@frigear-nu/events 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -44,7 +44,7 @@ export default [
44
44
  Tickets (`tickets:read`, `tickets:write`) are self-service: every signed-in user holds them. The named scope `tickets`
45
45
  offers both to API tokens and OAuth clients.
46
46
 
47
- Full documentation: `apps/docs/content/3.modules/3.features/1.events/index.md`.
47
+ Full documentation: `apps/docs/content/3.modules/5.features/1.events/index.md`.
48
48
 
49
49
  ## Development
50
50
 
package/dist/module.d.mts CHANGED
@@ -21,7 +21,10 @@ type ModuleOptions = {
21
21
  events?: string | boolean;
22
22
  /** Event detail; must contain a `:slug` param. `true` = `/events/:slug`. */
23
23
  event?: string | boolean;
24
- /** The signed-in user's tickets. `true` = `/account/tickets`. */
24
+ /**
25
+ * The signed-in user's tickets. `true` = `/dashboard/tickets` with the signed-in hub of `@frigear-nu/dashboard`
26
+ * (its layout and `dashboard` menu; `/account/tickets` redirects there), else `/account/tickets`. Off by default.
27
+ */
25
28
  tickets?: string | boolean;
26
29
  /** Staff event list (needs the `events:manage` permission). `true` = `/admin/events`. Off by default. */
27
30
  admin?: string | boolean;
@@ -43,6 +46,8 @@ type PublicModuleOptions = {
43
46
  admin?: string;
44
47
  adminEvent?: string;
45
48
  };
49
+ /** The menu the tickets page is listed in: `dashboard` when it is in the signed-in hub, else `account`. */
50
+ ticketsMenu?: 'dashboard' | 'account';
46
51
  };
47
52
  type AddonDto = {
48
53
  id: string;
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@frigear-nu/events",
3
3
  "configKey": "events",
4
- "version": "0.5.0",
4
+ "version": "0.5.1",
5
5
  "builder": {
6
- "@nuxt/module-builder": "1.0.3",
6
+ "@nuxt/module-builder": "1.0.4",
7
7
  "unbuild": "unknown"
8
8
  }
9
9
  }
package/dist/module.mjs CHANGED
@@ -1,11 +1,12 @@
1
1
  import { defineNuxtModule, createResolver, hasNuxtModule, addServerImportsDir, addServerPlugin, addImports, addComponentsDir } from '@nuxt/kit';
2
- import { registerModule, registerTailwindSource, registerLocales, resolvePagePath, registerDatabaseTable, addModuleRoutes, registerBootstrapProvider, inlineModuleRuntime, addModulePages, addOptionalMenuSource } from '@frigear-nu/module-kit/utils';
2
+ import { registerModule, registerTailwindSource, registerLocales, resolvePagePath, resolveDashboardHubPath, joinPagePath, isPathUnder, addPageRedirects, registerDatabaseTable, addModuleRoutes, registerBootstrapProvider, inlineModuleRuntime, addModulePages, addOptionalMenuSource } from '@frigear-nu/module-kit/utils';
3
3
  import { adminRoute } from '@frigear-nu/admin/utils';
4
4
  import { registerAccess } from '@frigear-nu/auth/utils';
5
5
  import { eventsAccess } from '../dist/runtime/access.js';
6
6
  import { addMcpDefinitions } from '@frigear-nu/mcp/utils';
7
7
 
8
8
  const MODULE_NAME = "@frigear-nu/events";
9
+ const ACCOUNT_TICKETS_PATH = "/account/tickets";
9
10
  const module$1 = defineNuxtModule({
10
11
  meta: { name: MODULE_NAME, configKey: "events" },
11
12
  defaults: {
@@ -38,7 +39,9 @@ const module$1 = defineNuxtModule({
38
39
  const settings = options.settings ?? {};
39
40
  const eventsPath = resolvePagePath(settings.pages?.events, "/events");
40
41
  const eventPath = resolvePagePath(settings.pages?.event, "/events/:slug");
41
- const ticketsPath = resolvePagePath(settings.pages?.tickets, "/account/tickets");
42
+ const hub = resolveDashboardHubPath(nuxt);
43
+ const ticketsPath = resolvePagePath(settings.pages?.tickets, hub ? joinPagePath(hub, "tickets") : ACCOUNT_TICKETS_PATH);
44
+ const ticketsMenu = ticketsPath && hub && isPathUnder(ticketsPath, hub) ? "dashboard" : "account";
42
45
  const withAdmin = hasNuxtModule("@frigear-nu/admin");
43
46
  const adminPath = withAdmin ? resolvePagePath(settings.pages?.admin, adminRoute(nuxt, "events")) : void 0;
44
47
  const adminEventPath = withAdmin ? resolvePagePath(settings.pages?.adminEvent, adminRoute(nuxt, "events", ":id")) : void 0;
@@ -46,8 +49,12 @@ const module$1 = defineNuxtModule({
46
49
  reservationMinutes: settings.reservationMinutes ?? 30
47
50
  };
48
51
  nuxt.options.runtimeConfig.public.events = {
49
- pages: { events: eventsPath, event: eventPath, tickets: ticketsPath, admin: adminPath, adminEvent: adminEventPath }
52
+ pages: { events: eventsPath, event: eventPath, tickets: ticketsPath, admin: adminPath, adminEvent: adminEventPath },
53
+ ticketsMenu
50
54
  };
55
+ if (settings.pages?.tickets === true && ticketsPath && ticketsPath !== ACCOUNT_TICKETS_PATH) {
56
+ addPageRedirects(nuxt, { [ACCOUNT_TICKETS_PATH]: ticketsPath });
57
+ }
51
58
  registerDatabaseTable(nuxt, {
52
59
  resolver,
53
60
  schema: (dialect) => `./runtime/server/db/schema.${dialect}`
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Locale-aware links to the event pages (`/events`, `/events/:slug`, `/account/tickets`, the admin list and event
2
+ * Locale-aware links to the event pages (`/events`, `/events/:slug`, the tickets, the admin list and event
3
3
  * page). Always use these instead of building the path by hand: they keep the locale prefix (`/en/events` stays under
4
4
  * `/en`) and follow `events.settings.pages`.
5
5
  */
@@ -4,7 +4,8 @@ import { eventsAccess } from "./access.js";
4
4
  export default defineMenuSource(() => {
5
5
  const config = useRuntimeConfig().public.events;
6
6
  if (config?.pages?.tickets) {
7
- extendMenuItem("account", defineMenuItem({
7
+ const hub = config.ticketsMenu === "dashboard";
8
+ extendMenuItem(hub ? "dashboard" : "account", defineMenuItem({
8
9
  id: "event-tickets",
9
10
  label: "Tickets",
10
11
  labelKey: "events.menu.tickets.label",
@@ -12,7 +13,7 @@ export default defineMenuSource(() => {
12
13
  descriptionKey: "events.menu.tickets.description",
13
14
  icon: "i-lucide-ticket",
14
15
  to: config.pages.tickets,
15
- order: 40
16
+ order: hub ? 30 : 40
16
17
  }));
17
18
  }
18
19
  if (config?.pages?.admin) {
@@ -53,11 +53,11 @@ export declare const eventPatchSchema: z.ZodObject<{
53
53
  body: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodString>, z.ZodTransform<{
54
54
  [k: string]: string;
55
55
  }, Record<string, string>>>]>>>>;
56
- startsAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
57
56
  location: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodString>, z.ZodTransform<{
58
57
  [k: string]: string;
59
58
  }, Record<string, string>>>]>>>>;
60
59
  locationUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
60
+ startsAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
61
61
  endsAt: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
62
62
  requiresMembership: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<"any">, z.ZodArray<z.ZodString>]>>>>;
63
63
  }, z.core.$strip>;
@@ -8,8 +8,8 @@ export type { AddonDto, AdminAddonDto, AdminAddonGroupDto, AdminEventDetailDto,
8
8
  export declare const DEFAULT_CURRENCY = "DKK";
9
9
  /** Normalises a stored requirement: empty plan lists mean "any active subscription". */
10
10
  export declare function normalizeMembership(value: MembershipRequirement | undefined): MembershipRequirement;
11
- /** Random, prefixed id (`tkt_...`), Web Crypto only so it works on Workers. */
12
- export declare function newId(prefix: string): string;
11
+ /** Random, prefixed id (`<prefix>_<32 hex>`): the one of `@frigear-nu/module-kit/id`. */
12
+ export { newId } from '@frigear-nu/module-kit/id';
13
13
  /** A longer random token for ticket QR codes. */
14
14
  export declare function newTicketCode(): string;
15
15
  /**
@@ -9,9 +9,7 @@ export function normalizeMembership(value) {
9
9
  if (Array.isArray(value)) return value.length ? value : "any";
10
10
  return null;
11
11
  }
12
- export function newId(prefix) {
13
- return `${prefix}_${crypto.randomUUID().replaceAll("-", "")}`;
14
- }
12
+ export { newId } from "@frigear-nu/module-kit/id";
15
13
  export function newTicketCode() {
16
14
  return `${crypto.randomUUID().replaceAll("-", "")}${crypto.randomUUID().replaceAll("-", "")}`;
17
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frigear-nu/events",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Events with ticket types, addons, capacity, membership requirements, Stripe payments and QR check-in for the frigear ecosystem, built on @frigear-nu/payments.",
5
5
  "homepage": "https://docs.frigear.dev/modules/features/events",
6
6
  "repository": {
@@ -35,15 +35,15 @@
35
35
  "playground"
36
36
  ],
37
37
  "dependencies": {
38
- "@frigear-nu/admin": "^0.5.0",
39
- "@frigear-nu/auth": "^0.6.0",
38
+ "@frigear-nu/admin": "^0.5.1",
39
+ "@frigear-nu/auth": "^0.6.4",
40
40
  "@frigear-nu/mcp": "^0.5.0",
41
- "@frigear-nu/module-kit": "^1.3.5",
42
- "@frigear-nu/payments": "^0.5.0",
43
- "@frigear-nu/stripe": "^0.4.0",
44
- "@frigear-nu/subscriptions": "^0.5.0",
45
- "@frigear-nu/ui": "^0.2.6",
46
- "@frigear-nu/users": "^3.1.0",
41
+ "@frigear-nu/module-kit": "^1.3.8",
42
+ "@frigear-nu/payments": "^0.5.1",
43
+ "@frigear-nu/stripe": "^0.4.1",
44
+ "@frigear-nu/subscriptions": "^0.5.1",
45
+ "@frigear-nu/ui": "^0.2.8",
46
+ "@frigear-nu/users": "^3.1.2",
47
47
  "@libsql/client": "^0.18.0",
48
48
  "@nuxt/kit": "^4.6.4",
49
49
  "@vueuse/core": "^15.0.0",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@frigear-nu/menu": "^0.4.0",
59
- "@frigear-nu/widget": "^0.4.0",
59
+ "@frigear-nu/widget": "^0.4.1",
60
60
  "@nuxt/ui": "^4.12.0",
61
61
  "@nuxthub/core": "^0.10.12"
62
62
  },
@@ -73,17 +73,17 @@
73
73
  },
74
74
  "devDependencies": {
75
75
  "@frigear-nu/menu": "^0.4.0",
76
- "@frigear-nu/widget": "^0.4.0",
77
- "@nuxt/devtools": "^4.1.0",
76
+ "@frigear-nu/widget": "^0.4.1",
77
+ "@nuxt/devtools": "^4.2.0",
78
78
  "@nuxt/eslint-config": "^1.17.0",
79
- "@nuxt/module-builder": "^1.0.3",
79
+ "@nuxt/module-builder": "^1.0.4",
80
80
  "@nuxt/schema": "^4.6.4",
81
- "@nuxt/test-utils": "^4.3.4",
81
+ "@nuxt/test-utils": "^4.4.0",
82
82
  "@nuxt/ui": "^4.12.0",
83
83
  "@nuxthub/core": "^0.10.12",
84
84
  "@types/node": "^26.6.6",
85
85
  "changelogen": "^0.6.2",
86
- "eslint": "^10.14.0",
86
+ "eslint": "^10.15.0",
87
87
  "nuxt": "^4.6.4",
88
88
  "typescript": "^6.0.3",
89
89
  "unstorage": "^1.17.5",