@ory/elements-react 1.0.0-next.16 → 1.0.0-next.17

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.
@@ -0,0 +1,421 @@
1
+ ## API Report File for "@ory/elements-react"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import * as class_variance_authority_types from 'class-variance-authority/types';
8
+ import { ComponentPropsWithoutRef } from 'react';
9
+ import { ComponentType } from 'react';
10
+ import { ConfigurationParameters } from '@ory/client-fetch';
11
+ import { DetailedHTMLProps } from 'react';
12
+ import { Dispatch } from 'react';
13
+ import { FlowError } from '@ory/client-fetch';
14
+ import { FlowType } from '@ory/client-fetch';
15
+ import { FormEventHandler } from 'react';
16
+ import { HTMLAttributes } from 'react';
17
+ import { IntlShape } from 'react-intl';
18
+ import { LoginFlow } from '@ory/client-fetch';
19
+ import { MouseEventHandler } from 'react';
20
+ import { OnRedirectHandler } from '@ory/client-fetch';
21
+ import { PropsWithChildren } from 'react';
22
+ import * as react_jsx_runtime from 'react/jsx-runtime';
23
+ import { RecoveryFlow } from '@ory/client-fetch';
24
+ import { RegistrationFlow } from '@ory/client-fetch';
25
+ import { SettingsFlow } from '@ory/client-fetch';
26
+ import { UiNode } from '@ory/client-fetch';
27
+ import { UiNodeAnchorAttributes } from '@ory/client-fetch';
28
+ import { UiNodeGroupEnum } from '@ory/client-fetch';
29
+ import { UiNodeImageAttributes } from '@ory/client-fetch';
30
+ import { UiNodeInputAttributes } from '@ory/client-fetch';
31
+ import { UiNodeTextAttributes } from '@ory/client-fetch';
32
+ import { UiText } from '@ory/client-fetch';
33
+ import { UpdateLoginFlowBody } from '@ory/client-fetch';
34
+ import { UpdateRecoveryFlowBody } from '@ory/client-fetch';
35
+ import { UpdateRegistrationFlowBody } from '@ory/client-fetch';
36
+ import { UpdateSettingsFlowBody } from '@ory/client-fetch';
37
+ import { UpdateVerificationFlowBody } from '@ory/client-fetch';
38
+ import { VariantProps } from 'class-variance-authority';
39
+ import { VerificationFlow } from '@ory/client-fetch';
40
+
41
+ // Warning: (ae-forgotten-export) The symbol "OryFlow" needs to be exported by the entry point index.d.ts
42
+ //
43
+ // @public
44
+ export type ErrorFlowContainer = OryFlow<FlowType.Error, FlowError>;
45
+
46
+ // @public
47
+ export type FlowContainerSetter = Dispatch<OryFlowContainer>;
48
+
49
+ // @public
50
+ export type FlowContextValue = OryFlowContainer & {
51
+ setFlowContainer: FlowContainerSetter;
52
+ formState: FormState;
53
+ dispatchFormState: Dispatch<FormStateAction>;
54
+ };
55
+
56
+ // @public (undocumented)
57
+ export type FormState = {
58
+ current: "provide_identifier";
59
+ } | {
60
+ current: "select_method";
61
+ } | {
62
+ current: "method_active";
63
+ method: UiNodeGroupEnum;
64
+ } | {
65
+ current: "success_screen";
66
+ } | {
67
+ current: "settings";
68
+ };
69
+
70
+ // @public (undocumented)
71
+ export type FormStateAction = {
72
+ type: "action_flow_update";
73
+ flow: OryFlowContainer;
74
+ } | {
75
+ type: "action_select_method";
76
+ method: UiNodeGroupEnum;
77
+ };
78
+
79
+ // @public
80
+ export type FormValues = Record<string, string | boolean | number | undefined>;
81
+
82
+ // @public (undocumented)
83
+ export const HeadlessPageHeader: () => react_jsx_runtime.JSX.Element;
84
+
85
+ // Warning: (ae-forgotten-export) The symbol "IntlContextProps" needs to be exported by the entry point index.d.ts
86
+ //
87
+ // @public (undocumented)
88
+ export type IntlConfig = IntlContextProps;
89
+
90
+ // @public
91
+ export type LoginFlowContainer = OryFlow<FlowType.Login, LoginFlow>;
92
+
93
+ // @public
94
+ export function messageTestId(message: UiText): {
95
+ "data-testid": string;
96
+ };
97
+
98
+ // @public
99
+ export type OnSubmitHandlerProps<T extends UpdateLoginFlowBody | UpdateRegistrationFlowBody | UpdateVerificationFlowBody | UpdateRecoveryFlowBody | UpdateSettingsFlowBody> = {
100
+ setFlowContainer: (flowContainer: OryFlowContainer) => void;
101
+ body: T;
102
+ onRedirect: OnRedirectHandler;
103
+ };
104
+
105
+ // @public
106
+ export function OryCard({ children }: PropsWithChildren): react_jsx_runtime.JSX.Element;
107
+
108
+ // @public
109
+ export type OryCardAuthMethodListItemProps = {
110
+ onClick: () => void;
111
+ group: string;
112
+ };
113
+
114
+ // @public
115
+ export function OryCardContent({ children }: OryCardContentProps): react_jsx_runtime.JSX.Element;
116
+
117
+ // @public
118
+ export type OryCardContentProps = PropsWithChildren;
119
+
120
+ // @public
121
+ export type OryCardDividerProps = Record<string, never>;
122
+
123
+ // @public (undocumented)
124
+ export function OryCardFooter(): react_jsx_runtime.JSX.Element;
125
+
126
+ // @public (undocumented)
127
+ export type OryCardFooterProps = Record<string, never>;
128
+
129
+ // @public (undocumented)
130
+ export function OryCardHeader(): react_jsx_runtime.JSX.Element;
131
+
132
+ // @public (undocumented)
133
+ export type OryCardHeaderProps = Record<string, never>;
134
+
135
+ // @public (undocumented)
136
+ export type OryCardLogoProps = Record<string, never>;
137
+
138
+ // @public (undocumented)
139
+ export type OryCardProps = PropsWithChildren;
140
+
141
+ // @public (undocumented)
142
+ export function OryCardValidationMessages({ ...props }: OryMessageRootProps): react_jsx_runtime.JSX.Element | null;
143
+
144
+ // @public (undocumented)
145
+ export type OryClientConfiguration = {
146
+ name: string;
147
+ logoUrl?: string;
148
+ stylesheet?: string;
149
+ favicon?: string;
150
+ sdk: {
151
+ url: string;
152
+ options?: Partial<ConfigurationParameters>;
153
+ };
154
+ project: {
155
+ registration_enabled: boolean;
156
+ verification_enabled: boolean;
157
+ recovery_enabled: boolean;
158
+ recovery_ui_url: string;
159
+ registration_ui_url: string;
160
+ verification_ui_url: string;
161
+ login_ui_url: string;
162
+ };
163
+ intl?: IntlConfig;
164
+ };
165
+
166
+ // Warning: (ae-forgotten-export) The symbol "DeepPartialTwoLevels" needs to be exported by the entry point index.d.ts
167
+ //
168
+ // @public (undocumented)
169
+ export type OryFlowComponentOverrides = DeepPartialTwoLevels<OryFlowComponents>;
170
+
171
+ // @public
172
+ export type OryFlowComponents = {
173
+ Node: {
174
+ Button: ComponentType<OryNodeButtonProps>;
175
+ OidcButton: ComponentType<OryNodeOidcButtonProps>;
176
+ Anchor: ComponentType<OryNodeAnchorProps>;
177
+ Input: ComponentType<OryNodeInputProps>;
178
+ CodeInput: ComponentType<OryNodeInputProps>;
179
+ Image: ComponentType<OryNodeImageProps>;
180
+ Label: ComponentType<OryNodeLabelProps>;
181
+ Checkbox: ComponentType<OryNodeInputProps>;
182
+ Text: ComponentType<OryNodeTextProps>;
183
+ };
184
+ Card: {
185
+ Root: ComponentType<OryCardProps>;
186
+ Footer: ComponentType<OryCardFooterProps>;
187
+ Header: ComponentType<OryCardProps>;
188
+ Content: ComponentType<OryCardContentProps>;
189
+ Logo: ComponentType<OryCardLogoProps>;
190
+ Divider: ComponentType<OryCardDividerProps>;
191
+ AuthMethodListItem: ComponentType<OryCardAuthMethodListItemProps>;
192
+ SettingsSection: ComponentType<OryFormSectionProps>;
193
+ SettingsSectionContent: ComponentType<OryFormSectionContentProps>;
194
+ SettingsSectionFooter: ComponentType<OryFormSectionContentProps>;
195
+ };
196
+ Form: {
197
+ Root: ComponentType<OryFormRootProps>;
198
+ OidcRoot: ComponentType<OryFormOidcRootProps>;
199
+ Group: ComponentType<OryFormGroupProps>;
200
+ OidcSettings: ComponentType<OrySettingsOidcProps>;
201
+ WebauthnSettings: ComponentType<OrySettingsWebauthnProps>;
202
+ PasskeySettings: ComponentType<OrySettingsPasskeyProps>;
203
+ TotpSettings: ComponentType<OrySettingsTotpProps>;
204
+ RecoveryCodesSettings: ComponentType<OrySettingsRecoveryCodesProps>;
205
+ };
206
+ Message: {
207
+ Root: ComponentType<OryMessageRootProps>;
208
+ Content: ComponentType<OryMessageContentProps>;
209
+ };
210
+ Page: {
211
+ Header: ComponentType<OryPageHeaderProps>;
212
+ };
213
+ };
214
+
215
+ // @public
216
+ export type OryFlowContainer = LoginFlowContainer | RegistrationFlowContainer | RecoveryFlowContainer | VerificationFlowContainer | SettingsFlowContainer;
217
+
218
+ // @public (undocumented)
219
+ export function OryForm({ children, onAfterSubmit }: OryFormProps): string | react_jsx_runtime.JSX.Element;
220
+
221
+ // @public
222
+ export function OryFormGroupDivider(): react_jsx_runtime.JSX.Element | null;
223
+
224
+ // @public (undocumented)
225
+ export type OryFormGroupProps = PropsWithChildren;
226
+
227
+ // @public (undocumented)
228
+ export function OryFormGroups({ children, groups }: OryFormGroupsProps): react_jsx_runtime.JSX.Element;
229
+
230
+ // @public (undocumented)
231
+ export type OryFormGroupsProps = PropsWithChildren<{
232
+ groups: UiNodeGroupEnum[];
233
+ }>;
234
+
235
+ // @public (undocumented)
236
+ export function OryFormOidcButtons({ children, hideDivider, }: OryFormOidcButtonsProps): react_jsx_runtime.JSX.Element | null;
237
+
238
+ // @public (undocumented)
239
+ export type OryFormOidcButtonsProps = PropsWithChildren<{
240
+ hideDivider?: boolean;
241
+ }>;
242
+
243
+ // @public (undocumented)
244
+ export type OryFormOidcRootProps = PropsWithChildren<{
245
+ nodes: UiNode[];
246
+ }>;
247
+
248
+ // @public (undocumented)
249
+ export type OryFormProps = PropsWithChildren<{
250
+ onAfterSubmit?: (method: string | number | boolean | undefined) => void;
251
+ }>;
252
+
253
+ // @public (undocumented)
254
+ export type OryFormRootProps = ComponentPropsWithoutRef<"form"> & {
255
+ onSubmit: FormEventHandler<HTMLFormElement>;
256
+ };
257
+
258
+ // @public (undocumented)
259
+ export function OryFormSection({ children, nodes }: OryFormSectionProps): react_jsx_runtime.JSX.Element;
260
+
261
+ // @public (undocumented)
262
+ export type OryFormSectionContentProps = PropsWithChildren<{
263
+ title?: string;
264
+ description?: string;
265
+ }>;
266
+
267
+ // @public (undocumented)
268
+ export type OryFormSectionFooterProps = PropsWithChildren;
269
+
270
+ // @public (undocumented)
271
+ export type OryFormSectionProps = PropsWithChildren<{
272
+ nodes?: UiNode[];
273
+ }>;
274
+
275
+ // @public (undocumented)
276
+ export function OryFormSocialButtonsForm(): react_jsx_runtime.JSX.Element | null;
277
+
278
+ // Warning: (ae-forgotten-export) The symbol "LocaleMap" needs to be exported by the entry point index.d.ts
279
+ //
280
+ // @public (undocumented)
281
+ export const OryLocales: LocaleMap;
282
+
283
+ // @public (undocumented)
284
+ export type OryMessageContentProps = {
285
+ message: UiText;
286
+ };
287
+
288
+ // @public (undocumented)
289
+ export type OryMessageRootProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
290
+
291
+ // @public (undocumented)
292
+ export type OryNodeAnchorProps = {
293
+ attributes: UiNodeAnchorAttributes;
294
+ node: UiNode;
295
+ } & Omit<ComponentPropsWithoutRef<"a">, "children">;
296
+
297
+ // Warning: (ae-forgotten-export) The symbol "ButtonVariants" needs to be exported by the entry point index.d.ts
298
+ //
299
+ // @public (undocumented)
300
+ export type OryNodeButtonProps = {
301
+ attributes: UiNodeInputAttributes;
302
+ node: UiNode;
303
+ } & Omit<ComponentPropsWithoutRef<"button">, "children"> & ButtonVariants;
304
+
305
+ // @public (undocumented)
306
+ export type OryNodeImageProps = {
307
+ attributes: UiNodeImageAttributes;
308
+ node: UiNode;
309
+ };
310
+
311
+ // @public (undocumented)
312
+ export type OryNodeInputProps = {
313
+ attributes: UiNodeInputAttributes;
314
+ node: UiNode;
315
+ onClick?: MouseEventHandler;
316
+ };
317
+
318
+ // @public (undocumented)
319
+ export type OryNodeLabelProps = {
320
+ attributes: UiNodeInputAttributes;
321
+ node: UiNode;
322
+ } & ComponentPropsWithoutRef<"label">;
323
+
324
+ // @public (undocumented)
325
+ export type OryNodeOidcButtonProps = {
326
+ node: UiNode;
327
+ attributes: UiNodeInputAttributes;
328
+ onClick?: () => void;
329
+ };
330
+
331
+ // @public (undocumented)
332
+ export type OryNodeTextProps = {
333
+ attributes: UiNodeTextAttributes;
334
+ node: UiNode;
335
+ };
336
+
337
+ // @public (undocumented)
338
+ export type OryPageHeaderProps = Record<never, never>;
339
+
340
+ // @public (undocumented)
341
+ export function OryProvider({ children, components: Components, ...oryFlowProps }: OryProviderProps): react_jsx_runtime.JSX.Element;
342
+
343
+ // @public (undocumented)
344
+ export type OryProviderProps = {
345
+ components: OryFlowComponents;
346
+ } & OryFlowContainer & PropsWithChildren;
347
+
348
+ // @public (undocumented)
349
+ export function OrySettingsCard(): react_jsx_runtime.JSX.Element;
350
+
351
+ // @public (undocumented)
352
+ export type OrySettingsOidcProps = {
353
+ linkButtons: UiNode[];
354
+ unlinkButtons: UiNode[];
355
+ };
356
+
357
+ // @public (undocumented)
358
+ export type OrySettingsPasskeyProps = {
359
+ triggerButton: UiNode & {
360
+ onClick: () => void;
361
+ };
362
+ removeButtons: UiNode[];
363
+ };
364
+
365
+ // @public (undocumented)
366
+ export type OrySettingsRecoveryCodesProps = {
367
+ codes: string[];
368
+ regnerateButton?: UiNode;
369
+ revealButton?: UiNode;
370
+ };
371
+
372
+ // @public (undocumented)
373
+ export type OrySettingsTotpProps = {
374
+ totpImage: UiNode;
375
+ totpSecret: UiNode;
376
+ totpInput: UiNode;
377
+ } | {
378
+ totpUnlink: UiNode;
379
+ };
380
+
381
+ // @public (undocumented)
382
+ export type OrySettingsWebauthnProps = {
383
+ nameInput: UiNode;
384
+ triggerButton: UiNode & {
385
+ onClick: () => void;
386
+ };
387
+ removeButtons: UiNode[];
388
+ };
389
+
390
+ // @public (undocumented)
391
+ export function OryTwoStepCard(): react_jsx_runtime.JSX.Element;
392
+
393
+ // @public
394
+ export type RecoveryFlowContainer = OryFlow<FlowType.Recovery, RecoveryFlow>;
395
+
396
+ // @public
397
+ export type RegistrationFlowContainer = OryFlow<FlowType.Registration, RegistrationFlow>;
398
+
399
+ // @public
400
+ export type SettingsFlowContainer = OryFlow<FlowType.Settings, SettingsFlow>;
401
+
402
+ // @public
403
+ export const uiTextToFormattedMessage: ({ id, context, text }: Omit<UiText, "type">, intl: IntlShape) => string;
404
+
405
+ // @public (undocumented)
406
+ export function useComponents(): OryFlowComponents;
407
+
408
+ // @public (undocumented)
409
+ export function useNodeSorter(): (a: UiNode, b: UiNode, ctx: {
410
+ flowType: string;
411
+ }) => number;
412
+
413
+ // @public
414
+ export function useOryFlow(): FlowContextValue;
415
+
416
+ // @public
417
+ export type VerificationFlowContainer = OryFlow<FlowType.Verification, VerificationFlow>;
418
+
419
+ // (No @packageDocumentation comment for this package)
420
+
421
+ ```
package/dist/index.js CHANGED
@@ -115,6 +115,7 @@ function findMethodWithMessage(nodes) {
115
115
  });
116
116
  }
117
117
  function parseStateFromFlow(flow) {
118
+ var _a;
118
119
  switch (flow.flowType) {
119
120
  case clientFetch.FlowType.Registration:
120
121
  case clientFetch.FlowType.Login: {
@@ -125,10 +126,12 @@ function parseStateFromFlow(flow) {
125
126
  return { current: "method_active", method: "code" };
126
127
  } else if (methodWithMessage) {
127
128
  return { current: "method_active", method: methodWithMessage.group };
128
- } else if (flow.flow.active && !["default", "identifier_first"].includes(flow.flow.active)) {
129
+ } else if (flow.flow.active && !["default", "identifier_first", "oidc"].includes(flow.flow.active)) {
129
130
  return { current: "method_active", method: flow.flow.active };
130
131
  } else if (isChoosingMethod(flow.flow.ui.nodes)) {
131
132
  return { current: "select_method" };
133
+ } else if ((_a = flow.flow.ui.messages) == null ? void 0 : _a.some((m) => m.id === 1010016)) {
134
+ return { current: "select_method" };
132
135
  }
133
136
  return { current: "provide_identifier" };
134
137
  }
@@ -438,7 +441,8 @@ var en_default = {
438
441
  "settings.passkey.title": "Manage Passkeys",
439
442
  "settings.passkey.description": "Manage your passkey settings",
440
443
  "settings.passkey.info": "Manage your passkey settings",
441
- "card.footer.select-another-method": "Select another method"
444
+ "card.footer.select-another-method": "Select another method",
445
+ "account-linking.title": "Link account"
442
446
  };
443
447
 
444
448
  // src/locales/de.json
@@ -684,7 +688,8 @@ var de_default = {
684
688
  "settings.title-totp": "Verwalten Sie die 2FA TOTP Authenticator-App",
685
689
  "settings.title-webauthn": "Hardware-Token verwalten",
686
690
  "settings.webauthn.info": "Hardware-Tokens werden f\xFCr die Zweitfaktor-Authentifizierung oder als Erstfaktor-Authentifizierung mit Passkeys verwendet",
687
- "card.footer.select-another-method": "Eine andere Methode verwenden"
691
+ "card.footer.select-another-method": "Eine andere Methode verwenden",
692
+ "account-linking.title": "Account Verbinden"
688
693
  };
689
694
 
690
695
  // src/locales/es.json
@@ -930,7 +935,8 @@ var es_default = {
930
935
  "settings.title-totp": "",
931
936
  "settings.title-webauthn": "",
932
937
  "settings.webauthn.info": "",
933
- "card.footer.select-another-method": ""
938
+ "card.footer.select-another-method": "",
939
+ "account-linking.title": ""
934
940
  };
935
941
 
936
942
  // src/locales/fr.json
@@ -1176,7 +1182,8 @@ var fr_default = {
1176
1182
  "settings.webauthn.description": "",
1177
1183
  "settings.webauthn.info": "",
1178
1184
  "settings.webauthn.title": "",
1179
- "card.footer.select-another-method": ""
1185
+ "card.footer.select-another-method": "",
1186
+ "account-linking.title": ""
1180
1187
  };
1181
1188
 
1182
1189
  // src/locales/nl.json
@@ -1422,7 +1429,8 @@ var nl_default = {
1422
1429
  "settings.webauthn.description": "",
1423
1430
  "settings.webauthn.info": "",
1424
1431
  "settings.webauthn.title": "",
1425
- "card.footer.select-another-method": ""
1432
+ "card.footer.select-another-method": "",
1433
+ "account-linking.title": ""
1426
1434
  };
1427
1435
 
1428
1436
  // src/locales/pl.json
@@ -1668,7 +1676,8 @@ var pl_default = {
1668
1676
  "settings.webauthn.description": "",
1669
1677
  "settings.webauthn.info": "",
1670
1678
  "settings.webauthn.title": "",
1671
- "card.footer.select-another-method": ""
1679
+ "card.footer.select-another-method": "",
1680
+ "account-linking.title": ""
1672
1681
  };
1673
1682
 
1674
1683
  // src/locales/pt.json
@@ -1914,7 +1923,8 @@ var pt_default = {
1914
1923
  "settings.webauthn.description": "",
1915
1924
  "settings.webauthn.info": "",
1916
1925
  "settings.webauthn.title": "",
1917
- "card.footer.select-another-method": ""
1926
+ "card.footer.select-another-method": "",
1927
+ "account-linking.title": ""
1918
1928
  };
1919
1929
 
1920
1930
  // src/locales/sv.json
@@ -2160,7 +2170,8 @@ var sv_default = {
2160
2170
  "settings.webauthn.description": "Hantera inst\xE4llningarna f\xF6r din maskinvarutoken",
2161
2171
  "settings.webauthn.info": "H\xE5rdvarutokens anv\xE4nds f\xF6r andrafaktorsautentisering eller som f\xF6rstafaktor med l\xF6senordsnycklar",
2162
2172
  "settings.webauthn.title": "Hantera maskinvarutokens",
2163
- "card.footer.select-another-method": "V\xE4lj en annan metod"
2173
+ "card.footer.select-another-method": "V\xE4lj en annan metod",
2174
+ "account-linking.title": "L\xE4nka ditt konto"
2164
2175
  };
2165
2176
 
2166
2177
  // src/locales/index.ts
@@ -2298,16 +2309,34 @@ async function onSubmitRecovery({ config, flow }, {
2298
2309
  onRedirect(clientFetch.recoveryUrl(config), true);
2299
2310
  },
2300
2311
  onValidationError: (body2) => {
2301
- setFlowContainer({
2302
- flow: body2,
2303
- flowType: clientFetch.FlowType.Recovery,
2304
- config
2305
- });
2312
+ if ("error" in body2) {
2313
+ handleContinueWithRecoveryUIError(body2.error, config, onRedirect);
2314
+ return;
2315
+ } else {
2316
+ setFlowContainer({
2317
+ flow: body2,
2318
+ flowType: clientFetch.FlowType.Recovery,
2319
+ config
2320
+ });
2321
+ }
2306
2322
  },
2307
2323
  onRedirect
2308
2324
  })
2309
2325
  );
2310
2326
  }
2327
+ function handleContinueWithRecoveryUIError(error, config, onRedirect) {
2328
+ if ("continue_with" in error.details && Array.isArray(error.details.continue_with)) {
2329
+ const continueWithRecovery = error.details.continue_with.find(clientFetch.instanceOfContinueWithRecoveryUi);
2330
+ if ((continueWithRecovery == null ? void 0 : continueWithRecovery.action) === "show_recovery_ui") {
2331
+ onRedirect(
2332
+ config.project.recovery_ui_url + "?flow=" + (continueWithRecovery == null ? void 0 : continueWithRecovery.flow.id),
2333
+ false
2334
+ );
2335
+ return;
2336
+ }
2337
+ }
2338
+ onRedirect(clientFetch.recoveryUrl(config), true);
2339
+ }
2311
2340
  async function onSubmitRegistration({ config, flow }, {
2312
2341
  setFlowContainer,
2313
2342
  body,
@@ -2438,20 +2467,22 @@ function computeDefaultValues(nodes) {
2438
2467
  return nodes.reduce((acc, node) => {
2439
2468
  const attrs = node.attributes;
2440
2469
  if (clientFetch.isUiNodeInputAttributes(attrs)) {
2441
- if (attrs.name === "method" || attrs.type === "submit" || typeof attrs.value === "undefined")
2470
+ if (attrs.name === "method" || attrs.type === "submit" || typeof attrs.value === "undefined") {
2442
2471
  return acc;
2443
- const unrolled = unrollTrait({
2444
- name: attrs.name,
2445
- value: attrs.value
2446
- });
2447
- Object.assign(acc, unrolled != null ? unrolled : { [attrs.name]: attrs.value });
2472
+ }
2473
+ return unrollTrait(
2474
+ {
2475
+ name: attrs.name,
2476
+ value: attrs.value
2477
+ },
2478
+ acc
2479
+ );
2448
2480
  }
2449
2481
  return acc;
2450
2482
  }, {});
2451
2483
  }
2452
2484
  function unrollTrait(input, output = {}) {
2453
2485
  const keys = input.name.split(".");
2454
- if (!keys.length) return void 0;
2455
2486
  let current = output;
2456
2487
  keys.forEach((key, index) => {
2457
2488
  if (!key) return;
@@ -2547,8 +2578,10 @@ var NodeInput = ({
2547
2578
  //
2548
2579
  ...attrs
2549
2580
  } = attributes;
2581
+ const isResendNode = ((_a = node.meta.label) == null ? void 0 : _a.id) === 1070008;
2582
+ const isScreenSelectionNode = "name" in node.attributes && node.attributes.name === "screen";
2550
2583
  const setFormValue = () => {
2551
- if (attrs.value) {
2584
+ if (attrs.value && !(isResendNode || isScreenSelectionNode)) {
2552
2585
  setValue(attrs.name, attrs.value);
2553
2586
  }
2554
2587
  };
@@ -2573,8 +2606,6 @@ var NodeInput = ({
2573
2606
  };
2574
2607
  const isSocial = (attrs.name === "provider" || attrs.name === "link") && node.group === "oidc";
2575
2608
  const isPinCodeInput = attrs.name === "code" && node.group === "code" || attrs.name === "totp_code" && node.group === "totp";
2576
- const isResendNode = ((_a = node.meta.label) == null ? void 0 : _a.id) === 1070008;
2577
- const isScreenSelectionNode = "name" in node.attributes && node.attributes.name === "screen";
2578
2609
  switch (attributes.type) {
2579
2610
  case clientFetch.UiNodeInputAttributesTypeEnum.Submit:
2580
2611
  case clientFetch.UiNodeInputAttributesTypeEnum.Button:
@@ -2646,6 +2677,51 @@ function OryFormGroups({ children, groups }) {
2646
2677
  return /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k);
2647
2678
  }) });
2648
2679
  }
2680
+
2681
+ // src/components/form/form-resolver.ts
2682
+ function isCodeResendRequest(data) {
2683
+ var _a;
2684
+ return (_a = data.email) != null ? _a : data.resend;
2685
+ }
2686
+ function useOryFormResolver() {
2687
+ const flowContainer = useOryFlow();
2688
+ return (data) => {
2689
+ if (flowContainer.formState.current === "method_active") {
2690
+ if (data.method === "code" && !data.code && !isCodeResendRequest(data)) {
2691
+ return {
2692
+ values: data,
2693
+ errors: {
2694
+ code: {
2695
+ id: 4000002,
2696
+ context: {
2697
+ property: "code"
2698
+ },
2699
+ type: "error",
2700
+ text: "Property code is missing"
2701
+ }
2702
+ }
2703
+ };
2704
+ }
2705
+ }
2706
+ return {
2707
+ values: data,
2708
+ errors: {}
2709
+ };
2710
+ };
2711
+ }
2712
+ function OryFormProvider({
2713
+ children,
2714
+ nodes
2715
+ }) {
2716
+ const flowContainer = useOryFlow();
2717
+ const defaultNodes = nodes ? flowContainer.flow.ui.nodes.filter((node) => node.group === clientFetch.UiNodeGroupEnum.Default).concat(nodes) : flowContainer.flow.ui.nodes;
2718
+ const methods = reactHookForm.useForm({
2719
+ // TODO: Generify this, so we have typesafety in the submit handler.
2720
+ defaultValues: computeDefaultValues(defaultNodes),
2721
+ resolver: useOryFormResolver()
2722
+ });
2723
+ return /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.FormProvider, { ...methods, children });
2724
+ }
2649
2725
  function OryFormOidcButtons({
2650
2726
  children,
2651
2727
  hideDivider
@@ -2691,7 +2767,7 @@ function OryFormSocialButtonsForm() {
2691
2767
  if (filteredNodes.length === 0) {
2692
2768
  return null;
2693
2769
  }
2694
- return /* @__PURE__ */ jsxRuntime.jsx(OryForm, { children: /* @__PURE__ */ jsxRuntime.jsx(OryFormOidcButtons, {}) });
2770
+ return /* @__PURE__ */ jsxRuntime.jsx(OryFormProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(OryForm, { children: /* @__PURE__ */ jsxRuntime.jsx(OryFormOidcButtons, {}) }) });
2695
2771
  }
2696
2772
  function OryForm({ children, onAfterSubmit }) {
2697
2773
  var _a;
@@ -2841,7 +2917,7 @@ function OryForm({ children, onAfterSubmit }) {
2841
2917
  }
2842
2918
  );
2843
2919
  }
2844
- var messageIdsToHide = [1040009, 1060003, 1080003, 1010014, 1040005];
2920
+ var messageIdsToHide = [1040009, 1060003, 1080003, 1010014, 1040005, 1010016];
2845
2921
  function OryCardValidationMessages({ ...props }) {
2846
2922
  var _a;
2847
2923
  const { flow } = useOryFlow();
@@ -2854,18 +2930,6 @@ function OryCardValidationMessages({ ...props }) {
2854
2930
  }
2855
2931
  return /* @__PURE__ */ jsxRuntime.jsx(Message.Root, { ...props, children: messages == null ? void 0 : messages.map((message) => /* @__PURE__ */ jsxRuntime.jsx(Message.Content, { message }, message.id)) });
2856
2932
  }
2857
- function OryFormProvider({
2858
- children,
2859
- nodes
2860
- }) {
2861
- const flowContainer = useOryFlow();
2862
- const defaultNodes = nodes ? flowContainer.flow.ui.nodes.filter((node) => node.group === clientFetch.UiNodeGroupEnum.Default).concat(nodes) : flowContainer.flow.ui.nodes;
2863
- const methods = reactHookForm.useForm({
2864
- // TODO: Generify this, so we have typesafety in the submit handler.
2865
- defaultValues: computeDefaultValues(defaultNodes)
2866
- });
2867
- return /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.FormProvider, { ...methods, children });
2868
- }
2869
2933
  function OryFormSection({ children, nodes }) {
2870
2934
  const { Card } = useComponents();
2871
2935
  return /* @__PURE__ */ jsxRuntime.jsx(OryFormProvider, { nodes, children: /* @__PURE__ */ jsxRuntime.jsx(OryForm, { children: /* @__PURE__ */ jsxRuntime.jsx(Card.SettingsSection, { children }) }) });