@viasoftbr/shared-ui 0.0.3 → 0.0.5
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/components/encoder/DvB.d.ts +5 -2
- package/dist/components/encoder/Livecast.d.ts +4 -2
- package/dist/components/index.d.ts +1 -2
- package/dist/components/main/Header.d.ts +1 -0
- package/dist/components.cjs +53280 -0
- package/dist/components.js +845 -2904
- package/dist/context/AuthContext.d.ts +11 -2
- package/dist/context/SharedUiProvider.d.ts +7 -0
- package/dist/context/ThemeContext.d.ts +3 -1
- package/dist/context/index.d.ts +4 -3
- package/dist/context.cjs +3039 -0
- package/dist/context.js +84 -556
- package/dist/hooks.cjs +3109 -0
- package/dist/hooks.js +21 -1384
- package/dist/i18n.cjs +3277 -0
- package/dist/i18n.js +2 -87
- package/dist/index.cjs +53677 -0
- package/dist/index.js +935 -3161
- package/dist/services/index.d.ts +0 -2
- package/dist/services.cjs +3124 -0
- package/dist/services.js +0 -137
- package/dist/types.cjs +34 -0
- package/package.json +19 -9
package/dist/services.js
CHANGED
|
@@ -2907,140 +2907,6 @@ var authService = {
|
|
|
2907
2907
|
}
|
|
2908
2908
|
};
|
|
2909
2909
|
|
|
2910
|
-
// src/services/loadRemoteModule.ts
|
|
2911
|
-
import * as React from "react";
|
|
2912
|
-
import * as ReactDOM from "react-dom";
|
|
2913
|
-
var sharedScopeInitialized = false;
|
|
2914
|
-
function getSharedScope() {
|
|
2915
|
-
if (!globalThis.__federation_shared__) {
|
|
2916
|
-
globalThis.__federation_shared__ = {};
|
|
2917
|
-
}
|
|
2918
|
-
if (!sharedScopeInitialized) {
|
|
2919
|
-
globalThis.__federation_shared__["react"] = {
|
|
2920
|
-
"18.3.1": {
|
|
2921
|
-
get: () => Promise.resolve(() => React),
|
|
2922
|
-
loaded: true,
|
|
2923
|
-
from: "core",
|
|
2924
|
-
scope: "default"
|
|
2925
|
-
}
|
|
2926
|
-
};
|
|
2927
|
-
globalThis.__federation_shared__["react-dom"] = {
|
|
2928
|
-
"18.3.1": {
|
|
2929
|
-
get: () => Promise.resolve(() => ReactDOM),
|
|
2930
|
-
loaded: true,
|
|
2931
|
-
from: "core",
|
|
2932
|
-
scope: "default"
|
|
2933
|
-
}
|
|
2934
|
-
};
|
|
2935
|
-
sharedScopeInitialized = true;
|
|
2936
|
-
}
|
|
2937
|
-
return globalThis.__federation_shared__;
|
|
2938
|
-
}
|
|
2939
|
-
var loadedContainers = /* @__PURE__ */ new Map();
|
|
2940
|
-
var initializedContainers = /* @__PURE__ */ new Set();
|
|
2941
|
-
async function loadContainer(url) {
|
|
2942
|
-
if (loadedContainers.has(url)) {
|
|
2943
|
-
return loadedContainers.get(url);
|
|
2944
|
-
}
|
|
2945
|
-
const loadPromise = (async () => {
|
|
2946
|
-
try {
|
|
2947
|
-
const container = await import(
|
|
2948
|
-
/* @vite-ignore */
|
|
2949
|
-
url
|
|
2950
|
-
);
|
|
2951
|
-
if (container.init && !initializedContainers.has(url)) {
|
|
2952
|
-
await container.init(getSharedScope());
|
|
2953
|
-
initializedContainers.add(url);
|
|
2954
|
-
}
|
|
2955
|
-
return container;
|
|
2956
|
-
} catch (error) {
|
|
2957
|
-
loadedContainers.delete(url);
|
|
2958
|
-
initializedContainers.delete(url);
|
|
2959
|
-
throw error;
|
|
2960
|
-
}
|
|
2961
|
-
})();
|
|
2962
|
-
loadedContainers.set(url, loadPromise);
|
|
2963
|
-
return loadPromise;
|
|
2964
|
-
}
|
|
2965
|
-
async function loadRemoteModule(config) {
|
|
2966
|
-
const container = await loadContainer(config.url);
|
|
2967
|
-
if (!container || typeof container.get !== "function") {
|
|
2968
|
-
throw new Error(`Container inv\xE1lido ou sem m\xE9todo get: ${config.scope}`);
|
|
2969
|
-
}
|
|
2970
|
-
if (typeof container.dynamicLoadingCss === "function") {
|
|
2971
|
-
try {
|
|
2972
|
-
await container.dynamicLoadingCss([]);
|
|
2973
|
-
} catch (err) {
|
|
2974
|
-
console.warn(`Aviso: Falha ao carregar CSS global do remote ${config.scope}`, err);
|
|
2975
|
-
}
|
|
2976
|
-
}
|
|
2977
|
-
const factory2 = await container.get(config.module);
|
|
2978
|
-
const moduleExports = await factory2();
|
|
2979
|
-
if (moduleExports && typeof moduleExports === "object" && "default" in moduleExports) {
|
|
2980
|
-
return moduleExports.default;
|
|
2981
|
-
}
|
|
2982
|
-
return moduleExports;
|
|
2983
|
-
}
|
|
2984
|
-
|
|
2985
|
-
// src/services/metadataLoader.ts
|
|
2986
|
-
var MetadataLoader = class {
|
|
2987
|
-
constructor() {
|
|
2988
|
-
__publicField(this, "metadataCache", /* @__PURE__ */ new Map());
|
|
2989
|
-
}
|
|
2990
|
-
async loadMetadata(metadataUrl) {
|
|
2991
|
-
if (this.metadataCache.has(metadataUrl)) {
|
|
2992
|
-
return this.metadataCache.get(metadataUrl) || [];
|
|
2993
|
-
}
|
|
2994
|
-
try {
|
|
2995
|
-
const response = await fetch(metadataUrl);
|
|
2996
|
-
console.log(response);
|
|
2997
|
-
if (!response.ok) {
|
|
2998
|
-
throw new Error(`Failed to fetch metadata: ${response.statusText}`);
|
|
2999
|
-
}
|
|
3000
|
-
const data = await response.json();
|
|
3001
|
-
let metadata;
|
|
3002
|
-
if (Array.isArray(data)) {
|
|
3003
|
-
metadata = data;
|
|
3004
|
-
} else if (data.pages && Array.isArray(data.pages)) {
|
|
3005
|
-
metadata = data.pages;
|
|
3006
|
-
} else {
|
|
3007
|
-
throw new Error(
|
|
3008
|
-
"Invalid metadata format: expected array or object with pages property"
|
|
3009
|
-
);
|
|
3010
|
-
}
|
|
3011
|
-
metadata.forEach((page, index) => {
|
|
3012
|
-
if (!page.id || !page.name || !page.path || !page.url) {
|
|
3013
|
-
throw new Error(
|
|
3014
|
-
`Invalid page metadata at index ${index}: missing required fields`
|
|
3015
|
-
);
|
|
3016
|
-
}
|
|
3017
|
-
});
|
|
3018
|
-
this.metadataCache.set(metadataUrl, metadata);
|
|
3019
|
-
return metadata;
|
|
3020
|
-
} catch (error) {
|
|
3021
|
-
console.warn(`Failed to load metadata from ${metadataUrl}:`, error);
|
|
3022
|
-
return [];
|
|
3023
|
-
}
|
|
3024
|
-
}
|
|
3025
|
-
async loadFromDirectory(directoryUrl) {
|
|
3026
|
-
try {
|
|
3027
|
-
const manifestUrl = `${directoryUrl}/manifest.json`;
|
|
3028
|
-
return await this.loadMetadata(manifestUrl);
|
|
3029
|
-
} catch (error) {
|
|
3030
|
-
throw new Error(
|
|
3031
|
-
`Directory manifest not found at ${directoryUrl}/manifest.json: ${error}`
|
|
3032
|
-
);
|
|
3033
|
-
}
|
|
3034
|
-
}
|
|
3035
|
-
clearCache() {
|
|
3036
|
-
this.metadataCache.clear();
|
|
3037
|
-
}
|
|
3038
|
-
getCachedMetadata(metadataUrl) {
|
|
3039
|
-
return this.metadataCache.get(metadataUrl);
|
|
3040
|
-
}
|
|
3041
|
-
};
|
|
3042
|
-
var metadataLoader = new MetadataLoader();
|
|
3043
|
-
|
|
3044
2910
|
// src/services/registry.ts
|
|
3045
2911
|
var PluginRegistryImpl = class {
|
|
3046
2912
|
constructor() {
|
|
@@ -3217,7 +3083,6 @@ var discoveryService = {
|
|
|
3217
3083
|
}
|
|
3218
3084
|
};
|
|
3219
3085
|
export {
|
|
3220
|
-
MetadataLoader,
|
|
3221
3086
|
api,
|
|
3222
3087
|
authApi,
|
|
3223
3088
|
authService,
|
|
@@ -3232,8 +3097,6 @@ export {
|
|
|
3232
3097
|
getRefreshToken,
|
|
3233
3098
|
hostConfigLoader,
|
|
3234
3099
|
isFirstRun,
|
|
3235
|
-
loadRemoteModule,
|
|
3236
|
-
metadataLoader,
|
|
3237
3100
|
registry,
|
|
3238
3101
|
saveConfig,
|
|
3239
3102
|
setAccessToken,
|
package/dist/types.cjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/types/index.ts
|
|
21
|
+
var types_exports = {};
|
|
22
|
+
__export(types_exports, {
|
|
23
|
+
Role: () => Role
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(types_exports);
|
|
26
|
+
|
|
27
|
+
// src/types/auth.ts
|
|
28
|
+
var Role = /* @__PURE__ */ ((Role2) => {
|
|
29
|
+
Role2["Admin"] = "admin";
|
|
30
|
+
Role2["Operator"] = "operator";
|
|
31
|
+
Role2["SuperAdmin"] = "superadmin";
|
|
32
|
+
Role2["ReadOnly"] = "readonly";
|
|
33
|
+
return Role2;
|
|
34
|
+
})(Role || {});
|
package/package.json
CHANGED
|
@@ -1,37 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viasoftbr/shared-ui",
|
|
3
|
-
"version": "0.0.3",
|
|
4
3
|
"description": "Shared frontend utilities, components and i18n for Viasoft plugins and micro-frontends",
|
|
5
4
|
"type": "module",
|
|
6
5
|
"main": "dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"version": "0.0.5",
|
|
8
9
|
"exports": {
|
|
9
|
-
|
|
10
|
+
".": {
|
|
10
11
|
"import": "./dist/index.js",
|
|
11
|
-
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
12
14
|
},
|
|
13
15
|
"./index": {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/index.cjs",
|
|
18
|
+
"types": "./dist/index.d.ts"
|
|
16
19
|
},
|
|
17
20
|
"./context": {
|
|
18
21
|
"import": "./dist/context.js",
|
|
22
|
+
"require": "./dist/context.cjs",
|
|
19
23
|
"types": "./dist/context/index.d.ts"
|
|
20
24
|
},
|
|
21
25
|
"./components": {
|
|
22
26
|
"import": "./dist/components.js",
|
|
27
|
+
"require": "./dist/components.cjs",
|
|
23
28
|
"types": "./dist/components/index.d.ts"
|
|
24
29
|
},
|
|
25
30
|
"./services": {
|
|
26
31
|
"import": "./dist/services.js",
|
|
32
|
+
"require": "./dist/services.cjs",
|
|
27
33
|
"types": "./dist/services/index.d.ts"
|
|
28
34
|
},
|
|
29
35
|
"./types": {
|
|
30
36
|
"import": "./dist/types.js",
|
|
37
|
+
"require": "./dist/types.cjs",
|
|
31
38
|
"types": "./dist/types/index.d.ts"
|
|
32
39
|
},
|
|
33
40
|
"./i18n": {
|
|
34
41
|
"import": "./dist/i18n.js",
|
|
42
|
+
"require": "./dist/i18n.cjs",
|
|
35
43
|
"types": "./dist/i18n.d.ts"
|
|
36
44
|
},
|
|
37
45
|
"./jsmpeg": {
|
|
@@ -51,6 +59,7 @@
|
|
|
51
59
|
},
|
|
52
60
|
"devDependencies": {
|
|
53
61
|
"@types/react": "^19.2.13",
|
|
62
|
+
"@tanstack/react-query": "^5.90.10",
|
|
54
63
|
"esbuild": "^0.20.0",
|
|
55
64
|
"typescript": "^5.0.0"
|
|
56
65
|
},
|
|
@@ -58,14 +67,14 @@
|
|
|
58
67
|
"dist"
|
|
59
68
|
],
|
|
60
69
|
"overrides": {
|
|
61
|
-
"use-sync-external-store": "1.6.
|
|
70
|
+
"use-sync-external-store": "1.6.0"
|
|
62
71
|
},
|
|
63
72
|
"resolutions": {
|
|
64
|
-
"use-sync-external-store": "1.6.
|
|
73
|
+
"use-sync-external-store": "1.6.0"
|
|
65
74
|
},
|
|
66
75
|
"pnpm": {
|
|
67
76
|
"overrides": {
|
|
68
|
-
"use-sync-external-store": "1.6.
|
|
77
|
+
"use-sync-external-store": "1.6.0"
|
|
69
78
|
}
|
|
70
79
|
},
|
|
71
80
|
"keywords": [
|
|
@@ -84,7 +93,7 @@
|
|
|
84
93
|
"dependencies": {
|
|
85
94
|
"@headlessui/react": "^2.2.9",
|
|
86
95
|
"@reduxjs/toolkit": "^2.10.1",
|
|
87
|
-
|
|
96
|
+
|
|
88
97
|
"@types/react-dom": "^19.2.3",
|
|
89
98
|
"@viasoftbr/shared-utils": "^0.0.1",
|
|
90
99
|
"axios": "^1.13.2",
|
|
@@ -98,6 +107,7 @@
|
|
|
98
107
|
"react-router-dom": "^6.20.1",
|
|
99
108
|
"react-tooltip": "^5.30.0",
|
|
100
109
|
"redux-batch-middleware": "^0.2.0",
|
|
110
|
+
"use-sync-external-store": "1.6.0",
|
|
101
111
|
"tailwind-scrollbar": "^4.0.2"
|
|
102
112
|
},
|
|
103
113
|
"repository": {
|