commandbar 1.7.1 → 1.7.3

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 (35) hide show
  1. package/build/commandbar-js/src/index.js +1 -1
  2. package/build/commandbar-js/src/init.d.ts +2 -8
  3. package/build/internal/src/client/AddContextOptions.d.ts +6 -7
  4. package/build/internal/src/client/AnalyticsEventTypes.d.ts +1 -1
  5. package/build/internal/src/client/CommandBarClientSDK.d.ts +33 -31
  6. package/build/internal/src/client/CommandBarSDK.d.ts +20 -4
  7. package/build/internal/src/client/EventHandler.d.ts +92 -3
  8. package/build/internal/src/client/globals.d.ts +2 -0
  9. package/build/internal/src/client/symbols.d.ts +7 -0
  10. package/build/internal/src/middleware/CommandFromClientV.d.ts +32 -47
  11. package/build/internal/src/middleware/OrganizationV.d.ts +15 -2
  12. package/build/internal/src/middleware/ResourceSettingsV.d.ts +6 -0
  13. package/build/internal/src/middleware/checklist.d.ts +740 -0
  14. package/build/internal/src/middleware/command.d.ts +718 -977
  15. package/build/internal/src/middleware/commandCategory.d.ts +32 -0
  16. package/build/internal/src/middleware/dashboardFlags.d.ts +9 -0
  17. package/build/internal/src/middleware/detailPreview.d.ts +4 -0
  18. package/build/internal/src/middleware/helpers/actions.d.ts +84 -0
  19. package/build/internal/src/middleware/helpers/argument.d.ts +0 -120
  20. package/build/internal/src/middleware/helpers/commandTemplate.d.ts +60 -60
  21. package/build/internal/src/middleware/helpers/endUser.d.ts +1 -0
  22. package/build/internal/src/middleware/helpers/goals.d.ts +26 -0
  23. package/build/internal/src/middleware/helpers/rules.d.ts +48 -22
  24. package/build/internal/src/middleware/helpers/tags.d.ts +7 -0
  25. package/build/internal/src/middleware/historyEvent.d.ts +0 -19
  26. package/build/internal/src/middleware/nudge.d.ts +925 -81
  27. package/build/internal/src/middleware/organization.d.ts +110 -60
  28. package/build/internal/src/middleware/skin.d.ts +13 -2
  29. package/build/internal/src/middleware/types.d.ts +38 -6
  30. package/build/internal/src/middleware/user.d.ts +2 -1
  31. package/build/internal/src/util/LocalStorage.d.ts +1 -1
  32. package/package.json +3 -4
  33. package/src/init.ts +2 -9
  34. package/src/snippet.ts +2 -2
  35. package/webpack.config.js +5 -0
