@passport.lgbt/react 0.0.0-stage → 1.0.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.
- package/LICENSE +203 -0
- package/NOTICE +5 -0
- package/README.md +47 -2
- package/dist/PassportButton.d.ts +12 -0
- package/dist/PassportButton.js +38 -0
- package/dist/backend.d.ts +9 -0
- package/dist/backend.js +176 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/provider.d.ts +22 -0
- package/dist/provider.js +116 -0
- package/dist/usePassport.d.ts +63 -0
- package/dist/usePassport.js +33 -0
- package/package.json +47 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Copyright 2026 Fondation passport.lgbt
|
|
2
|
+
|
|
3
|
+
Apache License
|
|
4
|
+
Version 2.0, January 2004
|
|
5
|
+
http://www.apache.org/licenses/
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
1. Definitions.
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
12
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
13
|
+
|
|
14
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
15
|
+
the copyright owner that is granting the License.
|
|
16
|
+
|
|
17
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
18
|
+
other entities that control, are controlled by, or are under common
|
|
19
|
+
control with that entity. For the purposes of this definition,
|
|
20
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
21
|
+
direction or management of such entity, whether by contract or
|
|
22
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
23
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
24
|
+
|
|
25
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
26
|
+
exercising permissions granted by this License.
|
|
27
|
+
|
|
28
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
29
|
+
including but not limited to software source code, documentation
|
|
30
|
+
source, and configuration files.
|
|
31
|
+
|
|
32
|
+
"Object" form shall mean any form resulting from mechanical
|
|
33
|
+
transformation or translation of a Source form, including but
|
|
34
|
+
not limited to compiled object code, generated documentation,
|
|
35
|
+
and conversions to other media types.
|
|
36
|
+
|
|
37
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
38
|
+
Object form, made available under the License, as indicated by a
|
|
39
|
+
copyright notice that is included in or attached to the work
|
|
40
|
+
(an example is provided in the Appendix below).
|
|
41
|
+
|
|
42
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
43
|
+
form, that is based on (or derived from) the Work and for which the
|
|
44
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
45
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
46
|
+
of this License, Derivative Works shall not include works that remain
|
|
47
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
48
|
+
the Work and Derivative Works thereof.
|
|
49
|
+
|
|
50
|
+
"Contribution" shall mean any work of authorship, including
|
|
51
|
+
the original version of the Work and any modifications or additions
|
|
52
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
53
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
54
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
55
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
56
|
+
means any form of electronic, verbal, or written communication sent
|
|
57
|
+
to the Licensor or its representatives, including but not limited to
|
|
58
|
+
communication on electronic mailing lists, source code control systems,
|
|
59
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
60
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
61
|
+
excluding communication that is conspicuously marked or otherwise
|
|
62
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
63
|
+
|
|
64
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
65
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
66
|
+
subsequently incorporated within the Work.
|
|
67
|
+
|
|
68
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
69
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
70
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
71
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
72
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
73
|
+
Work and such Derivative Works in Source or Object form.
|
|
74
|
+
|
|
75
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
76
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
77
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
78
|
+
(except as stated in this section) patent license to make, have made,
|
|
79
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
80
|
+
where such license applies only to those patent claims licensable
|
|
81
|
+
by such Contributor that are necessarily infringed by their
|
|
82
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
83
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
84
|
+
institute patent litigation against any entity (including a
|
|
85
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
86
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
87
|
+
or contributory patent infringement, then any patent licenses
|
|
88
|
+
granted to You under this License for that Work shall terminate
|
|
89
|
+
as of the date such litigation is filed.
|
|
90
|
+
|
|
91
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
92
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
93
|
+
modifications, and in Source or Object form, provided that You
|
|
94
|
+
meet the following conditions:
|
|
95
|
+
|
|
96
|
+
(a) You must give any other recipients of the Work or
|
|
97
|
+
Derivative Works a copy of this License; and
|
|
98
|
+
|
|
99
|
+
(b) You must cause any modified files to carry prominent notices
|
|
100
|
+
stating that You changed the files; and
|
|
101
|
+
|
|
102
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
103
|
+
that You distribute, all copyright, patent, trademark, and
|
|
104
|
+
attribution notices from the Source form of the Work,
|
|
105
|
+
excluding those notices that do not pertain to any part of
|
|
106
|
+
the Derivative Works; and
|
|
107
|
+
|
|
108
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
109
|
+
distribution, then any Derivative Works that You distribute must
|
|
110
|
+
include a readable copy of the attribution notices contained
|
|
111
|
+
within such NOTICE file, excluding those notices that do not
|
|
112
|
+
pertain to any part of the Derivative Works, in at least one
|
|
113
|
+
of the following places: within a NOTICE text file distributed
|
|
114
|
+
as part of the Derivative Works; within the Source form or
|
|
115
|
+
documentation, if provided along with the Derivative Works; or,
|
|
116
|
+
within a display generated by the Derivative Works, if and
|
|
117
|
+
wherever such third-party notices normally appear. The contents
|
|
118
|
+
of the NOTICE file are for informational purposes only and
|
|
119
|
+
do not modify the License. You may add Your own attribution
|
|
120
|
+
notices within Derivative Works that You distribute, alongside
|
|
121
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
122
|
+
that such additional attribution notices cannot be construed
|
|
123
|
+
as modifying the License.
|
|
124
|
+
|
|
125
|
+
You may add Your own copyright statement to Your modifications and
|
|
126
|
+
may provide additional or different license terms and conditions
|
|
127
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
128
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
129
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
130
|
+
the conditions stated in this License.
|
|
131
|
+
|
|
132
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
133
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
134
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
135
|
+
this License, without any additional terms or conditions.
|
|
136
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
137
|
+
the terms of any separate license agreement you may have executed
|
|
138
|
+
with Licensor regarding such Contributions.
|
|
139
|
+
|
|
140
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
141
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
142
|
+
except as required for reasonable and customary use in describing the
|
|
143
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
144
|
+
|
|
145
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
146
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
147
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
149
|
+
implied, including, without limitation, any warranties or conditions
|
|
150
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
151
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
152
|
+
appropriateness of using or redistributing the Work and assume any
|
|
153
|
+
risks associated with Your exercise of permissions under this License.
|
|
154
|
+
|
|
155
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
156
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
157
|
+
unless required by applicable law (such as deliberate and grossly
|
|
158
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
159
|
+
liable to You for damages, including any direct, indirect, special,
|
|
160
|
+
incidental, or consequential damages of any character arising as a
|
|
161
|
+
result of this License or out of the use or inability to use the
|
|
162
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
163
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
164
|
+
other commercial damages or losses), even if such Contributor
|
|
165
|
+
has been advised of the possibility of such damages.
|
|
166
|
+
|
|
167
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
168
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
169
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
170
|
+
or other liability obligations and/or rights consistent with this
|
|
171
|
+
License. However, in accepting such obligations, You may act only
|
|
172
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
173
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
174
|
+
defend, and hold each Contributor harmless for any liability
|
|
175
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
176
|
+
of your accepting any such warranty or additional liability.
|
|
177
|
+
|
|
178
|
+
END OF TERMS AND CONDITIONS
|
|
179
|
+
|
|
180
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
181
|
+
|
|
182
|
+
To apply the Apache License to your work, attach the following
|
|
183
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
184
|
+
replaced with your own identifying information. (Don't include
|
|
185
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
186
|
+
comment syntax for the file format. We also recommend that a
|
|
187
|
+
file or class name and description of purpose be included on the
|
|
188
|
+
same "printed page" as the copyright notice for easier
|
|
189
|
+
identification within third-party archives.
|
|
190
|
+
|
|
191
|
+
Copyright [yyyy] [name of copyright owner]
|
|
192
|
+
|
|
193
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
you may not use this file except in compliance with the License.
|
|
195
|
+
You may obtain a copy of the License at
|
|
196
|
+
|
|
197
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
+
|
|
199
|
+
Unless required by applicable law or agreed to in writing, software
|
|
200
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
+
See the License for the specific language governing permissions and
|
|
203
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @passport.lgbt/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[passport.lgbt](https://passport.lgbt) for React 18 and 19: `PassportProvider`, `usePassport()` and `<PassportButton />`.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install @passport.lgbt/react
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { PassportButton, PassportProvider, usePassport } from '@passport.lgbt/react';
|
|
11
|
+
|
|
12
|
+
function Profile() {
|
|
13
|
+
const { status, user, logout } = usePassport();
|
|
14
|
+
if (status === 'loading') return null;
|
|
15
|
+
if (status !== 'authenticated') return <PassportButton />;
|
|
16
|
+
return <button onClick={() => void logout()}>{user?.name}</button>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const App = () => (
|
|
20
|
+
<PassportProvider
|
|
21
|
+
config={{
|
|
22
|
+
issuer: 'https://passport.lgbt',
|
|
23
|
+
clientId: 'my-app',
|
|
24
|
+
redirectUri: 'https://app.example.com/callback',
|
|
25
|
+
scopes: ['name', 'pronouns'],
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<Profile />
|
|
29
|
+
</PassportProvider>
|
|
30
|
+
);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Sign in with a popup
|
|
34
|
+
|
|
35
|
+
`<PassportButton mode="popup" />` opens the sign-in in a window and leaves your page in place (the default, `mode="redirect"`,
|
|
36
|
+
leaves the page). `usePassport().login` takes the same option and the same overloads as `@passport.lgbt/web`:
|
|
37
|
+
`login({ mode: 'popup' })` returns `Promise<PassportState>`, while `login()` returns `Promise<never>` (the page leaves).
|
|
38
|
+
A closed window rejects with `popup_closed`; a blocked window falls back to the full-page flow. In backend mode (server
|
|
39
|
+
session) `mode` is ignored: the sign-in is always a redirect to your server. The requirements on your app headers
|
|
40
|
+
(`Cross-Origin-Opener-Policy`) are listed in the
|
|
41
|
+
[`@passport.lgbt/web` README](https://www.npmjs.com/package/@passport.lgbt/web).
|
|
42
|
+
|
|
43
|
+
- [React guide](https://developer.passport.lgbt/guides/react/)
|
|
44
|
+
- [PassportProvider](https://developer.passport.lgbt/guides/react/provider/)
|
|
45
|
+
- [Browser and backend modes](https://developer.passport.lgbt/guides/react/modes/)
|
|
46
|
+
- [API reference](https://developer.passport.lgbt/reference/react/)
|
|
47
|
+
|
|
48
|
+
License: Apache-2.0.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { Locale } from '@passport.lgbt/web';
|
|
3
|
+
export interface PassportButtonProps {
|
|
4
|
+
variant?: 'discreet' | 'expressive';
|
|
5
|
+
theme?: 'light' | 'dark';
|
|
6
|
+
locale?: Locale;
|
|
7
|
+
returnTo?: string;
|
|
8
|
+
/** `popup` : connexion en fenêtre ; sans effet en mode serveur (redirection BFF). */
|
|
9
|
+
mode?: 'redirect' | 'popup';
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function PassportButton(p: PassportButtonProps): JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
// <PassportButton/> : rend <passport-button> (@passport.lgbt/web/button) et lui donne, par ref, la connexion du
|
|
3
|
+
// Provider (React 18 ne passe ni propriétés ni événements aux éléments personnalisés). Discret par défaut.
|
|
4
|
+
import { createElement, useEffect, useRef } from 'react';
|
|
5
|
+
import { defineSigninButton } from '@passport.lgbt/web/button';
|
|
6
|
+
import { useSource } from './usePassport.js';
|
|
7
|
+
export function PassportButton(p) {
|
|
8
|
+
const source = useSource();
|
|
9
|
+
// idempotent, et sans effet hors navigateur : l'élément est déclaré au premier rendu, pas à l'import du module
|
|
10
|
+
defineSigninButton();
|
|
11
|
+
const ref = useRef(null);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const el = ref.current;
|
|
14
|
+
if (!el)
|
|
15
|
+
return;
|
|
16
|
+
const passport = { login: (o) => source.login(o) };
|
|
17
|
+
el.passport = passport;
|
|
18
|
+
return () => {
|
|
19
|
+
if (el.passport === passport)
|
|
20
|
+
el.passport = undefined;
|
|
21
|
+
};
|
|
22
|
+
}, [source]);
|
|
23
|
+
const attrs = { ref };
|
|
24
|
+
if (p.variant !== undefined)
|
|
25
|
+
attrs.variant = p.variant;
|
|
26
|
+
if (p.theme !== undefined)
|
|
27
|
+
attrs.theme = p.theme;
|
|
28
|
+
if (p.locale !== undefined)
|
|
29
|
+
attrs.locale = p.locale;
|
|
30
|
+
if (p.mode !== undefined)
|
|
31
|
+
attrs.mode = p.mode;
|
|
32
|
+
if (p.returnTo !== undefined)
|
|
33
|
+
attrs['return-to'] = p.returnTo;
|
|
34
|
+
// `class` et non `className` : React 18 recopie les props d'un élément personnalisé en attributs, sous leur nom
|
|
35
|
+
if (p.className !== undefined)
|
|
36
|
+
attrs.class = p.className;
|
|
37
|
+
return createElement('passport-button', attrs);
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Source } from './usePassport.js';
|
|
2
|
+
/** Navigation et envoi de formulaire : remplacés dans les tests (jsdom ne navigue pas). */
|
|
3
|
+
export declare const browser: {
|
|
4
|
+
navigate(url: string): void;
|
|
5
|
+
submit(form: HTMLFormElement): void;
|
|
6
|
+
};
|
|
7
|
+
export declare function createBackendSource(o: {
|
|
8
|
+
basePath: string;
|
|
9
|
+
}): Source;
|
package/dist/backend.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
// Mode serveur (Q4 C) : la session vit sur le serveur de l'appli (@passport.lgbt/node), le navigateur n'a jamais de jeton.
|
|
3
|
+
// État lu sur `GET {basePath}/me` ; connexion par navigation pleine page vers `{basePath}/login` ; déconnexion par
|
|
4
|
+
// formulaire `POST {basePath}/logout` (le serveur contrôle `Origin`). Une session expirée sans refresh token déclenche
|
|
5
|
+
// un renouvellement silencieux (`prompt=none`) sous la garde de boucle : au plus 3 en 2 minutes par onglet.
|
|
6
|
+
import { ACR, PassportError } from '@passport.lgbt/web';
|
|
7
|
+
/** Navigation et envoi de formulaire : remplacés dans les tests (jsdom ne navigue pas). */
|
|
8
|
+
export const browser = {
|
|
9
|
+
navigate(url) {
|
|
10
|
+
window.location.assign(url);
|
|
11
|
+
},
|
|
12
|
+
submit(form) {
|
|
13
|
+
form.submit();
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const SILENT_MAX = 3;
|
|
17
|
+
const SILENT_WINDOW_MS = 120_000;
|
|
18
|
+
/** Chemin absolu de même origine, sans `/` final ni segment `.` ou `..` : `/auth`, `/api/auth`. */
|
|
19
|
+
const BASE_PATH = /^(?:\/(?!\.{1,2}(?:\/|$))[A-Za-z0-9._~-]+)+$/;
|
|
20
|
+
/** `maxAge` admis par le serveur : entier de 0 à 30 jours (secondes). */
|
|
21
|
+
const MAX_AGE_LIMIT_S = 30 * 86_400;
|
|
22
|
+
/** Une demande dont la page part ne se résout jamais. */
|
|
23
|
+
const never = () => new Promise(() => { });
|
|
24
|
+
const str = (v) => typeof v === 'string' && v.length > 0;
|
|
25
|
+
/** Profil rendu par `/me` : champs connus, types vérifiés ; tout le reste est ignoré. Sans `sub` : refusé. */
|
|
26
|
+
function toUser(v) {
|
|
27
|
+
if (typeof v !== 'object' || v === null)
|
|
28
|
+
return undefined;
|
|
29
|
+
const o = v;
|
|
30
|
+
if (!str(o.sub))
|
|
31
|
+
return undefined;
|
|
32
|
+
const amr = Array.isArray(o.amr) ? o.amr.filter((x) => typeof x === 'string') : [];
|
|
33
|
+
const user = { sub: o.sub, amr };
|
|
34
|
+
for (const k of ['name', 'pronouns', 'picture', 'email', 'phoneNumber', 'acr'])
|
|
35
|
+
if (str(o[k]))
|
|
36
|
+
user[k] = o[k];
|
|
37
|
+
for (const k of ['emailVerified', 'phoneNumberVerified'])
|
|
38
|
+
if (typeof o[k] === 'boolean')
|
|
39
|
+
user[k] = o[k];
|
|
40
|
+
if (typeof o.authTime === 'number')
|
|
41
|
+
user.authTime = o.authTime;
|
|
42
|
+
return user;
|
|
43
|
+
}
|
|
44
|
+
const ACR_VALUES = new Set(Object.values(ACR));
|
|
45
|
+
const currentPage = () => `${location.pathname}${location.search}`;
|
|
46
|
+
export function createBackendSource(o) {
|
|
47
|
+
const base = o?.basePath;
|
|
48
|
+
if (typeof base !== 'string' || !BASE_PATH.test(base))
|
|
49
|
+
throw new PassportError('config');
|
|
50
|
+
const silentKey = `pp.backend:${base}.silent`;
|
|
51
|
+
let state = { status: 'loading' };
|
|
52
|
+
const listeners = new Set();
|
|
53
|
+
let started = false;
|
|
54
|
+
const publish = (s) => {
|
|
55
|
+
state = s;
|
|
56
|
+
for (const l of [...listeners])
|
|
57
|
+
l();
|
|
58
|
+
};
|
|
59
|
+
const fail = (code) => publish({ status: 'error', error: new PassportError(code) });
|
|
60
|
+
function recentSilent(now) {
|
|
61
|
+
try {
|
|
62
|
+
const v = JSON.parse(sessionStorage.getItem(silentKey) ?? '[]');
|
|
63
|
+
return Array.isArray(v) ? v.filter((t) => typeof t === 'number' && t > now - SILENT_WINDOW_MS && t <= now) : [];
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function resetSilent() {
|
|
70
|
+
try {
|
|
71
|
+
sessionStorage.removeItem(silentKey);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// stockage indisponible : rien à effacer
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** Session expirée : renouvellement silencieux par le serveur, sauf boucle (alors `login_loop`, plus rien ne part). */
|
|
78
|
+
function silent() {
|
|
79
|
+
const now = Date.now();
|
|
80
|
+
const recent = recentSilent(now);
|
|
81
|
+
if (recent.length >= SILENT_MAX)
|
|
82
|
+
return fail('login_loop');
|
|
83
|
+
try {
|
|
84
|
+
sessionStorage.setItem(silentKey, JSON.stringify([...recent, now]));
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
// sans stockage, pas de compteur : on ne part pas (une boucle ne serait pas arrêtée)
|
|
88
|
+
return fail('login_loop');
|
|
89
|
+
}
|
|
90
|
+
browser.navigate(`${base}/login?prompt=none&returnTo=${encodeURIComponent(currentPage())}`);
|
|
91
|
+
}
|
|
92
|
+
async function readMe() {
|
|
93
|
+
let res;
|
|
94
|
+
try {
|
|
95
|
+
res = await fetch(`${base}/me`, { credentials: 'same-origin', cache: 'no-store', headers: { accept: 'application/json' } });
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return fail('network');
|
|
99
|
+
}
|
|
100
|
+
let body;
|
|
101
|
+
try {
|
|
102
|
+
body = (await res.json());
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
body = undefined;
|
|
106
|
+
}
|
|
107
|
+
if (res.status === 200) {
|
|
108
|
+
const user = toUser(body?.user);
|
|
109
|
+
return user ? publish({ status: 'authenticated', user }) : fail('invalid_response');
|
|
110
|
+
}
|
|
111
|
+
if (res.status === 429)
|
|
112
|
+
return fail('rate_limited');
|
|
113
|
+
if (res.status === 401)
|
|
114
|
+
return body?.error === 'session_expired' ? silent() : publish({ status: 'anonymous' });
|
|
115
|
+
return fail(res.status >= 500 ? 'network' : 'invalid_response');
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
getState: () => state,
|
|
119
|
+
subscribe(listener) {
|
|
120
|
+
listeners.add(listener);
|
|
121
|
+
return () => void listeners.delete(listener);
|
|
122
|
+
},
|
|
123
|
+
start() {
|
|
124
|
+
if (started)
|
|
125
|
+
return;
|
|
126
|
+
started = true;
|
|
127
|
+
void readMe();
|
|
128
|
+
},
|
|
129
|
+
login(lo) {
|
|
130
|
+
// acr et maxAge passent au serveur, qui les exige au retour ; une valeur qu'il refuserait est refusée ici
|
|
131
|
+
const acr = lo?.acrValues ?? [];
|
|
132
|
+
const maxAge = lo?.maxAge;
|
|
133
|
+
if (!acr.every((a) => ACR_VALUES.has(a)))
|
|
134
|
+
return Promise.reject(new PassportError('config'));
|
|
135
|
+
if (maxAge !== undefined && !(Number.isInteger(maxAge) && maxAge >= 0 && maxAge <= MAX_AGE_LIMIT_S)) {
|
|
136
|
+
return Promise.reject(new PassportError('config'));
|
|
137
|
+
}
|
|
138
|
+
resetSilent();
|
|
139
|
+
const q = new URLSearchParams({ returnTo: lo?.returnTo ?? currentPage() });
|
|
140
|
+
for (const a of acr)
|
|
141
|
+
q.append('acr', a);
|
|
142
|
+
if (maxAge !== undefined)
|
|
143
|
+
q.set('maxAge', String(maxAge));
|
|
144
|
+
browser.navigate(`${base}/login?${q.toString()}`);
|
|
145
|
+
return never();
|
|
146
|
+
},
|
|
147
|
+
logout(lo) {
|
|
148
|
+
// le serveur contrôle `returnTo` (chemin de l'appli) et l'applique au retour de l'émetteur
|
|
149
|
+
const form = document.createElement('form');
|
|
150
|
+
form.method = 'post';
|
|
151
|
+
form.action = `${base}/logout`;
|
|
152
|
+
form.hidden = true;
|
|
153
|
+
if (lo?.returnTo !== undefined) {
|
|
154
|
+
const field = document.createElement('input');
|
|
155
|
+
field.type = 'hidden';
|
|
156
|
+
field.name = 'returnTo';
|
|
157
|
+
field.value = lo.returnTo;
|
|
158
|
+
form.append(field);
|
|
159
|
+
}
|
|
160
|
+
document.body.append(form);
|
|
161
|
+
try {
|
|
162
|
+
browser.submit(form);
|
|
163
|
+
}
|
|
164
|
+
finally {
|
|
165
|
+
// navigation annulée (beforeunload) ou second clic : aucun formulaire ne reste dans la page
|
|
166
|
+
form.remove();
|
|
167
|
+
}
|
|
168
|
+
return never();
|
|
169
|
+
},
|
|
170
|
+
stepUp: () => Promise.reject(new PassportError('config')),
|
|
171
|
+
takeResumedIntent: () => undefined,
|
|
172
|
+
getAccessToken: () => Promise.reject(new PassportError('config')),
|
|
173
|
+
// `same-origin` par défaut, sans écraser les `credentials` d'une `Request` ni ceux de `init`
|
|
174
|
+
fetch: (input, init) => (input instanceof Request || init?.credentials !== undefined ? fetch(input, init) : fetch(input, { ...init, credentials: 'same-origin' })),
|
|
175
|
+
};
|
|
176
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { PassportProvider } from './provider.js';
|
|
2
|
+
export type { PassportProviderProps } from './provider.js';
|
|
3
|
+
export { usePassport } from './usePassport.js';
|
|
4
|
+
export type { LoginOptions, UsePassport } from './usePassport.js';
|
|
5
|
+
export { PassportButton } from './PassportButton.js';
|
|
6
|
+
export type { PassportButtonProps } from './PassportButton.js';
|
|
7
|
+
export { ACR, PassportError } from '@passport.lgbt/web';
|
|
8
|
+
export type { Acr, Locale, PassportErrorCode, PassportState, PassportUser, PassportWebConfig, Scope } from '@passport.lgbt/web';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// @passport.lgbt/react : PassportProvider, usePassport() et <PassportButton/>, en mode navigateur (config ou client) ou
|
|
2
|
+
// en mode serveur (backend), avec la même API (Q4 C).
|
|
3
|
+
// Pas de 'use client' ici : chaque module de composant ou de hook porte le sien. Ainsi `PassportError` et `ACR`,
|
|
4
|
+
// réexportés de @passport.lgbt/web, restent des valeurs dans un composant serveur (`instanceof` y marche).
|
|
5
|
+
export { PassportProvider } from './provider.js';
|
|
6
|
+
export { usePassport } from './usePassport.js';
|
|
7
|
+
export { PassportButton } from './PassportButton.js';
|
|
8
|
+
export { ACR, PassportError } from '@passport.lgbt/web';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from 'react';
|
|
2
|
+
import type { Passport, PassportWebConfig } from '@passport.lgbt/web';
|
|
3
|
+
export type PassportProviderProps = {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
} & ({
|
|
6
|
+
config: PassportWebConfig;
|
|
7
|
+
client?: never;
|
|
8
|
+
backend?: never;
|
|
9
|
+
} | {
|
|
10
|
+
client: Passport;
|
|
11
|
+
config?: never;
|
|
12
|
+
backend?: never;
|
|
13
|
+
} | {
|
|
14
|
+
backend: {
|
|
15
|
+
basePath: string;
|
|
16
|
+
};
|
|
17
|
+
config?: never;
|
|
18
|
+
client?: never;
|
|
19
|
+
});
|
|
20
|
+
/** Tests seulement : oublie les instances créées (chaque test part d'une page neuve). */
|
|
21
|
+
export declare function forgetInstances(): void;
|
|
22
|
+
export declare function PassportProvider(p: PassportProviderProps): JSX.Element;
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
// <PassportProvider> : une instance par configuration, gardée hors du rendu (StrictMode rejoue les initialiseurs et les
|
|
4
|
+
// effets : la même instance est reprise, et son démarrage est idempotent).
|
|
5
|
+
import { useEffect, useRef, useState } from 'react';
|
|
6
|
+
import { PassportError, createPassport } from '@passport.lgbt/web';
|
|
7
|
+
import { createBackendSource } from './backend.js';
|
|
8
|
+
import { PassportContext } from './usePassport.js';
|
|
9
|
+
/** Mode navigateur : l'instance de @passport.lgbt/web telle quelle. */
|
|
10
|
+
function browserSource(client) {
|
|
11
|
+
let started = false;
|
|
12
|
+
return {
|
|
13
|
+
getState: () => client.state,
|
|
14
|
+
subscribe: (listener) => client.subscribe(() => listener()),
|
|
15
|
+
start() {
|
|
16
|
+
if (started)
|
|
17
|
+
return;
|
|
18
|
+
started = true;
|
|
19
|
+
// l'issue est publiée dans l'état de l'instance
|
|
20
|
+
client.start().catch(() => undefined);
|
|
21
|
+
},
|
|
22
|
+
login: ((o) => client.login(o)),
|
|
23
|
+
logout: (o) => client.logout(o),
|
|
24
|
+
stepUp: (o) => client.stepUp(o),
|
|
25
|
+
takeResumedIntent: () => client.takeResumedIntent(),
|
|
26
|
+
getAccessToken: () => client.getAccessToken(),
|
|
27
|
+
fetch: (input, init) => client.fetch(input, init),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
// Une source par instance fournie (`client`) ou par objet `backend` : un second appel de l'initialiseur, sous
|
|
31
|
+
// StrictMode, reprend la première.
|
|
32
|
+
const sources = new WeakMap();
|
|
33
|
+
function sourceFor(key, make) {
|
|
34
|
+
let source = sources.get(key);
|
|
35
|
+
if (!source) {
|
|
36
|
+
source = make(key);
|
|
37
|
+
sources.set(key, source);
|
|
38
|
+
}
|
|
39
|
+
return source;
|
|
40
|
+
}
|
|
41
|
+
/** Rendu côté serveur : aucune instance (elle lirait la page), état `loading` ; la vraie est créée à l'hydratation. */
|
|
42
|
+
const SERVER_STATE = Object.freeze({ status: 'loading' });
|
|
43
|
+
const serverSource = {
|
|
44
|
+
getState: () => SERVER_STATE,
|
|
45
|
+
subscribe: () => () => { },
|
|
46
|
+
start: () => { },
|
|
47
|
+
login: () => Promise.reject(new PassportError('config')),
|
|
48
|
+
logout: () => Promise.reject(new PassportError('config')),
|
|
49
|
+
stepUp: () => Promise.reject(new PassportError('config')),
|
|
50
|
+
takeResumedIntent: () => undefined,
|
|
51
|
+
getAccessToken: () => Promise.reject(new PassportError('config')),
|
|
52
|
+
fetch: () => Promise.reject(new PassportError('config')),
|
|
53
|
+
};
|
|
54
|
+
const instances = new Map();
|
|
55
|
+
function configKey(c) {
|
|
56
|
+
return JSON.stringify(c, (_k, v) => {
|
|
57
|
+
if (typeof v === 'function')
|
|
58
|
+
return undefined;
|
|
59
|
+
if (v && typeof v === 'object' && !Array.isArray(v)) {
|
|
60
|
+
return Object.fromEntries(Object.entries(v).sort(([a], [b]) => (a < b ? -1 : 1)));
|
|
61
|
+
}
|
|
62
|
+
return v;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function entryFor(c) {
|
|
66
|
+
const key = configKey(c);
|
|
67
|
+
let entry = instances.get(key);
|
|
68
|
+
if (!entry) {
|
|
69
|
+
const passport = createPassport(c);
|
|
70
|
+
entry = { key, passport, source: browserSource(passport), users: 0 };
|
|
71
|
+
instances.set(key, entry);
|
|
72
|
+
}
|
|
73
|
+
return entry;
|
|
74
|
+
}
|
|
75
|
+
function release(entry) {
|
|
76
|
+
if (instances.get(entry.key) === entry)
|
|
77
|
+
instances.delete(entry.key);
|
|
78
|
+
entry.passport.dispose();
|
|
79
|
+
}
|
|
80
|
+
/** Tests seulement : oublie les instances créées (chaque test part d'une page neuve). */
|
|
81
|
+
export function forgetInstances() {
|
|
82
|
+
instances.clear();
|
|
83
|
+
}
|
|
84
|
+
export function PassportProvider(p) {
|
|
85
|
+
const modes = [p.config, p.client, p.backend].filter((m) => m !== undefined && m !== null);
|
|
86
|
+
if (modes.length !== 1 || typeof modes[0] !== 'object')
|
|
87
|
+
throw new PassportError('config');
|
|
88
|
+
// backend : la première source est gardée pour la vie du Provider ; client : celle fournie ; config : par valeur.
|
|
89
|
+
const [backend] = useState(() => (p.backend ? sourceFor(p.backend, createBackendSource) : undefined));
|
|
90
|
+
const entry = p.config && typeof window !== 'undefined' ? entryFor(p.config) : undefined;
|
|
91
|
+
const source = p.config ? (entry?.source ?? serverSource) : p.client ? sourceFor(p.client, browserSource) : (backend ?? serverSource);
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (!entry)
|
|
94
|
+
return;
|
|
95
|
+
entry.users++;
|
|
96
|
+
return () => {
|
|
97
|
+
entry.users--;
|
|
98
|
+
};
|
|
99
|
+
}, [entry]);
|
|
100
|
+
// Configuration passée à une autre valeur : l'instance quittée est arrêtée si plus aucun Provider ne s'en sert. La
|
|
101
|
+
// décision est différée (microtâche) : dans une même validation, un Provider placé après celui-ci peut se monter avec la
|
|
102
|
+
// valeur quittée, et son effet (qui compte un utilisateur de plus) ne joue qu'après celui-ci.
|
|
103
|
+
const previous = useRef(undefined);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
const before = previous.current;
|
|
106
|
+
previous.current = entry;
|
|
107
|
+
if (before && before !== entry) {
|
|
108
|
+
queueMicrotask(() => {
|
|
109
|
+
if (before.users === 0)
|
|
110
|
+
release(before);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}, [entry]);
|
|
114
|
+
useEffect(() => source.start(), [source]);
|
|
115
|
+
return _jsx(PassportContext.Provider, { value: source, children: p.children });
|
|
116
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Acr, PassportError, PassportState, PassportUser } from '@passport.lgbt/web';
|
|
2
|
+
/** Options de connexion communes aux deux modes. */
|
|
3
|
+
export interface LoginOptions {
|
|
4
|
+
returnTo?: string;
|
|
5
|
+
acrValues?: readonly Acr[];
|
|
6
|
+
maxAge?: number;
|
|
7
|
+
/** `popup` : fenêtre, mode navigateur seulement ; ignoré en mode serveur. */
|
|
8
|
+
mode?: 'redirect' | 'popup';
|
|
9
|
+
}
|
|
10
|
+
type LoginBase = Omit<LoginOptions, 'mode'>;
|
|
11
|
+
/** Mêmes surcharges que `Passport.login` : sans `mode` (ou `redirect`) la page part et l'appel ne revient jamais. */
|
|
12
|
+
export interface LoginFn {
|
|
13
|
+
(o?: LoginBase & {
|
|
14
|
+
mode?: 'redirect';
|
|
15
|
+
}): Promise<never>;
|
|
16
|
+
(o: LoginBase & {
|
|
17
|
+
mode: 'popup';
|
|
18
|
+
}): Promise<PassportState>;
|
|
19
|
+
(o?: LoginOptions): Promise<PassportState>;
|
|
20
|
+
}
|
|
21
|
+
/** Ce que le Provider expose, quel que soit le mode : une instance de @passport.lgbt/web, ou le serveur de l'appli. */
|
|
22
|
+
export interface Source {
|
|
23
|
+
getState(): PassportState;
|
|
24
|
+
subscribe(listener: () => void): () => void;
|
|
25
|
+
/** Idempotent : un seul démarrage, même sous StrictMode (effets joués deux fois). */
|
|
26
|
+
start(): void;
|
|
27
|
+
login: LoginFn;
|
|
28
|
+
logout(o?: {
|
|
29
|
+
returnTo?: string;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
stepUp(o: {
|
|
32
|
+
intent: string;
|
|
33
|
+
acrValues?: readonly Acr[];
|
|
34
|
+
maxAge?: number;
|
|
35
|
+
}): Promise<never>;
|
|
36
|
+
takeResumedIntent(): string | undefined;
|
|
37
|
+
getAccessToken(): Promise<string>;
|
|
38
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
39
|
+
}
|
|
40
|
+
export declare const PassportContext: import("react").Context<Source | undefined>;
|
|
41
|
+
export interface UsePassport {
|
|
42
|
+
status: PassportState['status'];
|
|
43
|
+
user?: PassportUser;
|
|
44
|
+
error?: PassportError;
|
|
45
|
+
login: LoginFn;
|
|
46
|
+
logout(o?: {
|
|
47
|
+
returnTo?: string;
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
/** Mode navigateur ; rejette `config` en mode serveur. */
|
|
50
|
+
stepUp(o: {
|
|
51
|
+
intent: string;
|
|
52
|
+
acrValues?: readonly Acr[];
|
|
53
|
+
maxAge?: number;
|
|
54
|
+
}): Promise<never>;
|
|
55
|
+
/** Mode navigateur ; `undefined` en mode serveur. */
|
|
56
|
+
takeResumedIntent(): string | undefined;
|
|
57
|
+
/** Mode navigateur ; rejette `config` en mode serveur (le navigateur n'y a aucun jeton). */
|
|
58
|
+
getAccessToken(): Promise<string>;
|
|
59
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
60
|
+
}
|
|
61
|
+
export declare function useSource(): Source;
|
|
62
|
+
export declare function usePassport(): UsePassport;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
// usePassport() : état de la session (useSyncExternalStore) et actions, les mêmes dans les deux modes (Q4 C).
|
|
3
|
+
import { createContext, useContext, useMemo, useSyncExternalStore } from 'react';
|
|
4
|
+
export const PassportContext = createContext(undefined);
|
|
5
|
+
/** Rendu côté serveur : rien n'est connu avant le démarrage dans le navigateur. */
|
|
6
|
+
const LOADING = Object.freeze({ status: 'loading' });
|
|
7
|
+
const loading = () => LOADING;
|
|
8
|
+
export function useSource() {
|
|
9
|
+
const source = useContext(PassportContext);
|
|
10
|
+
if (!source)
|
|
11
|
+
throw new Error('passport.lgbt: usePassport() must be called inside <PassportProvider>');
|
|
12
|
+
return source;
|
|
13
|
+
}
|
|
14
|
+
export function usePassport() {
|
|
15
|
+
const source = useSource();
|
|
16
|
+
const state = useSyncExternalStore(source.subscribe, source.getState, loading);
|
|
17
|
+
return useMemo(() => {
|
|
18
|
+
const out = {
|
|
19
|
+
status: state.status,
|
|
20
|
+
login: source.login,
|
|
21
|
+
logout: source.logout,
|
|
22
|
+
stepUp: source.stepUp,
|
|
23
|
+
takeResumedIntent: source.takeResumedIntent,
|
|
24
|
+
getAccessToken: source.getAccessToken,
|
|
25
|
+
fetch: source.fetch,
|
|
26
|
+
};
|
|
27
|
+
if (state.status === 'authenticated')
|
|
28
|
+
out.user = state.user;
|
|
29
|
+
if (state.status === 'error')
|
|
30
|
+
out.error = state.error;
|
|
31
|
+
return out;
|
|
32
|
+
}, [state, source]);
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@passport.lgbt/react",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "passport.lgbt for React: PassportProvider, usePassport() and <PassportButton/>",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/passport-lgbt/sdk-js.git",
|
|
9
|
+
"directory": "packages/react"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/passport-lgbt/sdk-js/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://passport.lgbt",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README*.md",
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"NOTICE"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@passport.lgbt/web": "1.0.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"react": "^18.3.0 || ^19.0.0"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=20.19"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@testing-library/dom": "10.4.2",
|
|
44
|
+
"@testing-library/react": "16.3.3",
|
|
45
|
+
"@types/react": "19.3.0",
|
|
46
|
+
"react": "19.3.1",
|
|
47
|
+
"react-dom": "19.3.1"
|
|
48
|
+
}
|
|
49
|
+
}
|