codenotch-react 1.0.21 → 1.0.23
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/auml.d.ts +29 -0
- package/dist/auml.d.ts.map +1 -0
- package/dist/auml.js +185 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- package/package.json +4 -1
- package/dist/auml/Auml.d.ts +0 -8
- package/dist/auml/Auml.d.ts.map +0 -1
- package/dist/auml/Auml.js +0 -36
- package/dist/components.d.ts +0 -18
- package/dist/components.d.ts.map +0 -1
- package/dist/components.js +0 -37
package/dist/auml.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SpaRenderStatus } from '@echino/echino.ui.framework/components/SpaBuilder/common/ISpaRenderProps';
|
|
3
|
+
interface IRenderAumlProps {
|
|
4
|
+
auml: string;
|
|
5
|
+
}
|
|
6
|
+
interface IRenderAumlState {
|
|
7
|
+
loaded: boolean;
|
|
8
|
+
inspectorEnabled: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class RenderAuml extends React.Component<IRenderAumlProps, IRenderAumlState> {
|
|
11
|
+
_refreshTokenTimer: NodeJS.Timeout | undefined;
|
|
12
|
+
constructor(props: IRenderAumlProps);
|
|
13
|
+
componentDidMount(): void;
|
|
14
|
+
componentWillUnmount(): void;
|
|
15
|
+
progress(s: SpaRenderStatus): void;
|
|
16
|
+
getLogo(): React.JSX.Element;
|
|
17
|
+
getMode(theme: boolean | undefined): "dark" | "light";
|
|
18
|
+
retrieveInputs(): {
|
|
19
|
+
[k: string]: string;
|
|
20
|
+
};
|
|
21
|
+
getTimeToTokenExpiration(): number | null;
|
|
22
|
+
getTimeToNewTokenExpiration(expirationDateTime: string): number;
|
|
23
|
+
msToTime(ms: number): string;
|
|
24
|
+
parseJwt(token: string): any;
|
|
25
|
+
render(): React.JSX.Element;
|
|
26
|
+
refreshExpiredToken(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=auml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auml.d.ts","sourceRoot":"","sources":["../src/auml.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,0EAA0E,CAAC;AAmB3G,UAAU,gBAAgB;IACtB,IAAI,EAAE,MAAM,CAAC;CAChB;AACD,UAAU,gBAAgB;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,OAAO,CAAC;CAC7B;AAED,qBAAa,UAAW,SAAQ,KAAK,CAAC,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAE/E,kBAAkB,EAAE,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC;gBAEnC,KAAK,EAAE,gBAAgB;IAqBnC,iBAAiB;IAmCjB,oBAAoB;IAQpB,QAAQ,CAAC,CAAC,EAAE,eAAe;IAO3B,OAAO;IAYP,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS;IAclC,cAAc;;;IAMd,wBAAwB,IAAI,MAAM,GAAG,IAAI;IAoCzC,2BAA2B,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM;IAO/D,QAAQ,CAAC,EAAE,EAAE,MAAM;IAmBnB,QAAQ,CAAC,KAAK,EAAE,MAAM;IAUtB,MAAM;IAiDA,mBAAmB;CAqC5B"}
|
package/dist/auml.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RenderAuml = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const SpaRenderWithBrowserRouter_1 = require("@echino/echino.ui.framework/components/SpaBuilder/SpaRender/SpaRenderWithBrowserRouter");
|
|
9
|
+
class RenderAuml extends react_1.default.Component {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
super(props);
|
|
12
|
+
this.state = {
|
|
13
|
+
loaded: false,
|
|
14
|
+
inspectorEnabled: false
|
|
15
|
+
};
|
|
16
|
+
// Add a function that we can call from the browser console, allowing us to debug the page
|
|
17
|
+
//TODO we may not want to do that for prod pages
|
|
18
|
+
//@ts-ignore
|
|
19
|
+
window.toggleInspector = () => {
|
|
20
|
+
this.setState({
|
|
21
|
+
inspectorEnabled: !this.state.inspectorEnabled
|
|
22
|
+
}, () => console.log(`Auml inspector is now ${this.state.inspectorEnabled ? 'enabled' : 'disabled'}`));
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
componentDidMount() {
|
|
26
|
+
try {
|
|
27
|
+
// Setup a method to refresh our access token when it expires
|
|
28
|
+
if (this._refreshTokenTimer) {
|
|
29
|
+
clearTimeout(this._refreshTokenTimer);
|
|
30
|
+
}
|
|
31
|
+
if (!user) {
|
|
32
|
+
console.log("No user found, will not refresh the token");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
let timeToExpireMs = this.getTimeToTokenExpiration();
|
|
36
|
+
if (timeToExpireMs === null) {
|
|
37
|
+
console.log("No identity token found, attempting refreshing the token in 5 minutes");
|
|
38
|
+
this._refreshTokenTimer = setTimeout(() => this.refreshExpiredToken(), 5 * 60 * 1000);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (timeToExpireMs <= 0) {
|
|
42
|
+
// Refresh it immediatelty
|
|
43
|
+
this.refreshExpiredToken();
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
this._refreshTokenTimer = setTimeout(() => this.refreshExpiredToken(), timeToExpireMs);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
console.warn("Could not setup token refresh timer: " + err);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
componentWillUnmount() {
|
|
54
|
+
// Cleanup the refresh of the token
|
|
55
|
+
if (this._refreshTokenTimer) {
|
|
56
|
+
clearTimeout(this._refreshTokenTimer);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
progress(s) {
|
|
60
|
+
//console.log('progessStatus ', s);
|
|
61
|
+
if (s === 'completed') {
|
|
62
|
+
this.setState({ loaded: true });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
getLogo() {
|
|
66
|
+
//@ts-ignore
|
|
67
|
+
let tenant = global.tenant;
|
|
68
|
+
if (tenant.logoUrl) {
|
|
69
|
+
return react_1.default.createElement("img", { src: tenant.logoUrl, alt: tenant.displayName });
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return react_1.default.createElement("div", { className: 'app-loading-title' }, tenant.displayName);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
getMode(theme) {
|
|
76
|
+
if (theme !== undefined) {
|
|
77
|
+
return theme ? 'dark' : 'light';
|
|
78
|
+
}
|
|
79
|
+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
80
|
+
return 'dark';
|
|
81
|
+
}
|
|
82
|
+
return 'light';
|
|
83
|
+
}
|
|
84
|
+
// Get input from the query parameters in the url
|
|
85
|
+
retrieveInputs() {
|
|
86
|
+
return Object.fromEntries(new URLSearchParams(window.location.search).entries());
|
|
87
|
+
}
|
|
88
|
+
getTimeToTokenExpiration() {
|
|
89
|
+
// The identity token is the only one we have access here on the client
|
|
90
|
+
// We use it to know when the access token (which we can't read) will expire
|
|
91
|
+
let identityToken = null;
|
|
92
|
+
let identityTokenKey = `${tenant.name}IdToken=`;
|
|
93
|
+
let cookies = document.cookie.split(';');
|
|
94
|
+
for (let c of cookies) {
|
|
95
|
+
if (c.trim().startsWith(identityTokenKey)) {
|
|
96
|
+
identityToken = c.trim().slice(identityTokenKey.length);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (identityToken === null) {
|
|
101
|
+
return null; // token not found
|
|
102
|
+
}
|
|
103
|
+
let identityTokenParsed = this.parseJwt(identityToken);
|
|
104
|
+
let expires = identityTokenParsed.exp; // Timestamp in second since Unix epoch
|
|
105
|
+
let timeToExpiresMs = expires * 1000 - new Date().getTime();
|
|
106
|
+
let timeToExpireStr = this.msToTime(timeToExpiresMs);
|
|
107
|
+
console.log(`Token will expire at ${new Date(expires * 1000).toISOString()} (in ${timeToExpireStr}), setting up a timer to refresh it`);
|
|
108
|
+
// Refresh it a bit before the expiration (5 min)
|
|
109
|
+
timeToExpiresMs -= 5 * 60 * 1000;
|
|
110
|
+
return timeToExpiresMs;
|
|
111
|
+
}
|
|
112
|
+
getTimeToNewTokenExpiration(expirationDateTime) {
|
|
113
|
+
let timeToExpiresMs = new Date(expirationDateTime).getTime() - new Date().getTime();
|
|
114
|
+
// Refresh it a bit before the expiration (5 min)
|
|
115
|
+
timeToExpiresMs -= 5 * 60 * 1000;
|
|
116
|
+
return timeToExpiresMs;
|
|
117
|
+
}
|
|
118
|
+
msToTime(ms) {
|
|
119
|
+
let seconds = Math.floor((ms / 1000) % 60), minutes = Math.floor((ms / (1000 * 60)) % 60), hours = Math.floor((ms / (1000 * 60 * 60)) % 24);
|
|
120
|
+
let timeString = seconds + " seconds";
|
|
121
|
+
if (minutes > 0) {
|
|
122
|
+
timeString = minutes + " minutes " + timeString;
|
|
123
|
+
}
|
|
124
|
+
if (hours > 0) {
|
|
125
|
+
timeString = hours + " hours " + timeString;
|
|
126
|
+
}
|
|
127
|
+
return timeString;
|
|
128
|
+
}
|
|
129
|
+
parseJwt(token) {
|
|
130
|
+
var base64Url = token.split('.')[1];
|
|
131
|
+
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
|
132
|
+
var jsonPayload = decodeURIComponent(window.atob(base64).split('').map(function (c) {
|
|
133
|
+
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
|
134
|
+
}).join(''));
|
|
135
|
+
return JSON.parse(jsonPayload);
|
|
136
|
+
}
|
|
137
|
+
render() {
|
|
138
|
+
//var clusterUrl = this.figureOutClusterUrl();
|
|
139
|
+
let inputs = this.retrieveInputs();
|
|
140
|
+
let theme = undefined;
|
|
141
|
+
if (inputs["_theme"]) {
|
|
142
|
+
theme = inputs["_theme"].toLowerCase() === "dark";
|
|
143
|
+
}
|
|
144
|
+
let aumlManifest = null;
|
|
145
|
+
try {
|
|
146
|
+
let appManifestObj = JSON.parse(appManifest);
|
|
147
|
+
aumlManifest = appManifestObj.auml;
|
|
148
|
+
}
|
|
149
|
+
catch { }
|
|
150
|
+
return (react_1.default.createElement("div", { className: "app" },
|
|
151
|
+
react_1.default.createElement(SpaRenderWithBrowserRouter_1.SpaRenderWithBrowserRouter, { appDescription: this.props.auml, tenant: tenant, serviceName: serviceName, packageVersions: packageVersions, user: user, languages: languages, onProgress: (s) => this.progress(s), input: inputs, theme: theme, manifest: aumlManifest, inspectorEnabled: this.state.inspectorEnabled, children: [] }),
|
|
152
|
+
!this.state.loaded &&
|
|
153
|
+
react_1.default.createElement("div", { className: `app-loading ${this.getMode(theme)}` },
|
|
154
|
+
this.getLogo(),
|
|
155
|
+
react_1.default.createElement("i", { className: "fas fa-circle-notch fa-spin" }))));
|
|
156
|
+
}
|
|
157
|
+
async refreshExpiredToken() {
|
|
158
|
+
console.log("Token will expire soon, requesting a new one...");
|
|
159
|
+
// Using the refresh token we ask for a new access token using /portal/login/refresh
|
|
160
|
+
// If the refresh token has also expired, we will be redirected to the login page
|
|
161
|
+
let redirectUrl = window.location.href; // Where to send us back in case we need to be redirected to the login page
|
|
162
|
+
let url = `${tenant.clusterUrl}/portal/login/refresh?redirectUrl=${encodeURIComponent(redirectUrl)}`;
|
|
163
|
+
let response = await fetch(url); // For this request to work, we need to have a refresh token in the cookies
|
|
164
|
+
if (response.ok) {
|
|
165
|
+
// Setup next refresh
|
|
166
|
+
let timeToExpireMs;
|
|
167
|
+
try {
|
|
168
|
+
let newTokenExpiration = await response.text();
|
|
169
|
+
timeToExpireMs = this.getTimeToNewTokenExpiration(newTokenExpiration);
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
timeToExpireMs = 2 * 60 * 60 * 1000; // refresh in 2 hours
|
|
173
|
+
}
|
|
174
|
+
console.log(`Refresh request ok, next refresh in ${this.msToTime(timeToExpireMs)}`);
|
|
175
|
+
this._refreshTokenTimer = setTimeout(() => this.refreshExpiredToken(), timeToExpireMs);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
let content = await response.text();
|
|
179
|
+
console.error("Could not refresh the token", content);
|
|
180
|
+
console.log("Retrying refreshing the token in 5 minutes...");
|
|
181
|
+
this._refreshTokenTimer = setTimeout(() => this.refreshExpiredToken(), 5 * 60 * 1000);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
exports.RenderAuml = RenderAuml;
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC1B,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACjE,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACrE,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK;QAAE,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;CACjF;AAED,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC;AAE9D,QAAA,MAAM,aAAa,EAAE,aAAkB,CAAC;AAExC;;;GAGG;AACH,wBAAgB,YAAY,IAAI,aAAa,CA8D5C;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,aAAa,CAmBpE;AAGD,OAAO,EAAE,aAAa,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC1B,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACjE,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACrE,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK;QAAE,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;CACjF;AAED,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC;AAE9D,QAAA,MAAM,aAAa,EAAE,aAAkB,CAAC;AAExC;;;GAGG;AACH,wBAAgB,YAAY,IAAI,aAAa,CA8D5C;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,aAAa,CAmBpE;AAGD,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CODENOTCH_ENV = void 0;
|
|
4
4
|
exports.useCodenotch = useCodenotch;
|
|
5
5
|
exports.useCodenotchApp = useCodenotchApp;
|
|
6
6
|
const CODENOTCH_ENV = {};
|
|
@@ -88,6 +88,3 @@ function useCodenotchApp(props) {
|
|
|
88
88
|
}
|
|
89
89
|
return useCodenotch();
|
|
90
90
|
}
|
|
91
|
-
// Export des composants React
|
|
92
|
-
var Auml_1 = require("./auml/Auml");
|
|
93
|
-
Object.defineProperty(exports, "Auml", { enumerable: true, get: function () { return Auml_1.Auml; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codenotch-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "Codenotch SA",
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
"files": [
|
|
14
14
|
"dist/**/*"
|
|
15
15
|
],
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@echino/echino.ui.framework": "1.1.42"
|
|
18
|
+
},
|
|
16
19
|
"devDependencies": {
|
|
17
20
|
"@types/node": "^25.3.2",
|
|
18
21
|
"@types/react": "^16.14.69",
|
package/dist/auml/Auml.d.ts
DELETED
package/dist/auml/Auml.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Auml.d.ts","sourceRoot":"","sources":["../../src/auml/Auml.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,IAAK,SAAQ,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC;IAGjD,MAAM;CAkCT"}
|
package/dist/auml/Auml.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Auml = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const __1 = require("..");
|
|
9
|
-
class Auml extends react_1.default.Component {
|
|
10
|
-
render() {
|
|
11
|
-
let codenotchEnvironment = __1.CODENOTCH_ENV;
|
|
12
|
-
try {
|
|
13
|
-
if (`${this.props.auml ?? ''}`.trim() === '') {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
// Try to load SpaRender only when the component is rendered
|
|
17
|
-
let SpaRender;
|
|
18
|
-
try {
|
|
19
|
-
SpaRender = require('@echino/echino.ui.framework').SpaRender;
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
// Package not available, return an informational message
|
|
23
|
-
return react_1.default.createElement("div", { style: { background: '#343434', color: '#fbb040', fontSize: 12, padding: 20, borderRadius: 5 } }, "Package '@echino/echino.ui.framework' not available");
|
|
24
|
-
}
|
|
25
|
-
return react_1.default.createElement(SpaRender, { appDescription: this.props.auml, languages: codenotchEnvironment.languages ?? [], serviceName: codenotchEnvironment.serviceName ?? 'DEV', tenant: {
|
|
26
|
-
name: codenotchEnvironment.tenantName ?? 'DEV',
|
|
27
|
-
clusterUrl: codenotchEnvironment.clusterUrl ?? undefined,
|
|
28
|
-
displayName: codenotchEnvironment.tenantDisplayName ?? undefined,
|
|
29
|
-
} });
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
return react_1.default.createElement("div", { style: { background: '#343434', color: '#fc8181', fontSize: 12, padding: 20, borderRadius: 5 } }, e?.message ?? 'Unknown error');
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.Auml = Auml;
|
package/dist/components.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ICodenotchEnv } from './index';
|
|
3
|
-
export interface CodenotchProviderProps extends ICodenotchEnv {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Composant Provider React pour Codenotch
|
|
8
|
-
* Configure automatiquement l'environnement Codenotch pour tous les composants enfants
|
|
9
|
-
*/
|
|
10
|
-
export declare const CodenotchProvider: React.FC<CodenotchProviderProps>;
|
|
11
|
-
export interface CodenotchStatusProps {
|
|
12
|
-
className?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Composant d'affichage du statut de connexion Codenotch
|
|
16
|
-
*/
|
|
17
|
-
export declare const CodenotchStatus: React.FC<CodenotchStatusProps>;
|
|
18
|
-
//# sourceMappingURL=components.d.ts.map
|
package/dist/components.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IACzD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAwB9D,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAW1D,CAAC"}
|
package/dist/components.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CodenotchStatus = exports.CodenotchProvider = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
/**
|
|
9
|
-
* Composant Provider React pour Codenotch
|
|
10
|
-
* Configure automatiquement l'environnement Codenotch pour tous les composants enfants
|
|
11
|
-
*/
|
|
12
|
-
const CodenotchProvider = ({ children, clusterUrl, serviceName, tenantName, accessToken, ...props }) => {
|
|
13
|
-
// Configuration de l'environnement Codenotch au montage du composant
|
|
14
|
-
react_1.default.useEffect(() => {
|
|
15
|
-
// Logique d'initialisation automatique de Codenotch
|
|
16
|
-
console.log('Codenotch Provider initialized with:', {
|
|
17
|
-
clusterUrl,
|
|
18
|
-
serviceName,
|
|
19
|
-
tenantName,
|
|
20
|
-
hasAccessToken: !!accessToken
|
|
21
|
-
});
|
|
22
|
-
}, [clusterUrl, serviceName, tenantName, accessToken]);
|
|
23
|
-
return (react_1.default.createElement("div", { className: "codenotch-provider", "data-codenotch-initialized": "true" }, children));
|
|
24
|
-
};
|
|
25
|
-
exports.CodenotchProvider = CodenotchProvider;
|
|
26
|
-
/**
|
|
27
|
-
* Composant d'affichage du statut de connexion Codenotch
|
|
28
|
-
*/
|
|
29
|
-
const CodenotchStatus = ({ className }) => {
|
|
30
|
-
const [status, setStatus] = react_1.default.useState('disconnected');
|
|
31
|
-
return (react_1.default.createElement("div", { className: `codenotch-status codenotch-status--${status} ${className || ''}` },
|
|
32
|
-
react_1.default.createElement("span", { className: "codenotch-status__indicator" }),
|
|
33
|
-
react_1.default.createElement("span", { className: "codenotch-status__text" },
|
|
34
|
-
"Codenotch: ",
|
|
35
|
-
status)));
|
|
36
|
-
};
|
|
37
|
-
exports.CodenotchStatus = CodenotchStatus;
|