@owlmeans/web-client 0.1.18-rc.9 → 0.1.18
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/README.md +247 -43
- package/agent-meta/manifest.json +3 -3
- package/agent-meta/skills/web-client/SKILL.md +62 -73
- package/build/components/dispatcher/component.d.ts.map +1 -1
- package/build/components/dispatcher/component.js +55 -9
- package/build/components/dispatcher/component.js.map +1 -1
- package/build/components/dispatcher/parametrise.d.ts.map +1 -1
- package/build/components/dispatcher/parametrise.js +0 -3
- package/build/components/dispatcher/parametrise.js.map +1 -1
- package/build/components/dispatcher/types.d.ts +2 -2
- package/build/components/dispatcher/types.d.ts.map +1 -1
- package/build/context.d.ts.map +1 -1
- package/build/context.js +0 -1
- package/build/context.js.map +1 -1
- package/build/entrypoints.d.ts +16 -0
- package/build/entrypoints.d.ts.map +1 -0
- package/build/entrypoints.js +20 -0
- package/build/entrypoints.js.map +1 -0
- package/build/exports.d.ts +3 -2
- package/build/exports.d.ts.map +1 -1
- package/build/exports.js +2 -2
- package/build/exports.js.map +1 -1
- package/build/i18n/auth-be.json +32 -0
- package/build/i18n/auth-de.json +32 -0
- package/build/i18n/auth-en.json +32 -0
- package/build/i18n/auth-es.json +32 -0
- package/build/i18n/auth-fr.json +38 -0
- package/build/i18n/auth-pl.json +32 -0
- package/build/i18n/auth-ru.json +32 -0
- package/build/i18n/auth-uk.json +32 -0
- package/build/i18n.js +10 -8
- package/build/i18n.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/login/consts.d.ts +36 -0
- package/build/login/consts.d.ts.map +1 -1
- package/build/login/consts.js +38 -0
- package/build/login/consts.js.map +1 -1
- package/build/login/consts.local.d.ts +22 -0
- package/build/login/consts.local.d.ts.map +1 -0
- package/build/login/consts.local.js +48 -0
- package/build/login/consts.local.js.map +1 -0
- package/build/login/index.d.ts +4 -0
- package/build/login/index.d.ts.map +1 -1
- package/build/login/index.js +3 -0
- package/build/login/index.js.map +1 -1
- package/build/login/pump.d.ts +20 -0
- package/build/login/pump.d.ts.map +1 -0
- package/build/login/pump.js +46 -0
- package/build/login/pump.js.map +1 -0
- package/build/login/redirect.d.ts.map +1 -1
- package/build/login/redirect.js +17 -1
- package/build/login/redirect.js.map +1 -1
- package/build/login/screen.d.ts +19 -0
- package/build/login/screen.d.ts.map +1 -0
- package/build/login/screen.js +119 -0
- package/build/login/screen.js.map +1 -0
- package/build/login/surrogate.d.ts +16 -0
- package/build/login/surrogate.d.ts.map +1 -1
- package/build/login/surrogate.js +139 -71
- package/build/login/surrogate.js.map +1 -1
- package/build/login/types.d.ts +10 -0
- package/build/login/types.d.ts.map +1 -0
- package/build/login/types.js +2 -0
- package/build/login/types.js.map +1 -0
- package/build/login/view.d.ts +4 -0
- package/build/login/view.d.ts.map +1 -0
- package/build/login/view.js +12 -0
- package/build/login/view.js.map +1 -0
- package/build/main.d.ts +9 -1
- package/build/main.d.ts.map +1 -1
- package/build/main.js +18 -5
- package/build/main.js.map +1 -1
- package/build/middleware.d.ts +1 -1
- package/build/middleware.d.ts.map +1 -1
- package/build/middleware.js +7 -6
- package/build/middleware.js.map +1 -1
- package/build/service.js +1 -1
- package/build/service.js.map +1 -1
- package/build/types.local.d.ts +5 -0
- package/build/types.local.d.ts.map +1 -0
- package/build/types.local.js +2 -0
- package/build/types.local.js.map +1 -0
- package/package.json +22 -21
- package/src/components/dispatcher/component.tsx +71 -8
- package/src/components/dispatcher/parametrise.tsx +0 -3
- package/src/components/dispatcher/types.ts +2 -2
- package/src/context.ts +0 -2
- package/src/entrypoints.ts +20 -0
- package/src/exports.ts +7 -2
- package/src/i18n/auth-be.json +32 -0
- package/src/i18n/auth-de.json +32 -0
- package/src/i18n/auth-en.json +32 -0
- package/src/i18n/auth-es.json +32 -0
- package/src/i18n/auth-fr.json +38 -0
- package/src/i18n/auth-pl.json +32 -0
- package/src/i18n/auth-ru.json +32 -0
- package/src/i18n/auth-uk.json +32 -0
- package/src/i18n.ts +10 -8
- package/src/index.ts +1 -1
- package/src/login/consts.local.ts +52 -0
- package/src/login/consts.ts +38 -0
- package/src/login/index.ts +4 -0
- package/src/login/pump.ts +53 -0
- package/src/login/redirect.ts +23 -2
- package/src/login/screen.tsx +141 -0
- package/src/login/surrogate.ts +170 -86
- package/src/login/types.ts +10 -0
- package/src/login/view.tsx +22 -0
- package/src/main.tsx +19 -6
- package/src/middleware.ts +9 -12
- package/src/service.ts +1 -1
- package/src/types.local.ts +5 -0
- package/tests/surrogate.spec.ts +74 -0
- package/tsconfig.json +1 -1
- package/src/modules.ts +0 -9
package/build/login/surrogate.js
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { surrogatePath, LoginIntent, LoginOutcome, LOGIN_LOGOUT_MESSAGE, LOGIN_SURROGATE_HEIGHT, LOGIN_SURROGATE_NAME, LOGIN_SURROGATE_WIDTH, LOGIN_TOKEN_MESSAGE, loginEnvHelper, loginTokenOf } from '@owlmeans/client-auth/login';
|
|
2
2
|
import { SURROGATE_LOGIN, SURROGATE_LOGIN_PRIORITY } from './consts.js';
|
|
3
|
+
import { awaitSurrogate } from './pump.js';
|
|
4
|
+
/**
|
|
5
|
+
* `window.open` features that size and CENTER the surrogate on the screen the browser window
|
|
6
|
+
* currently occupies.
|
|
7
|
+
*
|
|
8
|
+
* Computed fresh per call, never a constant: centering depends on where the browser window sits
|
|
9
|
+
* NOW, which can change between one login attempt and the next. `screenLeft`/`screenTop` and
|
|
10
|
+
* `outerWidth`/`outerHeight` describe the browser's own chrome rather than this document's
|
|
11
|
+
* viewport — and, unlike `innerWidth` or anything reached through `window.top`, they stay readable
|
|
12
|
+
* from a cross-origin iframe. That matters here specifically: a generated app's preview runs
|
|
13
|
+
* framed on a different origin than the manager that embeds it, so `env.embedded` is exactly the
|
|
14
|
+
* case where `window.top.innerWidth` would throw, and reading this document's own `innerWidth`
|
|
15
|
+
* instead would center the popup on the IFRAME's rectangle rather than on the actual window a
|
|
16
|
+
* person sees. Falling back to `window.screen` covers a window that reports no outer geometry at
|
|
17
|
+
* all (a headless test runner).
|
|
18
|
+
*/
|
|
19
|
+
export const centeredPopupFeatures = (width, height) => {
|
|
20
|
+
const screenLeft = window.screenLeft ?? window.screenX ?? 0;
|
|
21
|
+
const screenTop = window.screenTop ?? window.screenY ?? 0;
|
|
22
|
+
const outerWidth = window.outerWidth || window.screen.width;
|
|
23
|
+
const outerHeight = window.outerHeight || window.screen.height;
|
|
24
|
+
const left = Math.round(screenLeft + Math.max(0, (outerWidth - width) / 2));
|
|
25
|
+
const top = Math.round(screenTop + Math.max(0, (outerHeight - height) / 2));
|
|
26
|
+
return `popup=yes,width=${width},height=${height},left=${left},top=${top}`;
|
|
27
|
+
};
|
|
3
28
|
/**
|
|
4
29
|
* Login for a document that cannot complete the flow where it is.
|
|
5
30
|
*
|
|
@@ -18,73 +43,14 @@ import { SURROGATE_LOGIN, SURROGATE_LOGIN_PRIORITY } from './consts.js';
|
|
|
18
43
|
* top-level, so it authorizes by an ordinary redirect and differs only in what it does with the
|
|
19
44
|
* token at the end.
|
|
20
45
|
*/
|
|
21
|
-
export const makeSurrogateLoginPlugin = () =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (env.surrogate) {
|
|
30
|
-
window.location.href = request.url;
|
|
31
|
-
return Promise.resolve(LoginOutcome.Redirected);
|
|
32
|
-
}
|
|
33
|
-
// Opened FIRST and synchronously: `window.open` escapes the popup blocker only while the user
|
|
34
|
-
// gesture is still being handled, so nothing may be awaited before this line. That is why this
|
|
35
|
-
// function is not `async`.
|
|
36
|
-
const surrogate = window.open(request.url, LOGIN_SURROGATE_NAME, LOGIN_SURROGATE_FEATURES);
|
|
37
|
-
if (surrogate == null) {
|
|
38
|
-
return Promise.resolve(LoginOutcome.Failed);
|
|
39
|
-
}
|
|
40
|
-
return new Promise(resolve => {
|
|
41
|
-
let settled = false;
|
|
42
|
-
let watch;
|
|
43
|
-
const finish = (result) => {
|
|
44
|
-
if (settled) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
settled = true;
|
|
48
|
-
window.removeEventListener('message', onMessage);
|
|
49
|
-
if (watch != null) {
|
|
50
|
-
clearInterval(watch);
|
|
51
|
-
}
|
|
52
|
-
resolve(result);
|
|
53
|
-
};
|
|
54
|
-
function onMessage(event) {
|
|
55
|
-
if (event.origin !== window.location.origin) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const data = event.data;
|
|
59
|
-
if (data?.type !== LOGIN_TOKEN_MESSAGE || data.token == null || data.token === '') {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
void adoptToken(ctx, data.token)
|
|
63
|
-
.then(() => finish(LoginOutcome.Handled))
|
|
64
|
-
.catch(() => finish(LoginOutcome.Failed));
|
|
65
|
-
}
|
|
66
|
-
window.addEventListener('message', onMessage);
|
|
67
|
-
// A window the user simply closes announces nothing, so the only way to stop waiting on it
|
|
68
|
-
// is to watch for it going away.
|
|
69
|
-
watch = setInterval(() => {
|
|
70
|
-
if (surrogate.closed) {
|
|
71
|
-
finish(LoginOutcome.Failed);
|
|
72
|
-
}
|
|
73
|
-
}, LOGIN_WATCH_INTERVAL);
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
authorize: async (_ctx, url, env) => {
|
|
77
|
-
// The surrogate is top-level, so it redirects like any ordinary tab.
|
|
78
|
-
if (env.surrogate) {
|
|
79
|
-
window.location.href = url;
|
|
80
|
-
return LoginOutcome.Redirected;
|
|
81
|
-
}
|
|
82
|
-
// Framed, and not yet one window up. A redirect from here would land in the frame and be
|
|
83
|
-
// refused, and the window that would fix it cannot be opened without a user gesture — so the
|
|
84
|
-
// caller is told to render a control rather than to navigate.
|
|
85
|
-
return LoginOutcome.Gesture;
|
|
86
|
-
},
|
|
87
|
-
complete: async (_ctx, token, env) => {
|
|
46
|
+
export const makeSurrogateLoginPlugin = () => {
|
|
47
|
+
/**
|
|
48
|
+
* Give the token to whoever is entitled to it, and get out of the way.
|
|
49
|
+
*
|
|
50
|
+
* Shared by `complete` (a token was just issued here) and `resume` (one was already here),
|
|
51
|
+
* because what happens to it is the same in both cases and only the question differs.
|
|
52
|
+
*/
|
|
53
|
+
const handBack = async (token, env) => {
|
|
88
54
|
if (!env.surrogate) {
|
|
89
55
|
// This document started the flow and finished it in place — it already has what it needs.
|
|
90
56
|
return LoginOutcome.Passed;
|
|
@@ -94,12 +60,114 @@ export const makeSurrogateLoginPlugin = () => ({
|
|
|
94
60
|
// provider severs `window.opener` permanently, so this is not a timing problem to retry.
|
|
95
61
|
return LoginOutcome.Orphaned;
|
|
96
62
|
}
|
|
97
|
-
clearSurrogate();
|
|
63
|
+
loginEnvHelper.clearSurrogate();
|
|
98
64
|
// Both windows are the same origin (the surrogate is this application's own login route), so
|
|
99
65
|
// the origin is pinned rather than passed as `*` — the message carries a bearer token.
|
|
100
66
|
window.opener.postMessage({ type: LOGIN_TOKEN_MESSAGE, token }, window.location.origin);
|
|
101
67
|
window.close();
|
|
102
68
|
return LoginOutcome.Handled;
|
|
103
|
-
}
|
|
104
|
-
|
|
69
|
+
};
|
|
70
|
+
const plugin = {
|
|
71
|
+
alias: SURROGATE_LOGIN,
|
|
72
|
+
priority: SURROGATE_LOGIN_PRIORITY,
|
|
73
|
+
mode: 'surrogate',
|
|
74
|
+
match: env => env.hasWindow && (env.embedded || env.surrogate),
|
|
75
|
+
enter: () => { loginEnvHelper.markSurrogate(); },
|
|
76
|
+
begin: (ctx, request, env) => {
|
|
77
|
+
// Already one window up — nothing to open, just run the flow.
|
|
78
|
+
if (env.surrogate) {
|
|
79
|
+
window.location.href = request.url;
|
|
80
|
+
return Promise.resolve(LoginOutcome.Redirected);
|
|
81
|
+
}
|
|
82
|
+
// Opened FIRST and synchronously: `window.open` escapes the popup blocker only while the
|
|
83
|
+
// user gesture is still being handled, so nothing may be awaited before this line. That is
|
|
84
|
+
// why this function is not `async`.
|
|
85
|
+
//
|
|
86
|
+
// The window opens on the surrogate route rather than on the dispatcher, so its very first
|
|
87
|
+
// paint is a bare "signing you in" panel instead of the application with its navigation. The
|
|
88
|
+
// dispatcher address travels as `next`, because the provider's callback still lands there and
|
|
89
|
+
// whatever flow parameters the caller's URL carried must survive the hop.
|
|
90
|
+
const path = surrogatePath(ctx, {
|
|
91
|
+
intent: LoginIntent.Login, next: request.url,
|
|
92
|
+
});
|
|
93
|
+
const surrogate = window.open(path ?? request.url, LOGIN_SURROGATE_NAME, centeredPopupFeatures(LOGIN_SURROGATE_WIDTH, LOGIN_SURROGATE_HEIGHT));
|
|
94
|
+
if (surrogate == null) {
|
|
95
|
+
// Distinct from `Failed` below: nothing ever opened, so there is nothing left to wait on.
|
|
96
|
+
return Promise.resolve(LoginOutcome.Blocked);
|
|
97
|
+
}
|
|
98
|
+
return awaitSurrogate(surrogate, LOGIN_TOKEN_MESSAGE, async (data) => {
|
|
99
|
+
if (data.token == null || data.token === '') {
|
|
100
|
+
return LoginOutcome.Failed;
|
|
101
|
+
}
|
|
102
|
+
await loginTokenOf(ctx).adoptToken(data.token);
|
|
103
|
+
// Adopting the token is not the end of the flow — running the caller's continuation is,
|
|
104
|
+
// exactly as the redirect plugin does before it reports `Handled`. Without it the token
|
|
105
|
+
// lands in the auth service and nothing else happens: the framed app keeps rendering its
|
|
106
|
+
// signed-out tree, and the user watches the login window close over a preview that never
|
|
107
|
+
// changes. `Handled` promises the caller there is nothing left to do.
|
|
108
|
+
await request.navigate?.();
|
|
109
|
+
return LoginOutcome.Handled;
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
authorize: async (_ctx, url, env) => {
|
|
113
|
+
// The surrogate is top-level, so it redirects like any ordinary tab.
|
|
114
|
+
if (env.surrogate) {
|
|
115
|
+
window.location.href = url;
|
|
116
|
+
return LoginOutcome.Redirected;
|
|
117
|
+
}
|
|
118
|
+
// Framed, and not yet one window up. A redirect from here would land in the frame and be
|
|
119
|
+
// refused, and the window that would fix it cannot be opened without a user gesture — so the
|
|
120
|
+
// caller is told to render a control rather than to navigate.
|
|
121
|
+
return LoginOutcome.Gesture;
|
|
122
|
+
},
|
|
123
|
+
complete: async (_ctx, token, env) => await handBack(token, env),
|
|
124
|
+
// A session that was already here is worth exactly as much as one just issued — to the window
|
|
125
|
+
// that asked for it. Without this the surrogate would render the signed-in application to
|
|
126
|
+
// itself and the framed app would stay signed out, which is the whole reported defect.
|
|
127
|
+
resume: async (_ctx, token, env) => await handBack(token, env),
|
|
128
|
+
logout: (ctx, request, env) => {
|
|
129
|
+
// Already one window up — end the session here and tell the opener.
|
|
130
|
+
if (env.surrogate) {
|
|
131
|
+
return loginTokenOf(ctx).revokeToken()
|
|
132
|
+
.then(async () => await plugin.logoutComplete(ctx, env));
|
|
133
|
+
}
|
|
134
|
+
const path = surrogatePath(ctx, { intent: LoginIntent.Logout });
|
|
135
|
+
// Opened first and synchronously, for the same reason `begin` does.
|
|
136
|
+
const surrogate = path != null
|
|
137
|
+
? window.open(path, LOGIN_SURROGATE_NAME, centeredPopupFeatures(LOGIN_SURROGATE_WIDTH, LOGIN_SURROGATE_HEIGHT))
|
|
138
|
+
: null;
|
|
139
|
+
// The local session goes next, and UNCONDITIONALLY. A blocked window, a severed opener or a
|
|
140
|
+
// user who closes the popup must never leave THIS document signed in: a logout that only
|
|
141
|
+
// half happened is bad, and one that did not happen at all is worse.
|
|
142
|
+
const local = loginTokenOf(ctx).revokeToken();
|
|
143
|
+
if (surrogate == null) {
|
|
144
|
+
// `path == null` is an app whose entrypoint list predates the surrogate route — nothing a
|
|
145
|
+
// retry would do differently. A `window.open` the browser refused is the one case worth
|
|
146
|
+
// telling the user about, so only that one reports `Blocked`.
|
|
147
|
+
const outcome = path != null ? LoginOutcome.Blocked : LoginOutcome.Failed;
|
|
148
|
+
return local.then(async () => {
|
|
149
|
+
await request.navigate?.();
|
|
150
|
+
return outcome;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
return local.then(async () => await awaitSurrogate(surrogate, LOGIN_LOGOUT_MESSAGE, async () => {
|
|
154
|
+
await request.navigate?.();
|
|
155
|
+
return LoginOutcome.Handled;
|
|
156
|
+
}));
|
|
157
|
+
},
|
|
158
|
+
logoutComplete: async (_ctx, env) => {
|
|
159
|
+
if (!env.surrogate) {
|
|
160
|
+
return LoginOutcome.Passed;
|
|
161
|
+
}
|
|
162
|
+
if (!env.hasOpener) {
|
|
163
|
+
return LoginOutcome.Orphaned;
|
|
164
|
+
}
|
|
165
|
+
loginEnvHelper.clearSurrogate();
|
|
166
|
+
window.opener.postMessage({ type: LOGIN_LOGOUT_MESSAGE, ok: true }, window.location.origin);
|
|
167
|
+
window.close();
|
|
168
|
+
return LoginOutcome.Handled;
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
return plugin;
|
|
172
|
+
};
|
|
105
173
|
//# sourceMappingURL=surrogate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surrogate.js","sourceRoot":"","sources":["../../src/login/surrogate.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"surrogate.js","sourceRoot":"","sources":["../../src/login/surrogate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAEpO,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAAa,EAAE,MAAc,EAAU,EAAE;IAC7E,MAAM,UAAU,GAA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AAE;gBAC1C,MAAM,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAA;gBAE1B,OAAO,YAAY,CAAC,OAAO,CAAA;YAC7B,CAAC,CACF,CAAC,CAAA;QACJ,CAAC;QAED,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;YAClC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;gBACnB,OAAO,YAAY,CAAC,MAAM,CAAA;YAC5B,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;gBACnB,OAAO,YAAY,CAAC,QAAQ,CAAA;YAC9B,CAAC;YACD,cAAc,CAAC,cAAc,EAAE,CAAA;YAC/B,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;YAC3F,MAAM,CAAC,KAAK,EAAE,CAAA;YAEd,OAAO,YAAY,CAAC,OAAO,CAAA;QAC7B,CAAC;KACF,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LoginIntent } from '@owlmeans/client-auth/login';
|
|
2
|
+
import { SurrogateStage } from './consts.js';
|
|
3
|
+
export interface SurrogateViewProps {
|
|
4
|
+
stage: SurrogateStage;
|
|
5
|
+
intent: LoginIntent;
|
|
6
|
+
onAction?: () => void;
|
|
7
|
+
error?: string;
|
|
8
|
+
translate?: (key: string, defaultValue: string) => string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/login/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,cAAc,CAAA;IACrB,MAAM,EAAE,WAAW,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,MAAM,CAAA;CAC1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/login/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/login/view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAG/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,kBAAkB,CAgBrD,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LoginIntent } from '@owlmeans/client-auth/login';
|
|
3
|
+
import { action, box, COPY, LOGOUT_COPY } from './consts.local.js';
|
|
4
|
+
export const LoginSurrogateView = ({ stage, intent, onAction, error, translate }) => {
|
|
5
|
+
const t = translate ?? ((_key, defaultValue) => defaultValue);
|
|
6
|
+
const scope = intent === LoginIntent.Logout ? 'logout' : 'login';
|
|
7
|
+
const base = COPY[stage];
|
|
8
|
+
const copy = (intent === LoginIntent.Logout ? LOGOUT_COPY[stage] : undefined) ?? base;
|
|
9
|
+
return _jsxs("div", { style: box, "data-surrogate-stage": stage, "data-surrogate-intent": intent, children: [_jsx("p", { children: t(`surrogate.${scope}.${copy.key}`, copy.en) }), error != null && error !== '' &&
|
|
10
|
+
_jsx("p", { style: { color: '#b00', fontSize: '.875rem' }, role: "alert", children: error }), base.action != null && onAction != null && _jsx("button", { type: "button", style: action, onClick: onAction, children: t(`surrogate.${scope}.${base.action[0]}`, base.action[1]) })] });
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/login/view.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAGlE,MAAM,CAAC,MAAM,kBAAkB,GAA2B,CACxD,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,EAC7C,EAAE;IACF,MAAM,CAAC,GAAG,SAAS,IAAI,CAAC,CAAC,IAAY,EAAE,YAAoB,EAAE,EAAE,CAAC,YAAY,CAAC,CAAA;IAC7E,MAAM,KAAK,GAAG,MAAM,KAAK,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAA;IAChE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;IACxB,MAAM,IAAI,GAAG,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,IAAI,CAAA;IAErF,OAAO,eAAK,KAAK,EAAE,GAAG,0BAAwB,KAAK,2BAAyB,MAAM,aAChF,sBAAI,CAAC,CAAC,aAAa,KAAK,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,GAAK,EACpD,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE;gBAC5B,YAAG,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,IAAI,EAAC,OAAO,YAAE,KAAK,GAAK,EAC3E,IAAI,CAAC,MAAM,IAAI,IAAI,IAAI,QAAQ,IAAI,IAAI,IAAI,iBAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,YAC/F,CAAC,CAAC,aAAa,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GACnD,IACL,CAAA;AACR,CAAC,CAAA"}
|
package/build/main.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { AppConfig, AppContext, RenderOptions } from './types.js';
|
|
3
3
|
export declare const render: (node: ReactNode, opts?: RenderOptions) => void;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Mount the application.
|
|
6
|
+
*
|
|
7
|
+
* `children` are rendered inside the context provider and BEFORE the router, which makes them the
|
|
8
|
+
* app's global overlay slot: a consent dialog, a toast surface, anything that must exist on every
|
|
9
|
+
* route and outlive navigation. A component mounted inside a route instead is torn down and
|
|
10
|
+
* rebuilt on every navigation, which for a dialog means it closes itself.
|
|
11
|
+
*/
|
|
12
|
+
export declare const renderApp: <C extends AppConfig, T extends AppContext<C>>(context: T, opts?: RenderOptions, children?: ReactNode) => void;
|
|
5
13
|
//# sourceMappingURL=main.d.ts.map
|
package/build/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAGtE,eAAO,MAAM,MAAM,SAAU,SAAS,SAAS,aAAa,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAGtE,eAAO,MAAM,MAAM,SAAU,SAAS,SAAS,aAAa,SAsB3D,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,WAC3D,CAAC,SAAS,aAAa,aAAa,SAAS,SACQ,CAAA"}
|
package/build/main.js
CHANGED
|
@@ -6,9 +6,6 @@ export const render = (node, opts) => {
|
|
|
6
6
|
const _callback = () => {
|
|
7
7
|
const key = opts?.domId ?? DEFAULT_ROOT;
|
|
8
8
|
const root = document.getElementById(key);
|
|
9
|
-
if (opts?.debug) {
|
|
10
|
-
console.debug(`Render react app to ${key}`);
|
|
11
|
-
}
|
|
12
9
|
if (root == null) {
|
|
13
10
|
throw new Error(`Root element not found with id: ${key}`);
|
|
14
11
|
}
|
|
@@ -19,7 +16,23 @@ export const render = (node, opts) => {
|
|
|
19
16
|
createRoot(root).render(node);
|
|
20
17
|
}
|
|
21
18
|
};
|
|
22
|
-
|
|
19
|
+
// Wait for the DOM only while it is still loading: a caller that awaits something first
|
|
20
|
+
// (`await prepareI18n(cfg); render(...)`) can run after `DOMContentLoaded` has already fired,
|
|
21
|
+
// and a listener added then never runs — the app would never mount.
|
|
22
|
+
if ((opts?.onReady ?? true) && document.readyState === 'loading') {
|
|
23
|
+
window.addEventListener('DOMContentLoaded', _callback, { once: true });
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
_callback();
|
|
27
|
+
}
|
|
23
28
|
};
|
|
24
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Mount the application.
|
|
31
|
+
*
|
|
32
|
+
* `children` are rendered inside the context provider and BEFORE the router, which makes them the
|
|
33
|
+
* app's global overlay slot: a consent dialog, a toast surface, anything that must exist on every
|
|
34
|
+
* route and outlive navigation. A component mounted inside a route instead is torn down and
|
|
35
|
+
* rebuilt on every navigation, which for a dialog means it closes itself.
|
|
36
|
+
*/
|
|
37
|
+
export const renderApp = (context, opts, children) => render(_jsx(WebApp, { context: context, children: children }), opts);
|
|
25
38
|
//# sourceMappingURL=main.js.map
|
package/build/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAE9C,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAe,EAAE,IAAoB,EAAE,EAAE;IAC9D,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,MAAM,GAAG,GAAG,IAAI,EAAE,KAAK,IAAI,YAAY,CAAA;QACvC,MAAM,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAA;QACzC,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAE9C,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAe,EAAE,IAAoB,EAAE,EAAE;IAC9D,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,MAAM,GAAG,GAAG,IAAI,EAAE,KAAK,IAAI,YAAY,CAAA;QACvC,MAAM,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAA;QACzC,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,EAAE,CAAC,CAAA;QAC3D,CAAC;QACD,IAAI,IAAI,EAAE,OAAO,KAAK,IAAI,EAAE,CAAC;YAC3B,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QACzB,CAAC;aAAM,CAAC;YACN,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAC/B,CAAC;IACH,CAAC,CAAA;IAED,wFAAwF;IACxF,8FAA8F;IAC9F,oEAAoE;IACpE,IAAI,CAAC,IAAI,EAAE,OAAO,IAAI,IAAI,CAAC,IAAI,QAAQ,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACjE,MAAM,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;IACxE,CAAC;SAAM,CAAC;QACN,SAAS,EAAE,CAAA;IACb,CAAC;AACH,CAAC,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,OAAU,EAAE,IAAoB,EAAE,QAAoB,EACtD,EAAE,CAAC,MAAM,CAAC,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,YAAG,QAAQ,GAAU,EAAE,IAAI,CAAC,CAAA"}
|
package/build/middleware.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAA4C,MAAM,mBAAmB,CAAA;AAO7F,eAAO,MAAM,gBAAgB,EAAE,UAuC9B,CAAA"}
|
package/build/middleware.js
CHANGED
|
@@ -7,18 +7,19 @@ export const logoutMiddleware = {
|
|
|
7
7
|
stage: MiddlewareStage.Loading,
|
|
8
8
|
apply: async (context) => {
|
|
9
9
|
context.entrypoints().forEach(module => {
|
|
10
|
-
if (module.route.route.type === AppType.Backend && module.
|
|
10
|
+
if (module.route.route.type === AppType.Backend && module.invoke != null) {
|
|
11
11
|
const guards = module.getGuards();
|
|
12
12
|
if (guards.length > 0) {
|
|
13
13
|
if (module._auth_web_middleware_applied === true) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
module._auth_web_middleware_applied = true;
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
// Wrapping `invoke` covers `call` too: `call` reads `invoke` off the entrypoint at the
|
|
18
|
+
// moment it runs, so a rejected session is caught whichever verb the caller used.
|
|
19
|
+
const invoke = module.invoke;
|
|
20
|
+
module.invoke = (async (req) => {
|
|
20
21
|
try {
|
|
21
|
-
return await
|
|
22
|
+
return await invoke(req);
|
|
22
23
|
}
|
|
23
24
|
catch (e) {
|
|
24
25
|
if (e instanceof Error) {
|
|
@@ -35,7 +36,7 @@ export const logoutMiddleware = {
|
|
|
35
36
|
}
|
|
36
37
|
throw e;
|
|
37
38
|
}
|
|
38
|
-
};
|
|
39
|
+
});
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
});
|
package/build/middleware.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,cAAc,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,aAAa,EAA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xD,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;4CAC5B,MAAM,GAAG,CAAA;wCACX,CAAC;oCACH,CAAC;gCACH,CAAC;4BACH,CAAC;4BACD,MAAM,CAAC,CAAA;wBACT,CAAC;oBACH,CAAC,CAAyB,CAAA;gBAE5B,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
package/build/service.js
CHANGED
|
@@ -9,7 +9,7 @@ export const makeAuthWebService = (alias = DEFAULT_ALIAS) => {
|
|
|
9
9
|
await update(token);
|
|
10
10
|
if (token == null) {
|
|
11
11
|
const module = service.assertCtx().entrypoint(DISPATCHER);
|
|
12
|
-
const
|
|
12
|
+
const url = await module.url();
|
|
13
13
|
document.location.href = url;
|
|
14
14
|
}
|
|
15
15
|
};
|
package/build/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAK,GAAW,aAAa,EAAe,EAAE;IAC/E,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IAEtC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;IAC7B,OAAO,CAAC,MAAM,GAAG,KAAK,EAAC,KAAK,EAAC,EAAE;QAC7B,MAAM,MAAM,CAAC,KAAK,CAAC,CAAA;QACnB,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,UAAU,CA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CAAC,gBAAgB,CAAC,CAAA;IAE5C,OAAO,CAAC,IAAI,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAE/C,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.local.d.ts","sourceRoot":"","sources":["../src/types.local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAEnE,MAAM,WAAW,MAAO,SAAQ,gBAAgB,CAAC,OAAO,CAAC;IACvD,4BAA4B,CAAC,EAAE,OAAO,CAAA;CACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.local.js","sourceRoot":"","sources":["../src/types.local.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/web-client",
|
|
3
|
-
"version": "0.1.18
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -21,32 +21,33 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@owlmeans/auth": "^0.1.18
|
|
25
|
-
"@owlmeans/auth-common": "^0.1.18
|
|
26
|
-
"@owlmeans/client": "^0.1.18
|
|
27
|
-
"@owlmeans/client-auth": "^0.1.18
|
|
28
|
-
"@owlmeans/client-context": "^0.1.18
|
|
29
|
-
"@owlmeans/client-i18n": "^0.1.18
|
|
30
|
-
"@owlmeans/client-entrypoint": "^0.1.18
|
|
31
|
-
"@owlmeans/client-resource": "^0.1.18
|
|
32
|
-
"@owlmeans/client-route": "^0.1.18
|
|
33
|
-
"@owlmeans/config": "^0.1.18
|
|
34
|
-
"@owlmeans/context": "^0.1.18
|
|
35
|
-
"@owlmeans/error": "^0.1.18
|
|
36
|
-
"@owlmeans/i18n": "^0.1.18
|
|
37
|
-
"@owlmeans/
|
|
38
|
-
"@owlmeans/
|
|
39
|
-
"@owlmeans/web-
|
|
40
|
-
"
|
|
24
|
+
"@owlmeans/auth": "^0.1.18",
|
|
25
|
+
"@owlmeans/auth-common": "^0.1.18",
|
|
26
|
+
"@owlmeans/client": "^0.1.18",
|
|
27
|
+
"@owlmeans/client-auth": "^0.1.18",
|
|
28
|
+
"@owlmeans/client-context": "^0.1.18",
|
|
29
|
+
"@owlmeans/client-i18n": "^0.1.18",
|
|
30
|
+
"@owlmeans/client-entrypoint": "^0.1.18",
|
|
31
|
+
"@owlmeans/client-resource": "^0.1.18",
|
|
32
|
+
"@owlmeans/client-route": "^0.1.18",
|
|
33
|
+
"@owlmeans/config": "^0.1.18",
|
|
34
|
+
"@owlmeans/context": "^0.1.18",
|
|
35
|
+
"@owlmeans/error": "^0.1.18",
|
|
36
|
+
"@owlmeans/i18n": "^0.1.18",
|
|
37
|
+
"@owlmeans/log": "^0.1.18",
|
|
38
|
+
"@owlmeans/route": "^0.1.18",
|
|
39
|
+
"@owlmeans/web-db": "^0.1.18",
|
|
40
|
+
"@owlmeans/web-router": "^0.1.18",
|
|
41
|
+
"react-dropzone": "^20.1.2"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
44
|
"react": "*",
|
|
44
45
|
"react-dom": "*"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@owlmeans/dep-config": "
|
|
48
|
-
"@types/react": "^19.
|
|
49
|
-
"@types/react-dom": "^19.
|
|
48
|
+
"@owlmeans/dep-config": "^0.1.18",
|
|
49
|
+
"@types/react": "^19.3.0",
|
|
50
|
+
"@types/react-dom": "^19.3.0",
|
|
50
51
|
"nodemon": "^3.1.14",
|
|
51
52
|
"typescript": "^7.0.2"
|
|
52
53
|
},
|