@victusvinceere/saas-core 0.1.0
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/auth/index.d.mts +40 -0
- package/dist/auth/index.d.ts +40 -0
- package/dist/auth/index.js +147 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/index.mjs +111 -0
- package/dist/auth/index.mjs.map +1 -0
- package/dist/authorization/index.d.mts +78 -0
- package/dist/authorization/index.d.ts +78 -0
- package/dist/authorization/index.js +137 -0
- package/dist/authorization/index.js.map +1 -0
- package/dist/authorization/index.mjs +104 -0
- package/dist/authorization/index.mjs.map +1 -0
- package/dist/components/auth/index.d.mts +26 -0
- package/dist/components/auth/index.d.ts +26 -0
- package/dist/components/auth/index.js +733 -0
- package/dist/components/auth/index.js.map +1 -0
- package/dist/components/auth/index.mjs +696 -0
- package/dist/components/auth/index.mjs.map +1 -0
- package/dist/components/dashboard/index.d.mts +32 -0
- package/dist/components/dashboard/index.d.ts +32 -0
- package/dist/components/dashboard/index.js +440 -0
- package/dist/components/dashboard/index.js.map +1 -0
- package/dist/components/dashboard/index.mjs +401 -0
- package/dist/components/dashboard/index.mjs.map +1 -0
- package/dist/components/ui/index.d.mts +351 -0
- package/dist/components/ui/index.d.ts +351 -0
- package/dist/components/ui/index.js +14342 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/components/ui/index.mjs +14173 -0
- package/dist/components/ui/index.mjs.map +1 -0
- package/dist/config/index.d.mts +45 -0
- package/dist/config/index.d.ts +45 -0
- package/dist/config/index.js +71 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/index.mjs +44 -0
- package/dist/config/index.mjs.map +1 -0
- package/dist/hooks/index.d.mts +20 -0
- package/dist/hooks/index.d.ts +20 -0
- package/dist/hooks/index.js +103 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +65 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +459 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +401 -0
- package/dist/index.mjs.map +1 -0
- package/dist/prisma/index.d.mts +11 -0
- package/dist/prisma/index.d.ts +11 -0
- package/dist/prisma/index.js +46 -0
- package/dist/prisma/index.js.map +1 -0
- package/dist/prisma/index.mjs +20 -0
- package/dist/prisma/index.mjs.map +1 -0
- package/dist/providers/index.d.mts +37 -0
- package/dist/providers/index.d.ts +37 -0
- package/dist/providers/index.js +97 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/index.mjs +69 -0
- package/dist/providers/index.mjs.map +1 -0
- package/dist/sidebar-ttX_iZ40.d.mts +22 -0
- package/dist/sidebar-ttX_iZ40.d.ts +22 -0
- package/package.json +122 -0
- package/prisma/schema.prisma +106 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AuthProvider } from '../auth/index.mjs';
|
|
2
|
+
import { S as SidebarNavGroup } from '../sidebar-ttX_iZ40.mjs';
|
|
3
|
+
import 'next-auth';
|
|
4
|
+
import 'next-auth/adapters';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import 'lucide-react';
|
|
7
|
+
|
|
8
|
+
interface SaasKitConfig {
|
|
9
|
+
app: {
|
|
10
|
+
name: string;
|
|
11
|
+
url?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
};
|
|
14
|
+
auth: {
|
|
15
|
+
providers: AuthProvider[];
|
|
16
|
+
pages?: {
|
|
17
|
+
signIn?: string;
|
|
18
|
+
signOut?: string;
|
|
19
|
+
error?: string;
|
|
20
|
+
verifyRequest?: string;
|
|
21
|
+
newUser?: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
dashboard?: {
|
|
25
|
+
navigation?: SidebarNavGroup[];
|
|
26
|
+
};
|
|
27
|
+
features?: {
|
|
28
|
+
payments?: boolean;
|
|
29
|
+
admin?: boolean;
|
|
30
|
+
blog?: boolean;
|
|
31
|
+
};
|
|
32
|
+
theme?: {
|
|
33
|
+
defaultTheme?: "light" | "dark" | "system";
|
|
34
|
+
enableSystem?: boolean;
|
|
35
|
+
storageKey?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
declare function defineConfig(config: SaasKitConfig): SaasKitConfig;
|
|
39
|
+
declare function createSiteConfig(config: SaasKitConfig): {
|
|
40
|
+
name: string;
|
|
41
|
+
description: string;
|
|
42
|
+
url: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { type SaasKitConfig, createSiteConfig, defineConfig };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AuthProvider } from '../auth/index.js';
|
|
2
|
+
import { S as SidebarNavGroup } from '../sidebar-ttX_iZ40.js';
|
|
3
|
+
import 'next-auth';
|
|
4
|
+
import 'next-auth/adapters';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import 'lucide-react';
|
|
7
|
+
|
|
8
|
+
interface SaasKitConfig {
|
|
9
|
+
app: {
|
|
10
|
+
name: string;
|
|
11
|
+
url?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
};
|
|
14
|
+
auth: {
|
|
15
|
+
providers: AuthProvider[];
|
|
16
|
+
pages?: {
|
|
17
|
+
signIn?: string;
|
|
18
|
+
signOut?: string;
|
|
19
|
+
error?: string;
|
|
20
|
+
verifyRequest?: string;
|
|
21
|
+
newUser?: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
dashboard?: {
|
|
25
|
+
navigation?: SidebarNavGroup[];
|
|
26
|
+
};
|
|
27
|
+
features?: {
|
|
28
|
+
payments?: boolean;
|
|
29
|
+
admin?: boolean;
|
|
30
|
+
blog?: boolean;
|
|
31
|
+
};
|
|
32
|
+
theme?: {
|
|
33
|
+
defaultTheme?: "light" | "dark" | "system";
|
|
34
|
+
enableSystem?: boolean;
|
|
35
|
+
storageKey?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
declare function defineConfig(config: SaasKitConfig): SaasKitConfig;
|
|
39
|
+
declare function createSiteConfig(config: SaasKitConfig): {
|
|
40
|
+
name: string;
|
|
41
|
+
description: string;
|
|
42
|
+
url: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { type SaasKitConfig, createSiteConfig, defineConfig };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/config/index.ts
|
|
22
|
+
var config_exports = {};
|
|
23
|
+
__export(config_exports, {
|
|
24
|
+
createSiteConfig: () => createSiteConfig,
|
|
25
|
+
defineConfig: () => defineConfig
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(config_exports);
|
|
28
|
+
|
|
29
|
+
// src/config/define-config.ts
|
|
30
|
+
function defineConfig(config) {
|
|
31
|
+
return {
|
|
32
|
+
app: {
|
|
33
|
+
name: config.app.name,
|
|
34
|
+
url: config.app.url || process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000",
|
|
35
|
+
description: config.app.description || ""
|
|
36
|
+
},
|
|
37
|
+
auth: {
|
|
38
|
+
providers: config.auth.providers,
|
|
39
|
+
pages: {
|
|
40
|
+
signIn: config.auth.pages?.signIn || "/login",
|
|
41
|
+
error: config.auth.pages?.error || "/auth-error",
|
|
42
|
+
verifyRequest: config.auth.pages?.verifyRequest || "/verify-request",
|
|
43
|
+
...config.auth.pages
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
dashboard: config.dashboard,
|
|
47
|
+
features: {
|
|
48
|
+
payments: config.features?.payments ?? false,
|
|
49
|
+
admin: config.features?.admin ?? false,
|
|
50
|
+
blog: config.features?.blog ?? false
|
|
51
|
+
},
|
|
52
|
+
theme: {
|
|
53
|
+
defaultTheme: config.theme?.defaultTheme || "system",
|
|
54
|
+
enableSystem: config.theme?.enableSystem ?? true,
|
|
55
|
+
storageKey: config.theme?.storageKey || "saas-kit-theme"
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function createSiteConfig(config) {
|
|
60
|
+
return {
|
|
61
|
+
name: config.app.name,
|
|
62
|
+
description: config.app.description || "",
|
|
63
|
+
url: config.app.url || process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000"
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
createSiteConfig,
|
|
69
|
+
defineConfig
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/config/index.ts","../../src/config/define-config.ts"],"sourcesContent":["export { defineConfig, createSiteConfig } from \"./define-config\";\nexport type { SaasKitConfig } from \"./define-config\";\n","import type { AuthProvider } from \"../auth/create-auth-config\";\nimport type { SidebarNavGroup } from \"../components/dashboard/sidebar\";\n\nexport interface SaasKitConfig {\n app: {\n name: string;\n url?: string;\n description?: string;\n };\n auth: {\n providers: AuthProvider[];\n pages?: {\n signIn?: string;\n signOut?: string;\n error?: string;\n verifyRequest?: string;\n newUser?: string;\n };\n };\n dashboard?: {\n navigation?: SidebarNavGroup[];\n };\n features?: {\n payments?: boolean;\n admin?: boolean;\n blog?: boolean;\n };\n theme?: {\n defaultTheme?: \"light\" | \"dark\" | \"system\";\n enableSystem?: boolean;\n storageKey?: string;\n };\n}\n\nexport function defineConfig(config: SaasKitConfig): SaasKitConfig {\n return {\n app: {\n name: config.app.name,\n url: config.app.url || process.env.NEXT_PUBLIC_APP_URL || \"http://localhost:3000\",\n description: config.app.description || \"\",\n },\n auth: {\n providers: config.auth.providers,\n pages: {\n signIn: config.auth.pages?.signIn || \"/login\",\n error: config.auth.pages?.error || \"/auth-error\",\n verifyRequest: config.auth.pages?.verifyRequest || \"/verify-request\",\n ...config.auth.pages,\n },\n },\n dashboard: config.dashboard,\n features: {\n payments: config.features?.payments ?? false,\n admin: config.features?.admin ?? false,\n blog: config.features?.blog ?? false,\n },\n theme: {\n defaultTheme: config.theme?.defaultTheme || \"system\",\n enableSystem: config.theme?.enableSystem ?? true,\n storageKey: config.theme?.storageKey || \"saas-kit-theme\",\n },\n };\n}\n\nexport function createSiteConfig(config: SaasKitConfig) {\n return {\n name: config.app.name,\n description: config.app.description || \"\",\n url: config.app.url || process.env.NEXT_PUBLIC_APP_URL || \"http://localhost:3000\",\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACkCO,SAAS,aAAa,QAAsC;AACjE,SAAO;AAAA,IACL,KAAK;AAAA,MACH,MAAM,OAAO,IAAI;AAAA,MACjB,KAAK,OAAO,IAAI,OAAO,QAAQ,IAAI,uBAAuB;AAAA,MAC1D,aAAa,OAAO,IAAI,eAAe;AAAA,IACzC;AAAA,IACA,MAAM;AAAA,MACJ,WAAW,OAAO,KAAK;AAAA,MACvB,OAAO;AAAA,QACL,QAAQ,OAAO,KAAK,OAAO,UAAU;AAAA,QACrC,OAAO,OAAO,KAAK,OAAO,SAAS;AAAA,QACnC,eAAe,OAAO,KAAK,OAAO,iBAAiB;AAAA,QACnD,GAAG,OAAO,KAAK;AAAA,MACjB;AAAA,IACF;AAAA,IACA,WAAW,OAAO;AAAA,IAClB,UAAU;AAAA,MACR,UAAU,OAAO,UAAU,YAAY;AAAA,MACvC,OAAO,OAAO,UAAU,SAAS;AAAA,MACjC,MAAM,OAAO,UAAU,QAAQ;AAAA,IACjC;AAAA,IACA,OAAO;AAAA,MACL,cAAc,OAAO,OAAO,gBAAgB;AAAA,MAC5C,cAAc,OAAO,OAAO,gBAAgB;AAAA,MAC5C,YAAY,OAAO,OAAO,cAAc;AAAA,IAC1C;AAAA,EACF;AACF;AAEO,SAAS,iBAAiB,QAAuB;AACtD,SAAO;AAAA,IACL,MAAM,OAAO,IAAI;AAAA,IACjB,aAAa,OAAO,IAAI,eAAe;AAAA,IACvC,KAAK,OAAO,IAAI,OAAO,QAAQ,IAAI,uBAAuB;AAAA,EAC5D;AACF;","names":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/config/define-config.ts
|
|
4
|
+
function defineConfig(config) {
|
|
5
|
+
return {
|
|
6
|
+
app: {
|
|
7
|
+
name: config.app.name,
|
|
8
|
+
url: config.app.url || process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000",
|
|
9
|
+
description: config.app.description || ""
|
|
10
|
+
},
|
|
11
|
+
auth: {
|
|
12
|
+
providers: config.auth.providers,
|
|
13
|
+
pages: {
|
|
14
|
+
signIn: config.auth.pages?.signIn || "/login",
|
|
15
|
+
error: config.auth.pages?.error || "/auth-error",
|
|
16
|
+
verifyRequest: config.auth.pages?.verifyRequest || "/verify-request",
|
|
17
|
+
...config.auth.pages
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
dashboard: config.dashboard,
|
|
21
|
+
features: {
|
|
22
|
+
payments: config.features?.payments ?? false,
|
|
23
|
+
admin: config.features?.admin ?? false,
|
|
24
|
+
blog: config.features?.blog ?? false
|
|
25
|
+
},
|
|
26
|
+
theme: {
|
|
27
|
+
defaultTheme: config.theme?.defaultTheme || "system",
|
|
28
|
+
enableSystem: config.theme?.enableSystem ?? true,
|
|
29
|
+
storageKey: config.theme?.storageKey || "saas-kit-theme"
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function createSiteConfig(config) {
|
|
34
|
+
return {
|
|
35
|
+
name: config.app.name,
|
|
36
|
+
description: config.app.description || "",
|
|
37
|
+
url: config.app.url || process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000"
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
createSiteConfig,
|
|
42
|
+
defineConfig
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/config/define-config.ts"],"sourcesContent":["import type { AuthProvider } from \"../auth/create-auth-config\";\nimport type { SidebarNavGroup } from \"../components/dashboard/sidebar\";\n\nexport interface SaasKitConfig {\n app: {\n name: string;\n url?: string;\n description?: string;\n };\n auth: {\n providers: AuthProvider[];\n pages?: {\n signIn?: string;\n signOut?: string;\n error?: string;\n verifyRequest?: string;\n newUser?: string;\n };\n };\n dashboard?: {\n navigation?: SidebarNavGroup[];\n };\n features?: {\n payments?: boolean;\n admin?: boolean;\n blog?: boolean;\n };\n theme?: {\n defaultTheme?: \"light\" | \"dark\" | \"system\";\n enableSystem?: boolean;\n storageKey?: string;\n };\n}\n\nexport function defineConfig(config: SaasKitConfig): SaasKitConfig {\n return {\n app: {\n name: config.app.name,\n url: config.app.url || process.env.NEXT_PUBLIC_APP_URL || \"http://localhost:3000\",\n description: config.app.description || \"\",\n },\n auth: {\n providers: config.auth.providers,\n pages: {\n signIn: config.auth.pages?.signIn || \"/login\",\n error: config.auth.pages?.error || \"/auth-error\",\n verifyRequest: config.auth.pages?.verifyRequest || \"/verify-request\",\n ...config.auth.pages,\n },\n },\n dashboard: config.dashboard,\n features: {\n payments: config.features?.payments ?? false,\n admin: config.features?.admin ?? false,\n blog: config.features?.blog ?? false,\n },\n theme: {\n defaultTheme: config.theme?.defaultTheme || \"system\",\n enableSystem: config.theme?.enableSystem ?? true,\n storageKey: config.theme?.storageKey || \"saas-kit-theme\",\n },\n };\n}\n\nexport function createSiteConfig(config: SaasKitConfig) {\n return {\n name: config.app.name,\n description: config.app.description || \"\",\n url: config.app.url || process.env.NEXT_PUBLIC_APP_URL || \"http://localhost:3000\",\n };\n}\n"],"mappings":";;;AAkCO,SAAS,aAAa,QAAsC;AACjE,SAAO;AAAA,IACL,KAAK;AAAA,MACH,MAAM,OAAO,IAAI;AAAA,MACjB,KAAK,OAAO,IAAI,OAAO,QAAQ,IAAI,uBAAuB;AAAA,MAC1D,aAAa,OAAO,IAAI,eAAe;AAAA,IACzC;AAAA,IACA,MAAM;AAAA,MACJ,WAAW,OAAO,KAAK;AAAA,MACvB,OAAO;AAAA,QACL,QAAQ,OAAO,KAAK,OAAO,UAAU;AAAA,QACrC,OAAO,OAAO,KAAK,OAAO,SAAS;AAAA,QACnC,eAAe,OAAO,KAAK,OAAO,iBAAiB;AAAA,QACnD,GAAG,OAAO,KAAK;AAAA,MACjB;AAAA,IACF;AAAA,IACA,WAAW,OAAO;AAAA,IAClB,UAAU;AAAA,MACR,UAAU,OAAO,UAAU,YAAY;AAAA,MACvC,OAAO,OAAO,UAAU,SAAS;AAAA,MACjC,MAAM,OAAO,UAAU,QAAQ;AAAA,IACjC;AAAA,IACA,OAAO;AAAA,MACL,cAAc,OAAO,OAAO,gBAAgB;AAAA,MAC5C,cAAc,OAAO,OAAO,gBAAgB;AAAA,MAC5C,YAAY,OAAO,OAAO,cAAc;AAAA,IAC1C;AAAA,EACF;AACF;AAEO,SAAS,iBAAiB,QAAuB;AACtD,SAAO;AAAA,IACL,MAAM,OAAO,IAAI;AAAA,IACjB,aAAa,OAAO,IAAI,eAAe;AAAA,IACvC,KAAK,OAAO,IAAI,OAAO,QAAQ,IAAI,uBAAuB;AAAA,EAC5D;AACF;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare function useMediaQuery(query: string): boolean;
|
|
2
|
+
|
|
3
|
+
declare function useIsMobile(): boolean;
|
|
4
|
+
|
|
5
|
+
interface CurrentUser {
|
|
6
|
+
id: string;
|
|
7
|
+
name?: string | null;
|
|
8
|
+
email?: string | null;
|
|
9
|
+
image?: string | null;
|
|
10
|
+
role?: string;
|
|
11
|
+
}
|
|
12
|
+
interface UseCurrentUserReturn {
|
|
13
|
+
user: CurrentUser | null;
|
|
14
|
+
isLoading: boolean;
|
|
15
|
+
isAuthenticated: boolean;
|
|
16
|
+
update: () => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
declare function useCurrentUser(): UseCurrentUserReturn;
|
|
19
|
+
|
|
20
|
+
export { type CurrentUser, type UseCurrentUserReturn, useCurrentUser, useIsMobile, useMediaQuery };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare function useMediaQuery(query: string): boolean;
|
|
2
|
+
|
|
3
|
+
declare function useIsMobile(): boolean;
|
|
4
|
+
|
|
5
|
+
interface CurrentUser {
|
|
6
|
+
id: string;
|
|
7
|
+
name?: string | null;
|
|
8
|
+
email?: string | null;
|
|
9
|
+
image?: string | null;
|
|
10
|
+
role?: string;
|
|
11
|
+
}
|
|
12
|
+
interface UseCurrentUserReturn {
|
|
13
|
+
user: CurrentUser | null;
|
|
14
|
+
isLoading: boolean;
|
|
15
|
+
isAuthenticated: boolean;
|
|
16
|
+
update: () => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
declare function useCurrentUser(): UseCurrentUserReturn;
|
|
19
|
+
|
|
20
|
+
export { type CurrentUser, type UseCurrentUserReturn, useCurrentUser, useIsMobile, useMediaQuery };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/hooks/index.ts
|
|
32
|
+
var hooks_exports = {};
|
|
33
|
+
__export(hooks_exports, {
|
|
34
|
+
useCurrentUser: () => useCurrentUser,
|
|
35
|
+
useIsMobile: () => useIsMobile,
|
|
36
|
+
useMediaQuery: () => useMediaQuery
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(hooks_exports);
|
|
39
|
+
|
|
40
|
+
// src/hooks/use-media-query.ts
|
|
41
|
+
var import_react = require("react");
|
|
42
|
+
function useMediaQuery(query) {
|
|
43
|
+
const [matches, setMatches] = (0, import_react.useState)(false);
|
|
44
|
+
(0, import_react.useEffect)(() => {
|
|
45
|
+
const mediaQuery = window.matchMedia(query);
|
|
46
|
+
setMatches(mediaQuery.matches);
|
|
47
|
+
const handler = (event) => {
|
|
48
|
+
setMatches(event.matches);
|
|
49
|
+
};
|
|
50
|
+
mediaQuery.addEventListener("change", handler);
|
|
51
|
+
return () => {
|
|
52
|
+
mediaQuery.removeEventListener("change", handler);
|
|
53
|
+
};
|
|
54
|
+
}, [query]);
|
|
55
|
+
return matches;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/hooks/use-mobile.ts
|
|
59
|
+
var React = __toESM(require("react"));
|
|
60
|
+
var MOBILE_BREAKPOINT = 768;
|
|
61
|
+
function useIsMobile() {
|
|
62
|
+
const [isMobile, setIsMobile] = React.useState(void 0);
|
|
63
|
+
React.useEffect(() => {
|
|
64
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
65
|
+
const onChange = () => {
|
|
66
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
67
|
+
};
|
|
68
|
+
mql.addEventListener("change", onChange);
|
|
69
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
70
|
+
return () => mql.removeEventListener("change", onChange);
|
|
71
|
+
}, []);
|
|
72
|
+
return !!isMobile;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// src/hooks/use-current-user.ts
|
|
76
|
+
var import_react2 = require("next-auth/react");
|
|
77
|
+
function useCurrentUser() {
|
|
78
|
+
const { data: session, status, update } = (0, import_react2.useSession)();
|
|
79
|
+
const isLoading = status === "loading";
|
|
80
|
+
const isAuthenticated = status === "authenticated";
|
|
81
|
+
const user = session?.user ? {
|
|
82
|
+
id: session.user.id,
|
|
83
|
+
name: session.user.name,
|
|
84
|
+
email: session.user.email,
|
|
85
|
+
image: session.user.image,
|
|
86
|
+
role: session.user.role
|
|
87
|
+
} : null;
|
|
88
|
+
return {
|
|
89
|
+
user,
|
|
90
|
+
isLoading,
|
|
91
|
+
isAuthenticated,
|
|
92
|
+
update: async () => {
|
|
93
|
+
await update();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
98
|
+
0 && (module.exports = {
|
|
99
|
+
useCurrentUser,
|
|
100
|
+
useIsMobile,
|
|
101
|
+
useMediaQuery
|
|
102
|
+
});
|
|
103
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/index.ts","../../src/hooks/use-media-query.ts","../../src/hooks/use-mobile.ts","../../src/hooks/use-current-user.ts"],"sourcesContent":["export { useMediaQuery } from \"./use-media-query\";\nexport { useIsMobile } from \"./use-mobile\";\nexport { useCurrentUser } from \"./use-current-user\";\nexport type { CurrentUser, UseCurrentUserReturn } from \"./use-current-user\";\n","\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\nexport function useMediaQuery(query: string): boolean {\n const [matches, setMatches] = useState(false);\n\n useEffect(() => {\n const mediaQuery = window.matchMedia(query);\n\n // Set initial value\n setMatches(mediaQuery.matches);\n\n // Create listener\n const handler = (event: MediaQueryListEvent) => {\n setMatches(event.matches);\n };\n\n // Add listener\n mediaQuery.addEventListener(\"change\", handler);\n\n // Cleanup\n return () => {\n mediaQuery.removeEventListener(\"change\", handler);\n };\n }, [query]);\n\n return matches;\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nconst MOBILE_BREAKPOINT = 768;\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined);\n\n React.useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return !!isMobile;\n}\n","\"use client\";\n\nimport { useSession } from \"next-auth/react\";\n\nexport interface CurrentUser {\n id: string;\n name?: string | null;\n email?: string | null;\n image?: string | null;\n role?: string;\n}\n\nexport interface UseCurrentUserReturn {\n user: CurrentUser | null;\n isLoading: boolean;\n isAuthenticated: boolean;\n update: () => Promise<void>;\n}\n\nexport function useCurrentUser(): UseCurrentUserReturn {\n const { data: session, status, update } = useSession();\n\n const isLoading = status === \"loading\";\n const isAuthenticated = status === \"authenticated\";\n\n const user: CurrentUser | null = session?.user\n ? {\n id: session.user.id!,\n name: session.user.name,\n email: session.user.email,\n image: session.user.image,\n role: (session.user as { role?: string }).role,\n }\n : null;\n\n return {\n user,\n isLoading,\n isAuthenticated,\n update: async () => {\n await update();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAAoC;AAE7B,SAAS,cAAc,OAAwB;AACpD,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,KAAK;AAE5C,8BAAU,MAAM;AACd,UAAM,aAAa,OAAO,WAAW,KAAK;AAG1C,eAAW,WAAW,OAAO;AAG7B,UAAM,UAAU,CAAC,UAA+B;AAC9C,iBAAW,MAAM,OAAO;AAAA,IAC1B;AAGA,eAAW,iBAAiB,UAAU,OAAO;AAG7C,WAAO,MAAM;AACX,iBAAW,oBAAoB,UAAU,OAAO;AAAA,IAClD;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO;AACT;;;AC1BA,YAAuB;AAEvB,IAAM,oBAAoB;AAEnB,SAAS,cAAc;AAC5B,QAAM,CAAC,UAAU,WAAW,IAAU,eAA8B,MAAS;AAE7E,EAAM,gBAAU,MAAM;AACpB,UAAM,MAAM,OAAO,WAAW,eAAe,oBAAoB,CAAC,KAAK;AACvE,UAAM,WAAW,MAAM;AACrB,kBAAY,OAAO,aAAa,iBAAiB;AAAA,IACnD;AACA,QAAI,iBAAiB,UAAU,QAAQ;AACvC,gBAAY,OAAO,aAAa,iBAAiB;AACjD,WAAO,MAAM,IAAI,oBAAoB,UAAU,QAAQ;AAAA,EACzD,GAAG,CAAC,CAAC;AAEL,SAAO,CAAC,CAAC;AACX;;;AClBA,IAAAA,gBAA2B;AAiBpB,SAAS,iBAAuC;AACrD,QAAM,EAAE,MAAM,SAAS,QAAQ,OAAO,QAAI,0BAAW;AAErD,QAAM,YAAY,WAAW;AAC7B,QAAM,kBAAkB,WAAW;AAEnC,QAAM,OAA2B,SAAS,OACtC;AAAA,IACE,IAAI,QAAQ,KAAK;AAAA,IACjB,MAAM,QAAQ,KAAK;AAAA,IACnB,OAAO,QAAQ,KAAK;AAAA,IACpB,OAAO,QAAQ,KAAK;AAAA,IACpB,MAAO,QAAQ,KAA2B;AAAA,EAC5C,IACA;AAEJ,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ,YAAY;AAClB,YAAM,OAAO;AAAA,IACf;AAAA,EACF;AACF;","names":["import_react"]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/hooks/use-media-query.ts
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
function useMediaQuery(query) {
|
|
6
|
+
const [matches, setMatches] = useState(false);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const mediaQuery = window.matchMedia(query);
|
|
9
|
+
setMatches(mediaQuery.matches);
|
|
10
|
+
const handler = (event) => {
|
|
11
|
+
setMatches(event.matches);
|
|
12
|
+
};
|
|
13
|
+
mediaQuery.addEventListener("change", handler);
|
|
14
|
+
return () => {
|
|
15
|
+
mediaQuery.removeEventListener("change", handler);
|
|
16
|
+
};
|
|
17
|
+
}, [query]);
|
|
18
|
+
return matches;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// src/hooks/use-mobile.ts
|
|
22
|
+
import * as React from "react";
|
|
23
|
+
var MOBILE_BREAKPOINT = 768;
|
|
24
|
+
function useIsMobile() {
|
|
25
|
+
const [isMobile, setIsMobile] = React.useState(void 0);
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
28
|
+
const onChange = () => {
|
|
29
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
30
|
+
};
|
|
31
|
+
mql.addEventListener("change", onChange);
|
|
32
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
33
|
+
return () => mql.removeEventListener("change", onChange);
|
|
34
|
+
}, []);
|
|
35
|
+
return !!isMobile;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/hooks/use-current-user.ts
|
|
39
|
+
import { useSession } from "next-auth/react";
|
|
40
|
+
function useCurrentUser() {
|
|
41
|
+
const { data: session, status, update } = useSession();
|
|
42
|
+
const isLoading = status === "loading";
|
|
43
|
+
const isAuthenticated = status === "authenticated";
|
|
44
|
+
const user = session?.user ? {
|
|
45
|
+
id: session.user.id,
|
|
46
|
+
name: session.user.name,
|
|
47
|
+
email: session.user.email,
|
|
48
|
+
image: session.user.image,
|
|
49
|
+
role: session.user.role
|
|
50
|
+
} : null;
|
|
51
|
+
return {
|
|
52
|
+
user,
|
|
53
|
+
isLoading,
|
|
54
|
+
isAuthenticated,
|
|
55
|
+
update: async () => {
|
|
56
|
+
await update();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
useCurrentUser,
|
|
62
|
+
useIsMobile,
|
|
63
|
+
useMediaQuery
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-media-query.ts","../../src/hooks/use-mobile.ts","../../src/hooks/use-current-user.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\nexport function useMediaQuery(query: string): boolean {\n const [matches, setMatches] = useState(false);\n\n useEffect(() => {\n const mediaQuery = window.matchMedia(query);\n\n // Set initial value\n setMatches(mediaQuery.matches);\n\n // Create listener\n const handler = (event: MediaQueryListEvent) => {\n setMatches(event.matches);\n };\n\n // Add listener\n mediaQuery.addEventListener(\"change\", handler);\n\n // Cleanup\n return () => {\n mediaQuery.removeEventListener(\"change\", handler);\n };\n }, [query]);\n\n return matches;\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nconst MOBILE_BREAKPOINT = 768;\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined);\n\n React.useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return !!isMobile;\n}\n","\"use client\";\n\nimport { useSession } from \"next-auth/react\";\n\nexport interface CurrentUser {\n id: string;\n name?: string | null;\n email?: string | null;\n image?: string | null;\n role?: string;\n}\n\nexport interface UseCurrentUserReturn {\n user: CurrentUser | null;\n isLoading: boolean;\n isAuthenticated: boolean;\n update: () => Promise<void>;\n}\n\nexport function useCurrentUser(): UseCurrentUserReturn {\n const { data: session, status, update } = useSession();\n\n const isLoading = status === \"loading\";\n const isAuthenticated = status === \"authenticated\";\n\n const user: CurrentUser | null = session?.user\n ? {\n id: session.user.id!,\n name: session.user.name,\n email: session.user.email,\n image: session.user.image,\n role: (session.user as { role?: string }).role,\n }\n : null;\n\n return {\n user,\n isLoading,\n isAuthenticated,\n update: async () => {\n await update();\n },\n };\n}\n"],"mappings":";;;AAEA,SAAS,WAAW,gBAAgB;AAE7B,SAAS,cAAc,OAAwB;AACpD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAE5C,YAAU,MAAM;AACd,UAAM,aAAa,OAAO,WAAW,KAAK;AAG1C,eAAW,WAAW,OAAO;AAG7B,UAAM,UAAU,CAAC,UAA+B;AAC9C,iBAAW,MAAM,OAAO;AAAA,IAC1B;AAGA,eAAW,iBAAiB,UAAU,OAAO;AAG7C,WAAO,MAAM;AACX,iBAAW,oBAAoB,UAAU,OAAO;AAAA,IAClD;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO;AACT;;;AC1BA,YAAY,WAAW;AAEvB,IAAM,oBAAoB;AAEnB,SAAS,cAAc;AAC5B,QAAM,CAAC,UAAU,WAAW,IAAU,eAA8B,MAAS;AAE7E,EAAM,gBAAU,MAAM;AACpB,UAAM,MAAM,OAAO,WAAW,eAAe,oBAAoB,CAAC,KAAK;AACvE,UAAM,WAAW,MAAM;AACrB,kBAAY,OAAO,aAAa,iBAAiB;AAAA,IACnD;AACA,QAAI,iBAAiB,UAAU,QAAQ;AACvC,gBAAY,OAAO,aAAa,iBAAiB;AACjD,WAAO,MAAM,IAAI,oBAAoB,UAAU,QAAQ;AAAA,EACzD,GAAG,CAAC,CAAC;AAEL,SAAO,CAAC,CAAC;AACX;;;AClBA,SAAS,kBAAkB;AAiBpB,SAAS,iBAAuC;AACrD,QAAM,EAAE,MAAM,SAAS,QAAQ,OAAO,IAAI,WAAW;AAErD,QAAM,YAAY,WAAW;AAC7B,QAAM,kBAAkB,WAAW;AAEnC,QAAM,OAA2B,SAAS,OACtC;AAAA,IACE,IAAI,QAAQ,KAAK;AAAA,IACjB,MAAM,QAAQ,KAAK;AAAA,IACnB,OAAO,QAAQ,KAAK;AAAA,IACpB,OAAO,QAAQ,KAAK;AAAA,IACpB,MAAO,QAAQ,KAA2B;AAAA,EAC5C,IACA;AAEJ,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ,YAAY;AAClB,YAAM,OAAO;AAAA,IACf;AAAA,EACF;AACF;","names":[]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { AuthConfigOptions, AuthProvider, createAuthConfig } from './auth/index.mjs';
|
|
2
|
+
export { PERMISSIONS, Permission, Role, WithRoleOptions, WithRoleResult, configureAuthorization, createPermissionChecker, hasMinRole, hasPermission, hasRole, isAdmin, isModerator, isSuperAdmin, withRole } from './authorization/index.mjs';
|
|
3
|
+
export { SaasKitConfig, createSiteConfig, defineConfig } from './config/index.mjs';
|
|
4
|
+
export { SaasKitProvider, SaasKitProviderProps, SessionProvider, SessionProviderProps, ThemeProvider, ThemeProviderProps } from './providers/index.mjs';
|
|
5
|
+
export { CurrentUser, UseCurrentUserReturn, useCurrentUser, useIsMobile, useMediaQuery } from './hooks/index.mjs';
|
|
6
|
+
import { ClassValue } from 'clsx';
|
|
7
|
+
export { createPrismaClient, prisma } from './prisma/index.mjs';
|
|
8
|
+
export { PrismaClient } from '@prisma/client';
|
|
9
|
+
import 'next-auth';
|
|
10
|
+
import 'next-auth/adapters';
|
|
11
|
+
import 'next/server';
|
|
12
|
+
import './sidebar-ttX_iZ40.mjs';
|
|
13
|
+
import 'react/jsx-runtime';
|
|
14
|
+
import 'lucide-react';
|
|
15
|
+
import 'react';
|
|
16
|
+
import 'next-themes';
|
|
17
|
+
import '@prisma/client/runtime/library';
|
|
18
|
+
|
|
19
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
20
|
+
|
|
21
|
+
export { cn };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { AuthConfigOptions, AuthProvider, createAuthConfig } from './auth/index.js';
|
|
2
|
+
export { PERMISSIONS, Permission, Role, WithRoleOptions, WithRoleResult, configureAuthorization, createPermissionChecker, hasMinRole, hasPermission, hasRole, isAdmin, isModerator, isSuperAdmin, withRole } from './authorization/index.js';
|
|
3
|
+
export { SaasKitConfig, createSiteConfig, defineConfig } from './config/index.js';
|
|
4
|
+
export { SaasKitProvider, SaasKitProviderProps, SessionProvider, SessionProviderProps, ThemeProvider, ThemeProviderProps } from './providers/index.js';
|
|
5
|
+
export { CurrentUser, UseCurrentUserReturn, useCurrentUser, useIsMobile, useMediaQuery } from './hooks/index.js';
|
|
6
|
+
import { ClassValue } from 'clsx';
|
|
7
|
+
export { createPrismaClient, prisma } from './prisma/index.js';
|
|
8
|
+
export { PrismaClient } from '@prisma/client';
|
|
9
|
+
import 'next-auth';
|
|
10
|
+
import 'next-auth/adapters';
|
|
11
|
+
import 'next/server';
|
|
12
|
+
import './sidebar-ttX_iZ40.js';
|
|
13
|
+
import 'react/jsx-runtime';
|
|
14
|
+
import 'lucide-react';
|
|
15
|
+
import 'react';
|
|
16
|
+
import 'next-themes';
|
|
17
|
+
import '@prisma/client/runtime/library';
|
|
18
|
+
|
|
19
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
20
|
+
|
|
21
|
+
export { cn };
|