@@ -4,7 +4,8 @@ import { BatchEditorCommandResponseV, BatchOperationV, CommandV, HelpSyncCommand
4
4
  import { ArgumentMapV, ArgumentTypeV, ConditionV, ConditionOperatorV, StepArgumentTypeV, ContextArgumentV, SetArgumentV, DynamicArgumentV, DependentArgumentV, FunctionArgumentV } from './helpers/argument';
5
5
  import { GenericBatchRequest } from './generics';
6
6
  import { OptionGroupRenderAsV } from './helpers/optionGroup';
7
- import { TemplateV, TemplateOptionsV, RequestTemplateV, RequestV } from './helpers/commandTemplate';
7
+ import { TemplateV, TemplateOptionsV, RequestTemplateV } from './helpers/commandTemplate';
8
+ import { RequestV } from './helpers/actions';
8
9
  import { CommandCategoryV } from './commandCategory';
9
10
  import { OrganizationStatusV, KeyEventV, ResourceSettingsByContextKeyV, InternalSettingsV, OrganizationSettingsV } from './organization';
10
11
  import { UserV } from './user';
@@ -19,9 +20,18 @@ import { ProfileV } from './profile';
19
20
  import { PlaceholderV } from './placeholder';
20
21
  import { EnvReleaseInfoV, ReleaseStepV, ReleaseV } from './releases';
21
22
  import { EnvironmentV } from './environment';
22
- import { NudgeV } from './nudge';
23
+ import { NudgeContentBlockV, NudgeContentButtonBlockV, NudgeContentHelpDocBlockV, NudgeContentImageBlockV, NudgeContentMarkdownBlockV, NudgeContentVideoBlockV, NudgeStepV, NudgeV, OldNudgeV } from './nudge';
23
24
  import { TabV } from './tab';
24
25
  import { RuleExpressionAndV, RuleExpressionOrV, RuleExpressionV } from './helpers/rules';
26
+ import { ChecklistItemV, ChecklistV } from './checklist';
27
+ import { DashboardFlagsV } from './dashboardFlags';
28
+ /*******************************************************************************/
29
+ export declare type IInitOptions = {
30
+ debug?: boolean;
31
+ environment?: string;
32
+ version?: string;
33
+ config?: IConfigEndpointResponse;
34
+ };
25
35
  /*******************************************************************************/
26
36
  export declare type IContextType = t.TypeOf<typeof ContextV> & unknown;
27
37
  export declare type IUserType = t.TypeOf<typeof UserV> & unknown;
@@ -39,6 +49,7 @@ export declare type IHelpDocsIntegrationType = t.TypeOf<typeof HelpDocsIntegrati
39
49
  export type { IOrganizationType } from './OrganizationV';
40
50
  export declare type IOrganizationStatusType = t.TypeOf<typeof OrganizationStatusV> & unknown;
41
51
  export declare type IInternalSettingsType = t.TypeOf<typeof InternalSettingsV> & unknown;
52
+ export declare type IDashboardFlagsType = t.TypeOf<typeof DashboardFlagsV> & unknown;
42
53
  export declare type ISkinType = t.TypeOf<typeof SkinV> & unknown;
43
54
  export declare type IProfileType = t.TypeOf<typeof ProfileV> & unknown;
44
55
  export declare type IOrganizationSettingsType = t.TypeOf<typeof OrganizationSettingsV> & unknown;
@@ -73,12 +84,22 @@ export declare type IDynamicArgumentType = t.TypeOf<typeof DynamicArgumentV> & u
73
84
  export declare type IDependentArgumentType = t.TypeOf<typeof DependentArgumentV> & unknown;
74
85
  export declare type IFunctionArgumentType = t.TypeOf<typeof FunctionArgumentV> & unknown;
75
86
  export declare type OptionGroupRenderAsType = t.TypeOf<typeof OptionGroupRenderAsV> & unknown;
87
+ export declare type IOldNudgeType = t.TypeOf<typeof OldNudgeV> & unknown;
76
88
  export declare type INudgeType = t.TypeOf<typeof NudgeV> & unknown;
77
- export interface INudgeClientType {
89
+ export declare type INudgeStepType = t.TypeOf<typeof NudgeStepV> & unknown;
90
+ export declare type INudgeStepContentBlockType = t.TypeOf<typeof NudgeContentBlockV> & unknown;
91
+ export declare type INudgeStepContentMarkdownBlockType = t.TypeOf<typeof NudgeContentMarkdownBlockV> & unknown;
92
+ export declare type INudgeStepContentImageBlockType = t.TypeOf<typeof NudgeContentImageBlockV> & unknown;
93
+ export declare type INudgeStepContentVideoBlockType = t.TypeOf<typeof NudgeContentVideoBlockV> & unknown;
94
+ export declare type INudgeStepContentHelpDocBlockType = t.TypeOf<typeof NudgeContentHelpDocBlockV> & unknown;
95
+ export declare type INudgeStepContentButtonBlockType = t.TypeOf<typeof NudgeContentButtonBlockV> & unknown;
96
+ export declare type INudgeClientType = {
78
97
  nudge: INudgeType;
79
- active: boolean;
98
+ passedConditionsInLastEvaluation: boolean;
80
99
  lastTriggeredTs?: number;
81
- }
100
+ };
101
+ export declare type IChecklist = t.TypeOf<typeof ChecklistV> & unknown;
102
+ export declare type IChecklistItem = t.TypeOf<typeof ChecklistItemV> & unknown;
82
103
  export interface ICommandInput {
83
104
  text: string;
84
105
  command: ICommandType;
@@ -94,6 +115,15 @@ export declare type IHistoryType = Array<{
94
115
  export interface IUserContext {
95
116
  [variable: string]: any;
96
117
  }
118
+ export interface IEndUserAnalytics {
119
+ num_command_executions: number;
120
+ num_shortcut_command_executions: number;
121
+ num_sessions: number;
122
+ num_opens: number;
123
+ num_deadends: number;
124
+ first_seen_at: string;
125
+ last_seen_at: string;
126
+ }
97
127
  export interface ICallbackMap {
98
128
  [variable: string]: (...args: any[]) => unknown;
99
129
  }
@@ -109,8 +139,10 @@ export declare type IConfigEndpointResponse = {
109
139
  organization: any;
110
140
  environments_with_versions?: any[];
111
141
  placeholders?: any[];
112
- nudges?: INudgeType[];
142
+ nudges?: IOldNudgeType[];
143
+ nudges_v2?: INudgeType[];
113
144
  tabs?: ITabType[];
145
+ checklists?: IChecklist[];
114
146
  };
115
147
  export type { IResourceSettings } from './IResourceSettings';
116
148
  export declare type IResourceSettingsByContextKey = t.TypeOf<typeof ResourceSettingsByContextKeyV> & unknown;
@@ -5,10 +5,11 @@ export declare const UserV: t.IntersectionC<[t.TypeC<{
5
5
  token: t.StringC;
6
6
  email: t.StringC;
7
7
  organization: t.StringC;
8
+ organization_name: t.StringC;
8
9
  api_token: t.UnionC<[t.StringC, t.NullC]>;
9
10
  profile: t.NumberC;
10
11
  has_updated_password: t.BooleanC;
11
12
  is_active: t.BooleanC;
12
13
  }>, t.PartialC<{
13
- atlas_hash: t.StringC;
14
+ intercom_hash: t.StringC;
14
15
  }>]>;
@@ -1,6 +1,6 @@
1
1
  declare const LocalStorage: {
2
2
  set: (label: string, value: string | boolean | number) => string | number | boolean;
3
- get: (label: string, defaultValue: string | boolean | number) => string | number | boolean;
3
+ get: (label: string, defaultValue: string | boolean | number, prefixOverride?: string | undefined) => string | number | boolean;
4
4
  remove: (label: string) => void;
5
5
  };
6
6
  export default LocalStorage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commandbar",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "description": "Javascript Utility for CommandBar",
5
5
  "main": "build/commandbar-js/src/index.js",
6
6
  "types": "build/commandbar-js/src/index.d.ts",
@@ -20,12 +20,11 @@
20
20
  "dependencies": {
21
21
  "commandbar-launcher": "^1.1.9",
22
22
  "fp-ts": "2.10.5",
23
- "io-ts": "2.2.13",
24
- "react-hot-toast": "^2.3.0"
23
+ "io-ts": "^2.2.14"
25
24
  },
26
25
  "devDependencies": {
27
26
  "rimraf": "3.0.2",
28
27
  "typescript": "4.6.2",
29
- "webpack": "5.74.0"
28
+ "webpack": "^5.74.0"
30
29
  }
31
30
  }
package/src/init.ts CHANGED
@@ -3,14 +3,7 @@ import 'es6-object-assign/auto';
3
3
  import 'es6-symbol/implement';
4
4
  import { getProxySDK } from '../../internal/src/client/proxy';
5
5
  import { _configuration } from '../../internal/src/client/symbols';
6
- import { IConfigEndpointResponse } from '../../internal/src/middleware/types';
7
-
8
- interface IInitOptions {
9
- debug?: boolean;
10
- environment?: string;
11
- version?: string;
12
- config?: IConfigEndpointResponse;
13
- }
6
+ import { IInitOptions } from '../../internal/src/middleware/types';
14
7
 
15
8
  const getSrc = (org: string) => {
16
9
  let origin = 'https://api.commandbar.com';
@@ -58,7 +51,7 @@ const DEFAULT_OPTS = { debug: false };
58
51
  * this function it will be possible to access window.CommandBar and call the SDK methods, even if the scripts have not
59
52
  * finished loading yet.
60
53
  *
61
- * @param {string} org Your organization ID, which can be found [here](https://app.commandbar.com/docs/getting-started/installation#step-1:-install-commandbar).
54
+ * @param {string} org Your organization ID, which can be found [here](https://commandbar.com/docs/dev/installation).
62
55
  * @param {IInitOptions} [opts] Additional options to use for initialization: `debug` will enable additional logging, `environment` specifies the environment to load config from
63
56
  * output.
64
57
  */
package/src/snippet.ts CHANGED
@@ -46,7 +46,7 @@ export const snippet = (org: string) => {
46
46
  w.CommandBar,
47
47
  );
48
48
 
49
- const ASYNC_METHODS = ['addCommand', 'boot', 'addEventSubscriber'];
49
+ const ASYNC_METHODS_SNIPPET = ['addCommand', 'boot', 'addEventSubscriber', 'addRecordAction', 'setFormFactor'];
50
50
 
51
51
  const sdk = proxy;
52
52
 
@@ -58,7 +58,7 @@ export const snippet = (org: string) => {
58
58
  w.CommandBar = new Proxy(proxy, {
59
59
  get: function (_, prop) {
60
60
  if (prop in sdk) return proxy[prop];
61
- if (ASYNC_METHODS.includes(prop as string)) {
61
+ if (ASYNC_METHODS_SNIPPET.includes(prop as string)) {
62
62
  return function () {
63
63
  // eslint-disable-next-line prefer-rest-params
64
64
  const a = Array.prototype.slice.call(arguments);
package/webpack.config.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const path = require('path');
2
+ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
2
3
 
3
4
  module.exports = {
4
5
  mode: 'production',
@@ -27,4 +28,8 @@ module.exports = {
27
28
  extensions: ['.ts', '.js', '.json', '.tsx'],
28
29
  },
29
30
  stats: 'minimal',
31
+ plugins: [process.env.ENABLE_STATSFILE_GENERATION && new BundleAnalyzerPlugin({
32
+ analyzerMode: 'disabled',
33
+ generateStatsFile: true
34
+ })].filter(Boolean),
30
35
  };