@unisphere/nx 4.15.8 → 5.0.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/dist/generators/utils.d.ts +2 -2
- package/dist/generators/utils.d.ts.map +1 -1
- package/dist/generators/utils.js +1 -1
- package/dist/migrations/3-15-0/add-experience-documentation.d.ts +3 -4
- package/dist/migrations/3-15-0/add-experience-documentation.d.ts.map +1 -1
- package/dist/migrations/3-15-0/add-experience-documentation.js +4 -18
- package/dist/migrations/3-23-0/update-documentation-typedoc-plugins.d.ts +3 -6
- package/dist/migrations/3-23-0/update-documentation-typedoc-plugins.d.ts.map +1 -1
- package/dist/migrations/3-23-0/update-documentation-typedoc-plugins.js +4 -166
- package/dist/migrations/4-15-2/move-cli-to-dev-dependencies.d.ts +4 -0
- package/dist/migrations/4-15-2/move-cli-to-dev-dependencies.d.ts.map +1 -1
- package/dist/migrations/4-15-2/move-cli-to-dev-dependencies.js +70 -0
- package/dist/migrations/4-15-9/templates/_publish-artifacts.template +361 -0
- package/dist/migrations/4-15-9/update-publish-artifacts-workflow.d.ts +10 -0
- package/dist/migrations/4-15-9/update-publish-artifacts-workflow.d.ts.map +1 -0
- package/dist/migrations/4-15-9/update-publish-artifacts-workflow.js +42 -0
- package/dist/migrations/5-0-0/remove-documentation.d.ts +9 -0
- package/dist/migrations/5-0-0/remove-documentation.d.ts.map +1 -0
- package/dist/migrations/5-0-0/remove-documentation.js +45 -0
- package/generators.json +0 -5
- package/migrations.json +16 -0
- package/package.json +1 -1
- package/dist/generators/add-documentation/USAGE.md +0 -64
- package/dist/generators/add-documentation/add-documentation.d.ts +0 -5
- package/dist/generators/add-documentation/add-documentation.d.ts.map +0 -1
- package/dist/generators/add-documentation/add-documentation.js +0 -145
- package/dist/generators/add-documentation/discover-typedoc-plugins.d.ts +0 -23
- package/dist/generators/add-documentation/discover-typedoc-plugins.d.ts.map +0 -1
- package/dist/generators/add-documentation/discover-typedoc-plugins.js +0 -128
- package/dist/generators/add-documentation/schema.d.ts +0 -4
- package/dist/generators/add-documentation/schema.json +0 -20
- package/dist/generators/add-documentation/templates/babel.config.js +0 -3
- package/dist/generators/add-documentation/templates/docs/changelog/overview.md +0 -9
- package/dist/generators/add-documentation/templates/docs/documentations/overview.md +0 -9
- package/dist/generators/add-documentation/templates/docs/reference/overview.md +0 -9
- package/dist/generators/add-documentation/templates/docusaurus.config.ts.template +0 -134
- package/dist/generators/add-documentation/templates/package.json.template +0 -59
- package/dist/generators/add-documentation/templates/plugins/discover-typedoc-plugins.mjs +0 -156
- package/dist/generators/add-documentation/templates/plugins/typedoc-plugins.ts.template +0 -7
- package/dist/generators/add-documentation/templates/postcss.config.js +0 -6
- package/dist/generators/add-documentation/templates/sidebars.ts +0 -9
- package/dist/generators/add-documentation/templates/src/components/demo-placeholder-card.tsx +0 -33
- package/dist/generators/add-documentation/templates/src/components/guides/experiences/genie/integrate-genie-guide.tsx +0 -149
- package/dist/generators/add-documentation/templates/src/components/guides/experiences/notifications/notifications-react-guide.tsx +0 -211
- package/dist/generators/add-documentation/templates/src/components/homepage-features/index.tsx +0 -141
- package/dist/generators/add-documentation/templates/src/components/homepage-features/styles.module.css +0 -87
- package/dist/generators/add-documentation/templates/src/components/homepage-modules/index.tsx +0 -76
- package/dist/generators/add-documentation/templates/src/components/homepage-modules/styles.module.css +0 -120
- package/dist/generators/add-documentation/templates/src/components/homepage-start-now/index.tsx +0 -22
- package/dist/generators/add-documentation/templates/src/components/homepage-start-now/styles.module.css +0 -38
- package/dist/generators/add-documentation/templates/src/components/interactive-code-panel.tsx +0 -258
- package/dist/generators/add-documentation/templates/src/components/introductions/developer-toolbox-experience.tsx +0 -84
- package/dist/generators/add-documentation/templates/src/components/introductions/hello-world-experience.tsx +0 -133
- package/dist/generators/add-documentation/templates/src/components/introductions/notificaitons-experience.tsx +0 -635
- package/dist/generators/add-documentation/templates/src/components/introductions/reactions-experience.tsx +0 -117
- package/dist/generators/add-documentation/templates/src/components/ui-shared/introduction-card.tsx +0 -117
- package/dist/generators/add-documentation/templates/src/components/ui-shared/playground-card.tsx +0 -67
- package/dist/generators/add-documentation/templates/src/components/ui-shared/use-color-mode.ts +0 -20
- package/dist/generators/add-documentation/templates/src/components/ui-shared/utils.ts +0 -8
- package/dist/generators/add-documentation/templates/src/css/custom.css +0 -710
- package/dist/generators/add-documentation/templates/src/css/hero.module.css +0 -190
- package/dist/generators/add-documentation/templates/src/pages/index.module.css +0 -59
- package/dist/generators/add-documentation/templates/src/pages/index.tsx.template +0 -79
- package/dist/generators/add-documentation/templates/src/theme/Navbar/Content/index.tsx +0 -103
- package/dist/generators/add-documentation/templates/src/theme/Navbar/Content/styles.module.css +0 -9
- package/dist/generators/add-documentation/templates/src/theme/Navbar/MobileSidebar/Header/index.tsx +0 -45
- package/dist/generators/add-documentation/templates/static/.nojekyll +0 -0
- package/dist/generators/add-documentation/templates/static/homepage/divider.svg +0 -5
- package/dist/generators/add-documentation/templates/static/homepage/icons/Architecture.svg +0 -4
- package/dist/generators/add-documentation/templates/static/homepage/icons/Cost.svg +0 -4
- package/dist/generators/add-documentation/templates/static/homepage/icons/ExternalLink.svg +0 -3
- package/dist/generators/add-documentation/templates/static/homepage/icons/Infra.svg +0 -8
- package/dist/generators/add-documentation/templates/static/homepage/icons/Redundancies.svg +0 -6
- package/dist/generators/add-documentation/templates/static/homepage/icons/Speed.svg +0 -6
- package/dist/generators/add-documentation/templates/static/homepage/icons/Standards.svg +0 -4
- package/dist/generators/add-documentation/templates/static/homepage/icons/Unified.svg +0 -12
- package/dist/generators/add-documentation/templates/static/homepage/services/custo.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/homepage/services/flame.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/homepage/services/keepr.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/homepage/services/loggi.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/homepage/services/palleto.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/homepage/services/publi.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/homepage/services/tinker.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/img/favicon.ico +0 -0
- package/dist/generators/add-documentation/templates/static/img/logo.svg +0 -6
- package/dist/generators/add-documentation/templates/static/img/logo_dark.svg +0 -6
- package/dist/generators/add-documentation/templates/static/robots.txt +0 -5
- package/dist/generators/add-documentation/templates/tailwind.config.js +0 -30
- package/dist/generators/add-documentation/templates/tsconfig.json +0 -7
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Auto-discovers publishable packages from .unisphere config and regenerates
|
|
4
|
-
* plugins/typedoc-plugins.ts with updated docusaurus-plugin-typedoc entries.
|
|
5
|
-
*
|
|
6
|
-
* Run: npm run discover-plugins
|
|
7
|
-
*
|
|
8
|
-
* - Reads <workspace-root>/.unisphere for packages list
|
|
9
|
-
* - Reads <workspace-root>/tsconfig.base.json for npm package names
|
|
10
|
-
* - Writes plugins/typedoc-plugins.ts
|
|
11
|
-
*
|
|
12
|
-
* Packages under the "local" scope are excluded (internal-only packages).
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
16
|
-
import { join, relative, dirname } from 'path';
|
|
17
|
-
import { fileURLToPath } from 'url';
|
|
18
|
-
|
|
19
|
-
const DOCUMENTED_SCOPES = [
|
|
20
|
-
'kaltura-corp',
|
|
21
|
-
'kaltura-apps',
|
|
22
|
-
'kaltura-ui',
|
|
23
|
-
'kaltura-sdk',
|
|
24
|
-
'unisphere',
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
// This script lives at <docs-site>/plugins/discover-typedoc-plugins.mjs
|
|
28
|
-
const pluginsDir = dirname(fileURLToPath(import.meta.url));
|
|
29
|
-
const docsSiteRoot = join(pluginsDir, '..');
|
|
30
|
-
|
|
31
|
-
// Walk up from docs site to find workspace root (where .unisphere lives)
|
|
32
|
-
function findWorkspaceRoot(startDir) {
|
|
33
|
-
let dir = startDir;
|
|
34
|
-
while (true) {
|
|
35
|
-
if (existsSync(join(dir, '.unisphere'))) return dir;
|
|
36
|
-
const parent = dirname(dir);
|
|
37
|
-
if (parent === dir) {
|
|
38
|
-
throw new Error(
|
|
39
|
-
'Could not find .unisphere — are you inside a Unisphere workspace?'
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
dir = parent;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const workspaceRoot = findWorkspaceRoot(docsSiteRoot);
|
|
47
|
-
|
|
48
|
-
// Parse workspace configs
|
|
49
|
-
const unisphere = JSON.parse(
|
|
50
|
-
readFileSync(join(workspaceRoot, '.unisphere'), 'utf-8')
|
|
51
|
-
);
|
|
52
|
-
const tsconfig = JSON.parse(
|
|
53
|
-
readFileSync(join(workspaceRoot, 'tsconfig.base.json'), 'utf-8')
|
|
54
|
-
);
|
|
55
|
-
const tsconfigPaths = tsconfig?.compilerOptions?.paths ?? {};
|
|
56
|
-
const packages = unisphere?.elements?.packages ?? {};
|
|
57
|
-
|
|
58
|
-
// Build reverse lookup: "sourceRoot/src/index.ts" → npm package name
|
|
59
|
-
const pathToPackageName = {};
|
|
60
|
-
for (const [pkgName, paths] of Object.entries(tsconfigPaths)) {
|
|
61
|
-
if (Array.isArray(paths)) {
|
|
62
|
-
for (const p of paths) {
|
|
63
|
-
pathToPackageName[p] = pkgName;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function findPackageName(sourceRoot) {
|
|
69
|
-
return pathToPackageName[`${sourceRoot}/src/index.ts`] ?? null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function shortName(pkgName) {
|
|
73
|
-
return pkgName.split('/').pop();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Discover plugins
|
|
77
|
-
const discovered = [];
|
|
78
|
-
for (const [, pkgConfig] of Object.entries(packages)) {
|
|
79
|
-
const sourceRoot = pkgConfig?.sourceRoot;
|
|
80
|
-
if (!sourceRoot) continue;
|
|
81
|
-
|
|
82
|
-
// Expected sourceRoot format: unisphere/packages/<scope>/<name>
|
|
83
|
-
const parts = sourceRoot.split('/');
|
|
84
|
-
if (parts.length < 4) continue;
|
|
85
|
-
const scope = parts[2];
|
|
86
|
-
|
|
87
|
-
if (!DOCUMENTED_SCOPES.includes(scope)) continue;
|
|
88
|
-
|
|
89
|
-
const pkgName = findPackageName(sourceRoot);
|
|
90
|
-
if (!pkgName) {
|
|
91
|
-
console.warn(`⚠️ No tsconfig path found for ${sourceRoot} — skipping`);
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const short = shortName(pkgName);
|
|
96
|
-
// Relative path from docs site root to the package folder
|
|
97
|
-
const relBase = relative(
|
|
98
|
-
docsSiteRoot,
|
|
99
|
-
join(workspaceRoot, sourceRoot)
|
|
100
|
-
).replace(/\\/g, '/');
|
|
101
|
-
|
|
102
|
-
discovered.push({
|
|
103
|
-
id: `api-${short}`,
|
|
104
|
-
packageName: pkgName,
|
|
105
|
-
entryPoints: `${relBase}/src/index.ts`,
|
|
106
|
-
tsconfig: `${relBase}/tsconfig.json`,
|
|
107
|
-
out: `docs/api/${short}/v1`,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Serialise to TypeScript
|
|
112
|
-
function pluginsToTs(plugins) {
|
|
113
|
-
if (plugins.length === 0) return '[]';
|
|
114
|
-
|
|
115
|
-
const entries = plugins
|
|
116
|
-
.map(
|
|
117
|
-
(p) =>
|
|
118
|
-
` // ${p.packageName}\n` +
|
|
119
|
-
` [\n` +
|
|
120
|
-
` 'docusaurus-plugin-typedoc',\n` +
|
|
121
|
-
` {\n` +
|
|
122
|
-
` id: '${p.id}',\n` +
|
|
123
|
-
` entryPoints: ['${p.entryPoints}'],\n` +
|
|
124
|
-
` tsconfig: '${p.tsconfig}',\n` +
|
|
125
|
-
` out: '${p.out}',\n` +
|
|
126
|
-
` readme: 'none',\n` +
|
|
127
|
-
` excludePrivate: true,\n` +
|
|
128
|
-
` excludeProtected: true,\n` +
|
|
129
|
-
` excludeInternal: true,\n` +
|
|
130
|
-
` disableSources: true,\n` +
|
|
131
|
-
` },\n` +
|
|
132
|
-
` ]`
|
|
133
|
-
)
|
|
134
|
-
.join(',\n');
|
|
135
|
-
|
|
136
|
-
return `[\n${entries},\n]`;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const content =
|
|
140
|
-
`// Auto-generated by plugins/discover-typedoc-plugins.mjs\n` +
|
|
141
|
-
`// Run "npm run discover-plugins" to regenerate\n` +
|
|
142
|
-
`\n` +
|
|
143
|
-
`// eslint-disable-next-line @typescript-eslint/no-explicit-any\n` +
|
|
144
|
-
`const typedocPlugins: any[] = ${pluginsToTs(discovered)};\n` +
|
|
145
|
-
`\n` +
|
|
146
|
-
`export default typedocPlugins;\n`;
|
|
147
|
-
|
|
148
|
-
const outPath = join(pluginsDir, 'typedoc-plugins.ts');
|
|
149
|
-
writeFileSync(outPath, content, 'utf-8');
|
|
150
|
-
|
|
151
|
-
console.log(
|
|
152
|
-
`✅ Discovered ${discovered.length} package(s) → plugins/typedoc-plugins.ts`
|
|
153
|
-
);
|
|
154
|
-
for (const p of discovered) {
|
|
155
|
-
console.log(` • ${p.packageName} → ${p.out}`);
|
|
156
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Auto-generated by plugins/discover-typedoc-plugins.mjs
|
|
2
|
-
// Run "npm run discover-plugins" to regenerate
|
|
3
|
-
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
-
const typedocPlugins: any[] = <%- typedocPluginsConfig %>;
|
|
6
|
-
|
|
7
|
-
export default typedocPlugins;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
|
|
2
|
-
|
|
3
|
-
const sidebars: SidebarsConfig = {
|
|
4
|
-
documentations: [{ type: 'autogenerated', dirName: '.' }],
|
|
5
|
-
reference: [{ type: 'autogenerated', dirName: '.' }],
|
|
6
|
-
changelog: [{ type: 'autogenerated', dirName: '.' }],
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default sidebars;
|
package/dist/generators/add-documentation/templates/src/components/demo-placeholder-card.tsx
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { PlaygroundCard } from '@site/src/components/ui-shared/playground-card';
|
|
3
|
-
|
|
4
|
-
const DemoPlaceholderCard: React.FC = () => {
|
|
5
|
-
const playIcon = (
|
|
6
|
-
<svg
|
|
7
|
-
width="48"
|
|
8
|
-
height="48"
|
|
9
|
-
viewBox="0 0 24 24"
|
|
10
|
-
fill="none"
|
|
11
|
-
stroke="currentColor"
|
|
12
|
-
strokeWidth="1.5"
|
|
13
|
-
style={{
|
|
14
|
-
color: '#94a3b8',
|
|
15
|
-
opacity: 0.7
|
|
16
|
-
}}
|
|
17
|
-
>
|
|
18
|
-
<circle cx="12" cy="12" r="10" />
|
|
19
|
-
<polygon points="10,8 16,12 10,16 10,8" />
|
|
20
|
-
</svg>
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<PlaygroundCard
|
|
25
|
-
title="Live Demonstration"
|
|
26
|
-
icon={playIcon}
|
|
27
|
-
>
|
|
28
|
-
A live demonstration will be added here soon
|
|
29
|
-
</PlaygroundCard>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default DemoPlaceholderCard;
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Tab, InteractiveCodePanel } from '../../../interactive-code-panel';
|
|
3
|
-
|
|
4
|
-
export const IntegrateGenieGuide: React.FC = () => {
|
|
5
|
-
const tabs: Tab[] = [
|
|
6
|
-
{
|
|
7
|
-
id: 'verify-setup',
|
|
8
|
-
title: '1. Verify Setup',
|
|
9
|
-
icon: '✅',
|
|
10
|
-
language: 'bash',
|
|
11
|
-
content: ``,
|
|
12
|
-
description: `Ensure your Unisphere workspace is properly set up before integrating Genie.`
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: 'install-genie',
|
|
16
|
-
title: '2. Install Genie Types',
|
|
17
|
-
icon: '📦',
|
|
18
|
-
language: 'bash',
|
|
19
|
-
content: `npm i @unisphere/genie-core`,
|
|
20
|
-
description: `Install the Genie core package to access Genie functionality.`
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: 'configure-genie',
|
|
24
|
-
title: '3. Load Genie',
|
|
25
|
-
icon: '⚙️',
|
|
26
|
-
language: 'typescript',
|
|
27
|
-
content: `import { GenieSettings } from '@unisphere/genie-core';
|
|
28
|
-
|
|
29
|
-
// Extract settings to a const using the Genie type
|
|
30
|
-
const genieSettings: GenieSettings = {
|
|
31
|
-
getSourceUrl: ({ entryId, startTime }) => {
|
|
32
|
-
return ""; // return your entry URL
|
|
33
|
-
},
|
|
34
|
-
kalturaServerURI: "https://www.kaltura.com",
|
|
35
|
-
ks: "",
|
|
36
|
-
partnerId: "",
|
|
37
|
-
uiconfId: "",
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// Genie experience configuration
|
|
41
|
-
const genieExperience = {
|
|
42
|
-
widgetName: "unisphere.widget.genie",
|
|
43
|
-
runtimeName: "chat",
|
|
44
|
-
settings: genieSettings,
|
|
45
|
-
visuals: [
|
|
46
|
-
{
|
|
47
|
-
type: "page",
|
|
48
|
-
target: "class-genie-container",
|
|
49
|
-
settings: {},
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
};`,
|
|
53
|
-
description: `The settings are extracted to a const using the GenieSettings type for better type safety. Copy it to your workspace configuration.`
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
id: 'render-genie',
|
|
57
|
-
title: '4. Render Genie',
|
|
58
|
-
icon: '🚀',
|
|
59
|
-
language: 'html',
|
|
60
|
-
content: `
|
|
61
|
-
<style>
|
|
62
|
-
:root {
|
|
63
|
-
--host-header-height: 4rem;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
body {
|
|
67
|
-
margin: 0;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.host-root-container {
|
|
71
|
-
width: 100vw;
|
|
72
|
-
height: calc(100vh - var(--host-header-height));
|
|
73
|
-
overflow-x: hidden;
|
|
74
|
-
overflow-y: auto;
|
|
75
|
-
padding-top: var(--host-header-height);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.host-root-header {
|
|
79
|
-
z-index: 10;
|
|
80
|
-
position: fixed;
|
|
81
|
-
top: 0;
|
|
82
|
-
left: 0;
|
|
83
|
-
height: var(--host-header-height);
|
|
84
|
-
width: 100%;
|
|
85
|
-
background: navy;
|
|
86
|
-
color: white;
|
|
87
|
-
display: flex;
|
|
88
|
-
align-items: center;
|
|
89
|
-
padding: 0 2rem;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.host-root-content {
|
|
93
|
-
width: 100%;
|
|
94
|
-
height: 100%;
|
|
95
|
-
display: flex;
|
|
96
|
-
justify-content: center;
|
|
97
|
-
align-items: center;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
#class-genie-container {
|
|
101
|
-
display: flex;
|
|
102
|
-
width: 100%;
|
|
103
|
-
height: 100%;
|
|
104
|
-
min-height: calc(100vh - var(--host-header-height));
|
|
105
|
-
}
|
|
106
|
-
</style>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<body>
|
|
110
|
-
<div class="host-root-container">
|
|
111
|
-
<header class="host-root-header">Genie Expo</header>
|
|
112
|
-
<main class="host-root-content">
|
|
113
|
-
<div id="class-genie-container"></div>
|
|
114
|
-
</main>
|
|
115
|
-
</div>
|
|
116
|
-
</body>
|
|
117
|
-
`,
|
|
118
|
-
description: `Copy the HTML code to your application. Make sure you style as shown above`
|
|
119
|
-
},
|
|
120
|
-
];
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<>
|
|
124
|
-
<style>{`
|
|
125
|
-
@media (max-width: 768px) {
|
|
126
|
-
.tab-navigation {
|
|
127
|
-
flex-direction: column !important;
|
|
128
|
-
}
|
|
129
|
-
.tab-navigation button {
|
|
130
|
-
flex: none !important;
|
|
131
|
-
border-bottom: 1px solid var(--ifm-color-emphasis-300) !important;
|
|
132
|
-
border-right: none !important;
|
|
133
|
-
}
|
|
134
|
-
.tab-navigation button:last-child {
|
|
135
|
-
border-bottom: none !important;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
`}</style>
|
|
139
|
-
<InteractiveCodePanel
|
|
140
|
-
title="🧞 Integrate Genie Experience"
|
|
141
|
-
description="Complete guide for integrating Genie AI assistant into your Unisphere application"
|
|
142
|
-
tabs={tabs}
|
|
143
|
-
defaultTab="verify-setup"
|
|
144
|
-
defaultExpanded={false}
|
|
145
|
-
showCopyButton={true}
|
|
146
|
-
/>
|
|
147
|
-
</>
|
|
148
|
-
);
|
|
149
|
-
};
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Tab, InteractiveCodePanel } from '../../../interactive-code-panel';
|
|
3
|
-
|
|
4
|
-
export const NotificationsReactGuide: React.FC = () => {
|
|
5
|
-
const tabs: Tab[] = [
|
|
6
|
-
{
|
|
7
|
-
id: 'verify-setup',
|
|
8
|
-
title: '1. Verify Setup',
|
|
9
|
-
icon: '✅',
|
|
10
|
-
language: 'bash',
|
|
11
|
-
content: ``,
|
|
12
|
-
description: `Ensure your Unisphere workspace is properly set up before integrating notifications.`
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: 'install-runtime',
|
|
16
|
-
title: '2. Install Runtime',
|
|
17
|
-
icon: '📦',
|
|
18
|
-
language: 'bash',
|
|
19
|
-
content: `npm install @unisphere/runtime-react`,
|
|
20
|
-
description: `Install the React-optimized Unisphere runtime package for host applications.`
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: 'configure-provider',
|
|
24
|
-
title: '3. Configure Provider',
|
|
25
|
-
icon: '⚙️',
|
|
26
|
-
language: 'tsx',
|
|
27
|
-
content: `import React from 'react';
|
|
28
|
-
import { UnisphereProvider } from '@unisphere/runtime-react';
|
|
29
|
-
|
|
30
|
-
function HostAppComponent() {
|
|
31
|
-
const unisphereConfiguration = React.useMemo(() => ({
|
|
32
|
-
serverUrl: process.env.REACT_APP_UNISPHERE_SERVER_URL,
|
|
33
|
-
runtimes: [{
|
|
34
|
-
widgetName: 'unisphere.widget.notifications',
|
|
35
|
-
runtimeName: 'notifications',
|
|
36
|
-
settings: {},
|
|
37
|
-
runtimeArea: { target: 'body' }
|
|
38
|
-
}]
|
|
39
|
-
}), []);
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<UnisphereProvider initialConfiguration={unisphereConfiguration}>
|
|
43
|
-
<MyApplication />
|
|
44
|
-
</UnisphereProvider>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export default HostAppComponent;`,
|
|
49
|
-
description: `Configure the UnisphereProvider with notifications runtime. Replace serverUrl with your actual Unisphere server URL.`
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
id: 'install-notifications',
|
|
53
|
-
title: '4. Install Notifications',
|
|
54
|
-
icon: '🔔',
|
|
55
|
-
language: 'bash',
|
|
56
|
-
content: `npm install @unisphere/notifications-runtime-react @unisphere/notifications-core`,
|
|
57
|
-
description: `Install the React notifications runtime and core packages.`
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
id: 'setup-notifications-provider',
|
|
61
|
-
title: '5. Setup Provider',
|
|
62
|
-
icon: '🔧',
|
|
63
|
-
language: 'tsx',
|
|
64
|
-
content: `import React from 'react';
|
|
65
|
-
import { UnisphereProvider } from '@unisphere/runtime-react';
|
|
66
|
-
import { UnisphereNotificationsProvider } from '@unisphere/notifications-runtime-react';
|
|
67
|
-
|
|
68
|
-
function App() {
|
|
69
|
-
const unisphereConfiguration = React.useMemo(() => ({
|
|
70
|
-
serverUrl: process.env.REACT_APP_UNISPHERE_SERVER_URL,
|
|
71
|
-
runtimes: [{
|
|
72
|
-
widgetName: 'unisphere.widget.notifications',
|
|
73
|
-
runtimeName: 'notifications',
|
|
74
|
-
settings: {},
|
|
75
|
-
runtimeArea: { target: 'body' }
|
|
76
|
-
}]
|
|
77
|
-
}), []);
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<UnisphereProvider initialConfiguration={unisphereConfiguration}>
|
|
81
|
-
<UnisphereNotificationsProvider>
|
|
82
|
-
<MyApplication />
|
|
83
|
-
</UnisphereNotificationsProvider>
|
|
84
|
-
</UnisphereProvider>
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export default App;`,
|
|
89
|
-
description: `Wrap your app with both UnisphereProvider and UnisphereNotificationsProvider for complete setup.`
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
id: 'show-notifications',
|
|
93
|
-
title: '6. Show Notifications',
|
|
94
|
-
icon: '✨',
|
|
95
|
-
language: 'tsx',
|
|
96
|
-
content: `import React, { useContext } from 'react';
|
|
97
|
-
import { UnisphereNotificationsContext, NotificationTypes } from '@unisphere/notifications-runtime-react';
|
|
98
|
-
|
|
99
|
-
function MyComponent() {
|
|
100
|
-
const { addNotification } = useContext(UnisphereNotificationsContext);
|
|
101
|
-
|
|
102
|
-
const showNotification = () => {
|
|
103
|
-
addNotification({
|
|
104
|
-
type: NotificationTypes.Toast,
|
|
105
|
-
content: { message: "Hello everyone!" },
|
|
106
|
-
author: {
|
|
107
|
-
name: "Brian Dennis",
|
|
108
|
-
position: "Director of Brand, Kaltura",
|
|
109
|
-
url: "https://avatar.com",
|
|
110
|
-
},
|
|
111
|
-
buttons: [{
|
|
112
|
-
id: 'btn-1',
|
|
113
|
-
type: 'link',
|
|
114
|
-
label: 'Read Post',
|
|
115
|
-
url: 'www.example.com'
|
|
116
|
-
}]
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
<button onClick={showNotification}>
|
|
122
|
-
Show Notification
|
|
123
|
-
</button>
|
|
124
|
-
);
|
|
125
|
-
}`,
|
|
126
|
-
description: `Use the notifications context to display toast notifications with author information and action buttons.`
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
id: 'custom-hook',
|
|
130
|
-
title: '7. Custom Hook',
|
|
131
|
-
icon: '🎣',
|
|
132
|
-
language: 'tsx',
|
|
133
|
-
content: `import { useContext, useCallback } from 'react';
|
|
134
|
-
import { UnisphereNotificationsContext, NotificationTypes } from '@unisphere/notifications-runtime-react';
|
|
135
|
-
|
|
136
|
-
// Custom hook for common notification patterns
|
|
137
|
-
export const useNotifications = () => {
|
|
138
|
-
const { addNotification } = useContext(UnisphereNotificationsContext);
|
|
139
|
-
|
|
140
|
-
const showSuccess = useCallback((message: string, options?: any) => {
|
|
141
|
-
addNotification({
|
|
142
|
-
type: NotificationTypes.Toast,
|
|
143
|
-
content: { message, title: "Success" },
|
|
144
|
-
author: { name: "System", position: "Success Handler" },
|
|
145
|
-
duration: 3000,
|
|
146
|
-
priority: 'normal',
|
|
147
|
-
...options
|
|
148
|
-
});
|
|
149
|
-
}, [addNotification]);
|
|
150
|
-
|
|
151
|
-
const showError = useCallback((message: string, options?: any) => {
|
|
152
|
-
addNotification({
|
|
153
|
-
type: NotificationTypes.Toast,
|
|
154
|
-
content: { message, title: "Error" },
|
|
155
|
-
author: { name: "System", position: "Error Handler" },
|
|
156
|
-
persistent: true,
|
|
157
|
-
priority: 'urgent',
|
|
158
|
-
...options
|
|
159
|
-
});
|
|
160
|
-
}, [addNotification]);
|
|
161
|
-
|
|
162
|
-
return { showSuccess, showError, addNotification };
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
// Usage in component
|
|
166
|
-
function MyComponent() {
|
|
167
|
-
const { showSuccess, showError } = useNotifications();
|
|
168
|
-
|
|
169
|
-
const handleSave = async () => {
|
|
170
|
-
try {
|
|
171
|
-
await saveData();
|
|
172
|
-
showSuccess("Data saved successfully!");
|
|
173
|
-
} catch (error) {
|
|
174
|
-
showError("Failed to save data. Please try again.");
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
return <button onClick={handleSave}>Save Data</button>;
|
|
179
|
-
}`,
|
|
180
|
-
description: `Create reusable custom hooks for common notification patterns with success, error, and info helpers.`
|
|
181
|
-
}
|
|
182
|
-
];
|
|
183
|
-
|
|
184
|
-
return (
|
|
185
|
-
<>
|
|
186
|
-
<style>{`
|
|
187
|
-
@media (max-width: 768px) {
|
|
188
|
-
.tab-navigation {
|
|
189
|
-
flex-direction: column !important;
|
|
190
|
-
}
|
|
191
|
-
.tab-navigation button {
|
|
192
|
-
flex: none !important;
|
|
193
|
-
border-bottom: 1px solid var(--ifm-color-emphasis-300) !important;
|
|
194
|
-
border-right: none !important;
|
|
195
|
-
}
|
|
196
|
-
.tab-navigation button:last-child {
|
|
197
|
-
border-bottom: none !important;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
`}</style>
|
|
201
|
-
<InteractiveCodePanel
|
|
202
|
-
title="Integrate Notifications Experience - React"
|
|
203
|
-
description="Complete guide for integrating Unisphere notifications into your React application"
|
|
204
|
-
tabs={tabs}
|
|
205
|
-
defaultTab="verify-setup"
|
|
206
|
-
defaultExpanded={false}
|
|
207
|
-
showCopyButton={true}
|
|
208
|
-
/>
|
|
209
|
-
</>
|
|
210
|
-
);
|
|
211
|
-
};
|