@archbee/app-widget 1.1.23 → 1.1.24

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.
package/README.md CHANGED
@@ -104,11 +104,18 @@ ReactDOM.render(<App />, appElement);
104
104
  | `jwt` | `string` | `optional` | Pass the jwt token in order to see jwt protected docs.
105
105
  | `shareableToken` | `string` | `optional` | Pass the shareableToken from your private links to protect your docs.
106
106
  | `className` | `string` | `optional` | Pass CSS classes to the `div` wrapper
107
- | `widgetType` | `docs \| search` | `optional` | Default value is `docs``. This opens the widget with the desired behaviour. `docs`` type will open the widget with the default behaviour, `search` will open a search widget bar that shows a search bar with AI support (if included in your subscription)
108
- | `loadingStrategy` | `eager \| lazy` | `optional` | Default value is `lazy`. Loading strategy method for widget loading.
107
+ | `widgetType` | `docs \| search` | `optional` | Default value is `docs`. This opens the widget with the desired behaviour. `docs`` type will open the widget with the default behaviour, `search` will open a search widget bar that shows a search bar with AI support (if included in your subscription)
108
+ | `bubble` | `ask \| invisible` | `optional` | Default value is `invisible`. This prop will display an ask bubble in the bottom-right of your screen. Whenever someone clicks on it, the search widget will open.
109
+ | `loadingStrategy` | `eager \| lazy` | `optional` | Default value is `lazy`. While `lazy` loading delays the initialization of a resource, `eager` loading initializes or loads the widget as soon as the code is executed.
109
110
  | `onWidgetOpen` | `void` | `optional` | Callback that is called after widget opens.
110
111
  | `onWidgetClose` | `void` | `optional` | Callback that is called after widget closes.
111
112
 
113
+ ## Bubble
114
+
115
+ Use `bubble` prop whenever you want an easy search button to browse your entire documentation.
116
+
117
+ ![Ask search bubble](https://archbee.imgix.net/bNBm7nPJgXjbjLyfbHNh2/3AB9jiOJuhR9OtFAE19QP_screenshot-2024-03-22-at-172311.png)
118
+
112
119
  ## Ref Methods
113
120
 
114
121
  If `ref` is not passed to `ArchbeeAppWidget`, the children will automatically open the modal popup upon click.
@@ -119,7 +126,6 @@ If `ref` is not passed to `ArchbeeAppWidget`, the children will automatically op
119
126
  | `close` | `method` | Closes widget programatically.
120
127
  | `instance` | `method` | Returns the instance of the widget.
121
128
 
122
-
123
129
  ## Demos
124
130
 
125
131
  Down below is a demo setup in [CodeSandbox](https://codesandbox.io/), which
package/index.js CHANGED
@@ -25,6 +25,65 @@ $parcel$export(module.exports, "ArchbeeAppWidget", function () { return $3454c31
25
25
 
26
26
 
27
27
 
28
+ const $24928a7e91a52dac$export$82eafebb825fc23f = ({ className: className, size: size = 24 })=>{
29
+ return /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsx)("svg", {
30
+ className: className,
31
+ width: size,
32
+ height: size,
33
+ viewBox: "0 0 24 24",
34
+ fill: "none",
35
+ xmlns: "http://www.w3.org/2000/svg",
36
+ children: /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsx)("path", {
37
+ d: "M21 21L16.65 16.65M19 11C19 15.4183 15.4183 19 11 19C6.58172 19 3 15.4183 3 11C3 6.58172 6.58172 3 11 3C15.4183 3 19 6.58172 19 11Z",
38
+ stroke: "currentColor",
39
+ strokeWidth: "2",
40
+ strokeLinecap: "round",
41
+ strokeLinejoin: "round"
42
+ })
43
+ });
44
+ };
45
+
46
+
47
+ const $71c11890332f76f6$export$890c0998c02c05a7 = ({ isModalOpen: isModalOpen, openAskBubbleModal: openAskBubbleModal })=>{
48
+ return /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsx)("div", {
49
+ className: "ab-ask-bubble",
50
+ onClick: openAskBubbleModal,
51
+ style: isModalOpen ? {
52
+ zIndex: 0
53
+ } : {},
54
+ children: /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsxs)("div", {
55
+ className: "ab-ask-bubble-wrapper",
56
+ children: [
57
+ /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsx)("div", {
58
+ className: "ab-ask-notification"
59
+ }),
60
+ /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsx)("div", {
61
+ className: "ab-ask-bubble-icon",
62
+ children: /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsx)((0, $24928a7e91a52dac$export$82eafebb825fc23f), {})
63
+ }),
64
+ /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsxs)("div", {
65
+ className: "ab-ask-bubble-content",
66
+ children: [
67
+ /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsx)("div", {
68
+ className: "ab-ask-bubble-title",
69
+ children: "Ask a question"
70
+ }),
71
+ /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsx)("div", {
72
+ className: "ab-ask-bubble-subtitle",
73
+ children: "Powered by Archbee"
74
+ })
75
+ ]
76
+ })
77
+ ]
78
+ })
79
+ });
80
+ };
81
+
82
+
83
+
84
+
85
+
86
+
28
87
  const $7d0ac34aa5949d25$export$15a92cf792322942 = {
29
88
  animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
30
89
  };
@@ -320,20 +379,33 @@ const $91b786905c14e19d$export$86fbec116b87613f = ()=>{
320
379
  window._archbee.widget.blockId = undefined;
321
380
  window.dispatchEvent((0, $5ea18ff364e1e223$export$c6414d05a79532c3)());
322
381
  };
382
+ const openAskBubbleModal = ()=>{
383
+ window._archbee.widget.isOpen = true;
384
+ window._archbee.widget.widgetType = "search";
385
+ window.dispatchEvent((0, $5ea18ff364e1e223$export$4eadcc42fc7554ad)());
386
+ };
323
387
  (0, $cD94P$react.useEffect)(()=>{
324
388
  (0, ($parcel$interopDefault($cD94P$reactmodal))).setAppElement("#archbee-docs-widget-modal");
325
389
  }, []);
326
- return /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsx)("div", {
327
- id: "archbee-docs-widget-modal",
328
- children: isModalOpen && /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsx)((0, $d0b8a7ae25f50023$export$a65e3ebe24ca6cb5), {
329
- docId: docId || "",
330
- blockId: blockId || "",
331
- spaceId: window._archbee.widget.spaceId || window._archbee.widget.collectionId || "",
332
- jwt: jwt,
333
- shareableToken: shareableToken,
334
- screen: initialScreen,
335
- onClose: closeModal
336
- })
390
+ return /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsxs)((0, $cD94P$reactjsxruntime.Fragment), {
391
+ children: [
392
+ window._archbee.widget.bubble === "ask" && /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsx)((0, $71c11890332f76f6$export$890c0998c02c05a7), {
393
+ isModalOpen: isModalOpen,
394
+ openAskBubbleModal: openAskBubbleModal
395
+ }),
396
+ /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsx)("div", {
397
+ id: "archbee-docs-widget-modal",
398
+ children: isModalOpen && /*#__PURE__*/ (0, $cD94P$reactjsxruntime.jsx)((0, $d0b8a7ae25f50023$export$a65e3ebe24ca6cb5), {
399
+ docId: docId || "",
400
+ blockId: blockId || "",
401
+ spaceId: window._archbee.widget.spaceId || window._archbee.widget.collectionId || "",
402
+ jwt: jwt,
403
+ shareableToken: shareableToken,
404
+ screen: initialScreen,
405
+ onClose: closeModal
406
+ })
407
+ })
408
+ ]
337
409
  });
338
410
  };
339
411
  var $91b786905c14e19d$export$2e2bcd8739ae039 = $91b786905c14e19d$export$86fbec116b87613f;
@@ -451,7 +523,7 @@ const $ef43c9dfc50ce6f2$export$daaeb3f1095d12b8 = (loadingStrategy)=>{
451
523
  const script = document.getElementsByTagName("script")[0];
452
524
  script === null || script === void 0 ? void 0 : (_script_parentNode = script.parentNode) === null || _script_parentNode === void 0 ? void 0 : _script_parentNode.insertBefore(scripttag, script);
453
525
  };
454
- const $ef43c9dfc50ce6f2$export$2d47b06a7861ac47 = (spaceId, jwt, shareableToken, loadingStrategy = "lazy")=>{
526
+ const $ef43c9dfc50ce6f2$export$2d47b06a7861ac47 = (spaceId, jwt, shareableToken, loadingStrategy = "lazy", bubble = "invisible")=>{
455
527
  if (!window._archbee) {
456
528
  // @ts-expect-error
457
529
  window._archbee = window._archbee || {
@@ -464,7 +536,8 @@ const $ef43c9dfc50ce6f2$export$2d47b06a7861ac47 = (spaceId, jwt, shareableToken,
464
536
  eventType: "init",
465
537
  spaceId: spaceId,
466
538
  jwt: jwt,
467
- shareableToken: shareableToken
539
+ shareableToken: shareableToken,
540
+ bubble: bubble
468
541
  });
469
542
  $ef43c9dfc50ce6f2$export$daaeb3f1095d12b8(loadingStrategy);
470
543
  }
@@ -474,16 +547,17 @@ const $ef43c9dfc50ce6f2$export$2d47b06a7861ac47 = (spaceId, jwt, shareableToken,
474
547
 
475
548
 
476
549
 
477
- const $3454c312fc43187e$export$d1cc455138316794 = /*#__PURE__*/ (0, $cD94P$react.forwardRef)(({ className: className, spaceId: spaceId, jwt: jwt, shareableToken: shareableToken, docId: docId, blockId: blockId, widgetType: widgetType = "docs", loadingStrategy: loadingStrategy = "lazy", onWidgetOpen: onWidgetOpen, onWidgetClose: onWidgetClose, children: children }, ref)=>{
550
+ const $3454c312fc43187e$export$d1cc455138316794 = /*#__PURE__*/ (0, $cD94P$react.forwardRef)(({ className: className, spaceId: spaceId, jwt: jwt, shareableToken: shareableToken, docId: docId, blockId: blockId, widgetType: widgetType = "docs", loadingStrategy: loadingStrategy = "lazy", onWidgetOpen: onWidgetOpen, onWidgetClose: onWidgetClose, bubble: bubble, children: children }, ref)=>{
478
551
  const elementRef = (0, $cD94P$react.useRef)(null);
479
552
  const widgetInstance = (0, $cD94P$react.useMemo)(()=>{
480
553
  if (typeof window === "undefined") return;
481
- return (0, $ef43c9dfc50ce6f2$export$2d47b06a7861ac47)(spaceId, jwt, shareableToken, loadingStrategy);
554
+ return (0, $ef43c9dfc50ce6f2$export$2d47b06a7861ac47)(spaceId, jwt, shareableToken, loadingStrategy, bubble);
482
555
  }, [
483
556
  spaceId,
484
557
  jwt,
485
558
  shareableToken,
486
- loadingStrategy
559
+ loadingStrategy,
560
+ bubble
487
561
  ]);
488
562
  (0, $cD94P$react.useImperativeHandle)(ref, ()=>{
489
563
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archbee/app-widget",
3
- "version": "1.1.23",
3
+ "version": "1.1.24",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "author": {
package/types.d.ts CHANGED
@@ -29,9 +29,11 @@ interface AbWidgetData {
29
29
  hasExecuted: boolean;
30
30
  jwt?: string;
31
31
  shareableToken?: string;
32
- widgetType?: ScreenType;
32
+ widgetType?: WidgetType;
33
+ bubble?: BubbleType;
33
34
  }
34
- type ScreenType = 'docs' | 'search';
35
+ type BubbleType = 'ask' | 'invisible';
36
+ type WidgetType = 'docs' | 'search';
35
37
  interface AbWidgetRef {
36
38
  open: () => void;
37
39
  close: () => void;
@@ -43,7 +45,8 @@ type Props = {
43
45
  jwt?: string;
44
46
  className?: string;
45
47
  shareableToken?: string;
46
- widgetType: ScreenType;
48
+ widgetType: WidgetType;
49
+ bubble?: BubbleType;
47
50
  blockId?: string;
48
51
  user?: {
49
52
  id: string;