@contentgrowth/content-auth 0.2.0 → 0.2.2
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/dist/backend/index.d.ts +17 -1
- package/dist/backend/index.js +3 -1
- package/dist/{chunk-VX6RJ5XJ.js → chunk-2TPT2QM4.js} +30 -24
- package/dist/{chunk-C2QC5WEH.js → chunk-FYU2PONS.js} +13 -0
- package/dist/frontend/client.d.ts +8 -8
- package/dist/frontend/index.d.ts +4 -0
- package/dist/frontend/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -2
- package/package.json +1 -1
package/dist/backend/index.d.ts
CHANGED
|
@@ -1059,6 +1059,22 @@ declare namespace schema {
|
|
|
1059
1059
|
export { schema_accounts as accounts, schema_invitations as invitations, schema_members as members, schema_organizations as organizations, schema_sessions as sessions, schema_users as users, schema_verifications as verifications };
|
|
1060
1060
|
}
|
|
1061
1061
|
|
|
1062
|
+
/**
|
|
1063
|
+
* Generates a formatted invitation link from the Better-Auth invitation data.
|
|
1064
|
+
*
|
|
1065
|
+
* Handles:
|
|
1066
|
+
* 1. Default Better-Auth fields (link, url)
|
|
1067
|
+
* 2. Fallback construction using baseUrl and invitation ID
|
|
1068
|
+
* 3. Markdown formatting for email clients causing auto-link issues
|
|
1069
|
+
*
|
|
1070
|
+
* @param data The data object received in the sendInvitationEmail hook
|
|
1071
|
+
* @param baseUrl The base URL of the application (e.g., https://app.example.com)
|
|
1072
|
+
* @returns An object containing the raw link and the markdown formatted link
|
|
1073
|
+
*/
|
|
1074
|
+
declare function getInvitationLink(data: any, baseUrl: string): {
|
|
1075
|
+
link: any;
|
|
1076
|
+
};
|
|
1077
|
+
|
|
1062
1078
|
interface AuthConfig {
|
|
1063
1079
|
/**
|
|
1064
1080
|
* The database instance or D1 binding.
|
|
@@ -1088,4 +1104,4 @@ declare const createAuthApp: (config: AuthConfig) => {
|
|
|
1088
1104
|
auth: better_auth.Auth<any>;
|
|
1089
1105
|
};
|
|
1090
1106
|
|
|
1091
|
-
export { type AuthConfig, authMiddleware, createAuth, createAuthApp, schema };
|
|
1107
|
+
export { type AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, schema };
|
package/dist/backend/index.js
CHANGED
|
@@ -3,13 +3,15 @@ import {
|
|
|
3
3
|
authMiddleware,
|
|
4
4
|
createAuth,
|
|
5
5
|
createAuthApp,
|
|
6
|
+
getInvitationLink,
|
|
6
7
|
schema_exports
|
|
7
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-FYU2PONS.js";
|
|
8
9
|
import "../chunk-R5U7XKVJ.js";
|
|
9
10
|
export {
|
|
10
11
|
Hono,
|
|
11
12
|
authMiddleware,
|
|
12
13
|
createAuth,
|
|
13
14
|
createAuthApp,
|
|
15
|
+
getInvitationLink,
|
|
14
16
|
schema_exports as schema
|
|
15
17
|
};
|
|
@@ -16,10 +16,12 @@ var AuthForm = ({
|
|
|
16
16
|
layout = "default",
|
|
17
17
|
socialPosition = "top",
|
|
18
18
|
view,
|
|
19
|
-
onSwitchMode
|
|
19
|
+
onSwitchMode,
|
|
20
|
+
defaultEmail = "",
|
|
21
|
+
lockEmail = false
|
|
20
22
|
}) => {
|
|
21
23
|
const [isLogin, setIsLogin] = useState(view !== "signup");
|
|
22
|
-
const [email, setEmail] = useState(
|
|
24
|
+
const [email, setEmail] = useState(defaultEmail);
|
|
23
25
|
const [password, setPassword] = useState("");
|
|
24
26
|
const [name, setName] = useState("");
|
|
25
27
|
const [loading, setLoading] = useState(false);
|
|
@@ -73,26 +75,29 @@ var AuthForm = ({
|
|
|
73
75
|
else if (width === "wide") widthClass = "ca-width-wide";
|
|
74
76
|
else widthClass = "ca-width-default";
|
|
75
77
|
const containerClass = `ca-container ${layout === "split" ? "ca-layout-split" : ""} ${widthClass} ${className || ""}`;
|
|
76
|
-
const renderSocials = () =>
|
|
77
|
-
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
/* @__PURE__ */ jsx("
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
78
|
+
const renderSocials = () => (
|
|
79
|
+
// Hide social logins when email is locked (e.g., invitation flow)
|
|
80
|
+
!lockEmail && socialProviders.length > 0 && /* @__PURE__ */ jsx("div", { className: socialClass, children: socialProviders.map((provider) => /* @__PURE__ */ jsxs(
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
type: "button",
|
|
84
|
+
className: `ca-button ca-button-social ca-button-${provider}`,
|
|
85
|
+
onClick: () => handleSocialLogin(provider),
|
|
86
|
+
disabled: loading,
|
|
87
|
+
children: [
|
|
88
|
+
provider === "google" && /* @__PURE__ */ jsx("svg", { className: "ca-icon", viewBox: "0 0 24 24", width: "20", height: "20", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxs("g", { transform: "matrix(1, 0, 0, 1, 27.009001, -39.238998)", children: [
|
|
89
|
+
/* @__PURE__ */ jsx("path", { fill: "#4285F4", d: "M -3.264 51.509 C -3.264 50.719 -3.334 49.969 -3.454 49.239 L -14.754 49.239 L -14.754 53.749 L -8.284 53.749 C -8.574 55.229 -9.424 56.479 -10.684 57.329 L -10.684 60.329 L -6.824 60.329 C -4.564 58.239 -3.264 55.159 -3.264 51.509 Z" }),
|
|
90
|
+
/* @__PURE__ */ jsx("path", { fill: "#34A853", d: "M -14.754 63.239 C -11.514 63.239 -8.804 62.159 -6.824 60.329 L -10.684 57.329 C -11.764 58.049 -13.134 58.489 -14.754 58.489 C -17.884 58.489 -20.534 56.379 -21.484 53.529 L -25.464 53.529 L -25.464 56.619 C -23.494 60.539 -19.444 63.239 -14.754 63.239 Z" }),
|
|
91
|
+
/* @__PURE__ */ jsx("path", { fill: "#FBBC05", d: "M -21.484 53.529 C -21.734 52.809 -21.864 52.039 -21.864 51.239 C -21.864 50.439 -21.734 49.669 -21.484 48.949 L -21.484 45.859 L -25.464 45.859 C -26.284 47.479 -26.754 49.299 -26.754 51.239 C -26.754 53.179 -26.284 54.999 -25.464 56.619 L -21.484 53.529 Z" }),
|
|
92
|
+
/* @__PURE__ */ jsx("path", { fill: "#EA4335", d: "M -14.754 43.989 C -12.984 43.989 -11.424 44.599 -10.174 45.789 L -6.744 42.359 C -8.804 40.429 -11.514 39.239 -14.754 39.239 C -19.444 39.239 -23.494 41.939 -25.464 45.859 L -21.484 48.949 C -20.534 46.099 -17.884 43.989 -14.754 43.989 Z" })
|
|
93
|
+
] }) }),
|
|
94
|
+
provider === "github" && /* @__PURE__ */ jsx("svg", { className: "ca-icon", viewBox: "0 0 24 24", width: "20", height: "20", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M12 2C6.477 2 2 6.477 2 12c0 4.42 2.865 8.17 6.839 9.49.5.092.682-.217.682-.482 0-.237-.008-.866-.013-1.7-2.782.604-3.369-1.34-3.369-1.34-.454-1.156-1.11-1.464-1.11-1.464-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12c0-5.523-4.477-10-10-10z", fill: "currentColor" }) }),
|
|
95
|
+
/* @__PURE__ */ jsx("span", { className: "ca-btn-text", children: provider === "github" ? "GitHub" : "Google" })
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
provider
|
|
99
|
+
)) })
|
|
100
|
+
);
|
|
96
101
|
const renderForm = () => {
|
|
97
102
|
if (!mounted) {
|
|
98
103
|
return /* @__PURE__ */ jsx("div", { className: "ca-form", children: /* @__PURE__ */ jsxs("div", { className: "ca-input-group", style: { opacity: 0 }, children: [
|
|
@@ -122,9 +127,10 @@ var AuthForm = ({
|
|
|
122
127
|
{
|
|
123
128
|
id: "email",
|
|
124
129
|
type: "email",
|
|
125
|
-
className: "ca-input"
|
|
130
|
+
className: `ca-input ${lockEmail ? "ca-input-locked" : ""}`,
|
|
126
131
|
value: email,
|
|
127
|
-
onChange: (e) => setEmail(e.target.value),
|
|
132
|
+
onChange: (e) => !lockEmail && setEmail(e.target.value),
|
|
133
|
+
readOnly: lockEmail,
|
|
128
134
|
required: true
|
|
129
135
|
}
|
|
130
136
|
)
|
|
@@ -164,6 +164,18 @@ async function verifyPassword(passwordOrData, storedHash) {
|
|
|
164
164
|
return result === 0;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
// src/backend/utils.ts
|
|
168
|
+
function getInvitationLink(data, baseUrl) {
|
|
169
|
+
let rawLink = data.link || data.url;
|
|
170
|
+
if (!rawLink) {
|
|
171
|
+
const cleanBaseUrl = baseUrl.replace(/\/$/, "");
|
|
172
|
+
rawLink = `${cleanBaseUrl}/accept-invitation/${data.id}`;
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
link: rawLink
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
167
179
|
// src/backend/index.ts
|
|
168
180
|
var createAuth = (config) => {
|
|
169
181
|
let db;
|
|
@@ -222,6 +234,7 @@ var createAuthApp = (config) => {
|
|
|
222
234
|
|
|
223
235
|
export {
|
|
224
236
|
schema_exports,
|
|
237
|
+
getInvitationLink,
|
|
225
238
|
Hono,
|
|
226
239
|
createAuth,
|
|
227
240
|
authMiddleware,
|
|
@@ -628,7 +628,7 @@ declare const createClient: (baseUrl?: string) => {
|
|
|
628
628
|
sortDirection?: "asc" | "desc" | undefined;
|
|
629
629
|
filterField?: string | undefined;
|
|
630
630
|
filterValue?: string | number | boolean | undefined;
|
|
631
|
-
filterOperator?: "eq" | "ne" | "
|
|
631
|
+
filterOperator?: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "contains" | undefined;
|
|
632
632
|
organizationId?: string | undefined;
|
|
633
633
|
organizationSlug?: string | undefined;
|
|
634
634
|
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
|
|
@@ -639,7 +639,7 @@ declare const createClient: (baseUrl?: string) => {
|
|
|
639
639
|
sortDirection?: "asc" | "desc" | undefined;
|
|
640
640
|
filterField?: string | undefined;
|
|
641
641
|
filterValue?: string | number | boolean | undefined;
|
|
642
|
-
filterOperator?: "eq" | "ne" | "
|
|
642
|
+
filterOperator?: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "contains" | undefined;
|
|
643
643
|
organizationId?: string | undefined;
|
|
644
644
|
organizationSlug?: string | undefined;
|
|
645
645
|
} | undefined;
|
|
@@ -746,7 +746,7 @@ declare const createClient: (baseUrl?: string) => {
|
|
|
746
746
|
} & {
|
|
747
747
|
signIn: {
|
|
748
748
|
social: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
|
|
749
|
-
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "
|
|
749
|
+
provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
750
750
|
callbackURL?: string | undefined;
|
|
751
751
|
newUserCallbackURL?: string | undefined;
|
|
752
752
|
errorCallbackURL?: string | undefined;
|
|
@@ -763,7 +763,7 @@ declare const createClient: (baseUrl?: string) => {
|
|
|
763
763
|
loginHint?: string | undefined;
|
|
764
764
|
additionalData?: Record<string, any> | undefined;
|
|
765
765
|
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
|
|
766
|
-
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "
|
|
766
|
+
provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
767
767
|
callbackURL?: string | undefined;
|
|
768
768
|
newUserCallbackURL?: string | undefined;
|
|
769
769
|
errorCallbackURL?: string | undefined;
|
|
@@ -2205,7 +2205,7 @@ declare const authClient: {
|
|
|
2205
2205
|
sortDirection?: "asc" | "desc" | undefined;
|
|
2206
2206
|
filterField?: string | undefined;
|
|
2207
2207
|
filterValue?: string | number | boolean | undefined;
|
|
2208
|
-
filterOperator?: "eq" | "ne" | "
|
|
2208
|
+
filterOperator?: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "contains" | undefined;
|
|
2209
2209
|
organizationId?: string | undefined;
|
|
2210
2210
|
organizationSlug?: string | undefined;
|
|
2211
2211
|
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
|
|
@@ -2216,7 +2216,7 @@ declare const authClient: {
|
|
|
2216
2216
|
sortDirection?: "asc" | "desc" | undefined;
|
|
2217
2217
|
filterField?: string | undefined;
|
|
2218
2218
|
filterValue?: string | number | boolean | undefined;
|
|
2219
|
-
filterOperator?: "eq" | "ne" | "
|
|
2219
|
+
filterOperator?: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "contains" | undefined;
|
|
2220
2220
|
organizationId?: string | undefined;
|
|
2221
2221
|
organizationSlug?: string | undefined;
|
|
2222
2222
|
} | undefined;
|
|
@@ -2323,7 +2323,7 @@ declare const authClient: {
|
|
|
2323
2323
|
} & {
|
|
2324
2324
|
signIn: {
|
|
2325
2325
|
social: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
|
|
2326
|
-
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "
|
|
2326
|
+
provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
2327
2327
|
callbackURL?: string | undefined;
|
|
2328
2328
|
newUserCallbackURL?: string | undefined;
|
|
2329
2329
|
errorCallbackURL?: string | undefined;
|
|
@@ -2340,7 +2340,7 @@ declare const authClient: {
|
|
|
2340
2340
|
loginHint?: string | undefined;
|
|
2341
2341
|
additionalData?: Record<string, any> | undefined;
|
|
2342
2342
|
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
|
|
2343
|
-
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "
|
|
2343
|
+
provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
2344
2344
|
callbackURL?: string | undefined;
|
|
2345
2345
|
newUserCallbackURL?: string | undefined;
|
|
2346
2346
|
errorCallbackURL?: string | undefined;
|
package/dist/frontend/index.d.ts
CHANGED
|
@@ -18,6 +18,10 @@ interface AuthFormProps {
|
|
|
18
18
|
layout?: 'default' | 'split';
|
|
19
19
|
socialPosition?: 'top' | 'bottom';
|
|
20
20
|
onSwitchMode?: () => void;
|
|
21
|
+
/** Pre-populate the email field (useful for invitation flows) */
|
|
22
|
+
defaultEmail?: string;
|
|
23
|
+
/** Lock the email field (readonly) and hide social logins */
|
|
24
|
+
lockEmail?: boolean;
|
|
21
25
|
}
|
|
22
26
|
declare const AuthForm: React.FC<AuthFormProps>;
|
|
23
27
|
|
package/dist/frontend/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthConfig, authMiddleware, createAuth, createAuthApp, schema } from './backend/index.js';
|
|
1
|
+
export { AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, schema } from './backend/index.js';
|
|
2
2
|
export { AuthForm, CreateOrganizationForm, InviteMemberForm, OrganizationSwitcher } from './frontend/index.js';
|
|
3
3
|
export { authClient, createClient } from './frontend/client.js';
|
|
4
4
|
export * from 'better-auth';
|
package/dist/index.js
CHANGED
|
@@ -3,14 +3,15 @@ import {
|
|
|
3
3
|
authMiddleware,
|
|
4
4
|
createAuth,
|
|
5
5
|
createAuthApp,
|
|
6
|
+
getInvitationLink,
|
|
6
7
|
schema_exports
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FYU2PONS.js";
|
|
8
9
|
import {
|
|
9
10
|
AuthForm,
|
|
10
11
|
CreateOrganizationForm,
|
|
11
12
|
InviteMemberForm,
|
|
12
13
|
OrganizationSwitcher
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-2TPT2QM4.js";
|
|
14
15
|
import {
|
|
15
16
|
authClient,
|
|
16
17
|
createClient
|
|
@@ -27,5 +28,6 @@ export {
|
|
|
27
28
|
createAuth,
|
|
28
29
|
createAuthApp,
|
|
29
30
|
createClient,
|
|
31
|
+
getInvitationLink,
|
|
30
32
|
schema_exports as schema
|
|
31
33
|
};
|