@jmruthers/pace-core 0.6.3 → 0.6.5

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 (103) hide show
  1. package/dist/{DataTable-THFPBKTP.js → DataTable-AOVNCPTX.js} +8 -8
  2. package/dist/{PublicPageProvider-DEMpysFR.d.ts → PublicPageProvider-QTFVrL-Z.d.ts} +65 -83
  3. package/dist/{UnifiedAuthProvider-KAGUYQ4J.js → UnifiedAuthProvider-4SBX4LU5.js} +4 -4
  4. package/dist/{api-IAGWF3ZG.js → api-O6HTBX5Y.js} +3 -3
  5. package/dist/{chunk-ZNIWI3UC.js → chunk-6COVEUS7.js} +141 -107
  6. package/dist/chunk-6COVEUS7.js.map +1 -0
  7. package/dist/{chunk-QRPVRXYT.js → chunk-AFVQODI2.js} +38 -1
  8. package/dist/{chunk-QRPVRXYT.js.map → chunk-AFVQODI2.js.map} +1 -1
  9. package/dist/{chunk-RWEBCB47.js → chunk-EFN2EIMK.js} +2 -2
  10. package/dist/{chunk-CNCQDFLN.js → chunk-G7QEZTYQ.js} +31 -31
  11. package/dist/{chunk-CNCQDFLN.js.map → chunk-G7QEZTYQ.js.map} +1 -1
  12. package/dist/{chunk-YDQHOZNA.js → chunk-HU2C6SSC.js} +29 -18
  13. package/dist/chunk-HU2C6SSC.js.map +1 -0
  14. package/dist/{chunk-DWUBLJJM.js → chunk-IHB5DR3H.js} +184 -53
  15. package/dist/chunk-IHB5DR3H.js.map +1 -0
  16. package/dist/{chunk-PQBSKX33.js → chunk-IVOFDYWT.js} +364 -208
  17. package/dist/chunk-IVOFDYWT.js.map +1 -0
  18. package/dist/{chunk-6SOIHG6Z.js → chunk-JGRYX5UX.js} +120 -20
  19. package/dist/chunk-JGRYX5UX.js.map +1 -0
  20. package/dist/{chunk-6Z7LTB3D.js → chunk-NTM7ZSB6.js} +4 -4
  21. package/dist/chunk-NTM7ZSB6.js.map +1 -0
  22. package/dist/{chunk-HFZBI76P.js → chunk-RGAWHO7N.js} +4 -4
  23. package/dist/chunk-RGAWHO7N.js.map +1 -0
  24. package/dist/{chunk-2T2IG7T7.js → chunk-UPPMRMYG.js} +3 -3
  25. package/dist/{chunk-2T2IG7T7.js.map → chunk-UPPMRMYG.js.map} +1 -1
  26. package/dist/components.d.ts +2 -3
  27. package/dist/components.js +24 -28
  28. package/dist/components.js.map +1 -1
  29. package/dist/{contextValidator-3JNZKUTX.js → contextValidator-5OGXSPKS.js} +2 -2
  30. package/dist/hooks.d.ts +3 -3
  31. package/dist/hooks.js +41 -139
  32. package/dist/hooks.js.map +1 -1
  33. package/dist/index.d.ts +27 -18
  34. package/dist/index.js +41 -50
  35. package/dist/index.js.map +1 -1
  36. package/dist/providers.js +3 -3
  37. package/dist/rbac/index.d.ts +16 -9
  38. package/dist/rbac/index.js +6 -6
  39. package/dist/{usePublicRouteParams-i3qtoBgg.d.ts → usePublicRouteParams-ClnV4tnv.d.ts} +8 -8
  40. package/dist/utils.js +1 -1
  41. package/docs/api/modules.md +210 -100
  42. package/package.json +8 -4
  43. package/scripts/audit/core/checks/dependencies.cjs +9 -0
  44. package/scripts/validate-master.js +1 -1
  45. package/src/components/DataTable/__tests__/keyboard.test.tsx +15 -2
  46. package/src/components/DataTable/components/ImportModal.tsx +4 -6
  47. package/src/components/DataTable/components/ViewRowModal.tsx +4 -4
  48. package/src/components/DataTable/components/__tests__/ImportModal.test.tsx +455 -96
  49. package/src/components/DataTable/components/__tests__/ViewRowModal.test.tsx +122 -58
  50. package/src/components/DataTable/core/DataTableContext.tsx +1 -1
  51. package/src/components/DateTimeField/DateTimeField.tsx +17 -19
  52. package/src/components/DateTimeField/README.md +5 -2
  53. package/src/components/Dialog/Dialog.test.tsx +248 -228
  54. package/src/components/Dialog/Dialog.tsx +455 -325
  55. package/src/components/Dialog/index.ts +3 -3
  56. package/src/components/FileDisplay/FileDisplay.test.tsx +41 -0
  57. package/src/components/FileDisplay/FileDisplay.tsx +5 -5
  58. package/src/components/Form/Form.test.tsx +3 -2
  59. package/src/components/Form/Form.tsx +4 -5
  60. package/src/components/InactivityWarningModal/InactivityWarningModal.test.tsx +28 -28
  61. package/src/components/InactivityWarningModal/InactivityWarningModal.tsx +40 -54
  62. package/src/components/LoginForm/LoginForm.tsx +2 -2
  63. package/src/components/NavigationMenu/NavigationMenu.tsx +2 -2
  64. package/src/components/PaceAppLayout/PaceAppLayout.tsx +54 -42
  65. package/src/components/PaceAppLayout/README.md +10 -9
  66. package/src/components/PaceAppLayout/test-setup.tsx +40 -31
  67. package/src/components/PasswordChange/PasswordChangeForm.test.tsx +61 -0
  68. package/src/components/PasswordChange/PasswordChangeForm.tsx +20 -13
  69. package/src/components/PublicLayout/PublicLayout.test.tsx +7 -3
  70. package/src/components/PublicLayout/PublicPageLayout.tsx +5 -8
  71. package/src/components/UserMenu/UserMenu.test.tsx +38 -6
  72. package/src/components/UserMenu/UserMenu.tsx +36 -34
  73. package/src/components/index.ts +3 -4
  74. package/src/hooks/useEventTheme.ts +4 -4
  75. package/src/hooks/useEvents.ts +11 -7
  76. package/src/hooks/useKeyboardShortcuts.ts +1 -1
  77. package/src/hooks/useOrganisationPermissions.ts +4 -4
  78. package/src/hooks/useOrganisations.ts +13 -7
  79. package/src/index.ts +11 -1
  80. package/src/rbac/README.md +20 -20
  81. package/src/rbac/hooks/useRBAC.test.ts +21 -3
  82. package/src/rbac/hooks/useRBAC.ts +4 -3
  83. package/src/rbac/hooks/useResourcePermissions.test.ts +125 -30
  84. package/src/rbac/hooks/useResourcePermissions.ts +57 -29
  85. package/src/rbac/permissions.ts +17 -17
  86. package/src/rbac/utils/contextValidator.ts +36 -0
  87. package/src/services/AuthService.ts +2 -5
  88. package/src/services/EventService.ts +99 -2
  89. package/src/services/InactivityService.ts +139 -58
  90. package/src/styles/core.css +4 -0
  91. package/src/utils/formatting/formatTime.test.ts +3 -2
  92. package/dist/chunk-6SOIHG6Z.js.map +0 -1
  93. package/dist/chunk-6Z7LTB3D.js.map +0 -1
  94. package/dist/chunk-DWUBLJJM.js.map +0 -1
  95. package/dist/chunk-HFZBI76P.js.map +0 -1
  96. package/dist/chunk-PQBSKX33.js.map +0 -1
  97. package/dist/chunk-YDQHOZNA.js.map +0 -1
  98. package/dist/chunk-ZNIWI3UC.js.map +0 -1
  99. /package/dist/{DataTable-THFPBKTP.js.map → DataTable-AOVNCPTX.js.map} +0 -0
  100. /package/dist/{UnifiedAuthProvider-KAGUYQ4J.js.map → UnifiedAuthProvider-4SBX4LU5.js.map} +0 -0
  101. /package/dist/{api-IAGWF3ZG.js.map → api-O6HTBX5Y.js.map} +0 -0
  102. /package/dist/{chunk-RWEBCB47.js.map → chunk-EFN2EIMK.js.map} +0 -0
  103. /package/dist/{contextValidator-3JNZKUTX.js.map → contextValidator-5OGXSPKS.js.map} +0 -0
