@archbee/app-widget 1.1.24 → 1.1.26
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 +39 -39
- package/index.esm.d.ts +1 -0
- package/index.esm.js +1689 -0
- package/package.json +4 -44
- package/src/index.d.ts +3 -0
- package/src/lib/main.d.ts +19 -0
- package/src/lib/scripts/index.d.ts +4 -0
- package/src/lib/scripts/initScripts.d.ts +4 -0
- package/src/lib/scripts/proxy.d.ts +2 -0
- package/src/lib/scripts/render.d.ts +1 -0
- package/src/lib/scripts/widgetActions.d.ts +4 -0
- package/src/lib/types.d.ts +54 -0
- package/index.js +0 -599
- package/types.d.ts +0 -65
package/README.md
CHANGED
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
## Table of Contents
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
- [Installation](#installation)
|
|
6
|
+
- [API documentation](#api-documentation)
|
|
7
|
+
- [Examples](#examples)
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
11
|
To install, you can use [npm](https://npmjs.org/) or [yarn](https://yarnpkg.com):
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
$ npm install --save @archbee/app-widget
|
|
15
14
|
$ yarn add @archbee/app-widget
|
|
16
|
-
|
|
15
|
+
|
|
17
16
|
If you need to install Archbee Contextual Widget SDK, you can find more details [here](https://docs.archbee.com/app-widget).
|
|
18
17
|
|
|
19
18
|
## API documentation
|
|
@@ -24,29 +23,29 @@ and gives examples of its usage.
|
|
|
24
23
|
|
|
25
24
|
## Examples
|
|
26
25
|
|
|
27
|
-
Here is a simple example of Archbee React widget
|
|
26
|
+
Here is a simple example of Archbee React widget being used in an app with some action variations:
|
|
28
27
|
|
|
29
28
|
```tsx
|
|
30
|
-
import React from 'react'
|
|
29
|
+
import React from 'react'
|
|
31
30
|
import { ArchbeeAppWidget } from '@archbee/app-widget'
|
|
32
31
|
|
|
33
32
|
function App() {
|
|
34
33
|
return (
|
|
35
34
|
<div>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
<ArchbeeAppWidget
|
|
36
|
+
spaceId={/** published space id **/}
|
|
37
|
+
onWidgetOpen={() => {
|
|
38
|
+
/** ... **/
|
|
39
|
+
}} // callback function called after widget has open
|
|
40
|
+
// onWidgetClose={() => { /** ... **/ }} // callback function called after widget has open
|
|
40
41
|
>
|
|
41
|
-
<button type=
|
|
42
|
-
Open
|
|
43
|
-
</button>
|
|
42
|
+
<button type="button">Open</button>
|
|
44
43
|
</ArchbeeAppWidget>
|
|
45
44
|
</div>
|
|
46
|
-
)
|
|
45
|
+
)
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
ReactDOM.render(<App />, appElement)
|
|
48
|
+
ReactDOM.render(<App />, appElement)
|
|
50
49
|
```
|
|
51
50
|
|
|
52
51
|
Can also be used with ref for a more programmatic approach:
|
|
@@ -72,14 +71,14 @@ const widgetRef = useRef<AbWidgetRef>(null);
|
|
|
72
71
|
}}>
|
|
73
72
|
Open
|
|
74
73
|
</button>
|
|
75
|
-
|
|
74
|
+
|
|
76
75
|
<button type='button' onClick={() => {
|
|
77
76
|
<!-- Closes widget -->
|
|
78
77
|
widgetRef.current?.close();
|
|
79
78
|
}}>
|
|
80
79
|
Close
|
|
81
80
|
</button>
|
|
82
|
-
|
|
81
|
+
|
|
83
82
|
<button type='button' onClick={() => {
|
|
84
83
|
<!-- Gets the instance of the widget if needed for various event manipulations. -->
|
|
85
84
|
widgetRef.current?.instance();
|
|
@@ -96,20 +95,21 @@ ReactDOM.render(<App />, appElement);
|
|
|
96
95
|
|
|
97
96
|
## Component Props
|
|
98
97
|
|
|
99
|
-
| Property | Type
|
|
100
|
-
|
|
101
|
-
| `spaceId` | `string`
|
|
102
|
-
| `docId` | `string`
|
|
103
|
-
| `blockId` | `string`
|
|
104
|
-
| `jwt` | `string`
|
|
105
|
-
| `shareableToken` | `string`
|
|
106
|
-
| `className` | `string`
|
|
107
|
-
| `widgetType` | `docs \| search`
|
|
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`
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
|
|
98
|
+
| Property | Type | Required | Description |
|
|
99
|
+
| ----------------- | ------------------ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
100
|
+
| `spaceId` | `string` | `required` | Pass the desired id to load your docs. |
|
|
101
|
+
| `docId` | `string` | `optional` | The doc where you want to open the widget docs. If `docId` is passed, `widgetType` is ignored, it will open in docs mode regardless of prop passed. |
|
|
102
|
+
| `blockId` | `string` | `optional` | The block where you want to scroll, after a certain document was open. |
|
|
103
|
+
| `jwt` | `string` | `optional` | Pass the jwt token in order to see jwt protected docs. |
|
|
104
|
+
| `shareableToken` | `string` | `optional` | Pass the shareableToken from your private links to protect your docs. |
|
|
105
|
+
| `className` | `string` | `optional` | Pass CSS classes to the `div` wrapper |
|
|
106
|
+
| `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) |
|
|
107
|
+
| `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. |
|
|
108
|
+
| `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
|
+
| `anchor` | `string` | `optional` | You can provide your `class`, `id` or `path` to a DOM element where you would like the widget to anchor and instantiate. The container provided should have `position: relative` as the widget will be displayed based on the first relative parent found. |
|
|
110
|
+
| `onWidgetOpen` | `void` | `optional` | Callback that is called after widget opens. |
|
|
111
|
+
| `onWidgetClose` | `void` | `optional` | Callback that is called after widget closes. |
|
|
112
|
+
|
|
113
113
|
## Bubble
|
|
114
114
|
|
|
115
115
|
Use `bubble` prop whenever you want an easy search button to browse your entire documentation.
|
|
@@ -118,17 +118,17 @@ Use `bubble` prop whenever you want an easy search button to browse your entire
|
|
|
118
118
|
|
|
119
119
|
## Ref Methods
|
|
120
120
|
|
|
121
|
-
If `ref` is not passed to `ArchbeeAppWidget`, the children will automatically open the modal popup upon click.
|
|
121
|
+
If `ref` is not passed to `ArchbeeAppWidget`, the children will automatically open the modal popup upon click.
|
|
122
122
|
|
|
123
|
-
| Property | Type | Description
|
|
124
|
-
|
|
125
|
-
| `open` | `method` | Opens widget programatically.
|
|
126
|
-
| `close` | `method` | Closes widget programatically.
|
|
127
|
-
| `instance` | `method` | Returns the instance of the widget.
|
|
123
|
+
| Property | Type | Description |
|
|
124
|
+
| ---------- | -------- | ----------------------------------- |
|
|
125
|
+
| `open` | `method` | Opens widget programatically. |
|
|
126
|
+
| `close` | `method` | Closes widget programatically. |
|
|
127
|
+
| `instance` | `method` | Returns the instance of the widget. |
|
|
128
128
|
|
|
129
129
|
## Demos
|
|
130
130
|
|
|
131
131
|
Down below is a demo setup in [CodeSandbox](https://codesandbox.io/), which
|
|
132
132
|
demonstrate various features of archbee-app:
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
- [Demo](https://codesandbox.io/s/funny-austin-gndp8w?file=/src/App.tsx)
|
package/index.esm.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|