commandbar 1.9.0 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/build/{internal/src/client → commandbar/src/shared/services/analytics}/EventHandler.d.ts +32 -10
  2. package/build/commandbar/src/shared/services/analytics/types.d.ts +77 -0
  3. package/build/commandbar-js/src/index.d.ts +2 -2
  4. package/build/commandbar-js/src/index.js +1 -1
  5. package/build/internal/src/client/AddContextOptions.d.ts +4 -0
  6. package/build/internal/src/client/CommandBarClientSDK.d.ts +46 -13
  7. package/build/internal/src/client/CommandBarSDK.d.ts +17 -10
  8. package/build/internal/src/client/SDKConfig.d.ts +3 -2
  9. package/build/internal/src/client/symbols.d.ts +5 -1
  10. package/build/internal/src/middleware/CommandFromClientV.d.ts +22 -10
  11. package/build/internal/src/middleware/IRecordSettings.d.ts +3 -0
  12. package/build/internal/src/middleware/OrganizationV.d.ts +200 -6
  13. package/build/internal/src/middleware/{ResourceSettingsV.d.ts → RecordSettingsV.d.ts} +2 -2
  14. package/build/internal/src/middleware/additionalResource.d.ts +96 -15
  15. package/build/internal/src/middleware/billing.d.ts +0 -2
  16. package/build/internal/src/middleware/chat.d.ts +2196 -176
  17. package/build/internal/src/middleware/checklist.d.ts +504 -63
  18. package/build/internal/src/middleware/command.d.ts +1809 -385
  19. package/build/internal/src/middleware/endUser.d.ts +33 -5
  20. package/build/internal/src/middleware/entityChanges.d.ts +17 -0
  21. package/build/internal/src/middleware/experienceTemplate.d.ts +59 -0
  22. package/build/internal/src/middleware/experiencesSearch.d.ts +3579 -0
  23. package/build/internal/src/middleware/flags.d.ts +20 -0
  24. package/build/internal/src/middleware/helpDocsIntegration.d.ts +9 -0
  25. package/build/internal/src/middleware/helpDocsSearch.d.ts +371 -35
  26. package/build/internal/src/middleware/helpers/actions.d.ts +66 -16
  27. package/build/internal/src/middleware/helpers/commandTemplate.d.ts +70 -8
  28. package/build/internal/src/middleware/helpers/copilotPersonality.d.ts +12 -0
  29. package/build/internal/src/middleware/helpers/goals.d.ts +4 -2
  30. package/build/internal/src/middleware/helpers/pushTrigger.d.ts +22 -0
  31. package/build/internal/src/middleware/helpers/rules.d.ts +45 -36
  32. package/build/internal/src/middleware/network.d.ts +15 -0
  33. package/build/internal/src/middleware/nudge.d.ts +1103 -124
  34. package/build/internal/src/middleware/organization.d.ts +1288 -61
  35. package/build/internal/src/middleware/organizationSettings.d.ts +320 -12
  36. package/build/internal/src/middleware/profile.d.ts +2 -0
  37. package/build/internal/src/middleware/recommendationSet.d.ts +96 -15
  38. package/build/internal/src/middleware/releases.d.ts +1 -1
  39. package/build/internal/src/middleware/theme.d.ts +431 -0
  40. package/build/internal/src/middleware/types.d.ts +52 -15
  41. package/build/internal/src/middleware/user.d.ts +1 -0
  42. package/build/internal/src/util/dispatchCustomEvent.d.ts +3 -3
  43. package/build/internal/src/util/operatingSystem.d.ts +2 -4
  44. package/package.json +1 -1
  45. package/src/index.ts +2 -2
  46. package/src/init.ts +12 -6
  47. package/src/snippet.ts +2 -2
  48. package/build/internal/src/client/AnalyticsEventTypes.d.ts +0 -1
  49. package/build/internal/src/middleware/IResourceSettings.d.ts +0 -3
  50. package/build/internal/src/middleware/dashboardFlags.d.ts +0 -9
package/src/index.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import Launcher, { getControlKey } from 'commandbar-launcher';
2
- import { CommandBarClientSDK } from '../../internal/src/client/CommandBarClientSDK';
2
+ import type { CommandBarClientSDK } from '@commandbar/internal/src/client/CommandBarClientSDK';
3
3
 
4
4
  export { default as init } from './init';
5
- export { initProxySDK as initProxy } from '../../internal/src/client/proxy';
5
+ export { initProxySDK as initProxy } from '@commandbar/internal/src/client/proxy';
6
6
  export { snippet } from './snippet';
7
7
  export { CommandBarClientSDK };
8
8
  export { Launcher, getControlKey };
package/src/init.ts CHANGED
@@ -5,7 +5,7 @@ import { getProxySDK } from '../../internal/src/client/proxy';
5
5
  import { _configuration } from '../../internal/src/client/symbols';
6
6
  import { IInitOptions } from '../../internal/src/middleware/types';
7
7
 
