@kaltura-apps/genie-chat-react 1.3.0 → 1.3.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/index.esm.js +35 -11
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import React, { useMemo, useContext } from 'react';
|
|
3
|
-
import { UnisphereProvider, ScopedUnisphereWorkspaceProvider, ScopedUnisphereWorkspaceContext, UnisphereRuntimeVisual } from '@unisphere/runtime-react';
|
|
3
|
+
import { UnisphereProvider, ScopedUnisphereWorkspaceProvider, UnisphereRuntimeLoader, ScopedUnisphereWorkspaceContext, UnisphereRuntimeVisual } from '@unisphere/runtime-react';
|
|
4
4
|
|
|
5
5
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
6
6
|
|
|
@@ -1653,14 +1653,10 @@ const GenieChatProvider = ({
|
|
|
1653
1653
|
appId: appId,
|
|
1654
1654
|
workspaceName: workspaceName,
|
|
1655
1655
|
appVersion: '0.0.0',
|
|
1656
|
-
serverUrl: `https://unisphere.${_env}.ovp.kaltura.com/v1
|
|
1657
|
-
runtimes: [{
|
|
1658
|
-
widgetName: 'unisphere.widget.genie',
|
|
1659
|
-
runtimeName: 'chat',
|
|
1660
|
-
settings: runtimeSettings
|
|
1661
|
-
}]
|
|
1656
|
+
serverUrl: `https://unisphere.${_env}.ovp.kaltura.com/v1`
|
|
1662
1657
|
};
|
|
1663
|
-
}, [_env,
|
|
1658
|
+
}, [_env, workspaceName]);
|
|
1659
|
+
const [runtimeError, setRuntimeError] = React.useState(null);
|
|
1664
1660
|
const themeProps = useMemo(() => {
|
|
1665
1661
|
if (typeof _theme === 'object') {
|
|
1666
1662
|
return {
|
|
@@ -1671,14 +1667,42 @@ const GenieChatProvider = ({
|
|
|
1671
1667
|
themeMode: _theme
|
|
1672
1668
|
};
|
|
1673
1669
|
}, [_theme]);
|
|
1670
|
+
if (!runtimeSettings) {
|
|
1671
|
+
return null;
|
|
1672
|
+
}
|
|
1673
|
+
if (runtimeError) {
|
|
1674
|
+
return jsx("div", {
|
|
1675
|
+
style: {
|
|
1676
|
+
color: 'red',
|
|
1677
|
+
padding: '1rem',
|
|
1678
|
+
width: '100%',
|
|
1679
|
+
height: '100%',
|
|
1680
|
+
display: 'flex',
|
|
1681
|
+
alignItems: 'center',
|
|
1682
|
+
justifyContent: 'center',
|
|
1683
|
+
textAlign: 'center'
|
|
1684
|
+
},
|
|
1685
|
+
children: jsxs("span", {
|
|
1686
|
+
children: [jsx("b", {
|
|
1687
|
+
children: "Error loading chat runtime:"
|
|
1688
|
+
}), " ", runtimeError.message]
|
|
1689
|
+
})
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1674
1692
|
return jsx(UnisphereProvider, Object.assign({}, themeProps, {
|
|
1675
1693
|
language: _lang,
|
|
1676
1694
|
initialConfiguration: initialConfiguration,
|
|
1677
1695
|
onWorkspaceLoaded: setWorkspace,
|
|
1678
|
-
children: workspace &&
|
|
1696
|
+
children: workspace && jsxs(ScopedUnisphereWorkspaceProvider, {
|
|
1679
1697
|
unisphereWorkspace: workspace,
|
|
1680
1698
|
runtimeLogger: workspace.getLogger(appId),
|
|
1681
|
-
children:
|
|
1699
|
+
children: [jsx(UnisphereRuntimeLoader, {
|
|
1700
|
+
runtimeName: "chat",
|
|
1701
|
+
widgetName: "unisphere.widget.genie",
|
|
1702
|
+
runtimeSettings: runtimeSettings,
|
|
1703
|
+
workspaceName: workspace.getWorkspaceName(),
|
|
1704
|
+
onRuntimeError: setRuntimeError
|
|
1705
|
+
}), children]
|
|
1682
1706
|
})
|
|
1683
1707
|
}));
|
|
1684
1708
|
};
|