commandbar 1.8.6 → 1.9.0

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 (42) hide show
  1. package/build/commandbar-js/src/index.js +1 -1
  2. package/build/internal/src/client/AddContextOptions.d.ts +4 -0
  3. package/build/internal/src/client/AnalyticsEventTypes.d.ts +1 -1
  4. package/build/internal/src/client/CommandBarClientSDK.d.ts +25 -7
  5. package/build/internal/src/client/CommandBarProxySDK.d.ts +3 -3
  6. package/build/internal/src/client/CommandBarSDK.d.ts +23 -12
  7. package/build/internal/src/client/EventHandler.d.ts +19 -5
  8. package/build/internal/src/client/globals.d.ts +6 -0
  9. package/build/internal/src/client/symbols.d.ts +11 -6
  10. package/build/internal/src/middleware/CommandFromClientV.d.ts +68 -10
  11. package/build/internal/src/middleware/OrganizationV.d.ts +124 -20
  12. package/build/internal/src/middleware/additionalResource.d.ts +178 -16
  13. package/build/internal/src/middleware/billing.d.ts +33 -0
  14. package/build/internal/src/middleware/chat.d.ts +10913 -0
  15. package/build/internal/src/middleware/checklist.d.ts +106 -28
  16. package/build/internal/src/middleware/command.d.ts +3778 -446
  17. package/build/internal/src/middleware/detailPreview.d.ts +12 -1
  18. package/build/internal/src/middleware/endUser.d.ts +104 -0
  19. package/build/internal/src/middleware/generics.d.ts +12 -11
  20. package/build/internal/src/middleware/helpDocsIntegration.d.ts +54 -8
  21. package/build/internal/src/middleware/helpDocsSearch.d.ts +2204 -0
  22. package/build/internal/src/middleware/helpHub.d.ts +26 -0
  23. package/build/internal/src/middleware/helpers/actions.d.ts +116 -8
  24. package/build/internal/src/middleware/helpers/commandTemplate.d.ts +82 -2
  25. package/build/internal/src/middleware/helpers/pushTrigger.d.ts +6 -0
  26. package/build/internal/src/middleware/helpers/rules.d.ts +285 -26
  27. package/build/internal/src/middleware/network.d.ts +18 -3
  28. package/build/internal/src/middleware/nudge.d.ts +1193 -43
  29. package/build/internal/src/middleware/organization.d.ts +1051 -141
  30. package/build/internal/src/middleware/organizationSettings.d.ts +129 -22
  31. package/build/internal/src/middleware/recommendationSet.d.ts +408 -1007
  32. package/build/internal/src/middleware/types.d.ts +43 -25
  33. package/build/internal/src/util/dispatchCustomEvent.d.ts +3 -1
  34. package/build/internal/src/util/operatingSystem.d.ts +13 -0
  35. package/build/internal/src/util/sentry.d.ts +23 -0
  36. package/package.json +4 -4
  37. package/build/internal/src/client/SentryReporter.d.ts +0 -63
  38. package/build/internal/src/middleware/chatAnalytics.d.ts +0 -2601
  39. package/build/internal/src/middleware/helpers/endUser.d.ts +0 -11
  40. package/build/internal/src/middleware/qaPair.d.ts +0 -676
  41. package/build/internal/src/util/integrations.d.ts +0 -1
  42. package/src/commandbar-launcher.d.ts +0 -7
