commandbar 1.7.3 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- package/build/commandbar-js/src/index.js +1 -1
- package/package.json +2 -2
- package/src/snippet.ts +1 -0
- package/build/internal/src/client/AddContextOptions.d.ts +0 -123
- package/build/internal/src/client/AnalyticsEventTypes.d.ts +0 -1
- package/build/internal/src/client/CommandBarClientSDK.d.ts +0 -376
- package/build/internal/src/client/CommandBarProxySDK.d.ts +0 -49
- package/build/internal/src/client/CommandBarSDK.d.ts +0 -65
- package/build/internal/src/client/EventHandler.d.ts +0 -207
- package/build/internal/src/client/OrgConfig.d.ts +0 -5
- package/build/internal/src/client/SDKConfig.d.ts +0 -13
- package/build/internal/src/client/SentryReporter.d.ts +0 -62
- package/build/internal/src/client/globals.d.ts +0 -20
- package/build/internal/src/client/proxy.d.ts +0 -15
- package/build/internal/src/client/symbols.d.ts +0 -41
- package/build/internal/src/middleware/CommandFromClientV.d.ts +0 -290
- package/build/internal/src/middleware/ICommandFromClientType.d.ts +0 -5
- package/build/internal/src/middleware/IResourceSettings.d.ts +0 -3
- package/build/internal/src/middleware/OrganizationV.d.ts +0 -177
- package/build/internal/src/middleware/ResourceSettingsV.d.ts +0 -91
- package/build/internal/src/middleware/checklist.d.ts +0 -740
- package/build/internal/src/middleware/command.d.ts +0 -6678
- package/build/internal/src/middleware/commandCategory.d.ts +0 -192
- package/build/internal/src/middleware/confetti.d.ts +0 -16
- package/build/internal/src/middleware/context.d.ts +0 -40
- package/build/internal/src/middleware/dashboardFlags.d.ts +0 -9
- package/build/internal/src/middleware/detailPreview.d.ts +0 -24
- package/build/internal/src/middleware/environment.d.ts +0 -11
- package/build/internal/src/middleware/generics.d.ts +0 -40
- package/build/internal/src/middleware/guide.d.ts +0 -37
- package/build/internal/src/middleware/helpDocsIntegration.d.ts +0 -66
- package/build/internal/src/middleware/helpDocsSync.d.ts +0 -42
- package/build/internal/src/middleware/helpers/actions.d.ts +0 -84
- package/build/internal/src/middleware/helpers/argument.d.ts +0 -448
- package/build/internal/src/middleware/helpers/commandTemplate.d.ts +0 -225
- package/build/internal/src/middleware/helpers/endUser.d.ts +0 -11
- package/build/internal/src/middleware/helpers/goals.d.ts +0 -26
- package/build/internal/src/middleware/helpers/optionGroup.d.ts +0 -2
- package/build/internal/src/middleware/helpers/rules.d.ts +0 -260
- package/build/internal/src/middleware/helpers/tags.d.ts +0 -7
- package/build/internal/src/middleware/historyEvent.d.ts +0 -21
- package/build/internal/src/middleware/network.d.ts +0 -4
- package/build/internal/src/middleware/nudge.d.ts +0 -1057
- package/build/internal/src/middleware/organization.d.ts +0 -978
- package/build/internal/src/middleware/placeholder.d.ts +0 -47
- package/build/internal/src/middleware/profile.d.ts +0 -11
- package/build/internal/src/middleware/releases.d.ts +0 -261
- package/build/internal/src/middleware/skin.d.ts +0 -94
- package/build/internal/src/middleware/tab.d.ts +0 -27
- package/build/internal/src/middleware/types.d.ts +0 -155
- package/build/internal/src/middleware/user.d.ts +0 -15
- package/build/internal/src/util/Disposable.d.ts +0 -17
- package/build/internal/src/util/LocalStorage.d.ts +0 -6
- package/build/internal/src/util/Logger.d.ts +0 -18
- package/build/internal/src/util/dispatchCustomEvent.d.ts +0 -2
@@ -1,376 +0,0 @@
|
|
1
|
-
import { AddContextOptions, ArgumentOptions, DataRow, RecordOptions } from './AddContextOptions';
|
2
|
-
import { EventHandler, EventSubscriber } from './EventHandler';
|
3
|
-
import { ICommandFromClientType } from '../middleware/ICommandFromClientType';
|
4
|
-
import { IResourceSettings } from '../middleware/IResourceSettings';
|
5
|
-
import { ICommandCategoryType, DetailPreviewType, ISkinType } from '../middleware/types';
|
6
|
-
import { DataRowMetadata } from '../middleware/detailPreview';
|
7
|
-
export type { DataRow } from './AddContextOptions';
|
8
|
-
export type { DataRowMetadata } from '../middleware/types';
|
9
|
-
/**
|
10
|
-
* WARNING: We wary with adding methods to this list that have a fn as the first arg.
|
11
|
-
* Updating ASYNC_METHODS_SNIPPET will change how we parse a call in the queue. If a method is in this list, we assume
|
12
|
-
* it has Promise.resolve and Promise.reject unshifted to the arguments list. */
|
13
|
-
export declare const ASYNC_METHODS_SNIPPET: Array<keyof CommandBarClientSDK>;
|
14
|
-
export declare const ASYNC_METHODS: Array<keyof CommandBarClientSDK>;
|
15
|
-
export declare type BootOptions = string | (UserAttributes & {
|
16
|
-
id: string;
|
17
|
-
});
|
18
|
-
export declare type Metadata = Record<string, unknown>;
|
19
|
-
export declare type CommandDetails = {
|
20
|
-
category?: number | null;
|
21
|
-
/**
|
22
|
-
* The unique id of the command. For commands defined via the Editor, the value will be a number. For programmatic
|
23
|
-
* commands, the `name` (string) provided will be used.
|
24
|
-
*/
|
25
|
-
command: number | string | undefined;
|
26
|
-
/** The text of the command */
|
27
|
-
commandText: string;
|
28
|
-
/** The source of the command. */
|
29
|
-
source: string;
|
30
|
-
shortcut_mac: string;
|
31
|
-
shortcut_win: string;
|
32
|
-
customShortcut: string | undefined;
|
33
|
-
callbackKey: string | undefined;
|
34
|
-
};
|
35
|
-
export declare type UserAttributes = Record<string, unknown>;
|
36
|
-
export declare type ModalFormFactor = {
|
37
|
-
type: 'modal';
|
38
|
-
};
|
39
|
-
export declare type InlineFormFactor = {
|
40
|
-
type: 'inline';
|
41
|
-
rootElement: string | HTMLElement;
|
42
|
-
};
|
43
|
-
export declare type FormFactorConfig = ModalFormFactor | InlineFormFactor;
|
44
|
-
export declare type ProductConfig = Array<'bar' | 'nudges' | 'questlists'>;
|
45
|
-
export declare type FormFactor = Pick<FormFactorConfig, 'type'>;
|
46
|
-
export declare type InstanceAttributes = {
|
47
|
-
canOpenEditor: boolean;
|
48
|
-
hmac?: string;
|
49
|
-
formFactor: FormFactorConfig;
|
50
|
-
products: ProductConfig;
|
51
|
-
};
|
52
|
-
export declare type MetaAttributes = {
|
53
|
-
wp_plugin_version?: string;
|
54
|
-
};
|
55
|
-
export declare const DEFAULT_INSTANCE_ATTRIBUTES: InstanceAttributes;
|
56
|
-
export declare const DEFAULT_META_ATTRIBUTES: MetaAttributes;
|
57
|
-
export declare type CallbackFunction<T, U = Metadata> = (args: T, context: U) => void;
|
58
|
-
export declare type ContextLoader = (chosenValues?: undefined | Record<string, unknown[]>) => unknown;
|
59
|
-
export declare type RecordsOrArgumentListLoader = (chosenValues?: undefined | Record<string, unknown[]>) => DataRow[];
|
60
|
-
export declare type CallbackMap = {
|
61
|
-
[name: string]: CallbackFunction<any, any>;
|
62
|
-
};
|
63
|
-
export declare type CustomComponent = {
|
64
|
-
mount: (node: HTMLElement) => CustomComponentInstance;
|
65
|
-
};
|
66
|
-
export declare type CustomComponentInstance = {
|
67
|
-
render: (data?: DataRow, metadata?: DataRowMetadata) => void;
|
68
|
-
unmount: () => void;
|
69
|
-
};
|
70
|
-
export declare type CommandBarClientSDK = Readonly<{
|
71
|
-
/**
|
72
|
-
* Adds a callback function to CommandBar. The callback function provided is mapped to `callbackKey`, and can be
|
73
|
-
* attached to commands by referencing `callbackKey` in a command config.
|
74
|
-
*
|
75
|
-
* @param callbackKey Key to reference the provided function
|
76
|
-
* @param callbackFn Callback function, with the following signature:
|
77
|
-
* * `args`: Depends on the callback, but typically a dictionary of argument keys and the values entered by the user.
|
78
|
-
* * `context`: A dictionary reflecting the state of context when the callback was triggered by a command execution
|
79
|
-
*/
|
80
|
-
addCallback<T, U>(callbackKey: string, callbackFn: CallbackFunction<T, U>): void;
|
81
|
-
addCallbacks(callbacks: CallbackMap): void;
|
82
|
-
/**
|
83
|
-
* Add a command to CommandBar.
|
84
|
-
*
|
85
|
-
* @param command The command schema
|
86
|
-
*/
|
87
|
-
addCommand(command: ICommandFromClientType): Promise<void>;
|
88
|
-
/**
|
89
|
-
* Configure a Category
|
90
|
-
*
|
91
|
-
* @param category The id (or name) of the category. If you provide a name and that category doesn't exist, it will be created automatically.
|
92
|
-
* @param config The Category config schema
|
93
|
-
*/
|
94
|
-
setCategoryConfig(category: string | number, config: Partial<ICommandCategoryType>): void;
|
95
|
-
/**
|
96
|
-
* Provides a list of argument choices to CommandBar. For any keys previously set, updates values.
|
97
|
-
*
|
98
|
-
* @param key Key for the argument choices. Used to associate an argument with choices in the Editor.
|
99
|
-
*
|
100
|
-
* @param initialValue The initial choices
|
101
|
-
*
|
102
|
-
* There are two options:
|
103
|
-
* * Static: A literal value (e.g. `["foo", "bar"]`)
|
104
|
-
* * Dynamic: A function to load a set of values for `key`, used to lazily load a list of values. This function will
|
105
|
-
* be passed as an argument a dictionary of the previously selected argument values, if the argument is not the first. Useful for
|
106
|
-
* lazily loading longer lists, or loading lists that are dependent on previous arguments.
|
107
|
-
*
|
108
|
-
* If providing a list of objects, there are some reserved fields that will trigger special behavior. See DataRow type
|
109
|
-
* for the list of those fields.
|
110
|
-
*
|
111
|
-
* @param options Options to customize CommandBar properties for `key`.
|
112
|
-
*
|
113
|
-
* @see [ArgumentOptions](#ArgumentOptions).
|
114
|
-
*/
|
115
|
-
addArgumentChoices(key: string, initial: DataRow[] | RecordsOrArgumentListLoader, options?: ArgumentOptions): void;
|
116
|
-
/**
|
117
|
-
* Adds a key, value pair to CommandBar that can be referenced to customize commands: such as in command URLs, availability rules, and recommendation rules.
|
118
|
-
*
|
119
|
-
* @param key Key for the metadata. Used to reference metadata.
|
120
|
-
*
|
121
|
-
* @param value The value of the key
|
122
|
-
*
|
123
|
-
* There are two options:
|
124
|
-
* * Static: A literal value (e.g. `addMetadata('isAdmin', true)`)
|
125
|
-
* * Dynamic: A function to load a set of values for `key`, used to lazily load a value. Useful for
|
126
|
-
* lazily loading data.
|
127
|
-
*/
|
128
|
-
addMetadata(key: string, value: unknown | ContextLoader, addToUserProperties?: boolean): void;
|
129
|
-
addMetadataBatch(data: Metadata, addToUserProperties?: boolean): void;
|
130
|
-
trackEvent(key: string, properties: Metadata): void;
|
131
|
-
/** @deprecated Use addRecords, addArgumentChoices, or addMetadata instead. */
|
132
|
-
addContext(key: string, initialValue: ContextLoader, options?: AddContextOptions): void;
|
133
|
-
/** @deprecated Use addRecords, addArgumentChoices, or addMetadata instead. */
|
134
|
-
addContext(key: string, initialValue: unknown, options?: AddContextOptions): void;
|
135
|
-
/** @deprecated Use setContext instead. */
|
136
|
-
addContext(ctx: Metadata): void;
|
137
|
-
/** @deprecated Use addEventSubscriber instead. */
|
138
|
-
addEventHandler(eventHandler: EventHandler): Promise<void>;
|
139
|
-
/**
|
140
|
-
* Captures CommandBar events to be handled in your code / stored in your database. Ask the CommandBar team if you're
|
141
|
-
* interested in this feature.
|
142
|
-
*
|
143
|
-
* @param eventSubscriber A function for handling events generated by CommandBar. It should have the following signature:
|
144
|
-
* * `eventName`: The name of the event type. Here are the different event types:
|
145
|
-
* * `opened`: Bar open
|
146
|
-
* * `closed`: Bar close. When the bar is closed with input text, it triggers both a `closed` event and a
|
147
|
-
* `abandoned_search` (deadend). Executions do not trigger `closed` events.
|
148
|
-
* * `abandoned_search`: A deadend
|
149
|
-
* * `command_suggestion`: A command suggestion
|
150
|
-
* * `command_execution`: A command execution
|
151
|
-
* * `no_results_for_query`: When a user's query does not retrieve any results
|
152
|
-
* * `client_error`: An error encountered by CommandBar
|
153
|
-
* * `shortcut_edited`: When a user assigns or edits a command's shortcut
|
154
|
-
* * `eventData`: Event attributes (will differ based on the type of event). In addition to the data below, any
|
155
|
-
* [eventData you pass to .boot()](https://app.commandbar.com/sdk#boot-eventdata) will be added to each event.
|
156
|
-
* @returns A function to remove the event handler
|
157
|
-
*/
|
158
|
-
addEventSubscriber(eventSubscriber: EventSubscriber): Promise<() => void>;
|
159
|
-
/**
|
160
|
-
* Add a record action for a key
|
161
|
-
*
|
162
|
-
* @param recordKey The key for record for which to attach an action to
|
163
|
-
*
|
164
|
-
* @param action The record action
|
165
|
-
*
|
166
|
-
* @param isDefault Whether this record action should be the default. Only needs to be included if multiple record actions are provided
|
167
|
-
*
|
168
|
-
* @param showInDefaultList Whether this record action should also be shown in the default list as a command
|
169
|
-
*/
|
170
|
-
addRecordAction(recordKey: string, action: ICommandFromClientType, isDefault?: boolean, showInDefaultList?: boolean): Promise<void>;
|
171
|
-
/**
|
172
|
-
* Makes records available to CommandBar. Records are searchable data. For any keys previously set, updates values.
|
173
|
-
*
|
174
|
-
* @param key Key for the records. Used to refer to records in the Editor, such as when creating record actions.
|
175
|
-
*
|
176
|
-
* @param initialValue The initial records
|
177
|
-
*
|
178
|
-
* There are two options:
|
179
|
-
* * Static: A literal value (e.g. `["foo", "bar"]`)
|
180
|
-
* * Dynamic: A function to load a set of values for `key`, used to lazily load a list of values. * Useful for
|
181
|
-
* lazily loading longer lists of records.
|
182
|
-
*
|
183
|
-
* If providing a list of objects, there are some reserved fields that will trigger special behavior. See DataRow type
|
184
|
-
* for the list of those fields.
|
185
|
-
*
|
186
|
-
* @param options Options to customize CommandBar properties for `key`.
|
187
|
-
*
|
188
|
-
* @see [RecordOptions](#RecordOptions).
|
189
|
-
*/
|
190
|
-
addRecords(key: string, initial: DataRow[] | RecordsOrArgumentListLoader, options?: RecordOptions): void;
|
191
|
-
/**
|
192
|
-
* Adds a search endpoint to CommandBar that returns results for multiple record types.
|
193
|
-
*
|
194
|
-
* @param onInputChange search endpoint to call for the specified record keys
|
195
|
-
* @param keys Record keys that this search endppoint covers
|
196
|
-
*/
|
197
|
-
addMultiSearch(onInputChange: (input: string) => Promise<any>, keys: string[]): void;
|
198
|
-
/**
|
199
|
-
* Sets a router function that link command can use to update the page's URL without triggering a reload. To lean more about using `addRouter` see [Adding a router](https://app.commandbar.com/docs/dev/router).
|
200
|
-
*
|
201
|
-
* @param routerFn The router function. It should accept the following arguments:
|
202
|
-
* * `url` {string} The url to navigate to
|
203
|
-
*/
|
204
|
-
addRouter(routerFn: (url: string) => void): void;
|
205
|
-
/** @deprecated Use addContext instead. */
|
206
|
-
addSearch(name: string, func: (...args: unknown[]) => unknown): void;
|
207
|
-
/**
|
208
|
-
* Make CommandBar available to the user. CommandBar will not be available before `.boot` is called, even if the
|
209
|
-
* snippet has been run on the page they are on.
|
210
|
-
*
|
211
|
-
* @param id ID corresponding to the currently logged-in end user. Used to tag analytics events.
|
212
|
-
* @param metadata Key-value pairs to be associated with the end user for whom CommandBar is being booted. You can
|
213
|
-
* filter on these attributes from the analytics page in your dashboard. In addition, events passed to a supplied
|
214
|
-
* event handler will include metadata you provide via `boot`.
|
215
|
-
*/
|
216
|
-
boot(id: string, userAttributes?: UserAttributes, instanceAttributes?: Partial<InstanceAttributes>): Promise<void>;
|
217
|
-
/**
|
218
|
-
* @deprecated Passing an object to boot will be deprecated in a future version of CommandBar.
|
219
|
-
*/
|
220
|
-
boot(opts: BootOptions): Promise<void>;
|
221
|
-
/**
|
222
|
-
* Changes the Bar form factor; can be set to either Modal (the default) or Inline.
|
223
|
-
*
|
224
|
-
* @param formFactorConfig either {type: 'modal'} or {type: 'inline', rootElement: (id of an element on the page) or an HTMLElement}
|
225
|
-
*/
|
226
|
-
setFormFactor(formFactorConfig: FormFactorConfig): Promise<void>;
|
227
|
-
close(): void;
|
228
|
-
/**
|
229
|
-
* Executes a command. If this command has arguments, the Bar will open so the user can complete those arguments.
|
230
|
-
*
|
231
|
-
* @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.
|
232
|
-
*/
|
233
|
-
execute(id: number | string): void;
|
234
|
-
/**
|
235
|
-
* Defines a function
|
236
|
-
*
|
237
|
-
* @param fn The preview detail generator function. It should accept the following arguments:
|
238
|
-
* * `row` {any}
|
239
|
-
* * `node` {any}
|
240
|
-
*/
|
241
|
-
generateDetailPreview(fn: (data: DataRow, metadata: DataRowMetadata) => undefined | DetailPreviewType): void;
|
242
|
-
addComponent(key: string, name: string, component: CustomComponent): void;
|
243
|
-
removeComponent(key: string): void;
|
244
|
-
/**
|
245
|
-
* Returns an array returning all commands that fit the optional filter function. By default, all commands are returned
|
246
|
-
* @param filter A function that filters out commands based on its properties. These are:
|
247
|
-
* * `command`: The unqiue id of the command. For commands defined via the Editor, the value will be a number. For programmatic commands, the name (string) provided will be used.
|
248
|
-
* * `commandText`: The text of the command
|
249
|
-
* * `category`: The category id of the command. Only provided if the command has a category
|
250
|
-
* * `callbackKey`: The command's callback key, if the command has one
|
251
|
-
* * `shortcut_mac`: Default shortcut set for macOS
|
252
|
-
* * `shortcut_win`:Default shortcut set for Windows and Linux devices
|
253
|
-
* * `source`: Source of the executed command
|
254
|
-
* * `customShortcut`: Shortcut string if this command has a custom user-set shortcut
|
255
|
-
*/
|
256
|
-
getCommands(filter?: (entry: CommandDetails) => boolean): CommandDetails[];
|
257
|
-
/**
|
258
|
-
* Returns `true` if the Bar is currently open, `false` if it is not, or `undefined` if the CommandBar is not fully
|
259
|
-
* initialized yet.
|
260
|
-
*/
|
261
|
-
isOpen(): boolean | undefined;
|
262
|
-
/**
|
263
|
-
* Open the Bar. If an input is supplied, will prefill the search input with that value.
|
264
|
-
*
|
265
|
-
* @param input Optional input ot prefill the Bar's search field.
|
266
|
-
* @param options FIXME: UNDOCUMENTED
|
267
|
-
*/
|
268
|
-
open(input?: string, options?: {
|
269
|
-
categoryFilter?: number | string;
|
270
|
-
}): void;
|
271
|
-
/**
|
272
|
-
* Open the in-app Editor
|
273
|
-
*/
|
274
|
-
openEditor(): void;
|
275
|
-
/**
|
276
|
-
* Open the Help Hub.
|
277
|
-
*/
|
278
|
-
openHelpHub(): void;
|
279
|
-
/**
|
280
|
-
* Removes the callback function referenced by `callbackKey` from CommandBar.
|
281
|
-
*
|
282
|
-
* When you remove a callback, any commands for which the callback is a dependency will become unavailable. Learn
|
283
|
-
* more about availability [here](https://app.commandbar.com/docs/commands/availability).
|
284
|
-
*
|
285
|
-
* @param callbackKey Callback key for the callback to be removed.
|
286
|
-
*/
|
287
|
-
removeCallback(callbackKey: string): void;
|
288
|
-
/**
|
289
|
-
* Remove a command, making it unavailable to a user.
|
290
|
-
*
|
291
|
-
* @param commandName The `name` field of the command
|
292
|
-
*/
|
293
|
-
removeCommand(commandName: string): void;
|
294
|
-
/**
|
295
|
-
* Removes a key and its corresponding value from context. When you remove a context key, any commands for which the
|
296
|
-
* key was a depencdency will become unavailable. To learn more about availability, see
|
297
|
-
* [When are commands available to users?](https://app.commandbar.com/docs/commands/availability)
|
298
|
-
*
|
299
|
-
* @param keyToRemove Context key to remove
|
300
|
-
*/
|
301
|
-
removeContext(keyToRemove: string): void;
|
302
|
-
/**
|
303
|
-
* Overrides certain components with provided options. Ask the CommandBar team if you're interested in this feature.
|
304
|
-
* Custom UI components are only available for enterprise customers. Please contact CommandBar.
|
305
|
-
* @param slug Component slug
|
306
|
-
* @param getHTML Function that returns an html string to be rendered as the component
|
307
|
-
*/
|
308
|
-
setCustomComponent(slug: 'header' | 'input' | 'sidepanel' | 'footer' | 'navPaneHeader' | 'navPaneFooter' | 'defaultState' | 'emptyState', getHTML: (step?: 'base' | 'multiselect' | 'longtextinput' | 'textinput' | 'select' | 'dashboard') => string | CustomComponent): void;
|
309
|
-
/**
|
310
|
-
* Similar to `addContext`, but also removes any keys that are omitted from the supplied `ctx` from context. It may be
|
311
|
-
* helpful to use this to make large context changes, such as when a user logs out.
|
312
|
-
*
|
313
|
-
* @param context Dictionary to overwrite context
|
314
|
-
* @param meta FIXME: UNDOCUMENTED
|
315
|
-
*/
|
316
|
-
setContext(context: Metadata, meta?: Metadata & {
|
317
|
-
useCustom?: boolean;
|
318
|
-
customID?: string | number;
|
319
|
-
}): void;
|
320
|
-
/**
|
321
|
-
* This method will override the hotkey used by the current user to summon CommandBar.
|
322
|
-
*
|
323
|
-
* Please note that this method will only work if your Organization as End User Customizable Shortcuts enabled.
|
324
|
-
*
|
325
|
-
* @param {string} hotkey Any mousetrap.js compliant string (e.g. 'mod+k')
|
326
|
-
* @returns {boolean} Returns false if the hotkey string is invalid
|
327
|
-
*/
|
328
|
-
setSummonHotkey(hotkey: string | null): boolean;
|
329
|
-
/**
|
330
|
-
* Changes the background and primary color of the CommandBar to the supplied color.
|
331
|
-
*
|
332
|
-
* @param theme A hex color. Using 'light' or 'dark' will trigger CommandBar's default light or dark theme.
|
333
|
-
* @param [primaryColor] A hex color.
|
334
|
-
*/
|
335
|
-
setTheme(theme: string | 'light' | 'dark' | Pick<ISkinType, 'logo' | 'skin'>, primaryColor?: string): void;
|
336
|
-
/**
|
337
|
-
* Returns dictionary representing the current callbacks currently stored within CommandBar. The keys represent
|
338
|
-
* callback keys, and the values are the supplied functions.
|
339
|
-
*/
|
340
|
-
shareCallbacks(): Record<string, CallbackFunction<unknown>>;
|
341
|
-
/**
|
342
|
-
* Returns dictionary representing the Custom Components currently defined (via addComponent).
|
343
|
-
*
|
344
|
-
* The keys represent component keys, and the value is the name of the component.
|
345
|
-
*/
|
346
|
-
shareComponentNamesByKey(): Record<string, string>;
|
347
|
-
/** Returns the key value dictionary representing the current state of context */
|
348
|
-
shareContext(): Metadata;
|
349
|
-
/**
|
350
|
-
* Get information about the current status of CommandBar
|
351
|
-
*/
|
352
|
-
shareState(): {
|
353
|
-
isBooted: boolean;
|
354
|
-
currentInput: string;
|
355
|
-
};
|
356
|
-
/** Returns whether or not the end user is successfully verified using HMAC */
|
357
|
-
isUserVerified(): boolean;
|
358
|
-
/**
|
359
|
-
* Make CommandBar unavailable to the user. Does nothing unless `.boot` has been called. `shutdown` is typically used
|
360
|
-
* to make CommandBar unavailable after logout.
|
361
|
-
*/
|
362
|
-
shutdown(): void;
|
363
|
-
/**
|
364
|
-
* Manually trigger client search functions.
|
365
|
-
*
|
366
|
-
* Allows search functions to be re-triggered with the same input text.
|
367
|
-
*/
|
368
|
-
triggerSearchFunctions(): void;
|
369
|
-
/** @deprecated Use addContext instead. */
|
370
|
-
updateContextSettings(key: string, settings: IResourceSettings): void;
|
371
|
-
/**
|
372
|
-
* Completely remove CommandBar from the page. You will need to re-run the snippet or call the init() function again
|
373
|
-
* (depending on your deployment method) to load CommandBar again.
|
374
|
-
*/
|
375
|
-
unmount(): void;
|
376
|
-
}>;
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import { OrgConfig } from './OrgConfig';
|
2
|
-
import { SDKConfig } from './CommandBarSDK';
|
3
|
-
import { _configuration, _disposed, _isProxy, _queue, _reporter, _unwrap, _orgConfig, _eventSubscriptions } from './symbols';
|
4
|
-
/**
|
5
|
-
* A proxy object that absorbs function calls into a queue that can be later consumed. The queue contains the name of
|
6
|
-
* properties accessed for function calls including any arguments passed.
|
7
|
-
*
|
8
|
-
* This is useful to allow clients to "queue up" calls to the SDK before it can be "upgraded" with state and callbacks
|
9
|
-
* from the React component tree.
|
10
|
-
*/
|
11
|
-
export declare type CommandBarProxySDK = CommandBarProxyGlobal & Record<string, Function> & {
|
12
|
-
[_configuration]?: Function | Partial<SDKConfig>;
|
13
|
-
[_orgConfig]?: Function | OrgConfig;
|
14
|
-
[_reporter]?: Function | any;
|
15
|
-
};
|
16
|
-
/**
|
17
|
-
* The global SDK object, which is usually hidden behind a Proxy at `window.CommandBar`. Use
|
18
|
-
* `window.CommandBar[_unwrap]()` (or ideally `getProxySDK()`) from anywhere to access this.
|
19
|
-
*
|
20
|
-
* The properties defined here are the minimal properties that can always be expected to be present in the global
|
21
|
-
* object. Many more are added once "upgraded" using `initSDK`.
|
22
|
-
*/
|
23
|
-
export interface CommandBarProxyGlobal {
|
24
|
-
/**
|
25
|
-
* Marks the proxy as disposed when true; this will cause a new global object to be created with the next `getSDK()`
|
26
|
-
* or `getProxySDK()` call.
|
27
|
-
*/
|
28
|
-
[_disposed]: boolean;
|
29
|
-
[_isProxy]: true;
|
30
|
-
/**
|
31
|
-
* A command queue that builds up commands executed early in the application lifecycle, before the App component has
|
32
|
-
* had a chance to render.
|
33
|
-
*/
|
34
|
-
[_queue]: unknown[][];
|
35
|
-
/**
|
36
|
-
* A sneaky way to get access to the object that's being proxied, the one that holds the real global state. Use this
|
37
|
-
* to avoid triggering unwanted proxy behavior when accessing properties that are unassigned.
|
38
|
-
*
|
39
|
-
* The typedefs of the optional properties (_org, _reporter) in CommandBarProxySDK illustrate the risk of working with
|
40
|
-
* a wrapped proxy global.
|
41
|
-
*/
|
42
|
-
[_unwrap]: () => CommandBarProxyGlobal;
|
43
|
-
[_configuration]?: Partial<SDKConfig>;
|
44
|
-
[_orgConfig]?: OrgConfig;
|
45
|
-
[_reporter]?: any;
|
46
|
-
[_eventSubscriptions]: undefined;
|
47
|
-
}
|
48
|
-
/** Tests if the given object is a "proxy" SDK object that has not yet been upgraded to a client SDK object. */
|
49
|
-
export declare function isProxySDK(x: unknown): x is CommandBarProxySDK;
|
@@ -1,65 +0,0 @@
|
|
1
|
-
import { CommandBarClientSDK, InstanceAttributes, MetaAttributes, Metadata } from './CommandBarClientSDK';
|
2
|
-
import { EVENT_NAME } from './AnalyticsEventTypes';
|
3
|
-
import { SentryReporter } from './SentryReporter';
|
4
|
-
import { _access, _configuration, _configure, _configUser, _dispose, _disposed, _eventSubscriptions, _userAttributes, _isProxy, _loadEditor, _orgConfig, _perf, _programmaticTheme, _reloadCommands, _reloadOrganization, _reloadPlaceholders, _reloadNudges, _previewNudge, _stopChecklistPreview, _stopNudgePreview, _reloadChecklists, _report, _reporter, _search, _setDashboard, _setPreviewMode, _setTestMode, _showGuide, _showMessage, _user, _instanceAttributes, _setEditorVisible, _shareConfig, _shareContextSettings, _shareProgrammaticCommands, _metaAttributes, _previewChecklist } from './symbols';
|
5
|
-
import { SDKConfig } from './SDKConfig';
|
6
|
-
import { IChecklist, ICommandType, INudgeType, IResourceSettingsByContextKey } from '../middleware/types';
|
7
|
-
import { OrgConfig } from './OrgConfig';
|
8
|
-
import { EventSubscriber } from './EventHandler';
|
9
|
-
export type { SDKConfig } from './SDKConfig';
|
10
|
-
export interface CommandBarInternalSDK {
|
11
|
-
[_access]: string | undefined;
|
12
|
-
[_instanceAttributes]: InstanceAttributes;
|
13
|
-
[_metaAttributes]: MetaAttributes;
|
14
|
-
[_perf]: boolean;
|
15
|
-
[_programmaticTheme]: string | undefined;
|
16
|
-
[_reporter]: SentryReporter | undefined;
|
17
|
-
[_search]: string;
|
18
|
-
[_user]: string | undefined;
|
19
|
-
[_userAttributes]: Metadata | undefined;
|
20
|
-
[_eventSubscriptions]: Map<symbol, EventSubscriber> | undefined;
|
21
|
-
/** @deprecated */
|
22
|
-
readonly [_configure]: (uuid: string) => void;
|
23
|
-
readonly [_configuration]: SDKConfig;
|
24
|
-
readonly [_configUser]: () => Promise<void>;
|
25
|
-
readonly [_dispose]: () => void;
|
26
|
-
readonly [_disposed]: false;
|
27
|
-
readonly [_isProxy]: false;
|
28
|
-
readonly [_loadEditor]: () => void;
|
29
|
-
readonly [_orgConfig]: OrgConfig;
|
30
|
-
readonly [_reloadCommands]: () => void;
|
31
|
-
readonly [_reloadOrganization]: () => void;
|
32
|
-
readonly [_reloadPlaceholders]: () => void;
|
33
|
-
readonly [_reloadNudges]: () => void;
|
34
|
-
readonly [_previewNudge]: (data: {
|
35
|
-
nudge: INudgeType;
|
36
|
-
step: number;
|
37
|
-
}) => void;
|
38
|
-
readonly [_stopChecklistPreview]: () => void;
|
39
|
-
readonly [_stopNudgePreview]: (data: {
|
40
|
-
index?: number;
|
41
|
-
}) => void;
|
42
|
-
readonly [_previewChecklist]: (data: {
|
43
|
-
checklist: IChecklist;
|
44
|
-
clearData?: boolean;
|
45
|
-
}) => void;
|
46
|
-
readonly [_reloadChecklists]: () => void;
|
47
|
-
/** @deprecated */
|
48
|
-
readonly [_report]: (event: EVENT_NAME, data?: Metadata) => void;
|
49
|
-
/** @deprecated */
|
50
|
-
readonly [_setDashboard]: (element: HTMLElement) => void;
|
51
|
-
readonly [_setPreviewMode]: (on: boolean) => void;
|
52
|
-
readonly [_setTestMode]: (on: boolean) => void;
|
53
|
-
readonly [_setEditorVisible]: (visible: boolean) => void;
|
54
|
-
readonly [_shareContextSettings]: () => {
|
55
|
-
local: IResourceSettingsByContextKey;
|
56
|
-
server: IResourceSettingsByContextKey;
|
57
|
-
};
|
58
|
-
readonly [_shareConfig]: () => any;
|
59
|
-
readonly [_shareProgrammaticCommands]: () => ICommandType[];
|
60
|
-
/** @deprecated */
|
61
|
-
readonly [_showGuide]: (eventName: string, preview?: boolean) => void;
|
62
|
-
/** @deprecated */
|
63
|
-
readonly [_showMessage]: (eventName: string, preview?: boolean) => void;
|
64
|
-
}
|
65
|
-
export declare type CommandBarSDK = CommandBarInternalSDK & CommandBarClientSDK;
|