@pitcher/js-api 1.21.0-beta.3 → 1.21.0-beta.5

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.
@@ -3,7 +3,7 @@ import { PitcherInfo } from '../../../types/app';
3
3
  import { ContentGridProps, CanvasBuilderProps } from '@canvas-builder/types/canvas';
4
4
  import { RecommendedContent } from '@canvas-builder/types/recommendations.types';
5
5
  import { Canvas } from '../../../../types/openapi';
6
- import { InstanceSettings } from '../../../types/instanceSettings';
6
+ import { InstanceSettings } from '../../../types/instanceSettings.types';
7
7
 
8
8
  declare function autofillCanvasContentGridsWithAi(filesFetcher: NonNullable<CanvasBuilderProps['listFiles']>): Promise<void>;
9
9
  declare function autofillSectionContentGridsWithAi(filesFetcher: NonNullable<CanvasBuilderProps['listFiles']>): Promise<void>;
@@ -17,6 +17,7 @@ declare function autofillCanvasContentGridsWithMatchingProperties(options: {
17
17
  filesFetcher: NonNullable<CanvasBuilderProps['listFiles']>;
18
18
  http: AxiosInstance;
19
19
  pitcherInfo: PitcherInfo;
20
+ instanceSettings?: InstanceSettings;
20
21
  }): Promise<void>;
21
22
  declare function cleanup(): void;
