@botonic/react 0.31.0-alpha.2 → 0.31.5-alpha.1
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/lib/cjs/components/audio.d.ts +1 -1
- package/lib/cjs/components/custom-message.d.ts +2 -2
- package/lib/cjs/components/document.d.ts +1 -1
- package/lib/cjs/components/handoff.d.ts +1 -1
- package/lib/cjs/components/image.d.ts +1 -1
- package/lib/cjs/components/index-types.d.ts +1 -0
- package/lib/cjs/components/message/message-feedback.d.ts +1 -1
- package/lib/cjs/components/message/message-footer.d.ts +1 -1
- package/lib/cjs/components/message/timestamps.d.ts +1 -1
- package/lib/cjs/components/multichannel/multichannel-button.d.ts +1 -1
- package/lib/cjs/components/multichannel/multichannel-reply.d.ts +1 -1
- package/lib/cjs/components/multichannel/multichannel-text.d.ts +1 -1
- package/lib/cjs/components/raw.d.ts +1 -1
- package/lib/cjs/components/text.d.ts +1 -1
- package/lib/cjs/components/video.d.ts +1 -1
- package/lib/cjs/contexts.js +3 -0
- package/lib/cjs/contexts.js.map +1 -1
- package/lib/cjs/dev-app.js +2 -5
- package/lib/cjs/dev-app.js.map +1 -1
- package/lib/cjs/index-types.d.ts +1 -0
- package/lib/cjs/react-bot.d.ts +1 -1
- package/lib/cjs/util/error-boundary.d.ts +1 -1
- package/lib/cjs/util/react.d.ts +1 -1
- package/lib/cjs/webchat/chat-area/index.d.ts +1 -1
- package/lib/cjs/webchat/components/common.d.ts +1 -1
- package/lib/cjs/webchat/components/conditional-animation.d.ts +1 -1
- package/lib/cjs/webchat/components/opened-persistent-menu.d.ts +1 -1
- package/lib/cjs/webchat/cover-component/index.d.ts +6 -0
- package/lib/cjs/webchat/cover-component/index.js +21 -0
- package/lib/cjs/webchat/cover-component/index.js.map +1 -0
- package/lib/cjs/webchat/header.d.ts +1 -1
- package/lib/cjs/webchat/input-panel/attachment.d.ts +1 -1
- package/lib/cjs/webchat/input-panel/emoji-picker.d.ts +1 -1
- package/lib/cjs/webchat/input-panel/index.d.ts +1 -1
- package/lib/cjs/webchat/input-panel/opened-emoji-picker.d.ts +1 -1
- package/lib/cjs/webchat/input-panel/persistent-menu.d.ts +1 -1
- package/lib/cjs/webchat/input-panel/send-button.d.ts +1 -1
- package/lib/cjs/webchat/input-panel/textarea.d.ts +1 -1
- package/lib/cjs/webchat/message-list/index.d.ts +1 -1
- package/lib/cjs/webchat/message-list/intro-message.d.ts +1 -1
- package/lib/cjs/webchat/message-list/scroll-button.d.ts +0 -1
- package/lib/cjs/webchat/replies.d.ts +1 -1
- package/lib/cjs/webchat/session-view.d.ts +1 -1
- package/lib/cjs/webchat/session-view.js +2 -2
- package/lib/cjs/webchat/session-view.js.map +1 -1
- package/lib/cjs/webchat/trigger-button/index.d.ts +0 -1
- package/lib/cjs/webchat/typing-indicator/index.d.ts +1 -1
- package/lib/cjs/webchat/webchat-dev.d.ts +2 -2
- package/lib/cjs/webchat/webchat.js +10 -15
- package/lib/cjs/webchat/webchat.js.map +1 -1
- package/lib/cjs/webchat/webview.d.ts +2 -2
- package/lib/cjs/webchat-app.d.ts +1 -2
- package/lib/cjs/webchat-app.js +5 -12
- package/lib/cjs/webchat-app.js.map +1 -1
- package/lib/cjs/webview-app.js +2 -5
- package/lib/cjs/webview-app.js.map +1 -1
- package/lib/esm/components/audio.d.ts +1 -1
- package/lib/esm/components/custom-message.d.ts +2 -2
- package/lib/esm/components/document.d.ts +1 -1
- package/lib/esm/components/handoff.d.ts +1 -1
- package/lib/esm/components/image.d.ts +1 -1
- package/lib/esm/components/index-types.d.ts +1 -0
- package/lib/esm/components/message/message-feedback.d.ts +1 -1
- package/lib/esm/components/message/message-footer.d.ts +1 -1
- package/lib/esm/components/message/timestamps.d.ts +1 -1
- package/lib/esm/components/multichannel/multichannel-button.d.ts +1 -1
- package/lib/esm/components/multichannel/multichannel-reply.d.ts +1 -1
- package/lib/esm/components/multichannel/multichannel-text.d.ts +1 -1
- package/lib/esm/components/raw.d.ts +1 -1
- package/lib/esm/components/text.d.ts +1 -1
- package/lib/esm/components/video.d.ts +1 -1
- package/lib/esm/contexts.js +3 -0
- package/lib/esm/contexts.js.map +1 -1
- package/lib/esm/dev-app.js +2 -5
- package/lib/esm/dev-app.js.map +1 -1
- package/lib/esm/index-types.d.ts +1 -0
- package/lib/esm/react-bot.d.ts +1 -1
- package/lib/esm/util/error-boundary.d.ts +1 -1
- package/lib/esm/util/react.d.ts +1 -1
- package/lib/esm/webchat/chat-area/index.d.ts +1 -1
- package/lib/esm/webchat/components/common.d.ts +1 -1
- package/lib/esm/webchat/components/conditional-animation.d.ts +1 -1
- package/lib/esm/webchat/components/opened-persistent-menu.d.ts +1 -1
- package/lib/esm/webchat/cover-component/index.d.ts +6 -0
- package/lib/esm/webchat/cover-component/index.js +17 -0
- package/lib/esm/webchat/cover-component/index.js.map +1 -0
- package/lib/esm/webchat/header.d.ts +1 -1
- package/lib/esm/webchat/input-panel/attachment.d.ts +1 -1
- package/lib/esm/webchat/input-panel/emoji-picker.d.ts +1 -1
- package/lib/esm/webchat/input-panel/index.d.ts +1 -1
- package/lib/esm/webchat/input-panel/opened-emoji-picker.d.ts +1 -1
- package/lib/esm/webchat/input-panel/persistent-menu.d.ts +1 -1
- package/lib/esm/webchat/input-panel/send-button.d.ts +1 -1
- package/lib/esm/webchat/input-panel/textarea.d.ts +1 -1
- package/lib/esm/webchat/message-list/index.d.ts +1 -1
- package/lib/esm/webchat/message-list/intro-message.d.ts +1 -1
- package/lib/esm/webchat/message-list/scroll-button.d.ts +0 -1
- package/lib/esm/webchat/replies.d.ts +1 -1
- package/lib/esm/webchat/session-view.d.ts +1 -1
- package/lib/esm/webchat/session-view.js +1 -1
- package/lib/esm/webchat/session-view.js.map +1 -1
- package/lib/esm/webchat/trigger-button/index.d.ts +0 -1
- package/lib/esm/webchat/typing-indicator/index.d.ts +1 -1
- package/lib/esm/webchat/webchat-dev.d.ts +2 -2
- package/lib/esm/webchat/webchat.js +10 -15
- package/lib/esm/webchat/webchat.js.map +1 -1
- package/lib/esm/webchat/webview.d.ts +2 -2
- package/lib/esm/webchat-app.d.ts +1 -2
- package/lib/esm/webchat-app.js +5 -12
- package/lib/esm/webchat-app.js.map +1 -1
- package/lib/esm/webview-app.js +2 -5
- package/lib/esm/webview-app.js.map +1 -1
- package/package.json +15 -15
- package/src/components/index-types.ts +1 -0
- package/src/contexts.tsx +3 -0
- package/src/dev-app.jsx +5 -5
- package/src/index-types.ts +1 -0
- package/src/webchat/cover-component/index.tsx +31 -0
- package/src/webchat/session-view.jsx +1 -1
- package/src/webchat/webchat.jsx +43 -46
- package/src/webchat-app.jsx +8 -12
- package/src/webview-app.tsx +4 -6
package/src/webchat-app.jsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HubtypeService, INPUT } from '@botonic/core'
|
|
2
2
|
import merge from 'lodash.merge'
|
|
3
3
|
import React, { createRef } from 'react'
|
|
4
|
-
import {
|
|
4
|
+
import { render, unmountComponentAtNode } from 'react-dom'
|
|
5
5
|
|
|
6
6
|
import { WEBCHAT } from './constants'
|
|
7
7
|
import { SENDERS, Typing } from './index-types'
|
|
@@ -65,7 +65,6 @@ export class WebchatApp {
|
|
|
65
65
|
this.server = server
|
|
66
66
|
this.webchatRef = createRef()
|
|
67
67
|
this.appId = appId
|
|
68
|
-
this.reactRoot = null
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
createRootElement(host) {
|
|
@@ -95,9 +94,7 @@ export class WebchatApp {
|
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
getReactMountNode(node) {
|
|
98
|
-
if (!node)
|
|
99
|
-
node = this.host
|
|
100
|
-
}
|
|
97
|
+
if (!node) node = this.host
|
|
101
98
|
return node.shadowRoot ? node.shadowRoot : node
|
|
102
99
|
}
|
|
103
100
|
|
|
@@ -375,19 +372,18 @@ export class WebchatApp {
|
|
|
375
372
|
|
|
376
373
|
destroy() {
|
|
377
374
|
if (this.hubtypeService) this.hubtypeService.destroyPusher()
|
|
378
|
-
this.
|
|
375
|
+
unmountComponentAtNode(this.host)
|
|
379
376
|
if (this.storage) this.storage.removeItem(this.storageKey)
|
|
380
377
|
}
|
|
381
378
|
|
|
382
379
|
async render(dest, optionsAtRuntime = {}) {
|
|
383
380
|
onDOMLoaded(async () => {
|
|
384
381
|
const isVisible = await this.resolveWebchatVisibility(optionsAtRuntime)
|
|
385
|
-
if (isVisible)
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
382
|
+
if (isVisible)
|
|
383
|
+
render(
|
|
384
|
+
this.getComponent(dest, optionsAtRuntime),
|
|
385
|
+
this.getReactMountNode(dest)
|
|
386
|
+
)
|
|
391
387
|
})
|
|
392
388
|
}
|
|
393
389
|
}
|
package/src/webview-app.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { getString, params2queryString, PROVIDER } from '@botonic/core'
|
|
3
3
|
import axios from 'axios'
|
|
4
4
|
import React from 'react'
|
|
5
|
-
import {
|
|
5
|
+
import { render } from 'react-dom'
|
|
6
6
|
import { BrowserRouter, Route } from 'react-router-dom'
|
|
7
7
|
|
|
8
8
|
import { CloseWebviewOptions, WebviewRequestContext } from './contexts'
|
|
@@ -110,13 +110,11 @@ export class WebviewApp {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
render(dest) {
|
|
113
|
-
|
|
113
|
+
render(
|
|
114
114
|
<BrowserRouter>
|
|
115
115
|
<App webviews={this.webviews} locales={this.locales} />
|
|
116
|
-
</BrowserRouter
|
|
116
|
+
</BrowserRouter>,
|
|
117
|
+
dest
|
|
117
118
|
)
|
|
118
|
-
const container = dest
|
|
119
|
-
const reactRoot = createRoot(container)
|
|
120
|
-
reactRoot.render(component)
|
|
121
119
|
}
|
|
122
120
|
}
|