@seamly/web-ui 21.0.2-beta.3 → 21.0.2-beta.4

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * focus-trap 7.0.0
2
+ * focus-trap 7.1.0
3
3
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamly/web-ui",
3
- "version": "21.0.2-beta.3",
3
+ "version": "21.0.2-beta.4",
4
4
  "main": "build/dist/lib/index.js",
5
5
  "types": "build/src/javascripts/index.d.ts",
6
6
  "module": "",
@@ -20,6 +20,7 @@ export { visibilityStates } from 'domains/visibility/constants'
20
20
  export { useVisibility as useSeamlyVisibility } from 'domains/visibility/hooks'
21
21
  export { calculateVisibility } from 'domains/visibility/utils'
22
22
  // Used by: StyleGuide
23
+ export { Provider as SeamlyStoreProvider } from 'react-redux'
23
24
  export { default as ComponentFilter } from 'ui/components/conversation/component-filter'
24
25
  // Used by: Client
25
26
  export { default as Conversation } from 'ui/components/conversation/conversation'
@@ -51,7 +51,20 @@ class ExternalApi {
51
51
  })
52
52
  }
53
53
 
54
+ instanceInitializing(namespace) {
55
+ const instances = Object.keys(this._instances)
56
+
57
+ return (!namespace && instances.length > 0) || instances.includes(namespace)
58
+ }
59
+
54
60
  setContext(action, args) {
61
+ const { instance: namespace } = args
62
+ // Do not set this action in context if we are already initializing.
63
+ // If we do, it will not be sent to the server anymore (because it gets marked as 'handled').
64
+ if (this.instanceInitializing(namespace)) {
65
+ return false
66
+ }
67
+
55
68
  switch (action) {
56
69
  case 'setTopic':
57
70
  const { name } = args
@@ -118,11 +131,11 @@ class ExternalApi {
118
131
 
119
132
  // results will be an array containing the results of wether an instance has
120
133
  // handled the action or not
121
- const results = instances.map((instance) => {
122
- return !namespace || instance.namespace === namespace
134
+ const results = instances.map((instance) =>
135
+ !namespace || instance.namespace === namespace
123
136
  ? instance.execFunction(action, ...args)
124
- : false
125
- })
137
+ : false,
138
+ )
126
139
 
127
140
  // test if any of the instances has handled the action
128
141
  return results.some(Boolean)
@@ -1,13 +1,12 @@
1
1
  import { configureStore } from '@reduxjs/toolkit'
2
- import { useMemo, useRef } from 'preact/hooks'
3
- import { Provider } from 'react-redux'
4
- import ComponentFilter from 'ui/components/conversation/component-filter'
5
2
  import {
3
+ ComponentFilter,
6
4
  SeamlyApiContext,
7
5
  SeamlyEventBusContext,
8
- } from 'ui/components/core/seamly-api-context'
9
- import SeamlyChat from 'ui/components/core/seamly-chat'
10
- import { SeamlyLiveRegionContext } from 'ui/components/core/seamly-live-region-context'
6
+ SeamlyLiveRegionContext,
7
+ SeamlyStoreProvider,
8
+ } from '@seamly/web-ui'
9
+ import { useMemo, useRef } from 'preact/hooks'
11
10
  import appReducer from 'domains/app/slice'
12
11
  import configReducer, {
13
12
  setConfig,
@@ -120,17 +119,15 @@ const SeamlyStaticCore = ({
120
119
 
121
120
  return (
122
121
  state && (
123
- <Provider store={store}>
122
+ <SeamlyStoreProvider store={store}>
124
123
  <SeamlyEventBusContext.Provider value={eventBusRef.current}>
125
124
  <SeamlyLiveRegionContext.Provider value={liveMsgRef.current}>
126
125
  <SeamlyApiContext.Provider value={bareApi}>
127
- <SeamlyChat>
128
- <ComponentFilter>{children}</ComponentFilter>
129
- </SeamlyChat>
126
+ <ComponentFilter>{children}</ComponentFilter>
130
127
  </SeamlyApiContext.Provider>
131
128
  </SeamlyLiveRegionContext.Provider>
132
129
  </SeamlyEventBusContext.Provider>
133
- </Provider>
130
+ </SeamlyStoreProvider>
134
131
  )
135
132
  )
136
133
  }