commandbar 1.10.1 → 1.10.2-alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/build/commandbar/src/shared/services/analytics/EventHandler.d.ts +7 -2
  2. package/build/commandbar/src/shared/services/analytics/event-queue.d.ts +13 -0
  3. package/build/commandbar/src/shared/services/analytics/types.d.ts +1 -1
  4. package/build/commandbar/src/shared/services/analytics/v2/client.d.ts +54 -0
  5. package/build/commandbar/src/shared/services/analytics/v2/helpers.d.ts +6 -0
  6. package/build/commandbar/src/shared/services/analytics/v2/schema.d.ts +152 -0
  7. package/build/commandbar/src/shared/services/analytics/v2/types.d.ts +4 -0
  8. package/build/commandbar-js/src/index.d.ts +0 -1
  9. package/build/commandbar-js/src/index.js +1 -1
  10. package/build/commandbar-js/src/snippet.d.ts +7 -1
  11. package/build/internal/src/client/CommandBarClientSDK.d.ts +12 -0
  12. package/build/internal/src/client/CommandBarProxySDK.d.ts +1 -4
  13. package/build/internal/src/client/CommandBarSDK.d.ts +5 -3
  14. package/build/internal/src/client/SDKConfig.d.ts +3 -1
  15. package/build/internal/src/client/globals.d.ts +1 -0
  16. package/build/internal/src/client/symbols.d.ts +3 -1
  17. package/build/internal/src/middleware/CommandFromClientV.d.ts +16 -2
  18. package/build/internal/src/middleware/OrganizationV.d.ts +34 -8
  19. package/build/internal/src/middleware/additionalResource.d.ts +9 -9
  20. package/build/internal/src/middleware/api.d.ts +173 -0
  21. package/build/internal/src/middleware/billing.d.ts +10 -0
  22. package/build/internal/src/middleware/chat.d.ts +3662 -172
  23. package/build/internal/src/middleware/checklist.d.ts +18 -10
  24. package/build/internal/src/middleware/command.d.ts +540 -140
  25. package/build/internal/src/middleware/endUser.d.ts +2 -0
  26. package/build/internal/src/middleware/experienceTemplate.d.ts +2874 -8
  27. package/build/internal/src/middleware/experiencesSearch.d.ts +233 -28
  28. package/build/internal/src/middleware/flags.d.ts +14 -1
  29. package/build/internal/src/middleware/generics.d.ts +1 -0
  30. package/build/internal/src/middleware/helpDocsIntegration.d.ts +98 -0
  31. package/build/internal/src/middleware/helpDocsSearch.d.ts +165 -20
  32. package/build/internal/src/middleware/helpDocsSync.d.ts +4 -0
  33. package/build/internal/src/middleware/helpers/actions.d.ts +6 -6
  34. package/build/internal/src/middleware/helpers/commandTemplate.d.ts +2 -2
  35. package/build/internal/src/middleware/helpers/rules.d.ts +7 -7
  36. package/build/internal/src/middleware/localizedMessage.d.ts +50 -0
  37. package/build/internal/src/middleware/network.d.ts +1 -0
  38. package/build/internal/src/middleware/nudge.d.ts +96 -24
  39. package/build/internal/src/middleware/organization.d.ts +180 -62
  40. package/build/internal/src/middleware/organizationSettings.d.ts +8 -8
  41. package/build/internal/src/middleware/profile.d.ts +8 -0
  42. package/build/internal/src/middleware/recommendationSet.d.ts +18 -9
  43. package/build/internal/src/middleware/theme.d.ts +7 -0
  44. package/build/internal/src/middleware/types.d.ts +23 -5
  45. package/build/internal/src/middleware/user.d.ts +9 -1
  46. package/build/internal/src/middleware/workflow.d.ts +69 -0
  47. package/package.json +5 -2
  48. package/src/index.ts +0 -1
  49. package/src/init.ts +27 -13
  50. package/src/snippet.ts +79 -74
  51. package/build/internal/src/client/OrgConfig.d.ts +0 -5
  52. package/build/internal/src/middleware/guide.d.ts +0 -37
