commandbar 1.6.8 → 1.6.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  import 'proxy-polyfill';
2
2
  import 'es6-object-assign/auto';
3
3
  import 'es6-symbol/implement';
4
- import { IConfigEndpointResponse } from '@commandbar/internal/middleware/types';
4
+ import { IConfigEndpointResponse } from '../../internal/src/middleware/types';
5
5
  interface IInitOptions {
6
6
  debug?: boolean;
7
7
  environment?: string;
@@ -30,6 +30,10 @@ export interface AddContextOptions {
30
30
  quickFind?: boolean;
31
31
  /** Turn on unfurling for `key`. */
32
32
  unfurl?: boolean;
33
+ /** Show records by default with no input */
34
+ showInDefaultEmptyState?: boolean;
35
+ /** Sort key */
36
+ categorySortKey?: number;
33
37
  };
34
38
  /** Options to customize the style of `key` objects. */
35
39
  renderOptions?: {
@@ -49,7 +53,10 @@ export interface AddContextOptions {
49
53
  * A list of object fields to be searched. If a custom `searchFunction` is provided, matches will be highlighted in
50
54
  * these fields. Field names will be transformed from _camelCase_ or _snake_case_ into _Sentence case_.
51
55
  */
52
- fields?: string[];
56
+ fields?: (string | {
57
+ key: string;
58
+ label: string;
59
+ })[];
53
60
  /**
54
61
  * Adds a custom search function to CommandBar for `key`. This custom search function should take a single argument `input` and return an array of results.
55
62
  *
@@ -81,7 +88,10 @@ export interface ArgumentOptions {
81
88
  * A list of object fields to be searched. If a custom `searchFunction` is provided, matches will be highlighted in
82
89
  * these fields. Field names will be transformed from _camelCase_ or _snake_case_ into _Sentence case_.
83
90
  */
84
- searchableFields?: string[];
91
+ searchableFields?: (string | {
92
+ key: string;
93
+ label: string;
94
+ })[];
85
95
  onInputChange?: SearchFunction | SearchFunctionPaginated;
86
96
  }
87
97
  export interface RecordOptions extends ArgumentOptions {
@@ -90,5 +100,9 @@ export interface RecordOptions extends ArgumentOptions {
90
100
  categoryName?: string;
91
101
  /** Turn on unfurling for `key`. */
92
102
  unfurl?: boolean;
103
+ /** Show records by default with no input */
104
+ showInDefaultEmptyState?: boolean;
105
+ /** Sort key */
106
+ categorySortKey?: number;
93
107
  };
94
108
  }
@@ -2,7 +2,9 @@ import { AddContextOptions, ArgumentOptions, DataRow, RecordOptions } from './Ad
2
2
  import { EventHandler } from './EventHandler';
3
3
  import { ICommandFromClientType } from '../middleware/ICommandFromClientType';
4
4
  import { IResourceSettings } from '../middleware/IResourceSettings';
5
- import { ICommandCategoryType } from '../middleware/types';
5
+ import { ICommandCategoryType, DetailPreviewType, DataRowMedata } from '../middleware/types';
6
+ export type { DataRow } from './AddContextOptions';
7
+ export type { DataRowMedata } from '../middleware/types';
6
8
  export declare const ASYNC_METHODS: Array<keyof CommandBarClientSDK>;
7
9
  export declare type BootOptions = string | (UserAttributes & {
8
10
  id: string;
@@ -181,6 +183,14 @@ export declare type CommandBarClientSDK = Readonly<{
181
183
  * @param id The command id to execute. For commands defined via the Editor, you can find this id in the Editor by selecting "Copy code" in the command's ellipsis menu. For commands defined via the SDK, this is the `name` field.
182
184
  */
183
185
  execute(id: number | string): void;
186
+ /**
187
+ * Defines a function
188
+ *
189
+ * @param fn The preview detail generator function. It should accept the following arguments:
190
+ * * `row` {any}
191
+ * * `node` {any}
192
+ */
193
+ generateDetailPreview(fn: (data: DataRow, metadata: DataRowMedata) => undefined | DetailPreviewType): void;
184
194
  /**
185
195
  * Returns an array returning all commands that fit the optional filter function. By default, all commands are returned
186
196
  * @param filter A function that filters out commands based on its properties. These are:
@@ -237,7 +247,7 @@ export declare type CommandBarClientSDK = Readonly<{
237
247
  * @param slug Component slug
238
248
  * @param getHTML Function that returns an html string to be rendered as the component
239
249
  */
240
- setCustomComponent(slug: 'header' | 'input' | 'sidepanel' | 'footer', getHTML: (step?: 'base' | 'multiselect' | 'longtextinput' | 'textinput' | 'select') => string): void;
250
+ setCustomComponent(slug: 'header' | 'input' | 'sidepanel' | 'footer' | 'navPaneHeader' | 'navPaneFooter', getHTML: (step?: 'base' | 'multiselect' | 'longtextinput' | 'textinput' | 'select') => string): void;
241
251
  /**
242
252
  * Similar to `addContext`, but also removes any keys that are omitted from the supplied `ctx` from context. It may be
243
253
  * helpful to use this to make large context changes, such as when a user logs out.
@@ -15,6 +15,8 @@ export interface AbandonedSearchEvent {
15
15
  numCommands: number;
16
16
  numRecords: number;
17
17
  };
18
+ /** command_ids of previously executed commands in the session */
19
+ previousCommands?: string[];
18
20
  }
19
21
  export interface ClosedEvent {
20
22
  /** Event data passed for `command_execution` events. */
@@ -38,8 +40,16 @@ export interface CommandExecutionEvent {
38
40
  source: string;
39
41
  /** DEPRECATED. The text input.*/
40
42
  ['inputText[*]']: string;
41
- /** The text input. */
42
- inputText: string;
43
+ /** The text input.*/
44
+ inputText?: string;
45
+ /** True if this command was triggered by a shortcut. */
46
+ shortcut?: boolean;
47
+ /** Ranking order of the command option */
48
+ ranking?: number;
49
+ /** command_ids of previously executed commands in the session */
50
+ previousCommands?: string[];
51
+ /** Command types, as defined at: https://www.commandbar.com/docs/commands/types/overview */
52
+ commandType?: 'admin' | 'link' | 'script' | 'clickByXpath' | 'clickBySelector' | 'click' | 'callback' | 'builtin' | 'webhook' | 'request' | 'appcues';
43
53
  }
44
54
  export interface EndUserShortcutChangedEvent {
45
55
  /** Event data passed for `command_execution` events. */
@@ -33,6 +33,31 @@ export declare const CommandFromClientV: t.IntersectionC<[t.TypeC<{
33
33
  object: t.StringC;
34
34
  hoverTooltip: t.BooleanC;
35
35
  operation: t.UnionC<[t.LiteralC<"router">, t.LiteralC<"self">, t.LiteralC<"blank">, t.UndefinedC]>;
36
+ }>]>]>, t.IntersectionC<[t.TypeC<{
37
+ type: t.LiteralC<"request">;
38
+ value: t.IntersectionC<[t.TypeC<{
39
+ method: t.UnionC<[t.LiteralC<"get">, t.LiteralC<"delete">, t.LiteralC<"head">, t.LiteralC<"options">, t.LiteralC<"post">, t.LiteralC<"put">, t.LiteralC<"patch">]>;
40
+ url: t.StringC;
41
+ }>, t.PartialC<{
42
+ headers: t.UnknownRecordC;
43
+ body: t.UnknownRecordC;
44
+ onSend: t.StringC;
45
+ onSuccess: t.StringC;
46
+ onError: t.StringC;
47
+ }>]>;
48
+ }>, t.IntersectionC<[t.TypeC<{}>, t.PartialC<{
49
+ commandType: t.UnionC<[t.LiteralC<"independent">, t.LiteralC<"object">, t.LiteralC<"help">]>;
50
+ object: t.StringC;
51
+ hoverTooltip: t.BooleanC;
52
+ operation: t.UnionC<[t.LiteralC<"router">, t.LiteralC<"self">, t.LiteralC<"blank">, t.UndefinedC]>;
53
+ }>]>]>, t.IntersectionC<[t.TypeC<{
54
+ type: t.LiteralC<"appcues">;
55
+ value: t.StringC;
56
+ }>, t.IntersectionC<[t.TypeC<{}>, t.PartialC<{
57
+ commandType: t.UnionC<[t.LiteralC<"independent">, t.LiteralC<"object">, t.LiteralC<"help">]>;
58
+ object: t.StringC;
59
+ hoverTooltip: t.BooleanC;
60
+ operation: t.UnionC<[t.LiteralC<"router">, t.LiteralC<"self">, t.LiteralC<"blank">, t.UndefinedC]>;
36
61
  }>]>]>]>;
37
62
  text: t.StringC;
38
63
  }>, t.PartialC<{
@@ -217,4 +242,11 @@ export declare const CommandFromClientV: t.IntersectionC<[t.TypeC<{
217
242
  value: t.StringC;
218
243
  reason: t.StringC;
219
244
  }>]>]>>;
245
+ detail: t.UnionC<[t.StringC, t.TypeC<{
246
+ type: t.UnionC<[t.LiteralC<"plaintext">, t.LiteralC<"markdown">, t.LiteralC<"html">, t.LiteralC<"react">, t.LiteralC<"video">, t.NullC]>;
247
+ value: t.StringC;
248
+ }>, t.ArrayC<t.TypeC<{
249
+ type: t.UnionC<[t.LiteralC<"plaintext">, t.LiteralC<"markdown">, t.LiteralC<"html">, t.LiteralC<"react">, t.LiteralC<"video">, t.NullC]>;
250
+ value: t.StringC;
251
+ }>>]>;
220
252
  }>]>;
@@ -1,3 +1,5 @@
1
1
  import * as t from 'io-ts';
2
2
  import { CommandFromClientV } from './CommandFromClientV';
3
+ import { ContextArgumentV } from './helpers/argument';
3
4
  export declare type ICommandFromClientType = t.TypeOf<typeof CommandFromClientV>;
5
+ export declare type IContextArgument = t.TypeOf<typeof ContextArgumentV>;
@@ -16,7 +16,10 @@ declare const OrganizationAdditionalV: t.TypeC<{
16
16
  search: t.BooleanC;
17
17
  label_field: t.StringC;
18
18
  useCategory: t.BooleanC;
19
- search_fields: t.ArrayC<t.StringC>;
19
+ search_fields: t.ArrayC<t.UnionC<[t.StringC, t.TypeC<{
20
+ key: t.StringC;
21
+ label: t.StringC;
22
+ }>]>>;
20
23
  auto_execute: t.BooleanC;
21
24
  unfurl: t.BooleanC;
22
25
  description_field: t.StringC;
@@ -25,12 +28,14 @@ declare const OrganizationAdditionalV: t.TypeC<{
25
28
  max_options_count: t.UnionC<[t.NumberC, t.NullC]>;
26
29
  sortFunction: t.AnyC;
27
30
  default_command_id: t.UnionC<[t.NumberC, t.StringC, t.UndefinedC]>;
31
+ render_as: t.UnionC<[t.LiteralC<"list">, t.LiteralC<"grid">]>;
28
32
  showResources: t.BooleanC;
29
33
  show_with_no_results: t.BooleanC;
30
34
  search_tab_enabled: t.BooleanC;
31
35
  search_tab_name: t.UnionC<[t.StringC, t.NullC]>;
32
36
  search_tab_instruction: t.UnionC<[t.StringC, t.NullC]>;
33
37
  setting_pin_to_bottom: t.BooleanC;
38
+ track_recents: t.BooleanC;
34
39
  }>>;
35
40
  should_show_onboarding: t.BooleanC;
36
41
  last_snippet_request: t.UnionC<[t.StringC, t.NullC]>;
@@ -42,9 +47,13 @@ declare const OrganizationAdditionalV: t.TypeC<{
42
47
  allow_event_handlers: t.BooleanC;
43
48
  in_bar_feedback: t.BooleanC;
44
49
  summon_hotkey_override: t.UnionC<[t.StringC, t.NullC]>;
45
- end_user_hotkeys: t.BooleanC;
50
+ end_user_hotkeys: t.UnionC<[t.UndefinedC, t.BooleanC]>;
51
+ end_user_shortcuts_enabled: t.BooleanC;
52
+ end_user_recents_enabled: t.BooleanC;
46
53
  releases_available: t.BooleanC;
47
54
  releases_enabled: t.BooleanC;
55
+ fallback_commands: t.ArrayC<t.NumberC>;
56
+ tab_direction: t.UnionC<[t.LiteralC<"horizontal">, t.LiteralC<"vertical">]>;
48
57
  }>;
49
58
  export declare const defaults: t.TypeOf<typeof OrganizationAdditionalV>;
50
59
  export declare const OrganizationV: t.IntersectionC<[t.IntersectionC<[t.TypeC<{
@@ -68,7 +77,10 @@ export declare const OrganizationV: t.IntersectionC<[t.IntersectionC<[t.TypeC<{
68
77
  search: t.BooleanC;
69
78
  label_field: t.StringC;
70
79
  useCategory: t.BooleanC;
71
- search_fields: t.ArrayC<t.StringC>;
80
+ search_fields: t.ArrayC<t.UnionC<[t.StringC, t.TypeC<{
81
+ key: t.StringC;
82
+ label: t.StringC;
83
+ }>]>>;
72
84
  auto_execute: t.BooleanC;
73
85
  unfurl: t.BooleanC;
74
86
  description_field: t.StringC;
@@ -77,12 +89,14 @@ export declare const OrganizationV: t.IntersectionC<[t.IntersectionC<[t.TypeC<{
77
89
  max_options_count: t.UnionC<[t.NumberC, t.NullC]>;
78
90
  sortFunction: t.AnyC;
79
91
  default_command_id: t.UnionC<[t.NumberC, t.StringC, t.UndefinedC]>;
92
+ render_as: t.UnionC<[t.LiteralC<"list">, t.LiteralC<"grid">]>;
80
93
  showResources: t.BooleanC;
81
94
  show_with_no_results: t.BooleanC;
82
95
  search_tab_enabled: t.BooleanC;
83
96
  search_tab_name: t.UnionC<[t.StringC, t.NullC]>;
84
97
  search_tab_instruction: t.UnionC<[t.StringC, t.NullC]>;
85
98
  setting_pin_to_bottom: t.BooleanC;
99
+ track_recents: t.BooleanC;
86
100
  }>>;
87
101
  should_show_onboarding: t.BooleanC;
88
102
  last_snippet_request: t.UnionC<[t.StringC, t.NullC]>;
@@ -94,9 +108,13 @@ export declare const OrganizationV: t.IntersectionC<[t.IntersectionC<[t.TypeC<{
94
108
  allow_event_handlers: t.BooleanC;
95
109
  in_bar_feedback: t.BooleanC;
96
110
  summon_hotkey_override: t.UnionC<[t.StringC, t.NullC]>;
97
- end_user_hotkeys: t.BooleanC;
111
+ end_user_hotkeys: t.UnionC<[t.UndefinedC, t.BooleanC]>;
112
+ end_user_shortcuts_enabled: t.BooleanC;
113
+ end_user_recents_enabled: t.BooleanC;
98
114
  releases_available: t.BooleanC;
99
115
  releases_enabled: t.BooleanC;
116
+ fallback_commands: t.ArrayC<t.NumberC>;
117
+ tab_direction: t.UnionC<[t.LiteralC<"horizontal">, t.LiteralC<"vertical">]>;
100
118
  }>]>;
101
119
  export declare type IOrganizationType = t.TypeOf<typeof OrganizationV>;
102
120
  export {};
@@ -1,10 +1,17 @@
1
1
  import * as t from 'io-ts';
2
+ export declare const SearchFieldConfigV: t.TypeC<{
3
+ key: t.StringC;
4
+ label: t.StringC;
5
+ }>;
2
6
  export declare const ResourceSettingsV: t.PartialC<{
3
7
  name: t.StringC;
4
8
  search: t.BooleanC;
5
9
  label_field: t.StringC;
6
10
  useCategory: t.BooleanC;
7
- search_fields: t.ArrayC<t.StringC>;
11
+ search_fields: t.ArrayC<t.UnionC<[t.StringC, t.TypeC<{
12
+ key: t.StringC;
13
+ label: t.StringC;
14
+ }>]>>;
8
15
  auto_execute: t.BooleanC;
9
16
  unfurl: t.BooleanC;
10
17
  description_field: t.StringC;
@@ -13,19 +20,24 @@ export declare const ResourceSettingsV: t.PartialC<{
13
20
  max_options_count: t.UnionC<[t.NumberC, t.NullC]>;
14
21
  sortFunction: t.AnyC;
15
22
  default_command_id: t.UnionC<[t.NumberC, t.StringC, t.UndefinedC]>;
23
+ render_as: t.UnionC<[t.LiteralC<"list">, t.LiteralC<"grid">]>;
16
24
  showResources: t.BooleanC;
17
25
  show_with_no_results: t.BooleanC;
18
26
  search_tab_enabled: t.BooleanC;
19
27
  search_tab_name: t.UnionC<[t.StringC, t.NullC]>;
20
28
  search_tab_instruction: t.UnionC<[t.StringC, t.NullC]>;
21
29
  setting_pin_to_bottom: t.BooleanC;
30
+ track_recents: t.BooleanC;
22
31
  }>;
23
32
  export declare const ResourceSettingsByContextKeyV: t.RecordC<t.StringC, t.PartialC<{
24
33
  name: t.StringC;
25
34
  search: t.BooleanC;
26
35
  label_field: t.StringC;
27
36
  useCategory: t.BooleanC;
28
- search_fields: t.ArrayC<t.StringC>;
37
+ search_fields: t.ArrayC<t.UnionC<[t.StringC, t.TypeC<{
38
+ key: t.StringC;
39
+ label: t.StringC;
40
+ }>]>>;
29
41
  auto_execute: t.BooleanC;
30
42
  unfurl: t.BooleanC;
31
43
  description_field: t.StringC;
@@ -34,10 +46,12 @@ export declare const ResourceSettingsByContextKeyV: t.RecordC<t.StringC, t.Parti
34
46
  max_options_count: t.UnionC<[t.NumberC, t.NullC]>;
35
47
  sortFunction: t.AnyC;
36
48
  default_command_id: t.UnionC<[t.NumberC, t.StringC, t.UndefinedC]>;
49
+ render_as: t.UnionC<[t.LiteralC<"list">, t.LiteralC<"grid">]>;
37
50
  showResources: t.BooleanC;
38
51
  show_with_no_results: t.BooleanC;
39
52
  search_tab_enabled: t.BooleanC;
40
53
  search_tab_name: t.UnionC<[t.StringC, t.NullC]>;
41
54
  search_tab_instruction: t.UnionC<[t.StringC, t.NullC]>;
42
55
  setting_pin_to_bottom: t.BooleanC;
56
+ track_recents: t.BooleanC;
43
57
  }>>;