@@ -5,7 +5,7 @@ import { ArgumentMapV, ArgumentTypeV, ConditionV, ConditionOperatorV, StepArgume
5
5
  import { GenericBatchRequest } from './generics';
6
6
  import { OptionGroupRenderAsV } from './helpers/optionGroup';
7
7
  import { TemplateV, TemplateOptionsV, RequestTemplateV } from './helpers/commandTemplate';
8
- import { ActionV, LabeledActionV, RequestV } from './helpers/actions';
8
+ import { ActionV, CommandActionV, LabeledActionV, OpenChatActionV, NudgeActionV, QuestlistActionV, RequestV } from './helpers/actions';
9
9
  import { CommandCategoryV } from './commandCategory';
10
10
  import { OrganizationStatusV, KeyEventV, ResourceSettingsByContextKeyV, InternalSettingsV, OrganizationV } from './organization';
11
11
  import { OrganizationSettingsV } from './organizationSettings';
@@ -15,14 +15,13 @@ import { GuideV } from './guide';
15
15
  import { HistoryEventV } from './historyEvent';
16
16
  import { HelpDocSyncLogMessageV, HelpDocsSyncV } from './helpDocsSync';
17
17
  import { HelpDocsIntegrationV } from './helpDocsIntegration';
18
- import { EndUserV } from './helpers/endUser';
18
+ import { EndUserStoreDataV, EndUserV, NudgeInteractionStateV, NudgeInteractionsV, QuestlistInteractionStateV, QuestlistInteractionsV, DecideResponseV } from './endUser';
19
19
  import { SkinV } from './skin';
20
20
  import { ProfileV } from './profile';
21
21
  import { PlaceholderV } from './placeholder';
22
22
  import { EnvReleaseInfoV, ReleaseStepV, ReleaseV } from './releases';
23
23
  import { EnvironmentV } from './environment';
24
- import { NudgeContentBlockV, NudgeContentButtonBlockV, NudgeContentHelpDocBlockV, NudgeContentImageBlockV, NudgeContentMarkdownBlockV, NudgeContentVideoBlockV, NudgeContentSurveyTextBlockV, NudgeContentSurveyRatingBlockV, NudgeStepV, NudgeV, OldNudgeV } from './nudge';
25
- import { InstantAnswerV } from './qaPair';
24
+ import { NudgeContentBlockV, NudgeContentButtonBlockV, NudgeContentHelpDocBlockV, NudgeContentImageBlockV, NudgeContentMarkdownBlockV, NudgeContentVideoBlockV, NudgeContentSurveyTextBlockV, NudgeStepContentSurveyTextShortBlockTypeV, NudgeContentSurveyRatingBlockV, NudgeContentListBlockV, NudgeStepV, NudgeV, OldNudgeV, NudgeButtonActionV, NudgeConditionalActionV } from './nudge';
26
25
  import { TabV } from './tab';
27
26
  import { RuleExpressionAndV, RuleExpressionOrV, RuleExpressionV } from './helpers/rules';
28
27
  import { ChecklistItemV, ChecklistV } from './checklist';
@@ -31,9 +30,11 @@ import { PushTriggerV } from './helpers/pushTrigger';
31
30
  import { FrequencyLimitV } from './helpers/frequencyLimit';
32
31
  import { AudienceV } from './helpers/audience';
33
32
  import { AdditionalResourceV } from './additionalResource';
34
- import { EditorRecommendationSetV, RecommendationSetV } from './recommendationSet';
35
- import { UsageV } from './billing';
36
- import { UserMessageV, AIMessageV, MessageV } from './chatAnalytics';
33
+ import { RecommendationSetV } from './recommendationSet';
34
+ import { BillingProfileV, UsageV } from './billing';
35
+ import { UserMessageV, AIMessageV, MessageV, AIAnswerPayloadV, AIAnswerV, ContinuationsPayloadV, ContinuationV, CreateAnswerFeedbackPayloadV, QuestionSuggestionsPayloadV, QuestionSuggestionsV, ExperienceV, CreateChatPayloadV } from './chat';
36
+ import { HelpDocHitV, SearchHelpDocsPayloadV, SearchHelpDocsResponseV } from './helpDocsSearch';
37
+ import { HelpHubLauncherSettingsV } from './helpHub';
37
38
  /*******************************************************************************/
38
39
  export type IInitOptions = {
39
40
  debug?: boolean;
@@ -41,6 +42,12 @@ export type IInitOptions = {
41
42
  version?: string;
42
43
  config?: IConfigEndpointResponse;
43
44
  };
45
+ /** Additional foobar init options */
46
+ export declare const SUPPORTED_FOOBAR_INIT_DEPLOYMENT_OPTIONS: readonly ["labs", "prod"];
47
+ export type IInitOptionsFoobar = IInitOptions & {
48
+ deployment?: (typeof SUPPORTED_FOOBAR_INIT_DEPLOYMENT_OPTIONS)[number];
49
+ disable_analytics?: boolean;
50
+ };
44
51
  /*******************************************************************************/
45
52
  export type IContextType = t.TypeOf<typeof ContextV> & unknown;
46
53
  export type IUserType = t.TypeOf<typeof UserV> & unknown;
@@ -58,6 +65,7 @@ export type IHistoryEventType = t.TypeOf<typeof HistoryEventV> & unknown;
58
65
  export type IHelpDocsSyncType = t.TypeOf<typeof HelpDocsSyncV> & unknown;
59
66
  export type IHelpDocsSyncLogMessageType = t.TypeOf<typeof HelpDocSyncLogMessageV> & unknown;
60
67
  export type IHelpDocsIntegrationType = t.TypeOf<typeof HelpDocsIntegrationV> & unknown;
68
+ export type IHelpHubLauncherSettingsType = t.TypeOf<typeof HelpHubLauncherSettingsV> & unknown;
61
69
  export type IOrganizationType = t.TypeOf<typeof OrganizationV> & unknown;
62
70
  export type IOrganizationStatusType = t.TypeOf<typeof OrganizationStatusV> & unknown;
63
71
  export type IInternalSettingsType = t.TypeOf<typeof InternalSettingsV> & unknown;
@@ -86,7 +94,6 @@ export type ITemplate = t.TypeOf<typeof TemplateV> & unknown;
86
94
  export type RequestTemplateType = t.TypeOf<typeof RequestTemplateV> & unknown;
87
95
  export type RequestType = t.TypeOf<typeof RequestV> & unknown;
88
96
  export type ITemplateOptions = t.TypeOf<typeof TemplateOptionsV> & unknown;
89
- export type IEndUserType = t.TypeOf<typeof EndUserV> & unknown;
90
97
  export type IRuleExpression = t.TypeOf<typeof RuleExpressionV> & unknown;
91
98
  export type IRuleExpressionAnd = t.TypeOf<typeof RuleExpressionAndV> & unknown;
92
99
  export type IRuleExpressionOr = t.TypeOf<typeof RuleExpressionOrV> & unknown;
@@ -108,30 +115,24 @@ export type INudgeStepContentImageBlockType = t.TypeOf<typeof NudgeContentImageB
108
115
  export type INudgeStepContentVideoBlockType = t.TypeOf<typeof NudgeContentVideoBlockV> & unknown;
109
116
  export type INudgeStepContentHelpDocBlockType = t.TypeOf<typeof NudgeContentHelpDocBlockV> & unknown;
110
117
  export type INudgeStepContentSurveyTextBlockType = t.TypeOf<typeof NudgeContentSurveyTextBlockV> & unknown;
118
+ export type INudgeStepContentSurveyTextShortBlockType = t.TypeOf<typeof NudgeStepContentSurveyTextShortBlockTypeV> & unknown;
111
119
  export type INudgeContentSurveyRatingBlockType = t.TypeOf<typeof NudgeContentSurveyRatingBlockV> & unknown;
120
+ export type INudgeContentListBlock = t.TypeOf<typeof NudgeContentListBlockV> & unknown;
112
121
  export type INudgeStepContentButtonBlockType = t.TypeOf<typeof NudgeContentButtonBlockV> & unknown;
122
+ export type INudgeButtonAction = t.TypeOf<typeof NudgeButtonActionV> & unknown;
123
+ export type INudgeButtonConditionalAction = t.TypeOf<typeof NudgeConditionalActionV> & unknown;
113
124
  export type INudgeClientType = {
114
125
  nudge: INudgeType;
115
126
  passedConditionsInLastEvaluation: boolean;
116
127
  lastTriggeredTs?: number;
117
128
  };
118
129
  export type LabeledAction = t.TypeOf<typeof LabeledActionV> & unknown;
130
+ export type OpenChatAction = t.TypeOf<typeof OpenChatActionV> & unknown;
131
+ export type QuestlistAction = t.TypeOf<typeof QuestlistActionV> & unknown;
132
+ export type NudgeAction = t.TypeOf<typeof NudgeActionV> & unknown;
133
+ export type CommandAction = t.TypeOf<typeof CommandActionV> & unknown;
119
134
  export type Action = t.TypeOf<typeof ActionV> & unknown;
120
- export type IBillingProfile = {
121
- organization: string;
122
- price_cents: number;
123
- tier: string;
124
- discount_cents: number;
125
- name: string;
126
- invoice_description: string;
127
- customer_id: string | null;
128
- publishable_key: string;
129
- balance: number | null;
130
- currency: string | null;
131
- on_free_trial: boolean;
132
- free_trial_end_date: string | null;
133
- appsumo_invoice_item_id: string | null;
134
- };
135
+ export type IBillingProfile = t.TypeOf<typeof BillingProfileV> & unknown;
135
136
  export type IChecklist = t.TypeOf<typeof ChecklistV> & {
136
137
  _editorState?: {
137
138
  timestamp?: number;
@@ -140,10 +141,25 @@ export type IChecklist = t.TypeOf<typeof ChecklistV> & {
140
141
  };
141
142
  } & unknown;
142
143
  export type IChecklistItem = t.TypeOf<typeof ChecklistItemV> & unknown;
143
- export type IInstantAnswerType = t.TypeOf<typeof InstantAnswerV> & unknown;
144
+ export type ChecklistInteractionState = t.TypeOf<typeof QuestlistInteractionStateV> & unknown;
145
+ export type ChecklistInteractions = t.TypeOf<typeof QuestlistInteractionsV> & unknown;
146
+ export type NudgeInteractionState = t.TypeOf<typeof NudgeInteractionStateV> & unknown;
147
+ export type NudgeInteractions = t.TypeOf<typeof NudgeInteractionsV> & unknown;
144
148
  export type IMessageType = t.TypeOf<typeof MessageV> & unknown;
145
149
  export type IUserMessageType = t.TypeOf<typeof UserMessageV> & unknown;
146
150
  export type IAIMessageType = t.TypeOf<typeof AIMessageV> & unknown;
151
+ export type IQuestionSuggestionsType = t.TypeOf<typeof QuestionSuggestionsV> & unknown;
152
+ export type IQuestionSuggestionsPayloadType = t.TypeOf<typeof QuestionSuggestionsPayloadV> & unknown;
153
+ export type ICreateChatPayloadType = t.TypeOf<typeof CreateChatPayloadV> & unknown;
154
+ export type IContinuationType = t.TypeOf<typeof ContinuationV> & unknown;
155
+ export type IExperienceType = t.TypeOf<typeof ExperienceV> & unknown;
156
+ export type IContinuationsPayloadType = t.TypeOf<typeof ContinuationsPayloadV> & unknown;
157
+ export type IAIAnswerType = t.TypeOf<typeof AIAnswerV> & unknown;
158
+ export type IAIAnswerPayloadType = t.TypeOf<typeof AIAnswerPayloadV> & unknown;
159
+ export type ICreateAnswerFeedbackPayloadType = t.TypeOf<typeof CreateAnswerFeedbackPayloadV> & unknown;
160
+ export type ISearchHelpDocsPayloadType = t.TypeOf<typeof SearchHelpDocsPayloadV> & unknown;
161
+ export type ISearchHelpDocsResponseType = t.TypeOf<typeof SearchHelpDocsResponseV> & unknown;
162
+ export type IHelpDocHitType = t.TypeOf<typeof HelpDocHitV> & unknown;
147
163
  export interface ICommandInput {
148
164
  text: string;
149
165
  command: ICommandType;
@@ -162,6 +178,9 @@ export interface IUserContext {
162
178
  export interface IUserRemoteProperties {
163
179
  [variable: string]: any;
164
180
  }
181
+ export type IEndUserType = t.TypeOf<typeof EndUserV> & unknown;
182
+ export type IEndUserStoreData = t.TypeOf<typeof EndUserStoreDataV> & unknown;
183
+ export type IDecideResponseType = t.TypeOf<typeof DecideResponseV> & unknown;
165
184
  export interface IEndUserAnalytics {
166
185
  num_command_executions: number;
167
186
  num_shortcut_command_executions: number;
@@ -182,7 +201,6 @@ export interface IResourceType extends IUserContext {
182
201
  }
183
202
  export type IAdditionalResource = t.TypeOf<typeof AdditionalResourceV> & unknown;
184
203
  export type IRecommendationSet = t.TypeOf<typeof RecommendationSetV> & unknown;
185
- export type IEditorRecommendationSet = t.TypeOf<typeof EditorRecommendationSetV> & unknown;
186
204
  export type IConfigEndpointResponse = {
187
205
  commands: any[];
188
206
  categories: any[];
@@ -1,12 +1,14 @@
1
+ import { INudgeType } from '../middleware/types';
1
2
  export type TUpdateEditorRouteDetails = {
2
3
  type: 'nudge';
4
+ nudge: INudgeType;
3
5
  nudgeId: string | number;
4
6
  stepId: string | number;
5
7
  } | {
6
8
  type: 'checklist';
7
9
  checklistId: string | number;
8
10
  } | {
9
- type: 'theme';
11
+ type: 'route';
10
12
  route_replacement: string;
11
13
  };
12
14
  export declare function dispatchCustomEvent<T>(eventType: string, detail: T, canBubble?: boolean, cancelable?: boolean): CustomEvent<T>;
@@ -0,0 +1,13 @@
1
+ export type PlatformType = 'mac' | 'ios' | 'windows' | 'android' | 'linux';
2
+ export type BrowserType = 'chrome' | 'firefox' | 'safari' | 'opera' | 'edge' | 'brave' | 'arc' | 'ie10' | 'ie11';
3
+ export type DeviceType = 'mobile' | 'desktop';
4
+ export declare const EDITOR_MOBILE_PREVIEW_SCREEN_HEIGHT: number;
5
+ export declare const EDITOR_MOBILE_PREVIEW_SCREEN_WIDTH: number;
6
+ export declare const EDITOR_MOBILE_PREVIEW_TOP_BAR_HEIGHT = 48;
7
+ export declare const EDITOR_MOBILE_PREVIEW_BOTTOM_BAR_HEIGHT = 48;
8
+ export declare const isMobileDevice: () => boolean;
9
+ export declare const getDeviceType: () => DeviceType;
10
+ export declare const getBrowser: () => BrowserType | null;
11
+ export declare const getOperatingSystem: () => PlatformType;
12
+ export declare const getTriggerKey: (event: any) => any;
13
+ export declare const osControlKey: (suffix?: string) => string;
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { Hub } from '@sentry/core';
3
+ export declare const SENTRY_COMMANDBAR_DSN = "https://ebf252b62885436e858a66d157aee9ea@o451734.ingest.sentry.io/5608348";
4
+ export declare const sentryHubFactory: (dsn: string) => Hub | undefined;
5
+ export declare const initSentryAndAddToSdk: () => void;
6
+ export declare const getSentry: () => Hub | undefined;
7
+ export declare const startSentryTransaction: (context: import("@sentry/types").TransactionContext, customSamplingContext?: import("@sentry/types").CustomSamplingContext | undefined) => import("@sentry/browser").Transaction | null | undefined;
8
+ interface Props {
9
+ children: React.ReactNode;
10
+ }
11
+ interface State {
12
+ hasError: boolean;
13
+ }
14
+ export declare class SentryErrorBoundary extends React.Component<Props, State> {
15
+ constructor(props: Props);
16
+ captureRejection: (ev: PromiseRejectionEvent) => void;
17
+ static getDerivedStateFromError(_error: Error): {
18
+ hasError: boolean;
19
+ };
20
+ componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
21
+ render(): React.ReactNode;
22
+ }
23
+ export {};
package/package.json CHANGED
@@ -1,24 +1,24 @@
1
1
  {
2
2
  "name": "commandbar",
3
- "version": "1.8.6",
3
+ "version": "1.9.0",
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",
7
7
  "sideEffects": false,
8
8
  "scripts": {
9
9
  "clean": "rimraf build",
10
- "build": "webpack build && tsc",
10
+ "build": "NODE_ENV=production webpack build && tsc",
11
11
  "minify-snippet": "ts-node scripts/minify-snippet.ts",
12
12
  "prepublishOnly": "yarn run clean && yarn run build",
13
13
  "test": "jest --runInBand",
14
14
  "test:watch": "jest --watch --verbose false --silent false",
15
- "watch": "scripts/watch.ts"
15
+ "watch": "NODE_ENV=development scripts/watch.ts"
16
16
  },
17
17
  "keywords": [],
18
18
  "author": "",
19
19
  "license": "ISC",
20
20
  "dependencies": {
21
- "commandbar-launcher": "^1.1.9",
21
+ "commandbar-launcher": "^1.1.10",
22
22
  "fp-ts": "2.10.5",
23
23
  "io-ts": "^2.2.14"
24
24
  },
@@ -1,63 +0,0 @@
1
- import { IOrganizationType } from '../middleware/types';
2
- import { PublicDisposable } from '../util/Disposable';
3
- type ExtraData = Record<string, unknown>;
4
- export interface UserScopeOptions {
5
- configuration: {
6
- uuid?: string;
7
- api: string;
8
- editor: string;
9
- proxy: string;
10
- session: string;
11
- };
12
- organization?: IOrganizationType;
13
- organizationId: string | number;
14
- organizationName?: string;
15
- session: string;
16
- userId?: string;
17
- }
18
- declare enum Severity {
19
- Fatal = "fatal",
20
- Error = "error",
21
- Warning = "warning",
22
- Log = "log",
23
- Info = "info",
24
- Debug = "debug",
25
- Critical = "critical"
26
- }
27
- export interface Breadcrumb {
28
- type?: string;
29
- level?: Severity;
30
- event_id?: string;
31
- category?: string;
32
- message?: string;
33
- data?: {
34
- [key: string]: any;
35
- };
36
- timestamp?: number;
37
- hint?: BreadcrumbHint;
38
- }
39
- export interface BreadcrumbHint {
40
- [key: string]: any;
41
- }
42
- export declare abstract class SentryReporter implements PublicDisposable {
43
- _disposed: boolean;
44
- breadcrumb: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void;
45
- dispose(): void;
46
- /**
47
- * Report an error to Sentry. The first argument must either be a string or error object, and optionally an error
48
- * object and extra data (in the form of an object) may be provided as well.
49
- *
50
- * If a string message is provided instead of an Error object a new Error will be generated. This will cause the
51
- * stacktrace to begin at this function; for that reason it is **strongly** recommended to provide an error object
52
- * so that the original stack trace can be preserved (as originalException).
53
- */
54
- abstract exception(message: string, err?: Error, extra?: ExtraData): void;
55
- abstract exception(message: string, extra?: ExtraData): void;
56
- abstract exception(err: Error, extra?: ExtraData): void;
57
- /**
58
- * Assigns various scope properties related to the currently active user and organization so that error events can
59
- * be easily associated with them.
60
- */
61
- abstract setUserScope(opts: UserScopeOptions): void;
62
- }
63
- export {};