@ory/elements-react 1.0.0-next.2 → 1.0.0-next.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/.vscode/i18n-ally-reviews.yml +3 -0
  2. package/.vscode/settings.json +4 -0
  3. package/CHANGELOG.md +299 -0
  4. package/README.md +160 -7
  5. package/api-report/elements-react-client.api.json +356 -0
  6. package/api-report/elements-react-client.api.md +33 -0
  7. package/api-report/elements-react-theme.api.json +1468 -0
  8. package/api-report/elements-react-theme.api.md +149 -0
  9. package/api-report/elements-react.api.json +3759 -0
  10. package/api-report/elements-react.api.md +442 -0
  11. package/api-report/temp/elements-react-client.api.md +33 -0
  12. package/api-report/temp/elements-react-theme.api.md +149 -0
  13. package/api-report/temp/elements-react.api.md +442 -0
  14. package/config/api-extractor-client.json +463 -0
  15. package/config/api-extractor-core.json +457 -0
  16. package/config/api-extractor-theme.json +463 -0
  17. package/dist/client/config.d.mts +21 -0
  18. package/dist/client/config.d.ts +21 -0
  19. package/dist/client/config.js +77 -0
  20. package/dist/client/config.js.map +1 -0
  21. package/dist/client/config.mjs +51 -0
  22. package/dist/client/config.mjs.map +1 -0
  23. package/dist/client/frontendClient.d.mts +7 -0
  24. package/dist/client/frontendClient.d.ts +7 -0
  25. package/dist/client/frontendClient.js +52 -0
  26. package/dist/client/frontendClient.js.map +1 -0
  27. package/dist/client/frontendClient.mjs +31 -0
  28. package/dist/client/frontendClient.mjs.map +1 -0
  29. package/dist/client/index.d.mts +5 -0
  30. package/dist/client/index.d.ts +5 -0
  31. package/dist/client/index.js +33 -0
  32. package/dist/client/index.js.map +1 -0
  33. package/dist/client/index.mjs +10 -0
  34. package/dist/client/index.mjs.map +1 -0
  35. package/dist/client/session-provider.d.mts +62 -0
  36. package/dist/client/session-provider.d.ts +62 -0
  37. package/dist/client/session-provider.js +96 -0
  38. package/dist/client/session-provider.js.map +1 -0
  39. package/dist/client/session-provider.mjs +71 -0
  40. package/dist/client/session-provider.mjs.map +1 -0
  41. package/dist/client/useSession.d.mts +32 -0
  42. package/dist/client/useSession.d.ts +32 -0
  43. package/dist/client/useSession.js +37 -0
  44. package/dist/client/useSession.js.map +1 -0
  45. package/dist/client/useSession.mjs +13 -0
  46. package/dist/client/useSession.mjs.map +1 -0
  47. package/dist/index.d.mts +441 -1634
  48. package/dist/index.d.ts +441 -1634
  49. package/dist/index.js +2492 -5790
  50. package/dist/index.js.map +1 -1
  51. package/dist/index.mjs +2483 -5754
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/theme/default/index.css +673 -169
  54. package/dist/theme/default/index.css.map +1 -1
  55. package/dist/theme/default/index.d.mts +29 -142
  56. package/dist/theme/default/index.d.ts +29 -142
  57. package/dist/theme/default/index.js +1968 -10130
  58. package/dist/theme/default/index.js.map +1 -1
  59. package/dist/theme/default/index.mjs +2014 -10203
  60. package/dist/theme/default/index.mjs.map +1 -1
  61. package/jest.config.ts +23 -0
  62. package/package.json +34 -9
  63. package/postcss.config.ts +1 -0
  64. package/tailwind.config.ts +21 -12
  65. package/tsconfig.json +15 -3
  66. package/tsconfig.spec.json +20 -0
  67. package/variables-processed.json +385 -187
  68. package/.eslintrc.js +0 -61
  69. package/test-results/.last-run.json +0 -4