@@ -14,9 +14,7 @@ import {
14
14
  DialogContent,
15
15
  DialogFooter,
16
16
  DialogHeader,
17
- DialogOverlay,
18
17
  DialogTitle,
19
- DialogTrigger,
20
18
  Input,
21
19
  Select,
22
20
  SelectContent,
@@ -26,13 +24,13 @@ import {
26
24
  SelectSeparator,
27
25
  SelectTrigger,
28
26
  SelectValue
29
- } from "./chunk-PQBSKX33.js";
27
+ } from "./chunk-IVOFDYWT.js";
30
28
  import {
31
29
  useCan,
32
30
  usePermissions,
33
31
  useRBAC,
34
32
  useResolvedScope
35
- } from "./chunk-YDQHOZNA.js";
33
+ } from "./chunk-HU2C6SSC.js";
36
34
  import {
37
35
  createFileReferenceService,
38
36
  generateFileUrlsBatch,
@@ -44,26 +42,30 @@ import {
44
42
  useFileDisplay,
45
43
  usePreventTabReload,
46
44
  usePublicFileDisplay
47
- } from "./chunk-2T2IG7T7.js";
45
+ } from "./chunk-UPPMRMYG.js";
48
46
  import {
49
47
  useToast
50
- } from "./chunk-6SOIHG6Z.js";
48
+ } from "./chunk-JGRYX5UX.js";
51
49
  import {
52
50
  ErrorBoundary,
53
51
  PublicPageContext,
54
52
  useAppConfig,
55
53
  useEvents,
56
54
  useIsPublicPage
57
- } from "./chunk-6Z7LTB3D.js";
55
+ } from "./chunk-NTM7ZSB6.js";
58
56
  import {
59
57
  EventServiceContext,
60
58
  useOrganisations,
61
59
  useSessionRestoration,
62
60
  useUnifiedAuth
63
- } from "./chunk-DWUBLJJM.js";
61
+ } from "./chunk-IHB5DR3H.js";
64
62
  import {
65
63
  isSuperAdmin
66
- } from "./chunk-RWEBCB47.js";
64
+ } from "./chunk-EFN2EIMK.js";
65
+ import {
66
+ EventContextRequiredError,
67
+ OrganisationContextRequiredError
68
+ } from "./chunk-AFVQODI2.js";
67
69
  import {
68
70
  assertAppId
69
71
  } from "./chunk-QXHPKYJV.js";
