@archbee/app-widget 1.1.3 → 1.1.5
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 +23 -0
- package/index.js +45 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -94,8 +94,31 @@ const widgetRef = useRef<AbWidgetRef>(null);
|
|
|
94
94
|
ReactDOM.render(<App />, appElement);
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
## Component Props
|
|
98
|
+
|
|
99
|
+
| Property | Type | Required | Description |
|
|
100
|
+
|-------------------|------------------|------------|-----------------|
|
|
101
|
+
| `spaceId` | `string` | `required` | Pass the desired id to load your docs.
|
|
102
|
+
| `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.
|
|
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
|
+
| `loadingStrategy` | `eager \| lazy` | `optional` | Default value is `lazy`. Loading strategy method for widget loading.
|
|
108
|
+
| `onWidgetOpen` | `void` | `optional` | Callback that is called after widget opens.
|
|
109
|
+
| `onWidgetClose` | `void` | `optional` | Callback that is called after widget closes.
|
|
110
|
+
|
|
111
|
+
## Ref Methods
|
|
112
|
+
|
|
97
113
|
If `ref` is not passed to `ArchbeeAppWidget`, the children will automatically open the modal popup upon click.
|
|
98
114
|
|
|
115
|
+
| Property | Type | Description |
|
|
116
|
+
|------------|----------|-----------------|
|
|
117
|
+
| `open` | `method` | Opens widget programatically.
|
|
118
|
+
| `close` | `method` | Closes widget programatically.
|
|
119
|
+
| `instance` | `method` | Returns the instance of the widget.
|
|
120
|
+
|
|
121
|
+
|
|
99
122
|
## Demos
|
|
100
123
|
|
|
101
124
|
Down below is a demo setup in [CodeSandbox](https://codesandbox.io/), which
|
package/index.js
CHANGED
|
@@ -30,6 +30,25 @@ const $7d0ac34aa5949d25$export$15a92cf792322942 = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
const $01068657cf84c1f4$export$a966859aef4647ca = ({ className: className, size: size = 24 })=>/*#__PURE__*/ (0, $hXgUO$reactjsxruntime.jsx)("svg", {
|
|
36
|
+
className: className,
|
|
37
|
+
width: size,
|
|
38
|
+
height: size,
|
|
39
|
+
viewBox: "0 0 40 40",
|
|
40
|
+
fill: "none",
|
|
41
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
42
|
+
children: /*#__PURE__*/ (0, $hXgUO$reactjsxruntime.jsx)("path", {
|
|
43
|
+
d: "M25 15L15 25M15 15L25 25",
|
|
44
|
+
stroke: "currentColor",
|
|
45
|
+
strokeWidth: "1.66667",
|
|
46
|
+
strokeLinecap: "round",
|
|
47
|
+
strokeLinejoin: "round"
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
|
|
33
52
|
const $24a1ab1d9e5e268a$export$7428da3cfb78ae6 = ({ onClose: onClose })=>{
|
|
34
53
|
const eventStopPropagation = (event)=>{
|
|
35
54
|
event.preventDefault();
|
|
@@ -42,6 +61,13 @@ const $24a1ab1d9e5e268a$export$7428da3cfb78ae6 = ({ onClose: onClose })=>{
|
|
|
42
61
|
onClick: eventStopPropagation,
|
|
43
62
|
className: "ab-doc-loader",
|
|
44
63
|
children: [
|
|
64
|
+
/*#__PURE__*/ (0, $hXgUO$reactjsxruntime.jsx)("div", {
|
|
65
|
+
onClick: onClose,
|
|
66
|
+
className: "ab-doc-close",
|
|
67
|
+
children: /*#__PURE__*/ (0, $hXgUO$reactjsxruntime.jsx)((0, $01068657cf84c1f4$export$a966859aef4647ca), {
|
|
68
|
+
size: 50
|
|
69
|
+
})
|
|
70
|
+
}),
|
|
45
71
|
/*#__PURE__*/ (0, $hXgUO$reactjsxruntime.jsx)("div", {
|
|
46
72
|
className: "ab-rounded ab-gray w-1/2 mb-4",
|
|
47
73
|
style: {
|
|
@@ -130,6 +156,7 @@ const $24a1ab1d9e5e268a$export$7428da3cfb78ae6 = ({ onClose: onClose })=>{
|
|
|
130
156
|
|
|
131
157
|
|
|
132
158
|
|
|
159
|
+
|
|
133
160
|
const $671c57dd09bd5436$export$e9f7c27668489a52 = ({ onClose: onClose })=>{
|
|
134
161
|
const eventStopPropagation = (event)=>{
|
|
135
162
|
event.preventDefault();
|
|
@@ -138,17 +165,26 @@ const $671c57dd09bd5436$export$e9f7c27668489a52 = ({ onClose: onClose })=>{
|
|
|
138
165
|
return /*#__PURE__*/ (0, $hXgUO$reactjsxruntime.jsx)("div", {
|
|
139
166
|
onClick: onClose,
|
|
140
167
|
className: "ab-doc-search-container",
|
|
141
|
-
children: /*#__PURE__*/ (0, $hXgUO$reactjsxruntime.
|
|
168
|
+
children: /*#__PURE__*/ (0, $hXgUO$reactjsxruntime.jsxs)("div", {
|
|
142
169
|
onClick: eventStopPropagation,
|
|
143
170
|
className: "ab-doc-search-placeholder",
|
|
144
|
-
children:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
171
|
+
children: [
|
|
172
|
+
/*#__PURE__*/ (0, $hXgUO$reactjsxruntime.jsx)("div", {
|
|
173
|
+
onClick: onClose,
|
|
174
|
+
className: "ab-doc-close",
|
|
175
|
+
children: /*#__PURE__*/ (0, $hXgUO$reactjsxruntime.jsx)((0, $01068657cf84c1f4$export$a966859aef4647ca), {
|
|
176
|
+
size: 50
|
|
177
|
+
})
|
|
178
|
+
}),
|
|
179
|
+
/*#__PURE__*/ (0, $hXgUO$reactjsxruntime.jsx)("div", {
|
|
180
|
+
className: "ab-rounded ab-gray",
|
|
181
|
+
style: {
|
|
182
|
+
...(0, $7d0ac34aa5949d25$export$15a92cf792322942),
|
|
183
|
+
height: "3rem",
|
|
184
|
+
width: "96%"
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
]
|
|
152
188
|
})
|
|
153
189
|
});
|
|
154
190
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archbee/app-widget",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"clean": "rm -rf dist build",
|
|
46
|
-
"start": "
|
|
46
|
+
"start": "http-server dist/ -p 3002 -c-1",
|
|
47
47
|
"build": "npm run clean && npm run build:widget && npm run build:react",
|
|
48
48
|
"build:widget": "REACT_APP_SDK=true craco build && parcel build src/index.tsx --no-source-maps && mkdir -p build/v1 && cp dist/* build/v1/",
|
|
49
49
|
"build:react": "./react-build.script.sh",
|