@@ -89,7 +89,7 @@ export declare const OrganizationSettingsV: t.TypeC<{
89
89
  }>]>, t.TypeC<{
90
90
  type: t.LiteralC<"open_chat">;
91
91
  meta: t.TypeC<{
92
- type: t.UnionC<[t.LiteralC<"intercom">, t.LiteralC<"helpscout">, t.LiteralC<"freshdesk">, t.LiteralC<"crisp">, t.LiteralC<"zendesk">, t.LiteralC<"liveChat">, t.LiteralC<"gist">, t.LiteralC<"olark">, t.LiteralC<"hubspot">, t.LiteralC<"drift">, t.LiteralC<"">]>;
92
+ type: t.UnionC<[t.LiteralC<"intercom">, t.LiteralC<"helpscout">, t.LiteralC<"freshdesk">, t.LiteralC<"freshchat">, t.LiteralC<"crisp">, t.LiteralC<"zendesk">, t.LiteralC<"liveChat">, t.LiteralC<"gist">, t.LiteralC<"olark">, t.LiteralC<"hubspot">, t.LiteralC<"drift">, t.LiteralC<"zendesk_handoff">, t.LiteralC<"">]>;
93
93
  }>;
94
94
  }>, t.TypeC<{
95
95
  type: t.LiteralC<"dismiss">;
@@ -144,7 +144,7 @@ export declare const OrganizationSettingsV: t.TypeC<{
144
144
  }>]>, t.TypeC<{
145
145
  type: t.LiteralC<"open_chat">;
146
146
  meta: t.TypeC<{
147
- type: t.UnionC<[t.LiteralC<"intercom">, t.LiteralC<"helpscout">, t.LiteralC<"freshdesk">, t.LiteralC<"crisp">, t.LiteralC<"zendesk">, t.LiteralC<"liveChat">, t.LiteralC<"gist">, t.LiteralC<"olark">, t.LiteralC<"hubspot">, t.LiteralC<"drift">, t.LiteralC<"">]>;
147
+ type: t.UnionC<[t.LiteralC<"intercom">, t.LiteralC<"helpscout">, t.LiteralC<"freshdesk">, t.LiteralC<"freshchat">, t.LiteralC<"crisp">, t.LiteralC<"zendesk">, t.LiteralC<"liveChat">, t.LiteralC<"gist">, t.LiteralC<"olark">, t.LiteralC<"hubspot">, t.LiteralC<"drift">, t.LiteralC<"zendesk_handoff">, t.LiteralC<"">]>;
148
148
  }>;
149
149
  }>, t.TypeC<{
150
150
  type: t.LiteralC<"dismiss">;
@@ -277,7 +277,7 @@ export declare const read: (params?: Record<string, string> | undefined, callbac
277
277
  }) | {
278
278
  type: "open_chat";
279
279
  meta: {
280
- type: "" | "intercom" | "helpscout" | "freshdesk" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift";
280
+ type: "" | "intercom" | "helpscout" | "freshdesk" | "freshchat" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift" | "zendesk_handoff";
281
281
  };
282
282
  } | {
283
283
  type: "dismiss";
@@ -332,7 +332,7 @@ export declare const read: (params?: Record<string, string> | undefined, callbac
332
332
  }) | {
333
333
  type: "open_chat";
334
334
  meta: {
335
- type: "" | "intercom" | "helpscout" | "freshdesk" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift";
335
+ type: "" | "intercom" | "helpscout" | "freshdesk" | "freshchat" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift" | "zendesk_handoff";
336
336
  };
337
337
  } | {
338
338
  type: "dismiss";
@@ -461,7 +461,7 @@ export declare const update: (object: {
461
461
  }) | {
462
462
  type: "open_chat";
463
463
  meta: {
464
- type: "" | "intercom" | "helpscout" | "freshdesk" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift";
464
+ type: "" | "intercom" | "helpscout" | "freshdesk" | "freshchat" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift" | "zendesk_handoff";
465
465
  };
466
466
  } | {
467
467
  type: "dismiss";
@@ -516,7 +516,7 @@ export declare const update: (object: {
516
516
  }) | {
517
517
  type: "open_chat";
518
518
  meta: {
519
- type: "" | "intercom" | "helpscout" | "freshdesk" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift";
519
+ type: "" | "intercom" | "helpscout" | "freshdesk" | "freshchat" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift" | "zendesk_handoff";
520
520
  };
521
521
  } | {
522
522
  type: "dismiss";
@@ -647,7 +647,7 @@ export declare const update: (object: {
647
647
  }) | {
648
648
  type: "open_chat";
649
649
  meta: {
650
- type: "" | "intercom" | "helpscout" | "freshdesk" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift";
650
+ type: "" | "intercom" | "helpscout" | "freshdesk" | "freshchat" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift" | "zendesk_handoff";
651
651
  };
652
652
  } | {
653
653
  type: "dismiss";
@@ -702,7 +702,7 @@ export declare const update: (object: {
702
702
  }) | {
703
703
  type: "open_chat";
704
704
  meta: {
705
- type: "" | "intercom" | "helpscout" | "freshdesk" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift";
705
+ type: "" | "intercom" | "helpscout" | "freshdesk" | "freshchat" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift" | "zendesk_handoff";
706
706
  };
707
707
  } | {
708
708
  type: "dismiss";
@@ -3,11 +3,19 @@ export declare const ProfileV: t.TypeC<{
3
3
  user: t.StringC;
4
4
  organization: t.StringC;
5
5
  is_active: t.BooleanC;
6
+ role: t.UnionC<[t.LiteralC<"admin">, t.LiteralC<"editor">, t.LiteralC<"contributor">, t.LiteralC<"viewer">]>;
7
+ first_name: t.StringC;
8
+ last_name: t.StringC;
9
+ email: t.StringC;
6
10
  }>;
7
11
  export declare class Profile {
8
12
  static list: (onSuccess?: (() => void) | undefined, onError?: ((err: string) => void) | undefined) => Promise<{
9
13
  user: string;
10
14
  organization: string;
11
15
  is_active: boolean;
16
+ role: "admin" | "editor" | "contributor" | "viewer";
17
+ first_name: string;
18
+ last_name: string;
19
+ email: string;
12
20
  }[]>;
13
21
  }
@@ -45,7 +45,7 @@ export declare const RecommendationSetAdditionalV: t.TypeC<{
45
45
  }>]>, t.TypeC<{
46
46
  type: t.LiteralC<"open_chat">;
47
47
  meta: t.TypeC<{
48
- type: t.UnionC<[t.LiteralC<"intercom">, t.LiteralC<"helpscout">, t.LiteralC<"freshdesk">, t.LiteralC<"crisp">, t.LiteralC<"zendesk">, t.LiteralC<"liveChat">, t.LiteralC<"gist">, t.LiteralC<"olark">, t.LiteralC<"hubspot">, t.LiteralC<"drift">, t.LiteralC<"">]>;
48
+ type: t.UnionC<[t.LiteralC<"intercom">, t.LiteralC<"helpscout">, t.LiteralC<"freshdesk">, t.LiteralC<"freshchat">, t.LiteralC<"crisp">, t.LiteralC<"zendesk">, t.LiteralC<"liveChat">, t.LiteralC<"gist">, t.LiteralC<"olark">, t.LiteralC<"hubspot">, t.LiteralC<"drift">, t.LiteralC<"zendesk_handoff">, t.LiteralC<"">]>;
49
49
  }>;
50
50
  }>, t.TypeC<{
51
51
  type: t.LiteralC<"dismiss">;
@@ -74,6 +74,7 @@ export declare const RecommendationSetAdditionalV: t.TypeC<{
74
74
  }>]>;
75
75
  cta: t.StringC;
76
76
  }>>;
77
+ is_live: t.BooleanC;
77
78
  }>;
78
79
  export declare const RecommendationSetV: t.IntersectionC<[t.TypeC<{
79
80
  id: t.NumberC;
@@ -120,7 +121,7 @@ export declare const RecommendationSetV: t.IntersectionC<[t.TypeC<{
120
121
  }>]>, t.TypeC<{
121
122
  type: t.LiteralC<"open_chat">;
122
123
  meta: t.TypeC<{
123
- type: t.UnionC<[t.LiteralC<"intercom">, t.LiteralC<"helpscout">, t.LiteralC<"freshdesk">, t.LiteralC<"crisp">, t.LiteralC<"zendesk">, t.LiteralC<"liveChat">, t.LiteralC<"gist">, t.LiteralC<"olark">, t.LiteralC<"hubspot">, t.LiteralC<"drift">, t.LiteralC<"">]>;
124
+ type: t.UnionC<[t.LiteralC<"intercom">, t.LiteralC<"helpscout">, t.LiteralC<"freshdesk">, t.LiteralC<"freshchat">, t.LiteralC<"crisp">, t.LiteralC<"zendesk">, t.LiteralC<"liveChat">, t.LiteralC<"gist">, t.LiteralC<"olark">, t.LiteralC<"hubspot">, t.LiteralC<"drift">, t.LiteralC<"zendesk_handoff">, t.LiteralC<"">]>;
124
125
  }>;
125
126
  }>, t.TypeC<{
126
127
  type: t.LiteralC<"dismiss">;
@@ -149,6 +150,7 @@ export declare const RecommendationSetV: t.IntersectionC<[t.TypeC<{
149
150
  }>]>;
150
151
  cta: t.StringC;
151
152
  }>>;
153
+ is_live: t.BooleanC;
152
154
  }>]>;
153
155
  export declare class RecommendationSet {
154
156
  static decode: (data: any) => {
@@ -194,7 +196,7 @@ export declare class RecommendationSet {
194
196
  }) | {
195
197
  type: "open_chat";
196
198
  meta: {
197
- type: "" | "intercom" | "helpscout" | "freshdesk" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift";
199
+ type: "" | "intercom" | "helpscout" | "freshdesk" | "freshchat" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift" | "zendesk_handoff";
198
200
  };
199
201
  } | {
200
202
  type: "dismiss";
@@ -225,6 +227,7 @@ export declare class RecommendationSet {
225
227
  };
226
228
  cta: string;
227
229
  }[];
230
+ is_live: boolean;
228
231
  };
229
232
  static create: (object: {
230
233
  id: number;
@@ -269,7 +272,7 @@ export declare class RecommendationSet {
269
272
  }) | {
270
273
  type: "open_chat";
271
274
  meta: {
272
- type: "" | "intercom" | "helpscout" | "freshdesk" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift";
275
+ type: "" | "intercom" | "helpscout" | "freshdesk" | "freshchat" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift" | "zendesk_handoff";
273
276
  };
274
277
  } | {
275
278
  type: "dismiss";
@@ -300,6 +303,7 @@ export declare class RecommendationSet {
300
303
  };
301
304
  cta: string;
302
305
  }[];
306
+ is_live: boolean;
303
307
  }, onSuccess?: (() => void) | undefined, onError?: ((err: string) => void) | undefined) => Promise<{
304
308
  id: number;
305
309
  widget: string;
@@ -343,7 +347,7 @@ export declare class RecommendationSet {
343
347
  }) | {
344
348
  type: "open_chat";
345
349
  meta: {
346
- type: "" | "intercom" | "helpscout" | "freshdesk" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift";
350
+ type: "" | "intercom" | "helpscout" | "freshdesk" | "freshchat" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift" | "zendesk_handoff";
347
351
  };
348
352
  } | {
349
353
  type: "dismiss";
@@ -374,6 +378,7 @@ export declare class RecommendationSet {
374
378
  };
375
379
  cta: string;
376
380
  }[];
381
+ is_live: boolean;
377
382
  }>;
