@inditeai/react 0.0.85 → 0.0.87
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/.eslintrc.cjs +8 -8
- package/README.md +144 -144
- package/dist/Bubble.d.ts +1 -1
- package/dist/Bubble.d.ts.map +1 -1
- package/dist/Popup.d.ts +1 -1
- package/dist/Popup.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/stories/bubble.stories.d.ts +2 -0
- package/dist/stories/bubble.stories.d.ts.map +1 -0
- package/dist/stories/popup.stories.d.ts +2 -0
- package/dist/stories/popup.stories.d.ts.map +1 -0
- package/dist/stories/standard.stories.d.ts +3 -0
- package/dist/stories/standard.stories.d.ts.map +1 -0
- package/package.json +47 -45
- package/rollup.config.js +42 -42
- package/src/Bubble.tsx +51 -51
- package/src/Popup.tsx +56 -56
- package/src/Standard.tsx +35 -35
- package/src/index.ts +4 -5
- package/src/stories/bubble.stories.tsx +59 -0
- package/src/stories/popup.stories.tsx +22 -0
- package/src/stories/standard.stories.tsx +30 -0
- package/tsconfig.json +15 -15
- package/base.json +0 -22
- package/react-library.json +0 -11
package/.eslintrc.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
extends: ['custom'],
|
|
4
|
-
rules: {
|
|
5
|
-
'@next/next/no-img-element': 'off',
|
|
6
|
-
'@next/next/no-html-link-for-pages': 'off',
|
|
7
|
-
},
|
|
8
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
extends: ['custom'],
|
|
4
|
+
rules: {
|
|
5
|
+
'@next/next/no-img-element': 'off',
|
|
6
|
+
'@next/next/no-html-link-for-pages': 'off',
|
|
7
|
+
},
|
|
8
|
+
}
|
package/README.md
CHANGED
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
## Install
|
|
2
|
-
|
|
3
|
-
```bash
|
|
4
|
-
npm install @
|
|
5
|
-
```
|
|
6
|
-
|
|
7
|
-
## Standard
|
|
8
|
-
|
|
9
|
-
```tsx
|
|
10
|
-
import { Standard } from '@
|
|
11
|
-
|
|
12
|
-
const App = () => {
|
|
13
|
-
return (
|
|
14
|
-
<Standard
|
|
15
|
-
bot="lead-generation-copy-3luzm6b"
|
|
16
|
-
style={{ width: '100%', height: '600px' }}
|
|
17
|
-
/>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
This code is creating a container with a 100% width (will match parent width) and 600px height.
|
|
23
|
-
|
|
24
|
-
## Popup
|
|
25
|
-
|
|
26
|
-
```tsx
|
|
27
|
-
import { Popup } from '@
|
|
28
|
-
|
|
29
|
-
const App = () => {
|
|
30
|
-
return <Popup bot="lead-generation-copy-3luzm6b" autoShowDelay={3000} />
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
This code will automatically trigger the popup window after 3 seconds.
|
|
35
|
-
|
|
36
|
-
### Open or Close a popup
|
|
37
|
-
|
|
38
|
-
You can use these commands:
|
|
39
|
-
|
|
40
|
-
```js
|
|
41
|
-
import { open } from '@
|
|
42
|
-
|
|
43
|
-
open()
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
```js
|
|
47
|
-
import { close } from '@
|
|
48
|
-
|
|
49
|
-
close()
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
```js
|
|
53
|
-
import { toggle } from '@
|
|
54
|
-
|
|
55
|
-
toggle()
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Bubble
|
|
59
|
-
|
|
60
|
-
```tsx
|
|
61
|
-
import { Bubble } from '@
|
|
62
|
-
|
|
63
|
-
const App = () => {
|
|
64
|
-
return (
|
|
65
|
-
<Bubble
|
|
66
|
-
bot="lead-generation-copy-3luzm6b"
|
|
67
|
-
previewMessage={{
|
|
68
|
-
message: 'I have a question for you!',
|
|
69
|
-
autoShowDelay: 5000,
|
|
70
|
-
avatarUrl: 'https://avatars.githubusercontent.com/u/16015833?v=4',
|
|
71
|
-
}}
|
|
72
|
-
theme={{
|
|
73
|
-
button: { backgroundColor: '#0042DA', iconColor: '#FFFFFF' },
|
|
74
|
-
previewMessage: { backgroundColor: '#ffffff', textColor: 'black' },
|
|
75
|
-
}}
|
|
76
|
-
/>
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
This code will show the bubble and let a preview message appear after 5 seconds.
|
|
82
|
-
|
|
83
|
-
### Open or close the preview message
|
|
84
|
-
|
|
85
|
-
You can use these commands:
|
|
86
|
-
|
|
87
|
-
```js
|
|
88
|
-
import { showPreviewMessage } from '@
|
|
89
|
-
|
|
90
|
-
Bot.showPreviewMessage()
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
```js
|
|
94
|
-
import { hidePreviewMessage } from '@
|
|
95
|
-
|
|
96
|
-
Bot.hidePreviewMessage()
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Open or close the chat window
|
|
100
|
-
|
|
101
|
-
You can use these commands:
|
|
102
|
-
|
|
103
|
-
```js
|
|
104
|
-
import { open } from '@
|
|
105
|
-
|
|
106
|
-
open()
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
```js
|
|
110
|
-
import { close } from '@
|
|
111
|
-
|
|
112
|
-
close()
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
```js
|
|
116
|
-
import { toggle } from '@
|
|
117
|
-
|
|
118
|
-
toggle()
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Additional configuration
|
|
122
|
-
|
|
123
|
-
You can prefill the bot variable values in your embed code by adding the `prefilledVariables` option. Here is an example:
|
|
124
|
-
|
|
125
|
-
```tsx
|
|
126
|
-
import { Standard } from '@
|
|
127
|
-
|
|
128
|
-
const App = () => {
|
|
129
|
-
return (
|
|
130
|
-
<Standard
|
|
131
|
-
bot="lead-generation-copy-3luzm6b"
|
|
132
|
-
style={{ width: '100%', height: '600px' }}
|
|
133
|
-
prefilledVariables={{
|
|
134
|
-
'Current URL': 'https://my-site/account',
|
|
135
|
-
'User name': 'John Doe',
|
|
136
|
-
}}
|
|
137
|
-
/>
|
|
138
|
-
)
|
|
139
|
-
}
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
It will prefill the `Current URL` variable with "https://my-site/account" and the `User name` variable with "John Doe". More info about variables: [here](/editor/variables).
|
|
143
|
-
|
|
144
|
-
Note that if your site URL contains query params (i.e. https://
|
|
1
|
+
## Install
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
npm install @indite.io/js @indite.io/react
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
## Standard
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Standard } from '@indite.io/react'
|
|
11
|
+
|
|
12
|
+
const App = () => {
|
|
13
|
+
return (
|
|
14
|
+
<Standard
|
|
15
|
+
bot="lead-generation-copy-3luzm6b"
|
|
16
|
+
style={{ width: '100%', height: '600px' }}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This code is creating a container with a 100% width (will match parent width) and 600px height.
|
|
23
|
+
|
|
24
|
+
## Popup
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { Popup } from '@indite.io/react'
|
|
28
|
+
|
|
29
|
+
const App = () => {
|
|
30
|
+
return <Popup bot="lead-generation-copy-3luzm6b" autoShowDelay={3000} />
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This code will automatically trigger the popup window after 3 seconds.
|
|
35
|
+
|
|
36
|
+
### Open or Close a popup
|
|
37
|
+
|
|
38
|
+
You can use these commands:
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
import { open } from '@indite.io/react'
|
|
42
|
+
|
|
43
|
+
open()
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
import { close } from '@indite.io/react'
|
|
48
|
+
|
|
49
|
+
close()
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
import { toggle } from '@indite.io/react'
|
|
54
|
+
|
|
55
|
+
toggle()
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Bubble
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { Bubble } from '@indite.io/react'
|
|
62
|
+
|
|
63
|
+
const App = () => {
|
|
64
|
+
return (
|
|
65
|
+
<Bubble
|
|
66
|
+
bot="lead-generation-copy-3luzm6b"
|
|
67
|
+
previewMessage={{
|
|
68
|
+
message: 'I have a question for you!',
|
|
69
|
+
autoShowDelay: 5000,
|
|
70
|
+
avatarUrl: 'https://avatars.githubusercontent.com/u/16015833?v=4',
|
|
71
|
+
}}
|
|
72
|
+
theme={{
|
|
73
|
+
button: { backgroundColor: '#0042DA', iconColor: '#FFFFFF' },
|
|
74
|
+
previewMessage: { backgroundColor: '#ffffff', textColor: 'black' },
|
|
75
|
+
}}
|
|
76
|
+
/>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
This code will show the bubble and let a preview message appear after 5 seconds.
|
|
82
|
+
|
|
83
|
+
### Open or close the preview message
|
|
84
|
+
|
|
85
|
+
You can use these commands:
|
|
86
|
+
|
|
87
|
+
```js
|
|
88
|
+
import { showPreviewMessage } from '@indite.io/react'
|
|
89
|
+
|
|
90
|
+
Bot.showPreviewMessage()
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
import { hidePreviewMessage } from '@indite.io/react'
|
|
95
|
+
|
|
96
|
+
Bot.hidePreviewMessage()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Open or close the chat window
|
|
100
|
+
|
|
101
|
+
You can use these commands:
|
|
102
|
+
|
|
103
|
+
```js
|
|
104
|
+
import { open } from '@indite.io/react'
|
|
105
|
+
|
|
106
|
+
open()
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
import { close } from '@indite.io/react'
|
|
111
|
+
|
|
112
|
+
close()
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
import { toggle } from '@indite.io/react'
|
|
117
|
+
|
|
118
|
+
toggle()
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Additional configuration
|
|
122
|
+
|
|
123
|
+
You can prefill the bot variable values in your embed code by adding the `prefilledVariables` option. Here is an example:
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import { Standard } from '@indite.io/react'
|
|
127
|
+
|
|
128
|
+
const App = () => {
|
|
129
|
+
return (
|
|
130
|
+
<Standard
|
|
131
|
+
bot="lead-generation-copy-3luzm6b"
|
|
132
|
+
style={{ width: '100%', height: '600px' }}
|
|
133
|
+
prefilledVariables={{
|
|
134
|
+
'Current URL': 'https://my-site/account',
|
|
135
|
+
'User name': 'John Doe',
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
It will prefill the `Current URL` variable with "https://my-site/account" and the `User name` variable with "John Doe". More info about variables: [here](/editor/variables).
|
|
143
|
+
|
|
144
|
+
Note that if your site URL contains query params (i.e. https://bot.io?User%20name=John%20Doe), the variables will automatically be injected to the bot. So you don't need to manually transfer query params to the bot embed configuration.
|
package/dist/Bubble.d.ts
CHANGED
package/dist/Bubble.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bubble.d.ts","sourceRoot":"","sources":["../src/Bubble.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Bubble.d.ts","sourceRoot":"","sources":["../src/Bubble.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,uBAAuB,CAAA;AAE9B,KAAK,KAAK,GAAG,WAAW,CAAA;AAExB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,YAAY,EAAE,KAAK,CAAC,iBAAiB,CACnC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EACjC,WAAW,CACZ,CAAA;SACF;KACF;CACF;AAID,eAAO,MAAM,MAAM,UAAW,KAAK,SA6BlC,CAAA;AAED,eAAe,MAAM,CAAA"}
|
package/dist/Popup.d.ts
CHANGED
package/dist/Popup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../src/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAA;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../src/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAA;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,uBAAuB,CAAA;AAE9B,KAAK,KAAK,GAAG,UAAU,CAAA;AAEvB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAClC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EACjC,WAAW,CACZ,GAAG;gBAAE,KAAK,CAAC,EAAE,MAAM,CAAA;aAAE,CAAA;SACvB;KACF;CACF;AAID,eAAO,MAAM,KAAK,UAAW,KAAK,4CAkCjC,CAAA;AAED,eAAe,KAAK,CAAA"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,cAAc,cAAc,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// v0.0.
|
|
2
|
-
import{jsx as
|
|
1
|
+
// v0.0.87
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{useRef as t,useEffect as r,useCallback as o}from"react";import"@inditeai/js/dist/web";"function"==typeof SuppressedError&&SuppressedError;const n=o=>{var{style:n,className:s}=o,a=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(o,["style","className"]);const c=t(null);return r(()=>{c.current&&Object.assign(c.current,a)},[a]),e("bot-standard",{ref:c,style:n,class:s})},s=e=>{const n=t(null),s=o(e=>{const t=document.createElement("bot-bubble");n.current=t,a(n.current,e),document.body.prepend(n.current)},[]);r(()=>{n.current||s(e),a(n.current,e)},[s,e]),r(()=>()=>{var e;null===(e=n.current)||void 0===e||e.remove(),n.current=null},[]);const a=(e,t)=>{Object.assign(e,t)};return null},a=n=>{const s=t(null),a=t(null),c=o(e=>{var t;const r=document.createElement("bot-popup");a.current=r,u(a.current,e),s.current?null===(t=s.current)||void 0===t||t.append(a.current):console.warn("Could not attach popup to container because containerRef.current is null")},[]);r(()=>{a.current||c(n),u(a.current,n)},[c,n]),r(()=>()=>{var e;null===(e=a.current)||void 0===e||e.remove(),a.current=null},[]);const u=(e,t)=>{Object.assign(e,t)};return e("div",{ref:s})},c=()=>{window.postMessage({isFromBot:!0,command:"close"})},u=()=>{window.postMessage({isFromBot:!0,command:"hidePreviewMessage"})},l=()=>{window.postMessage({isFromBot:!0,command:"open"})},i=e=>{const t={isFromBot:!0,command:"setPrefilledVariables",variables:e};window.postMessage(t)},m=e=>{const t={isFromBot:!0,command:"showPreviewMessage",message:e};window.postMessage(t)},p=()=>{window.postMessage({isFromBot:!0,command:"toggle"})},d=e=>{const t={isFromBot:!0,command:"setInputValue",value:e};window.postMessage(t)},w=()=>{window.postMessage({isFromBot:!0,command:"unmount"})};export{s as Bubble,a as Popup,n as Standard,c as close,u as hidePreviewMessage,l as open,d as setInputValue,i as setPrefilledVariables,m as showPreviewMessage,p as toggle,w as unmount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bubble.stories.d.ts","sourceRoot":"","sources":["../../src/stories/bubble.stories.tsx"],"names":[],"mappings":"AAaA,eAAO,MAAM,OAAO,+CA6CnB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popup.stories.d.ts","sourceRoot":"","sources":["../../src/stories/popup.stories.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,+CAiBnB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard.stories.d.ts","sourceRoot":"","sources":["../../src/stories/standard.stories.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,+CAWnB,CAAA;AAED,eAAO,MAAM,iBAAiB,+CAa7B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,46 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@inditeai/react",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Convenient library to display bots on your React app",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"type": "module",
|
|
8
|
-
|
|
9
|
-
"dev": "
|
|
10
|
-
"build": "
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"@
|
|
24
|
-
"@
|
|
25
|
-
"@rollup/plugin-
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"@indite.io/
|
|
30
|
-
"@indite.io/
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@inditeai/react",
|
|
3
|
+
"version": "0.0.87",
|
|
4
|
+
"description": "Convenient library to display bots on your React app",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"stories:dev": "ladle serve -p 3006",
|
|
10
|
+
"stories:build": "ladle build",
|
|
11
|
+
"dev": "rollup --watch --config rollup.config.js",
|
|
12
|
+
"build": "rollup --config rollup.config.js",
|
|
13
|
+
"lint": "eslint --fix \"src/**/*.ts*\"",
|
|
14
|
+
"format:check": "prettier --check ./src"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [],
|
|
17
|
+
"author": "ART",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@ladle/react": "2.5.1"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@babel/preset-react": "7.22.5",
|
|
24
|
+
"@babel/preset-typescript": "7.22.5",
|
|
25
|
+
"@rollup/plugin-babel": "6.0.3",
|
|
26
|
+
"@rollup/plugin-node-resolve": "15.1.0",
|
|
27
|
+
"@rollup/plugin-terser": "0.4.3",
|
|
28
|
+
"@inditeai/js": "1.2.65",
|
|
29
|
+
"@indite.io/lib": "workspace:*",
|
|
30
|
+
"@indite.io/prisma": "workspace:*",
|
|
31
|
+
"@indite.io/schemas": "workspace:*",
|
|
32
|
+
"@indite.io/tsconfig": "workspace:*",
|
|
33
|
+
"@types/node": "20.4.2",
|
|
34
|
+
"@types/react": "18.2.15",
|
|
35
|
+
"eslint": "8.44.0",
|
|
36
|
+
"eslint-config-custom": "workspace:*",
|
|
37
|
+
"react": "18.2.0",
|
|
38
|
+
"rollup": "3.26.2",
|
|
39
|
+
"rollup-plugin-typescript-paths": "1.4.0",
|
|
40
|
+
"tslib": "2.6.0",
|
|
41
|
+
"tsx": "4.6.2",
|
|
42
|
+
"typescript": "5.4.5",
|
|
43
|
+
"@rollup/plugin-typescript": "11.1.2"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"react": "^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
47
|
+
}
|
|
46
48
|
}
|
package/rollup.config.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import resolve from '@rollup/plugin-node-resolve'
|
|
2
|
-
import terser from '@rollup/plugin-terser'
|
|
3
|
-
import { babel } from '@rollup/plugin-babel'
|
|
4
|
-
import { typescriptPaths } from 'rollup-plugin-typescript-paths'
|
|
5
|
-
import typescript from '@rollup/plugin-typescript'
|
|
6
|
-
import fs from 'fs'
|
|
7
|
-
|
|
8
|
-
const extensions = ['.ts', '.tsx']
|
|
9
|
-
|
|
10
|
-
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'))
|
|
11
|
-
const packageVersion = packageJson.version
|
|
12
|
-
const preamble = `// v${packageVersion}`
|
|
13
|
-
|
|
14
|
-
const indexConfig = {
|
|
15
|
-
input: './src/index.ts',
|
|
16
|
-
output: {
|
|
17
|
-
file: './dist/index.js',
|
|
18
|
-
format: 'es',
|
|
19
|
-
},
|
|
20
|
-
external: ['react', 'react/jsx-runtime'],
|
|
21
|
-
watch: {
|
|
22
|
-
clearScreen: false,
|
|
23
|
-
},
|
|
24
|
-
plugins: [
|
|
25
|
-
resolve({ extensions }),
|
|
26
|
-
babel({
|
|
27
|
-
babelHelpers: 'bundled',
|
|
28
|
-
exclude: 'node_modules/**',
|
|
29
|
-
presets: ['@babel/preset-react', '@babel/preset-typescript'],
|
|
30
|
-
extensions,
|
|
31
|
-
}),
|
|
32
|
-
typescriptPaths({ preserveExtensions: true }),
|
|
33
|
-
typescript({
|
|
34
|
-
noEmitOnError: !process.env.ROLLUP_WATCH,
|
|
35
|
-
}),
|
|
36
|
-
terser({ format: { preamble } }),
|
|
37
|
-
],
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const configs = [indexConfig]
|
|
41
|
-
|
|
42
|
-
export default configs
|
|
1
|
+
import resolve from '@rollup/plugin-node-resolve'
|
|
2
|
+
import terser from '@rollup/plugin-terser'
|
|
3
|
+
import { babel } from '@rollup/plugin-babel'
|
|
4
|
+
import { typescriptPaths } from 'rollup-plugin-typescript-paths'
|
|
5
|
+
import typescript from '@rollup/plugin-typescript'
|
|
6
|
+
import fs from 'fs'
|
|
7
|
+
|
|
8
|
+
const extensions = ['.ts', '.tsx']
|
|
9
|
+
|
|
10
|
+
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'))
|
|
11
|
+
const packageVersion = packageJson.version
|
|
12
|
+
const preamble = `// v${packageVersion}`
|
|
13
|
+
|
|
14
|
+
const indexConfig = {
|
|
15
|
+
input: './src/index.ts',
|
|
16
|
+
output: {
|
|
17
|
+
file: './dist/index.js',
|
|
18
|
+
format: 'es',
|
|
19
|
+
},
|
|
20
|
+
external: ['react', 'react/jsx-runtime'],
|
|
21
|
+
watch: {
|
|
22
|
+
clearScreen: false,
|
|
23
|
+
},
|
|
24
|
+
plugins: [
|
|
25
|
+
resolve({ extensions }),
|
|
26
|
+
babel({
|
|
27
|
+
babelHelpers: 'bundled',
|
|
28
|
+
exclude: 'node_modules/**',
|
|
29
|
+
presets: ['@babel/preset-react', '@babel/preset-typescript'],
|
|
30
|
+
extensions,
|
|
31
|
+
}),
|
|
32
|
+
typescriptPaths({ preserveExtensions: true }),
|
|
33
|
+
typescript({
|
|
34
|
+
noEmitOnError: !process.env.ROLLUP_WATCH,
|
|
35
|
+
}),
|
|
36
|
+
terser({ format: { preamble } }),
|
|
37
|
+
],
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const configs = [indexConfig]
|
|
41
|
+
|
|
42
|
+
export default configs
|
package/src/Bubble.tsx
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef } from 'react'
|
|
2
|
-
import type { BubbleProps } from '@inditeai/js
|
|
3
|
-
import '@inditeai/js/dist/web'
|
|
4
|
-
|
|
5
|
-
type Props = BubbleProps
|
|
6
|
-
|
|
7
|
-
declare global {
|
|
8
|
-
namespace JSX {
|
|
9
|
-
interface IntrinsicElements {
|
|
10
|
-
'bot-bubble': React.DetailedHTMLProps<
|
|
11
|
-
React.HTMLAttributes<HTMLElement>,
|
|
12
|
-
HTMLElement
|
|
13
|
-
>
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type BubbleElement = HTMLElement & Props
|
|
19
|
-
|
|
20
|
-
export const Bubble = (props: Props) => {
|
|
21
|
-
const bubbleElement = useRef<BubbleElement | null>(null)
|
|
22
|
-
|
|
23
|
-
const attachBubbleToDom = useCallback((props: Props) => {
|
|
24
|
-
const newBubbleElement = document.createElement(
|
|
25
|
-
'bot-bubble'
|
|
26
|
-
) as BubbleElement
|
|
27
|
-
bubbleElement.current = newBubbleElement
|
|
28
|
-
injectPropsToElement(bubbleElement.current, props)
|
|
29
|
-
document.body.prepend(bubbleElement.current)
|
|
30
|
-
}, [])
|
|
31
|
-
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (!bubbleElement.current) attachBubbleToDom(props)
|
|
34
|
-
injectPropsToElement(bubbleElement.current as BubbleElement, props)
|
|
35
|
-
}, [attachBubbleToDom, props])
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
return () => {
|
|
39
|
-
bubbleElement.current?.remove()
|
|
40
|
-
bubbleElement.current = null
|
|
41
|
-
}
|
|
42
|
-
}, [])
|
|
43
|
-
|
|
44
|
-
const injectPropsToElement = (element: BubbleElement, props: Props) => {
|
|
45
|
-
Object.assign(element, props)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return null
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default Bubble
|
|
1
|
+
import React, { useCallback, useEffect, useRef } from 'react'
|
|
2
|
+
import type { BubbleProps } from '@inditeai/js'
|
|
3
|
+
import '@inditeai/js/dist/web'
|
|
4
|
+
|
|
5
|
+
type Props = BubbleProps
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
namespace JSX {
|
|
9
|
+
interface IntrinsicElements {
|
|
10
|
+
'bot-bubble': React.DetailedHTMLProps<
|
|
11
|
+
React.HTMLAttributes<HTMLElement>,
|
|
12
|
+
HTMLElement
|
|
13
|
+
>
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type BubbleElement = HTMLElement & Props
|
|
19
|
+
|
|
20
|
+
export const Bubble = (props: Props) => {
|
|
21
|
+
const bubbleElement = useRef<BubbleElement | null>(null)
|
|
22
|
+
|
|
23
|
+
const attachBubbleToDom = useCallback((props: Props) => {
|
|
24
|
+
const newBubbleElement = document.createElement(
|
|
25
|
+
'bot-bubble'
|
|
26
|
+
) as BubbleElement
|
|
27
|
+
bubbleElement.current = newBubbleElement
|
|
28
|
+
injectPropsToElement(bubbleElement.current, props)
|
|
29
|
+
document.body.prepend(bubbleElement.current)
|
|
30
|
+
}, [])
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!bubbleElement.current) attachBubbleToDom(props)
|
|
34
|
+
injectPropsToElement(bubbleElement.current as BubbleElement, props)
|
|
35
|
+
}, [attachBubbleToDom, props])
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
return () => {
|
|
39
|
+
bubbleElement.current?.remove()
|
|
40
|
+
bubbleElement.current = null
|
|
41
|
+
}
|
|
42
|
+
}, [])
|
|
43
|
+
|
|
44
|
+
const injectPropsToElement = (element: BubbleElement, props: Props) => {
|
|
45
|
+
Object.assign(element, props)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return null
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default Bubble
|
package/src/Popup.tsx
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef } from 'react'
|
|
2
|
-
import type { PopupProps } from '@inditeai/js
|
|
3
|
-
import '@inditeai/js/dist/web'
|
|
4
|
-
|
|
5
|
-
type Props = PopupProps
|
|
6
|
-
|
|
7
|
-
declare global {
|
|
8
|
-
namespace JSX {
|
|
9
|
-
interface IntrinsicElements {
|
|
10
|
-
'bot-popup': React.DetailedHTMLProps<
|
|
11
|
-
React.HTMLAttributes<HTMLElement>,
|
|
12
|
-
HTMLElement
|
|
13
|
-
> & { class?: string }
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type PopupElement = HTMLElement & Props
|
|
19
|
-
|
|
20
|
-
export const Popup = (props: Props) => {
|
|
21
|
-
const containerRef = useRef<HTMLDivElement | null>(null)
|
|
22
|
-
const popupRef = useRef<PopupElement | null>(null)
|
|
23
|
-
|
|
24
|
-
const attachPopupToContainer = useCallback((props: Props) => {
|
|
25
|
-
const popupElement = document.createElement('bot-popup') as PopupElement
|
|
26
|
-
popupRef.current = popupElement
|
|
27
|
-
injectPropsToElement(popupRef.current, props)
|
|
28
|
-
if (!containerRef.current) {
|
|
29
|
-
console.warn(
|
|
30
|
-
'Could not attach popup to container because containerRef.current is null'
|
|
31
|
-
)
|
|
32
|
-
return
|
|
33
|
-
}
|
|
34
|
-
containerRef.current?.append(popupRef.current)
|
|
35
|
-
}, [])
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (!popupRef.current) attachPopupToContainer(props)
|
|
39
|
-
injectPropsToElement(popupRef.current as PopupElement, props)
|
|
40
|
-
}, [attachPopupToContainer, props])
|
|
41
|
-
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
return () => {
|
|
44
|
-
popupRef.current?.remove()
|
|
45
|
-
popupRef.current = null
|
|
46
|
-
}
|
|
47
|
-
}, [])
|
|
48
|
-
|
|
49
|
-
const injectPropsToElement = (element: PopupElement, props: Props) => {
|
|
50
|
-
Object.assign(element, props)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return <div ref={containerRef} />
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export default Popup
|
|
1
|
+
import React, { useCallback, useEffect, useRef } from 'react'
|
|
2
|
+
import type { PopupProps } from '@inditeai/js'
|
|
3
|
+
import '@inditeai/js/dist/web'
|
|
4
|
+
|
|
5
|
+
type Props = PopupProps
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
namespace JSX {
|
|
9
|
+
interface IntrinsicElements {
|
|
10
|
+
'bot-popup': React.DetailedHTMLProps<
|
|
11
|
+
React.HTMLAttributes<HTMLElement>,
|
|
12
|
+
HTMLElement
|
|
13
|
+
> & { class?: string }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type PopupElement = HTMLElement & Props
|
|
19
|
+
|
|
20
|
+
export const Popup = (props: Props) => {
|
|
21
|
+
const containerRef = useRef<HTMLDivElement | null>(null)
|
|
22
|
+
const popupRef = useRef<PopupElement | null>(null)
|
|
23
|
+
|
|
24
|
+
const attachPopupToContainer = useCallback((props: Props) => {
|
|
25
|
+
const popupElement = document.createElement('bot-popup') as PopupElement
|
|
26
|
+
popupRef.current = popupElement
|
|
27
|
+
injectPropsToElement(popupRef.current, props)
|
|
28
|
+
if (!containerRef.current) {
|
|
29
|
+
console.warn(
|
|
30
|
+
'Could not attach popup to container because containerRef.current is null'
|
|
31
|
+
)
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
containerRef.current?.append(popupRef.current)
|
|
35
|
+
}, [])
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!popupRef.current) attachPopupToContainer(props)
|
|
39
|
+
injectPropsToElement(popupRef.current as PopupElement, props)
|
|
40
|
+
}, [attachPopupToContainer, props])
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
return () => {
|
|
44
|
+
popupRef.current?.remove()
|
|
45
|
+
popupRef.current = null
|
|
46
|
+
}
|
|
47
|
+
}, [])
|
|
48
|
+
|
|
49
|
+
const injectPropsToElement = (element: PopupElement, props: Props) => {
|
|
50
|
+
Object.assign(element, props)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return <div ref={containerRef} />
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default Popup
|
package/src/Standard.tsx
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react'
|
|
2
|
-
import type { BotProps } from '@inditeai/js'
|
|
3
|
-
import '@inditeai/js/dist/web'
|
|
4
|
-
|
|
5
|
-
type Props = BotProps & {
|
|
6
|
-
style?: React.CSSProperties
|
|
7
|
-
className?: string
|
|
8
|
-
source?: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
declare global {
|
|
12
|
-
namespace JSX {
|
|
13
|
-
interface IntrinsicElements {
|
|
14
|
-
'bot-standard': React.DetailedHTMLProps<
|
|
15
|
-
React.HTMLAttributes<HTMLElement>,
|
|
16
|
-
HTMLElement
|
|
17
|
-
> & { class?: string }
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
type StandardElement = HTMLElement & Props
|
|
23
|
-
|
|
24
|
-
export const Standard = ({ style, className, ...assignableProps }: Props) => {
|
|
25
|
-
const ref = useRef<StandardElement | null>(null)
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (!ref.current) return
|
|
29
|
-
Object.assign(ref.current, assignableProps)
|
|
30
|
-
}, [assignableProps])
|
|
31
|
-
|
|
32
|
-
return <bot-standard ref={ref} style={style} class={className} />
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default Standard
|
|
1
|
+
import React, { useEffect, useRef } from 'react'
|
|
2
|
+
import type { BotProps } from '@inditeai/js'
|
|
3
|
+
import '@inditeai/js/dist/web'
|
|
4
|
+
|
|
5
|
+
type Props = BotProps & {
|
|
6
|
+
style?: React.CSSProperties
|
|
7
|
+
className?: string
|
|
8
|
+
source?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare global {
|
|
12
|
+
namespace JSX {
|
|
13
|
+
interface IntrinsicElements {
|
|
14
|
+
'bot-standard': React.DetailedHTMLProps<
|
|
15
|
+
React.HTMLAttributes<HTMLElement>,
|
|
16
|
+
HTMLElement
|
|
17
|
+
> & { class?: string }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type StandardElement = HTMLElement & Props
|
|
23
|
+
|
|
24
|
+
export const Standard = ({ style, className, ...assignableProps }: Props) => {
|
|
25
|
+
const ref = useRef<StandardElement | null>(null)
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!ref.current) return
|
|
29
|
+
Object.assign(ref.current, assignableProps)
|
|
30
|
+
}, [assignableProps])
|
|
31
|
+
|
|
32
|
+
return <bot-standard ref={ref} style={style} class={className} />
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default Standard
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { Standard } from './Standard'
|
|
2
|
-
export { Bubble } from './Bubble'
|
|
3
|
-
export { Popup } from './Popup'
|
|
4
|
-
export * from '@inditeai/js
|
|
5
|
-
|
|
1
|
+
export { Standard } from './Standard'
|
|
2
|
+
export { Bubble } from './Bubble'
|
|
3
|
+
export { Popup } from './Popup'
|
|
4
|
+
export * from '@inditeai/js'
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Bubble } from '@/Bubble'
|
|
2
|
+
import {
|
|
3
|
+
open,
|
|
4
|
+
toggle,
|
|
5
|
+
close,
|
|
6
|
+
showPreviewMessage,
|
|
7
|
+
hidePreviewMessage,
|
|
8
|
+
setPrefilledVariables,
|
|
9
|
+
setInputValue,
|
|
10
|
+
} from '@inditeai/js'
|
|
11
|
+
import { useState } from 'react'
|
|
12
|
+
const leadGenerationBot = {}
|
|
13
|
+
|
|
14
|
+
export const Default = () => {
|
|
15
|
+
const [name, setName] = useState('John')
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div>
|
|
19
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
|
20
|
+
<button onClick={toggle}>Toggle chat window</button>
|
|
21
|
+
<button onClick={open}>Open chat window</button>
|
|
22
|
+
<button onClick={close}>Close chat window</button>
|
|
23
|
+
<button onClick={() => showPreviewMessage()}>
|
|
24
|
+
Show Preview Message
|
|
25
|
+
</button>
|
|
26
|
+
<button onClick={() => setInputValue('YOOOO!')}>Set input value</button>
|
|
27
|
+
<button onClick={hidePreviewMessage}>Close Preview Message</button>
|
|
28
|
+
<div>
|
|
29
|
+
<p>Predefined name:</p>
|
|
30
|
+
<input value={name} onChange={(e) => setName(e.target.value)} />
|
|
31
|
+
<button onClick={() => setPrefilledVariables({ Name: name })}>
|
|
32
|
+
Set predefined name
|
|
33
|
+
</button>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<Bubble
|
|
38
|
+
botName=''
|
|
39
|
+
bot={leadGenerationBot}
|
|
40
|
+
apiHost="http://localhost:3001"
|
|
41
|
+
prefilledVariables={{
|
|
42
|
+
Name: ['John'],
|
|
43
|
+
}}
|
|
44
|
+
previewMessage={{
|
|
45
|
+
avatarUrl: 'https://avatars.githubusercontent.com/u/16015833?v=4',
|
|
46
|
+
message: 'Hello, I am a preview message',
|
|
47
|
+
autoShowDelay: 3000,
|
|
48
|
+
}}
|
|
49
|
+
theme={{
|
|
50
|
+
button: {
|
|
51
|
+
backgroundColor: '#FF7537',
|
|
52
|
+
iconColor: 'white',
|
|
53
|
+
},
|
|
54
|
+
}}
|
|
55
|
+
isPreview
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Popup } from '../Popup'
|
|
2
|
+
import { open, toggle } from '@inditeai/js'
|
|
3
|
+
const leadGenerationBot = {}
|
|
4
|
+
|
|
5
|
+
export const Default = () => {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<button onClick={open}>Open modal</button>
|
|
9
|
+
<button onClick={toggle}>Toggle modal</button>
|
|
10
|
+
<Popup
|
|
11
|
+
botName=''
|
|
12
|
+
bot={leadGenerationBot}
|
|
13
|
+
apiHost="http://localhost:3001"
|
|
14
|
+
autoShowDelay={3000}
|
|
15
|
+
theme={{
|
|
16
|
+
width: '800px',
|
|
17
|
+
}}
|
|
18
|
+
isPreview
|
|
19
|
+
/>
|
|
20
|
+
</>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Standard } from '..'
|
|
2
|
+
|
|
3
|
+
const leadGenerationBot = {}
|
|
4
|
+
export const Default = () => {
|
|
5
|
+
return (
|
|
6
|
+
<div style={{ height: '500px' }}>
|
|
7
|
+
<Standard
|
|
8
|
+
botName=''
|
|
9
|
+
bot={leadGenerationBot}
|
|
10
|
+
apiHost="http://localhost:3001"
|
|
11
|
+
isPreview
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const StartWhenIntoView = () => {
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<div style={{ height: '300vh' }} />
|
|
21
|
+
<Standard
|
|
22
|
+
botName=''
|
|
23
|
+
bot={leadGenerationBot}
|
|
24
|
+
apiHost="http://localhost:3001"
|
|
25
|
+
isPreview
|
|
26
|
+
style={{ height: '300px' }}
|
|
27
|
+
/>
|
|
28
|
+
</>
|
|
29
|
+
)
|
|
30
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "
|
|
3
|
-
"include": ["src/**/*"],
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"baseUrl": ".",
|
|
6
|
-
"paths": {
|
|
7
|
-
"@/*": ["src/*"]
|
|
8
|
-
},
|
|
9
|
-
"outDir": "dist",
|
|
10
|
-
"declaration": true,
|
|
11
|
-
"declarationMap": true,
|
|
12
|
-
"noEmit": false,
|
|
13
|
-
"emitDeclarationOnly": true
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "@indite.io/tsconfig/react-library.json",
|
|
3
|
+
"include": ["src/**/*"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"baseUrl": ".",
|
|
6
|
+
"paths": {
|
|
7
|
+
"@/*": ["src/*"]
|
|
8
|
+
},
|
|
9
|
+
"outDir": "dist",
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"declarationMap": true,
|
|
12
|
+
"noEmit": false,
|
|
13
|
+
"emitDeclarationOnly": true
|
|
14
|
+
}
|
|
15
|
+
}
|
package/base.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"display": "Default",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"composite": false,
|
|
6
|
-
"declaration": false,
|
|
7
|
-
"declarationMap": false,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"forceConsistentCasingInFileNames": true,
|
|
10
|
-
"inlineSources": false,
|
|
11
|
-
"isolatedModules": true,
|
|
12
|
-
"moduleResolution": "node",
|
|
13
|
-
"noUnusedLocals": false,
|
|
14
|
-
"noUnusedParameters": false,
|
|
15
|
-
"preserveWatchOutput": true,
|
|
16
|
-
"skipLibCheck": true,
|
|
17
|
-
"strict": true,
|
|
18
|
-
"downlevelIteration": true,
|
|
19
|
-
"noEmit": true
|
|
20
|
-
},
|
|
21
|
-
"exclude": ["node_modules"]
|
|
22
|
-
}
|
package/react-library.json
DELETED