@nsxbet/admin-sdk 0.1.0

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.
Files changed (159) hide show
  1. package/README.md +680 -0
  2. package/dist/auth/client/in-memory.d.ts +27 -0
  3. package/dist/auth/client/in-memory.d.ts.map +1 -0
  4. package/dist/auth/client/in-memory.js +242 -0
  5. package/dist/auth/client/index.d.ts +7 -0
  6. package/dist/auth/client/index.d.ts.map +1 -0
  7. package/dist/auth/client/index.js +7 -0
  8. package/dist/auth/client/interface.d.ts +115 -0
  9. package/dist/auth/client/interface.d.ts.map +1 -0
  10. package/dist/auth/client/interface.js +7 -0
  11. package/dist/auth/client/keycloak.d.ts +19 -0
  12. package/dist/auth/client/keycloak.d.ts.map +1 -0
  13. package/dist/auth/client/keycloak.js +126 -0
  14. package/dist/auth/components/UserSelector.d.ts +19 -0
  15. package/dist/auth/components/UserSelector.d.ts.map +1 -0
  16. package/dist/auth/components/UserSelector.js +100 -0
  17. package/dist/auth/components/index.d.ts +5 -0
  18. package/dist/auth/components/index.d.ts.map +1 -0
  19. package/dist/auth/components/index.js +4 -0
  20. package/dist/auth/index.d.ts +7 -0
  21. package/dist/auth/index.d.ts.map +1 -0
  22. package/dist/auth/index.js +7 -0
  23. package/dist/components/AuthProvider.d.ts +48 -0
  24. package/dist/components/AuthProvider.d.ts.map +1 -0
  25. package/dist/components/AuthProvider.js +117 -0
  26. package/dist/hooks/useAuth.d.ts +21 -0
  27. package/dist/hooks/useAuth.d.ts.map +1 -0
  28. package/dist/hooks/useAuth.js +34 -0
  29. package/dist/hooks/useFetch.d.ts +8 -0
  30. package/dist/hooks/useFetch.d.ts.map +1 -0
  31. package/dist/hooks/useFetch.js +31 -0
  32. package/dist/hooks/useI18n.d.ts +46 -0
  33. package/dist/hooks/useI18n.d.ts.map +1 -0
  34. package/dist/hooks/useI18n.js +95 -0
  35. package/dist/hooks/usePlatformAPI.d.ts +12 -0
  36. package/dist/hooks/usePlatformAPI.d.ts.map +1 -0
  37. package/dist/hooks/usePlatformAPI.js +10 -0
  38. package/dist/hooks/useTelemetry.d.ts +17 -0
  39. package/dist/hooks/useTelemetry.d.ts.map +1 -0
  40. package/dist/hooks/useTelemetry.js +36 -0
  41. package/dist/i18n/config.d.ts +26 -0
  42. package/dist/i18n/config.d.ts.map +1 -0
  43. package/dist/i18n/config.js +92 -0
  44. package/dist/i18n/index.d.ts +6 -0
  45. package/dist/i18n/index.d.ts.map +1 -0
  46. package/dist/i18n/index.js +4 -0
  47. package/dist/i18n/locales/en-US.json +144 -0
  48. package/dist/i18n/locales/es.json +144 -0
  49. package/dist/i18n/locales/pt-BR.json +144 -0
  50. package/dist/i18n/locales/ro.json +144 -0
  51. package/dist/index.d.ts +27 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +30 -0
  54. package/dist/registry/AdminShellRegistry.d.ts +140 -0
  55. package/dist/registry/AdminShellRegistry.d.ts.map +1 -0
  56. package/dist/registry/AdminShellRegistry.js +237 -0
  57. package/dist/registry/client/http.d.ts +21 -0
  58. package/dist/registry/client/http.d.ts.map +1 -0
  59. package/dist/registry/client/http.js +107 -0
  60. package/dist/registry/client/in-memory.d.ts +36 -0
  61. package/dist/registry/client/in-memory.d.ts.map +1 -0
  62. package/dist/registry/client/in-memory.js +242 -0
  63. package/dist/registry/client/index.d.ts +7 -0
  64. package/dist/registry/client/index.d.ts.map +1 -0
  65. package/dist/registry/client/index.js +5 -0
  66. package/dist/registry/client/interface.d.ts +96 -0
  67. package/dist/registry/client/interface.d.ts.map +1 -0
  68. package/dist/registry/client/interface.js +7 -0
  69. package/dist/registry/index.d.ts +12 -0
  70. package/dist/registry/index.d.ts.map +1 -0
  71. package/dist/registry/index.js +8 -0
  72. package/dist/registry/types/index.d.ts +9 -0
  73. package/dist/registry/types/index.d.ts.map +1 -0
  74. package/dist/registry/types/index.js +6 -0
  75. package/dist/registry/types/manifest.d.ts +98 -0
  76. package/dist/registry/types/manifest.d.ts.map +1 -0
  77. package/dist/registry/types/manifest.js +81 -0
  78. package/dist/registry/types/module.d.ts +115 -0
  79. package/dist/registry/types/module.d.ts.map +1 -0
  80. package/dist/registry/types/module.js +6 -0
  81. package/dist/router/DynamicModule.d.ts +50 -0
  82. package/dist/router/DynamicModule.d.ts.map +1 -0
  83. package/dist/router/DynamicModule.js +141 -0
  84. package/dist/router/index.d.ts +2 -0
  85. package/dist/router/index.d.ts.map +1 -0
  86. package/dist/router/index.js +1 -0
  87. package/dist/shell/AdminShell.d.ts +38 -0
  88. package/dist/shell/AdminShell.d.ts.map +1 -0
  89. package/dist/shell/AdminShell.js +299 -0
  90. package/dist/shell/BackofficeShell.d.ts +38 -0
  91. package/dist/shell/BackofficeShell.d.ts.map +1 -0
  92. package/dist/shell/BackofficeShell.js +299 -0
  93. package/dist/shell/components/CommandPalette.d.ts +8 -0
  94. package/dist/shell/components/CommandPalette.d.ts.map +1 -0
  95. package/dist/shell/components/CommandPalette.js +197 -0
  96. package/dist/shell/components/HomePage.d.ts +2 -0
  97. package/dist/shell/components/HomePage.d.ts.map +1 -0
  98. package/dist/shell/components/HomePage.js +32 -0
  99. package/dist/shell/components/LeftNav.d.ts +7 -0
  100. package/dist/shell/components/LeftNav.d.ts.map +1 -0
  101. package/dist/shell/components/LeftNav.js +247 -0
  102. package/dist/shell/components/MainContent.d.ts +9 -0
  103. package/dist/shell/components/MainContent.d.ts.map +1 -0
  104. package/dist/shell/components/MainContent.js +88 -0
  105. package/dist/shell/components/ModuleOverview.d.ts +7 -0
  106. package/dist/shell/components/ModuleOverview.d.ts.map +1 -0
  107. package/dist/shell/components/ModuleOverview.js +40 -0
  108. package/dist/shell/components/ProfilePage.d.ts +2 -0
  109. package/dist/shell/components/ProfilePage.d.ts.map +1 -0
  110. package/dist/shell/components/ProfilePage.js +30 -0
  111. package/dist/shell/components/RegistryPage.d.ts +8 -0
  112. package/dist/shell/components/RegistryPage.d.ts.map +1 -0
  113. package/dist/shell/components/RegistryPage.js +129 -0
  114. package/dist/shell/components/SettingsPage.d.ts +2 -0
  115. package/dist/shell/components/SettingsPage.d.ts.map +1 -0
  116. package/dist/shell/components/SettingsPage.js +60 -0
  117. package/dist/shell/components/TopBar.d.ts +8 -0
  118. package/dist/shell/components/TopBar.d.ts.map +1 -0
  119. package/dist/shell/components/TopBar.js +61 -0
  120. package/dist/shell/components/index.d.ts +10 -0
  121. package/dist/shell/components/index.d.ts.map +1 -0
  122. package/dist/shell/components/index.js +7 -0
  123. package/dist/shell/components/theme-provider.d.ts +15 -0
  124. package/dist/shell/components/theme-provider.d.ts.map +1 -0
  125. package/dist/shell/components/theme-provider.js +39 -0
  126. package/dist/shell/index.d.ts +9 -0
  127. package/dist/shell/index.d.ts.map +1 -0
  128. package/dist/shell/index.js +8 -0
  129. package/dist/shell/search/fuzzy.d.ts +18 -0
  130. package/dist/shell/search/fuzzy.d.ts.map +1 -0
  131. package/dist/shell/search/fuzzy.js +121 -0
  132. package/dist/shell/search/index.d.ts +3 -0
  133. package/dist/shell/search/index.d.ts.map +1 -0
  134. package/dist/shell/search/index.js +1 -0
  135. package/dist/shell/telemetry.d.ts +7 -0
  136. package/dist/shell/telemetry.d.ts.map +1 -0
  137. package/dist/shell/telemetry.js +25 -0
  138. package/dist/shell/types.d.ts +110 -0
  139. package/dist/shell/types.d.ts.map +1 -0
  140. package/dist/shell/types.js +4 -0
  141. package/dist/tailwind/index.d.ts +20 -0
  142. package/dist/tailwind/index.d.ts.map +1 -0
  143. package/dist/tailwind/index.js +42 -0
  144. package/dist/types/keycloak.d.ts +26 -0
  145. package/dist/types/keycloak.d.ts.map +1 -0
  146. package/dist/types/keycloak.js +1 -0
  147. package/dist/types/platform.d.ts +83 -0
  148. package/dist/types/platform.d.ts.map +1 -0
  149. package/dist/types/platform.js +5 -0
  150. package/dist/vite/config.d.ts +71 -0
  151. package/dist/vite/config.d.ts.map +1 -0
  152. package/dist/vite/config.js +87 -0
  153. package/dist/vite/index.d.ts +18 -0
  154. package/dist/vite/index.d.ts.map +1 -0
  155. package/dist/vite/index.js +17 -0
  156. package/dist/vite/plugins.d.ts +44 -0
  157. package/dist/vite/plugins.d.ts.map +1 -0
  158. package/dist/vite/plugins.js +74 -0
  159. package/package.json +86 -0
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Vite utilities for building admin modules.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * // vite.config.ts
7
+ * import { defineModuleConfig } from "@nsxbet/admin-sdk/vite";
8
+ *
9
+ * export default defineModuleConfig({
10
+ * port: 3003,
11
+ * });
12
+ * ```
13
+ *
14
+ * @packageDocumentation
15
+ */
16
+ export { generateModuleManifestPlugin, serveDistPlugin, } from "./plugins.js";
17
+ export { defineModuleConfig, SHARED_EXTERNALS, } from "./config.js";
@@ -0,0 +1,44 @@
1
+ import type { Plugin } from "vite";
2
+ export interface GenerateModuleManifestPluginOptions {
3
+ /**
4
+ * Path to the admin.module.json file
5
+ * @default resolve(process.cwd(), "admin.module.json")
6
+ */
7
+ manifestPath?: string;
8
+ }
9
+ /**
10
+ * Vite plugin to generate module.manifest.json after build.
11
+ * Merges admin.module.json metadata with the build entry path.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { generateModuleManifestPlugin } from "@nsxbet/admin-sdk/vite";
16
+ *
17
+ * export default defineConfig({
18
+ * plugins: [generateModuleManifestPlugin()],
19
+ * });
20
+ * ```
21
+ */
22
+ export declare function generateModuleManifestPlugin(options?: GenerateModuleManifestPluginOptions): Plugin;
23
+ export interface ServeDistPluginOptions {
24
+ /**
25
+ * Directory where built files are located
26
+ * @default "dist"
27
+ */
28
+ distDir?: string;
29
+ }
30
+ /**
31
+ * Vite plugin to serve dist files during development.
32
+ * Enables the shell to load the module's built assets while developing.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * import { serveDistPlugin } from "@nsxbet/admin-sdk/vite";
37
+ *
38
+ * export default defineConfig({
39
+ * plugins: [serveDistPlugin()],
40
+ * });
41
+ * ```
42
+ */
43
+ export declare function serveDistPlugin(options?: ServeDistPluginOptions): Plugin;
44
+ //# sourceMappingURL=plugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/vite/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC,MAAM,WAAW,mCAAmC;IAClD;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,GAAE,mCAAwC,GAChD,MAAM,CAsBR;AAED,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,MAAM,CA+B5E"}
@@ -0,0 +1,74 @@
1
+ import { readFileSync, writeFileSync, existsSync } from "fs";
2
+ import { resolve, join } from "path";
3
+ /**
4
+ * Vite plugin to generate module.manifest.json after build.
5
+ * Merges admin.module.json metadata with the build entry path.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { generateModuleManifestPlugin } from "@nsxbet/admin-sdk/vite";
10
+ *
11
+ * export default defineConfig({
12
+ * plugins: [generateModuleManifestPlugin()],
13
+ * });
14
+ * ```
15
+ */
16
+ export function generateModuleManifestPlugin(options = {}) {
17
+ const manifestPath = options.manifestPath || resolve(process.cwd(), "admin.module.json");
18
+ return {
19
+ name: "generate-module-manifest",
20
+ writeBundle(outputOptions, bundle) {
21
+ const spaEntry = Object.keys(bundle).find((name) => name.includes("spa-") && name.endsWith(".js"));
22
+ if (!spaEntry)
23
+ return;
24
+ const metadata = JSON.parse(readFileSync(manifestPath, "utf-8"));
25
+ const manifest = { entry: spaEntry, ...metadata };
26
+ const outDir = outputOptions.dir || "dist";
27
+ const outputPath = join(outDir, "module.manifest.json");
28
+ writeFileSync(outputPath, JSON.stringify(manifest, null, 2));
29
+ console.log(`[generate-module-manifest] Generated ${outputPath} with entry: ${spaEntry}`);
30
+ },
31
+ };
32
+ }
33
+ /**
34
+ * Vite plugin to serve dist files during development.
35
+ * Enables the shell to load the module's built assets while developing.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * import { serveDistPlugin } from "@nsxbet/admin-sdk/vite";
40
+ *
41
+ * export default defineConfig({
42
+ * plugins: [serveDistPlugin()],
43
+ * });
44
+ * ```
45
+ */
46
+ export function serveDistPlugin(options = {}) {
47
+ const distDir = options.distDir || "dist";
48
+ return {
49
+ name: "serve-dist",
50
+ configureServer(server) {
51
+ server.middlewares.use((req, res, next) => {
52
+ if (req.url === "/module.manifest.json") {
53
+ const manifestPath = resolve(process.cwd(), distDir, "module.manifest.json");
54
+ if (existsSync(manifestPath)) {
55
+ res.setHeader("Content-Type", "application/json");
56
+ res.setHeader("Access-Control-Allow-Origin", "*");
57
+ res.end(readFileSync(manifestPath, "utf-8"));
58
+ return;
59
+ }
60
+ }
61
+ if (req.url?.startsWith("/assets/spa-") && req.url?.endsWith(".js")) {
62
+ const filePath = resolve(process.cwd(), distDir, req.url.slice(1));
63
+ if (existsSync(filePath)) {
64
+ res.setHeader("Content-Type", "application/javascript");
65
+ res.setHeader("Access-Control-Allow-Origin", "*");
66
+ res.end(readFileSync(filePath, "utf-8"));
67
+ return;
68
+ }
69
+ }
70
+ next();
71
+ });
72
+ },
73
+ };
74
+ }
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "@nsxbet/admin-sdk",
3
+ "version": "0.1.0",
4
+ "description": "SDK for building NSX Admin modules with integrated shell",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "./vite": {
16
+ "types": "./dist/vite/index.d.ts",
17
+ "import": "./dist/vite/index.js",
18
+ "default": "./dist/vite/index.js"
19
+ },
20
+ "./tailwind": {
21
+ "types": "./dist/tailwind/index.d.ts",
22
+ "import": "./dist/tailwind/index.js",
23
+ "default": "./dist/tailwind/index.js"
24
+ },
25
+ "./package.json": "./package.json"
26
+ },
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "scripts": {
31
+ "build": "tsc",
32
+ "dev": "tsc --watch --preserveWatchOutput",
33
+ "type-check": "tsc --noEmit",
34
+ "test": "vitest run --passWithNoTests"
35
+ },
36
+ "peerDependencies": {
37
+ "@nsxbet/admin-ui": ">=0.1.0",
38
+ "@vitejs/plugin-react": "^4.0.0",
39
+ "i18next": "^23.0.0 || ^24.0.0 || ^25.0.0",
40
+ "react": "^18.2.0",
41
+ "react-dom": "^18.2.0",
42
+ "react-i18next": "^14.0.0 || ^15.0.0 || ^16.0.0",
43
+ "react-router-dom": "^6.0.0",
44
+ "vite": "^5.0.0 || ^6.0.0"
45
+ },
46
+ "peerDependenciesMeta": {
47
+ "@vitejs/plugin-react": {
48
+ "optional": true
49
+ },
50
+ "vite": {
51
+ "optional": true
52
+ }
53
+ },
54
+ "dependencies": {
55
+ "keycloak-js": "^23.0.0",
56
+ "lucide-react": "^0.460.0"
57
+ },
58
+ "devDependencies": {
59
+ "@nsxbet/admin-ui": "workspace:*",
60
+ "@types/react": "^18.2.0",
61
+ "@types/react-dom": "^18.2.0",
62
+ "@vitejs/plugin-react": "^4.3.4",
63
+ "i18next": "^25.7.4",
64
+ "react-i18next": "^16.5.3",
65
+ "react-router-dom": "^6.20.1",
66
+ "typescript": "^5.7.0",
67
+ "vite": "^6.0.0",
68
+ "vitest": "^1.0.0"
69
+ },
70
+ "keywords": [
71
+ "nsxbet",
72
+ "admin",
73
+ "microfrontend",
74
+ "shell"
75
+ ],
76
+ "author": "NSX Platform Team",
77
+ "license": "UNLICENSED",
78
+ "publishConfig": {
79
+ "access": "public"
80
+ },
81
+ "repository": {
82
+ "type": "git",
83
+ "url": "git+https://github.com/NSXBet/admin.git",
84
+ "directory": "packages/admin-sdk"
85
+ }
86
+ }