378
383
  static update: (object: {
379
384
  id: number;
@@ -418,7 +423,7 @@ export declare class RecommendationSet {
418
423
  }) | {
419
424
  type: "open_chat";
420
425
  meta: {
421
- type: "" | "intercom" | "helpscout" | "freshdesk" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift";
426
+ type: "" | "intercom" | "helpscout" | "freshdesk" | "freshchat" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift" | "zendesk_handoff";
422
427
  };
423
428
  } | {
424
429
  type: "dismiss";
@@ -449,6 +454,7 @@ export declare class RecommendationSet {
449
454
  };
450
455
  cta: string;
451
456
  }[];
457
+ is_live: boolean;
452
458
  }, onSuccess?: (() => void) | undefined, onError?: ((err: string) => void) | undefined) => Promise<{
453
459
  id: number;
454
460
  widget: string;
@@ -492,7 +498,7 @@ export declare class RecommendationSet {
492
498
  }) | {
493
499
  type: "open_chat";
494
500
  meta: {
495
- type: "" | "intercom" | "helpscout" | "freshdesk" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift";
501
+ type: "" | "intercom" | "helpscout" | "freshdesk" | "freshchat" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift" | "zendesk_handoff";
496
502
  };
497
503
  } | {
498
504
  type: "dismiss";
@@ -523,6 +529,7 @@ export declare class RecommendationSet {
523
529
  };
524
530
  cta: string;
525
531
  }[];
