@ory/elements-react 0.0.0-pr.8e964fc1
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 +404 -0
- package/DEVELOPMENT.md +79 -0
- package/LICENSE +201 -0
- package/README.md +254 -0
- 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 +7 -0
- package/dist/client/frontendClient.d.ts +7 -0
- package/dist/client/frontendClient.js +52 -0
- package/dist/client/frontendClient.js.map +1 -0
- package/dist/client/frontendClient.mjs +31 -0
- package/dist/client/frontendClient.mjs.map +1 -0
- package/dist/client/index.d.mts +5 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js +33 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/index.mjs +10 -0
- package/dist/client/index.mjs.map +1 -0
- 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 +32 -0
- package/dist/client/useSession.d.ts +32 -0
- package/dist/client/useSession.js +37 -0
- package/dist/client/useSession.js.map +1 -0
- package/dist/client/useSession.mjs +13 -0
- package/dist/client/useSession.mjs.map +1 -0
- package/dist/index.d.mts +585 -0
- package/dist/index.d.ts +585 -0
- package/dist/index.js +3741 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3719 -0
- package/dist/index.mjs.map +1 -0
- package/dist/theme/default/index.css +1510 -0
- package/dist/theme/default/index.css.map +1 -0
- package/dist/theme/default/index.d.mts +78 -0
- package/dist/theme/default/index.d.ts +78 -0
- package/dist/theme/default/index.js +2576 -0
- package/dist/theme/default/index.js.map +1 -0
- package/dist/theme/default/index.mjs +2571 -0
- package/dist/theme/default/index.mjs.map +1 -0
- package/dist/theme/default/tailwind/defaults.d.mts +737 -0
- package/dist/theme/default/tailwind/defaults.d.ts +737 -0
- package/dist/theme/default/tailwind/defaults.js +219 -0
- package/dist/theme/default/tailwind/defaults.js.map +1 -0
- package/dist/theme/default/tailwind/defaults.mjs +196 -0
- package/dist/theme/default/tailwind/defaults.mjs.map +1 -0
- package/package.json +90 -0
- package/tailwind/defaults.ts +34 -0
- package/tailwind/generated/README.md +2 -0
- package/tailwind/generated/default-variables.css +216 -0
- package/tailwind/generated/variables-processed.json +161 -0
- package/tsconfig.json +35 -0
- package/tsconfig.runtime.json +4 -0
|
@@ -0,0 +1,2571 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
// src/theme/default/assets/ory-badge-horizontal.svg
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var SvgOryBadgeHorizontal = (props) => {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, fill: "none", ...props, children: [
|
|
9
|
+
/* @__PURE__ */ jsx("path", { fill: "#0F172A", d: "M18.007 8h-1.71l2.007-3.996L16.296 0h1.711l1.145 2.301L20.327 0H22z" }),
|
|
10
|
+
/* @__PURE__ */ jsx("path", { fill: "#0F172A", fillRule: "evenodd", d: "M12.902 4.86a2.47 2.47 0 0 0 1.796-2.365v-.038C14.687 1.097 13.592 0 12.245 0H9.037v1.44l1.208 1.985H9.04V8h1.51V4.949h.633L13.04 8h1.775zm-.876-1.431h.223c.52 0 .943-.427.943-.953a.95.95 0 0 0-.943-.952h-1.39zM4 0a4 4 0 1 0-.001 7.999A4 4 0 0 0 4 0M1.524 4a2.476 2.476 0 1 0 4.952 0 2.476 2.476 0 0 0-4.952 0", clipRule: "evenodd" })
|
|
11
|
+
] });
|
|
12
|
+
};
|
|
13
|
+
var ory_badge_horizontal_default = SvgOryBadgeHorizontal;
|
|
14
|
+
|
|
15
|
+
// src/theme/default/assets/ory-badge-vertical.svg
|
|
16
|
+
import * as React2 from "react";
|
|
17
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
18
|
+
var SvgOryBadgeVertical = (props) => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return /* @__PURE__ */ jsxs2("svg", { xmlns: "http://www.w3.org/2000/svg", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, fill: "none", ...props, children: [
|
|
21
|
+
/* @__PURE__ */ jsx2("path", { fill: "#0F172A", d: "M8 3.993v1.71L4.004 3.697 0 5.704V3.993l2.301-1.145L0 1.673V0z" }),
|
|
22
|
+
/* @__PURE__ */ jsx2("path", { fill: "#0F172A", fillRule: "evenodd", d: "M4.86 9.099a2.47 2.47 0 0 0-2.365-1.797h-.038C1.097 7.313 0 8.408 0 9.755v3.208h1.44l1.985-1.208v1.204H8v-1.51H4.949v-.633L8 8.96V7.185zm-1.431.875v-.223a.95.95 0 0 0-.953-.943.95.95 0 0 0-.952.943v1.39zM0 18a4 4 0 1 0 8 0 4 4 0 0 0-8 0m4 2.476a2.476 2.476 0 1 0 0-4.952 2.476 2.476 0 0 0 0 4.952", clipRule: "evenodd" })
|
|
23
|
+
] });
|
|
24
|
+
};
|
|
25
|
+
var ory_badge_vertical_default = SvgOryBadgeVertical;
|
|
26
|
+
|
|
27
|
+
// src/theme/default/components/card/badge.tsx
|
|
28
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
29
|
+
function Badge() {
|
|
30
|
+
return /* @__PURE__ */ jsxs3("div", { className: "absolute bg-ory-background-default p-2 font-bold max-sm:bottom-0 max-sm:left-8 max-sm:translate-y-full max-sm:rounded-b-branding sm:right-0 sm:top-8 sm:translate-x-full sm:rounded-r-branding border-ory-border-default border max-sm:py-[7px] sm:pl-[7px]", children: [
|
|
31
|
+
/* @__PURE__ */ jsx3(ory_badge_horizontal_default, { width: 22, height: 8, className: "sm:hidden" }),
|
|
32
|
+
/* @__PURE__ */ jsx3(ory_badge_vertical_default, { width: 8, height: 22, className: "max-sm:hidden" })
|
|
33
|
+
] });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/theme/default/components/card/content.tsx
|
|
37
|
+
function DefaultCardContent({ children }) {
|
|
38
|
+
return children;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/theme/default/components/card/footer.tsx
|
|
42
|
+
import { FlowType } from "@ory/client-fetch";
|
|
43
|
+
import { useOryFlow } from "@ory/elements-react";
|
|
44
|
+
import { useFormContext } from "react-hook-form";
|
|
45
|
+
import { useIntl } from "react-intl";
|
|
46
|
+
|
|
47
|
+
// src/theme/default/utils/url.ts
|
|
48
|
+
function restartFlowUrl(flow, fallback) {
|
|
49
|
+
return flow.request_url || appendReturnTo(fallback, flow.return_to);
|
|
50
|
+
}
|
|
51
|
+
function initFlowUrl(sdkUrl, flowType, flow) {
|
|
52
|
+
const result = `${sdkUrl}/self-service/${flowType}/browser`;
|
|
53
|
+
const qs = new URLSearchParams();
|
|
54
|
+
if (flow.oauth2_login_challenge) {
|
|
55
|
+
qs.set("login_challenge", flow.oauth2_login_challenge);
|
|
56
|
+
}
|
|
57
|
+
if (flow.return_to) {
|
|
58
|
+
qs.set("return_to", flow.return_to);
|
|
59
|
+
} else if (typeof window !== "undefined") {
|
|
60
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
61
|
+
if (searchParams.has("return_to")) {
|
|
62
|
+
qs.set("return_to", searchParams.get("return_to") || "");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (qs.toString().length === 0) {
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
return result + "?" + qs.toString();
|
|
69
|
+
}
|
|
70
|
+
function appendReturnTo(url, returnTo) {
|
|
71
|
+
if (!returnTo) {
|
|
72
|
+
return url;
|
|
73
|
+
}
|
|
74
|
+
const urlObj = new URL(url);
|
|
75
|
+
urlObj.searchParams.set("return_to", returnTo);
|
|
76
|
+
return urlObj.toString();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// src/theme/default/components/card/footer.tsx
|
|
80
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
81
|
+
function DefaultCardFooter() {
|
|
82
|
+
const { flowType } = useOryFlow();
|
|
83
|
+
switch (flowType) {
|
|
84
|
+
case FlowType.Login:
|
|
85
|
+
return /* @__PURE__ */ jsx4(LoginCardFooter, {});
|
|
86
|
+
case FlowType.Registration:
|
|
87
|
+
return /* @__PURE__ */ jsx4(RegistrationCardFooter, {});
|
|
88
|
+
case FlowType.Recovery:
|
|
89
|
+
return /* @__PURE__ */ jsx4(RecoveryCardFooter, {});
|
|
90
|
+
case FlowType.Verification:
|
|
91
|
+
return /* @__PURE__ */ jsx4(VerificationCardFooter, {});
|
|
92
|
+
default:
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function LoginCardFooter() {
|
|
97
|
+
const { config, formState, flow } = useOryFlow();
|
|
98
|
+
const intl = useIntl();
|
|
99
|
+
if (!config.project.registration_enabled || formState.current !== "provide_identifier") {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
return /* @__PURE__ */ jsxs4("span", { className: "font-normal leading-normal antialiased text-interface-foreground-default-primary", children: [
|
|
103
|
+
intl.formatMessage({
|
|
104
|
+
id: "login.registration-label",
|
|
105
|
+
defaultMessage: "No account?"
|
|
106
|
+
}),
|
|
107
|
+
" ",
|
|
108
|
+
/* @__PURE__ */ jsx4(
|
|
109
|
+
"a",
|
|
110
|
+
{
|
|
111
|
+
className: "text-button-link-brand-brand transition-colors hover:text-button-link-brand-brand-hover underline",
|
|
112
|
+
href: initFlowUrl(config.sdk.url, "registration", flow),
|
|
113
|
+
"data-testid": "ory/screen/registration/action/login",
|
|
114
|
+
children: intl.formatMessage({
|
|
115
|
+
id: "login.registration-button",
|
|
116
|
+
defaultMessage: "Sign up"
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
] });
|
|
121
|
+
}
|
|
122
|
+
function findScreenSelectionButton(nodes) {
|
|
123
|
+
return nodes.find(
|
|
124
|
+
(node) => node.attributes.node_type === "input" && node.attributes.type === "submit" && node.attributes.name === "screen"
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
function RegistrationCardFooter() {
|
|
128
|
+
const intl = useIntl();
|
|
129
|
+
const { config, flow, formState } = useOryFlow();
|
|
130
|
+
const { setValue } = useFormContext();
|
|
131
|
+
if (formState.current === "select_method") {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
const screenSelectionNode = findScreenSelectionButton(flow.ui.nodes);
|
|
135
|
+
function handleScreenSelection() {
|
|
136
|
+
setValue("method", "profile");
|
|
137
|
+
if (screenSelectionNode) {
|
|
138
|
+
setValue("screen", "credential-selection");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return /* @__PURE__ */ jsx4("span", { className: "font-normal leading-normal antialiased", children: formState.current === "method_active" ? /* @__PURE__ */ jsx4(Fragment, { children: screenSelectionNode && /* @__PURE__ */ jsx4(
|
|
142
|
+
"button",
|
|
143
|
+
{
|
|
144
|
+
className: "font-medium text-button-link-brand-brand hover:text-button-link-brand-brand-hover",
|
|
145
|
+
type: "submit",
|
|
146
|
+
onClick: handleScreenSelection,
|
|
147
|
+
children: intl.formatMessage({
|
|
148
|
+
id: "card.footer.select-another-method",
|
|
149
|
+
defaultMessage: "Select another method"
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
) }) : /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
153
|
+
intl.formatMessage({
|
|
154
|
+
id: "registration.login-label",
|
|
155
|
+
defaultMessage: "Already have an account?"
|
|
156
|
+
}),
|
|
157
|
+
" ",
|
|
158
|
+
/* @__PURE__ */ jsx4(
|
|
159
|
+
"a",
|
|
160
|
+
{
|
|
161
|
+
className: "text-button-link-brand-brand transition-colors hover:text-button-link-brand-brand-hover underline",
|
|
162
|
+
href: initFlowUrl(config.sdk.url, "login", flow),
|
|
163
|
+
"data-testid": "ory/screen/registration/action/login",
|
|
164
|
+
children: intl.formatMessage({
|
|
165
|
+
id: "registration.login-button",
|
|
166
|
+
defaultMessage: "Sign in"
|
|
167
|
+
})
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
] }) });
|
|
171
|
+
}
|
|
172
|
+
function RecoveryCardFooter() {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
function VerificationCardFooter() {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// src/theme/default/components/card/header.tsx
|
|
180
|
+
import { useComponents, useOryFlow as useOryFlow3 } from "@ory/elements-react";
|
|
181
|
+
|
|
182
|
+
// src/theme/default/utils/constructCardHeader.ts
|
|
183
|
+
import {
|
|
184
|
+
FlowType as FlowType2,
|
|
185
|
+
isUiNodeInputAttributes
|
|
186
|
+
} from "@ory/client-fetch";
|
|
187
|
+
import { useIntl as useIntl2 } from "react-intl";
|
|
188
|
+
function joinWithCommaOr(list, orText = "or") {
|
|
189
|
+
if (list.length === 0) {
|
|
190
|
+
return ".";
|
|
191
|
+
} else if (list.length === 1) {
|
|
192
|
+
return list[0];
|
|
193
|
+
} else {
|
|
194
|
+
const last = list.pop();
|
|
195
|
+
return `${list.join(", ")} ${orText} ${last}`;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function useCardHeaderText(container, opts) {
|
|
199
|
+
var _a, _b;
|
|
200
|
+
const nodes = container.nodes;
|
|
201
|
+
const intl = useIntl2();
|
|
202
|
+
switch (opts.flowType) {
|
|
203
|
+
case FlowType2.Recovery:
|
|
204
|
+
if (nodes.find(
|
|
205
|
+
(node) => "name" in node.attributes && node.attributes.name === "code"
|
|
206
|
+
)) {
|
|
207
|
+
return {
|
|
208
|
+
title: intl.formatMessage({
|
|
209
|
+
id: "recovery.title"
|
|
210
|
+
}),
|
|
211
|
+
description: intl.formatMessage({
|
|
212
|
+
id: "identities.messages.1060003"
|
|
213
|
+
})
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
title: intl.formatMessage({
|
|
218
|
+
id: "recovery.title"
|
|
219
|
+
}),
|
|
220
|
+
description: intl.formatMessage({
|
|
221
|
+
id: "recovery.subtitle"
|
|
222
|
+
})
|
|
223
|
+
};
|
|
224
|
+
case FlowType2.Settings:
|
|
225
|
+
return {
|
|
226
|
+
title: intl.formatMessage({
|
|
227
|
+
id: "settings.title"
|
|
228
|
+
}),
|
|
229
|
+
description: intl.formatMessage({
|
|
230
|
+
id: "settings.subtitle"
|
|
231
|
+
})
|
|
232
|
+
};
|
|
233
|
+
case FlowType2.Verification:
|
|
234
|
+
if (nodes.find(
|
|
235
|
+
(node) => "name" in node.attributes && node.attributes.name === "code"
|
|
236
|
+
)) {
|
|
237
|
+
return {
|
|
238
|
+
title: intl.formatMessage({
|
|
239
|
+
id: "verification.title"
|
|
240
|
+
}),
|
|
241
|
+
description: intl.formatMessage({
|
|
242
|
+
id: "identities.messages.1080003"
|
|
243
|
+
})
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
title: intl.formatMessage({
|
|
248
|
+
id: "verification.title"
|
|
249
|
+
}),
|
|
250
|
+
description: intl.formatMessage({
|
|
251
|
+
id: "verification.subtitle"
|
|
252
|
+
})
|
|
253
|
+
};
|
|
254
|
+
case FlowType2.Login: {
|
|
255
|
+
const accountLinkingMessage = (_a = container.messages) == null ? void 0 : _a.find(
|
|
256
|
+
(m) => m.id === 1010016
|
|
257
|
+
);
|
|
258
|
+
if (accountLinkingMessage) {
|
|
259
|
+
return {
|
|
260
|
+
title: intl.formatMessage({
|
|
261
|
+
id: "account-linking.title"
|
|
262
|
+
}),
|
|
263
|
+
description: intl.formatMessage(
|
|
264
|
+
{
|
|
265
|
+
id: "identities.messages.1010016"
|
|
266
|
+
},
|
|
267
|
+
accountLinkingMessage.context
|
|
268
|
+
)
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
const parts = [];
|
|
274
|
+
if (nodes.find((node) => node.group === "password")) {
|
|
275
|
+
switch (opts.flowType) {
|
|
276
|
+
case FlowType2.Registration:
|
|
277
|
+
parts.push(
|
|
278
|
+
intl.formatMessage(
|
|
279
|
+
{ id: "card.header.parts.password.registration" },
|
|
280
|
+
// TODO: make this generic for other labels
|
|
281
|
+
{ identifierLabel: "email" }
|
|
282
|
+
)
|
|
283
|
+
);
|
|
284
|
+
break;
|
|
285
|
+
default:
|
|
286
|
+
parts.push(
|
|
287
|
+
intl.formatMessage(
|
|
288
|
+
{ id: "card.header.parts.password.login" },
|
|
289
|
+
// TODO: make this generic for other labels
|
|
290
|
+
{ identifierLabel: "email" }
|
|
291
|
+
)
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (nodes.find((node) => node.group === "oidc")) {
|
|
296
|
+
parts.push(
|
|
297
|
+
intl.formatMessage({
|
|
298
|
+
id: "card.header.parts.oidc"
|
|
299
|
+
})
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
if (nodes.find((node) => node.group === "code")) {
|
|
303
|
+
parts.push(intl.formatMessage({ id: "card.header.parts.code" }));
|
|
304
|
+
}
|
|
305
|
+
if (nodes.find((node) => node.group === "passkey")) {
|
|
306
|
+
parts.push(intl.formatMessage({ id: "card.header.parts.passkey" }));
|
|
307
|
+
}
|
|
308
|
+
if (nodes.find((node) => node.group === "webauthn")) {
|
|
309
|
+
parts.push(intl.formatMessage({ id: "card.header.parts.webauthn" }));
|
|
310
|
+
}
|
|
311
|
+
if (nodes.find((node) => node.group === "identifier_first")) {
|
|
312
|
+
const identifier = nodes.find(
|
|
313
|
+
(node) => isUiNodeInputAttributes(node.attributes) && node.attributes.name.startsWith("identifier") && node.attributes.type !== "hidden"
|
|
314
|
+
);
|
|
315
|
+
if (identifier) {
|
|
316
|
+
parts.push(
|
|
317
|
+
intl.formatMessage(
|
|
318
|
+
{
|
|
319
|
+
id: "card.header.parts.identifier-first"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
identifierLabel: (_b = identifier.meta.label) == null ? void 0 : _b.text
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
switch (opts.flowType) {
|
|
329
|
+
case FlowType2.Login:
|
|
330
|
+
if (opts.flow.refresh) {
|
|
331
|
+
return {
|
|
332
|
+
title: intl.formatMessage({
|
|
333
|
+
id: "login.title-refresh"
|
|
334
|
+
}),
|
|
335
|
+
description: intl.formatMessage(
|
|
336
|
+
{
|
|
337
|
+
id: "login.subtitle-refresh"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
parts: joinWithCommaOr(parts)
|
|
341
|
+
}
|
|
342
|
+
)
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
return {
|
|
346
|
+
title: intl.formatMessage({
|
|
347
|
+
id: "login.title"
|
|
348
|
+
}),
|
|
349
|
+
description: parts.length > 0 ? intl.formatMessage(
|
|
350
|
+
{
|
|
351
|
+
id: "login.subtitle"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
parts: joinWithCommaOr(
|
|
355
|
+
parts,
|
|
356
|
+
intl.formatMessage({ id: "misc.or" })
|
|
357
|
+
)
|
|
358
|
+
}
|
|
359
|
+
) : ""
|
|
360
|
+
};
|
|
361
|
+
case FlowType2.Registration:
|
|
362
|
+
return {
|
|
363
|
+
title: intl.formatMessage({
|
|
364
|
+
id: "registration.title"
|
|
365
|
+
}),
|
|
366
|
+
description: parts.length > 0 ? intl.formatMessage(
|
|
367
|
+
{
|
|
368
|
+
id: "registration.subtitle"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
parts: joinWithCommaOr(
|
|
372
|
+
parts,
|
|
373
|
+
intl.formatMessage({ id: "misc.or" })
|
|
374
|
+
)
|
|
375
|
+
}
|
|
376
|
+
) : ""
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
return {
|
|
380
|
+
title: "Error",
|
|
381
|
+
description: "An error occurred"
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// src/theme/default/components/card/current-identifier-button.tsx
|
|
386
|
+
import { FlowType as FlowType3 } from "@ory/client-fetch";
|
|
387
|
+
import { useOryFlow as useOryFlow2 } from "@ory/elements-react";
|
|
388
|
+
|
|
389
|
+
// src/theme/default/assets/icons/arrow-left.svg
|
|
390
|
+
import * as React3 from "react";
|
|
391
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
392
|
+
var SvgArrowLeft = (props) => {
|
|
393
|
+
var _a, _b;
|
|
394
|
+
return /* @__PURE__ */ jsx5("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 25", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: /* @__PURE__ */ jsx5("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M5 12.325h14m-14 0 6 6m-6-6 6-6" }) });
|
|
395
|
+
};
|
|
396
|
+
var arrow_left_default = SvgArrowLeft;
|
|
397
|
+
|
|
398
|
+
// src/theme/default/utils/attributes.ts
|
|
399
|
+
function omit(obj, keys) {
|
|
400
|
+
const ret = { ...obj };
|
|
401
|
+
for (const key of keys) {
|
|
402
|
+
delete ret[key];
|
|
403
|
+
}
|
|
404
|
+
return ret;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// src/theme/default/components/card/current-identifier-button.tsx
|
|
408
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
409
|
+
function DefaultCurrentIdentifierButton() {
|
|
410
|
+
const { flow, flowType, config, formState } = useOryFlow2();
|
|
411
|
+
const ui = flow.ui;
|
|
412
|
+
if (formState.current === "provide_identifier") {
|
|
413
|
+
return null;
|
|
414
|
+
}
|
|
415
|
+
const nodeBackButton = getBackButtonNode(flowType, ui.nodes);
|
|
416
|
+
if ((nodeBackButton == null ? void 0 : nodeBackButton.attributes.node_type) !== "input" || !nodeBackButton.attributes.value) {
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
const initFlowUrl2 = restartFlowUrl(
|
|
420
|
+
flow,
|
|
421
|
+
`${config.sdk.url}/self-service/${flowType}/browser`
|
|
422
|
+
);
|
|
423
|
+
const attributes = omit(nodeBackButton.attributes, [
|
|
424
|
+
"autocomplete",
|
|
425
|
+
"node_type",
|
|
426
|
+
"maxlength"
|
|
427
|
+
]);
|
|
428
|
+
return /* @__PURE__ */ jsx6(
|
|
429
|
+
"a",
|
|
430
|
+
{
|
|
431
|
+
className: "group inline-flex max-w-full cursor-pointer items-center gap-1 self-start rounded-identifier border px-[11px] py-[5px] transition-colors border-button-identifier-border-border-default bg-button-identifier-background-default hover:border-button-identifier-border-border-hover hover:bg-button-identifier-background-hover",
|
|
432
|
+
...attributes,
|
|
433
|
+
href: initFlowUrl2,
|
|
434
|
+
title: `Adjust ${nodeBackButton == null ? void 0 : nodeBackButton.attributes.value}`,
|
|
435
|
+
"data-testid": "ory/screen/login/action/restart",
|
|
436
|
+
children: /* @__PURE__ */ jsxs5("span", { className: "inline-flex min-h-5 items-center gap-2 overflow-hidden text-ellipsis", children: [
|
|
437
|
+
/* @__PURE__ */ jsx6(
|
|
438
|
+
arrow_left_default,
|
|
439
|
+
{
|
|
440
|
+
size: 16,
|
|
441
|
+
stroke: "1",
|
|
442
|
+
className: "shrink-0 text-button-identifier-foreground-default group-hover:text-button-identifier-foreground-hover"
|
|
443
|
+
}
|
|
444
|
+
),
|
|
445
|
+
/* @__PURE__ */ jsx6("span", { className: "overflow-hidden text-ellipsis text-nowrap text-sm font-medium text-button-identifier-foreground-default group-hover:text-button-identifier-foreground-hover", children: nodeBackButton == null ? void 0 : nodeBackButton.attributes.value })
|
|
446
|
+
] })
|
|
447
|
+
}
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
function getBackButtonNode(flowType, nodes) {
|
|
451
|
+
let nodeBackButton;
|
|
452
|
+
switch (flowType) {
|
|
453
|
+
case FlowType3.Login:
|
|
454
|
+
nodeBackButton = nodes.find(
|
|
455
|
+
(node) => "name" in node.attributes && node.attributes.name === "identifier" && ["default", "identifier_first"].includes(node.group)
|
|
456
|
+
);
|
|
457
|
+
break;
|
|
458
|
+
case FlowType3.Registration:
|
|
459
|
+
nodeBackButton = guessRegistrationBackButton(nodes);
|
|
460
|
+
break;
|
|
461
|
+
case FlowType3.Recovery:
|
|
462
|
+
case FlowType3.Verification:
|
|
463
|
+
nodeBackButton = nodes.find(
|
|
464
|
+
(n) => "name" in n.attributes && n.attributes.name === "email"
|
|
465
|
+
);
|
|
466
|
+
break;
|
|
467
|
+
}
|
|
468
|
+
return nodeBackButton;
|
|
469
|
+
}
|
|
470
|
+
var backButtonCandiates = [
|
|
471
|
+
"traits.email",
|
|
472
|
+
"traits.username",
|
|
473
|
+
"traits.phone_number"
|
|
474
|
+
];
|
|
475
|
+
function guessRegistrationBackButton(uiNodes) {
|
|
476
|
+
return uiNodes.find(
|
|
477
|
+
(node) => "name" in node.attributes && backButtonCandiates.includes(node.attributes.name) && node.group === "default"
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// src/theme/default/components/card/header.tsx
|
|
482
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
483
|
+
function InnerCardHeader({ title, text }) {
|
|
484
|
+
const { Card } = useComponents();
|
|
485
|
+
return /* @__PURE__ */ jsxs6("header", { className: "flex flex-col gap-8 antialiased", children: [
|
|
486
|
+
/* @__PURE__ */ jsx7(Card.Logo, {}),
|
|
487
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-2", children: [
|
|
488
|
+
/* @__PURE__ */ jsx7("h2", { className: "text-lg font-semibold leading-normal text-interface-foreground-default-primary", children: title }),
|
|
489
|
+
/* @__PURE__ */ jsx7("p", { className: "leading-normal text-interface-foreground-default-secondary", children: text }),
|
|
490
|
+
/* @__PURE__ */ jsx7(DefaultCurrentIdentifierButton, {})
|
|
491
|
+
] })
|
|
492
|
+
] });
|
|
493
|
+
}
|
|
494
|
+
function DefaultCardHeader() {
|
|
495
|
+
const context = useOryFlow3();
|
|
496
|
+
const { title, description } = useCardHeaderText(context.flow.ui, context);
|
|
497
|
+
return /* @__PURE__ */ jsx7(InnerCardHeader, { title, text: description });
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// src/theme/default/components/card/logo.tsx
|
|
501
|
+
import { useOryFlow as useOryFlow4 } from "@ory/elements-react";
|
|
502
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
503
|
+
function DefaultCardLogo() {
|
|
504
|
+
const flow = useOryFlow4();
|
|
505
|
+
if (flow.config.logoUrl) {
|
|
506
|
+
return /* @__PURE__ */ jsx8("img", { src: flow.config.logoUrl, width: 100, height: 36, alt: "Logo" });
|
|
507
|
+
}
|
|
508
|
+
return /* @__PURE__ */ jsx8("h1", { className: "text-xl font-semibold leading-normal text-interface-foreground-default-primary", children: flow.config.name });
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// src/theme/default/components/card/layout.tsx
|
|
512
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
513
|
+
function DefaultCardLayout({ children }) {
|
|
514
|
+
return /* @__PURE__ */ jsx9("main", { className: "p-4 pb-8 flex items-center justify-center flex-col gap-8 min-h-screen", children });
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
// src/theme/default/components/card/index.tsx
|
|
518
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
519
|
+
function DefaultCard({ children }) {
|
|
520
|
+
return /* @__PURE__ */ jsx10("div", { className: "flex flex-1 sm:items-center justify-center font-sans items-start w-full sm:w-[480px] sm:max-w-[480px]", children: /* @__PURE__ */ jsxs7("div", { className: "relative grid grid-cols-1 gap-8 sm:rounded-cards sm:border border-form-border-default bg-form-background-default px-8 py-12 sm:px-12 sm:py-14 border-b w-full", children: [
|
|
521
|
+
children,
|
|
522
|
+
/* @__PURE__ */ jsx10(Badge, {})
|
|
523
|
+
] }) });
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// src/theme/default/utils/cn.ts
|
|
527
|
+
import { clsx } from "clsx";
|
|
528
|
+
import { twMerge } from "tailwind-merge";
|
|
529
|
+
function cn(...inputs) {
|
|
530
|
+
return twMerge(clsx(inputs));
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// src/theme/default/components/form/index.tsx
|
|
534
|
+
import { useIntl as useIntl4 } from "react-intl";
|
|
535
|
+
import {
|
|
536
|
+
messageTestId,
|
|
537
|
+
uiTextToFormattedMessage as uiTextToFormattedMessage2,
|
|
538
|
+
useOryFlow as useOryFlow6
|
|
539
|
+
} from "@ory/elements-react";
|
|
540
|
+
import { FlowType as FlowType4 } from "@ory/client-fetch";
|
|
541
|
+
|
|
542
|
+
// src/theme/default/components/form/social.tsx
|
|
543
|
+
import {
|
|
544
|
+
uiTextToFormattedMessage,
|
|
545
|
+
useOryFlow as useOryFlow5
|
|
546
|
+
} from "@ory/elements-react";
|
|
547
|
+
|
|
548
|
+
// src/theme/default/provider-logos/apple.svg
|
|
549
|
+
import * as React4 from "react";
|
|
550
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
551
|
+
var SvgApple = (props) => {
|
|
552
|
+
var _a, _b;
|
|
553
|
+
return /* @__PURE__ */ jsx11("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 32 32", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: /* @__PURE__ */ jsx11("path", { fill: "#283544", d: "M27.734 11.55c-.134.078-3.317 1.724-3.317 5.374.15 4.162 4.017 5.621 4.083 5.621-.066.078-.584 1.988-2.116 3.991C25.167 28.261 23.817 30 21.767 30c-1.95 0-2.65-1.15-4.9-1.15-2.416 0-3.1 1.15-4.95 1.15-2.05 0-3.5-1.832-4.782-3.541-1.667-2.236-3.083-5.746-3.133-9.116-.034-1.786.334-3.54 1.266-5.032 1.317-2.081 3.667-3.494 6.233-3.54 1.966-.063 3.716 1.257 4.916 1.257 1.15 0 3.3-1.258 5.733-1.258 1.05.001 3.85.296 5.584 2.78M16.25 8.414c-.35-1.631.616-3.262 1.516-4.302C18.917 2.854 20.734 2 22.3 2c.1 1.63-.534 3.23-1.666 4.395-1.017 1.258-2.767 2.205-4.383 2.019" }) });
|
|
554
|
+
};
|
|
555
|
+
var apple_default = SvgApple;
|
|
556
|
+
|
|
557
|
+
// src/theme/default/provider-logos/auth0.svg
|
|
558
|
+
import * as React5 from "react";
|
|
559
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
560
|
+
var SvgAuth0 = (props) => {
|
|
561
|
+
var _a, _b;
|
|
562
|
+
return /* @__PURE__ */ jsx12("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 64", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: /* @__PURE__ */ jsx12("path", { fill: "#eb5424", d: "M49.012 51.774 42.514 32l17.008-12.22h-21.02L32.005 0h21.032l6.506 19.78c3.767 11.468-.118 24.52-10.53 31.993zm-34.023 0L31.998 64l17.015-12.226-17.008-12.22zm-10.516-32c-3.976 12.1.64 24.917 10.5 32.007v-.007L21.482 32 4.474 19.774l21.025.007L31.998 0H10.972z" }) });
|
|
563
|
+
};
|
|
564
|
+
var auth0_default = SvgAuth0;
|
|
565
|
+
|
|
566
|
+
// src/theme/default/provider-logos/discord.svg
|
|
567
|
+
import * as React6 from "react";
|
|
568
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
569
|
+
var SvgDiscord = (props) => {
|
|
570
|
+
var _a, _b;
|
|
571
|
+
return /* @__PURE__ */ jsxs8("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 32 32", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: [
|
|
572
|
+
/* @__PURE__ */ jsx13("path", { d: "M2 11.6c0-3.36 0-5.04.654-6.324a6 6 0 0 1 2.622-2.622C6.56 2 8.24 2 11.6 2h8.8c3.36 0 5.04 0 6.324.654a6 6 0 0 1 2.622 2.622C30 6.56 30 8.24 30 11.6v8.8c0 3.36 0 5.04-.654 6.324a6 6 0 0 1-2.622 2.622C25.44 30 23.76 30 20.4 30h-8.8c-3.36 0-5.04 0-6.324-.654a6 6 0 0 1-2.622-2.622C2 25.44 2 23.76 2 20.4z" }),
|
|
573
|
+
/* @__PURE__ */ jsx13("path", { fill: "#5865F2", d: "M23.636 9.34A18.8 18.8 0 0 0 19.097 8c-.195.332-.424.779-.581 1.134a17.7 17.7 0 0 0-5.03 0A12 12 0 0 0 12.897 8a18.7 18.7 0 0 0-4.542 1.343c-2.872 4.078-3.65 8.055-3.262 11.975a18.6 18.6 0 0 0 5.567 2.68c.448-.58.848-1.195 1.192-1.844a12 12 0 0 1-1.877-.859 9 9 0 0 0 .46-.342c3.62 1.59 7.553 1.59 11.13 0q.225.178.46.342c-.595.337-1.225.626-1.88.86q.516.974 1.191 1.845a18.6 18.6 0 0 0 5.57-2.682c.457-4.544-.78-8.484-3.27-11.978m-11.29 9.567c-1.087 0-1.978-.953-1.978-2.113s.872-2.116 1.977-2.116c1.106 0 1.997.953 1.978 2.116.002 1.16-.872 2.113-1.978 2.113m7.308 0c-1.086 0-1.977-.953-1.977-2.113s.872-2.116 1.977-2.116c1.106 0 1.997.953 1.978 2.116 0 1.16-.872 2.113-1.978 2.113" })
|
|
574
|
+
] });
|
|
575
|
+
};
|
|
576
|
+
var discord_default = SvgDiscord;
|
|
577
|
+
|
|
578
|
+
// src/theme/default/provider-logos/facebook.svg
|
|
579
|
+
import * as React7 from "react";
|
|
580
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
581
|
+
var SvgFacebook = (props) => {
|
|
582
|
+
var _a, _b;
|
|
583
|
+
return /* @__PURE__ */ jsxs9("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 32 32", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: [
|
|
584
|
+
/* @__PURE__ */ jsx14("circle", { cx: 16, cy: 16, r: 14, fill: "url(#facebook_svg__a)" }),
|
|
585
|
+
/* @__PURE__ */ jsx14("path", { fill: "#fff", d: "m21.214 20.282.622-3.952h-3.89v-2.563c0-1.081.542-2.136 2.284-2.136H22V8.267S20.395 8 18.86 8c-3.205 0-5.298 1.893-5.298 5.318v3.012H10v3.952h3.562v9.552q1.073.165 2.191.166 1.12 0 2.192-.166v-9.552z" }),
|
|
586
|
+
/* @__PURE__ */ jsx14("defs", { children: /* @__PURE__ */ jsxs9("linearGradient", { id: "facebook_svg__a", x1: 16, x2: 16, y1: 2, y2: 29.917, gradientUnits: "userSpaceOnUse", children: [
|
|
587
|
+
/* @__PURE__ */ jsx14("stop", { stopColor: "#18ACFE" }),
|
|
588
|
+
/* @__PURE__ */ jsx14("stop", { offset: 1, stopColor: "#0163E0" })
|
|
589
|
+
] }) })
|
|
590
|
+
] });
|
|
591
|
+
};
|
|
592
|
+
var facebook_default = SvgFacebook;
|
|
593
|
+
|
|
594
|
+
// src/theme/default/provider-logos/generic.svg
|
|
595
|
+
import * as React8 from "react";
|
|
596
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
597
|
+
var SvgGeneric = (props) => {
|
|
598
|
+
var _a, _b;
|
|
599
|
+
return /* @__PURE__ */ jsxs10("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, className: "generic_svg__icon generic_svg__icon-tabler generic_svg__icon-tabler-brand-oauth", viewBox: "0 0 24 24", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: [
|
|
600
|
+
/* @__PURE__ */ jsx15("path", { stroke: "none", d: "M0 0h24v24H0z" }),
|
|
601
|
+
/* @__PURE__ */ jsx15("path", { d: "M2 12a10 10 0 1 0 20 0 10 10 0 1 0-20 0" }),
|
|
602
|
+
/* @__PURE__ */ jsx15("path", { d: "M12.556 6c.65 0 1.235.373 1.508.947l2.839 7.848a1.646 1.646 0 0 1-1.01 2.108 1.673 1.673 0 0 1-2.068-.851L13.365 15h-2.73l-.398.905A1.67 1.67 0 0 1 8.26 16.95l-.153-.047a1.647 1.647 0 0 1-1.056-1.956l2.824-7.852a1.66 1.66 0 0 1 1.409-1.087z" })
|
|
603
|
+
] });
|
|
604
|
+
};
|
|
605
|
+
var generic_default = SvgGeneric;
|
|
606
|
+
|
|
607
|
+
// src/theme/default/provider-logos/github.svg
|
|
608
|
+
import * as React9 from "react";
|
|
609
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
610
|
+
var SvgGithub = (props) => {
|
|
611
|
+
var _a, _b;
|
|
612
|
+
return /* @__PURE__ */ jsx16("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: /* @__PURE__ */ jsx16("path", { d: "M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.5 11.5 0 0 1 12 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12" }) });
|
|
613
|
+
};
|
|
614
|
+
var github_default = SvgGithub;
|
|
615
|
+
|
|
616
|
+
// src/theme/default/provider-logos/gitlab.svg
|
|
617
|
+
import * as React10 from "react";
|
|
618
|
+
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
619
|
+
var SvgGitlab = (props) => {
|
|
620
|
+
var _a, _b;
|
|
621
|
+
return /* @__PURE__ */ jsxs11("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: [
|
|
622
|
+
/* @__PURE__ */ jsx17("path", { fill: "#E24329", d: "m22.708 10.691-.031-.072-3.015-7.167a.74.74 0 0 0-.31-.34.87.87 0 0 0-.923.045.73.73 0 0 0-.268.37L16.125 9.2H7.881L5.845 3.527a.72.72 0 0 0-.268-.371.87.87 0 0 0-.923-.045.74.74 0 0 0-.31.34l-3.021 7.164-.03.072a4.67 4.67 0 0 0-.153 3.23c.335 1.063 1.04 1.998 2.01 2.664l.01.007.028.018 4.594 3.132 2.272 1.567 1.384.952c.162.112.36.172.563.172s.401-.06.563-.172l1.384-.952 2.273-1.567 4.62-3.151.012-.009c.968-.666 1.671-1.6 2.006-2.661a4.67 4.67 0 0 0-.15-3.226" }),
|
|
623
|
+
/* @__PURE__ */ jsx17("path", { fill: "#FC6D26", d: "m22.708 10.691-.031-.072a10.7 10.7 0 0 0-4.055 1.66L12 16.839l4.218 2.904 4.621-3.152.012-.008c.969-.666 1.674-1.601 2.008-2.664a4.67 4.67 0 0 0-.15-3.228" }),
|
|
624
|
+
/* @__PURE__ */ jsx17("path", { fill: "#FCA326", d: "m7.781 19.743 2.273 1.566 1.384.952c.162.112.36.172.563.172s.401-.06.563-.172l1.384-.952 2.273-1.566S14.255 18.389 12 16.839c-2.255 1.55-4.219 2.904-4.219 2.904" }),
|
|
625
|
+
/* @__PURE__ */ jsx17("path", { fill: "#FC6D26", d: "M5.376 12.279a10.7 10.7 0 0 0-4.053-1.664l-.03.072a4.67 4.67 0 0 0-.153 3.23c.335 1.063 1.04 1.998 2.01 2.664l.01.007.028.018 4.594 3.132L12 16.836z" })
|
|
626
|
+
] });
|
|
627
|
+
};
|
|
628
|
+
var gitlab_default = SvgGitlab;
|
|
629
|
+
|
|
630
|
+
// src/theme/default/provider-logos/google.svg
|
|
631
|
+
import * as React11 from "react";
|
|
632
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
633
|
+
var SvgGoogle = (props) => {
|
|
634
|
+
var _a, _b;
|
|
635
|
+
return /* @__PURE__ */ jsxs12("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 32 32", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: [
|
|
636
|
+
/* @__PURE__ */ jsx18("path", { fill: "#4285F4", d: "M30.001 16.31c0-1.15-.095-1.99-.301-2.861H16.287v5.195h7.873c-.159 1.291-1.016 3.236-2.92 4.542l-.027.174 4.24 3.22.294.029c2.699-2.443 4.254-6.036 4.254-10.298" }),
|
|
637
|
+
/* @__PURE__ */ jsx18("path", { fill: "#34A853", d: "M16.286 30c3.857 0 7.095-1.244 9.46-3.391l-4.507-3.423c-1.207.825-2.826 1.4-4.953 1.4A8.58 8.58 0 0 1 8.16 18.77l-.167.014-4.41 3.344-.058.157C5.874 26.858 10.7 30 16.286 30" }),
|
|
638
|
+
/* @__PURE__ */ jsx18("path", { fill: "#FBBC05", d: "M8.16 18.769a8.5 8.5 0 0 1-.476-2.77c0-.964.174-1.897.46-2.768l-.008-.185-4.465-3.399-.146.068A13.8 13.8 0 0 0 2.001 16c0 2.256.556 4.387 1.524 6.284z" }),
|
|
639
|
+
/* @__PURE__ */ jsx18("path", { fill: "#EB4335", d: "M16.286 7.413c2.683 0 4.492 1.136 5.524 2.085l4.032-3.858C23.366 3.384 20.143 2 16.286 2 10.7 2 5.874 5.142 3.524 9.715l4.62 3.516c1.158-3.375 4.365-5.818 8.142-5.818" })
|
|
640
|
+
] });
|
|
641
|
+
};
|
|
642
|
+
var google_default = SvgGoogle;
|
|
643
|
+
|
|
644
|
+
// src/theme/default/provider-logos/linkedin.svg
|
|
645
|
+
import * as React12 from "react";
|
|
646
|
+
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
647
|
+
var SvgLinkedin = (props) => {
|
|
648
|
+
var _a, _b;
|
|
649
|
+
return /* @__PURE__ */ jsxs13("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 32 32", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: [
|
|
650
|
+
/* @__PURE__ */ jsx19("rect", { width: 28, height: 28, x: 2, y: 2, fill: "#1275B1", rx: 14 }),
|
|
651
|
+
/* @__PURE__ */ jsx19("path", { fill: "#fff", d: "M12.619 9.692c0 .935-.81 1.692-1.81 1.692C9.81 11.384 9 10.627 9 9.692S9.81 8 10.81 8c.999 0 1.809.758 1.809 1.692M9.247 12.628h3.093V22H9.247zM17.32 12.628h-3.093V22h3.093v-4.795c0-1.107.378-2.22 1.886-2.22 1.705 0 1.695 1.45 1.687 2.572-.01 1.467.014 2.965.014 4.443H24v-4.946c-.026-3.159-.85-4.614-3.557-4.614-1.608 0-2.604.73-3.123 1.39z" })
|
|
652
|
+
] });
|
|
653
|
+
};
|
|
654
|
+
var linkedin_default = SvgLinkedin;
|
|
655
|
+
|
|
656
|
+
// src/theme/default/provider-logos/microsoft.svg
|
|
657
|
+
import * as React13 from "react";
|
|
658
|
+
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
659
|
+
var SvgMicrosoft = (props) => {
|
|
660
|
+
var _a, _b;
|
|
661
|
+
return /* @__PURE__ */ jsxs14("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 23 23", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: [
|
|
662
|
+
/* @__PURE__ */ jsx20("path", { fill: "#F35325", d: "M1 1h10v10H1z" }),
|
|
663
|
+
/* @__PURE__ */ jsx20("path", { fill: "#81BC06", d: "M12 1h10v10H12z" }),
|
|
664
|
+
/* @__PURE__ */ jsx20("path", { fill: "#05A6F0", d: "M1 12h10v10H1z" }),
|
|
665
|
+
/* @__PURE__ */ jsx20("path", { fill: "#FFBA08", d: "M12 12h10v10H12z" })
|
|
666
|
+
] });
|
|
667
|
+
};
|
|
668
|
+
var microsoft_default = SvgMicrosoft;
|
|
669
|
+
|
|
670
|
+
// src/theme/default/provider-logos/slack.svg
|
|
671
|
+
import * as React14 from "react";
|
|
672
|
+
import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
673
|
+
var SvgSlack = (props) => {
|
|
674
|
+
var _a, _b;
|
|
675
|
+
return /* @__PURE__ */ jsxs15("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 32 32", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: [
|
|
676
|
+
/* @__PURE__ */ jsx21("path", { fill: "#2EB67D", d: "M26.5 15a2.5 2.5 0 1 0-2.5-2.5V15zm-7 0a2.5 2.5 0 0 0 2.5-2.5v-7a2.5 2.5 0 0 0-5 0v7a2.5 2.5 0 0 0 2.5 2.5" }),
|
|
677
|
+
/* @__PURE__ */ jsx21("path", { fill: "#E01E5A", d: "M5.5 17A2.5 2.5 0 1 0 8 19.5V17zm7 0a2.5 2.5 0 0 0-2.5 2.5v7a2.5 2.5 0 0 0 5 0v-7a2.5 2.5 0 0 0-2.5-2.5" }),
|
|
678
|
+
/* @__PURE__ */ jsx21("path", { fill: "#ECB22E", d: "M17 26.5a2.5 2.5 0 1 0 2.5-2.5H17zm0-7a2.5 2.5 0 0 0 2.5 2.5h7a2.5 2.5 0 0 0 0-5h-7a2.5 2.5 0 0 0-2.5 2.5" }),
|
|
679
|
+
/* @__PURE__ */ jsx21("path", { fill: "#36C5F0", d: "M15 5.5A2.5 2.5 0 1 0 12.5 8H15zm0 7a2.5 2.5 0 0 0-2.5-2.5h-7a2.5 2.5 0 0 0 0 5h7a2.5 2.5 0 0 0 2.5-2.5" })
|
|
680
|
+
] });
|
|
681
|
+
};
|
|
682
|
+
var slack_default = SvgSlack;
|
|
683
|
+
|
|
684
|
+
// src/theme/default/provider-logos/spotify.svg
|
|
685
|
+
import * as React15 from "react";
|
|
686
|
+
import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
687
|
+
var SvgSpotify = (props) => {
|
|
688
|
+
var _a, _b;
|
|
689
|
+
return /* @__PURE__ */ jsxs16("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 32 32", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: [
|
|
690
|
+
/* @__PURE__ */ jsx22("circle", { cx: 16, cy: 16, r: 14, fill: "#1ED760" }),
|
|
691
|
+
/* @__PURE__ */ jsx22("path", { fill: "#fff", d: "M22.364 21.623c-.239.38-.75.486-1.148.258-3.141-1.822-7.08-2.232-11.736-1.23-.446.091-.893-.167-.988-.592a.786.786 0 0 1 .621-.94c5.087-1.11 9.456-.639 12.964 1.41a.77.77 0 0 1 .287 1.094m1.627-3.461c-.303.47-.941.607-1.435.334-3.588-2.11-9.058-2.718-13.299-1.488-.558.152-1.132-.137-1.292-.653-.16-.531.144-1.078.702-1.23 4.848-1.396 10.875-.728 15.005 1.686.462.273.622.88.319 1.35m.143-3.613c-4.305-2.43-11.4-2.657-15.515-1.473-.654.197-1.355-.152-1.563-.79-.207-.622.176-1.29.83-1.487 4.72-1.366 12.565-1.093 17.508 1.7.59.334.781 1.063.43 1.625-.334.576-1.1.774-1.69.425" })
|
|
692
|
+
] });
|
|
693
|
+
};
|
|
694
|
+
var spotify_default = SvgSpotify;
|
|
695
|
+
|
|
696
|
+
// src/theme/default/provider-logos/yandex.svg
|
|
697
|
+
import * as React16 from "react";
|
|
698
|
+
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
699
|
+
var SvgYandex = (props) => {
|
|
700
|
+
var _a, _b;
|
|
701
|
+
return /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 32 32", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: [
|
|
702
|
+
/* @__PURE__ */ jsx23("circle", { cx: 16, cy: 16, r: 14, fill: "#fff" }),
|
|
703
|
+
/* @__PURE__ */ jsx23("path", { fill: "#FC3F1D", d: "M21 25h-3.143V9.435h-1.402c-2.572 0-3.922 1.294-3.922 3.211 0 2.175.935 3.185 2.857 4.48l1.584 1.063L12.403 25H9l4.104-6.086c-2.363-1.684-3.688-3.316-3.688-6.087C9.416 9.357 11.83 7 16.429 7H21z" })
|
|
704
|
+
] });
|
|
705
|
+
};
|
|
706
|
+
var yandex_default = SvgYandex;
|
|
707
|
+
|
|
708
|
+
// src/theme/default/provider-logos/x.svg
|
|
709
|
+
import * as React17 from "react";
|
|
710
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
711
|
+
var SvgX = (props) => {
|
|
712
|
+
var _a, _b;
|
|
713
|
+
return /* @__PURE__ */ jsx24("svg", { xmlns: "http://www.w3.org/2000/svg", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, fill: "none", ...props, children: /* @__PURE__ */ jsx24("path", { fill: "#0F172A", d: "M24.122 3h4.292L18.99 13.73 30 28.285h-8.64l-6.764-8.845-7.744 8.845H2.56l9.983-11.476L2 3h8.854l6.112 8.08zM22.62 25.766h2.379L9.604 5.426H7.048z" }) });
|
|
714
|
+
};
|
|
715
|
+
var x_default = SvgX;
|
|
716
|
+
|
|
717
|
+
// src/theme/default/provider-logos/index.ts
|
|
718
|
+
var logos = {
|
|
719
|
+
apple: apple_default,
|
|
720
|
+
auth0: auth0_default,
|
|
721
|
+
discord: discord_default,
|
|
722
|
+
facebook: facebook_default,
|
|
723
|
+
generic: generic_default,
|
|
724
|
+
github: github_default,
|
|
725
|
+
gitlab: gitlab_default,
|
|
726
|
+
google: google_default,
|
|
727
|
+
linkedin: linkedin_default,
|
|
728
|
+
microsoft: microsoft_default,
|
|
729
|
+
slack: slack_default,
|
|
730
|
+
spotify: spotify_default,
|
|
731
|
+
yandex: yandex_default,
|
|
732
|
+
x: x_default
|
|
733
|
+
};
|
|
734
|
+
var provider_logos_default = logos;
|
|
735
|
+
|
|
736
|
+
// src/theme/default/components/form/social.tsx
|
|
737
|
+
import { useIntl as useIntl3 } from "react-intl";
|
|
738
|
+
import { useEffect, useState } from "react";
|
|
739
|
+
import { useFormContext as useFormContext2 } from "react-hook-form";
|
|
740
|
+
|
|
741
|
+
// src/theme/default/components/form/spinner.tsx
|
|
742
|
+
import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
743
|
+
function Spinner({ className }) {
|
|
744
|
+
return /* @__PURE__ */ jsxs18(
|
|
745
|
+
"svg",
|
|
746
|
+
{
|
|
747
|
+
"aria-hidden": "true",
|
|
748
|
+
role: "status",
|
|
749
|
+
className: cn(
|
|
750
|
+
"absolute pointer-events-none inset-0 m-auto size-8 animate-spin",
|
|
751
|
+
className
|
|
752
|
+
),
|
|
753
|
+
viewBox: "0 0 34 34",
|
|
754
|
+
fill: "none",
|
|
755
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
756
|
+
children: [
|
|
757
|
+
/* @__PURE__ */ jsx25("g", { clipPath: "url(#clip0_2572_1748)", children: /* @__PURE__ */ jsx25(
|
|
758
|
+
"path",
|
|
759
|
+
{
|
|
760
|
+
d: "M23.364 10.6362C22.1053 9.37751 20.5016 8.52034 18.7558 8.17307C17.01 7.82581 15.2004 8.00404 13.5559 8.68523C11.9113 9.36641 10.5057 10.52 9.51678 12C8.52784 13.4801 8 15.2201 8 17.0001C8 18.7802 8.52784 20.5202 9.51678 22.0003C10.5057 23.4803 11.9113 24.6339 13.5559 25.3151C15.2004 25.9962 17.01 26.1745 18.7558 25.8272C20.5016 25.4799 22.1053 24.6228 23.364 23.3641",
|
|
761
|
+
stroke: "currentColor",
|
|
762
|
+
strokeLinecap: "round",
|
|
763
|
+
strokeLinejoin: "round"
|
|
764
|
+
}
|
|
765
|
+
) }),
|
|
766
|
+
/* @__PURE__ */ jsx25("defs", { children: /* @__PURE__ */ jsx25("clipPath", { id: "clip0_2572_1748", children: /* @__PURE__ */ jsx25(
|
|
767
|
+
"rect",
|
|
768
|
+
{
|
|
769
|
+
width: "24",
|
|
770
|
+
height: "24",
|
|
771
|
+
fill: "currentColor",
|
|
772
|
+
transform: "translate(17 0.029541) rotate(45)"
|
|
773
|
+
}
|
|
774
|
+
) }) })
|
|
775
|
+
]
|
|
776
|
+
}
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// src/theme/default/components/form/social.tsx
|
|
781
|
+
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
782
|
+
function extractProvider(context) {
|
|
783
|
+
if (context && typeof context === "object" && "provider" in context && typeof context.provider === "string") {
|
|
784
|
+
return context.provider;
|
|
785
|
+
}
|
|
786
|
+
return void 0;
|
|
787
|
+
}
|
|
788
|
+
function DefaultButtonSocial({
|
|
789
|
+
attributes,
|
|
790
|
+
node,
|
|
791
|
+
onClick,
|
|
792
|
+
showLabel: _showLabel,
|
|
793
|
+
logos: providedLogos
|
|
794
|
+
}) {
|
|
795
|
+
var _a, _b, _c;
|
|
796
|
+
const logos2 = { ...provider_logos_default, ...providedLogos };
|
|
797
|
+
const {
|
|
798
|
+
node_type: _ignoredNodeType,
|
|
799
|
+
type: _ignoredType,
|
|
800
|
+
name: _ignoredName,
|
|
801
|
+
...props
|
|
802
|
+
} = attributes;
|
|
803
|
+
const {
|
|
804
|
+
flow: { ui }
|
|
805
|
+
} = useOryFlow5();
|
|
806
|
+
const [clicked, setClicked] = useState(false);
|
|
807
|
+
const intl = useIntl3();
|
|
808
|
+
const {
|
|
809
|
+
formState: { isSubmitting }
|
|
810
|
+
} = useFormContext2();
|
|
811
|
+
const oidcNodeCount = (_a = ui.nodes.filter((node2) => node2.group === "oidc").length) != null ? _a : 0;
|
|
812
|
+
const Logo = logos2[attributes.value.split("-")[0]];
|
|
813
|
+
const showLabel = _showLabel != null ? _showLabel : oidcNodeCount % 3 !== 0 && oidcNodeCount % 4 !== 0;
|
|
814
|
+
const provider = (_c = extractProvider((_b = node.meta.label) == null ? void 0 : _b.context)) != null ? _c : "";
|
|
815
|
+
const localOnClick = () => {
|
|
816
|
+
setClicked(true);
|
|
817
|
+
onClick == null ? void 0 : onClick();
|
|
818
|
+
};
|
|
819
|
+
useEffect(() => {
|
|
820
|
+
if (!isSubmitting) {
|
|
821
|
+
setClicked(false);
|
|
822
|
+
}
|
|
823
|
+
}, [isSubmitting]);
|
|
824
|
+
return /* @__PURE__ */ jsxs19(
|
|
825
|
+
"button",
|
|
826
|
+
{
|
|
827
|
+
className: "gap-3 border border-button-social-border-default bg-button-social-background-default hover:bg-button-social-background-hover transition-colors rounded-buttons flex items-center justify-center px-4 py-[13px] loading:bg-button-social-background-disabled loading:border-button-social-border-disabled loading:text-button-social-foreground-disabled hover:text-button-social-foreground-hover",
|
|
828
|
+
value: attributes.value,
|
|
829
|
+
type: "submit",
|
|
830
|
+
name: "provider",
|
|
831
|
+
"data-testid": `ory/form/node/input/${attributes.name}`,
|
|
832
|
+
...props,
|
|
833
|
+
onClick: localOnClick,
|
|
834
|
+
"data-loading": clicked,
|
|
835
|
+
disabled: isSubmitting,
|
|
836
|
+
children: [
|
|
837
|
+
/* @__PURE__ */ jsx26("span", { className: "size-5 relative", children: !clicked ? Logo ? /* @__PURE__ */ jsx26(Logo, { size: 20 }) : /* @__PURE__ */ jsx26("span", { className: "flex aspect-square items-center justify-center rounded-[999px] border text-xs", children: provider.slice(0, 2) }) : /* @__PURE__ */ jsx26(Spinner, { className: "size-5" }) }),
|
|
838
|
+
showLabel && node.meta.label ? /* @__PURE__ */ jsx26("span", { className: "grow text-left font-medium leading-none text-button-social-foreground-default", children: uiTextToFormattedMessage(node.meta.label, intl) }) : null
|
|
839
|
+
]
|
|
840
|
+
}
|
|
841
|
+
);
|
|
842
|
+
}
|
|
843
|
+
DefaultButtonSocial.WithLogos = (logos2) => (props) => /* @__PURE__ */ jsx26(DefaultButtonSocial, { ...props, logos: logos2 });
|
|
844
|
+
function DefaultSocialButtonContainer({
|
|
845
|
+
children,
|
|
846
|
+
nodes
|
|
847
|
+
}) {
|
|
848
|
+
return /* @__PURE__ */ jsx26(
|
|
849
|
+
"div",
|
|
850
|
+
{
|
|
851
|
+
className: cn("grid gap-3", {
|
|
852
|
+
// needed because tailwind is not compiling dynamic classes
|
|
853
|
+
"grid-cols-1": nodes.length % 4 <= 2,
|
|
854
|
+
"grid-cols-3": nodes.length % 3 === 0,
|
|
855
|
+
"grid-cols-4": nodes.length > 1 && nodes.length % 4 === 0
|
|
856
|
+
}),
|
|
857
|
+
children
|
|
858
|
+
}
|
|
859
|
+
);
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
// src/theme/default/components/form/index.tsx
|
|
863
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
864
|
+
function DefaultFormContainer({
|
|
865
|
+
children,
|
|
866
|
+
onSubmit,
|
|
867
|
+
action,
|
|
868
|
+
method
|
|
869
|
+
}) {
|
|
870
|
+
return /* @__PURE__ */ jsx27(
|
|
871
|
+
"form",
|
|
872
|
+
{
|
|
873
|
+
onSubmit,
|
|
874
|
+
noValidate: true,
|
|
875
|
+
action,
|
|
876
|
+
method,
|
|
877
|
+
className: "grid gap-8",
|
|
878
|
+
children
|
|
879
|
+
}
|
|
880
|
+
);
|
|
881
|
+
}
|
|
882
|
+
function DefaultMessageContainer({ children }) {
|
|
883
|
+
const { flowType } = useOryFlow6();
|
|
884
|
+
if (!children || Array.isArray(children) && children.length === 0) {
|
|
885
|
+
return null;
|
|
886
|
+
}
|
|
887
|
+
return /* @__PURE__ */ jsx27(
|
|
888
|
+
"section",
|
|
889
|
+
{
|
|
890
|
+
className: cn(
|
|
891
|
+
flowType === FlowType4.Settings ? "text-center" : "text-left"
|
|
892
|
+
),
|
|
893
|
+
children
|
|
894
|
+
}
|
|
895
|
+
);
|
|
896
|
+
}
|
|
897
|
+
function DefaultMessage({ message }) {
|
|
898
|
+
const intl = useIntl4();
|
|
899
|
+
return /* @__PURE__ */ jsx27(
|
|
900
|
+
"span",
|
|
901
|
+
{
|
|
902
|
+
className: cn(
|
|
903
|
+
"leading-normal",
|
|
904
|
+
message.type === "error" && "text-interface-foreground-validation-danger",
|
|
905
|
+
message.type === "info" && "text-interface-foreground-default-secondary",
|
|
906
|
+
message.type === "success" && "text-interface-foreground-validation-success"
|
|
907
|
+
),
|
|
908
|
+
...messageTestId(message),
|
|
909
|
+
children: uiTextToFormattedMessage2(message, intl)
|
|
910
|
+
}
|
|
911
|
+
);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
// src/theme/default/components/card/auth-method-list-item.tsx
|
|
915
|
+
import { useIntl as useIntl5 } from "react-intl";
|
|
916
|
+
|
|
917
|
+
// src/theme/default/assets/icons/code.svg
|
|
918
|
+
import * as React18 from "react";
|
|
919
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
920
|
+
var SvgCode = (props) => {
|
|
921
|
+
var _a, _b;
|
|
922
|
+
return /* @__PURE__ */ jsx28("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 15 13", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: /* @__PURE__ */ jsx28("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M6.333 10.666h-4A1.333 1.333 0 0 1 1 9.333V2.666m0 0a1.333 1.333 0 0 1 1.333-1.333h9.334A1.333 1.333 0 0 1 13 2.666m-12 0 6 4 6-4m0 0v4M12.333 12l1.334-1.334-1.334-1.333m-2 0L9 10.666 10.333 12" }) });
|
|
923
|
+
};
|
|
924
|
+
var code_default = SvgCode;
|
|
925
|
+
|
|
926
|
+
// src/theme/default/assets/icons/passkey.svg
|
|
927
|
+
import * as React19 from "react";
|
|
928
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
929
|
+
var SvgPasskey = (props) => {
|
|
930
|
+
var _a, _b;
|
|
931
|
+
return /* @__PURE__ */ jsx29("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 13 14", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: /* @__PURE__ */ jsx29("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M10.602 3.667c.603 1 .86 2.171.733 3.333v.667a4 4 0 0 0 .533 2M3.335 6.333a2.667 2.667 0 0 1 5.333 0V7c0 1.442.468 2.846 1.334 4m-4-4.667v1.334A9.33 9.33 0 0 0 7.668 13M3.335 9a12 12 0 0 0 1.2 4m-3.267-1.333A14.7 14.7 0 0 1 .668 7v-.667a5.333 5.333 0 0 1 8-4.633" }) });
|
|
932
|
+
};
|
|
933
|
+
var passkey_default = SvgPasskey;
|
|
934
|
+
|
|
935
|
+
// src/theme/default/assets/icons/password.svg
|
|
936
|
+
import * as React20 from "react";
|
|
937
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
938
|
+
var SvgPassword = (props) => {
|
|
939
|
+
var _a, _b;
|
|
940
|
+
return /* @__PURE__ */ jsx30("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 14 4", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: /* @__PURE__ */ jsx30("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M7 .667v2.667m-1.333-.667 2.666-1.333m-2.666 0 2.666 1.333m-6-2v2.667M1 2.667l2.667-1.333M1 1.334l2.667 1.333m8-2v2.667m-1.334-.667L13 1.334m-2.667 0L13 2.667" }) });
|
|
941
|
+
};
|
|
942
|
+
var password_default = SvgPassword;
|
|
943
|
+
|
|
944
|
+
// src/theme/default/assets/icons/webauthn.svg
|
|
945
|
+
import * as React21 from "react";
|
|
946
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
947
|
+
var SvgWebauthn = (props) => {
|
|
948
|
+
var _a, _b;
|
|
949
|
+
return /* @__PURE__ */ jsx31("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 14 14", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: /* @__PURE__ */ jsx31("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5h.007m1.03-3.438 2.401 2.401a1.92 1.92 0 0 1 0 2.713l-1.762 1.762a1.92 1.92 0 0 1-2.713 0l-.2-.2-4.372 4.371a1.33 1.33 0 0 1-.826.386L2.448 13h-.781a.667.667 0 0 1-.662-.589L1 12.333v-.781c0-.313.11-.616.311-.856l.08-.087.276-.276H3V9h1.333V7.667l1.43-1.43-.201-.2a1.92 1.92 0 0 1 0-2.713l1.762-1.762a1.92 1.92 0 0 1 2.713 0" }) });
|
|
950
|
+
};
|
|
951
|
+
var webauthn_default = SvgWebauthn;
|
|
952
|
+
|
|
953
|
+
// src/theme/default/utils/form.ts
|
|
954
|
+
function isGroupImmediateSubmit(group) {
|
|
955
|
+
return group === "code";
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
// src/theme/default/components/card/auth-method-list-item.tsx
|
|
959
|
+
import { jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
960
|
+
var iconsMap = {
|
|
961
|
+
code: code_default,
|
|
962
|
+
passkey: passkey_default,
|
|
963
|
+
password: password_default,
|
|
964
|
+
webauthn: webauthn_default,
|
|
965
|
+
...provider_logos_default
|
|
966
|
+
};
|
|
967
|
+
function DefaultAuthMethodListItem({
|
|
968
|
+
onClick,
|
|
969
|
+
group
|
|
970
|
+
}) {
|
|
971
|
+
const intl = useIntl5();
|
|
972
|
+
const Icon = iconsMap[group] || null;
|
|
973
|
+
return /* @__PURE__ */ jsxs20(
|
|
974
|
+
"button",
|
|
975
|
+
{
|
|
976
|
+
className: "flex cursor-pointer gap-3 text-left items-start w-full rounded-buttons p-2 hover:bg-interface-background-default-primary-hover",
|
|
977
|
+
onClick,
|
|
978
|
+
type: isGroupImmediateSubmit(group) ? "submit" : "button",
|
|
979
|
+
"data-testid": `ory/form/auth-picker/${group}`,
|
|
980
|
+
children: [
|
|
981
|
+
/* @__PURE__ */ jsx32("span", { className: "mt-1", children: Icon && /* @__PURE__ */ jsx32(Icon, { size: 16, className: "text-interface-foreground-brand-primary" }) }),
|
|
982
|
+
/* @__PURE__ */ jsxs20("span", { className: "flex-1 leading-normal inline-flex flex-col", children: [
|
|
983
|
+
/* @__PURE__ */ jsx32("span", { className: "text-interface-foreground-default-primary", children: intl.formatMessage({ id: `two-step.${group}.title` }) }),
|
|
984
|
+
/* @__PURE__ */ jsx32("span", { className: "text-interface-foreground-default-secondary", children: intl.formatMessage({
|
|
985
|
+
id: `two-step.${group}.description`
|
|
986
|
+
}) })
|
|
987
|
+
] })
|
|
988
|
+
]
|
|
989
|
+
}
|
|
990
|
+
);
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
// src/theme/default/components/form/button.tsx
|
|
994
|
+
import { getNodeLabel } from "@ory/client-fetch";
|
|
995
|
+
import {
|
|
996
|
+
uiTextToFormattedMessage as uiTextToFormattedMessage3
|
|
997
|
+
} from "@ory/elements-react";
|
|
998
|
+
import { cva } from "class-variance-authority";
|
|
999
|
+
import { useFormContext as useFormContext3 } from "react-hook-form";
|
|
1000
|
+
import { useIntl as useIntl6 } from "react-intl";
|
|
1001
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
1002
|
+
import { jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1003
|
+
var buttonStyles = cva(
|
|
1004
|
+
[
|
|
1005
|
+
"relative flex justify-center gap-3 overflow-hidden rounded-buttons leading-none ring-1 ring-inset font-medium",
|
|
1006
|
+
"disabled:cursor-not-allowed loading:cursor-wait loading:before:pointer-events-none",
|
|
1007
|
+
"transition-colors duration-100 ease-linear",
|
|
1008
|
+
"p-4 max-w-[488px]"
|
|
1009
|
+
],
|
|
1010
|
+
{
|
|
1011
|
+
variants: {
|
|
1012
|
+
intent: {
|
|
1013
|
+
primary: [
|
|
1014
|
+
"bg-button-primary-background-default text-button-primary-foreground-default ring-button-primary-border-default",
|
|
1015
|
+
"hover:bg-button-primary-background-hover hover:text-button-primary-foreground-hover hover:ring-button-primary-border-hover",
|
|
1016
|
+
"disabled:bg-button-primary-background-disabled disabled:text-button-primary-foreground-disabled disabled:ring-button-primary-border-disabled",
|
|
1017
|
+
"loading:bg-button-primary-background-default loading:text-button-primary-foreground-default loading:ring-button-primary-border-default",
|
|
1018
|
+
"loading:before:absolute loading:before:inset-0 loading:before:bg-button-primary-background-default loading:before:opacity-80 loading:before:content-['']",
|
|
1019
|
+
"disabled:bg-button-primary-background-disabled disabled:text-button-primary-foreground-disabled disabled:ring-button-primary-border-disabled"
|
|
1020
|
+
],
|
|
1021
|
+
secondary: [
|
|
1022
|
+
"bg-button-secondary-background-default text-button-secondary-foreground-default ring-button-secondary-border-default",
|
|
1023
|
+
"hover:bg-button-secondary-background-hover hover:text-button-secondary-foreground-hover hover:ring-button-secondary-border-hover",
|
|
1024
|
+
"disabled:bg-button-secondary-background-disabled disabled:text-button-secondary-foreground-disabled disabled:ring-button-secondary-border-disabled",
|
|
1025
|
+
"loading:bg-button-secondary-background-default loading:text-button-secondary-foreground-default loading:ring-button-secondary-border-default",
|
|
1026
|
+
"loading:before:absolute loading:before:inset-0 loading:before:bg-button-secondary-background-default loading:before:opacity-80 loading:before:content-['']"
|
|
1027
|
+
]
|
|
1028
|
+
},
|
|
1029
|
+
defaultVariants: {
|
|
1030
|
+
intent: "primary"
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
);
|
|
1035
|
+
var DefaultButton = ({
|
|
1036
|
+
attributes,
|
|
1037
|
+
node,
|
|
1038
|
+
onClick
|
|
1039
|
+
}) => {
|
|
1040
|
+
var _a;
|
|
1041
|
+
const {
|
|
1042
|
+
type,
|
|
1043
|
+
name,
|
|
1044
|
+
value,
|
|
1045
|
+
// Button does not support these attributes, so we skip them
|
|
1046
|
+
autocomplete: _ignoredAutocomplete,
|
|
1047
|
+
label: _ignoredLabel,
|
|
1048
|
+
node_type: _ignoredNodeType,
|
|
1049
|
+
// End of skipped attributes
|
|
1050
|
+
...rest
|
|
1051
|
+
} = attributes;
|
|
1052
|
+
const [clicked, setClicked] = useState2(false);
|
|
1053
|
+
const intl = useIntl6();
|
|
1054
|
+
const label = getNodeLabel(node);
|
|
1055
|
+
const {
|
|
1056
|
+
formState: { isSubmitting },
|
|
1057
|
+
setValue
|
|
1058
|
+
} = useFormContext3();
|
|
1059
|
+
useEffect2(() => {
|
|
1060
|
+
if (!isSubmitting) {
|
|
1061
|
+
setClicked(false);
|
|
1062
|
+
}
|
|
1063
|
+
}, [isSubmitting]);
|
|
1064
|
+
const isPrimary = attributes.name === "method" || attributes.name.includes("passkey") || attributes.name.includes("webauthn") || attributes.name.includes("lookup_secret");
|
|
1065
|
+
return /* @__PURE__ */ jsxs21(
|
|
1066
|
+
"button",
|
|
1067
|
+
{
|
|
1068
|
+
...rest,
|
|
1069
|
+
value,
|
|
1070
|
+
name,
|
|
1071
|
+
type: type === "button" ? "button" : "submit",
|
|
1072
|
+
onClick: (e) => {
|
|
1073
|
+
onClick == null ? void 0 : onClick(e);
|
|
1074
|
+
setClicked(true);
|
|
1075
|
+
if (type !== "button") {
|
|
1076
|
+
setValue(name, value);
|
|
1077
|
+
}
|
|
1078
|
+
},
|
|
1079
|
+
className: buttonStyles({
|
|
1080
|
+
intent: isPrimary ? "primary" : "secondary"
|
|
1081
|
+
}),
|
|
1082
|
+
disabled: (_a = rest.disabled) != null ? _a : isSubmitting,
|
|
1083
|
+
"data-loading": clicked,
|
|
1084
|
+
children: [
|
|
1085
|
+
clicked ? /* @__PURE__ */ jsx33(Spinner, {}) : null,
|
|
1086
|
+
label ? /* @__PURE__ */ jsx33("span", { children: uiTextToFormattedMessage3(label, intl) }) : ""
|
|
1087
|
+
]
|
|
1088
|
+
}
|
|
1089
|
+
);
|
|
1090
|
+
};
|
|
1091
|
+
DefaultButton.displayName = "DefaultButton";
|
|
1092
|
+
|
|
1093
|
+
// src/theme/default/components/form/checkbox.tsx
|
|
1094
|
+
import { getNodeLabel as getNodeLabel2 } from "@ory/client-fetch";
|
|
1095
|
+
import {
|
|
1096
|
+
messageTestId as messageTestId2,
|
|
1097
|
+
uiTextToFormattedMessage as uiTextToFormattedMessage5
|
|
1098
|
+
} from "@ory/elements-react";
|
|
1099
|
+
import { useForm } from "react-hook-form";
|
|
1100
|
+
import { useIntl as useIntl8 } from "react-intl";
|
|
1101
|
+
|
|
1102
|
+
// src/theme/default/components/ui/checkbox-label.tsx
|
|
1103
|
+
import { useIntl as useIntl7 } from "react-intl";
|
|
1104
|
+
|
|
1105
|
+
// src/util/i18n/index.ts
|
|
1106
|
+
var uiTextToFormattedMessage4 = ({ id, context = {}, text }, intl) => {
|
|
1107
|
+
const contextInjectedMessage = Object.entries(context).reduce(
|
|
1108
|
+
(accumulator, [key, value]) => {
|
|
1109
|
+
if (Array.isArray(value)) {
|
|
1110
|
+
return {
|
|
1111
|
+
...accumulator,
|
|
1112
|
+
[key]: value,
|
|
1113
|
+
[key + "_list"]: intl.formatList(value)
|
|
1114
|
+
};
|
|
1115
|
+
} else if (key.endsWith("_unix")) {
|
|
1116
|
+
if (typeof value === "number") {
|
|
1117
|
+
return {
|
|
1118
|
+
...accumulator,
|
|
1119
|
+
[key]: intl.formatDate(new Date(value * 1e3)),
|
|
1120
|
+
[key + "_since"]: intl.formatDateTimeRange(
|
|
1121
|
+
new Date(value),
|
|
1122
|
+
/* @__PURE__ */ new Date()
|
|
1123
|
+
),
|
|
1124
|
+
[key + "_since_minutes"]: Math.ceil(
|
|
1125
|
+
(value - (/* @__PURE__ */ new Date()).getTime() / 1e3) / 60
|
|
1126
|
+
).toFixed(0),
|
|
1127
|
+
[key + "_until"]: intl.formatDateTimeRange(
|
|
1128
|
+
/* @__PURE__ */ new Date(),
|
|
1129
|
+
new Date(value)
|
|
1130
|
+
),
|
|
1131
|
+
[key + "_until_minutes"]: Math.ceil(
|
|
1132
|
+
((/* @__PURE__ */ new Date()).getTime() / 1e3 - value) / 60
|
|
1133
|
+
).toFixed(0)
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
} else if (key === "property") {
|
|
1137
|
+
return {
|
|
1138
|
+
...accumulator,
|
|
1139
|
+
[key]: intl.formatMessage({
|
|
1140
|
+
id: `property.${value}`,
|
|
1141
|
+
defaultMessage: value
|
|
1142
|
+
})
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
return {
|
|
1146
|
+
...accumulator,
|
|
1147
|
+
[key]: value
|
|
1148
|
+
};
|
|
1149
|
+
},
|
|
1150
|
+
{}
|
|
1151
|
+
);
|
|
1152
|
+
return intl.formatMessage(
|
|
1153
|
+
{
|
|
1154
|
+
id: `identities.messages.${id}`,
|
|
1155
|
+
defaultMessage: text
|
|
1156
|
+
},
|
|
1157
|
+
contextInjectedMessage
|
|
1158
|
+
);
|
|
1159
|
+
};
|
|
1160
|
+
|
|
1161
|
+
// src/theme/default/components/ui/checkbox-label.tsx
|
|
1162
|
+
import { Fragment as Fragment2, jsx as jsx34 } from "react/jsx-runtime";
|
|
1163
|
+
var linkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
1164
|
+
function computeLabelElements(labelText) {
|
|
1165
|
+
const elements = [];
|
|
1166
|
+
let lastIndex = 0;
|
|
1167
|
+
for (const match of labelText.matchAll(linkRegex)) {
|
|
1168
|
+
const linkText = match[1];
|
|
1169
|
+
const url = match[2];
|
|
1170
|
+
const matchStart = match.index;
|
|
1171
|
+
if (typeof matchStart === "undefined") {
|
|
1172
|
+
continue;
|
|
1173
|
+
}
|
|
1174
|
+
if (matchStart > lastIndex) {
|
|
1175
|
+
elements.push(labelText.slice(lastIndex, matchStart));
|
|
1176
|
+
}
|
|
1177
|
+
elements.push(
|
|
1178
|
+
/* @__PURE__ */ jsx34(
|
|
1179
|
+
"a",
|
|
1180
|
+
{
|
|
1181
|
+
href: url,
|
|
1182
|
+
target: "_blank",
|
|
1183
|
+
rel: "noopener noreferrer",
|
|
1184
|
+
className: "text-button-link-brand-brand hover:text-button-link-brand-brand-hover underline",
|
|
1185
|
+
children: linkText
|
|
1186
|
+
},
|
|
1187
|
+
matchStart
|
|
1188
|
+
)
|
|
1189
|
+
);
|
|
1190
|
+
lastIndex = matchStart + match[0].length;
|
|
1191
|
+
}
|
|
1192
|
+
if (lastIndex < labelText.length) {
|
|
1193
|
+
elements.push(labelText.slice(lastIndex));
|
|
1194
|
+
}
|
|
1195
|
+
return elements;
|
|
1196
|
+
}
|
|
1197
|
+
function CheckboxLabel({ label }) {
|
|
1198
|
+
const intl = useIntl7();
|
|
1199
|
+
if (!label) {
|
|
1200
|
+
return null;
|
|
1201
|
+
}
|
|
1202
|
+
const labelText = uiTextToFormattedMessage4(label, intl);
|
|
1203
|
+
return /* @__PURE__ */ jsx34(Fragment2, { children: computeLabelElements(labelText) });
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
// src/theme/default/components/form/checkbox.tsx
|
|
1207
|
+
import { jsx as jsx35, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1208
|
+
function CheckboxSVG() {
|
|
1209
|
+
return /* @__PURE__ */ jsx35(
|
|
1210
|
+
"svg",
|
|
1211
|
+
{
|
|
1212
|
+
className: "absolute hidden size-4 peer-checked:block fill-checkbox-foreground-checked",
|
|
1213
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1214
|
+
width: "16",
|
|
1215
|
+
height: "16",
|
|
1216
|
+
viewBox: "0 0 16 16",
|
|
1217
|
+
fill: "none",
|
|
1218
|
+
children: /* @__PURE__ */ jsx35(
|
|
1219
|
+
"path",
|
|
1220
|
+
{
|
|
1221
|
+
fillRule: "evenodd",
|
|
1222
|
+
clipRule: "evenodd",
|
|
1223
|
+
d: "M11.6464 5.14645C11.8417 4.95118 12.1583 4.95118 12.3536 5.14645C12.5338 5.32669 12.5477 5.6103 12.3951 5.80645L12.3536 5.85355L7.35355 10.8536C7.17331 11.0338 6.8897 11.0477 6.69355 10.8951L6.64645 10.8536L4.14645 8.35355C3.95118 8.15829 3.95118 7.84171 4.14645 7.64645C4.32669 7.4662 4.6103 7.45234 4.80645 7.60485L4.85355 7.64645L7 9.7925L11.6464 5.14645Z"
|
|
1224
|
+
}
|
|
1225
|
+
)
|
|
1226
|
+
}
|
|
1227
|
+
);
|
|
1228
|
+
}
|
|
1229
|
+
var DefaultCheckbox = ({
|
|
1230
|
+
attributes: initialAttributes,
|
|
1231
|
+
node
|
|
1232
|
+
}) => {
|
|
1233
|
+
const {
|
|
1234
|
+
value,
|
|
1235
|
+
name,
|
|
1236
|
+
// Button does not support these attributes, so we skip them
|
|
1237
|
+
autocomplete: _autocomplete,
|
|
1238
|
+
onclick: _onclick,
|
|
1239
|
+
maxlength: _max,
|
|
1240
|
+
// End of skipped attributes
|
|
1241
|
+
...attributes
|
|
1242
|
+
} = initialAttributes;
|
|
1243
|
+
const intl = useIntl8();
|
|
1244
|
+
const label = getNodeLabel2(node);
|
|
1245
|
+
const { register } = useForm();
|
|
1246
|
+
const hasError = node.messages.some((m) => m.type === "error");
|
|
1247
|
+
return /* @__PURE__ */ jsxs22("label", { className: "flex items-start gap-3 self-stretch antialiased", children: [
|
|
1248
|
+
/* @__PURE__ */ jsxs22("span", { className: "flex h-5 items-center", children: [
|
|
1249
|
+
/* @__PURE__ */ jsx35(
|
|
1250
|
+
"input",
|
|
1251
|
+
{
|
|
1252
|
+
...attributes,
|
|
1253
|
+
value: 1,
|
|
1254
|
+
defaultChecked: Boolean(value),
|
|
1255
|
+
type: "checkbox",
|
|
1256
|
+
className: cn(
|
|
1257
|
+
"peer size-4 border appearance-none rounded-forms bg-checkbox-background-default border-checkbox-border-checkbox-border-default checked:bg-checkbox-background-checked checked:border-checkbox-border-checkbox-border-checked",
|
|
1258
|
+
hasError && "border-interface-border-validation-danger"
|
|
1259
|
+
),
|
|
1260
|
+
...register(name, { value })
|
|
1261
|
+
}
|
|
1262
|
+
),
|
|
1263
|
+
/* @__PURE__ */ jsx35(CheckboxSVG, {})
|
|
1264
|
+
] }),
|
|
1265
|
+
/* @__PURE__ */ jsxs22("span", { className: "flex flex-col", children: [
|
|
1266
|
+
/* @__PURE__ */ jsx35("span", { className: "font-normal leading-tight text-interface-foreground-default-primary", children: /* @__PURE__ */ jsx35(CheckboxLabel, { label }) }),
|
|
1267
|
+
node.messages.map((message) => /* @__PURE__ */ jsx35(
|
|
1268
|
+
"span",
|
|
1269
|
+
{
|
|
1270
|
+
className: cn(
|
|
1271
|
+
"mt-1",
|
|
1272
|
+
message.type === "error" ? "text-interface-foreground-validation-danger" : "text-interface-foreground-default-secondary"
|
|
1273
|
+
),
|
|
1274
|
+
...messageTestId2(message),
|
|
1275
|
+
children: uiTextToFormattedMessage5(message, intl)
|
|
1276
|
+
},
|
|
1277
|
+
message.id
|
|
1278
|
+
))
|
|
1279
|
+
] })
|
|
1280
|
+
] });
|
|
1281
|
+
};
|
|
1282
|
+
|
|
1283
|
+
// src/theme/default/components/form/group-container.tsx
|
|
1284
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
1285
|
+
function DefaultGroupContainer({ children }) {
|
|
1286
|
+
return /* @__PURE__ */ jsx36("div", { className: "grid grid-cols-1 gap-8", children });
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
// src/theme/default/components/form/horizontal-divider.tsx
|
|
1290
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
1291
|
+
function DefaultHorizontalDivider() {
|
|
1292
|
+
return /* @__PURE__ */ jsx37("hr", { className: "border-interface-border-default-primary" });
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
// src/theme/default/components/form/image.tsx
|
|
1296
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
1297
|
+
function DefaultImage({ attributes }) {
|
|
1298
|
+
return /* @__PURE__ */ jsx38("figure", { children: /* @__PURE__ */ jsx38("img", { ...attributes }) });
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
// src/theme/default/components/form/input.tsx
|
|
1302
|
+
import { FlowType as FlowType5, getNodeLabel as getNodeLabel3 } from "@ory/client-fetch";
|
|
1303
|
+
import {
|
|
1304
|
+
uiTextToFormattedMessage as uiTextToFormattedMessage6,
|
|
1305
|
+
useOryFlow as useOryFlow7
|
|
1306
|
+
} from "@ory/elements-react";
|
|
1307
|
+
import { useFormContext as useFormContext4 } from "react-hook-form";
|
|
1308
|
+
import { useIntl as useIntl9 } from "react-intl";
|
|
1309
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
1310
|
+
var DefaultInput = ({
|
|
1311
|
+
node,
|
|
1312
|
+
attributes,
|
|
1313
|
+
onClick
|
|
1314
|
+
}) => {
|
|
1315
|
+
const label = getNodeLabel3(node);
|
|
1316
|
+
const { register } = useFormContext4();
|
|
1317
|
+
const {
|
|
1318
|
+
value,
|
|
1319
|
+
autocomplete,
|
|
1320
|
+
name,
|
|
1321
|
+
maxlength,
|
|
1322
|
+
node_type: _,
|
|
1323
|
+
...rest
|
|
1324
|
+
} = attributes;
|
|
1325
|
+
const intl = useIntl9();
|
|
1326
|
+
const { flowType } = useOryFlow7();
|
|
1327
|
+
const formattedLabel = label ? intl.formatMessage(
|
|
1328
|
+
{
|
|
1329
|
+
id: "input.placeholder",
|
|
1330
|
+
defaultMessage: "Enter your {placeholder}"
|
|
1331
|
+
},
|
|
1332
|
+
{
|
|
1333
|
+
placeholder: uiTextToFormattedMessage6(label, intl)
|
|
1334
|
+
}
|
|
1335
|
+
) : "";
|
|
1336
|
+
return /* @__PURE__ */ jsx39(
|
|
1337
|
+
"input",
|
|
1338
|
+
{
|
|
1339
|
+
...rest,
|
|
1340
|
+
onClick,
|
|
1341
|
+
maxLength: maxlength,
|
|
1342
|
+
autoComplete: autocomplete,
|
|
1343
|
+
placeholder: formattedLabel,
|
|
1344
|
+
"data-testid": `ory/form/node/input/${name}`,
|
|
1345
|
+
className: cn(
|
|
1346
|
+
"antialiased rounded-forms border leading-tight transition-colors placeholder:h-[20px] placeholder:text-input-foreground-tertiary focus-visible:outline-none focus:ring-0",
|
|
1347
|
+
"bg-input-background-default border-input-border-default text-input-foreground-primary",
|
|
1348
|
+
"disabled:bg-input-background-disabled disabled:border-input-border-disabled disabled:text-input-foreground-disabled",
|
|
1349
|
+
"focus:border-input-border-focus focus-visible:border-input-border-focus",
|
|
1350
|
+
"hover:bg-input-background-hover hover:border-input-border-hover",
|
|
1351
|
+
"px-4 py-[13px]",
|
|
1352
|
+
// The settings flow input fields are supposed to be dense, so we don't need the extra padding we want on the user flows.
|
|
1353
|
+
flowType === FlowType5.Settings && "max-w-[488px]"
|
|
1354
|
+
),
|
|
1355
|
+
...register(name, { value })
|
|
1356
|
+
}
|
|
1357
|
+
);
|
|
1358
|
+
};
|
|
1359
|
+
|
|
1360
|
+
// src/theme/default/components/form/label.tsx
|
|
1361
|
+
import {
|
|
1362
|
+
FlowType as FlowType6,
|
|
1363
|
+
getNodeLabel as getNodeLabel4,
|
|
1364
|
+
instanceOfUiText
|
|
1365
|
+
} from "@ory/client-fetch";
|
|
1366
|
+
import {
|
|
1367
|
+
messageTestId as messageTestId3,
|
|
1368
|
+
uiTextToFormattedMessage as uiTextToFormattedMessage7,
|
|
1369
|
+
useComponents as useComponents2,
|
|
1370
|
+
useOryFlow as useOryFlow8
|
|
1371
|
+
} from "@ory/elements-react";
|
|
1372
|
+
import { useFormContext as useFormContext5 } from "react-hook-form";
|
|
1373
|
+
import { useIntl as useIntl10 } from "react-intl";
|
|
1374
|
+
import { jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1375
|
+
function findResendNode(nodes) {
|
|
1376
|
+
return nodes.find(
|
|
1377
|
+
(n) => "name" in n.attributes && (n.attributes.name === "email" && n.attributes.type === "submit" || n.attributes.name === "resend")
|
|
1378
|
+
);
|
|
1379
|
+
}
|
|
1380
|
+
function DefaultLabel({
|
|
1381
|
+
node,
|
|
1382
|
+
children,
|
|
1383
|
+
attributes,
|
|
1384
|
+
...rest
|
|
1385
|
+
}) {
|
|
1386
|
+
const intl = useIntl10();
|
|
1387
|
+
const label = getNodeLabel4(node);
|
|
1388
|
+
const { Message } = useComponents2();
|
|
1389
|
+
const { config, flowType, flow } = useOryFlow8();
|
|
1390
|
+
const { setValue, formState } = useFormContext5();
|
|
1391
|
+
const isPassword = attributes.type === "password";
|
|
1392
|
+
const resendNode = findResendNode(flow.ui.nodes);
|
|
1393
|
+
const handleResend = () => {
|
|
1394
|
+
if ((resendNode == null ? void 0 : resendNode.attributes) && "name" in resendNode.attributes) {
|
|
1395
|
+
setValue(resendNode.attributes.name, resendNode.attributes.value);
|
|
1396
|
+
}
|
|
1397
|
+
};
|
|
1398
|
+
const fieldError = formState.errors[attributes.name];
|
|
1399
|
+
return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-1 antialiased", children: [
|
|
1400
|
+
label && /* @__PURE__ */ jsxs23("span", { className: "inline-flex justify-between", children: [
|
|
1401
|
+
/* @__PURE__ */ jsx40(
|
|
1402
|
+
"label",
|
|
1403
|
+
{
|
|
1404
|
+
...messageTestId3(label),
|
|
1405
|
+
className: "leading-normal text-input-foreground-primary",
|
|
1406
|
+
htmlFor: attributes.name,
|
|
1407
|
+
"data-testid": `ory/form/node/input/label/${attributes.name}`,
|
|
1408
|
+
...rest,
|
|
1409
|
+
children: uiTextToFormattedMessage7(label, intl)
|
|
1410
|
+
}
|
|
1411
|
+
),
|
|
1412
|
+
isPassword && config.project.recovery_enabled && flowType === FlowType6.Login && // TODO: make it possible to override with a custom component
|
|
1413
|
+
/* @__PURE__ */ jsx40(
|
|
1414
|
+
"a",
|
|
1415
|
+
{
|
|
1416
|
+
href: initFlowUrl(config.sdk.url, "recovery", flow),
|
|
1417
|
+
className: "text-button-link-brand-brand transition-colors hover:text-button-link-brand-brand-hover underline",
|
|
1418
|
+
children: intl.formatMessage({
|
|
1419
|
+
id: "forms.label.forgot-password",
|
|
1420
|
+
defaultMessage: "Forgot password?"
|
|
1421
|
+
})
|
|
1422
|
+
}
|
|
1423
|
+
),
|
|
1424
|
+
(resendNode == null ? void 0 : resendNode.attributes.node_type) === "input" && /* @__PURE__ */ jsx40(
|
|
1425
|
+
"button",
|
|
1426
|
+
{
|
|
1427
|
+
type: "submit",
|
|
1428
|
+
name: resendNode.attributes.name,
|
|
1429
|
+
value: resendNode.attributes.value,
|
|
1430
|
+
onClick: handleResend,
|
|
1431
|
+
className: "cursor-pointer text-button-link-brand-brand transition-colors hover:text-button-link-brand-brand-hover underline",
|
|
1432
|
+
children: intl.formatMessage({ id: "identities.messages.1070008" })
|
|
1433
|
+
}
|
|
1434
|
+
)
|
|
1435
|
+
] }),
|
|
1436
|
+
children,
|
|
1437
|
+
node.messages.map((message) => /* @__PURE__ */ jsx40(Message.Content, { message }, message.id)),
|
|
1438
|
+
fieldError && instanceOfUiText(fieldError) && /* @__PURE__ */ jsx40(Message.Content, { message: fieldError })
|
|
1439
|
+
] });
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
// src/theme/default/components/form/link-button.tsx
|
|
1443
|
+
import { getNodeLabel as getNodeLabel5 } from "@ory/client-fetch";
|
|
1444
|
+
import {
|
|
1445
|
+
uiTextToFormattedMessage as uiTextToFormattedMessage8
|
|
1446
|
+
} from "@ory/elements-react";
|
|
1447
|
+
import { forwardRef } from "react";
|
|
1448
|
+
import { useIntl as useIntl11 } from "react-intl";
|
|
1449
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
1450
|
+
var DefaultLinkButton = forwardRef(({ attributes, node }, ref) => {
|
|
1451
|
+
const intl = useIntl11();
|
|
1452
|
+
const label = getNodeLabel5(node);
|
|
1453
|
+
return /* @__PURE__ */ jsx41(
|
|
1454
|
+
"a",
|
|
1455
|
+
{
|
|
1456
|
+
...attributes,
|
|
1457
|
+
ref,
|
|
1458
|
+
title: label ? uiTextToFormattedMessage8(label, intl) : "",
|
|
1459
|
+
"data-testid": `ory/form/node/link/${attributes.id}`,
|
|
1460
|
+
className: cn(
|
|
1461
|
+
"antialiased rounded cursor-pointer text-center border gap-3 leading-none bg-button-primary-background-default hover:bg-button-primary-background-hover transition-colors text-button-primary-foreground-default hover:text-button-primary-foreground-hover p-4 font-medium"
|
|
1462
|
+
),
|
|
1463
|
+
children: label ? uiTextToFormattedMessage8(label, intl) : ""
|
|
1464
|
+
}
|
|
1465
|
+
);
|
|
1466
|
+
});
|
|
1467
|
+
DefaultLinkButton.displayName = "DefaultLinkButton";
|
|
1468
|
+
|
|
1469
|
+
// src/theme/default/components/form/pin-code-input.tsx
|
|
1470
|
+
import { useFormContext as useFormContext6 } from "react-hook-form";
|
|
1471
|
+
|
|
1472
|
+
// src/theme/default/components/form/shadcn/otp-input.tsx
|
|
1473
|
+
import { OTPInput, OTPInputContext } from "input-otp";
|
|
1474
|
+
import * as React22 from "react";
|
|
1475
|
+
import { jsx as jsx42, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
1476
|
+
var InputOTP = React22.forwardRef(({ className, containerClassName, ...props }, ref) => /* @__PURE__ */ jsx42(
|
|
1477
|
+
OTPInput,
|
|
1478
|
+
{
|
|
1479
|
+
ref,
|
|
1480
|
+
containerClassName: cn(
|
|
1481
|
+
"flex items-center gap-2 has-[:disabled]:opacity-50",
|
|
1482
|
+
containerClassName
|
|
1483
|
+
),
|
|
1484
|
+
className: cn("disabled:cursor-not-allowed", className),
|
|
1485
|
+
...props
|
|
1486
|
+
}
|
|
1487
|
+
));
|
|
1488
|
+
InputOTP.displayName = "InputOTP";
|
|
1489
|
+
var InputOTPGroup = React22.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx42("div", { ref, className: cn("flex items-center", className), ...props }));
|
|
1490
|
+
InputOTPGroup.displayName = "InputOTPGroup";
|
|
1491
|
+
var InputOTPSlot = React22.forwardRef(({ index, className, ...props }, ref) => {
|
|
1492
|
+
const inputOTPContext = React22.useContext(OTPInputContext);
|
|
1493
|
+
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
|
|
1494
|
+
return /* @__PURE__ */ jsxs24(
|
|
1495
|
+
"div",
|
|
1496
|
+
{
|
|
1497
|
+
ref,
|
|
1498
|
+
className: cn(
|
|
1499
|
+
"rounded-forms border border-solid bg-input-background-default py-[15px] text-center focus-visible:outline-none w-full",
|
|
1500
|
+
"relative flex items-center justify-center transition-all leading-none",
|
|
1501
|
+
isActive ? "border-input-border-focus" : "border-input-border-default",
|
|
1502
|
+
className
|
|
1503
|
+
),
|
|
1504
|
+
...props,
|
|
1505
|
+
children: [
|
|
1506
|
+
/* @__PURE__ */ jsx42("span", { className: "inline-block size-4", children: char }),
|
|
1507
|
+
hasFakeCaret && /* @__PURE__ */ jsx42("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx42("div", { className: "h-4 w-px animate-caret-blink bg-interface-background-brand-primary duration-700" }) })
|
|
1508
|
+
]
|
|
1509
|
+
}
|
|
1510
|
+
);
|
|
1511
|
+
});
|
|
1512
|
+
InputOTPSlot.displayName = "InputOTPSlot";
|
|
1513
|
+
|
|
1514
|
+
// src/theme/default/components/form/pin-code-input.tsx
|
|
1515
|
+
import { useOryFlow as useOryFlow9 } from "@ory/elements-react";
|
|
1516
|
+
import { FlowType as FlowType7 } from "@ory/client-fetch";
|
|
1517
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
1518
|
+
var DefaultPinCodeInput = ({ attributes }) => {
|
|
1519
|
+
const { setValue, watch } = useFormContext6();
|
|
1520
|
+
const { maxlength, name } = attributes;
|
|
1521
|
+
const elements = maxlength != null ? maxlength : 6;
|
|
1522
|
+
const { flowType } = useOryFlow9();
|
|
1523
|
+
const handleInputChange = (v) => {
|
|
1524
|
+
setValue(name, v);
|
|
1525
|
+
};
|
|
1526
|
+
const value = watch(name);
|
|
1527
|
+
return /* @__PURE__ */ jsx43(
|
|
1528
|
+
InputOTP,
|
|
1529
|
+
{
|
|
1530
|
+
maxLength: maxlength != null ? maxlength : 6,
|
|
1531
|
+
onChange: handleInputChange,
|
|
1532
|
+
name,
|
|
1533
|
+
value,
|
|
1534
|
+
children: /* @__PURE__ */ jsx43(
|
|
1535
|
+
InputOTPGroup,
|
|
1536
|
+
{
|
|
1537
|
+
className: cn(
|
|
1538
|
+
"w-full flex gap-2 justify-stretch",
|
|
1539
|
+
// The settings flow input fields are supposed to be dense, so we don't need the extra padding we want on the user flows.
|
|
1540
|
+
flowType === FlowType7.Settings && "max-w-[488px]"
|
|
1541
|
+
),
|
|
1542
|
+
children: [...Array(elements)].map((_, index) => /* @__PURE__ */ jsx43(InputOTPSlot, { index }, index))
|
|
1543
|
+
}
|
|
1544
|
+
)
|
|
1545
|
+
}
|
|
1546
|
+
);
|
|
1547
|
+
};
|
|
1548
|
+
|
|
1549
|
+
// src/theme/default/components/form/section.tsx
|
|
1550
|
+
import { jsx as jsx44, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
1551
|
+
var DefaultFormSection = ({
|
|
1552
|
+
children,
|
|
1553
|
+
nodes: _nodes,
|
|
1554
|
+
...rest
|
|
1555
|
+
}) => {
|
|
1556
|
+
return /* @__PURE__ */ jsx44(
|
|
1557
|
+
"form",
|
|
1558
|
+
{
|
|
1559
|
+
className: "flex w-full max-w-screen-sm flex-col md:max-w-[712px] lg:max-w-[802px] xl:max-w-[896px] px-4",
|
|
1560
|
+
...rest,
|
|
1561
|
+
children
|
|
1562
|
+
}
|
|
1563
|
+
);
|
|
1564
|
+
};
|
|
1565
|
+
var DefaultFormSectionContent = ({
|
|
1566
|
+
title,
|
|
1567
|
+
description,
|
|
1568
|
+
children
|
|
1569
|
+
}) => {
|
|
1570
|
+
return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-8 rounded-t-cards border border-b-0 border-interface-border-default-primary bg-interface-background-default-primary px-6 py-8", children: [
|
|
1571
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-2", children: [
|
|
1572
|
+
/* @__PURE__ */ jsx44("h3", { className: "font-medium text-interface-foreground-default-primary", children: title }),
|
|
1573
|
+
/* @__PURE__ */ jsx44("span", { className: "text-interface-foreground-default-secondary", children: description })
|
|
1574
|
+
] }),
|
|
1575
|
+
children
|
|
1576
|
+
] });
|
|
1577
|
+
};
|
|
1578
|
+
var DefaultFormSectionFooter = ({
|
|
1579
|
+
children,
|
|
1580
|
+
text
|
|
1581
|
+
}) => {
|
|
1582
|
+
return /* @__PURE__ */ jsxs25(
|
|
1583
|
+
"div",
|
|
1584
|
+
{
|
|
1585
|
+
className: cn(
|
|
1586
|
+
"flex min-h-[72px] items-center justify-between gap-2 rounded-b-cards border border-interface-border-default-primary bg-interface-background-default-secondary px-6 py-4 text-interface-foreground-default-tertiary"
|
|
1587
|
+
),
|
|
1588
|
+
children: [
|
|
1589
|
+
/* @__PURE__ */ jsx44("span", { children: text }),
|
|
1590
|
+
children
|
|
1591
|
+
]
|
|
1592
|
+
}
|
|
1593
|
+
);
|
|
1594
|
+
};
|
|
1595
|
+
|
|
1596
|
+
// src/theme/default/components/form/text.tsx
|
|
1597
|
+
import { uiTextToFormattedMessage as uiTextToFormattedMessage9 } from "@ory/elements-react";
|
|
1598
|
+
import { useIntl as useIntl12 } from "react-intl";
|
|
1599
|
+
import { Fragment as Fragment3, jsx as jsx45, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
1600
|
+
function DefaultText({ node, attributes }) {
|
|
1601
|
+
var _a;
|
|
1602
|
+
const intl = useIntl12();
|
|
1603
|
+
return /* @__PURE__ */ jsxs26(Fragment3, { children: [
|
|
1604
|
+
/* @__PURE__ */ jsx45("p", { "data-testid": `ory/form/node/text/${attributes.id}/label`, children: node.meta.label ? uiTextToFormattedMessage9(node.meta.label, intl) : "" }),
|
|
1605
|
+
(_a = attributes.text.context.secrets) == null ? void 0 : _a.map((text, index) => /* @__PURE__ */ jsx45(
|
|
1606
|
+
"pre",
|
|
1607
|
+
{
|
|
1608
|
+
"data-testid": `ory/form/node/text/lookup_secret_codes/text`,
|
|
1609
|
+
children: /* @__PURE__ */ jsx45("code", { children: text ? uiTextToFormattedMessage9(text, intl) : "" })
|
|
1610
|
+
},
|
|
1611
|
+
index
|
|
1612
|
+
))
|
|
1613
|
+
] });
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
// src/theme/default/components/generic/page-header.tsx
|
|
1617
|
+
import { useComponents as useComponents3 } from "@ory/elements-react";
|
|
1618
|
+
|
|
1619
|
+
// src/theme/default/components/ui/user-menu.tsx
|
|
1620
|
+
import { DropdownMenuLabel as DropdownMenuLabel2 } from "@radix-ui/react-dropdown-menu";
|
|
1621
|
+
import { useCallback, useEffect as useEffect3, useState as useState3 } from "react";
|
|
1622
|
+
import { useOryFlow as useOryFlow10 } from "@ory/elements-react";
|
|
1623
|
+
|
|
1624
|
+
// src/util/client.ts
|
|
1625
|
+
import {
|
|
1626
|
+
Configuration,
|
|
1627
|
+
FrontendApi
|
|
1628
|
+
} from "@ory/client-fetch";
|
|
1629
|
+
function frontendClient(sdkUrl, opts = {}) {
|
|
1630
|
+
const config = new Configuration({
|
|
1631
|
+
...opts,
|
|
1632
|
+
basePath: sdkUrl,
|
|
1633
|
+
headers: {
|
|
1634
|
+
Accept: "application/json",
|
|
1635
|
+
...opts.headers
|
|
1636
|
+
}
|
|
1637
|
+
});
|
|
1638
|
+
return new FrontendApi(config);
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
// src/theme/default/assets/icons/logout.svg
|
|
1642
|
+
import * as React23 from "react";
|
|
1643
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
1644
|
+
var SvgLogout = (props) => {
|
|
1645
|
+
var _a, _b;
|
|
1646
|
+
return /* @__PURE__ */ jsx46("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: /* @__PURE__ */ jsx46("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M9.333 5.334V4A1.333 1.333 0 0 0 8 2.667H3.333A1.333 1.333 0 0 0 2 4v8a1.333 1.333 0 0 0 1.333 1.334H8A1.333 1.333 0 0 0 9.333 12v-1.333M4.667 8H14m0 0-2-2m2 2-2 2" }) });
|
|
1647
|
+
};
|
|
1648
|
+
var logout_default = SvgLogout;
|
|
1649
|
+
|
|
1650
|
+
// src/theme/default/assets/icons/settings.svg
|
|
1651
|
+
import * as React24 from "react";
|
|
1652
|
+
import { jsx as jsx47, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
1653
|
+
var SvgSettings = (props) => {
|
|
1654
|
+
var _a, _b;
|
|
1655
|
+
return /* @__PURE__ */ jsx47("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: /* @__PURE__ */ jsxs27("g", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1656
|
+
/* @__PURE__ */ jsx47("path", { d: "M6.883 2.878c.284-1.17 1.95-1.17 2.234 0a1.15 1.15 0 0 0 1.715.71c1.029-.626 2.207.551 1.58 1.58a1.148 1.148 0 0 0 .71 1.715c1.17.284 1.17 1.95 0 2.234a1.15 1.15 0 0 0-.71 1.715c.626 1.029-.551 2.207-1.58 1.58a1.148 1.148 0 0 0-1.715.71c-.284 1.17-1.95 1.17-2.234 0a1.15 1.15 0 0 0-1.715-.71c-1.029.626-2.207-.551-1.58-1.58a1.15 1.15 0 0 0-.71-1.715c-1.17-.284-1.17-1.95 0-2.234a1.15 1.15 0 0 0 .71-1.715c-.626-1.029.551-2.207 1.58-1.58.667.405 1.531.047 1.715-.71" }),
|
|
1657
|
+
/* @__PURE__ */ jsx47("path", { d: "M6 8a2 2 0 1 0 4 0 2 2 0 0 0-4 0" })
|
|
1658
|
+
] }) });
|
|
1659
|
+
};
|
|
1660
|
+
var settings_default = SvgSettings;
|
|
1661
|
+
|
|
1662
|
+
// src/theme/default/utils/user.ts
|
|
1663
|
+
function isTraitsIndexable(traits) {
|
|
1664
|
+
return typeof traits === "object" && traits !== null;
|
|
1665
|
+
}
|
|
1666
|
+
var getUserInitials = (session) => {
|
|
1667
|
+
var _a, _b;
|
|
1668
|
+
const avatar = "";
|
|
1669
|
+
let primary = "";
|
|
1670
|
+
let secondary = "";
|
|
1671
|
+
if (!((_a = session == null ? void 0 : session.identity) == null ? void 0 : _a.traits) || !isTraitsIndexable(session.identity.traits)) {
|
|
1672
|
+
return {
|
|
1673
|
+
primary,
|
|
1674
|
+
secondary,
|
|
1675
|
+
avatar
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
const traits = (_b = session.identity) == null ? void 0 : _b.traits;
|
|
1679
|
+
if (traits.email && typeof traits.email === "string") {
|
|
1680
|
+
secondary = traits.email;
|
|
1681
|
+
}
|
|
1682
|
+
if (traits.name) {
|
|
1683
|
+
if (typeof traits.name === "string") {
|
|
1684
|
+
primary = traits.name;
|
|
1685
|
+
}
|
|
1686
|
+
if (typeof traits.name === "object" && traits.name && traits.name.first && traits.name.last) {
|
|
1687
|
+
primary = traits.name.first + " " + traits.name.last;
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
if (primary === "") {
|
|
1691
|
+
primary = secondary;
|
|
1692
|
+
secondary = "";
|
|
1693
|
+
}
|
|
1694
|
+
return {
|
|
1695
|
+
primary,
|
|
1696
|
+
secondary,
|
|
1697
|
+
avatar
|
|
1698
|
+
};
|
|
1699
|
+
};
|
|
1700
|
+
|
|
1701
|
+
// src/theme/default/components/ui/dropdown-menu.tsx
|
|
1702
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
1703
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
1704
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
1705
|
+
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
1706
|
+
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
1707
|
+
var DropdownMenuContent = forwardRef3(({ className, sideOffset = 16, ...props }, ref) => /* @__PURE__ */ jsx48(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx48(
|
|
1708
|
+
DropdownMenuPrimitive.Content,
|
|
1709
|
+
{
|
|
1710
|
+
ref,
|
|
1711
|
+
sideOffset,
|
|
1712
|
+
align: "end",
|
|
1713
|
+
className: cn(
|
|
1714
|
+
"z-50 min-w-[19rem] overflow-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
1715
|
+
"border border-interface-border-default-primary bg-interface-background-default-primary rounded-cards",
|
|
1716
|
+
className
|
|
1717
|
+
),
|
|
1718
|
+
...props
|
|
1719
|
+
}
|
|
1720
|
+
) }));
|
|
1721
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
1722
|
+
var DropdownMenuItem = forwardRef3(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx48(
|
|
1723
|
+
DropdownMenuPrimitive.Item,
|
|
1724
|
+
{
|
|
1725
|
+
ref,
|
|
1726
|
+
className: cn(
|
|
1727
|
+
"relative flex cursor-pointer select-none items-center outline-none transition-colors data-[disabled]:pointer-events-none",
|
|
1728
|
+
"px-8 py-3 lg:py-4.5 text-sm gap-6",
|
|
1729
|
+
"first:border-0 border-t border-button-secondary-border-default hover:border-button-social-border-hover",
|
|
1730
|
+
"text-button-secondary-foreground-default bg-button-secondary-background-default",
|
|
1731
|
+
"hover:text-button-secondary-foreground-hover hover:bg-button-secondary-background-hover",
|
|
1732
|
+
"data-[disabled]:text-button-secondary-foreground-disabled data-[disabled]:bg-button-secondary-background-disabled",
|
|
1733
|
+
inset && "pl-8",
|
|
1734
|
+
className
|
|
1735
|
+
),
|
|
1736
|
+
...props
|
|
1737
|
+
}
|
|
1738
|
+
));
|
|
1739
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
1740
|
+
var DropdownMenuLabel = forwardRef3(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx48(
|
|
1741
|
+
DropdownMenuPrimitive.Label,
|
|
1742
|
+
{
|
|
1743
|
+
ref,
|
|
1744
|
+
className: cn(
|
|
1745
|
+
"px-2 py-1.5 text-sm font-semibold",
|
|
1746
|
+
inset && "pl-8",
|
|
1747
|
+
className
|
|
1748
|
+
),
|
|
1749
|
+
...props
|
|
1750
|
+
}
|
|
1751
|
+
));
|
|
1752
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
1753
|
+
|
|
1754
|
+
// src/theme/default/components/ui/user-avater.tsx
|
|
1755
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
1756
|
+
|
|
1757
|
+
// src/theme/default/assets/icons/user.svg
|
|
1758
|
+
import * as React25 from "react";
|
|
1759
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
1760
|
+
var SvgUser = (props) => {
|
|
1761
|
+
var _a, _b;
|
|
1762
|
+
return /* @__PURE__ */ jsx49("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: /* @__PURE__ */ jsx49("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M6 21v-2a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v2M8 7a4 4 0 1 0 8 0 4 4 0 0 0-8 0" }) });
|
|
1763
|
+
};
|
|
1764
|
+
var user_default = SvgUser;
|
|
1765
|
+
|
|
1766
|
+
// src/theme/default/components/ui/user-avater.tsx
|
|
1767
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
1768
|
+
var UserAvatar = forwardRef4(
|
|
1769
|
+
({ initials, ...rest }, ref) => {
|
|
1770
|
+
return /* @__PURE__ */ jsx50(
|
|
1771
|
+
"button",
|
|
1772
|
+
{
|
|
1773
|
+
ref,
|
|
1774
|
+
className: "relative flex size-10 items-center justify-center overflow-hidden rounded-[999px] bg-button-primary-background-default hover:bg-button-primary-background-hover",
|
|
1775
|
+
...rest,
|
|
1776
|
+
children: /* @__PURE__ */ jsx50("div", { className: "relative flex size-full items-center justify-center", children: initials.avatar ? /* @__PURE__ */ jsx50(
|
|
1777
|
+
"img",
|
|
1778
|
+
{
|
|
1779
|
+
src: initials.avatar,
|
|
1780
|
+
alt: initials.primary,
|
|
1781
|
+
className: "w-full object-contain"
|
|
1782
|
+
}
|
|
1783
|
+
) : /* @__PURE__ */ jsx50(
|
|
1784
|
+
user_default,
|
|
1785
|
+
{
|
|
1786
|
+
size: 24,
|
|
1787
|
+
className: "text-button-primary-foreground-default"
|
|
1788
|
+
}
|
|
1789
|
+
) })
|
|
1790
|
+
}
|
|
1791
|
+
);
|
|
1792
|
+
}
|
|
1793
|
+
);
|
|
1794
|
+
UserAvatar.displayName = "UserAvatar";
|
|
1795
|
+
|
|
1796
|
+
// src/theme/default/components/ui/user-menu.tsx
|
|
1797
|
+
import { jsx as jsx51, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
1798
|
+
var UserMenu = ({ session }) => {
|
|
1799
|
+
const { config } = useOryFlow10();
|
|
1800
|
+
const initials = getUserInitials(session);
|
|
1801
|
+
const [logoutFlow, setLogoutFlow] = useState3();
|
|
1802
|
+
const fetchLogoutFlow = useCallback(async () => {
|
|
1803
|
+
const flow = await frontendClient(config.sdk.url).createBrowserLogoutFlow();
|
|
1804
|
+
setLogoutFlow(flow);
|
|
1805
|
+
}, [config.sdk.url]);
|
|
1806
|
+
useEffect3(() => {
|
|
1807
|
+
void fetchLogoutFlow();
|
|
1808
|
+
}, [fetchLogoutFlow]);
|
|
1809
|
+
return /* @__PURE__ */ jsxs28(DropdownMenu, { children: [
|
|
1810
|
+
/* @__PURE__ */ jsx51(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx51(UserAvatar, { initials }) }),
|
|
1811
|
+
/* @__PURE__ */ jsxs28(DropdownMenuContent, { children: [
|
|
1812
|
+
/* @__PURE__ */ jsxs28(DropdownMenuLabel2, { className: "flex gap-3 px-5 py-4.5", children: [
|
|
1813
|
+
/* @__PURE__ */ jsx51(UserAvatar, { disabled: true, initials }),
|
|
1814
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex flex-col justify-center text-sm leading-tight", children: [
|
|
1815
|
+
/* @__PURE__ */ jsx51("div", { className: "text-interface-foreground-default-primary leading-tight font-medium", children: initials.primary }),
|
|
1816
|
+
initials.secondary && /* @__PURE__ */ jsx51("div", { className: "text-interface-foreground-default-tertiary leading-tight", children: initials.secondary })
|
|
1817
|
+
] })
|
|
1818
|
+
] }),
|
|
1819
|
+
/* @__PURE__ */ jsx51(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxs28("a", { href: "/settings", children: [
|
|
1820
|
+
/* @__PURE__ */ jsx51(settings_default, { size: 16 }),
|
|
1821
|
+
" User settings"
|
|
1822
|
+
] }) }),
|
|
1823
|
+
/* @__PURE__ */ jsx51(DropdownMenuItem, { asChild: true, disabled: !(logoutFlow == null ? void 0 : logoutFlow.logout_url), children: /* @__PURE__ */ jsxs28("a", { href: logoutFlow == null ? void 0 : logoutFlow.logout_url, children: [
|
|
1824
|
+
/* @__PURE__ */ jsx51(logout_default, { size: 16 }),
|
|
1825
|
+
" Logout"
|
|
1826
|
+
] }) })
|
|
1827
|
+
] })
|
|
1828
|
+
] });
|
|
1829
|
+
};
|
|
1830
|
+
|
|
1831
|
+
// src/theme/default/components/generic/page-header.tsx
|
|
1832
|
+
import { useSession } from "@ory/elements-react/client";
|
|
1833
|
+
import { jsx as jsx52, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
1834
|
+
var DefaultPageHeader = (_props) => {
|
|
1835
|
+
const { Card } = useComponents3();
|
|
1836
|
+
const { session } = useSession();
|
|
1837
|
+
return /* @__PURE__ */ jsx52("div", { className: "mt-16 flex max-w-screen-sm w-full md:max-w-[712px] lg:max-w-[802px] xl:max-w-[896px] flex-col gap-3 px-4", children: /* @__PURE__ */ jsx52("div", { className: "flex flex-col gap-12", children: /* @__PURE__ */ jsxs29("div", { className: "flex max-h-10 flex-1 justify-between gap-2", children: [
|
|
1838
|
+
/* @__PURE__ */ jsx52("div", { className: "relative h-10 flex-1", children: /* @__PURE__ */ jsx52(Card.Logo, {}) }),
|
|
1839
|
+
/* @__PURE__ */ jsx52(UserMenu, { session })
|
|
1840
|
+
] }) }) });
|
|
1841
|
+
};
|
|
1842
|
+
|
|
1843
|
+
// src/theme/default/components/settings/settings-oidc.tsx
|
|
1844
|
+
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
1845
|
+
import { useFormContext as useFormContext7 } from "react-hook-form";
|
|
1846
|
+
|
|
1847
|
+
// src/theme/default/assets/icons/trash.svg
|
|
1848
|
+
import * as React26 from "react";
|
|
1849
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
1850
|
+
var SvgTrash = (props) => {
|
|
1851
|
+
var _a, _b;
|
|
1852
|
+
return /* @__PURE__ */ jsx53("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: /* @__PURE__ */ jsx53("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M4 7h16m-10 4v6m4-6v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3" }) });
|
|
1853
|
+
};
|
|
1854
|
+
var trash_default = SvgTrash;
|
|
1855
|
+
|
|
1856
|
+
// src/theme/default/components/settings/settings-oidc.tsx
|
|
1857
|
+
import { jsx as jsx54, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
1858
|
+
function DefaultSettingsOidc({
|
|
1859
|
+
linkButtons,
|
|
1860
|
+
unlinkButtons
|
|
1861
|
+
}) {
|
|
1862
|
+
const hasLinkButtons = linkButtons.length > 0;
|
|
1863
|
+
const hasUnlinkButtons = unlinkButtons.length > 0;
|
|
1864
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-8", children: [
|
|
1865
|
+
hasLinkButtons && /* @__PURE__ */ jsx54("div", { className: "grid items-start gap-3 grid-cols-1 sm:grid-cols-2 md:grid-cols-3", children: linkButtons.map((button) => {
|
|
1866
|
+
const attrs = button.attributes;
|
|
1867
|
+
return /* @__PURE__ */ jsx54(
|
|
1868
|
+
DefaultButtonSocial,
|
|
1869
|
+
{
|
|
1870
|
+
showLabel: true,
|
|
1871
|
+
node: button,
|
|
1872
|
+
attributes: attrs,
|
|
1873
|
+
onClick: button.onClick
|
|
1874
|
+
},
|
|
1875
|
+
attrs.value
|
|
1876
|
+
);
|
|
1877
|
+
}) }),
|
|
1878
|
+
hasUnlinkButtons && hasLinkButtons ? /* @__PURE__ */ jsx54(DefaultHorizontalDivider, {}) : null,
|
|
1879
|
+
unlinkButtons.map((button) => {
|
|
1880
|
+
if (button.attributes.node_type !== "input") {
|
|
1881
|
+
return null;
|
|
1882
|
+
}
|
|
1883
|
+
return /* @__PURE__ */ jsx54(UnlinkRow, { button }, button.attributes.value);
|
|
1884
|
+
})
|
|
1885
|
+
] });
|
|
1886
|
+
}
|
|
1887
|
+
function UnlinkRow({ button }) {
|
|
1888
|
+
var _a, _b;
|
|
1889
|
+
const [clicked, setClicked] = useState4(false);
|
|
1890
|
+
const {
|
|
1891
|
+
formState: { isSubmitting }
|
|
1892
|
+
} = useFormContext7();
|
|
1893
|
+
const attrs = button.attributes;
|
|
1894
|
+
const provider = (_b = extractProvider((_a = button.meta.label) == null ? void 0 : _a.context)) != null ? _b : "";
|
|
1895
|
+
const Logo = attrs.value in provider_logos_default ? provider_logos_default[attrs.value] : provider_logos_default.generic;
|
|
1896
|
+
const localOnClick = () => {
|
|
1897
|
+
button.onClick();
|
|
1898
|
+
setTimeout(() => {
|
|
1899
|
+
setClicked(true);
|
|
1900
|
+
}, 100);
|
|
1901
|
+
};
|
|
1902
|
+
useEffect4(() => {
|
|
1903
|
+
if (!isSubmitting) {
|
|
1904
|
+
setClicked(false);
|
|
1905
|
+
}
|
|
1906
|
+
}, [isSubmitting]);
|
|
1907
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex justify-between", children: [
|
|
1908
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-6", children: [
|
|
1909
|
+
/* @__PURE__ */ jsx54(Logo, { size: 32 }),
|
|
1910
|
+
/* @__PURE__ */ jsx54("p", { className: "text-sm font-medium text-interface-foreground-default-secondary", children: provider })
|
|
1911
|
+
] }),
|
|
1912
|
+
/* @__PURE__ */ jsx54(
|
|
1913
|
+
"button",
|
|
1914
|
+
{
|
|
1915
|
+
...attrs,
|
|
1916
|
+
type: "submit",
|
|
1917
|
+
onClick: localOnClick,
|
|
1918
|
+
disabled: isSubmitting,
|
|
1919
|
+
className: "relative",
|
|
1920
|
+
title: `Unlink ${provider}`,
|
|
1921
|
+
children: clicked ? /* @__PURE__ */ jsx54(Spinner, { className: "relative" }) : /* @__PURE__ */ jsx54(
|
|
1922
|
+
trash_default,
|
|
1923
|
+
{
|
|
1924
|
+
className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover",
|
|
1925
|
+
size: 24
|
|
1926
|
+
}
|
|
1927
|
+
)
|
|
1928
|
+
}
|
|
1929
|
+
)
|
|
1930
|
+
] }, attrs.value);
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
// src/theme/default/components/settings/settings-passkey.tsx
|
|
1934
|
+
import { useComponents as useComponents4 } from "@ory/elements-react";
|
|
1935
|
+
import { useFormContext as useFormContext8 } from "react-hook-form";
|
|
1936
|
+
import { jsx as jsx55, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
1937
|
+
function DefaultSettingsPasskey({
|
|
1938
|
+
triggerButton,
|
|
1939
|
+
removeButtons
|
|
1940
|
+
}) {
|
|
1941
|
+
const {
|
|
1942
|
+
formState: { isSubmitting }
|
|
1943
|
+
} = useFormContext8();
|
|
1944
|
+
const { Node } = useComponents4();
|
|
1945
|
+
const hasRemoveButtons = removeButtons.length > 0;
|
|
1946
|
+
return /* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-8", children: [
|
|
1947
|
+
/* @__PURE__ */ jsx55("div", { className: "flex max-w-[60%] items-end gap-3", children: triggerButton && /* @__PURE__ */ jsx55(
|
|
1948
|
+
Node.Button,
|
|
1949
|
+
{
|
|
1950
|
+
node: triggerButton,
|
|
1951
|
+
attributes: triggerButton.attributes,
|
|
1952
|
+
onClick: triggerButton.onClick
|
|
1953
|
+
}
|
|
1954
|
+
) }),
|
|
1955
|
+
hasRemoveButtons ? /* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-8", children: [
|
|
1956
|
+
/* @__PURE__ */ jsx55(DefaultHorizontalDivider, {}),
|
|
1957
|
+
/* @__PURE__ */ jsx55("div", { className: "flex flex-col gap-2", children: removeButtons.map((node, i) => {
|
|
1958
|
+
var _a, _b;
|
|
1959
|
+
const context = (_b = (_a = node.meta.label) == null ? void 0 : _a.context) != null ? _b : {};
|
|
1960
|
+
const addedAt = "added_at" in context ? context.added_at : null;
|
|
1961
|
+
const displayName = "display_name" in context ? context.display_name : null;
|
|
1962
|
+
const keyId = "value" in node.attributes ? node.attributes.value : null;
|
|
1963
|
+
return /* @__PURE__ */ jsxs31(
|
|
1964
|
+
"div",
|
|
1965
|
+
{
|
|
1966
|
+
className: "flex justify-between gap-6 md:items-center",
|
|
1967
|
+
children: [
|
|
1968
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex gap-2 items-center flex-1", children: [
|
|
1969
|
+
/* @__PURE__ */ jsx55(
|
|
1970
|
+
passkey_default,
|
|
1971
|
+
{
|
|
1972
|
+
size: 32,
|
|
1973
|
+
className: "text-interface-foreground-default-primary"
|
|
1974
|
+
}
|
|
1975
|
+
),
|
|
1976
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex-1 flex-col md:flex-row md:items-center flex md:justify-between gap-4", children: [
|
|
1977
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex-1 flex-col", children: [
|
|
1978
|
+
/* @__PURE__ */ jsx55("p", { className: "text-sm font-medium text-interface-foreground-default-secondary", children: displayName }),
|
|
1979
|
+
/* @__PURE__ */ jsx55("span", { className: "text-sm text-interface-foreground-default-tertiary hidden sm:block", children: keyId })
|
|
1980
|
+
] }),
|
|
1981
|
+
addedAt && /* @__PURE__ */ jsx55("p", { className: "text-sm text-interface-foreground-default-tertiary", children: new Intl.DateTimeFormat(void 0, {
|
|
1982
|
+
dateStyle: "long"
|
|
1983
|
+
}).format(new Date(addedAt)) })
|
|
1984
|
+
] })
|
|
1985
|
+
] }),
|
|
1986
|
+
/* @__PURE__ */ jsx55(
|
|
1987
|
+
"button",
|
|
1988
|
+
{
|
|
1989
|
+
...node.attributes,
|
|
1990
|
+
type: "submit",
|
|
1991
|
+
onClick: node.onClick,
|
|
1992
|
+
disabled: isSubmitting,
|
|
1993
|
+
className: "relative",
|
|
1994
|
+
children: isSubmitting ? /* @__PURE__ */ jsx55(Spinner, { className: "relative" }) : /* @__PURE__ */ jsx55(
|
|
1995
|
+
trash_default,
|
|
1996
|
+
{
|
|
1997
|
+
className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover",
|
|
1998
|
+
size: 24
|
|
1999
|
+
}
|
|
2000
|
+
)
|
|
2001
|
+
}
|
|
2002
|
+
)
|
|
2003
|
+
]
|
|
2004
|
+
},
|
|
2005
|
+
`passkey-remove-button-${i}`
|
|
2006
|
+
);
|
|
2007
|
+
}) })
|
|
2008
|
+
] }) : null
|
|
2009
|
+
] });
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
// src/theme/default/assets/icons/download.svg
|
|
2013
|
+
import * as React27 from "react";
|
|
2014
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
2015
|
+
var SvgDownload = (props) => {
|
|
2016
|
+
var _a, _b;
|
|
2017
|
+
return /* @__PURE__ */ jsx56("svg", { xmlns: "http://www.w3.org/2000/svg", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, fill: "none", ...props, children: /* @__PURE__ */ jsx56("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2M7 11l5 5m0 0 5-5m-5 5V4" }) });
|
|
2018
|
+
};
|
|
2019
|
+
var download_default = SvgDownload;
|
|
2020
|
+
|
|
2021
|
+
// src/theme/default/assets/icons/eye.svg
|
|
2022
|
+
import * as React28 from "react";
|
|
2023
|
+
import { jsx as jsx57, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2024
|
+
var SvgEye = (props) => {
|
|
2025
|
+
var _a, _b;
|
|
2026
|
+
return /* @__PURE__ */ jsx57("svg", { xmlns: "http://www.w3.org/2000/svg", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, fill: "none", ...props, children: /* @__PURE__ */ jsxs32("g", { strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2027
|
+
/* @__PURE__ */ jsx57("path", { stroke: "currentColor", d: "M10 12a2 2 0 1 0 4 0 2 2 0 0 0-4 0" }),
|
|
2028
|
+
/* @__PURE__ */ jsx57("path", { stroke: "#64748B", d: "M21 12q-3.6 6-9 6t-9-6q3.6-6 9-6t9 6" })
|
|
2029
|
+
] }) });
|
|
2030
|
+
};
|
|
2031
|
+
var eye_default = SvgEye;
|
|
2032
|
+
|
|
2033
|
+
// src/theme/default/assets/icons/refresh.svg
|
|
2034
|
+
import * as React29 from "react";
|
|
2035
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
2036
|
+
var SvgRefresh = (props) => {
|
|
2037
|
+
var _a, _b;
|
|
2038
|
+
return /* @__PURE__ */ jsx58("svg", { xmlns: "http://www.w3.org/2000/svg", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, fill: "none", ...props, children: /* @__PURE__ */ jsx58("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4" }) });
|
|
2039
|
+
};
|
|
2040
|
+
var refresh_default = SvgRefresh;
|
|
2041
|
+
|
|
2042
|
+
// src/theme/default/components/settings/settings-recovery-codes.tsx
|
|
2043
|
+
import { useFormContext as useFormContext9 } from "react-hook-form";
|
|
2044
|
+
import { Fragment as Fragment4, jsx as jsx59, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
2045
|
+
function DefaultSettingsRecoveryCodes({
|
|
2046
|
+
codes,
|
|
2047
|
+
regnerateButton,
|
|
2048
|
+
revealButton,
|
|
2049
|
+
onRegenerate,
|
|
2050
|
+
onReveal
|
|
2051
|
+
}) {
|
|
2052
|
+
const {
|
|
2053
|
+
formState: { isSubmitting }
|
|
2054
|
+
} = useFormContext9();
|
|
2055
|
+
const onDownload = () => {
|
|
2056
|
+
const element = document.createElement("a");
|
|
2057
|
+
const file = new Blob([codes.join("\n")], {
|
|
2058
|
+
type: "text/plain"
|
|
2059
|
+
});
|
|
2060
|
+
element.href = URL.createObjectURL(file);
|
|
2061
|
+
element.download = "recovery-codes.txt";
|
|
2062
|
+
document.body.appendChild(element);
|
|
2063
|
+
element.click();
|
|
2064
|
+
};
|
|
2065
|
+
const hasCodes = codes.length >= 1;
|
|
2066
|
+
return /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-8", children: [
|
|
2067
|
+
codes.length > 0 && /* @__PURE__ */ jsx59(DefaultHorizontalDivider, {}),
|
|
2068
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex gap-4 justify-between", children: [
|
|
2069
|
+
/* @__PURE__ */ jsx59("span", { className: "text-interface-foreground-default-tertiary", children: revealButton && "Reveal recovery codes" }),
|
|
2070
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex gap-2", children: [
|
|
2071
|
+
regnerateButton && codes.length > 0 && /* @__PURE__ */ jsx59(
|
|
2072
|
+
"button",
|
|
2073
|
+
{
|
|
2074
|
+
...regnerateButton.attributes,
|
|
2075
|
+
type: "submit",
|
|
2076
|
+
className: "ml-auto",
|
|
2077
|
+
onClick: onRegenerate,
|
|
2078
|
+
disabled: isSubmitting,
|
|
2079
|
+
"data-loading": isSubmitting,
|
|
2080
|
+
children: /* @__PURE__ */ jsx59(
|
|
2081
|
+
refresh_default,
|
|
2082
|
+
{
|
|
2083
|
+
size: 24,
|
|
2084
|
+
className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover"
|
|
2085
|
+
}
|
|
2086
|
+
)
|
|
2087
|
+
}
|
|
2088
|
+
),
|
|
2089
|
+
revealButton && /* @__PURE__ */ jsx59(Fragment4, { children: /* @__PURE__ */ jsx59(
|
|
2090
|
+
"button",
|
|
2091
|
+
{
|
|
2092
|
+
...revealButton.attributes,
|
|
2093
|
+
type: "submit",
|
|
2094
|
+
className: "ml-auto",
|
|
2095
|
+
onClick: onReveal,
|
|
2096
|
+
title: "Reveal recovery codes",
|
|
2097
|
+
children: /* @__PURE__ */ jsx59(
|
|
2098
|
+
eye_default,
|
|
2099
|
+
{
|
|
2100
|
+
size: 24,
|
|
2101
|
+
className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover"
|
|
2102
|
+
}
|
|
2103
|
+
)
|
|
2104
|
+
}
|
|
2105
|
+
) }),
|
|
2106
|
+
hasCodes && /* @__PURE__ */ jsx59(
|
|
2107
|
+
"button",
|
|
2108
|
+
{
|
|
2109
|
+
onClick: onDownload,
|
|
2110
|
+
type: "button",
|
|
2111
|
+
className: "ml-auto",
|
|
2112
|
+
"data-testid": "ory/screen/settings/group/recovery_code/download",
|
|
2113
|
+
title: "Download recovery codes",
|
|
2114
|
+
children: /* @__PURE__ */ jsx59(
|
|
2115
|
+
download_default,
|
|
2116
|
+
{
|
|
2117
|
+
size: 24,
|
|
2118
|
+
className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover"
|
|
2119
|
+
}
|
|
2120
|
+
)
|
|
2121
|
+
}
|
|
2122
|
+
)
|
|
2123
|
+
] })
|
|
2124
|
+
] }),
|
|
2125
|
+
hasCodes ? /* @__PURE__ */ jsx59("div", { className: "rounded-general p-6 bg-interface-background-default-secondary border-interface-border-default-primary", children: /* @__PURE__ */ jsx59(
|
|
2126
|
+
"div",
|
|
2127
|
+
{
|
|
2128
|
+
className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 flex-wrap gap-4 text-sm text-interface-foreground-default-primary",
|
|
2129
|
+
"data-testid": "ory/screen/settings/group/recovery_code/codes",
|
|
2130
|
+
children: codes.map((code) => /* @__PURE__ */ jsx59("p", { children: code }, code))
|
|
2131
|
+
}
|
|
2132
|
+
) }) : null
|
|
2133
|
+
] });
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
// src/theme/default/components/settings/settings-totp.tsx
|
|
2137
|
+
import { useComponents as useComponents5 } from "@ory/elements-react";
|
|
2138
|
+
|
|
2139
|
+
// src/theme/default/assets/icons/qrcode.svg
|
|
2140
|
+
import * as React30 from "react";
|
|
2141
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
2142
|
+
var SvgQrcode = (props) => {
|
|
2143
|
+
var _a, _b;
|
|
2144
|
+
return /* @__PURE__ */ jsx60("svg", { xmlns: "http://www.w3.org/2000/svg", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, fill: "none", ...props, children: /* @__PURE__ */ jsx60("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M9.333 22.667v.013m0-13.346v.013m13.333-.013v.013m0 9.32h-4v4m8-4v.013m-8 7.987h4m0-4h4v4m-21.333-20a1.333 1.333 0 0 1 1.333-1.333H12a1.333 1.333 0 0 1 1.333 1.333V12A1.334 1.334 0 0 1 12 13.334H6.666A1.334 1.334 0 0 1 5.333 12zm13.333 0A1.333 1.333 0 0 1 20 5.334h5.333a1.333 1.333 0 0 1 1.333 1.333V12a1.333 1.333 0 0 1-1.333 1.334H20A1.333 1.333 0 0 1 18.666 12zM5.333 20a1.333 1.333 0 0 1 1.333-1.333H12A1.333 1.333 0 0 1 13.333 20v5.334A1.333 1.333 0 0 1 12 26.667H6.666a1.333 1.333 0 0 1-1.333-1.334z" }) });
|
|
2145
|
+
};
|
|
2146
|
+
var qrcode_default = SvgQrcode;
|
|
2147
|
+
|
|
2148
|
+
// src/theme/default/components/settings/settings-totp.tsx
|
|
2149
|
+
import { useFormContext as useFormContext10 } from "react-hook-form";
|
|
2150
|
+
import { jsx as jsx61, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
2151
|
+
function DefaultSettingsTotp({
|
|
2152
|
+
totpImage,
|
|
2153
|
+
totpInput,
|
|
2154
|
+
totpSecret,
|
|
2155
|
+
totpUnlink,
|
|
2156
|
+
onUnlink
|
|
2157
|
+
}) {
|
|
2158
|
+
const { Node, Card } = useComponents5();
|
|
2159
|
+
const {
|
|
2160
|
+
formState: { isSubmitting }
|
|
2161
|
+
} = useFormContext10();
|
|
2162
|
+
if (totpUnlink) {
|
|
2163
|
+
const {
|
|
2164
|
+
type,
|
|
2165
|
+
autocomplete: _ignoredAutocomplete,
|
|
2166
|
+
label: _ignoredLabel,
|
|
2167
|
+
node_type: _ignoredNodeType,
|
|
2168
|
+
...buttonAttrs
|
|
2169
|
+
} = totpUnlink.attributes;
|
|
2170
|
+
return /* @__PURE__ */ jsxs34("div", { className: "grid grid-cols-1 gap-8 md:grid-cols-2", children: [
|
|
2171
|
+
/* @__PURE__ */ jsx61("div", { className: "col-span-full", children: /* @__PURE__ */ jsx61(Card.Divider, {}) }),
|
|
2172
|
+
/* @__PURE__ */ jsxs34("div", { className: "col-span-full flex items-center gap-6", children: [
|
|
2173
|
+
/* @__PURE__ */ jsx61("div", { className: "aspect-square size-8 ", children: /* @__PURE__ */ jsx61(qrcode_default, { size: 32 }) }),
|
|
2174
|
+
/* @__PURE__ */ jsx61("div", { className: "mr-auto flex flex-col", children: /* @__PURE__ */ jsx61("p", { className: "text-sm font-medium text-interface-foreground-default-primary", children: "Authenticator app" }) }),
|
|
2175
|
+
/* @__PURE__ */ jsx61(
|
|
2176
|
+
"button",
|
|
2177
|
+
{
|
|
2178
|
+
type: type === "button" ? "button" : "submit",
|
|
2179
|
+
...buttonAttrs,
|
|
2180
|
+
onClick: onUnlink,
|
|
2181
|
+
disabled: isSubmitting,
|
|
2182
|
+
children: isSubmitting ? /* @__PURE__ */ jsx61(Spinner, { className: "relative" }) : /* @__PURE__ */ jsx61(
|
|
2183
|
+
trash_default,
|
|
2184
|
+
{
|
|
2185
|
+
className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover",
|
|
2186
|
+
size: 24
|
|
2187
|
+
}
|
|
2188
|
+
)
|
|
2189
|
+
}
|
|
2190
|
+
)
|
|
2191
|
+
] })
|
|
2192
|
+
] });
|
|
2193
|
+
}
|
|
2194
|
+
if (totpImage && totpSecret && totpInput) {
|
|
2195
|
+
return /* @__PURE__ */ jsxs34("div", { className: "grid grid-cols-1 gap-8 md:grid-cols-2", children: [
|
|
2196
|
+
/* @__PURE__ */ jsx61("div", { className: "col-span-full", children: /* @__PURE__ */ jsx61(DefaultHorizontalDivider, {}) }),
|
|
2197
|
+
/* @__PURE__ */ jsx61("div", { className: "flex justify-center rounded-cards bg-interface-background-default-secondary p-8", children: /* @__PURE__ */ jsx61("div", { className: "aspect-square h-44 rounded bg-[white]", children: /* @__PURE__ */ jsx61("div", { className: "-m-3 antialiased mix-blend-multiply", children: /* @__PURE__ */ jsx61(
|
|
2198
|
+
Node.Image,
|
|
2199
|
+
{
|
|
2200
|
+
node: totpImage,
|
|
2201
|
+
attributes: {
|
|
2202
|
+
...totpImage.attributes
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
) }) }) }),
|
|
2206
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex flex-col gap-6", children: [
|
|
2207
|
+
/* @__PURE__ */ jsx61(
|
|
2208
|
+
Node.Label,
|
|
2209
|
+
{
|
|
2210
|
+
node: totpSecret,
|
|
2211
|
+
attributes: totpSecret.attributes,
|
|
2212
|
+
children: /* @__PURE__ */ jsx61(
|
|
2213
|
+
Node.Input,
|
|
2214
|
+
{
|
|
2215
|
+
node: totpSecret,
|
|
2216
|
+
attributes: {
|
|
2217
|
+
disabled: true,
|
|
2218
|
+
name: "totp_secret_key",
|
|
2219
|
+
node_type: "input",
|
|
2220
|
+
type: "text",
|
|
2221
|
+
value: totpSecret.attributes.text.text
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
)
|
|
2225
|
+
}
|
|
2226
|
+
),
|
|
2227
|
+
/* @__PURE__ */ jsx61(
|
|
2228
|
+
Node.Label,
|
|
2229
|
+
{
|
|
2230
|
+
attributes: totpInput.attributes,
|
|
2231
|
+
node: totpInput,
|
|
2232
|
+
children: /* @__PURE__ */ jsx61(
|
|
2233
|
+
Node.CodeInput,
|
|
2234
|
+
{
|
|
2235
|
+
node: totpInput,
|
|
2236
|
+
attributes: totpInput.attributes
|
|
2237
|
+
}
|
|
2238
|
+
)
|
|
2239
|
+
}
|
|
2240
|
+
)
|
|
2241
|
+
] })
|
|
2242
|
+
] });
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
// src/theme/default/components/settings/settings-webauthn.tsx
|
|
2247
|
+
import { useComponents as useComponents6 } from "@ory/elements-react";
|
|
2248
|
+
|
|
2249
|
+
// src/theme/default/assets/icons/key.svg
|
|
2250
|
+
import * as React31 from "react";
|
|
2251
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
2252
|
+
var SvgKey = (props) => {
|
|
2253
|
+
var _a, _b;
|
|
2254
|
+
return /* @__PURE__ */ jsx62("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 32 32", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: /* @__PURE__ */ jsx62("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M20 12h.013m2.06-6.876 4.803 4.803a3.836 3.836 0 0 1 0 5.425l-3.524 3.524a3.835 3.835 0 0 1-5.425 0l-.402-.401-8.744 8.744a2.67 2.67 0 0 1-1.652.77L6.896 28H5.333a1.334 1.334 0 0 1-1.324-1.177L4 26.667v-1.563c0-.626.22-1.232.623-1.712l.158-.173.552-.552H8V20h2.667v-2.667l2.858-2.858-.401-.402a3.835 3.835 0 0 1 0-5.425l3.524-3.524a3.835 3.835 0 0 1 5.425 0" }) });
|
|
2255
|
+
};
|
|
2256
|
+
var key_default = SvgKey;
|
|
2257
|
+
|
|
2258
|
+
// src/theme/default/components/settings/settings-webauthn.tsx
|
|
2259
|
+
import { useFormContext as useFormContext11 } from "react-hook-form";
|
|
2260
|
+
import { jsx as jsx63, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
2261
|
+
function DefaultSettingsWebauthn({
|
|
2262
|
+
nameInput,
|
|
2263
|
+
triggerButton,
|
|
2264
|
+
removeButtons
|
|
2265
|
+
}) {
|
|
2266
|
+
const {
|
|
2267
|
+
formState: { isSubmitting }
|
|
2268
|
+
} = useFormContext11();
|
|
2269
|
+
const { Node, Card } = useComponents6();
|
|
2270
|
+
const hasRemoveButtons = removeButtons.length > 0;
|
|
2271
|
+
return /* @__PURE__ */ jsxs35("div", { className: "flex flex-col gap-8", children: [
|
|
2272
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex md:max-w-96 sm:items-end gap-3 flex-col sm:flex-row", children: [
|
|
2273
|
+
/* @__PURE__ */ jsx63("div", { className: "flex-1", children: /* @__PURE__ */ jsx63(
|
|
2274
|
+
Node.Label,
|
|
2275
|
+
{
|
|
2276
|
+
node: nameInput,
|
|
2277
|
+
attributes: nameInput.attributes,
|
|
2278
|
+
children: /* @__PURE__ */ jsx63(
|
|
2279
|
+
Node.Input,
|
|
2280
|
+
{
|
|
2281
|
+
node: nameInput,
|
|
2282
|
+
attributes: nameInput.attributes
|
|
2283
|
+
}
|
|
2284
|
+
)
|
|
2285
|
+
}
|
|
2286
|
+
) }),
|
|
2287
|
+
triggerButton ? /* @__PURE__ */ jsx63(
|
|
2288
|
+
Node.Button,
|
|
2289
|
+
{
|
|
2290
|
+
node: triggerButton,
|
|
2291
|
+
attributes: triggerButton.attributes,
|
|
2292
|
+
onClick: triggerButton.onClick
|
|
2293
|
+
}
|
|
2294
|
+
) : null
|
|
2295
|
+
] }),
|
|
2296
|
+
hasRemoveButtons ? /* @__PURE__ */ jsxs35("div", { className: "flex flex-col gap-8", children: [
|
|
2297
|
+
/* @__PURE__ */ jsx63(Card.Divider, {}),
|
|
2298
|
+
/* @__PURE__ */ jsx63("div", { className: "flex flex-col gap-4", children: removeButtons.map((node, i) => {
|
|
2299
|
+
var _a, _b;
|
|
2300
|
+
const context = (_b = (_a = node.meta.label) == null ? void 0 : _a.context) != null ? _b : {};
|
|
2301
|
+
const addedAt = "added_at" in context ? context.added_at : null;
|
|
2302
|
+
const displayName = "display_name" in context ? context.display_name : null;
|
|
2303
|
+
const keyId = "value" in node.attributes ? node.attributes.value : null;
|
|
2304
|
+
return /* @__PURE__ */ jsxs35(
|
|
2305
|
+
"div",
|
|
2306
|
+
{
|
|
2307
|
+
className: "flex justify-between gap-6 md:items-center",
|
|
2308
|
+
children: [
|
|
2309
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex gap-2 items-center flex-1", children: [
|
|
2310
|
+
/* @__PURE__ */ jsx63(
|
|
2311
|
+
key_default,
|
|
2312
|
+
{
|
|
2313
|
+
size: 32,
|
|
2314
|
+
className: "text-interface-foreground-default-primary"
|
|
2315
|
+
}
|
|
2316
|
+
),
|
|
2317
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex-1 flex-col md:flex-row md:items-center flex md:justify-between gap-4", children: [
|
|
2318
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex-1 flex-col", children: [
|
|
2319
|
+
/* @__PURE__ */ jsx63("p", { className: "text-sm font-medium text-interface-foreground-default-secondary", children: displayName }),
|
|
2320
|
+
/* @__PURE__ */ jsx63("span", { className: "text-sm text-interface-foreground-default-tertiary hidden sm:block", children: keyId })
|
|
2321
|
+
] }),
|
|
2322
|
+
addedAt && /* @__PURE__ */ jsx63("p", { className: "text-sm text-interface-foreground-default-tertiary", children: new Intl.DateTimeFormat(void 0, {
|
|
2323
|
+
dateStyle: "long"
|
|
2324
|
+
}).format(new Date(addedAt)) })
|
|
2325
|
+
] })
|
|
2326
|
+
] }),
|
|
2327
|
+
/* @__PURE__ */ jsx63(
|
|
2328
|
+
"button",
|
|
2329
|
+
{
|
|
2330
|
+
...node.attributes,
|
|
2331
|
+
type: "submit",
|
|
2332
|
+
onClick: node.onClick,
|
|
2333
|
+
disabled: isSubmitting,
|
|
2334
|
+
className: "relative",
|
|
2335
|
+
children: isSubmitting ? /* @__PURE__ */ jsx63(Spinner, { className: "relative" }) : /* @__PURE__ */ jsx63(
|
|
2336
|
+
trash_default,
|
|
2337
|
+
{
|
|
2338
|
+
className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover",
|
|
2339
|
+
size: 24
|
|
2340
|
+
}
|
|
2341
|
+
)
|
|
2342
|
+
}
|
|
2343
|
+
)
|
|
2344
|
+
]
|
|
2345
|
+
},
|
|
2346
|
+
`webauthn-remove-button-${i}`
|
|
2347
|
+
);
|
|
2348
|
+
}) })
|
|
2349
|
+
] }) : null
|
|
2350
|
+
] });
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
// src/theme/default/components/card/auth-method-list-container.tsx
|
|
2354
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
2355
|
+
function DefaultAuthMethodListContainer({
|
|
2356
|
+
children
|
|
2357
|
+
}) {
|
|
2358
|
+
return /* @__PURE__ */ jsx64("div", { className: "grid grid-cols-1 gap-2", children });
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
// src/theme/default/components/default-components.tsx
|
|
2362
|
+
function getOryComponents(overrides) {
|
|
2363
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha;
|
|
2364
|
+
return {
|
|
2365
|
+
Card: {
|
|
2366
|
+
Root: (_b = (_a = overrides == null ? void 0 : overrides.Card) == null ? void 0 : _a.Root) != null ? _b : DefaultCard,
|
|
2367
|
+
Footer: (_d = (_c = overrides == null ? void 0 : overrides.Card) == null ? void 0 : _c.Footer) != null ? _d : DefaultCardFooter,
|
|
2368
|
+
Header: (_f = (_e = overrides == null ? void 0 : overrides.Card) == null ? void 0 : _e.Header) != null ? _f : DefaultCardHeader,
|
|
2369
|
+
Content: (_h = (_g = overrides == null ? void 0 : overrides.Card) == null ? void 0 : _g.Content) != null ? _h : DefaultCardContent,
|
|
2370
|
+
Logo: (_j = (_i = overrides == null ? void 0 : overrides.Card) == null ? void 0 : _i.Logo) != null ? _j : DefaultCardLogo,
|
|
2371
|
+
Divider: (_l = (_k = overrides == null ? void 0 : overrides.Card) == null ? void 0 : _k.Divider) != null ? _l : DefaultHorizontalDivider,
|
|
2372
|
+
AuthMethodListContainer: (_n = (_m = overrides == null ? void 0 : overrides.Card) == null ? void 0 : _m.AuthMethodListContainer) != null ? _n : DefaultAuthMethodListContainer,
|
|
2373
|
+
AuthMethodListItem: (_p = (_o = overrides == null ? void 0 : overrides.Card) == null ? void 0 : _o.AuthMethodListItem) != null ? _p : DefaultAuthMethodListItem,
|
|
2374
|
+
SettingsSection: (_r = (_q = overrides == null ? void 0 : overrides.Card) == null ? void 0 : _q.SettingsSection) != null ? _r : DefaultFormSection,
|
|
2375
|
+
SettingsSectionContent: (_t = (_s = overrides == null ? void 0 : overrides.Card) == null ? void 0 : _s.SettingsSectionContent) != null ? _t : DefaultFormSectionContent,
|
|
2376
|
+
SettingsSectionFooter: (_v = (_u = overrides == null ? void 0 : overrides.Card) == null ? void 0 : _u.SettingsSectionFooter) != null ? _v : DefaultFormSectionFooter
|
|
2377
|
+
},
|
|
2378
|
+
Node: {
|
|
2379
|
+
Button: (_x = (_w = overrides == null ? void 0 : overrides.Node) == null ? void 0 : _w.Button) != null ? _x : DefaultButton,
|
|
2380
|
+
OidcButton: (_z = (_y = overrides == null ? void 0 : overrides.Node) == null ? void 0 : _y.OidcButton) != null ? _z : DefaultButtonSocial,
|
|
2381
|
+
Input: (_B = (_A = overrides == null ? void 0 : overrides.Node) == null ? void 0 : _A.Input) != null ? _B : DefaultInput,
|
|
2382
|
+
CodeInput: (_D = (_C = overrides == null ? void 0 : overrides.Node) == null ? void 0 : _C.CodeInput) != null ? _D : DefaultPinCodeInput,
|
|
2383
|
+
Image: (_F = (_E = overrides == null ? void 0 : overrides.Node) == null ? void 0 : _E.Image) != null ? _F : DefaultImage,
|
|
2384
|
+
Label: (_H = (_G = overrides == null ? void 0 : overrides.Node) == null ? void 0 : _G.Label) != null ? _H : DefaultLabel,
|
|
2385
|
+
Checkbox: (_J = (_I = overrides == null ? void 0 : overrides.Node) == null ? void 0 : _I.Checkbox) != null ? _J : DefaultCheckbox,
|
|
2386
|
+
Text: (_L = (_K = overrides == null ? void 0 : overrides.Node) == null ? void 0 : _K.Text) != null ? _L : DefaultText,
|
|
2387
|
+
Anchor: (_N = (_M = overrides == null ? void 0 : overrides.Node) == null ? void 0 : _M.Anchor) != null ? _N : DefaultLinkButton
|
|
2388
|
+
},
|
|
2389
|
+
Form: {
|
|
2390
|
+
Root: (_P = (_O = overrides == null ? void 0 : overrides.Form) == null ? void 0 : _O.Root) != null ? _P : DefaultFormContainer,
|
|
2391
|
+
Group: (_R = (_Q = overrides == null ? void 0 : overrides.Form) == null ? void 0 : _Q.Group) != null ? _R : DefaultGroupContainer,
|
|
2392
|
+
OidcRoot: (_T = (_S = overrides == null ? void 0 : overrides.Form) == null ? void 0 : _S.OidcRoot) != null ? _T : DefaultSocialButtonContainer,
|
|
2393
|
+
RecoveryCodesSettings: (_V = (_U = overrides == null ? void 0 : overrides.Form) == null ? void 0 : _U.RecoveryCodesSettings) != null ? _V : DefaultSettingsRecoveryCodes,
|
|
2394
|
+
TotpSettings: (_X = (_W = overrides == null ? void 0 : overrides.Form) == null ? void 0 : _W.TotpSettings) != null ? _X : DefaultSettingsTotp,
|
|
2395
|
+
OidcSettings: (_Z = (_Y = overrides == null ? void 0 : overrides.Form) == null ? void 0 : _Y.OidcSettings) != null ? _Z : DefaultSettingsOidc,
|
|
2396
|
+
WebauthnSettings: (_$ = (__ = overrides == null ? void 0 : overrides.Form) == null ? void 0 : __.WebauthnSettings) != null ? _$ : DefaultSettingsWebauthn,
|
|
2397
|
+
PasskeySettings: (_ba = (_aa = overrides == null ? void 0 : overrides.Form) == null ? void 0 : _aa.PasskeySettings) != null ? _ba : DefaultSettingsPasskey
|
|
2398
|
+
},
|
|
2399
|
+
Message: {
|
|
2400
|
+
Root: (_da = (_ca = overrides == null ? void 0 : overrides.Message) == null ? void 0 : _ca.Root) != null ? _da : DefaultMessageContainer,
|
|
2401
|
+
Content: (_fa = (_ea = overrides == null ? void 0 : overrides.Message) == null ? void 0 : _ea.Content) != null ? _fa : DefaultMessage
|
|
2402
|
+
},
|
|
2403
|
+
Page: {
|
|
2404
|
+
Header: (_ha = (_ga = overrides == null ? void 0 : overrides.Page) == null ? void 0 : _ga.Header) != null ? _ha : DefaultPageHeader
|
|
2405
|
+
}
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
// src/theme/default/flows/error.tsx
|
|
2410
|
+
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
2411
|
+
function Error({
|
|
2412
|
+
error,
|
|
2413
|
+
children
|
|
2414
|
+
}) {
|
|
2415
|
+
return /* @__PURE__ */ jsx65("div", { "data-testid": "ory/screen/error/raw", children: JSON.stringify(error) || children });
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
// src/theme/default/flows/login.tsx
|
|
2419
|
+
import { FlowType as FlowType8 } from "@ory/client-fetch";
|
|
2420
|
+
import {
|
|
2421
|
+
OryProvider,
|
|
2422
|
+
OryTwoStepCard
|
|
2423
|
+
} from "@ory/elements-react";
|
|
2424
|
+
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
2425
|
+
function Login({
|
|
2426
|
+
flow,
|
|
2427
|
+
config,
|
|
2428
|
+
children,
|
|
2429
|
+
components: flowOverrideComponents
|
|
2430
|
+
}) {
|
|
2431
|
+
const components = getOryComponents(flowOverrideComponents);
|
|
2432
|
+
return /* @__PURE__ */ jsx66(
|
|
2433
|
+
OryProvider,
|
|
2434
|
+
{
|
|
2435
|
+
config,
|
|
2436
|
+
flow,
|
|
2437
|
+
flowType: FlowType8.Login,
|
|
2438
|
+
components,
|
|
2439
|
+
children: children != null ? children : /* @__PURE__ */ jsx66(OryTwoStepCard, {})
|
|
2440
|
+
}
|
|
2441
|
+
);
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
// src/theme/default/flows/recovery.tsx
|
|
2445
|
+
import { FlowType as FlowType9 } from "@ory/client-fetch";
|
|
2446
|
+
import {
|
|
2447
|
+
OryProvider as OryProvider2,
|
|
2448
|
+
OryTwoStepCard as OryTwoStepCard2
|
|
2449
|
+
} from "@ory/elements-react";
|
|
2450
|
+
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
2451
|
+
function Recovery({
|
|
2452
|
+
flow,
|
|
2453
|
+
config,
|
|
2454
|
+
children,
|
|
2455
|
+
components: flowOverrideComponents
|
|
2456
|
+
}) {
|
|
2457
|
+
const components = getOryComponents(flowOverrideComponents);
|
|
2458
|
+
return /* @__PURE__ */ jsx67(
|
|
2459
|
+
OryProvider2,
|
|
2460
|
+
{
|
|
2461
|
+
config,
|
|
2462
|
+
flow,
|
|
2463
|
+
flowType: FlowType9.Recovery,
|
|
2464
|
+
components,
|
|
2465
|
+
children: children != null ? children : /* @__PURE__ */ jsx67(OryTwoStepCard2, {})
|
|
2466
|
+
}
|
|
2467
|
+
);
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
// src/theme/default/flows/registration.tsx
|
|
2471
|
+
import { FlowType as FlowType10 } from "@ory/client-fetch";
|
|
2472
|
+
import {
|
|
2473
|
+
OryProvider as OryProvider3,
|
|
2474
|
+
OryTwoStepCard as OryTwoStepCard3
|
|
2475
|
+
} from "@ory/elements-react";
|
|
2476
|
+
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
2477
|
+
function Registration({
|
|
2478
|
+
flow,
|
|
2479
|
+
children,
|
|
2480
|
+
components: flowOverrideComponents,
|
|
2481
|
+
config
|
|
2482
|
+
}) {
|
|
2483
|
+
const components = getOryComponents(flowOverrideComponents);
|
|
2484
|
+
return /* @__PURE__ */ jsx68(
|
|
2485
|
+
OryProvider3,
|
|
2486
|
+
{
|
|
2487
|
+
config,
|
|
2488
|
+
flow,
|
|
2489
|
+
flowType: FlowType10.Registration,
|
|
2490
|
+
components,
|
|
2491
|
+
children: children != null ? children : /* @__PURE__ */ jsx68(OryTwoStepCard3, {})
|
|
2492
|
+
}
|
|
2493
|
+
);
|
|
2494
|
+
}
|
|
2495
|
+
|
|
2496
|
+
// src/theme/default/flows/settings.tsx
|
|
2497
|
+
import { FlowType as FlowType11 } from "@ory/client-fetch";
|
|
2498
|
+
import {
|
|
2499
|
+
HeadlessPageHeader,
|
|
2500
|
+
OryProvider as OryProvider4,
|
|
2501
|
+
OrySettingsCard
|
|
2502
|
+
} from "@ory/elements-react";
|
|
2503
|
+
import { Fragment as Fragment5, jsx as jsx69, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
2504
|
+
function Settings({
|
|
2505
|
+
flow,
|
|
2506
|
+
config,
|
|
2507
|
+
children,
|
|
2508
|
+
components: flowOverrideComponents
|
|
2509
|
+
}) {
|
|
2510
|
+
const components = getOryComponents(flowOverrideComponents);
|
|
2511
|
+
return /* @__PURE__ */ jsx69(
|
|
2512
|
+
OryProvider4,
|
|
2513
|
+
{
|
|
2514
|
+
config,
|
|
2515
|
+
flow,
|
|
2516
|
+
flowType: FlowType11.Settings,
|
|
2517
|
+
components,
|
|
2518
|
+
children: children != null ? children : /* @__PURE__ */ jsxs36(Fragment5, { children: [
|
|
2519
|
+
/* @__PURE__ */ jsx69(HeadlessPageHeader, {}),
|
|
2520
|
+
/* @__PURE__ */ jsx69(OrySettingsCard, {})
|
|
2521
|
+
] })
|
|
2522
|
+
}
|
|
2523
|
+
);
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
// src/theme/default/flows/verification.tsx
|
|
2527
|
+
import { FlowType as FlowType12 } from "@ory/client-fetch";
|
|
2528
|
+
import {
|
|
2529
|
+
OryProvider as OryProvider5,
|
|
2530
|
+
OryTwoStepCard as OryTwoStepCard4
|
|
2531
|
+
} from "@ory/elements-react";
|
|
2532
|
+
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
2533
|
+
function Verification({
|
|
2534
|
+
flow,
|
|
2535
|
+
config,
|
|
2536
|
+
children,
|
|
2537
|
+
components: flowOverrideComponents
|
|
2538
|
+
}) {
|
|
2539
|
+
const components = getOryComponents(flowOverrideComponents);
|
|
2540
|
+
return /* @__PURE__ */ jsx70(
|
|
2541
|
+
OryProvider5,
|
|
2542
|
+
{
|
|
2543
|
+
config,
|
|
2544
|
+
flow,
|
|
2545
|
+
flowType: FlowType12.Verification,
|
|
2546
|
+
components,
|
|
2547
|
+
children: children != null ? children : /* @__PURE__ */ jsx70(OryTwoStepCard4, {})
|
|
2548
|
+
}
|
|
2549
|
+
);
|
|
2550
|
+
}
|
|
2551
|
+
export {
|
|
2552
|
+
DefaultButtonSocial,
|
|
2553
|
+
DefaultCard,
|
|
2554
|
+
DefaultCardContent,
|
|
2555
|
+
DefaultCardFooter,
|
|
2556
|
+
DefaultCardHeader,
|
|
2557
|
+
DefaultCardLayout,
|
|
2558
|
+
DefaultCardLogo,
|
|
2559
|
+
DefaultCurrentIdentifierButton,
|
|
2560
|
+
DefaultFormContainer,
|
|
2561
|
+
DefaultMessage,
|
|
2562
|
+
DefaultMessageContainer,
|
|
2563
|
+
Error,
|
|
2564
|
+
Login,
|
|
2565
|
+
Recovery,
|
|
2566
|
+
Registration,
|
|
2567
|
+
Settings,
|
|
2568
|
+
Verification,
|
|
2569
|
+
getOryComponents
|
|
2570
|
+
};
|
|
2571
|
+
//# sourceMappingURL=index.mjs.map
|