@@ -734,8 +736,8 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
734
736
  children: "\xD7"
735
737
  }
736
738
  ),
737
- /* @__PURE__ */ jsx4(Dialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs3(DialogContent, { size: "sm", children: [
738
- /* @__PURE__ */ jsx4(DialogHeader, { children: /* @__PURE__ */ jsx4(DialogTitle, { children: "Confirm Delete" }) }),
739
+ /* @__PURE__ */ jsx4(Dialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs3(DialogContent, { size: "sm", title: "Confirm Delete", children: [
740
+ /* @__PURE__ */ jsx4(DialogHeader, { children: /* @__PURE__ */ jsx4("h2", { children: "Confirm Delete" }) }),
739
741
  /* @__PURE__ */ jsx4(DialogBody, { children: /* @__PURE__ */ jsx4("p", { children: "Are you sure you want to delete this file? This action cannot be undone." }) }),
740
742
  /* @__PURE__ */ jsxs3(DialogFooter, { children: [
741
743
  /* @__PURE__ */ jsx4(Button, { variant: "outline", onClick: () => setDeleteDialogOpen(false), children: "Cancel" }),
@@ -782,8 +784,8 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
782
784
  children: "\xD7"
783
785
  }
784
786
  ),
785
- /* @__PURE__ */ jsx4(Dialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs3(DialogContent, { size: "sm", children: [
786
- /* @__PURE__ */ jsx4(DialogHeader, { children: /* @__PURE__ */ jsx4(DialogTitle, { children: "Confirm Delete" }) }),
787
+ /* @__PURE__ */ jsx4(Dialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs3(DialogContent, { size: "sm", title: "Confirm Delete", children: [
788
+ /* @__PURE__ */ jsx4(DialogHeader, { children: /* @__PURE__ */ jsx4("h2", { children: "Confirm Delete" }) }),
787
789
  /* @__PURE__ */ jsx4(DialogBody, { children: /* @__PURE__ */ jsx4("p", { children: "Are you sure you want to delete this file? This action cannot be undone." }) }),
788
790
  /* @__PURE__ */ jsxs3(DialogFooter, { children: [
789
791
  /* @__PURE__ */ jsx4(Button, { variant: "outline", onClick: () => setDeleteDialogOpen(false), children: "Cancel" }),
@@ -2249,8 +2251,8 @@ function FormField({
2249
2251
  className
2250
2252
  }) {
2251
2253
  const { control } = useFormContext();
2252
- return /* @__PURE__ */ jsxs6("div", { className: cn("space-y-2", className), children: [
2253
- label && /* @__PURE__ */ jsxs6(Label, { htmlFor: name, children: [
2254
+ return /* @__PURE__ */ jsxs6("label", { className: cn("space-y-2", className), children: [
2255
+ label && /* @__PURE__ */ jsxs6(Fragment5, { children: [
2254
2256
  label,
2255
2257
  validation?.required && /* @__PURE__ */ jsx11("span", { className: "text-destructive ml-1", "aria-label": "required", children: "*" })
2256
2258
  ] }),
@@ -2380,7 +2382,7 @@ var LoginForm = React9.memo(({
2380
2382
  children: isLoading ? "Signing in..." : "Sign In"
2381
2383
  }
2382
2384
  ),
2383
- showSignUp && (onSignUp ? /* @__PURE__ */ jsx12("div", { className: "text-sm text-center text-muted-foreground", children: /* @__PURE__ */ jsx12(
2385
+ showSignUp && (onSignUp ? /* @__PURE__ */ jsx12("p", { className: "text-sm text-center text-muted-foreground", children: /* @__PURE__ */ jsx12(
2384
2386
  "button",
2385
2387
  {
2386
2388
  type: "button",
@@ -2622,7 +2624,7 @@ function ContextSelector({
2622
2624
  // src/components/PasswordChange/PasswordChangeForm.tsx
2623
2625
  import { useState as useState8 } from "react";
2624
2626
  import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
2625
- function PasswordChangeForm({ onSubmit, className }) {
2627
+ function PasswordChangeForm({ onSubmit, onSuccess, className }) {
2626
2628
  const [newPassword, setNewPassword] = useState8("");
2627
2629
  const [confirmPassword, setConfirmPassword] = useState8("");
2628
2630
  const [error, setError] = useState8(null);
@@ -2643,6 +2645,8 @@ function PasswordChangeForm({ onSubmit, className }) {
2643
2645
  const result = await onSubmit({ newPassword, confirmPassword });
2644
2646
  if (result && result.error) {
2645
2647
  setError(result.error.message || "Failed to change password.");
2648
+ } else {
2649
+ onSuccess?.();
2646
2650
  }
2647
2651
  } catch (err) {
2648
2652
  const errorObj = err instanceof Error ? err : new Error("An unexpected error occurred");
@@ -2652,9 +2656,9 @@ function PasswordChangeForm({ onSubmit, className }) {
2652
2656
  }
2653
2657
  };
2654
2658
  return /* @__PURE__ */ jsxs9("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), children: [
2655
- error && /* @__PURE__ */ jsx14("div", { role: "alert", children: error }),
2656
- /* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
2657
- /* @__PURE__ */ jsx14(Label, { htmlFor: "new-password", children: "New Password" }),
2659
+ error && /* @__PURE__ */ jsx14("p", { className: "grid place-items-center text-center size-full", role: "alert", children: error }),
2660
+ /* @__PURE__ */ jsxs9(Label, { htmlFor: "new-password", className: "block mb-4", children: [
2661
+ "New Password",
2658
2662
  /* @__PURE__ */ jsx14(
2659
2663
  Input,
2660
2664
  {
@@ -2663,12 +2667,13 @@ function PasswordChangeForm({ onSubmit, className }) {
2663
2667
  value: newPassword,
2664
2668
  onChange: (e) => setNewPassword(e.target.value),
2665
2669
  required: true,
2666
- disabled: isSubmitting
2670
+ disabled: isSubmitting,
2671
+ className: "mt-2"
2667
2672
  }
2668
2673
  )
2669
2674
  ] }),
2670
- /* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
2671
- /* @__PURE__ */ jsx14(Label, { htmlFor: "confirm-password", children: "Confirm Password" }),
2675
+ /* @__PURE__ */ jsxs9(Label, { htmlFor: "confirm-password", className: "block mb-4", children: [
2676
+ "Confirm Password",
2672
2677
  /* @__PURE__ */ jsx14(
2673
2678
  Input,
2674
2679
  {
@@ -2677,7 +2682,8 @@ function PasswordChangeForm({ onSubmit, className }) {
2677
2682
  value: confirmPassword,
2678
2683
  onChange: (e) => setConfirmPassword(e.target.value),
2679
2684
  required: true,
2680
- disabled: isSubmitting
2685
+ disabled: isSubmitting,
2686
+ className: "mt-2"
2681
2687
  }
2682
2688
  )
2683
2689
  ] }),
@@ -2696,7 +2702,7 @@ function PasswordChangeForm({ onSubmit, className }) {
2696
2702
  // src/components/UserMenu/UserMenu.tsx
2697
2703
  import React12, { useCallback as useCallback8, useMemo as useMemo6, useState as useState9 } from "react";
2698
2704
  import { ChevronDown, LogOut, KeyRound } from "lucide-react";
2699
- import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
2705
+ import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
2700
2706
  var UserMenu = React12.memo(function UserMenu2({
2701
2707
  user,
2702
2708
  onSignOut,
@@ -2704,7 +2710,6 @@ var UserMenu = React12.memo(function UserMenu2({
2704
2710
  className,
2705
2711
  showAvatar = true
2706
2712
  }) {
2707
- const [isPasswordDialogOpen, setPasswordDialogOpen] = useState9(false);
2708
2713
  const userInfo = useMemo6(() => {
2709
2714
  if (!user) return null;
2710
2715
  return {
@@ -2720,7 +2725,14 @@ var UserMenu = React12.memo(function UserMenu2({
2720
2725
  if (!user || !userInfo) {
2721
2726
  return null;
2722
2727
  }
2723
- return /* @__PURE__ */ jsxs10(Dialog, { open: isPasswordDialogOpen, onOpenChange: setPasswordDialogOpen, children: [
2728
+ const [isPasswordDialogOpen, setPasswordDialogOpen] = useState9(false);
2729
+ const handlePasswordChange = useCallback8(async (newPassword, confirmPassword) => {
2730
+ if (!onChangePassword) {
2731
+ return { error: { message: "Password change not configured" } };
2732
+ }
2733
+ return await onChangePassword(newPassword, confirmPassword);
2734
+ }, [onChangePassword]);
2735
+ return /* @__PURE__ */ jsxs10(Fragment7, { children: [
2724
2736
  /* @__PURE__ */ jsxs10(Select, { className, children: [
2725
2737
  /* @__PURE__ */ jsx15(SelectTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(Button, { variant: "outline", className: "flex items-center gap-2", "aria-label": userInfo.displayName, children: [
2726
2738
  showAvatar && /* @__PURE__ */ jsx15(
@@ -2739,38 +2751,38 @@ var UserMenu = React12.memo(function UserMenu2({
2739
2751
  /* @__PURE__ */ jsx15(SelectLabel, { className: "font-normal", children: /* @__PURE__ */ jsxs10("li", { className: "pt-2", children: [
2740
2752
  userInfo.displayName,
2741
2753
  /* @__PURE__ */ jsx15("br", {}),
2742
- /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: userInfo.email })
2754
+ /* @__PURE__ */ jsx15("small", { children: userInfo.email })
2743
2755
  ] }) }),
2744
2756
  /* @__PURE__ */ jsx15(SelectSeparator, {}),
2745
- /* @__PURE__ */ jsx15(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(SelectItem, { value: "change-password", children: [
2746
- /* @__PURE__ */ jsx15(KeyRound, { className: "mr-2 size-4" }),
2747
- /* @__PURE__ */ jsx15("span", { children: "Change Password" })
2748
- ] }) }),
2757
+ /* @__PURE__ */ jsxs10(
2758
+ SelectItem,
2759
+ {
2760
+ value: "change-password",
2761
+ onClick: () => setPasswordDialogOpen(true),
2762
+ children: [
2763
+ /* @__PURE__ */ jsx15(KeyRound, { className: "inline-block mr-2 size-4" }),
2764
+ "Change Password"
2765
+ ]
2766
+ }
2767
+ ),
2749
2768
  /* @__PURE__ */ jsxs10(SelectItem, { value: "sign-out", onClick: handleSignOut, children: [
2750
- /* @__PURE__ */ jsx15(LogOut, { className: "mr-2 size-4" }),
2751
- /* @__PURE__ */ jsx15("span", { children: "Sign out" })
2769
+ /* @__PURE__ */ jsx15(LogOut, { className: "inline-block mr-2 size-4" }),
2770
+ "Sign out"
2752
2771
  ] })
2753
2772
  ] })
2754
2773
  ] }),
2755
- /* @__PURE__ */ jsx15(DialogOverlay, {}),
2756
- /* @__PURE__ */ jsxs10(DialogContent, { className, children: [
2774
+ /* @__PURE__ */ jsx15(Dialog, { open: isPasswordDialogOpen, onOpenChange: setPasswordDialogOpen, children: /* @__PURE__ */ jsxs10(DialogContent, { children: [
2757
2775
  /* @__PURE__ */ jsx15(DialogHeader, { children: /* @__PURE__ */ jsx15(DialogTitle, { children: "Change Password" }) }),
2758
2776
  /* @__PURE__ */ jsx15(
2759
2777
  PasswordChangeForm,
2760
2778
  {
2761
2779
  onSubmit: async ({ newPassword, confirmPassword }) => {
2762
- if (onChangePassword) {
2763
- const { error } = await onChangePassword(newPassword, confirmPassword);
2764
- if (!error) {
2765
- setPasswordDialogOpen(false);
2766
- }
2767
- return { error };
2768
- }
2769
- return {};
2770
- }
2780
+ return await handlePasswordChange(newPassword, confirmPassword);
2781
+ },
2782
+ onSuccess: () => setPasswordDialogOpen(false)
2771
2783
  }
2772
2784
  )
2773
- ] })
2785
+ ] }) })
2774
2786
  ] });
2775
2787
  });
2776
2788
  var UserMenuLoading = React12.memo(function UserMenuLoading2() {
@@ -2841,7 +2853,7 @@ function useNavigationFiltering({
2841
2853
  }
2842
2854
  const userId2 = authContext.user.id;
2843
2855
  const appName = authContext.appName;
2844
- import("./api-IAGWF3ZG.js").then(({ resolveAppContext }) => {
2856
+ import("./api-O6HTBX5Y.js").then(({ resolveAppContext }) => {
2845
2857
  resolveAppContext({
2846
2858
  userId: userId2,
2847
2859
  appName
@@ -3084,7 +3096,7 @@ function useNavigationFiltering({
3084
3096
  }
3085
3097
 
3086
3098
  // src/components/NavigationMenu/NavigationMenu.tsx
3087
- import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
3099
+ import { Fragment as Fragment9, jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
3088
3100
  var NavigationMenu = React14.forwardRef(({
3089
3101
  items,
3090
3102
  mode = "dropdown",
@@ -3227,7 +3239,7 @@ var NavigationMenu = React14.forwardRef(({
3227
3239
  const hasChildren = item.children && item.children.length > 0;
3228
3240
  const isExpanded = expandedItems.has(item.id);
3229
3241
  const itemIsActive = isActiveItem(item);
3230
- return /* @__PURE__ */ jsx16("li", { role: "none", children: hasChildren ? /* @__PURE__ */ jsxs11("div", { children: [
3242
+ return /* @__PURE__ */ jsx16("li", { role: "none", children: hasChildren ? /* @__PURE__ */ jsxs11(Fragment9, { children: [
3231
3243
  /* @__PURE__ */ jsxs11(
3232
3244
  "button",
3233
3245
  {
@@ -3422,7 +3434,7 @@ function Header({
3422
3434
 
3423
3435
  // src/components/Footer/Footer.tsx
3424
3436
  import React15 from "react";
3425
- import { Fragment as Fragment8, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
3437
+ import { Fragment as Fragment10, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
3426
3438
  var FooterComponent = ({
3427
3439
  companyName = "Solvera Solutions Pty Ltd",
3428
3440
  year = (/* @__PURE__ */ new Date()).getFullYear(),
@@ -3435,7 +3447,7 @@ var FooterComponent = ({
3435
3447
  const copyrightText = copyright || `\xA9 Copyright 2022\u2013${year} all rights reserved, ${companyName}.`;
3436
3448
  return /* @__PURE__ */ jsx18("footer", { className: cn("mt-8 py-6 flex justify-center border-t border-border bg-main-100", className), children: /* @__PURE__ */ jsxs13("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
3437
3449
  logo && /* @__PURE__ */ jsx18("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
3438
- children && /* @__PURE__ */ jsx18(Fragment8, { children }),
3450
+ children && /* @__PURE__ */ jsx18(Fragment10, { children }),
3439
3451
  /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: copyrightText }),
3440
3452
  links && links.length > 0 && /* @__PURE__ */ jsx18("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx18("li", { children: /* @__PURE__ */ jsx18("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
3441
3453
  ] }) });
@@ -3447,7 +3459,7 @@ Footer.displayName = "Footer";
3447
3459
  // src/components/PaceAppLayout/PaceAppLayout.tsx
3448
3460
  import { useState as useState12, useEffect as useEffect7, useMemo as useMemo8 } from "react";
3449
3461
  import { Outlet, useNavigate, useLocation } from "react-router-dom";
3450
- import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
3462
+ import { Fragment as Fragment11, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
3451
3463
  var EMPTY_PAGE_ID_MAPPING = {};
3452
3464
  var EMPTY_ROUTE_PERMISSIONS = {};
3453
3465
  function PaceAppLayout({
@@ -3591,6 +3603,12 @@ function PaceAppLayout({
3591
3603
  );
3592
3604
  const can = isSuperAdmin2 ? true : canFromHook;
3593
3605
  const hasPermission = enforcePermissions ? can : true;
3606
+ const isContextError = useMemo8(() => {
3607
+ if (!permissionError) {
3608
+ return false;
3609
+ }
3610
+ return permissionError instanceof EventContextRequiredError || permissionError instanceof OrganisationContextRequiredError || permissionError.name === "EventContextRequiredError" || permissionError.name === "OrganisationContextRequiredError";
3611
+ }, [permissionError]);
3594
3612
  useEffect7(() => {
3595
3613
  if (!enforcePermissions) {
3596
3614
  return;
@@ -3641,7 +3659,7 @@ function PaceAppLayout({
3641
3659
  return;
3642
3660
  }
3643
3661
  try {
3644
- const { isSuperAdmin: checkSuperAdminDynamic } = await import("./api-IAGWF3ZG.js");
3662
+ const { isSuperAdmin: checkSuperAdminDynamic } = await import("./api-O6HTBX5Y.js");
3645
3663
  const isSuper = await checkSuperAdminDynamic(user.id);
3646
3664
  if (isSuper) {
3647
3665
  if (isMounted) {
@@ -3656,7 +3674,7 @@ function PaceAppLayout({
3656
3674
  }
3657
3675
  }
3658
3676
  try {
3659
- const { getPermissionMap } = await import("./api-IAGWF3ZG.js");
3677
+ const { getPermissionMap } = await import("./api-O6HTBX5Y.js");
3660
3678
  const permissionScope = {
3661
3679
  organisationId: currentScope.organisationId,
3662
3680
  eventId: currentScope.eventId,
@@ -3667,7 +3685,7 @@ function PaceAppLayout({
3667
3685
  userId: user.id,
3668
3686
  scope: permissionScope
3669
3687
  });
3670
- const { getPageScopeType } = await import("./api-IAGWF3ZG.js");
3688
+ const { getPageScopeType } = await import("./api-O6HTBX5Y.js");
3671
3689
  const effectiveAppId = currentScope.appId || resolvedAppId;
3672
3690
  const effectiveAppName = appName;
3673
3691
  const hasEventContext = !!currentScope.eventId;
@@ -3776,7 +3794,7 @@ function PaceAppLayout({
3776
3794
  let hasAccess = true;
3777
3795
  if (currentRoute.pageId && currentRoute.permissions && currentRoute.permissions.length > 0) {
3778
3796
  try {
3779
- const { isPermittedCached } = await import("./api-IAGWF3ZG.js");
3797
+ const { isPermittedCached } = await import("./api-O6HTBX5Y.js");
3780
3798
  const hasPagePermission = await isPermittedCached({
3781
3799
  userId: user?.id || "",
3782
3800
  scope,
@@ -3792,7 +3810,7 @@ function PaceAppLayout({
3792
3810
  }
3793
3811
  }
3794
3812
  if (hasAccess && currentRoute.roles && currentRoute.roles.length > 0 && user?.id) {
3795
- const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-KAGUYQ4J.js");
3813
+ const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-4SBX4LU5.js");
3796
3814
  hasAccess = true;
3797
3815
  }
3798
3816
  if (!isMounted) return;
@@ -3853,51 +3871,61 @@ function PaceAppLayout({
3853
3871
  }
3854
3872
  };
3855
3873
  if (user?.id && organisationLoading && !isSuperAdmin2 && !isCheckingSuperAdminDirect && !rbacLoading && !selectedOrganisationId) {
3856
- return /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs14("div", { className: "text-center", children: [
3857
- /* @__PURE__ */ jsx19("div", { className: "animate-spin rounded-full size-8 border-b-2 border-sec-900 mx-auto mb-4" }),
3858
- /* @__PURE__ */ jsx19("p", { className: "text-sec-600", children: "Loading organisation context..." })
3859
- ] }) });
3874
+ return /* @__PURE__ */ jsxs14("p", { className: "grid place-items-center text-center size-full", children: [
3875
+ /* @__PURE__ */ jsx19(
3876
+ LoadingSpinner,
3877
+ {
3878
+ size: "lg"
3879
+ }
3880
+ ),
3881
+ /* @__PURE__ */ jsx19("br", {}),
3882
+ "Loading organisation context..."
3883
+ ] });
3860
3884
  }
3861
3885
  if (enforcePermissions && isCheckingPermission) {
3862
- return /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs14("div", { className: "text-center", children: [
3863
- /* @__PURE__ */ jsx19("div", { className: "animate-spin rounded-full size-8 border-b-2 border-sec-900 mx-auto mb-4" }),
3864
- /* @__PURE__ */ jsx19("p", { className: "text-sec-600", children: "Checking permissions..." })
3865
- ] }) });
3886
+ return /* @__PURE__ */ jsxs14("p", { className: "grid place-items-center text-center size-full", children: [
3887
+ /* @__PURE__ */ jsx19(
3888
+ LoadingSpinner,
3889
+ {
3890
+ size: "lg"
3891
+ }
3892
+ ),
3893
+ /* @__PURE__ */ jsx19("br", {}),
3894
+ "Checking permissions..."
3895
+ ] });
3866
3896
  }
3867
- if (enforcePermissions && permissionError && !isSuperAdmin2) {
3868
- return /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs14("div", { className: "text-center", children: [
3869
- /* @__PURE__ */ jsx19("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Permission Error" }),
3870
- /* @__PURE__ */ jsx19("p", { className: "text-sec-600 mb-4", children: permissionError.message }),
3897
+ if (enforcePermissions && permissionError && !isSuperAdmin2 && !isContextError) {
3898
+ return /* @__PURE__ */ jsxs14("hgroup", { className: "grid place-items-center text-center size-full", children: [
3899
+ /* @__PURE__ */ jsx19("h2", { children: "Permission Error" }),
3900
+ /* @__PURE__ */ jsx19("p", { children: permissionError.message }),
3871
3901
  /* @__PURE__ */ jsx19(Button, { onClick: () => navigate("/"), children: "Go Home" })
3872
- ] }) });
3902
+ ] });
3873
3903
  }
3874
- if (enforcePermissions && hasPermission === false && !isCheckingSuperAdminDirect && !isSuperAdmin2) {
3904
+ if (enforcePermissions && hasPermission === false && !isCheckingSuperAdminDirect && !isSuperAdmin2 && !isContextError) {
3875
3905
  if (enforcePagePermissions && pagePermissionFallback) {
3876
- return /* @__PURE__ */ jsx19(Fragment9, { children: pagePermissionFallback });
3906
+ return /* @__PURE__ */ jsx19(Fragment11, { children: pagePermissionFallback });
3877
3907
  }
3878
3908
  if (permissionFallback) {
3879
- return /* @__PURE__ */ jsx19(Fragment9, { children: permissionFallback });
3880
- }
3881
- return /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs14("div", { className: "text-center", children: [
3882
- /* @__PURE__ */ jsx19("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Access Denied" }),
3883
- /* @__PURE__ */ jsx19("p", { className: "text-sec-600 mb-4", children: "You don't have permission to access this page." }),
3884
- /* @__PURE__ */ jsxs14("div", { className: "flex gap-2 justify-center", children: [
3885
- /* @__PURE__ */ jsx19(Button, { onClick: () => navigate("/"), children: "Go Home" }),
3886
- /* @__PURE__ */ jsx19(
3887
- Button,
3888
- {
3889
- variant: "outline",
3890
- onClick: async () => {
3891
- await handleSignOut();
3892
- navigate("/login");
3893
- },
3894
- children: "Sign out"
3895
- }
3896
- )
3897
- ] })
3898
- ] }) });
3909
+ return /* @__PURE__ */ jsx19(Fragment11, { children: permissionFallback });
3910
+ }
3911
+ return /* @__PURE__ */ jsxs14("hgroup", { className: "grid place-items-center text-center size-full", children: [
3912
+ /* @__PURE__ */ jsx19("h2", { children: "Access Denied" }),
3913
+ /* @__PURE__ */ jsx19("p", { children: "You don't have permission to access this page." }),
3914
+ /* @__PURE__ */ jsx19(Button, { onClick: () => navigate("/"), children: "Go Home" }),
3915
+ /* @__PURE__ */ jsx19(
3916
+ Button,
3917
+ {
3918
+ variant: "outline",
3919
+ onClick: async () => {
3920
+ await handleSignOut();
3921
+ navigate("/login");
3922
+ },
3923
+ children: "Sign out"
3924
+ }
3925
+ )
3926
+ ] });
3899
3927
  }
3900
- return /* @__PURE__ */ jsxs14(Fragment9, { children: [
3928
+ return /* @__PURE__ */ jsxs14(Fragment11, { children: [
3901
3929
  /* @__PURE__ */ jsx19(
3902
3930
  Header,
3903
3931
  {
@@ -4246,7 +4274,7 @@ function ProtectedRoute({
4246
4274
 
4247
4275
  // src/components/FileUpload/FileUpload.tsx
4248
4276
  import { useState as useState15, useCallback as useCallback10, useRef as useRef9, useEffect as useEffect10, useMemo as useMemo10 } from "react";
4249
- import { Fragment as Fragment10, jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
4277
+ import { Fragment as Fragment12, jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
4250
4278
  function FileUpload({
4251
4279
  supabase,
4252
4280
  table_name,
@@ -4623,7 +4651,7 @@ function FileUpload({
4623
4651
  "aria-label": accept ? `Upload file${multiple ? "s" : ""} (${accept})` : `Upload file${multiple ? "s" : ""}`
4624
4652
  }
4625
4653
  ),
4626
- /* @__PURE__ */ jsx23("div", { className: "text-sec-600", children: isResolvingAppId ? "Resolving app configuration..." : isDragging ? "Drop files here..." : /* @__PURE__ */ jsxs18(Fragment10, { children: [
4654
+ /* @__PURE__ */ jsx23("div", { className: "text-sec-600", children: isResolvingAppId ? "Resolving app configuration..." : isDragging ? "Drop files here..." : /* @__PURE__ */ jsxs18(Fragment12, { children: [
4627
4655
  /* @__PURE__ */ jsx23("span", { className: "font-medium", children: "Click to upload" }),
4628
4656
  " ",
4629
4657
  "or drag and drop"
@@ -4807,7 +4835,7 @@ var TableCaption = React20.forwardRef(({ className, ...props }, ref) => /* @__PU
4807
4835
  TableCaption.displayName = "TableCaption";
4808
4836
 
4809
4837
  // src/components/PublicLayout/PublicPageLayout.tsx
4810
- import { Fragment as Fragment11, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
4838
+ import { Fragment as Fragment13, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
4811
4839
  function PublicPageHeader({
4812
4840
  event,
4813
4841
  eventCode,
@@ -4832,9 +4860,9 @@ function PublicPageHeader({
4832
4860
  alt: appName
4833
4861
  }
4834
4862
  ),
4835
- event && /* @__PURE__ */ jsxs19(Fragment11, { children: [
4863
+ event && /* @__PURE__ */ jsxs19(Fragment13, { children: [
4836
4864
  /* @__PURE__ */ jsx25("h1", { children: event.event_name }),
4837
- showEventLogo && event && /* @__PURE__ */ jsx25(Fragment11, { children: customEventLogo || /* @__PURE__ */ jsx25(
4865
+ showEventLogo && event && /* @__PURE__ */ jsx25(Fragment13, { children: customEventLogo || /* @__PURE__ */ jsx25(
4838
4866
  FileDisplay,
4839
4867
  {
4840
4868
  table_name: "event",
@@ -4853,11 +4881,11 @@ function PublicPageHeader({
4853
4881
  ) }),
4854
4882
  event.event_venue && /* @__PURE__ */ jsx25("h4", { children: event.event_venue })
4855
4883
  ] }),
4856
- title && /* @__PURE__ */ jsxs19(Fragment11, { children: [
4884
+ title && /* @__PURE__ */ jsxs19(Fragment13, { children: [
4857
4885
  /* @__PURE__ */ jsx25("h1", { children: title }),
4858
4886
  description && /* @__PURE__ */ jsx25("p", { className: "text-lg text-sec-600 max-w-3xl mx-auto", children: description })
4859
4887
  ] }),
4860
- children && /* @__PURE__ */ jsx25(Fragment11, { children })
4888
+ children && /* @__PURE__ */ jsx25(Fragment13, { children })
4861
4889
  ] });
4862
4890
  }
4863
4891
  function PublicPageFooter({
@@ -4873,7 +4901,7 @@ function PublicPageFooter({
4873
4901
  const copyrightText = copyright || `\xA9 Copyright 2022\u2013${year} all rights reserved, ${companyName}.`;
4874
4902
  return /* @__PURE__ */ jsx25("footer", { className: cn("mt-8 py-6 flex justify-center", className), children: /* @__PURE__ */ jsxs19("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
4875
4903
  logo && /* @__PURE__ */ jsx25("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
4876
- children && /* @__PURE__ */ jsx25(Fragment11, { children }),
4904
+ children && /* @__PURE__ */ jsx25(Fragment13, { children }),
4877
4905
  /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: copyrightText }),
4878
4906
  links && links.length > 0 && /* @__PURE__ */ jsx25("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx25("li", { children: /* @__PURE__ */ jsx25("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
4879
4907
  ] }) });
@@ -4900,10 +4928,16 @@ function PublicPageLayout({
4900
4928
  if (LoadingFallback) {
4901
4929
  return /* @__PURE__ */ jsx25(LoadingFallback, {});
4902
4930
  }
4903
- return /* @__PURE__ */ jsx25("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ jsxs19("div", { className: "max-w-md mx-auto text-center px-4", children: [
4904
- /* @__PURE__ */ jsx25(LoadingSpinner, { size: "lg", className: "mx-auto mb-4" }),
4905
- loadingMessage && /* @__PURE__ */ jsx25("p", { className: "text-sec-600", children: loadingMessage })
4906
- ] }) });
4931
+ return /* @__PURE__ */ jsxs19("p", { className: "grid place-items-center text-center size-full", children: [
4932
+ /* @__PURE__ */ jsx25(
4933
+ LoadingSpinner,
4934
+ {
4935
+ size: "lg"
4936
+ }
4937
+ ),
4938
+ /* @__PURE__ */ jsx25("br", {}),
4939
+ loadingMessage || "Loading..."
4940
+ ] });
4907
4941
  }
4908
4942
  if (error && showValidationErrors) {
4909
4943
  if (ErrorFallback) {
@@ -4926,7 +4960,7 @@ function PublicPageLayout({
4926
4960
  handleRefetch && /* @__PURE__ */ jsx25(Button, { onClick: handleRefetch, children: "Try Again" })
4927
4961
  ] });
4928
4962
  }
4929
- return /* @__PURE__ */ jsx25(ErrorBoundary, { componentName: "PublicPageLayout", children: /* @__PURE__ */ jsxs19(Fragment11, { children: [
4963
+ return /* @__PURE__ */ jsx25(ErrorBoundary, { componentName: "PublicPageLayout", children: /* @__PURE__ */ jsxs19(Fragment13, { children: [
4930
4964
  customHeader || /* @__PURE__ */ jsx25(
4931
4965
  PublicPageHeader,
4932
4966
  {
@@ -4990,4 +5024,4 @@ export {
4990
5024
  PublicPageFooter,
4991
5025
  PublicPageLayout
4992
5026
  };
4993
- //# sourceMappingURL=chunk-ZNIWI3UC.js.map
5027
+ //# sourceMappingURL=chunk-6COVEUS7.js.map