532
+ is_live: boolean;
526
533
  }>;
527
534
  static delete: (id: string | number, params?: Record<string, string> | undefined, onSuccess?: (() => void) | undefined, onError?: ((err: string) => void) | undefined) => Promise<void>;
528
535
  static list: (onSuccess?: (() => void) | undefined, onError?: ((err: string) => void) | undefined) => Promise<({
@@ -568,7 +575,7 @@ export declare class RecommendationSet {
568
575
  }) | {
569
576
  type: "open_chat";
570
577
  meta: {
571
- type: "" | "intercom" | "helpscout" | "freshdesk" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift";
578
+ type: "" | "intercom" | "helpscout" | "freshdesk" | "freshchat" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift" | "zendesk_handoff";
572
579
  };
573
580
  } | {
574
581
  type: "dismiss";
@@ -599,6 +606,7 @@ export declare class RecommendationSet {
599
606
  };
600
607
  cta: string;
601
608
  }[];
609
+ is_live: boolean;
602
610
  })[]>;
603
611
  static read: (arg0: string, params?: Record<string, string> | undefined, callbacks?: {
604
612
  onSuccess?: (() => void) | undefined;
@@ -646,7 +654,7 @@ export declare class RecommendationSet {
646
654
  }) | {
647
655
  type: "open_chat";
648
656
  meta: {
649
- type: "" | "intercom" | "helpscout" | "freshdesk" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift";
657
+ type: "" | "intercom" | "helpscout" | "freshdesk" | "freshchat" | "crisp" | "zendesk" | "liveChat" | "gist" | "olark" | "hubspot" | "drift" | "zendesk_handoff";
650
658
  };
651
659
  } | {
652
660
  type: "dismiss";
@@ -677,5 +685,6 @@ export declare class RecommendationSet {
677
685
  };
678
686
  cta: string;
679
687
  }[];
688
+ is_live: boolean;
680
689
  }>;
681
690
  }
