@seamly/web-ui 24.0.0-beta.8 → 24.0.0-beta.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamly/web-ui",
3
- "version": "24.0.0-beta.8",
3
+ "version": "24.0.0-beta.9",
4
4
  "main": "build/dist/lib/index.js",
5
5
  "types": "build/src/javascripts/index.d.ts",
6
6
  "exports": {
@@ -15,6 +15,7 @@ import {
15
15
  useSeamlyCommands,
16
16
  useSeamlyConversationUrl,
17
17
  useSeamlyLayoutMode,
18
+ useSeamlyResumeConversationPrompt,
18
19
  useSeamlyUnreadCount,
19
20
  } from 'ui/hooks/seamly-hooks'
20
21
  import { actionTypes, sourceTypes } from 'ui/utils/seamly-utils'
@@ -46,6 +47,8 @@ const SeamlyInstanceFunctionsLoader = () => {
46
47
  const currentVisibility = useRef(visible)
47
48
  const eventBus = useSeamlyEventBusContext()
48
49
  const api = useSeamlyApiContext()
50
+ const { hasPrompt, continueChat } = useSeamlyResumeConversationPrompt()
51
+ const hasResumeConversationPrompt = useRef(hasPrompt)
49
52
  const unreadCount = useSeamlyUnreadCount()
50
53
  const previousUnreadCount = useRef<number | null>(null)
51
54
  const previousVisibilityState = useRef<VisibilityOptions>(null)
@@ -58,11 +61,16 @@ const SeamlyInstanceFunctionsLoader = () => {
58
61
 
59
62
  useEffect(() => {
60
63
  currentVisibility.current = visible
61
- }, [visible])
64
+ hasResumeConversationPrompt.current = hasPrompt
65
+ }, [hasPrompt, visible])
62
66
 
63
67
  useSeamlyInstanceFunction(
64
68
  'askText',
65
69
  (text) => {
70
+ if (hasResumeConversationPrompt.current) {
71
+ continueChat()
72
+ }
73
+
66
74
  sendMessage({ body: text })
67
75
  },
68
76
  [api.send],
@@ -75,6 +83,7 @@ const SeamlyInstanceFunctionsLoader = () => {
75
83
  },
76
84
  [api.send],
77
85
  )
86
+
78
87
  useSeamlyInstanceFunction('getVisibility', (callback) => {
79
88
  if (callback) {
80
89
  callback(currentVisibility.current)
@@ -84,6 +93,7 @@ const SeamlyInstanceFunctionsLoader = () => {
84
93
  )
85
94
  }
86
95
  })
96
+
87
97
  useSeamlyInstanceFunction(
88
98
  'setVisibility',
89
99
  (args: VisibilityOptions | VisibilityActionArgs) => {
@@ -102,6 +112,7 @@ const SeamlyInstanceFunctionsLoader = () => {
102
112
  },
103
113
  [config.api],
104
114
  )
115
+
105
116
  useSeamlyInstanceFunction(
106
117
  'sendCustomAction',
107
118
  (actionType, body) => {
@@ -109,6 +120,7 @@ const SeamlyInstanceFunctionsLoader = () => {
109
120
  },
110
121
  [api.send],
111
122
  )
123
+
112
124
  useSeamlyInstanceFunction(
113
125
  'setTopic',
114
126
  ({ name, fallbackMessage, message, userTriggered }) => {
@@ -116,6 +128,10 @@ const SeamlyInstanceFunctionsLoader = () => {
116
128
  dispatch(updateConfig({ showSuggestions: false }))
117
129
  }
118
130
 
131
+ if (hasResumeConversationPrompt.current) {
132
+ continueChat()
133
+ }
134
+
119
135
  if (name && fallbackMessage) {
120
136
  sendAction({
121
137
  type: actionTypes.setTopic,