vintasend 0.5.0 → 0.5.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.
Files changed (71) hide show
  1. package/dist/services/notification-service.d.ts +2 -0
  2. package/dist/services/notification-service.js +6 -0
  3. package/dist/tools/vintasend-dashboard/app/components/auth-status.d.ts +1 -0
  4. package/dist/tools/vintasend-dashboard/app/components/auth-status.js +29 -0
  5. package/dist/tools/vintasend-dashboard/app/error.d.ts +6 -0
  6. package/dist/tools/vintasend-dashboard/app/error.js +40 -0
  7. package/dist/tools/vintasend-dashboard/app/layout.d.ts +6 -0
  8. package/dist/tools/vintasend-dashboard/app/layout.js +38 -0
  9. package/dist/tools/vintasend-dashboard/app/notifications/actions.d.ts +51 -0
  10. package/dist/tools/vintasend-dashboard/app/notifications/actions.js +224 -0
  11. package/dist/tools/vintasend-dashboard/app/notifications/components/columns.d.ts +6 -0
  12. package/dist/tools/vintasend-dashboard/app/notifications/components/columns.js +158 -0
  13. package/dist/tools/vintasend-dashboard/app/notifications/components/notifications-filters.d.ts +18 -0
  14. package/dist/tools/vintasend-dashboard/app/notifications/components/notifications-filters.js +162 -0
  15. package/dist/tools/vintasend-dashboard/app/notifications/components/notifications-table.d.ts +23 -0
  16. package/dist/tools/vintasend-dashboard/app/notifications/components/notifications-table.js +132 -0
  17. package/dist/tools/vintasend-dashboard/app/page.d.ts +1 -0
  18. package/dist/tools/vintasend-dashboard/app/page.js +32 -0
  19. package/dist/tools/vintasend-dashboard/app/sign-in/[[...sign-in]]/page.d.ts +1 -0
  20. package/dist/tools/vintasend-dashboard/app/sign-in/[[...sign-in]]/page.js +18 -0
  21. package/dist/tools/vintasend-dashboard/app/sign-out/[[...sign-out]]/page.d.ts +1 -0
  22. package/dist/tools/vintasend-dashboard/app/sign-out/[[...sign-out]]/page.js +16 -0
  23. package/dist/tools/vintasend-dashboard/components/ui/badge.d.ts +9 -0
  24. package/dist/tools/vintasend-dashboard/components/ui/badge.js +61 -0
  25. package/dist/tools/vintasend-dashboard/components/ui/button.d.ts +10 -0
  26. package/dist/tools/vintasend-dashboard/components/ui/button.js +72 -0
  27. package/dist/tools/vintasend-dashboard/components/ui/calendar.d.ts +8 -0
  28. package/dist/tools/vintasend-dashboard/components/ui/calendar.js +116 -0
  29. package/dist/tools/vintasend-dashboard/components/ui/dropdown-menu.d.ts +25 -0
  30. package/dist/tools/vintasend-dashboard/components/ui/dropdown-menu.js +119 -0
  31. package/dist/tools/vintasend-dashboard/components/ui/input.d.ts +3 -0
  32. package/dist/tools/vintasend-dashboard/components/ui/input.js +41 -0
  33. package/dist/tools/vintasend-dashboard/components/ui/pagination.d.ts +13 -0
  34. package/dist/tools/vintasend-dashboard/components/ui/pagination.js +79 -0
  35. package/dist/tools/vintasend-dashboard/components/ui/popover.d.ts +10 -0
  36. package/dist/tools/vintasend-dashboard/components/ui/popover.js +69 -0
  37. package/dist/tools/vintasend-dashboard/components/ui/select.d.ts +15 -0
  38. package/dist/tools/vintasend-dashboard/components/ui/select.js +106 -0
  39. package/dist/tools/vintasend-dashboard/components/ui/skeleton.d.ts +2 -0
  40. package/dist/tools/vintasend-dashboard/components/ui/skeleton.js +7 -0
  41. package/dist/tools/vintasend-dashboard/components/ui/table.d.ts +10 -0
  42. package/dist/tools/vintasend-dashboard/components/ui/table.js +72 -0
  43. package/dist/tools/vintasend-dashboard/lib/auth/auth-context.d.ts +23 -0
  44. package/dist/tools/vintasend-dashboard/lib/auth/auth-context.js +30 -0
  45. package/dist/tools/vintasend-dashboard/lib/auth/index.d.ts +5 -0
  46. package/dist/tools/vintasend-dashboard/lib/auth/index.js +12 -0
  47. package/dist/tools/vintasend-dashboard/lib/auth/resolve-strategy.d.ts +5 -0
  48. package/dist/tools/vintasend-dashboard/lib/auth/resolve-strategy.js +24 -0
  49. package/dist/tools/vintasend-dashboard/lib/auth/strategies/auth0-strategy.d.ts +17 -0
  50. package/dist/tools/vintasend-dashboard/lib/auth/strategies/auth0-strategy.js +76 -0
  51. package/dist/tools/vintasend-dashboard/lib/auth/strategies/clerk-strategy.d.ts +18 -0
  52. package/dist/tools/vintasend-dashboard/lib/auth/strategies/clerk-strategy.js +70 -0
  53. package/dist/tools/vintasend-dashboard/lib/auth/types.d.ts +50 -0
  54. package/dist/tools/vintasend-dashboard/lib/auth/types.js +2 -0
  55. package/dist/tools/vintasend-dashboard/lib/auth/validate-config.d.ts +2 -0
  56. package/dist/tools/vintasend-dashboard/lib/auth/validate-config.js +10 -0
  57. package/dist/tools/vintasend-dashboard/lib/auth0.d.ts +6 -0
  58. package/dist/tools/vintasend-dashboard/lib/auth0.js +14 -0
  59. package/dist/tools/vintasend-dashboard/lib/notifications/get-vintasend-service.d.ts +26 -0
  60. package/dist/tools/vintasend-dashboard/lib/notifications/get-vintasend-service.js +31 -0
  61. package/dist/tools/vintasend-dashboard/lib/notifications/serialize.d.ts +27 -0
  62. package/dist/tools/vintasend-dashboard/lib/notifications/serialize.js +75 -0
  63. package/dist/tools/vintasend-dashboard/lib/notifications/types.d.ts +62 -0
  64. package/dist/tools/vintasend-dashboard/lib/notifications/types.js +6 -0
  65. package/dist/tools/vintasend-dashboard/lib/utils.d.ts +2 -0
  66. package/dist/tools/vintasend-dashboard/lib/utils.js +8 -0
  67. package/dist/tools/vintasend-dashboard/next.config.d.ts +3 -0
  68. package/dist/tools/vintasend-dashboard/next.config.js +6 -0
  69. package/dist/tools/vintasend-dashboard/proxy.d.ts +5 -0
  70. package/dist/tools/vintasend-dashboard/proxy.js +83 -0
  71. package/package.json +1 -1
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ declare function Table({ className, ...props }: React.ComponentProps<"table">): React.JSX.Element;
3
+ declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
4
+ declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
5
+ declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
6
+ declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): React.JSX.Element;
7
+ declare function TableHead({ className, ...props }: React.ComponentProps<"th">): React.JSX.Element;
8
+ declare function TableCell({ className, ...props }: React.ComponentProps<"td">): React.JSX.Element;
9
+ declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
10
+ export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ "use client";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.Table = Table;
38
+ exports.TableHeader = TableHeader;
39
+ exports.TableBody = TableBody;
40
+ exports.TableFooter = TableFooter;
41
+ exports.TableHead = TableHead;
42
+ exports.TableRow = TableRow;
43
+ exports.TableCell = TableCell;
44
+ exports.TableCaption = TableCaption;
45
+ const React = __importStar(require("react"));
46
+ const utils_1 = require("@/lib/utils");
47
+ function Table({ className, ...props }) {
48
+ return (<div data-slot="table-container" className="relative w-full overflow-x-auto">
49
+ <table data-slot="table" className={(0, utils_1.cn)("w-full caption-bottom text-sm", className)} {...props}/>
50
+ </div>);
51
+ }
52
+ function TableHeader({ className, ...props }) {
53
+ return (<thead data-slot="table-header" className={(0, utils_1.cn)("[&_tr]:border-b", className)} {...props}/>);
54
+ }
55
+ function TableBody({ className, ...props }) {
56
+ return (<tbody data-slot="table-body" className={(0, utils_1.cn)("[&_tr:last-child]:border-0", className)} {...props}/>);
57
+ }
58
+ function TableFooter({ className, ...props }) {
59
+ return (<tfoot data-slot="table-footer" className={(0, utils_1.cn)("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", className)} {...props}/>);
60
+ }
61
+ function TableRow({ className, ...props }) {
62
+ return (<tr data-slot="table-row" className={(0, utils_1.cn)("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors", className)} {...props}/>);
63
+ }
64
+ function TableHead({ className, ...props }) {
65
+ return (<th data-slot="table-head" className={(0, utils_1.cn)("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className)} {...props}/>);
66
+ }
67
+ function TableCell({ className, ...props }) {
68
+ return (<td data-slot="table-cell" className={(0, utils_1.cn)("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className)} {...props}/>);
69
+ }
70
+ function TableCaption({ className, ...props }) {
71
+ return (<caption data-slot="table-caption" className={(0, utils_1.cn)("text-muted-foreground mt-4 text-sm", className)} {...props}/>);
72
+ }
@@ -0,0 +1,23 @@
1
+ import { type ReactNode } from "react";
2
+ import type { AuthUser } from "./types";
3
+ interface AuthContextType {
4
+ user: AuthUser | null;
5
+ isAuthenticated: boolean;
6
+ signInUrl: string;
7
+ signOutUrl: string;
8
+ }
9
+ interface AuthProviderProps {
10
+ children: ReactNode;
11
+ signInUrl: string;
12
+ signOutUrl: string;
13
+ initialUser: AuthUser | null;
14
+ }
15
+ /**
16
+ * Client-side provider for resolved auth state and URLs.
17
+ */
18
+ export declare function AuthProvider({ children, signInUrl, signOutUrl, initialUser, }: AuthProviderProps): import("react").JSX.Element;
19
+ /**
20
+ * Accesses the resolved auth context in client components.
21
+ */
22
+ export declare function useAuth(): AuthContextType;
23
+ export {};
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AuthProvider = AuthProvider;
5
+ exports.useAuth = useAuth;
6
+ const react_1 = require("react");
7
+ const AuthContext = (0, react_1.createContext)(undefined);
8
+ /**
9
+ * Client-side provider for resolved auth state and URLs.
10
+ */
11
+ function AuthProvider({ children, signInUrl, signOutUrl, initialUser, }) {
12
+ const [user] = (0, react_1.useState)(initialUser);
13
+ const value = {
14
+ user,
15
+ isAuthenticated: !!user,
16
+ signInUrl,
17
+ signOutUrl,
18
+ };
19
+ return (<AuthContext.Provider value={value}>{children}</AuthContext.Provider>);
20
+ }
21
+ /**
22
+ * Accesses the resolved auth context in client components.
23
+ */
24
+ function useAuth() {
25
+ const context = (0, react_1.useContext)(AuthContext);
26
+ if (context === undefined) {
27
+ throw new Error("useAuth must be used within an AuthProvider");
28
+ }
29
+ return context;
30
+ }
@@ -0,0 +1,5 @@
1
+ export { resolveAuthStrategy } from "./resolve-strategy";
2
+ export type { AuthStrategy, AuthUser } from "./types";
3
+ export { ClerkStrategy } from "./strategies/clerk-strategy";
4
+ export { Auth0Strategy } from "./strategies/auth0-strategy";
5
+ export { AuthProvider, useAuth } from "./auth-context";
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAuth = exports.AuthProvider = exports.Auth0Strategy = exports.ClerkStrategy = exports.resolveAuthStrategy = void 0;
4
+ var resolve_strategy_1 = require("./resolve-strategy");
5
+ Object.defineProperty(exports, "resolveAuthStrategy", { enumerable: true, get: function () { return resolve_strategy_1.resolveAuthStrategy; } });
6
+ var clerk_strategy_1 = require("./strategies/clerk-strategy");
7
+ Object.defineProperty(exports, "ClerkStrategy", { enumerable: true, get: function () { return clerk_strategy_1.ClerkStrategy; } });
8
+ var auth0_strategy_1 = require("./strategies/auth0-strategy");
9
+ Object.defineProperty(exports, "Auth0Strategy", { enumerable: true, get: function () { return auth0_strategy_1.Auth0Strategy; } });
10
+ var auth_context_1 = require("./auth-context");
11
+ Object.defineProperty(exports, "AuthProvider", { enumerable: true, get: function () { return auth_context_1.AuthProvider; } });
12
+ Object.defineProperty(exports, "useAuth", { enumerable: true, get: function () { return auth_context_1.useAuth; } });
@@ -0,0 +1,5 @@
1
+ import type { AuthStrategy, AuthProvider } from "./types";
2
+ /**
3
+ * Resolves the auth strategy based on an explicit provider or env config.
4
+ */
5
+ export declare const resolveAuthStrategy: (provider?: AuthProvider | string) => AuthStrategy;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveAuthStrategy = void 0;
4
+ const auth0_strategy_1 = require("./strategies/auth0-strategy");
5
+ const clerk_strategy_1 = require("./strategies/clerk-strategy");
6
+ const AUTH_PROVIDER_ERROR = "AUTH_PROVIDER env var is required";
7
+ /**
8
+ * Resolves the auth strategy based on an explicit provider or env config.
9
+ */
10
+ const resolveAuthStrategy = (provider) => {
11
+ const resolvedProvider = provider !== null && provider !== void 0 ? provider : process.env.AUTH_PROVIDER;
12
+ if (!resolvedProvider) {
13
+ throw new Error(AUTH_PROVIDER_ERROR);
14
+ }
15
+ switch (resolvedProvider) {
16
+ case "clerk":
17
+ return new clerk_strategy_1.ClerkStrategy();
18
+ case "auth0":
19
+ return new auth0_strategy_1.Auth0Strategy();
20
+ default:
21
+ throw new Error(`Unsupported auth provider: ${resolvedProvider}`);
22
+ }
23
+ };
24
+ exports.resolveAuthStrategy = resolveAuthStrategy;
@@ -0,0 +1,17 @@
1
+ import type { NextRequest, NextResponse } from "next/server";
2
+ import type { ComponentType, ReactNode } from "react";
3
+ import type { AuthStrategy, AuthUser } from "../types";
4
+ /**
5
+ * AuthStrategy implementation backed by Auth0 v4.
6
+ */
7
+ export declare class Auth0Strategy implements AuthStrategy {
8
+ validateConfig(): string[];
9
+ getProviderComponent(): ComponentType<{
10
+ children: ReactNode;
11
+ }>;
12
+ getCurrentUser(_request?: NextRequest): Promise<AuthUser | null>;
13
+ isAuthenticated(_request?: NextRequest): Promise<boolean>;
14
+ getSignInUrl(): string;
15
+ getSignOutUrl(): string;
16
+ protectRoute(request: NextRequest): Promise<NextResponse | null>;
17
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Auth0Strategy = void 0;
4
+ const client_1 = require("@auth0/nextjs-auth0/client");
5
+ const server_1 = require("next/server");
6
+ const auth0_1 = require("../../auth0");
7
+ /**
8
+ * AuthStrategy implementation backed by Auth0 v4.
9
+ */
10
+ class Auth0Strategy {
11
+ validateConfig() {
12
+ const required = [
13
+ "AUTH0_SECRET",
14
+ "APP_BASE_URL",
15
+ "AUTH0_DOMAIN",
16
+ "AUTH0_CLIENT_ID",
17
+ "AUTH0_CLIENT_SECRET",
18
+ ];
19
+ return required.filter((key) => !process.env[key]);
20
+ }
21
+ getProviderComponent() {
22
+ return client_1.Auth0Provider;
23
+ }
24
+ async getCurrentUser(_request) {
25
+ try {
26
+ const session = await auth0_1.auth0.getSession();
27
+ if (!(session === null || session === void 0 ? void 0 : session.user)) {
28
+ return null;
29
+ }
30
+ const user = session.user;
31
+ return {
32
+ id: user.sub || "",
33
+ email: user.email || null,
34
+ name: user.name || null,
35
+ imageUrl: user.picture || null,
36
+ };
37
+ }
38
+ catch (_a) {
39
+ return null;
40
+ }
41
+ }
42
+ async isAuthenticated(_request) {
43
+ try {
44
+ const session = await auth0_1.auth0.getSession();
45
+ return !!(session === null || session === void 0 ? void 0 : session.user);
46
+ }
47
+ catch (_a) {
48
+ return false;
49
+ }
50
+ }
51
+ getSignInUrl() {
52
+ return "/auth/login";
53
+ }
54
+ getSignOutUrl() {
55
+ return "/auth/logout";
56
+ }
57
+ async protectRoute(request) {
58
+ try {
59
+ const session = await auth0_1.auth0.getSession(request);
60
+ if (!(session === null || session === void 0 ? void 0 : session.user)) {
61
+ // Redirect to login
62
+ const signInUrl = new URL(this.getSignInUrl(), request.url);
63
+ signInUrl.searchParams.set("returnTo", request.nextUrl.pathname);
64
+ return server_1.NextResponse.redirect(signInUrl);
65
+ }
66
+ return null;
67
+ }
68
+ catch (_a) {
69
+ // On error, redirect to login
70
+ const signInUrl = new URL(this.getSignInUrl(), request.url);
71
+ signInUrl.searchParams.set("returnTo", request.nextUrl.pathname);
72
+ return server_1.NextResponse.redirect(signInUrl);
73
+ }
74
+ }
75
+ }
76
+ exports.Auth0Strategy = Auth0Strategy;
@@ -0,0 +1,18 @@
1
+ import type { ComponentType, ReactNode } from "react";
2
+ import type { NextRequest } from "next/server";
3
+ import { NextResponse } from "next/server";
4
+ import type { AuthStrategy, AuthUser } from "../types";
5
+ /**
6
+ * AuthStrategy implementation backed by Clerk.
7
+ */
8
+ export declare class ClerkStrategy implements AuthStrategy {
9
+ validateConfig(): string[];
10
+ getProviderComponent(): ComponentType<{
11
+ children: ReactNode;
12
+ }>;
13
+ getCurrentUser(_request?: NextRequest): Promise<AuthUser | null>;
14
+ isAuthenticated(_request?: NextRequest): Promise<boolean>;
15
+ getSignInUrl(): string;
16
+ getSignOutUrl(): string;
17
+ protectRoute(_request: NextRequest): Promise<NextResponse | null>;
18
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClerkStrategy = void 0;
4
+ const server_1 = require("next/server");
5
+ const nextjs_1 = require("@clerk/nextjs");
6
+ const server_2 = require("@clerk/nextjs/server");
7
+ const mapClerkUserToAuthUser = (user) => {
8
+ var _a, _b, _c, _d, _e, _f, _g;
9
+ const primaryEmail = (_e = (_b = (_a = user.primaryEmailAddress) === null || _a === void 0 ? void 0 : _a.emailAddress) !== null && _b !== void 0 ? _b : (_d = (_c = user.emailAddresses) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.emailAddress) !== null && _e !== void 0 ? _e : null;
10
+ const constructedName = [user.firstName, user.lastName]
11
+ .filter(Boolean)
12
+ .join(" ");
13
+ const fullName = (_f = user.fullName) !== null && _f !== void 0 ? _f : (constructedName ? constructedName : null);
14
+ return {
15
+ id: user.id,
16
+ email: primaryEmail,
17
+ name: fullName,
18
+ imageUrl: (_g = user.imageUrl) !== null && _g !== void 0 ? _g : null,
19
+ };
20
+ };
21
+ /**
22
+ * AuthStrategy implementation backed by Clerk.
23
+ */
24
+ class ClerkStrategy {
25
+ validateConfig() {
26
+ const required = [
27
+ "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY",
28
+ "CLERK_SECRET_KEY",
29
+ ];
30
+ return required.filter((key) => !process.env[key]);
31
+ }
32
+ getProviderComponent() {
33
+ return nextjs_1.ClerkProvider;
34
+ }
35
+ async getCurrentUser(_request) {
36
+ if (_request) {
37
+ const { userId } = (0, server_2.getAuth)(_request);
38
+ if (!userId) {
39
+ return null;
40
+ }
41
+ const user = await (await (0, server_2.clerkClient)()).users.getUser(userId);
42
+ return mapClerkUserToAuthUser(user);
43
+ }
44
+ const user = await (0, server_2.currentUser)();
45
+ return user ? mapClerkUserToAuthUser(user) : null;
46
+ }
47
+ async isAuthenticated(_request) {
48
+ if (_request) {
49
+ const { userId } = (0, server_2.getAuth)(_request);
50
+ return Boolean(userId);
51
+ }
52
+ const { userId } = await (0, server_2.auth)();
53
+ return Boolean(userId);
54
+ }
55
+ getSignInUrl() {
56
+ return "/sign-in";
57
+ }
58
+ getSignOutUrl() {
59
+ return "/sign-out";
60
+ }
61
+ async protectRoute(_request) {
62
+ const { userId } = (0, server_2.getAuth)(_request);
63
+ if (userId) {
64
+ return null;
65
+ }
66
+ const signInUrl = new URL(this.getSignInUrl(), _request.url);
67
+ return server_1.NextResponse.redirect(signInUrl);
68
+ }
69
+ }
70
+ exports.ClerkStrategy = ClerkStrategy;
@@ -0,0 +1,50 @@
1
+ import type { ComponentType, ReactNode } from "react";
2
+ import type { NextRequest, NextResponse } from "next/server";
3
+ /**
4
+ * Supported auth providers for the dashboard.
5
+ */
6
+ export type AuthProvider = "clerk" | "auth0";
7
+ /**
8
+ * Normalized user data shared across strategies.
9
+ */
10
+ export type AuthUser = {
11
+ id: string;
12
+ email: string | null;
13
+ name: string | null;
14
+ imageUrl: string | null;
15
+ };
16
+ /**
17
+ * Strategy contract for pluggable auth providers.
18
+ */
19
+ export interface AuthStrategy {
20
+ /**
21
+ * Returns the provider component that wraps the app shell.
22
+ */
23
+ getProviderComponent(): ComponentType<{
24
+ children: ReactNode;
25
+ }>;
26
+ /**
27
+ * Fetches the current user in the active request context.
28
+ */
29
+ getCurrentUser(request?: NextRequest): Promise<AuthUser | null>;
30
+ /**
31
+ * Checks whether a session is present for the given request.
32
+ */
33
+ isAuthenticated(request?: NextRequest): Promise<boolean>;
34
+ /**
35
+ * Returns the URL used to initiate sign-in.
36
+ */
37
+ getSignInUrl(): string;
38
+ /**
39
+ * Returns the URL used to initiate sign-out.
40
+ */
41
+ getSignOutUrl(): string;
42
+ /**
43
+ * Handles middleware route protection and redirects when needed.
44
+ */
45
+ protectRoute(request: NextRequest): Promise<NextResponse | null>;
46
+ /**
47
+ * Validates required environment configuration and returns missing keys.
48
+ */
49
+ validateConfig(): string[];
50
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import type { AuthStrategy } from "./types";
2
+ export declare const assertValidAuthConfig: (strategy: AuthStrategy) => void;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertValidAuthConfig = void 0;
4
+ const assertValidAuthConfig = (strategy) => {
5
+ const missing = strategy.validateConfig();
6
+ if (missing.length > 0) {
7
+ throw new Error(`Missing required auth configuration: ${missing.join(", ")}`);
8
+ }
9
+ };
10
+ exports.assertValidAuthConfig = assertValidAuthConfig;
@@ -0,0 +1,6 @@
1
+ import { Auth0Client } from "@auth0/nextjs-auth0/server";
2
+ /**
3
+ * Auth0 client instance for v4.
4
+ * This client is used to handle authentication in the middleware and server components.
5
+ */
6
+ export declare const auth0: Auth0Client;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.auth0 = void 0;
4
+ const server_1 = require("@auth0/nextjs-auth0/server");
5
+ /**
6
+ * Auth0 client instance for v4.
7
+ * This client is used to handle authentication in the middleware and server components.
8
+ */
9
+ exports.auth0 = new server_1.Auth0Client({
10
+ authorizationParameters: {
11
+ scope: "openid profile email",
12
+ redirect_uri: `${process.env.APP_BASE_URL}/auth/callback`,
13
+ },
14
+ });
@@ -0,0 +1,26 @@
1
+ import type { VintaSendFactory } from 'vintasend';
2
+ declare const ContextMap: {};
3
+ export type VintaSendConfig = {
4
+ ContextMap: typeof ContextMap;
5
+ NotificationIdType: string;
6
+ UserIdType: string;
7
+ };
8
+ /**
9
+ * Factory helper to instantiate the VintaSend service for server actions.
10
+ * Currently returns mock data for Phase 2. Will be replaced with real backend in Phase 5.
11
+ */
12
+ /**
13
+ * Gets a configured VintaSend instance.
14
+ * In Phase 5, this will read env config and instantiate with the real backend.
15
+ * For Phase 2, it returns a mock service placeholder.
16
+ *
17
+ * @throws If the backend is not properly configured.
18
+ */
19
+ export declare function getVintaSendService(): Promise<ReturnType<VintaSendFactory<VintaSendConfig>['create']>>;
20
+ /**
21
+ * Validates that the required environment variables are set for the backend.
22
+ * Used at startup to catch configuration issues early.
23
+ * Will be implemented in Phase 5.
24
+ */
25
+ export declare function validateBackendConfig(): Promise<string[]>;
26
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getVintaSendService = getVintaSendService;
4
+ exports.validateBackendConfig = validateBackendConfig;
5
+ const ContextMap = {};
6
+ /**
7
+ * Factory helper to instantiate the VintaSend service for server actions.
8
+ * Currently returns mock data for Phase 2. Will be replaced with real backend in Phase 5.
9
+ */
10
+ /**
11
+ * Gets a configured VintaSend instance.
12
+ * In Phase 5, this will read env config and instantiate with the real backend.
13
+ * For Phase 2, it returns a mock service placeholder.
14
+ *
15
+ * @throws If the backend is not properly configured.
16
+ */
17
+ async function getVintaSendService() {
18
+ // Phase 2: Return a placeholder
19
+ // This will be implemented in Phase 5 with real backend configuration
20
+ throw new Error('getVintaSendService() not yet implemented. Phase 5 will integrate real backend.');
21
+ }
22
+ /**
23
+ * Validates that the required environment variables are set for the backend.
24
+ * Used at startup to catch configuration issues early.
25
+ * Will be implemented in Phase 5.
26
+ */
27
+ async function validateBackendConfig() {
28
+ // Phase 2: No validation yet
29
+ // Will be expanded in Phase 5
30
+ return [];
31
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Serialization logic to convert database notifications into dashboard DTOs.
3
+ * Converts dates to ISO strings and strips large payloads for list views.
4
+ */
5
+ import type { DatabaseNotification, DatabaseOneOffNotification, BaseNotificationTypeConfig } from 'vintasend';
6
+ import type { DashboardNotification, DashboardNotificationDetail, DashboardOneOffNotification, DashboardOneOffNotificationDetail } from './types';
7
+ /**
8
+ * Converts a database notification to a dashboard notification DTO.
9
+ * Strips contextUsed and contextParameters to keep payload small.
10
+ * Converts Date fields to ISO strings for serialization.
11
+ */
12
+ export declare function serializeNotification<Config extends BaseNotificationTypeConfig>(notification: DatabaseNotification<Config>): DashboardNotification<Config>;
13
+ /**
14
+ * Converts a database notification to a dashboard notification detail DTO.
15
+ * Includes contextUsed and extraParams for the detail view.
16
+ */
17
+ export declare function serializeNotificationWithDetail(notification: DatabaseNotification): DashboardNotificationDetail;
18
+ /**
19
+ * Converts a database one-off notification to a dashboard one-off notification DTO.
20
+ * Strips contextUsed and contextParameters to keep payload small.
21
+ */
22
+ export declare function serializeOneOffNotification<Config extends BaseNotificationTypeConfig>(notification: DatabaseOneOffNotification<Config>): DashboardOneOffNotification<Config>;
23
+ /**
24
+ * Converts a database one-off notification to a dashboard one-off notification detail DTO.
25
+ * Includes contextUsed and extraParams for the detail view.
26
+ */
27
+ export declare function serializeOneOffNotificationWithDetail(notification: DatabaseOneOffNotification): DashboardOneOffNotificationDetail;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ /**
3
+ * Serialization logic to convert database notifications into dashboard DTOs.
4
+ * Converts dates to ISO strings and strips large payloads for list views.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.serializeNotification = serializeNotification;
8
+ exports.serializeNotificationWithDetail = serializeNotificationWithDetail;
9
+ exports.serializeOneOffNotification = serializeOneOffNotification;
10
+ exports.serializeOneOffNotificationWithDetail = serializeOneOffNotificationWithDetail;
11
+ /**
12
+ * Converts a database notification to a dashboard notification DTO.
13
+ * Strips contextUsed and contextParameters to keep payload small.
14
+ * Converts Date fields to ISO strings for serialization.
15
+ */
16
+ function serializeNotification(notification) {
17
+ return {
18
+ id: notification.id,
19
+ userId: notification.userId,
20
+ notificationType: notification.notificationType,
21
+ title: notification.title,
22
+ contextName: notification.contextName,
23
+ status: notification.status,
24
+ sendAfter: notification.sendAfter ? notification.sendAfter.toISOString() : null,
25
+ sentAt: notification.sentAt ? notification.sentAt.toISOString() : null,
26
+ readAt: notification.readAt ? notification.readAt.toISOString() : null,
27
+ createdAt: notification.createdAt ? notification.createdAt.toISOString() : undefined,
28
+ adapterUsed: notification.adapterUsed,
29
+ bodyTemplate: notification.bodyTemplate,
30
+ };
31
+ }
32
+ /**
33
+ * Converts a database notification to a dashboard notification detail DTO.
34
+ * Includes contextUsed and extraParams for the detail view.
35
+ */
36
+ function serializeNotificationWithDetail(notification) {
37
+ return {
38
+ ...serializeNotification(notification),
39
+ contextUsed: notification.contextUsed,
40
+ extraParams: notification.extraParams,
41
+ };
42
+ }
43
+ /**
44
+ * Converts a database one-off notification to a dashboard one-off notification DTO.
45
+ * Strips contextUsed and contextParameters to keep payload small.
46
+ */
47
+ function serializeOneOffNotification(notification) {
48
+ return {
49
+ id: String(notification.id),
50
+ emailOrPhone: notification.emailOrPhone,
51
+ firstName: notification.firstName,
52
+ lastName: notification.lastName,
53
+ notificationType: notification.notificationType,
54
+ title: notification.title,
55
+ contextName: notification.contextName,
56
+ status: notification.status,
57
+ sendAfter: notification.sendAfter ? notification.sendAfter.toISOString() : null,
58
+ sentAt: notification.sentAt ? notification.sentAt.toISOString() : null,
59
+ readAt: notification.readAt ? notification.readAt.toISOString() : null,
60
+ createdAt: notification.createdAt ? notification.createdAt.toISOString() : undefined,
61
+ adapterUsed: notification.adapterUsed,
62
+ bodyTemplate: notification.bodyTemplate,
63
+ };
64
+ }
65
+ /**
66
+ * Converts a database one-off notification to a dashboard one-off notification detail DTO.
67
+ * Includes contextUsed and extraParams for the detail view.
68
+ */
69
+ function serializeOneOffNotificationWithDetail(notification) {
70
+ return {
71
+ ...serializeOneOffNotification(notification),
72
+ contextUsed: notification.contextUsed,
73
+ extraParams: notification.extraParams,
74
+ };
75
+ }