@@ -53,6 +53,7 @@ export declare const ThemeV: t.TypeC<{
53
53
  }>;
54
54
  }>, t.NullC, t.UndefinedC]>;
55
55
  organization: t.StringC;
56
+ archived: t.BooleanC;
56
57
  }>;
57
58
  export declare const ThemePatchV: t.PartialC<{
58
59
  id: t.StringC;
@@ -88,6 +89,7 @@ export declare const ThemePatchV: t.PartialC<{
88
89
  }>;
89
90
  }>, t.NullC, t.UndefinedC]>;
90
91
  organization: t.StringC;
92
+ archived: t.BooleanC;
91
93
  }>;
92
94
  export declare class Theme {
93
95
  static list: (onSuccess?: (() => void) | undefined, onError?: ((err: string) => void) | undefined) => Promise<{
@@ -156,6 +158,7 @@ export declare class Theme {
156
158
  };
157
159
  } | null | undefined;
158
160
  organization: string;
161
+ archived: boolean;
159
162
  }[]>;
160
163
  static read: (arg0: string, params?: Record<string, string> | undefined, callbacks?: {
161
164
  onSuccess?: (() => void) | undefined;
@@ -226,6 +229,7 @@ export declare class Theme {
226
229
  };
227
230
  } | null | undefined;
228
231
  organization: string;
232
+ archived: boolean;
229
233
  }>;
230
234
  static update: (theme: t.TypeOf<typeof ThemePatchV>) => Promise<{
231
235
  id: string;
@@ -293,6 +297,7 @@ export declare class Theme {
293
297
  };
294
298
  } | null | undefined;
295
299
  organization: string;
300
+ archived: boolean;
296
301
  }>;
297
302
  static create: (object: {
298
303
  id?: string | undefined;
@@ -360,6 +365,7 @@ export declare class Theme {
360
365
  };
361
366
  } | null | undefined;
362
367
  organization?: string | undefined;
368
+ archived?: boolean | undefined;
363
369
  }, onSuccess?: (() => void) | undefined, onError?: ((err: string) => void) | undefined) => Promise<{
364
370
  id: string;
365
371
  slug: string;
@@ -426,6 +432,7 @@ export declare class Theme {
426
432
  };
427
433
  } | null | undefined;
428
434
  organization: string;
435
+ archived: boolean;
429
436
  }>;
430
437
  static delete: (id: string | number, params?: Record<string, string> | undefined, onSuccess?: (() => void) | undefined, onError?: ((err: string) => void) | undefined) => Promise<void>;
431
438
  }
@@ -11,7 +11,6 @@ import { OrganizationStatusV, KeyEventV, RecordSettingsByContextKeyV, InternalSe
11
11
  import { OrganizationSettingsV } from './organizationSettings';
12
12
  import { UserV } from './user';
13
13
  import { ContextV } from './context';
14
- import { GuideV } from './guide';
15
14
  import { HistoryEventV } from './historyEvent';
16
15
  import { HelpDocSyncLogMessageV, HelpDocsSyncV } from './helpDocsSync';
17
16
  import { HelpDocsIntegrationV } from './helpDocsIntegration';
@@ -32,7 +31,7 @@ import { AudienceV } from './helpers/audience';
32
31
  import { AdditionalResourceV } from './additionalResource';
33
32
  import { RecommendationSetV } from './recommendationSet';
34
33
  import { BillingProfileV, UsageV } from './billing';
35
- import { UserMessageV, AIMessageV, MessageV, AIAnswerPayloadV, AIAnswerV, ContinuationsPayloadV, ContinuationV, CreateAnswerFeedbackPayloadV, QuestionSuggestionsPayloadV, QuestionSuggestionsV, ExperienceV, CreateChatPayloadV, ChatV, CopilotSettingsPreviewV } from './chat';
34
+ import { UserMessageV, AIMessageV, AIMessageExtraV, MessageV, AIAnswerPayloadV, AIAnswerV, ContinuationsPayloadV, ContinuationV, CreateAnswerFeedbackPayloadV, QuestionSuggestionsPayloadV, QuestionSuggestionsV, ExperienceV, CreateChatPayloadV, ChatV, CopilotSettingsPreviewV, HandoffPayloadV, ExternalChatPayloadV, ExternalChatHistoryV } from './chat';
36
35
  import { HelpDocHitV, SearchHelpDocsPayloadV, SearchHelpDocsResponseV } from './helpDocsSearch';
37
36
  import { ExperienceHitV, ExperienceTypeOptions, SearchExperiencesPayloadV, SearchExperiencesResponseV } from './experiencesSearch';
38
37
  import { HelpHubLauncherSettingsV } from './helpHub';
@@ -40,13 +39,19 @@ import { EntityChangeV } from './entityChanges';
40
39
  import { Flags } from './flags';
41
40
  import { CopilotPersonalityAdjectiveV, CopilotPersonalityResponseFormatV, CopilotPersonalityResponseLengthV, CopilotPersonalityV } from './helpers/copilotPersonality';
42
41
  import { ExperienceTemplateV } from './experienceTemplate';
42
+ import { APIV } from './api';
43
+ import { LocalizedMessagePatchV, LocalizedMessageV, LocalizedMessages } from './localizedMessage';
44
+ import { WorkflowV } from './workflow';
43
45
  /*******************************************************************************/
44
46
  export type IInitOptions = {
47
+ apiOrigin?: string;
48
+ cdnOrigin?: string;
45
49
  debug?: boolean;
46
50
  environment?: string;
47
51
  version?: string;
48
52
  config?: any;
49
53
  nonce?: string;
54
+ silentMode?: boolean;
50
55
  };
51
56
  /** Additional foobar init options */
52
57
  export declare const SUPPORTED_FOOBAR_INIT_DEPLOYMENT_OPTIONS: readonly ["dev", "labs", "prod"];
@@ -63,9 +68,6 @@ export type IEditorCommandTypeLite = t.TypeOf<typeof EditorCommandLiteV> & unkno
63
68
  export type ICommandTypeLite = t.TypeOf<typeof CommandLiteV> & unknown;
64
69
  export type { ICommandFromClientType } from './ICommandFromClientType';
65
70
  export type ICommandCategoryType = t.TypeOf<typeof CommandCategoryV> & unknown;
66
- export type IGuideType = t.TypeOf<typeof GuideV> & {
67
- preview?: boolean;
68
- } & unknown;
69
71
  export type IHistoryEventType = t.TypeOf<typeof HistoryEventV> & unknown;
70
72
  export type IEntityChangeType = t.TypeOf<typeof EntityChangeV> & unknown;
71
73
  export type IHelpDocsSyncType = t.TypeOf<typeof HelpDocsSyncV> & unknown;
@@ -124,6 +126,12 @@ export type INudgeTooltipStepType = INudgeStepType & {
124
126
  type: 'tooltip';
125
127
  };
126
128
  };