8
- const getSrc = (org: string) => {
8
+ const getSrc = (org: string, nonce?: string) => {
9
9
  let origin = 'https://api.commandbar.com';
10
10
  const params = [];
11
11
 
@@ -21,6 +21,10 @@ const getSrc = (org: string) => {
21
21
  params.push('lc=' + lc);
22
22
  }
23
23
 
24
+ if (nonce) {
25
+ params.push('nonce=' + nonce);
26
+ }
27
+
24
28
  const version = 2;
25
29
  params.push('version=' + version);
26
30
 
@@ -28,14 +32,14 @@ const getSrc = (org: string) => {
28
32
  return src;
29
33
  };
30
34
 
31
- const loadLatest = (org: string) => {
35
+ const loadLatest = (org: string, nonce?: string) => {
32
36
  if (document.readyState !== 'complete') {
33
37
  // NOTE: `once` is not supported by IE11 and this will cause a (minor!) memory leak.
34
- window.addEventListener('load', loadLatest.bind(null, org), { capture: false, once: true });
38
+ window.addEventListener('load', loadLatest.bind(null, org, nonce), { capture: false, once: true });
35
39
  return;
36
40
  }
37
41
 
38
- const src = getSrc(org);
42
+ const src = getSrc(org, nonce);
39
43
 
40
44
  const el = document.createElement('script');
41
45
  el.type = 'text/javascript';
@@ -75,9 +79,11 @@ const init = (org: string, opts: IInitOptions = DEFAULT_OPTS) => {
75
79
  uuid: org,
76
80
  environment: opts.environment,
77
81
  version: opts.version,
78
- config: opts.config,
82
+ config: opts.config, // TODO: We should update this type to correctly reflect the structure of the response from /config/ https://cmd-k.slack.com/archives/C0315KNU7FY/p1711558822136239?thread_ts=1711554558.063509&cid=C0315KNU7FY
83
+ nonce: opts.nonce,
79
84
  };
80
- loadLatest(org);
85
+
86
+ loadLatest(org, opts.nonce);
81
87
  };
82
88
 
83
89
  export default init;
package/src/snippet.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  /* eslint-disable no-template-curly-in-string */
2
2
  /* eslint-disable prefer-rest-params */
3
3
 
4
- import { _eventSubscriptions } from '../../internal/src/client/symbols';
5
-
6
4
  /* eslint-disable @typescript-eslint/no-inferrable-types */
7
5
  export const snippet = (org: string) => {
8
6
  const polyfills = ['Object.assign', 'Symbol', 'Symbol.for'].join('%2C');
@@ -29,6 +27,8 @@ export const snippet = (org: string) => {
29
27
  const _isProxy = Symbol.for('CommandBar::isProxy');
30
28
  const _queue = Symbol.for('CommandBar::queue');
31
29
  const _unwrap = Symbol.for('CommandBar::unwrap');
30
+ const _eventSubscriptions = Symbol.for('CommandBar::eventSubscriptions');
31
+
32
32
  const params = [];
33
33
  const lc = localStorage.getItem('commandbar.lc');
34
34
  const origin = lc && lc.includes('local') ? 'http://localhost:8000' : 'https://api.commandbar.com';
@@ -1 +0,0 @@
1
- export type EVENT_NAME = 'Identify' | 'New session' | 'End session' | 'Load Performance' | 'New search' | 'Exited' | 'Search input' | 'Onboarding tooltip shown' | 'Tooltip shown' | 'Onboarding started' | 'Onboarding exited' | 'Onboarding completed' | 'Abandoned search' | 'No results for query' | 'Command suggestion' | 'Command execution' | 'Unavailable shortcut' | 'Clicked branding' | 'Survey response' | 'Client-Error' | 'Internal-Error' | 'Internal-Event' | 'Sentry-Event' | 'User changed shortcut' | 'Preview shown' | 'Next step selected' | 'Preview link opened' | 'Preview engagement' | 'Nudge shown' | 'Nudge clicked' | 'Nudge completed' | 'Nudge dismissed' | 'Nudge snoozed' | 'Questlist shown' | 'Questlist engagement' | 'Questlist item engagement' | 'HelpHub opened' | 'HelpHub closed' | 'HelpHub unminimized' | 'HelpHub minimized' | 'HelpHub doc opened' | 'HelpHub doc closed' | 'HelpHub doc engagement' | 'HelpHub engagement' | 'No chat response';
@@ -1,3 +0,0 @@
1
- import * as t from 'io-ts';
2
- import { ResourceSettingsV } from './ResourceSettingsV';
3
- export type IResourceSettings = t.TypeOf<typeof ResourceSettingsV> & unknown;
@@ -1,9 +0,0 @@
1
- import * as t from 'io-ts';
2
- export declare const DashboardFlagsV: t.TypeC<{
3
- show_onboarding: t.BooleanC;
4
- show_appsumo_onboarding: t.BooleanC;
5
- }>;
6
- export declare const DashboardFlagsPartialV: t.PartialC<{
7
- show_onboarding: t.BooleanC;
8
- show_appsumo_onboarding: t.BooleanC;
9
- }>;