22
23
  export default function useRecommendations(): {
@@ -10,7 +10,7 @@ export type InactiveEventPayload = {
10
10
  export default function (track: (eventName: string, payload: any) => void, pitcherApi?: ReturnType<typeof usePitcherApi>): {
11
11
  registerInactiveEvent: ({ id, payload, enterEvent, exitEvent, type, }: {
12
12
  id: string;
13
- payload: InactiveEventPayload;
13
+ payload: InactiveEventPayload | (() => InactiveEventPayload);
14
14
  enterEvent: (typeof CDP_EVENT_TYPE)[keyof typeof CDP_EVENT_TYPE];
15
15
  exitEvent: (typeof CDP_EVENT_TYPE)[keyof typeof CDP_EVENT_TYPE];
16
16
  type?: EventType;
package/lib/main.lib.d.ts CHANGED
@@ -149,13 +149,14 @@ export * from './types/vueVirtualScroller';
149
149
  export * from './components/CUsersGroupsAccessManage/CUsersGroupsAccessManage.types';
150
150
  export * from './types/translations';
151
151
  export * from './types/organization.types';
152
+ export * from './types/instance.types';
152
153
  export * from './types/iframes';
153
154
  export * from './apps/canvas-builder/types/canvas';
154
155
  export type * from './composables/useWindowEvents';
155
156
  export * from './types/call';
156
157
  export * from './types/launchDarkly.types';
157
158
  export * from './types/toast';
158
- export * from './types/instanceSettings';
159
+ export * from './types/instanceSettings.types';
159
160
  export * from './components/CConfigEditor/CConfigEditor.types';
160
161
  export * from './constants/cdp.const';
161
162
  export * from './constants/uploads.const';
@@ -0,0 +1,4 @@
1
+ import { PitcherEnv } from '../interfaces';
2
+
3
+ export declare const setEnv: (e: PitcherEnv) => void;
4
+ export declare const onlineRestApiHandlers: Record<string, any>;
@@ -1,6 +1,7 @@
1
1
  import { Emitter } from './utils/eventEmitter';
2
- import { Favorite, File, Instance, User, Canvas } from '../../types/openapi';
2
+ import { Favorite, File, User, Canvas } from '../../types/openapi';
3
3
  import { PitcherOrg } from '../types/organization.types';
4
+ import { PitcherInstance } from '../types/instance.types';
4
5
  import { PaginatedData } from '../types/paginatedData';
5
6
  import { LaunchDarklyEnv } from '../types/launchDarkly.types';
6
7
  import { CLIENT_TYPE } from '../constants/cdp.const';
@@ -22,17 +23,19 @@ export interface PitcherMessage {
22
23
  body?: Record<string, any>;
23
24
  };
24
25
  }
26
+ type FetchMode = 'postmessage' | 'prefer-online';
25
27
  export interface ApiOptions {
26
28
  errorLogger?: (p: any) => string | void;
27
29
  logLevel?: 'off' | 'info' | 'debug';
28
30
  casing?: 'camel' | 'snake';
31
+ fetchMode?: FetchMode;
29
32
  }
30
33
  export interface PitcherEnv {
31
34
  mode: 'WEB' | 'IOS' | 'WINDOWS' | 'ANDROID';
32
35
  pitcher: {
33
36
  token_claims: Record<string, any>;
34
37
  organization: PitcherOrg;
35
- instance: Instance;
38
+ instance: PitcherInstance;
36
39
  user: User;
37
40
  access_token: string;
38
41
  id_token: string;
package/lib/sdk/main.d.ts CHANGED
@@ -54,7 +54,7 @@ export declare function useDsr(): {
54
54
  } & Record<string, typeof dsr.on | typeof dsr.getEnv | typeof dsr.embeddable_ready>;
55
55
  export type JsApiLocation = 'ui' | 'admin' | 'dsr' | 'impact';
56
56
  export declare function getAvailableApis(): JsApiLocation[];
57
- export declare function useApi(): {
57
+ export declare function useApi(options?: ApiOptions): {
58
58
  on: (type: string, callback: (payload: import('./interfaces').PitcherEvent) => void) => void;
59
59
  off: (type: string, callback: (payload: import('./interfaces').PitcherEvent) => void) => void;
60
60
  enterFullscreen: () => Promise<any>;
@@ -0,0 +1,15 @@
1
+ type FetchOptions = {
2
+ method?: string;
3
+ headers?: Record<string, string>;
4
+ body?: string;
5
+ credentials?: RequestCredentials;
6
+ params?: Record<string, any>;
7
+ };
8
+ export declare function createHttpClient(origin: string, token: string): {
9
+ get: (endpoint: string, options?: FetchOptions) => Promise<any>;
10
+ post: (endpoint: string, body?: object, options?: FetchOptions) => Promise<any>;
11
+ put: (endpoint: string, body: object, options?: FetchOptions) => Promise<any>;
12
+ delete: (endpoint: string, options?: FetchOptions) => Promise<any>;
13
+ patch: (endpoint: string, body: object, options?: FetchOptions) => Promise<any>;
14
+ };
15
+ export {};
@@ -0,0 +1,18 @@
1
+ import { Instance, InstanceUpdate, InstanceUpdateRequest, InstanceRequest, PatchedInstanceUpdateRequest } from '../../types/openapi';
2
+ import { InstanceSettings } from './instanceSettings.types';
3
+
4
+ export interface PitcherInstance extends Omit<Instance, 'settings'> {
5
+ readonly settings?: InstanceSettings;
6
+ }
7
+ export interface PitcherInstanceUpdate extends Omit<InstanceUpdate, 'settings'> {
8
+ settings?: InstanceSettings | null;
9
+ }
10
+ export interface PitcherInstanceUpdateRequest extends Omit<InstanceUpdateRequest, 'settings'> {
11
+ settings?: InstanceSettings | null;
12
+ }
13
+ export interface PitcherPatchedInstanceUpdateRequest extends Omit<PatchedInstanceUpdateRequest, 'settings'> {
14
+ settings?: InstanceSettings | null;
15
+ }
16
+ export interface PitcherInstanceRequest extends Omit<InstanceRequest, 'settings'> {
17
+ settings?: InstanceSettings | null;
18
+ }
@@ -12,10 +12,12 @@ export type CanvasComponentAvailability = {
12
12
  [component in CanvasComponentTypes]: boolean;
13
13
  };
14
14
  export type InstanceSettings = {
15
+ impact_show_only_saved_canvases_in_canvas_manager?: boolean;
15
16
  canvas?: {
16
17
  component_availability?: CanvasComponentAvailability & {
17
18
  apps?: Record<string, boolean>;
18
19
  };
19
- autofill_metadata_mismatch_properties?: string[];
20
+ content_grid_autofill_files_filter_iteratee?: string;
21
+ section_content_grid_autofill_files_filter_iteratee?: string;
20
22
  };
21
23
  };
@@ -1,6 +1,6 @@
1
1
  import { TranslationOverrides } from './translations';
2
2
 
3
- export type LaunchDarklyBooleanFlagKey = 'allow_ai_prompts_in_canvas_text' | 'allow_bulk_actions_canvases_files' | 'allow_canvas_duplication' | 'allow_canvas_history' | 'allow_canvas_ownership_change' | 'allow_content_grid_autofill' | 'allow_creating_canvas_with_no_template' | 'allow_embeddable_hiding' | 'allow_note_taking' | 'allow_rep_canvas_metadata_edit' | 'allow_rep_file_upload' | 'are_sections_system_controlled' | 'copy_context_to_canvas' | 'copy_template_metadata_to_canvas' | 'disable_canvas_edit_for_reps' | 'disable_file_edit_content' | 'disable_fullscreen_canvas_builder' | 'disable_impact_web_browser_fullscreen' | 'display_section_list_name' | 'enable_analytics' | 'enable_canvas_node_debugging' | 'enable_experimental_canvas_builder_dnd' | 'hide_asset_uploader' | 'interpolate_rep_canvases_on_edit_mode' | 'is_fe_sentry_enabled' | 'is_meeting_bar_account_selection_disabled' | 'is_meeting_bar_hidden' | 'is_rep_canvas_creation_disabled' | 'is_shared_link_creation_disabled' | 'is_timeline_component_allowed' | 'launch_in_full_screen_on_present_mode' | 'launch_in_present_mode_on_creation' | 'reorder_component_in_drawer' | 'show_asset_manager_for_multimedia' | 'show_popularity_icons' | 'show_system_filters';
3
+ export type LaunchDarklyBooleanFlagKey = 'allow_ai_prompts_in_canvas_text' | 'allow_bulk_actions_canvases_files' | 'allow_canvas_duplication' | 'allow_canvas_history' | 'allow_canvas_ownership_change' | 'allow_content_grid_autofill' | 'allow_creating_canvas_with_no_template' | 'allow_embeddable_hiding' | 'allow_note_taking' | 'allow_rep_canvas_metadata_edit' | 'allow_rep_file_upload' | 'are_sections_system_controlled' | 'copy_context_to_canvas' | 'copy_template_metadata_to_canvas' | 'disable_canvas_edit_for_reps' | 'disable_file_edit_content' | 'disable_fullscreen_canvas_builder' | 'disable_impact_web_browser_fullscreen' | 'display_section_list_name' | 'enable_analytics' | 'enable_canvas_node_debugging' | 'enable_experimental_canvas_builder_dnd' | 'hide_asset_uploader' | 'interpolate_rep_canvases_on_edit_mode' | 'is_fe_sentry_enabled' | 'is_meeting_bar_account_selection_disabled' | 'is_meeting_bar_hidden' | 'is_rep_canvas_creation_disabled' | 'is_shared_link_creation_disabled' | 'is_timeline_component_allowed' | 'launch_in_full_screen_on_present_mode' | 'launch_in_present_mode_on_creation' | 'reorder_component_in_drawer' | 'show_asset_manager_for_multimedia' | 'show_popularity_icons' | 'show_system_filters' | 'prefer_online_handlers';
4
4
  type LaunchDarklyObjectFlags = {
5
5
  canvas_table_pagination: CanvasTablePagination;
6
6
  canvas_manager_table_columns: CanvasManagerTableColumns;
@@ -6,9 +6,9 @@ export interface PitcherOrg extends Omit<Organization, 'metadata' | 'settings'>
6
6
  readonly metadata: OrganizationMetadata;
7
7
  readonly settings: OrganizationSettings;
8
8
  }
9
- export interface OrganizationUpdateExtended extends Omit<OrganizationUpdate, 'settings'> {
9
+ export interface PitcherOrganizationUpdate extends Omit<OrganizationUpdate, 'settings'> {
10
10
  settings?: OrganizationSettings | null;
11
11
  }
12
- export interface OrganizationUpdateRequestExtended extends Omit<OrganizationUpdateRequest, 'settings'> {
12
+ export interface PitcherOrganizationUpdateRequest extends Omit<OrganizationUpdateRequest, 'settings'> {
13
13
  settings?: OrganizationSettings | null;
14
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pitcher/js-api",
3
- "version": "1.21.0-beta.3",
3
+ "version": "1.21.0-beta.5",
4
4
  "type": "module",
5
5
  "main": "js-api.umd.min.js",
6
6
  "module": "js-api.esm.js",