129
+ export type INudgePinStepType = INudgeStepType & {
130
+ form_factor: {
131
+ type: 'pin';
132
+ };
133
+ };
134
+ export type INudgeAnchorableStepType = INudgeTooltipStepType | INudgePinStepType;
127
135
  export type INudgeStepContentBlockType = t.TypeOf<typeof NudgeContentBlockV> & unknown;
128
136
  export type INudgeStepContentMarkdownBlockType = t.TypeOf<typeof NudgeContentMarkdownBlockV> & unknown;
129
137
  export type INudgeStepContentImageBlockType = t.TypeOf<typeof NudgeContentImageBlockV> & unknown;
@@ -167,6 +175,7 @@ export type NudgeInteractions = t.TypeOf<typeof NudgeInteractionsV> & unknown;
167
175
  export type IMessageType = t.TypeOf<typeof MessageV> & unknown;
168
176
  export type IUserMessageType = t.TypeOf<typeof UserMessageV> & unknown;
169
177
  export type IAIMessageType = t.TypeOf<typeof AIMessageV> & unknown;
178
+ export type IAIMessageExtraType = t.TypeOf<typeof AIMessageExtraV> & unknown;
170
179
  export type IQuestionSuggestionsType = t.TypeOf<typeof QuestionSuggestionsV> & unknown;
171
180
  export type IQuestionSuggestionsPayloadType = t.TypeOf<typeof QuestionSuggestionsPayloadV> & unknown;
172
181
  export type ICreateChatPayloadType = t.TypeOf<typeof CreateChatPayloadV> & unknown;
@@ -175,6 +184,9 @@ export type IExperienceType = t.TypeOf<typeof ExperienceV> & unknown;
175
184
  export type IContinuationsPayloadType = t.TypeOf<typeof ContinuationsPayloadV> & unknown;
176
185
  export type IAIAnswerType = t.TypeOf<typeof AIAnswerV> & unknown;
177
186
  export type IAIAnswerPayloadType = t.TypeOf<typeof AIAnswerPayloadV> & unknown;
187
+ export type IHandoffPayloadType = t.TypeOf<typeof HandoffPayloadV> & unknown;
188
+ export type IExternalChatPayloadType = t.TypeOf<typeof ExternalChatPayloadV> & unknown;
189
+ export type IExternalChatHistoryType = t.TypeOf<typeof ExternalChatHistoryV> & unknown;
178
190
  export type ICreateAnswerFeedbackPayloadType = t.TypeOf<typeof CreateAnswerFeedbackPayloadV> & unknown;
179
191
  export type ISearchHelpDocsPayloadType = t.TypeOf<typeof SearchHelpDocsPayloadV> & unknown;
180
192
  export type ISearchHelpDocsResponseType = t.TypeOf<typeof SearchHelpDocsResponseV> & unknown;
