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.
- package/dist/services/notification-service.d.ts +2 -0
- package/dist/services/notification-service.js +6 -0
- package/dist/tools/vintasend-dashboard/app/components/auth-status.d.ts +1 -0
- package/dist/tools/vintasend-dashboard/app/components/auth-status.js +29 -0
- package/dist/tools/vintasend-dashboard/app/error.d.ts +6 -0
- package/dist/tools/vintasend-dashboard/app/error.js +40 -0
- package/dist/tools/vintasend-dashboard/app/layout.d.ts +6 -0
- package/dist/tools/vintasend-dashboard/app/layout.js +38 -0
- package/dist/tools/vintasend-dashboard/app/notifications/actions.d.ts +51 -0
- package/dist/tools/vintasend-dashboard/app/notifications/actions.js +224 -0
- package/dist/tools/vintasend-dashboard/app/notifications/components/columns.d.ts +6 -0
- package/dist/tools/vintasend-dashboard/app/notifications/components/columns.js +158 -0
- package/dist/tools/vintasend-dashboard/app/notifications/components/notifications-filters.d.ts +18 -0
- package/dist/tools/vintasend-dashboard/app/notifications/components/notifications-filters.js +162 -0
- package/dist/tools/vintasend-dashboard/app/notifications/components/notifications-table.d.ts +23 -0
- package/dist/tools/vintasend-dashboard/app/notifications/components/notifications-table.js +132 -0
- package/dist/tools/vintasend-dashboard/app/page.d.ts +1 -0
- package/dist/tools/vintasend-dashboard/app/page.js +32 -0
- package/dist/tools/vintasend-dashboard/app/sign-in/[[...sign-in]]/page.d.ts +1 -0
- package/dist/tools/vintasend-dashboard/app/sign-in/[[...sign-in]]/page.js +18 -0
- package/dist/tools/vintasend-dashboard/app/sign-out/[[...sign-out]]/page.d.ts +1 -0
- package/dist/tools/vintasend-dashboard/app/sign-out/[[...sign-out]]/page.js +16 -0
- package/dist/tools/vintasend-dashboard/components/ui/badge.d.ts +9 -0
- package/dist/tools/vintasend-dashboard/components/ui/badge.js +61 -0
- package/dist/tools/vintasend-dashboard/components/ui/button.d.ts +10 -0
- package/dist/tools/vintasend-dashboard/components/ui/button.js +72 -0
- package/dist/tools/vintasend-dashboard/components/ui/calendar.d.ts +8 -0
- package/dist/tools/vintasend-dashboard/components/ui/calendar.js +116 -0
- package/dist/tools/vintasend-dashboard/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/tools/vintasend-dashboard/components/ui/dropdown-menu.js +119 -0
- package/dist/tools/vintasend-dashboard/components/ui/input.d.ts +3 -0
- package/dist/tools/vintasend-dashboard/components/ui/input.js +41 -0
- package/dist/tools/vintasend-dashboard/components/ui/pagination.d.ts +13 -0
- package/dist/tools/vintasend-dashboard/components/ui/pagination.js +79 -0
- package/dist/tools/vintasend-dashboard/components/ui/popover.d.ts +10 -0
- package/dist/tools/vintasend-dashboard/components/ui/popover.js +69 -0
- package/dist/tools/vintasend-dashboard/components/ui/select.d.ts +15 -0
- package/dist/tools/vintasend-dashboard/components/ui/select.js +106 -0
- package/dist/tools/vintasend-dashboard/components/ui/skeleton.d.ts +2 -0
- package/dist/tools/vintasend-dashboard/components/ui/skeleton.js +7 -0
- package/dist/tools/vintasend-dashboard/components/ui/table.d.ts +10 -0
- package/dist/tools/vintasend-dashboard/components/ui/table.js +72 -0
- package/dist/tools/vintasend-dashboard/lib/auth/auth-context.d.ts +23 -0
- package/dist/tools/vintasend-dashboard/lib/auth/auth-context.js +30 -0
- package/dist/tools/vintasend-dashboard/lib/auth/index.d.ts +5 -0
- package/dist/tools/vintasend-dashboard/lib/auth/index.js +12 -0
- package/dist/tools/vintasend-dashboard/lib/auth/resolve-strategy.d.ts +5 -0
- package/dist/tools/vintasend-dashboard/lib/auth/resolve-strategy.js +24 -0
- package/dist/tools/vintasend-dashboard/lib/auth/strategies/auth0-strategy.d.ts +17 -0
- package/dist/tools/vintasend-dashboard/lib/auth/strategies/auth0-strategy.js +76 -0
- package/dist/tools/vintasend-dashboard/lib/auth/strategies/clerk-strategy.d.ts +18 -0
- package/dist/tools/vintasend-dashboard/lib/auth/strategies/clerk-strategy.js +70 -0
- package/dist/tools/vintasend-dashboard/lib/auth/types.d.ts +50 -0
- package/dist/tools/vintasend-dashboard/lib/auth/types.js +2 -0
- package/dist/tools/vintasend-dashboard/lib/auth/validate-config.d.ts +2 -0
- package/dist/tools/vintasend-dashboard/lib/auth/validate-config.js +10 -0
- package/dist/tools/vintasend-dashboard/lib/auth0.d.ts +6 -0
- package/dist/tools/vintasend-dashboard/lib/auth0.js +14 -0
- package/dist/tools/vintasend-dashboard/lib/notifications/get-vintasend-service.d.ts +26 -0
- package/dist/tools/vintasend-dashboard/lib/notifications/get-vintasend-service.js +31 -0
- package/dist/tools/vintasend-dashboard/lib/notifications/serialize.d.ts +27 -0
- package/dist/tools/vintasend-dashboard/lib/notifications/serialize.js +75 -0
- package/dist/tools/vintasend-dashboard/lib/notifications/types.d.ts +62 -0
- package/dist/tools/vintasend-dashboard/lib/notifications/types.js +6 -0
- package/dist/tools/vintasend-dashboard/lib/utils.d.ts +2 -0
- package/dist/tools/vintasend-dashboard/lib/utils.js +8 -0
- package/dist/tools/vintasend-dashboard/next.config.d.ts +3 -0
- package/dist/tools/vintasend-dashboard/next.config.js +6 -0
- package/dist/tools/vintasend-dashboard/proxy.d.ts +5 -0
- package/dist/tools/vintasend-dashboard/proxy.js +83 -0
- package/package.json +1 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard-specific types derived from VintaSend types using type algebra.
|
|
3
|
+
* Converts database representations (with Date fields) to serializable DTOs (with ISO strings).
|
|
4
|
+
*/
|
|
5
|
+
import type { DatabaseNotification, DatabaseOneOffNotification } from 'vintasend';
|
|
6
|
+
import type { NotificationStatus } from 'vintasend/dist/types/notification-status';
|
|
7
|
+
import type { NotificationType } from 'vintasend/dist/types/notification-type';
|
|
8
|
+
import { VintaSendConfig } from './get-vintasend-service';
|
|
9
|
+
export type { JsonValue, } from 'vintasend/dist/types/json-values';
|
|
10
|
+
export type { AnyDatabaseNotification, } from 'vintasend';
|
|
11
|
+
/**
|
|
12
|
+
* Helper type: converts Date fields to ISO string representations.
|
|
13
|
+
* Normalizes null and undefined date fields to `string | null`.
|
|
14
|
+
*/
|
|
15
|
+
type SerializeDates<T> = {
|
|
16
|
+
[K in keyof T]: T[K] extends Date | null | undefined ? T[K] extends Date ? string : string | null : T[K];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Dashboard DTO for regular notifications - derived from DatabaseNotification with serialized dates.
|
|
20
|
+
* Strips large context fields (contextUsed, contextParameters, extraParams) to keep payload small for list views.
|
|
21
|
+
*/
|
|
22
|
+
export type DashboardNotification = SerializeDates<Pick<DatabaseNotification<VintaSendConfig>, 'id' | 'userId' | 'notificationType' | 'title' | 'contextName' | 'status' | 'sendAfter' | 'sentAt' | 'readAt' | 'createdAt' | 'adapterUsed' | 'bodyTemplate' | 'subjectTemplate'>>;
|
|
23
|
+
/**
|
|
24
|
+
* Dashboard DTO for one-off notifications - derived from DatabaseOneOffNotification with serialized dates.
|
|
25
|
+
* Strips large context fields (contextUsed, contextParameters, extraParams) to keep payload small for list views.
|
|
26
|
+
*/
|
|
27
|
+
export type DashboardOneOffNotification = SerializeDates<Pick<DatabaseOneOffNotification<VintaSendConfig>, 'id' | 'emailOrPhone' | 'firstName' | 'lastName' | 'notificationType' | 'title' | 'contextName' | 'status' | 'sendAfter' | 'sentAt' | 'readAt' | 'createdAt' | 'adapterUsed' | 'bodyTemplate' | 'subjectTemplate'>>;
|
|
28
|
+
/**
|
|
29
|
+
* Detail view DTO for regular notifications.
|
|
30
|
+
* Extends DashboardNotification with full database fields including sensitive context data.
|
|
31
|
+
*/
|
|
32
|
+
export type DashboardNotificationDetail = SerializeDates<DatabaseNotification<VintaSendConfig>>;
|
|
33
|
+
/**
|
|
34
|
+
* Detail view DTO for one-off notifications.
|
|
35
|
+
* Extends DashboardOneOffNotification with full database fields including sensitive context data.
|
|
36
|
+
*/
|
|
37
|
+
export type DashboardOneOffNotificationDetail = SerializeDates<DatabaseOneOffNotification<VintaSendConfig>>;
|
|
38
|
+
/**
|
|
39
|
+
* Union type for dashboard notifications (regular or one-off) - list view.
|
|
40
|
+
*/
|
|
41
|
+
export type AnyDashboardNotification = DashboardNotification | DashboardOneOffNotification;
|
|
42
|
+
/**
|
|
43
|
+
* Union type for dashboard notification details (regular or one-off) - detail view.
|
|
44
|
+
*/
|
|
45
|
+
export type AnyDashboardNotificationDetail = DashboardNotificationDetail | DashboardOneOffNotificationDetail;
|
|
46
|
+
/**
|
|
47
|
+
* Filters for querying notifications.
|
|
48
|
+
*/
|
|
49
|
+
export type NotificationFilters = {
|
|
50
|
+
status?: NotificationStatus;
|
|
51
|
+
notificationType?: NotificationType;
|
|
52
|
+
search?: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Paginated result wrapper for dashboard queries.
|
|
56
|
+
*/
|
|
57
|
+
export type PaginatedResult<T> = {
|
|
58
|
+
data: T[];
|
|
59
|
+
page: number;
|
|
60
|
+
pageSize: number;
|
|
61
|
+
total: number;
|
|
62
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cn = cn;
|
|
4
|
+
const clsx_1 = require("clsx");
|
|
5
|
+
const tailwind_merge_1 = require("tailwind-merge");
|
|
6
|
+
function cn(...inputs) {
|
|
7
|
+
return (0, tailwind_merge_1.twMerge)((0, clsx_1.clsx)(inputs));
|
|
8
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.config = void 0;
|
|
4
|
+
exports.proxy = proxy;
|
|
5
|
+
const server_1 = require("next/server");
|
|
6
|
+
const server_2 = require("@clerk/nextjs/server");
|
|
7
|
+
const auth0_1 = require("./lib/auth0");
|
|
8
|
+
const auth_1 = require("./lib/auth");
|
|
9
|
+
const validate_config_1 = require("./lib/auth/validate-config");
|
|
10
|
+
const PUBLIC_ROUTES = ["/sign-in", "/sign-out", "/auth"];
|
|
11
|
+
async function proxy(request, event) {
|
|
12
|
+
const pathname = request.nextUrl.pathname;
|
|
13
|
+
const isPublicRoute = PUBLIC_ROUTES.some((route) => pathname.startsWith(route)) ||
|
|
14
|
+
pathname.startsWith("/_next") ||
|
|
15
|
+
pathname.startsWith("/public");
|
|
16
|
+
// For Clerk, we need to use their middleware wrapper
|
|
17
|
+
if (process.env.AUTH_PROVIDER === "clerk") {
|
|
18
|
+
const isProtectedRoute = (0, server_2.createRouteMatcher)([
|
|
19
|
+
"/((?!sign-in|sign-out|api/auth|_next|public).*)",
|
|
20
|
+
]);
|
|
21
|
+
const handler = (0, server_2.clerkMiddleware)(async (auth, req) => {
|
|
22
|
+
if (isProtectedRoute(req) && !(await auth()).userId) {
|
|
23
|
+
const signInUrl = new URL("/sign-in", req.url);
|
|
24
|
+
return server_1.NextResponse.redirect(signInUrl);
|
|
25
|
+
}
|
|
26
|
+
return server_1.NextResponse.next();
|
|
27
|
+
});
|
|
28
|
+
return handler(request, event);
|
|
29
|
+
}
|
|
30
|
+
// For Auth0 v4, use the auth0 client middleware
|
|
31
|
+
if (process.env.AUTH_PROVIDER === "auth0") {
|
|
32
|
+
const authRes = await auth0_1.auth0.middleware(request);
|
|
33
|
+
// Ensure routes starting with /auth are handled by the SDK
|
|
34
|
+
if (pathname.startsWith("/auth")) {
|
|
35
|
+
return authRes;
|
|
36
|
+
}
|
|
37
|
+
// Allow access to public routes without requiring a session
|
|
38
|
+
if (pathname === "/") {
|
|
39
|
+
return authRes;
|
|
40
|
+
}
|
|
41
|
+
// Protected routes - require authentication
|
|
42
|
+
const session = await auth0_1.auth0.getSession(request);
|
|
43
|
+
if (!session) {
|
|
44
|
+
const { origin } = new URL(request.url);
|
|
45
|
+
return server_1.NextResponse.redirect(`${origin}/auth/login`);
|
|
46
|
+
}
|
|
47
|
+
return authRes;
|
|
48
|
+
}
|
|
49
|
+
// Fallback for other providers
|
|
50
|
+
if (isPublicRoute) {
|
|
51
|
+
return server_1.NextResponse.next();
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const strategy = (0, auth_1.resolveAuthStrategy)();
|
|
55
|
+
(0, validate_config_1.assertValidAuthConfig)(strategy);
|
|
56
|
+
return (await strategy.protectRoute(request)) || server_1.NextResponse.next();
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
if (error instanceof Error) {
|
|
60
|
+
const message = error.message;
|
|
61
|
+
if (message.includes("AUTH_PROVIDER env var is required") ||
|
|
62
|
+
message.includes("Unsupported auth provider") ||
|
|
63
|
+
message.includes("Missing required auth configuration")) {
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
console.error("Middleware auth error:", error);
|
|
68
|
+
const signInUrl = new URL("/sign-in", request.url);
|
|
69
|
+
return server_1.NextResponse.redirect(signInUrl);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.config = {
|
|
73
|
+
matcher: [
|
|
74
|
+
/*
|
|
75
|
+
* Match all request paths except for the ones starting with:
|
|
76
|
+
* - api (API routes)
|
|
77
|
+
* - _next/static (static files)
|
|
78
|
+
* - _next/image (image optimization files)
|
|
79
|
+
* - favicon.ico (favicon file)
|
|
80
|
+
*/
|
|
81
|
+
"/((?!api|_next/static|_next/image|favicon.ico).*)",
|
|
82
|
+
],
|
|
83
|
+
};
|