@ory/elements-react 1.0.0-next.17 → 1.0.0-next.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/CHANGELOG.md +23 -0
- package/api-report/elements-react-client.api.json +144 -16
- package/api-report/elements-react-client.api.md +19 -8
- package/api-report/elements-react-theme.api.json +47 -0
- package/api-report/elements-react-theme.api.md +5 -2
- package/api-report/elements-react.api.json +7 -3
- package/api-report/elements-react.api.md +4 -2
- package/api-report/temp/elements-react-client.api.md +19 -8
- package/api-report/temp/elements-react-theme.api.md +5 -2
- package/api-report/temp/elements-react.api.md +4 -2
- package/dist/client/config.d.mts +21 -0
- package/dist/client/config.d.ts +21 -0
- package/dist/client/config.js +77 -0
- package/dist/client/config.js.map +1 -0
- package/dist/client/config.mjs +51 -0
- package/dist/client/config.mjs.map +1 -0
- package/dist/client/frontendClient.d.mts +3 -1
- package/dist/client/frontendClient.d.ts +3 -1
- package/dist/client/frontendClient.js +14 -2
- package/dist/client/frontendClient.js.map +1 -1
- package/dist/client/frontendClient.mjs +14 -2
- package/dist/client/frontendClient.mjs.map +1 -1
- package/dist/client/index.d.mts +3 -1
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +5 -0
- package/dist/client/index.mjs.map +1 -1
- package/dist/client/session-provider.d.mts +62 -0
- package/dist/client/session-provider.d.ts +62 -0
- package/dist/client/session-provider.js +96 -0
- package/dist/client/session-provider.js.map +1 -0
- package/dist/client/session-provider.mjs +71 -0
- package/dist/client/session-provider.mjs.map +1 -0
- package/dist/client/useSession.d.mts +22 -31
- package/dist/client/useSession.d.ts +22 -31
- package/dist/client/useSession.js +7 -49
- package/dist/client/useSession.js.map +1 -1
- package/dist/client/useSession.mjs +8 -49
- package/dist/client/useSession.mjs.map +1 -1
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +46 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -27
- package/dist/index.mjs.map +1 -1
- package/dist/theme/default/index.css +358 -251
- package/dist/theme/default/index.css.map +1 -1
- package/dist/theme/default/index.d.mts +4 -2
- package/dist/theme/default/index.d.ts +4 -2
- package/dist/theme/default/index.js +605 -531
- package/dist/theme/default/index.js.map +1 -1
- package/dist/theme/default/index.mjs +536 -463
- package/dist/theme/default/index.mjs.map +1 -1
- package/jest.config.ts +1 -1
- package/package.json +2 -1
- package/postcss.config.ts +1 -0
- package/tailwind.config.ts +14 -13
- package/tsconfig.json +4 -3
- package/variables-processed.json +385 -187
- package/.eslintrc.js +0 -63
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { UiNodeGroupEnum, isUiNodeInputAttributes, isUiNodeAnchorAttributes, isUiNodeImageAttributes, isUiNodeScriptAttributes, isUiNodeTextAttributes, FlowType,
|
|
2
|
-
import { createContext, useContext,
|
|
1
|
+
import { UiNodeGroupEnum, isUiNodeInputAttributes, isUiNodeAnchorAttributes, isUiNodeImageAttributes, isUiNodeScriptAttributes, isUiNodeTextAttributes, UiNodeInputAttributesTypeEnum, FlowType, Configuration, FrontendApi, handleContinueWith, settingsUrl, handleFlowError, isResponseError, loginUrl, instanceOfContinueWithRecoveryUi, recoveryUrl, verificationUrl, registrationUrl } from '@ory/client-fetch';
|
|
2
|
+
import { createContext, useContext, useRef, useEffect, useState, useReducer, useMemo } from 'react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { useIntl, IntlProvider as IntlProvider$1 } from 'react-intl';
|
|
5
|
-
import {
|
|
5
|
+
import { useForm, FormProvider, useFormContext } from 'react-hook-form';
|
|
6
6
|
|
|
7
7
|
// src/context/component.tsx
|
|
8
8
|
var ComponentContext = createContext({
|
|
@@ -2257,7 +2257,8 @@ async function onSubmitLogin({ config, flow }, {
|
|
|
2257
2257
|
updateLoginFlowBody: body
|
|
2258
2258
|
}).then(() => {
|
|
2259
2259
|
var _a2;
|
|
2260
|
-
window.location.href =
|
|
2260
|
+
window.location.href = // eslint-disable-next-line promise/always-return
|
|
2261
|
+
(_a2 = flow.return_to) != null ? _a2 : config.sdk.url + "/self-service/login/browser";
|
|
2261
2262
|
}).catch(
|
|
2262
2263
|
handleFlowError({
|
|
2263
2264
|
onRestartFlow: () => {
|
|
@@ -2465,6 +2466,9 @@ function computeDefaultValues(nodes) {
|
|
|
2465
2466
|
return nodes.reduce((acc, node) => {
|
|
2466
2467
|
const attrs = node.attributes;
|
|
2467
2468
|
if (isUiNodeInputAttributes(attrs)) {
|
|
2469
|
+
if (attrs.type === "checkbox" && typeof attrs.value === "undefined") {
|
|
2470
|
+
attrs.value = false;
|
|
2471
|
+
}
|
|
2468
2472
|
if (attrs.name === "method" || attrs.type === "submit" || typeof attrs.value === "undefined") {
|
|
2469
2473
|
return acc;
|
|
2470
2474
|
}
|
|
@@ -2517,19 +2521,19 @@ function triggerToWindowCall(trigger) {
|
|
|
2517
2521
|
}
|
|
2518
2522
|
function triggerToFunction(trigger) {
|
|
2519
2523
|
if (typeof window === "undefined") {
|
|
2520
|
-
console.
|
|
2524
|
+
console.debug(
|
|
2521
2525
|
"The Ory SDK is missing a required function: window is undefined."
|
|
2522
2526
|
);
|
|
2523
2527
|
return void 0;
|
|
2524
2528
|
}
|
|
2525
2529
|
const typedWindow = window;
|
|
2526
2530
|
if (!(trigger in typedWindow) || !typedWindow[trigger]) {
|
|
2527
|
-
console.
|
|
2531
|
+
console.debug(`The Ory SDK is missing a required function: ${trigger}.`);
|
|
2528
2532
|
return void 0;
|
|
2529
2533
|
}
|
|
2530
2534
|
const triggerFn = typedWindow[trigger];
|
|
2531
2535
|
if (typeof triggerFn !== "function") {
|
|
2532
|
-
console.
|
|
2536
|
+
console.debug(
|
|
2533
2537
|
`The Ory SDK is missing a required function: ${trigger}. It is not a function.`
|
|
2534
2538
|
);
|
|
2535
2539
|
return void 0;
|
|
@@ -3103,7 +3107,12 @@ function OrySettingsOidc({ nodes }) {
|
|
|
3103
3107
|
)
|
|
3104
3108
|
}
|
|
3105
3109
|
),
|
|
3106
|
-
/* @__PURE__ */ jsx(
|
|
3110
|
+
/* @__PURE__ */ jsx(
|
|
3111
|
+
Card.SettingsSectionFooter,
|
|
3112
|
+
{
|
|
3113
|
+
text: intl.formatMessage({ id: "settings.oidc.info" })
|
|
3114
|
+
}
|
|
3115
|
+
)
|
|
3107
3116
|
] });
|
|
3108
3117
|
}
|
|
3109
3118
|
var getTriggerNode = (nodes) => nodes.find(
|
|
@@ -3160,7 +3169,12 @@ function OrySettingsPasskey({ nodes }) {
|
|
|
3160
3169
|
]
|
|
3161
3170
|
}
|
|
3162
3171
|
),
|
|
3163
|
-
/* @__PURE__ */ jsx(
|
|
3172
|
+
/* @__PURE__ */ jsx(
|
|
3173
|
+
Card.SettingsSectionFooter,
|
|
3174
|
+
{
|
|
3175
|
+
text: intl.formatMessage({ id: "settings.passkey.info" })
|
|
3176
|
+
}
|
|
3177
|
+
)
|
|
3164
3178
|
] });
|
|
3165
3179
|
}
|
|
3166
3180
|
var getRegenerateNode = (nodes) => nodes.find(
|
|
@@ -3245,16 +3259,19 @@ function OrySettingsTotp({ nodes }) {
|
|
|
3245
3259
|
children: content
|
|
3246
3260
|
}
|
|
3247
3261
|
),
|
|
3248
|
-
/* @__PURE__ */
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3262
|
+
/* @__PURE__ */ jsx(
|
|
3263
|
+
Card.SettingsSectionFooter,
|
|
3264
|
+
{
|
|
3265
|
+
text: totpUnlink ? intl.formatMessage({ id: "settings.totp.info.linked" }) : intl.formatMessage({ id: "settings.totp.info.not-linked" }),
|
|
3266
|
+
children: totpLinkButton && /* @__PURE__ */ jsx(
|
|
3267
|
+
Node2.Button,
|
|
3268
|
+
{
|
|
3269
|
+
node: totpLinkButton,
|
|
3270
|
+
attributes: totpLinkButton.attributes
|
|
3271
|
+
}
|
|
3272
|
+
)
|
|
3273
|
+
}
|
|
3274
|
+
)
|
|
3258
3275
|
] });
|
|
3259
3276
|
}
|
|
3260
3277
|
var getInputNode = (nodes) => nodes.find(
|
|
@@ -3266,9 +3283,6 @@ var getTriggerNode2 = (nodes) => nodes.find(
|
|
|
3266
3283
|
var getRemoveButtons = (nodes) => nodes.filter(
|
|
3267
3284
|
(node) => "name" in node.attributes && node.attributes.name === "webauthn_remove"
|
|
3268
3285
|
);
|
|
3269
|
-
var getScriptNode = (nodes) => nodes.find(
|
|
3270
|
-
(node) => "id" in node.attributes && node.attributes.id === "webauthn_script"
|
|
3271
|
-
);
|
|
3272
3286
|
var getRegisterNode = (nodes) => nodes.find(
|
|
3273
3287
|
(node) => "name" in node.attributes && node.attributes.name === "webauthn_register"
|
|
3274
3288
|
);
|
|
@@ -3281,7 +3295,6 @@ function OrySettingsWebauthn({ nodes }) {
|
|
|
3281
3295
|
const triggerButton = getTriggerNode2(nodes);
|
|
3282
3296
|
const inputNode = getInputNode(nodes);
|
|
3283
3297
|
const removeButtons = getRemoveButtons(nodes);
|
|
3284
|
-
const scriptNode = getScriptNode(nodes);
|
|
3285
3298
|
const registerNode = getRegisterNode(nodes);
|
|
3286
3299
|
if (!inputNode || !triggerButton) {
|
|
3287
3300
|
return null;
|
|
@@ -3304,8 +3317,6 @@ function OrySettingsWebauthn({ nodes }) {
|
|
|
3304
3317
|
}),
|
|
3305
3318
|
children: [
|
|
3306
3319
|
(_a = groups.default) == null ? void 0 : _a.map((node, i) => /* @__PURE__ */ jsx(Node, { node }, `webauthn-default-${i}`)),
|
|
3307
|
-
scriptNode && /* @__PURE__ */ jsx(Node, { node: scriptNode }),
|
|
3308
|
-
registerNode && /* @__PURE__ */ jsx(Node, { node: registerNode }),
|
|
3309
3320
|
/* @__PURE__ */ jsx(
|
|
3310
3321
|
Form.WebauthnSettings,
|
|
3311
3322
|
{
|
|
@@ -3317,11 +3328,17 @@ function OrySettingsWebauthn({ nodes }) {
|
|
|
3317
3328
|
},
|
|
3318
3329
|
removeButtons
|
|
3319
3330
|
}
|
|
3320
|
-
)
|
|
3331
|
+
),
|
|
3332
|
+
registerNode && /* @__PURE__ */ jsx(Node, { node: registerNode })
|
|
3321
3333
|
]
|
|
3322
3334
|
}
|
|
3323
3335
|
),
|
|
3324
|
-
/* @__PURE__ */ jsx(
|
|
3336
|
+
/* @__PURE__ */ jsx(
|
|
3337
|
+
Card.SettingsSectionFooter,
|
|
3338
|
+
{
|
|
3339
|
+
text: intl.formatMessage({ id: "settings.webauthn.info" })
|
|
3340
|
+
}
|
|
3341
|
+
)
|
|
3325
3342
|
] });
|
|
3326
3343
|
}
|
|
3327
3344
|
function SettingsSectionContent({ group, nodes }) {
|
|
@@ -3373,11 +3390,16 @@ function SettingsSectionContent({ group, nodes }) {
|
|
|
3373
3390
|
).map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k)) })
|
|
3374
3391
|
] });
|
|
3375
3392
|
}
|
|
3393
|
+
var getScriptNode = (nodes) => nodes.find(
|
|
3394
|
+
(node) => "id" in node.attributes && node.attributes.id === "webauthn_script"
|
|
3395
|
+
);
|
|
3376
3396
|
function OrySettingsCard() {
|
|
3377
3397
|
const { flow } = useOryFlow();
|
|
3378
3398
|
const uniqueGroups = useNodesGroups(flow.ui.nodes);
|
|
3399
|
+
const scriptNode = getScriptNode(flow.ui.nodes);
|
|
3379
3400
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3380
3401
|
/* @__PURE__ */ jsx(OryCardValidationMessages, {}),
|
|
3402
|
+
scriptNode && /* @__PURE__ */ jsx(Node, { node: scriptNode }),
|
|
3381
3403
|
uniqueGroups.entries.map(([group, nodes]) => {
|
|
3382
3404
|
if (group === UiNodeGroupEnum.Default) {
|
|
3383
3405
|
return null;
|