@@ -230,6 +242,10 @@ export interface IResourceType extends IUserContext {
230
242
  }
231
243
  export type IAdditionalResource = t.TypeOf<typeof AdditionalResourceV> & unknown;
232
244
  export type IRecommendationSet = t.TypeOf<typeof RecommendationSetV> & unknown;
245
+ export type ILocalizedMessage = t.TypeOf<typeof LocalizedMessageV> & unknown;
246
+ export type ILocalizedMessagePatch = t.TypeOf<typeof LocalizedMessagePatchV> & unknown;
247
+ export type IAPI = t.TypeOf<typeof APIV> & unknown;
248
+ export type IWorkflow = t.TypeOf<typeof WorkflowV> & unknown;
233
249
  export type IConfigEndpointResponse = {
234
250
  commands: any[];
235
251
  categories: any[];
@@ -245,6 +261,7 @@ export type IConfigEndpointResponse = {
245
261
  __meta__?: {
246
262
  latest_foobar_version?: string;
247
263
  };
264
+ localized_messages: LocalizedMessages;
248
265
  };
249
266
  export type IConfigType = {
250
267
  commands: ICommandType[];
@@ -261,6 +278,7 @@ export type IConfigType = {
261
278
  latest_foobar_version?: string;
262
279
  };
263
280
  flags: Flags;
281
+ localized_messages: LocalizedMessages;
264
282
  };
265
283
  export type { IRecordSettings } from './IRecordSettings';
266
284
  export type IRecordSettingsByContextKey = t.TypeOf<typeof RecordSettingsByContextKeyV> & unknown;
@@ -7,7 +7,15 @@ export declare const UserV: t.IntersectionC<[t.TypeC<{
7
7
  organization: t.StringC;
8
8
  organization_name: t.StringC;
9
9
  api_token: t.UnionC<[t.StringC, t.NullC]>;
10
- profile: t.NumberC;
10
+ profile: t.TypeC<{
11
+ user: t.StringC;
12
+ organization: t.StringC;
13
+ is_active: t.BooleanC;
14
+ role: t.UnionC<[t.LiteralC<"admin">, t.LiteralC<"editor">, t.LiteralC<"contributor">, t.LiteralC<"viewer">]>;
15
+ first_name: t.StringC;
16
+ last_name: t.StringC;
17
+ email: t.StringC;
18
+ }>;
11
19
  has_updated_password: t.BooleanC;
12
20
  is_active: t.BooleanC;
13
21
  is_hijacked: t.BooleanC;
@@ -0,0 +1,69 @@
1
+ import * as t from 'io-ts';
2
+ export declare const WorkflowV: t.TypeC<{
3
+ id: t.NumberC;
4
+ archived: t.BooleanC;
5
+ is_live: t.BooleanC;
6
+ title: t.StringC;
7
+ prompt: t.StringC;
8
+ trigger: t.AnyC;
9
+ }>;
10
+ export declare class Workflow {
11
+ static decode: (data: any) => {
12
+ id: number;
13
+ archived: boolean;
14
+ is_live: boolean;
15
+ title: string;
16
+ prompt: string;
17
+ trigger: any;
18
+ };
19
+ static create: (object: {
20
+ id: number;
21
+ archived: boolean;
22
+ is_live: boolean;
23
+ title: string;
24
+ prompt: string;
25
+ trigger: any;
26
+ }, onSuccess?: (() => void) | undefined, onError?: ((err: string) => void) | undefined) => Promise<{
27
+ id: number;
28
+ archived: boolean;
29
+ is_live: boolean;
30
+ title: string;
31
+ prompt: string;
32
+ trigger: any;
33
+ }>;
34
+ static update: (object: {
35
+ id: number;
36
+ archived: boolean;
37
+ is_live: boolean;
38
+ title: string;
39
+ prompt: string;
40
+ trigger: any;
41
+ }, onSuccess?: (() => void) | undefined, onError?: ((err: string) => void) | undefined) => Promise<{
42
+ id: number;
43
+ archived: boolean;
44
+ is_live: boolean;
45
+ title: string;
46
+ prompt: string;
47
+ trigger: any;
48
+ }>;
49
+ static delete: (id: string | number, params?: Record<string, string> | undefined, onSuccess?: (() => void) | undefined, onError?: ((err: string) => void) | undefined) => Promise<void>;
50
+ static list: (onSuccess?: (() => void) | undefined, onError?: ((err: string) => void) | undefined) => Promise<{
51
+ id: number;
52
+ archived: boolean;
53
+ is_live: boolean;
54
+ title: string;
55
+ prompt: string;
56
+ trigger: any;
57
+ }[]>;
58
+ static read: (arg0: string, params?: Record<string, string> | undefined, callbacks?: {
59
+ onSuccess?: (() => void) | undefined;
60
+ onError?: ((err: string) => void) | undefined;
61
+ } | undefined) => Promise<{
62
+ id: number;
63
+ archived: boolean;
64
+ is_live: boolean;
65
+ title: string;
66
+ prompt: string;
67
+ trigger: any;
68
+ }>;
69
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commandbar",
3
- "version": "1.10.1",
3
+ "version": "1.10.2-alpha",
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",
@@ -8,7 +8,7 @@
8
8
  "scripts": {
9
9
  "clean": "rimraf build",
10
10
  "build": "NODE_ENV=production webpack build && tsc",
11
- "minify-snippet": "ts-node scripts/minify-snippet.ts",
11
+ "minify-snippet": "tsx 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",
@@ -23,7 +23,10 @@
23
23
  "io-ts": "^2.2.14"
24
24
  },
25
25
  "devDependencies": {
26
+ "@types/jest": "^29.5.3",
27
+ "jest": "^29.7.0",
26
28
  "rimraf": "3.0.2",
29
+ "tsx": "^4.9.3",
27
30
  "typescript": "5.1.5",
28
31
  "webpack": "^5.74.0"
29
32
  }
package/src/index.ts CHANGED
@@ -3,7 +3,6 @@ import type { CommandBarClientSDK } from '@commandbar/internal/src/client/Comman
3
3
 
4
4
  export { default as init } from './init';
5
5
  export { initProxySDK as initProxy } from '@commandbar/internal/src/client/proxy';
6
- export { snippet } from './snippet';
7
6
  export { CommandBarClientSDK };
8
7
  export { Launcher, getControlKey };
9
8
 
package/src/init.ts CHANGED
@@ -5,8 +5,8 @@ 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, nonce?: string) => {
9
- let origin = 'https://api.commandbar.com';
8
+ const getSrc = (org: string, opts: IInitOptions) => {
9
+ let origin = opts.apiOrigin || 'https://api.commandbar.com';
10
10
  const params = [];
11
11
 
12
12
  const lc = localStorage.getItem('commandbar.lc');
@@ -21,8 +21,16 @@ const getSrc = (org: string, nonce?: string) => {
21
21
  params.push('lc=' + lc);
22
22
  }
23
23
 
24
- if (nonce) {
25
- params.push('nonce=' + nonce);
24
+ if (opts.nonce) {
25
+ params.push('nonce=' + encodeURIComponent(opts.nonce));
26
+ }
27
+
28
+ if (opts.silentMode) {
29
+ params.push('silent=true');
30
+ }
31
+
32
+ if (opts.cdnOrigin) {
33
+ params.push('cdn=' + encodeURIComponent(opts.cdnOrigin));
26
34
  }
27
35
 
28
36
  const version = 2;
@@ -32,14 +40,14 @@ const getSrc = (org: string, nonce?: string) => {
32
40
  return src;
33
41
  };
34
42
 
35
- const loadLatest = (org: string, nonce?: string) => {
43
+ const loadLatest = (org: string, opts: IInitOptions) => {
36
44
  if (document.readyState !== 'complete') {
37
45
  // NOTE: `once` is not supported by IE11 and this will cause a (minor!) memory leak.
38
- window.addEventListener('load', loadLatest.bind(null, org, nonce), { capture: false, once: true });
46
+ window.addEventListener('load', loadLatest.bind(null, org, opts), { capture: false, once: true });
39
47
  return;
40
48
  }
41
49
 
42
- const src = getSrc(org, nonce);
50
+ const src = getSrc(org, opts);
43
51
 
44
52
  const el = document.createElement('script');
45
53
  el.type = 'text/javascript';
@@ -48,7 +56,10 @@ const loadLatest = (org: string, nonce?: string) => {
48
56
  document.head.appendChild(el);
49
57
  };
50
58
 
51
- const DEFAULT_OPTS = { debug: false };
59
+ const DEFAULT_OPTS = {
60
+ debug: false,
61
+ silentMode: false,
62
+ } as const;
52
63
 
53
64
  /**
54
65
  * Initializes CommandBar and injects the scripts required to load it into the <head> of the document. After calling
@@ -76,14 +87,17 @@ const init = (org: string, opts: IInitOptions = DEFAULT_OPTS) => {
76
87
  config.debug && console.log('CommandBar init...', { environment: opts.environment, version: opts.version });
77
88
 
78
89
  getProxySDK()[_configuration] = {
90
+ api: config.apiOrigin,
91
+ cdn: config.cdnOrigin,
79
92
  uuid: org,
80
- environment: opts.environment,
81
- version: opts.version,
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,
93
+ environment: config.environment,
94
+ version: config.version,
95
+ config: config.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
96
+ nonce: config.nonce,
97
+ silent: config.silentMode,
84
98
  };
85
99
 
86
- loadLatest(org, opts.nonce);
100
+ loadLatest(org, config);
87
101
  };
88
102
 
89
103
  export default init;