@@ -0,0 +1,3 @@
1
+ # Review comments generated by i18n-ally. Please commit this file.
2
+
3
+ {}
@@ -0,0 +1,4 @@
1
+ {
2
+ "i18n-ally.localesPaths": ["src/locales", "src/util/i18n"],
3
+ "i18n-ally.keystyle": "flat"
4
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,299 @@
1
+ ## 1.0.0-next.20 (2025-01-16)
2
+
3
+ ### 🚀 Features
4
+
5
+ - handle state transition edge cases ([f2e4023](https://github.com/ory/elements/commit/f2e4023))
6
+ - user experience improvements and e2e test coverage ([f68744c](https://github.com/ory/elements/commit/f68744c))
7
+ - do not show two-step selector if only one method exists ([6453673](https://github.com/ory/elements/commit/6453673))
8
+
9
+ ### 🩹 Fixes
10
+
11
+ - better validation for code method ([b0d8e2c](https://github.com/ory/elements/commit/b0d8e2c))
12
+
13
+ ### ❤️ Thank You
14
+
15
+ - aeneasr @aeneasr
16
+
17
+ ## 1.0.0-next.19 (2024-12-31)
18
+
19
+ ### 🩹 Fixes
20
+
21
+ - properly handle form submits in settings flow ([#322](https://github.com/ory/elements/pull/322))
22
+
23
+ ### ❤️ Thank You
24
+
25
+ - Jonas Hungershausen
26
+
27
+ ## 1.0.0-next.18 (2024-12-30)
28
+
29
+ ### 🚀 Features
30
+
31
+ - add page and app router examples ([#307](https://github.com/ory/elements/pull/307))
32
+ - ⚠️ add getServerSession and SessionProvider ([#309](https://github.com/ory/elements/pull/309))
33
+ - add @ory/nextjs package ([#303](https://github.com/ory/elements/pull/303))
34
+
35
+ ### 🩹 Fixes
36
+
37
+ - align font sizes to design & use updated variable names ([#318](https://github.com/ory/elements/pull/318))
38
+ - properly set default value for checkboxes ([#314](https://github.com/ory/elements/pull/314))
39
+ - passkey and webauthn in settings flow ([#317](https://github.com/ory/elements/pull/317))
40
+
41
+ ### ⚠️ Breaking Changes
42
+
43
+ - ⚠️ add getServerSession and SessionProvider ([#309](https://github.com/ory/elements/pull/309))
44
+
45
+ ### ❤️ Thank You
46
+
47
+ - hackerman @aeneasr
48
+ - Jonas Hungershausen
49
+
50
+ ## 1.0.0-next.17 (2024-11-27)
51
+
52
+
53
+ ### 🚀 Features
54
+
55
+ - allow overriding OIDC logos
56
+
57
+ - enable proper account linking flows
58
+
59
+ - **core:** add react-hook form resolver
60
+
61
+
62
+ ### 🩹 Fixes
63
+
64
+ - handle recovery brute force protection
65
+
66
+
67
+ ### ❤️ Thank You
68
+
69
+ - Jonas Hungershausen
70
+
71
+ ## 1.0.0-next.16 (2024-11-26)
72
+
73
+
74
+ ### 🚀 Features
75
+
76
+ - allow overriding of field messages
77
+
78
+ - add test ids to components
79
+
80
+
81
+ ### 🩹 Fixes
82
+
83
+ - use --font-sans CSS variable for font
84
+
85
+ - registration & login flow form states
86
+
87
+ - missing resend button on login & registration
88
+
89
+ - password validation error form state
90
+
91
+ - current identifier button overflowing on long values
92
+
93
+
94
+ ### ❤️ Thank You
95
+
96
+ - Jonas Hungershausen
97
+
98
+ ## 1.0.0-next.15 (2024-11-18)
99
+
100
+
101
+ ### 🩹 Fixes
102
+
103
+ - use --font-sans CSS variable for font
104
+
105
+ - registration & login flow form states
106
+
107
+
108
+ ### ❤️ Thank You
109
+
110
+ - Jonas Hungershausen
111
+
112
+ ## 1.0.0-next.14 (2024-11-08)
113
+
114
+
115
+ ### 🚀 Features
116
+
117
+ - force OIDC account selection on settings
118
+
119
+
120
+ ### 🩹 Fixes
121
+
122
+ - redirect to login if session expired during settings
123
+
124
+
125
+ ### ❤️ Thank You
126
+
127
+ - Jonas Hungershausen
128
+
129
+ ## 1.0.0-next.13 (2024-11-05)
130
+
131
+
132
+ ### 🩹 Fixes
133
+
134
+ - ⚠️ move useSession hook to /client entry point
135
+
136
+ - oidc linking & unlinking form properties
137
+
138
+ - hide two step registration message
139
+
140
+ - implement component merging instead of usign lodash
141
+
142
+ - replace translation merge with custom function
143
+
144
+
145
+ #### ⚠️ Breaking Changes
146
+
147
+ - ⚠️ move useSession hook to /client entry point
148
+
149
+ ### ❤️ Thank You
150
+
151
+ - Jonas Hungershausen
152
+
153
+ ## 1.0.0-next.12 (2024-10-29)
154
+
155
+
156
+ ### 🚀 Features
157
+
158
+ - add elements v1 packages
159
+
160
+ - add useSession hook
161
+
162
+ - add page header component with user menu
163
+
164
+ - support links in checkbox/boolean nodes
165
+
166
+ - add settings flow components
167
+
168
+
169
+ ### 🩹 Fixes
170
+
171
+ - use correct node to detect two step registration
172
+
173
+ - use translations in more missing places
174
+
175
+ - short-circuit code login on two step card
176
+
177
+ - duplicate resend button on recovery & verification
178
+
179
+
180
+ ### ❤️ Thank You
181
+
182
+ - Jonas Hungershausen
183
+ - Miłosz
184
+
185
+ ## 1.0.0-next.11 (2024-10-22)
186
+
187
+ Breaking Changes: This update includes breaking changes to the naming of some variables and functions. Please refer to [Advisory: ory elements‐react upgrade guide to v1.0.0‐next.11](https://github.com/ory/elements/wiki/Advisory:-ory-elements%E2%80%90react-upgrade-guide-to-v1.0.0%E2%80%90next.11) for more information.
188
+
189
+
190
+ ### 🚀 Features
191
+
192
+ - add elements v1 packages
193
+
194
+ - add useSession hook
195
+
196
+ ### ❤️ Thank You
197
+
198
+ - Jonas Hungershausen
199
+
200
+ ## 1.0.0-next.10 (2024-10-14)
201
+
202
+
203
+ ### 🩹 Fixes
204
+
205
+ - add missing translations in all places
206
+
207
+
208
+ ### ❤️ Thank You
209
+
210
+ - Jonas Hungershausen
211
+
212
+ ## 1.0.0-next.9 (2024-10-10)
213
+
214
+
215
+ ### 🩹 Fixes
216
+
217
+ - add missing swedish translations
218
+
219
+
220
+ ### ❤️ Thank You
221
+
222
+ - Jonas Hungershausen
223
+
224
+ ## 1.0.0-next.8 (2024-10-07)
225
+
226
+
227
+ ### 🩹 Fixes
228
+
229
+ - ⚠️ remove ory-default-theme class
230
+
231
+ - remove capitalize class from messages
232
+
233
+
234
+ #### ⚠️ Breaking Changes
235
+
236
+ - ⚠️ remove ory-default-theme class
237
+
238
+ ### ❤️ Thank You
239
+
240
+ - Jonas Hungershausen
241
+
242
+ ## 1.0.0-next.7 (2024-09-27)
243
+
244
+ ### 🚀 Features
245
+
246
+ - add two-step login card
247
+
248
+ ### 🩹 Fixes
249
+
250
+ - registration text in swedish translation
251
+
252
+ - show identifier_first node in card header
253
+
254
+ ### ❤️ Thank You
255
+
256
+ - Jonas Hungershausen
257
+
258
+ ## 1.0.0-next.6 (2024-09-18)
259
+
260
+ ### 🩹 Fixes
261
+
262
+ - **intl:** export locales object from package root
263
+
264
+ ### ❤️ Thank You
265
+
266
+ - Jonas Hungershausen
267
+
268
+ ## 1.0.0-next.5 (2024-09-17)
269
+
270
+ ### 🚀 Features
271
+
272
+ - @testing-library/react based tests
273
+
274
+ - **theme:** show resend code button on top of code input
275
+
276
+ ### 🩹 Fixes
277
+
278
+ - **core:** use SDK instead of HTML form submissions
279
+
280
+ - **core:** use empty strings instead of undefined default values
281
+
282
+ - **core:** code form submission precendence
283
+
284
+ - ⚠️ **theme:** scope css classes with .ory-default-theme
285
+
286
+ - **theme:** social sign in button styling
287
+
288
+ - **intl:** use correct abbreveation for swedish locale
289
+
290
+ - **core:** passkey script discovery
291
+
292
+ #### ⚠️ Breaking Changes
293
+
294
+ - ⚠️ **theme:** scope css classes with .ory-default-theme
295
+
296
+ ### ❤️ Thank You
297
+
298
+ - Jonas Hungershausen
299
+ - Miłosz
package/README.md CHANGED
@@ -6,18 +6,171 @@
6
6
 
7
7
  # @ory/elements-react
8
8
 
9
- ---
9
+ <p align="center">
10
+ <a aria-label="NPM Version" href="https://www.npmjs.com/package/@ory/elements-react">
11
+ <img src="https://img.shields.io/npm/v/@ory/elements-react.svg?style=flat-square">
12
+ </a>
13
+ <a aria-label="License" href="https://github.com/ory/elements/blob/main/LICENSE">
14
+ <img src="https://img.shields.io/github/license/ory/elements?style=flat-square">
15
+ </a>
16
+ <a aria-label="Join Ory Slack community!" href="https://slack.ory.sh/">
17
+ <img src="https://img.shields.io/badge/Slack-Join%20the%20community!-4f46e5?style=flat-square&logo=slack&logoColor=eef2ff">
18
+ </a>
19
+ </p>
10
20
 
11
- Ory Elements is a collection of components and functions that help you get an
12
- authentication solution up, running and integrated into your application in no
13
- time.
21
+ Ory Elements is a set of components and functions tailored for easy integration
22
+ of Ory into your React application. It simplifies the process of adding
23
+ authentication and other identity features to your application using the Ory
24
+ Network.
14
25
 
15
- - Documentation: https://ory.sh/docs
26
+ ## Documentation
16
27
 
17
- ## Usage
28
+ Visit https://ory.sh/docs to see the full Ory documentation.
29
+
30
+ ## Getting started
31
+
32
+ **Requirements**
33
+
34
+ - React `>= 18`
35
+ - Node.js `>= 18`
36
+ - **`@ory/client-fetch`** - fetch based version of ory client
18
37
 
19
- Install the package:
38
+ **Installation**
20
39
 
21
40
  ```sh
22
41
  npm install @ory/elements-react
23
42
  ```
43
+
44
+ ## Usage
45
+
46
+ Ory Elements provides components that can aggregate flow objects and display
47
+ user authentication flows based on the data.
48
+
49
+ To feed Ory Elements with flow data you need to use Ory client.
50
+
51
+ ```ts
52
+ export function serverClientFrontend() {
53
+ // For testing purposes we're using Ory tunnel
54
+
55
+ const config = new Configuration({
56
+ headers: {
57
+ Accept: "application/json",
58
+ },
59
+ basePath: "http://localhost:4000",
60
+ })
61
+ return new FrontendApi(config)
62
+ }
63
+ ```
64
+
65
+ ### Ory Network project setup
66
+
67
+ The Ory Identities APIs come with the ability to specify custom UI URLs. To make
68
+ sure, Ory knows about your custom UI, specify the URLs of your application on
69
+ https://console.ory.sh/projects/current/ui.
70
+
71
+ ### Initializing a new flow
72
+
73
+ Initializing a new flow is done by navigating the user's page to the initialize
74
+ flow URL. After creating a new flow object, Ory will return a redirect to the
75
+ flow UI URL and, in some cases, return anti-CSRF cookies.
76
+
77
+ ```ts
78
+ export function init(params: QueryParams, flowType: FlowType) {
79
+ // Take advantage of the fact, that Ory handles the flow creation for us and redirects the user to the default return to automatically if they're logged in already.
80
+ return redirect(
81
+ "http://localhost:4000" +
82
+ "/self-service/" +
83
+ flowType.toString() +
84
+ "/browser?" +
85
+ new URLSearchParams(params).toString(),
86
+ RedirectType.replace,
87
+ )
88
+ }
89
+ ```
90
+
91
+ **FlowType** can be: `login`, `registration`, `recovery`, `verification`,
92
+ `settings` or `error`
93
+
94
+ To access & render the flow, on your flow page, you can use the `flow` query
95
+ parameter, that is included in the redirect. Use it to call the
96
+ [`getLoginFlow()`](https://www.ory.sh/docs/reference/api#tag/frontend/operation/getLoginFlow)
97
+ API.
98
+
99
+ **Full Example**:
100
+
101
+ ````ts
102
+ export async function getOrCreateRegistrationFlow(
103
+ params: QueryParams
104
+ ): Promise<RegistrationFlow> {
105
+ const onRestartFlow = () => init(params, FlowType.Registration);
106
+
107
+ // If flow ID doesn't exist in params simply trigget the init function.
108
+ if (!params.flow) {
109
+ return onRestartFlow();
110
+ }
111
+
112
+ return await serverClientFrontend()
113
+ // Passing the flow ID
114
+ .getRegistrationFlowRaw({ id: flow })
115
+ .then(res => res.value())
116
+ .catch(
117
+ // Ory Elements predefines the handleFlowError function to simplify error handling.
118
+ // You can define what should happen in each of these callbacks
119
+ handleFlowError({
120
+ onValidationError,
121
+ onRestartFlow,
122
+ onRedirect,
123
+ })
124
+ );
125
+ ```
126
+ ````
127
+
128
+ As soon as we have our flow data we can render the `<Registration/>` component
129
+ from `@ory/elements-react` package.
130
+
131
+ ```tsx
132
+ export default async function RegistrationPage({ searchParams }: PageProps) {
133
+ const flow = await getOrCreateRegistrationFlow(searchParams)
134
+
135
+ if (!flow) {
136
+ return <div>Flow not found</div>
137
+ }
138
+
139
+ return (
140
+ <Registration
141
+ flow={flow}
142
+ config={oryConfiguration}
143
+ components={ComponentOverrides}
144
+ />
145
+ )
146
+ }
147
+ ```
148
+
149
+ ### Styling
150
+
151
+ To include the default styles, add the following import to your app. Make sure
152
+ it's included on all pages, that use Ory Elements.
153
+
154
+ ```ts
155
+ import "@ory/elements-react/theme/styles.css"
156
+ ```
157
+
158
+ ### Theming
159
+
160
+ Most styling can be overwritten, by providing your own custom CSS variables:
161
+
162
+ ```css
163
+ :root {
164
+ /* To override the text color of the primary buttons */
165
+ --button-primary-fg-default: #fffeee;
166
+ }
167
+ ```
168
+
169
+ ## Package development
170
+
171
+ To develop and use the package `npm link` is recommended. To run the package in
172
+ watch mode use
173
+
174
+ ```
175
+ npx nx run @ory/elements-react:dev
176
+ ```