@stackframe/stack 2.3.4 → 2.3.7
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/README.md +2 -2
- package/dist/components/card-frame.d.mts +9 -0
- package/dist/components/card-frame.d.ts +8 -5
- package/dist/components/card-frame.js +58 -23
- package/dist/components/credential-sign-in.d.mts +5 -0
- package/dist/components/credential-sign-in.d.ts +5 -1
- package/dist/components/credential-sign-in.js +109 -41
- package/dist/components/credential-sign-up.d.mts +5 -0
- package/dist/components/credential-sign-up.d.ts +5 -1
- package/dist/components/credential-sign-up.js +140 -62
- package/dist/components/forgot-password.d.mts +7 -0
- package/dist/components/forgot-password.d.ts +6 -2
- package/dist/components/forgot-password.js +83 -26
- package/dist/components/form-warning.d.mts +7 -0
- package/dist/components/form-warning.d.ts +6 -2
- package/dist/components/form-warning.js +34 -8
- package/dist/components/magic-link-sign-in.d.mts +5 -0
- package/dist/components/magic-link-sign-in.d.ts +5 -1
- package/dist/components/magic-link-sign-in.js +89 -31
- package/dist/components/message-card.d.mts +10 -0
- package/dist/components/message-card.d.ts +8 -4
- package/dist/components/message-card.js +45 -6
- package/dist/components/oauth-button.d.mts +8 -0
- package/dist/components/oauth-button.d.ts +6 -2
- package/dist/components/oauth-button.js +142 -63
- package/dist/components/oauth-group.d.mts +7 -0
- package/dist/components/oauth-group.d.ts +6 -2
- package/dist/components/oauth-group.js +46 -8
- package/dist/components/password-field.d.mts +5 -0
- package/dist/components/password-field.d.ts +5 -3
- package/dist/components/password-field.js +111 -41
- package/dist/components/password-reset-inner.d.mts +8 -0
- package/dist/components/password-reset-inner.d.ts +6 -2
- package/dist/components/password-reset-inner.js +120 -58
- package/dist/components/redirect-message-card.d.mts +8 -0
- package/dist/components/redirect-message-card.d.ts +6 -2
- package/dist/components/redirect-message-card.js +110 -58
- package/dist/components/separator-with-text.d.mts +7 -0
- package/dist/components/separator-with-text.d.ts +6 -2
- package/dist/components/separator-with-text.js +35 -5
- package/dist/components/user-avatar.d.mts +13 -0
- package/dist/components/user-avatar.d.ts +12 -2
- package/dist/components/user-avatar.js +34 -8
- package/dist/components/user-button.d.mts +15 -0
- package/dist/components/user-button.d.ts +14 -3
- package/dist/components/user-button.js +160 -24
- package/dist/components-core/avatar.d.mts +8 -0
- package/dist/components-core/avatar.d.ts +7 -5
- package/dist/components-core/avatar.js +73 -18
- package/dist/components-core/button.d.mts +12 -0
- package/dist/components-core/button.d.ts +8 -6
- package/dist/components-core/button.js +177 -113
- package/dist/components-core/card.d.mts +8 -0
- package/dist/components-core/card.d.ts +4 -2
- package/dist/components-core/card.js +73 -22
- package/dist/components-core/collapsible.d.mts +8 -0
- package/dist/components-core/collapsible.d.ts +8 -6
- package/dist/components-core/collapsible.js +48 -5
- package/dist/components-core/container.d.mts +8 -0
- package/dist/components-core/container.d.ts +5 -3
- package/dist/components-core/container.js +61 -11
- package/dist/components-core/dropdown.d.mts +15 -0
- package/dist/components-core/dropdown.d.ts +10 -8
- package/dist/components-core/dropdown.js +108 -36
- package/dist/components-core/index.d.mts +59 -0
- package/dist/components-core/index.d.ts +52 -38
- package/dist/components-core/index.js +144 -45
- package/dist/components-core/input.d.mts +6 -0
- package/dist/components-core/input.d.ts +5 -3
- package/dist/components-core/input.js +97 -28
- package/dist/components-core/label.d.mts +6 -0
- package/dist/components-core/label.d.ts +5 -3
- package/dist/components-core/label.js +65 -15
- package/dist/components-core/link.d.mts +10 -0
- package/dist/components-core/link.d.ts +7 -6
- package/dist/components-core/link.js +72 -18
- package/dist/components-core/loading-indicator.d.mts +13 -0
- package/dist/components-core/loading-indicator.d.ts +11 -4
- package/dist/components-core/loading-indicator.js +46 -6
- package/dist/components-core/popover.d.mts +8 -0
- package/dist/components-core/popover.d.ts +8 -6
- package/dist/components-core/popover.js +72 -16
- package/dist/components-core/separator.d.mts +6 -0
- package/dist/components-core/separator.d.ts +5 -3
- package/dist/components-core/separator.js +66 -16
- package/dist/components-core/skeleton.d.mts +7 -0
- package/dist/components-core/skeleton.d.ts +7 -0
- package/dist/components-core/skeleton.js +86 -0
- package/dist/components-core/tabs.d.mts +9 -0
- package/dist/components-core/tabs.d.ts +8 -6
- package/dist/components-core/tabs.js +87 -20
- package/dist/components-core/text.d.mts +10 -0
- package/dist/components-core/text.d.ts +5 -3
- package/dist/components-core/text.js +95 -40
- package/dist/components-core-joy/button.d.mts +6 -0
- package/dist/components-core-joy/button.d.ts +6 -2
- package/dist/components-core-joy/button.js +86 -28
- package/dist/components-core-joy/input.d.mts +5 -0
- package/dist/components-core-joy/input.d.ts +5 -2
- package/dist/components-core-joy/input.js +51 -6
- package/dist/components-core-joy/separator.d.mts +6 -0
- package/dist/components-core-joy/separator.d.ts +6 -2
- package/dist/components-core-joy/separator.js +50 -6
- package/dist/components-core-joy/tabs.d.mts +9 -0
- package/dist/components-core-joy/tabs.d.ts +9 -5
- package/dist/components-core-joy/tabs.js +62 -16
- package/dist/components-core-joy/text.d.mts +9 -0
- package/dist/components-core-joy/text.d.ts +6 -3
- package/dist/components-core-joy/text.js +68 -28
- package/dist/components-page/account-settings.d.mts +7 -0
- package/dist/components-page/account-settings.d.ts +6 -2
- package/dist/components-page/account-settings.js +213 -81
- package/dist/components-page/auth-page.d.mts +8 -0
- package/dist/components-page/auth-page.d.ts +6 -2
- package/dist/components-page/auth-page.js +79 -19
- package/dist/components-page/email-verification.d.mts +8 -0
- package/dist/components-page/email-verification.d.ts +6 -2
- package/dist/components-page/email-verification.js +65 -28
- package/dist/components-page/forgot-password.d.mts +7 -0
- package/dist/components-page/forgot-password.d.ts +6 -2
- package/dist/components-page/forgot-password.js +64 -20
- package/dist/components-page/magic-link-callback.d.mts +8 -0
- package/dist/components-page/magic-link-callback.d.ts +6 -2
- package/dist/components-page/magic-link-callback.js +72 -34
- package/dist/components-page/oauth-callback.d.mts +5 -0
- package/dist/components-page/oauth-callback.d.ts +5 -1
- package/dist/components-page/oauth-callback.js +52 -16
- package/dist/components-page/password-reset.d.mts +8 -0
- package/dist/components-page/password-reset.d.ts +6 -2
- package/dist/components-page/password-reset.js +70 -34
- package/dist/components-page/sign-in.d.mts +7 -0
- package/dist/components-page/sign-in.d.ts +6 -2
- package/dist/components-page/sign-in.js +41 -5
- package/dist/components-page/sign-out.d.mts +5 -0
- package/dist/components-page/sign-out.d.ts +5 -1
- package/dist/components-page/sign-out.js +47 -11
- package/dist/components-page/sign-up.d.mts +7 -0
- package/dist/components-page/sign-up.d.ts +6 -2
- package/dist/components-page/sign-up.js +41 -5
- package/dist/components-page/stack-handler.d.mts +16 -0
- package/dist/components-page/stack-handler.d.ts +11 -3
- package/dist/components-page/stack-handler.js +102 -64
- package/dist/esm/components/card-frame.js +39 -0
- package/dist/esm/components/credential-sign-in.js +82 -0
- package/dist/esm/components/credential-sign-up.js +114 -0
- package/dist/esm/components/forgot-password.js +55 -0
- package/dist/esm/components/form-warning.js +15 -0
- package/dist/esm/components/magic-link-sign-in.js +61 -0
- package/dist/esm/components/message-card.js +16 -0
- package/dist/esm/components/oauth-button.js +124 -0
- package/dist/esm/components/oauth-group.js +17 -0
- package/dist/esm/components/password-field.js +82 -0
- package/dist/esm/components/password-reset-inner.js +93 -0
- package/dist/esm/components/redirect-message-card.js +83 -0
- package/dist/esm/components/separator-with-text.js +16 -0
- package/dist/esm/components/user-avatar.js +14 -0
- package/dist/esm/components/user-button.js +133 -0
- package/dist/esm/components-core/avatar.js +56 -0
- package/dist/esm/components-core/button.js +165 -0
- package/dist/esm/components-core/card.js +51 -0
- package/dist/esm/components-core/collapsible.js +13 -0
- package/dist/esm/components-core/container.js +35 -0
- package/dist/esm/components-core/dropdown.js +106 -0
- package/dist/esm/components-core/index.js +93 -0
- package/dist/esm/components-core/input.js +80 -0
- package/dist/esm/components-core/label.js +38 -0
- package/dist/esm/components-core/link.js +38 -0
- package/dist/esm/components-core/loading-indicator.js +27 -0
- package/dist/esm/components-core/popover.js +43 -0
- package/dist/esm/components-core/separator.js +36 -0
- package/dist/esm/components-core/skeleton.js +52 -0
- package/dist/esm/components-core/tabs.js +79 -0
- package/dist/esm/components-core/text.js +63 -0
- package/dist/esm/components-core-joy/button.js +53 -0
- package/dist/esm/components-core-joy/input.js +18 -0
- package/dist/esm/components-core-joy/separator.js +17 -0
- package/dist/esm/components-core-joy/tabs.js +29 -0
- package/dist/esm/components-core-joy/text.js +35 -0
- package/dist/esm/components-page/account-settings.js +197 -0
- package/dist/esm/components-page/auth-page.js +50 -0
- package/dist/esm/components-page/email-verification.js +36 -0
- package/dist/esm/components-page/forgot-password.js +35 -0
- package/dist/esm/components-page/magic-link-callback.js +43 -0
- package/dist/esm/components-page/oauth-callback.js +23 -0
- package/dist/esm/components-page/password-reset.js +42 -0
- package/dist/esm/components-page/sign-in.js +12 -0
- package/dist/esm/components-page/sign-out.js +18 -0
- package/dist/esm/components-page/sign-up.js +12 -0
- package/dist/esm/components-page/stack-handler.js +75 -0
- package/dist/esm/index.js +47 -0
- package/dist/esm/joy.js +5 -0
- package/dist/esm/lib/auth.js +62 -0
- package/dist/esm/lib/cookie.js +185 -0
- package/dist/esm/lib/hooks.js +29 -0
- package/dist/esm/lib/stack-app.js +940 -0
- package/dist/esm/providers/component-provider.js +76 -0
- package/dist/esm/providers/design-provider.js +36 -0
- package/dist/esm/providers/joy-provider.js +35 -0
- package/dist/esm/providers/stack-provider-client.js +31 -0
- package/dist/esm/providers/stack-provider.js +21 -0
- package/dist/esm/providers/styled-components-registry.js +24 -0
- package/dist/esm/providers/theme-provider.js +22 -0
- package/dist/esm/utils/browser-script.js +25 -0
- package/dist/esm/utils/constants.js +34 -0
- package/dist/esm/utils/email.js +10 -0
- package/dist/esm/utils/next.js +7 -0
- package/dist/esm/utils/url.js +21 -0
- package/dist/index.d.mts +37 -0
- package/dist/index.d.ts +37 -22
- package/dist/index.js +106 -21
- package/dist/joy.d.mts +16 -0
- package/dist/joy.d.ts +16 -1
- package/dist/joy.js +30 -1
- package/dist/lib/auth.d.mts +11 -0
- package/dist/lib/auth.d.ts +8 -4
- package/dist/lib/auth.js +83 -57
- package/dist/lib/cookie.d.mts +14 -0
- package/dist/lib/cookie.d.ts +8 -6
- package/dist/lib/cookie.js +217 -45
- package/dist/lib/hooks.d.mts +35 -0
- package/dist/lib/hooks.d.ts +14 -8
- package/dist/lib/hooks.js +53 -28
- package/dist/lib/stack-app.d.mts +227 -0
- package/dist/lib/stack-app.d.ts +45 -44
- package/dist/lib/stack-app.js +937 -861
- package/dist/providers/component-provider.d.mts +113 -0
- package/dist/providers/component-provider.d.ts +97 -73
- package/dist/providers/component-provider.js +92 -56
- package/dist/providers/design-provider.d.mts +34 -0
- package/dist/providers/design-provider.d.ts +16 -21
- package/dist/providers/design-provider.js +57 -64
- package/dist/providers/joy-provider.d.mts +36 -0
- package/dist/providers/joy-provider.d.ts +30 -14
- package/dist/providers/joy-provider.js +58 -30
- package/dist/providers/stack-provider-client.d.mts +20 -0
- package/dist/providers/stack-provider-client.d.ts +18 -7
- package/dist/providers/stack-provider-client.js +65 -12
- package/dist/providers/stack-provider.d.mts +14 -0
- package/dist/providers/stack-provider.d.ts +13 -5
- package/dist/providers/stack-provider.js +41 -5
- package/dist/providers/styled-components-registry.d.mts +8 -0
- package/dist/providers/styled-components-registry.d.ts +8 -4
- package/dist/providers/styled-components-registry.js +43 -17
- package/dist/providers/theme-provider.d.mts +22 -0
- package/dist/providers/theme-provider.d.ts +21 -9
- package/dist/providers/theme-provider.js +55 -19
- package/dist/utils/browser-script.d.mts +5 -0
- package/dist/utils/browser-script.d.ts +5 -0
- package/dist/utils/browser-script.js +50 -0
- package/dist/utils/constants.d.mts +48 -0
- package/dist/utils/constants.d.ts +11 -9
- package/dist/utils/constants.js +66 -21
- package/dist/utils/email.d.mts +3 -0
- package/dist/utils/email.d.ts +3 -1
- package/dist/utils/email.js +44 -6
- package/dist/utils/next.d.mts +3 -0
- package/dist/utils/next.d.ts +3 -1
- package/dist/utils/next.js +31 -3
- package/dist/utils/url.d.mts +4 -0
- package/dist/utils/url.d.ts +4 -2
- package/dist/utils/url.js +44 -13
- package/package.json +20 -11
|
@@ -1,61 +1,113 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
2
|
+
"use strict";
|
|
3
|
+
"use client";
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
|
|
32
|
+
// src/components/redirect-message-card.tsx
|
|
33
|
+
var redirect_message_card_exports = {};
|
|
34
|
+
__export(redirect_message_card_exports, {
|
|
35
|
+
default: () => RedirectMessageCard
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(redirect_message_card_exports);
|
|
38
|
+
var import_navigation = require("next/navigation");
|
|
39
|
+
var import__ = require("..");
|
|
40
|
+
var import_message_card = __toESM(require("./message-card"));
|
|
41
|
+
var import_components_core = require("../components-core");
|
|
42
|
+
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
|
43
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
+
function RedirectMessageCard({
|
|
45
|
+
type,
|
|
46
|
+
fullPage = false
|
|
47
|
+
}) {
|
|
48
|
+
const stackApp = (0, import__.useStackApp)();
|
|
49
|
+
const router = (0, import_navigation.useRouter)();
|
|
50
|
+
let title;
|
|
51
|
+
let primaryUrl;
|
|
52
|
+
let secondaryUrl = null;
|
|
53
|
+
let message = null;
|
|
54
|
+
let primaryButton;
|
|
55
|
+
let secondaryButton = null;
|
|
56
|
+
switch (type) {
|
|
57
|
+
case "signedIn": {
|
|
58
|
+
title = "You are already signed in";
|
|
59
|
+
primaryUrl = stackApp.urls.home;
|
|
60
|
+
secondaryUrl = stackApp.urls.signOut;
|
|
61
|
+
primaryButton = "Go to Home";
|
|
62
|
+
secondaryButton = "Sign Out";
|
|
63
|
+
break;
|
|
53
64
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
case "signedOut": {
|
|
66
|
+
title = "You are not currently signed in.";
|
|
67
|
+
primaryUrl = stackApp.urls.home;
|
|
68
|
+
primaryButton = "Go to Home";
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
case "emailSent": {
|
|
72
|
+
title = "Email sent!";
|
|
73
|
+
message = "Please check your inbox. Make sure to check your spam folder.";
|
|
74
|
+
primaryUrl = stackApp.urls.home;
|
|
75
|
+
primaryButton = "Go to Home";
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case "passwordReset": {
|
|
79
|
+
title = "Password reset successfully!";
|
|
80
|
+
message = "Your password has been reset. You can now sign in with your new password.";
|
|
81
|
+
primaryUrl = stackApp.urls.signIn;
|
|
82
|
+
primaryButton = "Go to Sign In";
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case "emailVerified": {
|
|
86
|
+
title = "Email verified!";
|
|
87
|
+
message = "Your have successfully verified your email.";
|
|
88
|
+
primaryUrl = stackApp.urls.home;
|
|
89
|
+
primaryButton = "Go to Home";
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_message_card.default, { title, fullPage, children: [
|
|
94
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components_core.Text, { children: message }),
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "row", alignItems: "center", justifyContent: "center", gap: "16px", marginTop: 20 }, children: [
|
|
96
|
+
secondaryButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
97
|
+
import_components_core.Button,
|
|
98
|
+
{
|
|
99
|
+
variant: "secondary",
|
|
100
|
+
onClick: async () => {
|
|
101
|
+
router.push(stackApp.urls.signOut.toString());
|
|
102
|
+
await (0, import_promises.neverResolve)();
|
|
103
|
+
},
|
|
104
|
+
children: secondaryButton
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components_core.Button, { onClick: async () => {
|
|
108
|
+
router.push(primaryUrl.toString());
|
|
109
|
+
await (0, import_promises.neverResolve)();
|
|
110
|
+
}, children: primaryButton })
|
|
111
|
+
] })
|
|
112
|
+
] });
|
|
61
113
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
declare function SeparatorWithText({ text }: {
|
|
2
4
|
text: string;
|
|
3
|
-
}):
|
|
5
|
+
}): react_jsx_runtime.JSX.Element;
|
|
6
|
+
|
|
7
|
+
export { SeparatorWithText as default };
|
|
@@ -1,6 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
"use client";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/components/separator-with-text.tsx
|
|
23
|
+
var separator_with_text_exports = {};
|
|
24
|
+
__export(separator_with_text_exports, {
|
|
25
|
+
default: () => SeparatorWithText
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(separator_with_text_exports);
|
|
28
|
+
var import_components_core = require("../components-core");
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
function SeparatorWithText({ text }) {
|
|
31
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", marginTop: "1.5rem", marginBottom: "1.5rem" }, children: [
|
|
32
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components_core.Separator, {}) }),
|
|
33
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components_core.Text, { style: { padding: "0 16px" }, variant: "secondary", size: "sm", children: text }),
|
|
34
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components_core.Separator, {}) })
|
|
35
|
+
] });
|
|
6
36
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { User } from '../lib/stack-app.mjs';
|
|
3
|
+
import '@stackframe/stack-shared';
|
|
4
|
+
import '@stackframe/stack-shared/dist/interface/clientInterface';
|
|
5
|
+
import '@stackframe/stack-shared/dist/utils/json';
|
|
6
|
+
import '@stackframe/stack-shared/dist/interface/adminInterface';
|
|
7
|
+
|
|
8
|
+
declare function UserAvatar(props: {
|
|
9
|
+
size?: number;
|
|
10
|
+
user: User | null;
|
|
11
|
+
}): react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { UserAvatar as default };
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { User } from '../lib/stack-app.js';
|
|
3
|
+
import '@stackframe/stack-shared';
|
|
4
|
+
import '@stackframe/stack-shared/dist/interface/clientInterface';
|
|
5
|
+
import '@stackframe/stack-shared/dist/utils/json';
|
|
6
|
+
import '@stackframe/stack-shared/dist/interface/adminInterface';
|
|
7
|
+
|
|
8
|
+
declare function UserAvatar(props: {
|
|
2
9
|
size?: number;
|
|
3
|
-
|
|
10
|
+
user: User | null;
|
|
11
|
+
}): react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { UserAvatar as default };
|
|
@@ -1,9 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/user-avatar.tsx
|
|
21
|
+
var user_avatar_exports = {};
|
|
22
|
+
__export(user_avatar_exports, {
|
|
23
|
+
default: () => UserAvatar
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(user_avatar_exports);
|
|
26
|
+
var import_rx = require("react-icons/rx");
|
|
27
|
+
var import__ = require("..");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
function UserAvatar(props) {
|
|
30
|
+
const user = props.user;
|
|
31
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import__.Avatar, { style: { height: props.size, width: props.size }, children: [
|
|
32
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.AvatarImage, { src: user?.profileImageUrl || "" }),
|
|
33
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.AvatarFallback, { children: user ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { style: { fontWeight: 500 }, children: (user?.displayName || user?.primaryEmail)?.slice(0, 2).toUpperCase() }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_rx.RxPerson, { size: props.size }) })
|
|
34
|
+
] });
|
|
9
35
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
type UserButtonProps = {
|
|
5
|
+
showUserInfo?: boolean;
|
|
6
|
+
colorModeToggle?: () => void | Promise<void>;
|
|
7
|
+
extraItems?: {
|
|
8
|
+
text: string;
|
|
9
|
+
icon: React__default.ReactNode;
|
|
10
|
+
onClick: () => void | Promise<void>;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
declare function UserButton(props: UserButtonProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { UserButton as default };
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
type UserButtonProps = {
|
|
2
5
|
showUserInfo?: boolean;
|
|
3
|
-
|
|
4
|
-
|
|
6
|
+
colorModeToggle?: () => void | Promise<void>;
|
|
7
|
+
extraItems?: {
|
|
8
|
+
text: string;
|
|
9
|
+
icon: React__default.ReactNode;
|
|
10
|
+
onClick: () => void | Promise<void>;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
declare function UserButton(props: UserButtonProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { UserButton as default };
|
|
@@ -1,27 +1,163 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
"use client";
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
|
|
32
|
+
// src/components/user-button.tsx
|
|
33
|
+
var user_button_exports = {};
|
|
34
|
+
__export(user_button_exports, {
|
|
35
|
+
default: () => UserButton
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(user_button_exports);
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
39
|
+
var import__ = require("..");
|
|
40
|
+
var import_rx = require("react-icons/rx");
|
|
41
|
+
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
|
42
|
+
var import_constants = require("../utils/constants");
|
|
43
|
+
var import_user_avatar = __toESM(require("./user-avatar"));
|
|
44
|
+
var import_navigation = require("next/navigation");
|
|
45
|
+
var import_objects = require("@stackframe/stack-shared/dist/utils/objects");
|
|
46
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
47
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
48
|
+
var icons = (0, import_objects.typedFromEntries)((0, import_objects.typedEntries)({
|
|
49
|
+
RxPencil2: import_rx.RxPencil2,
|
|
50
|
+
RxPerson: import_rx.RxPerson,
|
|
51
|
+
RxEnter: import_rx.RxEnter,
|
|
52
|
+
RxHalf2: import_rx.RxHalf2,
|
|
53
|
+
RxFilePlus: import_rx.RxFilePlus
|
|
54
|
+
}).map(([key, value]) => {
|
|
55
|
+
const styledComponent = (0, import_styled_components.default)(value)`
|
|
56
|
+
color: ${import_constants.SECONDARY_FONT_COLORS.light};
|
|
57
|
+
|
|
58
|
+
html[data-theme='dark'] & {
|
|
59
|
+
color: ${import_constants.SECONDARY_FONT_COLORS.dark};
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
return [
|
|
63
|
+
key,
|
|
64
|
+
import_react.default.createElement(styledComponent, { size: 20 })
|
|
65
|
+
];
|
|
66
|
+
}));
|
|
9
67
|
function Item(props) {
|
|
10
|
-
|
|
68
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
69
|
+
import__.DropdownMenuItem,
|
|
70
|
+
{
|
|
71
|
+
onClick: () => (0, import_promises.runAsynchronously)(props.onClick),
|
|
72
|
+
style: { display: "flex", gap: "0.5rem", alignItems: "center" },
|
|
73
|
+
children: [
|
|
74
|
+
props.icon,
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { children: props.text })
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
);
|
|
11
79
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
80
|
+
function UserButton(props) {
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
82
|
+
import_react.Suspense,
|
|
83
|
+
{
|
|
84
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Skeleton, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserButtonInnerInner, { ...props, user: null }) }),
|
|
85
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserButtonInner, { ...props })
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
function UserButtonInner(props) {
|
|
90
|
+
const user = (0, import__.useUser)();
|
|
91
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserButtonInnerInner, { ...props, user });
|
|
92
|
+
}
|
|
93
|
+
function UserButtonInnerInner(props) {
|
|
94
|
+
const user = props.user;
|
|
95
|
+
const app = (0, import__.useStackApp)();
|
|
96
|
+
const router = (0, import_navigation.useRouter)();
|
|
97
|
+
const textStyles = {
|
|
98
|
+
textOverflow: "ellipsis",
|
|
99
|
+
whiteSpace: "nowrap",
|
|
100
|
+
overflow: "hidden"
|
|
101
|
+
};
|
|
102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import__.DropdownMenu, { children: [
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DropdownMenuTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center" }, children: [
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_user_avatar.default, { user }),
|
|
105
|
+
user && props.showUserInfo && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", justifyContent: "center" }, children: [
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { style: textStyles, children: user.displayName }),
|
|
107
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { style: { ...textStyles, fontWeight: 400 }, variant: "secondary", size: "sm", children: user.primaryEmail })
|
|
108
|
+
] })
|
|
109
|
+
] }) }),
|
|
110
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import__.DropdownMenuContent, { style: { zIndex: 1500 }, children: [
|
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DropdownMenuLabel, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center" }, children: [
|
|
112
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_user_avatar.default, { user }),
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
114
|
+
user && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { children: user.displayName }),
|
|
115
|
+
user && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { variant: "secondary", size: "sm", style: { fontWeight: 400 }, children: user.primaryEmail }),
|
|
116
|
+
!user && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { variant: "secondary", children: "Not signed in" })
|
|
117
|
+
] })
|
|
118
|
+
] }) }),
|
|
119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DropdownMenuSeparator, {}),
|
|
120
|
+
user && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
121
|
+
Item,
|
|
122
|
+
{
|
|
123
|
+
text: "Account settings",
|
|
124
|
+
onClick: () => (0, import_promises.runAsynchronously)(router.push(app.urls.accountSettings)),
|
|
125
|
+
icon: icons.RxPerson
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
!user && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
129
|
+
Item,
|
|
130
|
+
{
|
|
131
|
+
text: "Sign in",
|
|
132
|
+
onClick: () => (0, import_promises.runAsynchronously)(router.push(app.urls.signIn)),
|
|
133
|
+
icon: icons.RxPerson
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
!user && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
137
|
+
Item,
|
|
138
|
+
{
|
|
139
|
+
text: "Sign up",
|
|
140
|
+
onClick: () => (0, import_promises.runAsynchronously)(router.push(app.urls.signUp)),
|
|
141
|
+
icon: icons.RxPencil2
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
user && props.extraItems && props.extraItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Item, { ...item }, index)),
|
|
145
|
+
props.colorModeToggle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
146
|
+
Item,
|
|
147
|
+
{
|
|
148
|
+
text: "Toggle theme",
|
|
149
|
+
onClick: props.colorModeToggle,
|
|
150
|
+
icon: icons.RxHalf2
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
user && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
154
|
+
Item,
|
|
155
|
+
{
|
|
156
|
+
text: "Sign out",
|
|
157
|
+
onClick: () => user.signOut(),
|
|
158
|
+
icon: icons.RxEnter
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
] })
|
|
162
|
+
] });
|
|
27
163
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as _radix_ui_react_avatar from '@radix-ui/react-avatar';
|
|
3
|
+
|
|
4
|
+
declare const Avatar: React.ForwardRefExoticComponent<Omit<_radix_ui_react_avatar.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
5
|
+
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<_radix_ui_react_avatar.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
6
|
+
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<_radix_ui_react_avatar.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
7
|
+
|
|
8
|
+
export { Avatar, AvatarFallback, AvatarImage };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import * as
|
|
3
|
-
|
|
4
|
-
declare const
|
|
5
|
-
declare const
|
|
6
|
-
|
|
2
|
+
import * as _radix_ui_react_avatar from '@radix-ui/react-avatar';
|
|
3
|
+
|
|
4
|
+
declare const Avatar: React.ForwardRefExoticComponent<Omit<_radix_ui_react_avatar.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
5
|
+
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<_radix_ui_react_avatar.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
6
|
+
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<_radix_ui_react_avatar.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
7
|
+
|
|
8
|
+
export { Avatar, AvatarFallback, AvatarImage };
|