@jmruthers/pace-core 0.5.69 → 0.5.71
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/{DataTable-MPBSXUC6.js → DataTable-V3RFYBBB.js} +6 -5
- package/dist/{PublicLoadingSpinner-BOdyU3u-.d.ts → PublicLoadingSpinner-DLpF5bbs.d.ts} +77 -1
- package/dist/{api-A4SUYPPV.js → api-DDMUKIUD.js} +2 -2
- package/dist/{chunk-ZXJGZLLO.js → chunk-2NWIXRSB.js} +662 -106
- package/dist/chunk-2NWIXRSB.js.map +1 -0
- package/dist/{chunk-6JILXFEA.js → chunk-4CET7YQI.js} +51 -3
- package/dist/chunk-4CET7YQI.js.map +1 -0
- package/dist/{chunk-FJTAWPAQ.js → chunk-67FGPOHX.js} +3 -3
- package/dist/{chunk-Q2UP3ZWQ.js → chunk-BUM2ZPYC.js} +12 -12
- package/dist/{chunk-V3QO3LL7.js → chunk-C353TCFY.js} +2 -2
- package/dist/{chunk-NHR52QAQ.js → chunk-FGMFQSHX.js} +8 -7
- package/dist/chunk-FGMFQSHX.js.map +1 -0
- package/dist/{chunk-2ARQW6VX.js → chunk-GDIBOLKV.js} +2 -2
- package/dist/{chunk-RVYGJPOD.js → chunk-MTI7X73I.js} +9 -7
- package/dist/{chunk-RVYGJPOD.js.map → chunk-MTI7X73I.js.map} +1 -1
- package/dist/chunk-SMJZMKYN.js +141 -0
- package/dist/chunk-SMJZMKYN.js.map +1 -0
- package/dist/{chunk-L3RV2ALE.js → chunk-VKOCWWVY.js} +6 -1
- package/dist/{chunk-L3RV2ALE.js.map → chunk-VKOCWWVY.js.map} +1 -1
- package/dist/{chunk-NO5QHMDX.js → chunk-VLFIYM6B.js} +3 -3
- package/dist/{chunk-UCMHBF7Y.js → chunk-XC4ZCSO4.js} +2 -2
- package/dist/components.d.ts +4 -79
- package/dist/components.js +22 -579
- package/dist/components.js.map +1 -1
- package/dist/hooks.js +5 -5
- package/dist/index.d.ts +3 -2
- package/dist/index.js +26 -13
- package/dist/index.js.map +1 -1
- package/dist/providers.js +3 -2
- package/dist/rbac/index.d.ts +4 -0
- package/dist/rbac/index.js +6 -5
- package/dist/styles/index.js +2 -2
- package/dist/theming/runtime.d.ts +4 -3
- package/dist/theming/runtime.js +3 -1
- package/dist/utils.js +1 -1
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +1 -1
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +2 -2
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +129 -0
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventContextType.md +7 -7
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/EventProviderProps.md +2 -2
- package/docs/api/interfaces/FileDisplayProps.md +107 -0
- package/docs/api/interfaces/FileMetadata.md +129 -0
- package/docs/api/interfaces/FileReference.md +118 -0
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +85 -0
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACContextType.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACProviderProps.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +192 -12
- package/package.json +3 -2
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.performance.test.tsx +3 -2
- package/src/index.ts +6 -0
- package/src/providers/EventProvider.tsx +58 -2
- package/src/rbac/__tests__/engine.comprehensive.test.ts +150 -78
- package/src/rbac/__tests__/rbac-engine-core-logic.test.ts +52 -50
- package/src/rbac/__tests__/rbac-engine-simplified.test.ts +39 -19
- package/src/rbac/engine.test.ts +4 -0
- package/src/rbac/engine.ts +16 -7
- package/src/rbac/providers/RBACProvider.tsx +15 -4
- package/src/theming/__tests__/runtime.test.ts +102 -82
- package/src/theming/runtime.ts +71 -28
- package/dist/chunk-6JILXFEA.js.map +0 -1
- package/dist/chunk-N2EUGZRW.js +0 -98
- package/dist/chunk-N2EUGZRW.js.map +0 -1
- package/dist/chunk-NHR52QAQ.js.map +0 -1
- package/dist/chunk-ZXJGZLLO.js.map +0 -1
- package/src/styles/base.css +0 -208
- package/src/styles/semantic.css +0 -24
- /package/dist/{DataTable-MPBSXUC6.js.map → DataTable-V3RFYBBB.js.map} +0 -0
- /package/dist/{api-A4SUYPPV.js.map → api-DDMUKIUD.js.map} +0 -0
- /package/dist/{chunk-FJTAWPAQ.js.map → chunk-67FGPOHX.js.map} +0 -0
- /package/dist/{chunk-Q2UP3ZWQ.js.map → chunk-BUM2ZPYC.js.map} +0 -0
- /package/dist/{chunk-V3QO3LL7.js.map → chunk-C353TCFY.js.map} +0 -0
- /package/dist/{chunk-2ARQW6VX.js.map → chunk-GDIBOLKV.js.map} +0 -0
- /package/dist/{chunk-NO5QHMDX.js.map → chunk-VLFIYM6B.js.map} +0 -0
- /package/dist/{chunk-UCMHBF7Y.js.map → chunk-XC4ZCSO4.js.map} +0 -0
|
@@ -15,17 +15,17 @@ import {
|
|
|
15
15
|
SelectSeparator,
|
|
16
16
|
SelectTrigger,
|
|
17
17
|
SelectValue
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-VLFIYM6B.js";
|
|
19
19
|
import {
|
|
20
20
|
isPermitted
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-FGMFQSHX.js";
|
|
22
22
|
import {
|
|
23
23
|
PublicErrorBoundary,
|
|
24
24
|
useAppConfig,
|
|
25
25
|
usePublicEventLogo,
|
|
26
26
|
usePublicPageContext,
|
|
27
27
|
useToast
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-C353TCFY.js";
|
|
29
29
|
import {
|
|
30
30
|
Button,
|
|
31
31
|
Dialog,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
useEvents,
|
|
45
45
|
useOrganisations,
|
|
46
46
|
useUnifiedAuth
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-4CET7YQI.js";
|
|
48
48
|
import {
|
|
49
49
|
LoadingSpinner
|
|
50
50
|
} from "./chunk-CDQ3PX7L.js";
|
|
@@ -1205,7 +1205,7 @@ function PaceAppLayout({
|
|
|
1205
1205
|
eventId: user.user_metadata?.eventId || user.app_metadata?.eventId,
|
|
1206
1206
|
appId: user.user_metadata?.appId || user.app_metadata?.appId
|
|
1207
1207
|
};
|
|
1208
|
-
const { isSuperAdmin } = await import("./api-
|
|
1208
|
+
const { isSuperAdmin } = await import("./api-DDMUKIUD.js");
|
|
1209
1209
|
const isSuper = await isSuperAdmin(user.id);
|
|
1210
1210
|
if (isSuper) {
|
|
1211
1211
|
return true;
|
|
@@ -2396,11 +2396,564 @@ function useFileUpload({ supabase, appName, orgId }) {
|
|
|
2396
2396
|
};
|
|
2397
2397
|
}
|
|
2398
2398
|
|
|
2399
|
+
// src/hooks/useFileReference.ts
|
|
2400
|
+
import { useState as useState10, useCallback as useCallback6 } from "react";
|
|
2401
|
+
|
|
2402
|
+
// src/utils/file-reference.ts
|
|
2403
|
+
var FileReferenceServiceImpl = class {
|
|
2404
|
+
constructor(supabase) {
|
|
2405
|
+
this.supabase = supabase;
|
|
2406
|
+
}
|
|
2407
|
+
async createFileReference(options, file) {
|
|
2408
|
+
try {
|
|
2409
|
+
const filePath = generateFilePath({
|
|
2410
|
+
appName: "file-reference",
|
|
2411
|
+
orgId: options.organisation_id,
|
|
2412
|
+
isPublic: options.is_public || false
|
|
2413
|
+
}, file.name);
|
|
2414
|
+
const uploadResult = await uploadFile(this.supabase, file, {
|
|
2415
|
+
appName: "file-reference",
|
|
2416
|
+
orgId: options.organisation_id,
|
|
2417
|
+
isPublic: options.is_public || false,
|
|
2418
|
+
customPath: filePath
|
|
2419
|
+
});
|
|
2420
|
+
if (!uploadResult.success) {
|
|
2421
|
+
throw new Error(`Failed to upload file: ${uploadResult.error}`);
|
|
2422
|
+
}
|
|
2423
|
+
const metadata = await extractFileMetadata(file, {
|
|
2424
|
+
appName: "file-reference",
|
|
2425
|
+
orgId: options.organisation_id,
|
|
2426
|
+
isPublic: options.is_public || false
|
|
2427
|
+
}, "system");
|
|
2428
|
+
const { data, error } = await this.supabase.rpc("insert_file_reference", {
|
|
2429
|
+
p_table_name: options.table_name,
|
|
2430
|
+
p_record_id: options.record_id,
|
|
2431
|
+
p_file_path: filePath,
|
|
2432
|
+
p_organisation_id: options.organisation_id,
|
|
2433
|
+
p_app_id: options.app_id,
|
|
2434
|
+
p_file_metadata: {
|
|
2435
|
+
fileName: file.name,
|
|
2436
|
+
fileType: file.type,
|
|
2437
|
+
fileSize: file.size,
|
|
2438
|
+
category: options.category,
|
|
2439
|
+
...metadata,
|
|
2440
|
+
...options.custom_metadata
|
|
2441
|
+
},
|
|
2442
|
+
p_is_public: options.is_public || false
|
|
2443
|
+
});
|
|
2444
|
+
if (error) {
|
|
2445
|
+
await deleteFile(this.supabase, filePath);
|
|
2446
|
+
throw new Error(`Failed to create file reference: ${error.message}`);
|
|
2447
|
+
}
|
|
2448
|
+
const { data: fileRef, error: fetchError } = await this.supabase.from("file_references").select("*").eq("id", data).single();
|
|
2449
|
+
if (fetchError || !fileRef) {
|
|
2450
|
+
throw new Error(`Failed to fetch created file reference: ${fetchError?.message}`);
|
|
2451
|
+
}
|
|
2452
|
+
return fileRef;
|
|
2453
|
+
} catch (error) {
|
|
2454
|
+
console.error("Error creating file reference:", error);
|
|
2455
|
+
throw error;
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
async getFileReference(table_name, record_id, organisation_id) {
|
|
2459
|
+
try {
|
|
2460
|
+
const { data, error } = await this.supabase.from("file_references").select("*").eq("table_name", table_name).eq("record_id", record_id).eq("organisation_id", organisation_id).single();
|
|
2461
|
+
if (error) {
|
|
2462
|
+
if (error.code === "PGRST116") {
|
|
2463
|
+
return null;
|
|
2464
|
+
}
|
|
2465
|
+
throw new Error(`Failed to get file reference: ${error.message}`);
|
|
2466
|
+
}
|
|
2467
|
+
return data;
|
|
2468
|
+
} catch (error) {
|
|
2469
|
+
console.error("Error getting file reference:", error);
|
|
2470
|
+
throw error;
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
async getFileUrl(table_name, record_id, organisation_id) {
|
|
2474
|
+
try {
|
|
2475
|
+
const { data, error } = await this.supabase.rpc("get_file_url", {
|
|
2476
|
+
p_table_name: table_name,
|
|
2477
|
+
p_record_id: record_id,
|
|
2478
|
+
p_organisation_id: organisation_id
|
|
2479
|
+
});
|
|
2480
|
+
if (error) {
|
|
2481
|
+
throw new Error(`Failed to get file URL: ${error.message}`);
|
|
2482
|
+
}
|
|
2483
|
+
return data;
|
|
2484
|
+
} catch (error) {
|
|
2485
|
+
console.error("Error getting file URL:", error);
|
|
2486
|
+
throw error;
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
async getSignedUrl(table_name, record_id, organisation_id, expires_in = 3600) {
|
|
2490
|
+
try {
|
|
2491
|
+
const { data, error } = await this.supabase.rpc("get_file_signed_url", {
|
|
2492
|
+
p_table_name: table_name,
|
|
2493
|
+
p_record_id: record_id,
|
|
2494
|
+
p_organisation_id: organisation_id,
|
|
2495
|
+
p_expires_in: expires_in
|
|
2496
|
+
});
|
|
2497
|
+
if (error) {
|
|
2498
|
+
throw new Error(`Failed to get signed URL: ${error.message}`);
|
|
2499
|
+
}
|
|
2500
|
+
return data;
|
|
2501
|
+
} catch (error) {
|
|
2502
|
+
console.error("Error getting signed URL:", error);
|
|
2503
|
+
throw error;
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
async updateFileReference(id, updates) {
|
|
2507
|
+
try {
|
|
2508
|
+
const { data, error } = await this.supabase.from("file_references").update(updates).eq("id", id).select().single();
|
|
2509
|
+
if (error) {
|
|
2510
|
+
throw new Error(`Failed to update file reference: ${error.message}`);
|
|
2511
|
+
}
|
|
2512
|
+
return data;
|
|
2513
|
+
} catch (error) {
|
|
2514
|
+
console.error("Error updating file reference:", error);
|
|
2515
|
+
throw error;
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
async deleteFileReference(table_name, record_id, organisation_id, delete_file = false) {
|
|
2519
|
+
try {
|
|
2520
|
+
const { error } = await this.supabase.rpc("delete_file_reference", {
|
|
2521
|
+
p_table_name: table_name,
|
|
2522
|
+
p_record_id: record_id,
|
|
2523
|
+
p_organisation_id: organisation_id,
|
|
2524
|
+
p_delete_file: delete_file
|
|
2525
|
+
});
|
|
2526
|
+
if (error) {
|
|
2527
|
+
throw new Error(`Failed to delete file reference: ${error.message}`);
|
|
2528
|
+
}
|
|
2529
|
+
return true;
|
|
2530
|
+
} catch (error) {
|
|
2531
|
+
console.error("Error deleting file reference:", error);
|
|
2532
|
+
throw error;
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
async listFileReferences(table_name, record_id, organisation_id) {
|
|
2536
|
+
try {
|
|
2537
|
+
const { data, error } = await this.supabase.rpc("get_record_files", {
|
|
2538
|
+
p_table_name: table_name,
|
|
2539
|
+
p_record_id: record_id,
|
|
2540
|
+
p_organisation_id: organisation_id
|
|
2541
|
+
});
|
|
2542
|
+
if (error) {
|
|
2543
|
+
throw new Error(`Failed to list file references: ${error.message}`);
|
|
2544
|
+
}
|
|
2545
|
+
return data;
|
|
2546
|
+
} catch (error) {
|
|
2547
|
+
console.error("Error listing file references:", error);
|
|
2548
|
+
throw error;
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
async getFileCount(table_name, record_id, organisation_id) {
|
|
2552
|
+
try {
|
|
2553
|
+
const { data, error } = await this.supabase.rpc("get_record_file_count", {
|
|
2554
|
+
p_table_name: table_name,
|
|
2555
|
+
p_record_id: record_id,
|
|
2556
|
+
p_organisation_id: organisation_id
|
|
2557
|
+
});
|
|
2558
|
+
if (error) {
|
|
2559
|
+
throw new Error(`Failed to get file count: ${error.message}`);
|
|
2560
|
+
}
|
|
2561
|
+
return data || 0;
|
|
2562
|
+
} catch (error) {
|
|
2563
|
+
console.error("Error getting file count:", error);
|
|
2564
|
+
throw error;
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
};
|
|
2568
|
+
function createFileReferenceService(supabase) {
|
|
2569
|
+
return new FileReferenceServiceImpl(supabase);
|
|
2570
|
+
}
|
|
2571
|
+
async function uploadFileWithReference(supabase, options, file) {
|
|
2572
|
+
const service = createFileReferenceService(supabase);
|
|
2573
|
+
const fileReference = await service.createFileReference(options, file);
|
|
2574
|
+
const fileUrl = options.is_public ? getPublicUrl(supabase, fileReference.file_path) : await getSignedUrl(supabase, fileReference.file_path, {
|
|
2575
|
+
appName: "file-reference",
|
|
2576
|
+
orgId: options.organisation_id,
|
|
2577
|
+
expiresIn: 3600
|
|
2578
|
+
});
|
|
2579
|
+
const urlString = typeof fileUrl === "string" ? fileUrl : fileUrl?.url || "";
|
|
2580
|
+
return {
|
|
2581
|
+
file_reference: fileReference,
|
|
2582
|
+
file_url: urlString,
|
|
2583
|
+
signed_url: options.is_public ? void 0 : urlString || void 0
|
|
2584
|
+
};
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
// src/hooks/useFileReference.ts
|
|
2588
|
+
function useFileReference(supabase) {
|
|
2589
|
+
const [isLoading, setIsLoading] = useState10(false);
|
|
2590
|
+
const [error, setError] = useState10(null);
|
|
2591
|
+
const service = createFileReferenceService(supabase);
|
|
2592
|
+
const uploadFile2 = useCallback6(async (options, file) => {
|
|
2593
|
+
setIsLoading(true);
|
|
2594
|
+
setError(null);
|
|
2595
|
+
try {
|
|
2596
|
+
const result = await uploadFileWithReference(supabase, options, file);
|
|
2597
|
+
return result;
|
|
2598
|
+
} catch (err) {
|
|
2599
|
+
const errorMessage = err instanceof Error ? err.message : "Upload failed";
|
|
2600
|
+
setError(errorMessage);
|
|
2601
|
+
return null;
|
|
2602
|
+
} finally {
|
|
2603
|
+
setIsLoading(false);
|
|
2604
|
+
}
|
|
2605
|
+
}, [supabase]);
|
|
2606
|
+
const getFileReference = useCallback6(async (table_name, record_id, organisation_id) => {
|
|
2607
|
+
setIsLoading(true);
|
|
2608
|
+
setError(null);
|
|
2609
|
+
try {
|
|
2610
|
+
return await service.getFileReference(table_name, record_id, organisation_id);
|
|
2611
|
+
} catch (err) {
|
|
2612
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to get file reference";
|
|
2613
|
+
setError(errorMessage);
|
|
2614
|
+
return null;
|
|
2615
|
+
} finally {
|
|
2616
|
+
setIsLoading(false);
|
|
2617
|
+
}
|
|
2618
|
+
}, [service]);
|
|
2619
|
+
const getFileUrl = useCallback6(async (table_name, record_id, organisation_id) => {
|
|
2620
|
+
setIsLoading(true);
|
|
2621
|
+
setError(null);
|
|
2622
|
+
try {
|
|
2623
|
+
return await service.getFileUrl(table_name, record_id, organisation_id);
|
|
2624
|
+
} catch (err) {
|
|
2625
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to get file URL";
|
|
2626
|
+
setError(errorMessage);
|
|
2627
|
+
return null;
|
|
2628
|
+
} finally {
|
|
2629
|
+
setIsLoading(false);
|
|
2630
|
+
}
|
|
2631
|
+
}, [service]);
|
|
2632
|
+
const getSignedUrl2 = useCallback6(async (table_name, record_id, organisation_id, expires_in) => {
|
|
2633
|
+
setIsLoading(true);
|
|
2634
|
+
setError(null);
|
|
2635
|
+
try {
|
|
2636
|
+
return await service.getSignedUrl(table_name, record_id, organisation_id, expires_in);
|
|
2637
|
+
} catch (err) {
|
|
2638
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to get signed URL";
|
|
2639
|
+
setError(errorMessage);
|
|
2640
|
+
return null;
|
|
2641
|
+
} finally {
|
|
2642
|
+
setIsLoading(false);
|
|
2643
|
+
}
|
|
2644
|
+
}, [service]);
|
|
2645
|
+
const updateFileReference = useCallback6(async (id, updates) => {
|
|
2646
|
+
setIsLoading(true);
|
|
2647
|
+
setError(null);
|
|
2648
|
+
try {
|
|
2649
|
+
return await service.updateFileReference(id, updates);
|
|
2650
|
+
} catch (err) {
|
|
2651
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to update file reference";
|
|
2652
|
+
setError(errorMessage);
|
|
2653
|
+
return null;
|
|
2654
|
+
} finally {
|
|
2655
|
+
setIsLoading(false);
|
|
2656
|
+
}
|
|
2657
|
+
}, [service]);
|
|
2658
|
+
const deleteFileReference = useCallback6(async (table_name, record_id, organisation_id, delete_file) => {
|
|
2659
|
+
setIsLoading(true);
|
|
2660
|
+
setError(null);
|
|
2661
|
+
try {
|
|
2662
|
+
return await service.deleteFileReference(table_name, record_id, organisation_id, delete_file);
|
|
2663
|
+
} catch (err) {
|
|
2664
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to delete file reference";
|
|
2665
|
+
setError(errorMessage);
|
|
2666
|
+
return false;
|
|
2667
|
+
} finally {
|
|
2668
|
+
setIsLoading(false);
|
|
2669
|
+
}
|
|
2670
|
+
}, [service]);
|
|
2671
|
+
const listFileReferences = useCallback6(async (table_name, record_id, organisation_id) => {
|
|
2672
|
+
setIsLoading(true);
|
|
2673
|
+
setError(null);
|
|
2674
|
+
try {
|
|
2675
|
+
return await service.listFileReferences(table_name, record_id, organisation_id);
|
|
2676
|
+
} catch (err) {
|
|
2677
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to list file references";
|
|
2678
|
+
setError(errorMessage);
|
|
2679
|
+
return [];
|
|
2680
|
+
} finally {
|
|
2681
|
+
setIsLoading(false);
|
|
2682
|
+
}
|
|
2683
|
+
}, [service]);
|
|
2684
|
+
const getFileCount = useCallback6(async (table_name, record_id, organisation_id) => {
|
|
2685
|
+
setIsLoading(true);
|
|
2686
|
+
setError(null);
|
|
2687
|
+
try {
|
|
2688
|
+
return await service.getFileCount(table_name, record_id, organisation_id);
|
|
2689
|
+
} catch (err) {
|
|
2690
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to get file count";
|
|
2691
|
+
setError(errorMessage);
|
|
2692
|
+
return 0;
|
|
2693
|
+
} finally {
|
|
2694
|
+
setIsLoading(false);
|
|
2695
|
+
}
|
|
2696
|
+
}, [service]);
|
|
2697
|
+
const clearError = useCallback6(() => {
|
|
2698
|
+
setError(null);
|
|
2699
|
+
}, []);
|
|
2700
|
+
return {
|
|
2701
|
+
isLoading,
|
|
2702
|
+
error,
|
|
2703
|
+
uploadFile: uploadFile2,
|
|
2704
|
+
getFileReference,
|
|
2705
|
+
getFileUrl,
|
|
2706
|
+
getSignedUrl: getSignedUrl2,
|
|
2707
|
+
updateFileReference,
|
|
2708
|
+
deleteFileReference,
|
|
2709
|
+
listFileReferences,
|
|
2710
|
+
getFileCount,
|
|
2711
|
+
clearError
|
|
2712
|
+
};
|
|
2713
|
+
}
|
|
2714
|
+
function useFileReferenceForRecord(supabase, table_name, record_id, organisation_id) {
|
|
2715
|
+
const {
|
|
2716
|
+
isLoading,
|
|
2717
|
+
error,
|
|
2718
|
+
getFileUrl,
|
|
2719
|
+
getFileReference,
|
|
2720
|
+
updateFileReference,
|
|
2721
|
+
deleteFileReference,
|
|
2722
|
+
listFileReferences,
|
|
2723
|
+
getFileCount,
|
|
2724
|
+
clearError
|
|
2725
|
+
} = useFileReference(supabase);
|
|
2726
|
+
const [fileUrl, setFileUrl] = useState10(null);
|
|
2727
|
+
const [fileReference, setFileReference] = useState10(null);
|
|
2728
|
+
const [fileReferences, setFileReferences] = useState10([]);
|
|
2729
|
+
const [fileCount, setFileCount] = useState10(0);
|
|
2730
|
+
const loadFileReference = useCallback6(async () => {
|
|
2731
|
+
const reference = await getFileReference(table_name, record_id, organisation_id);
|
|
2732
|
+
setFileReference(reference);
|
|
2733
|
+
return reference;
|
|
2734
|
+
}, [getFileReference, table_name, record_id, organisation_id]);
|
|
2735
|
+
const loadFileUrl = useCallback6(async () => {
|
|
2736
|
+
const url = await getFileUrl(table_name, record_id, organisation_id);
|
|
2737
|
+
setFileUrl(url);
|
|
2738
|
+
return url;
|
|
2739
|
+
}, [getFileUrl, table_name, record_id, organisation_id]);
|
|
2740
|
+
const loadFileReferences = useCallback6(async () => {
|
|
2741
|
+
const references = await listFileReferences(table_name, record_id, organisation_id);
|
|
2742
|
+
setFileReferences(references);
|
|
2743
|
+
return references;
|
|
2744
|
+
}, [listFileReferences, table_name, record_id, organisation_id]);
|
|
2745
|
+
const loadFileCount = useCallback6(async () => {
|
|
2746
|
+
const count = await getFileCount(table_name, record_id, organisation_id);
|
|
2747
|
+
setFileCount(count);
|
|
2748
|
+
return count;
|
|
2749
|
+
}, [getFileCount, table_name, record_id, organisation_id]);
|
|
2750
|
+
const deleteFile2 = useCallback6(async (delete_file) => {
|
|
2751
|
+
const success = await deleteFileReference(table_name, record_id, organisation_id, delete_file);
|
|
2752
|
+
if (success) {
|
|
2753
|
+
setFileReference(null);
|
|
2754
|
+
setFileUrl(null);
|
|
2755
|
+
await loadFileCount();
|
|
2756
|
+
}
|
|
2757
|
+
return success;
|
|
2758
|
+
}, [deleteFileReference, table_name, record_id, organisation_id, loadFileCount]);
|
|
2759
|
+
return {
|
|
2760
|
+
isLoading,
|
|
2761
|
+
error,
|
|
2762
|
+
fileUrl,
|
|
2763
|
+
fileReference,
|
|
2764
|
+
fileReferences,
|
|
2765
|
+
fileCount,
|
|
2766
|
+
loadFileReference,
|
|
2767
|
+
loadFileUrl,
|
|
2768
|
+
loadFileReferences,
|
|
2769
|
+
loadFileCount,
|
|
2770
|
+
deleteFile: deleteFile2,
|
|
2771
|
+
updateFileReference,
|
|
2772
|
+
clearError
|
|
2773
|
+
};
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
// src/components/FileDisplay.tsx
|
|
2777
|
+
import { useState as useState11, useEffect as useEffect5 } from "react";
|
|
2778
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2779
|
+
function FileDisplay({
|
|
2780
|
+
supabase,
|
|
2781
|
+
table_name,
|
|
2782
|
+
record_id,
|
|
2783
|
+
organisation_id,
|
|
2784
|
+
category,
|
|
2785
|
+
showUpload = false,
|
|
2786
|
+
showDelete = false,
|
|
2787
|
+
className = "",
|
|
2788
|
+
children
|
|
2789
|
+
}) {
|
|
2790
|
+
const {
|
|
2791
|
+
isLoading,
|
|
2792
|
+
error,
|
|
2793
|
+
fileUrl,
|
|
2794
|
+
fileReference,
|
|
2795
|
+
fileReferences,
|
|
2796
|
+
fileCount,
|
|
2797
|
+
loadFileReference,
|
|
2798
|
+
loadFileUrl,
|
|
2799
|
+
loadFileReferences,
|
|
2800
|
+
loadFileCount,
|
|
2801
|
+
deleteFile: deleteFile2,
|
|
2802
|
+
clearError
|
|
2803
|
+
} = useFileReferenceForRecord(supabase, table_name, record_id, organisation_id);
|
|
2804
|
+
const [imageError, setImageError] = useState11(false);
|
|
2805
|
+
useEffect5(() => {
|
|
2806
|
+
loadFileCount();
|
|
2807
|
+
if (category) {
|
|
2808
|
+
loadFileReference();
|
|
2809
|
+
} else {
|
|
2810
|
+
loadFileReferences();
|
|
2811
|
+
}
|
|
2812
|
+
}, [loadFileCount, loadFileReference, loadFileReferences, category]);
|
|
2813
|
+
useEffect5(() => {
|
|
2814
|
+
if (fileReference) {
|
|
2815
|
+
loadFileUrl();
|
|
2816
|
+
}
|
|
2817
|
+
}, [fileReference, loadFileUrl]);
|
|
2818
|
+
const handleDelete = async () => {
|
|
2819
|
+
if (window.confirm("Are you sure you want to delete this file?")) {
|
|
2820
|
+
const success = await deleteFile2(true);
|
|
2821
|
+
if (success) {
|
|
2822
|
+
setImageError(false);
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
};
|
|
2826
|
+
const handleImageError = () => {
|
|
2827
|
+
setImageError(true);
|
|
2828
|
+
};
|
|
2829
|
+
const getFileIcon = (fileType) => {
|
|
2830
|
+
if (fileType.startsWith("image/")) return "\u{1F5BC}\uFE0F";
|
|
2831
|
+
if (fileType.startsWith("video/")) return "\u{1F3A5}";
|
|
2832
|
+
if (fileType.startsWith("audio/")) return "\u{1F3B5}";
|
|
2833
|
+
if (fileType.includes("pdf")) return "\u{1F4C4}";
|
|
2834
|
+
if (fileType.includes("word")) return "\u{1F4DD}";
|
|
2835
|
+
if (fileType.includes("excel") || fileType.includes("spreadsheet")) return "\u{1F4CA}";
|
|
2836
|
+
if (fileType.includes("powerpoint") || fileType.includes("presentation")) return "\u{1F4CA}";
|
|
2837
|
+
return "\u{1F4C1}";
|
|
2838
|
+
};
|
|
2839
|
+
const formatFileSize2 = (bytes) => {
|
|
2840
|
+
if (bytes === 0) return "0 Bytes";
|
|
2841
|
+
const k = 1024;
|
|
2842
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
2843
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
2844
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
2845
|
+
};
|
|
2846
|
+
if (isLoading) {
|
|
2847
|
+
return /* @__PURE__ */ jsx19("div", { className: `flex items-center justify-center p-4 ${className}`, children: /* @__PURE__ */ jsx19("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-main-500" }) });
|
|
2848
|
+
}
|
|
2849
|
+
if (error) {
|
|
2850
|
+
return /* @__PURE__ */ jsxs15("div", { className: `p-4 bg-acc-50 border border-acc-200 rounded-lg ${className}`, children: [
|
|
2851
|
+
/* @__PURE__ */ jsxs15("div", { className: "text-acc-600", children: [
|
|
2852
|
+
"Error loading file: ",
|
|
2853
|
+
error
|
|
2854
|
+
] }),
|
|
2855
|
+
/* @__PURE__ */ jsx19(
|
|
2856
|
+
"button",
|
|
2857
|
+
{
|
|
2858
|
+
onClick: clearError,
|
|
2859
|
+
className: "mt-2 text-sm text-acc-700 hover:text-acc-800 underline",
|
|
2860
|
+
children: "Try again"
|
|
2861
|
+
}
|
|
2862
|
+
)
|
|
2863
|
+
] });
|
|
2864
|
+
}
|
|
2865
|
+
if (fileCount === 0) {
|
|
2866
|
+
return /* @__PURE__ */ jsxs15("div", { className: `text-sec-500 text-center p-4 ${className}`, children: [
|
|
2867
|
+
"No files found",
|
|
2868
|
+
children
|
|
2869
|
+
] });
|
|
2870
|
+
}
|
|
2871
|
+
if (category && fileReference) {
|
|
2872
|
+
const isImage = fileReference.file_metadata.fileType?.startsWith("image/");
|
|
2873
|
+
return /* @__PURE__ */ jsxs15("div", { className: `space-y-2 ${className}`, children: [
|
|
2874
|
+
isImage && fileUrl && !imageError ? /* @__PURE__ */ jsxs15("div", { className: "relative", children: [
|
|
2875
|
+
/* @__PURE__ */ jsx19(
|
|
2876
|
+
"img",
|
|
2877
|
+
{
|
|
2878
|
+
src: fileUrl,
|
|
2879
|
+
alt: fileReference.file_metadata.fileName || "File",
|
|
2880
|
+
className: "max-w-full h-auto rounded-lg border border-sec-200",
|
|
2881
|
+
onError: handleImageError
|
|
2882
|
+
}
|
|
2883
|
+
),
|
|
2884
|
+
showDelete && /* @__PURE__ */ jsx19(
|
|
2885
|
+
"button",
|
|
2886
|
+
{
|
|
2887
|
+
onClick: handleDelete,
|
|
2888
|
+
className: "absolute top-2 right-2 bg-acc-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-sm hover:bg-acc-600",
|
|
2889
|
+
title: "Delete file",
|
|
2890
|
+
children: "\xD7"
|
|
2891
|
+
}
|
|
2892
|
+
)
|
|
2893
|
+
] }) : /* @__PURE__ */ jsxs15("div", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
|
|
2894
|
+
/* @__PURE__ */ jsx19("span", { className: "text-2xl", children: getFileIcon(fileReference.file_metadata.fileType || "") }),
|
|
2895
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0", children: [
|
|
2896
|
+
/* @__PURE__ */ jsx19("div", { className: "font-medium text-sec-900 truncate", children: fileReference.file_metadata.fileName || "Unknown file" }),
|
|
2897
|
+
/* @__PURE__ */ jsxs15("div", { className: "text-sm text-sec-500", children: [
|
|
2898
|
+
fileReference.file_metadata.fileSize && formatFileSize2(fileReference.file_metadata.fileSize),
|
|
2899
|
+
fileReference.file_metadata.fileType && ` \u2022 ${fileReference.file_metadata.fileType}`
|
|
2900
|
+
] })
|
|
2901
|
+
] }),
|
|
2902
|
+
showDelete && /* @__PURE__ */ jsx19(
|
|
2903
|
+
"button",
|
|
2904
|
+
{
|
|
2905
|
+
onClick: handleDelete,
|
|
2906
|
+
className: "text-acc-500 hover:text-acc-700 p-1",
|
|
2907
|
+
title: "Delete file",
|
|
2908
|
+
children: "\xD7"
|
|
2909
|
+
}
|
|
2910
|
+
)
|
|
2911
|
+
] }),
|
|
2912
|
+
children
|
|
2913
|
+
] });
|
|
2914
|
+
}
|
|
2915
|
+
return /* @__PURE__ */ jsxs15("div", { className: `space-y-2 ${className}`, children: [
|
|
2916
|
+
fileReferences.map((fileRef) => {
|
|
2917
|
+
const isImage = fileRef.file_metadata.fileType?.startsWith("image/");
|
|
2918
|
+
const fileUrl2 = fileRef.is_public ? `https://your-supabase-url.supabase.co/storage/v1/object/public/files/${fileRef.file_path}` : null;
|
|
2919
|
+
return /* @__PURE__ */ jsxs15("div", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
|
|
2920
|
+
isImage && fileUrl2 ? /* @__PURE__ */ jsx19(
|
|
2921
|
+
"img",
|
|
2922
|
+
{
|
|
2923
|
+
src: fileUrl2,
|
|
2924
|
+
alt: fileRef.file_metadata.fileName || "File",
|
|
2925
|
+
className: "w-12 h-12 object-cover rounded",
|
|
2926
|
+
onError: handleImageError
|
|
2927
|
+
}
|
|
2928
|
+
) : /* @__PURE__ */ jsx19("span", { className: "text-2xl", children: getFileIcon(fileRef.file_metadata.fileType || "") }),
|
|
2929
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0", children: [
|
|
2930
|
+
/* @__PURE__ */ jsx19("div", { className: "font-medium text-sec-900 truncate", children: fileRef.file_metadata.fileName || "Unknown file" }),
|
|
2931
|
+
/* @__PURE__ */ jsxs15("div", { className: "text-sm text-sec-500", children: [
|
|
2932
|
+
fileRef.file_metadata.fileSize && formatFileSize2(fileRef.file_metadata.fileSize),
|
|
2933
|
+
fileRef.file_metadata.fileType && ` \u2022 ${fileRef.file_metadata.fileType}`,
|
|
2934
|
+
fileRef.file_metadata.category && ` \u2022 ${fileRef.file_metadata.category}`
|
|
2935
|
+
] })
|
|
2936
|
+
] }),
|
|
2937
|
+
showDelete && /* @__PURE__ */ jsx19(
|
|
2938
|
+
"button",
|
|
2939
|
+
{
|
|
2940
|
+
onClick: () => deleteFile2(true),
|
|
2941
|
+
className: "text-acc-500 hover:text-acc-700 p-1",
|
|
2942
|
+
title: "Delete file",
|
|
2943
|
+
children: "\xD7"
|
|
2944
|
+
}
|
|
2945
|
+
)
|
|
2946
|
+
] }, fileRef.id);
|
|
2947
|
+
}),
|
|
2948
|
+
children
|
|
2949
|
+
] });
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2399
2952
|
// src/components/Table/Table.tsx
|
|
2400
2953
|
init_cn();
|
|
2401
|
-
import * as
|
|
2402
|
-
import { jsx as
|
|
2403
|
-
var Table =
|
|
2954
|
+
import * as React17 from "react";
|
|
2955
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2956
|
+
var Table = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2404
2957
|
"table",
|
|
2405
2958
|
{
|
|
2406
2959
|
ref,
|
|
@@ -2409,9 +2962,9 @@ var Table = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
2409
2962
|
}
|
|
2410
2963
|
));
|
|
2411
2964
|
Table.displayName = "Table";
|
|
2412
|
-
var TableHeader =
|
|
2965
|
+
var TableHeader = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
2413
2966
|
TableHeader.displayName = "TableHeader";
|
|
2414
|
-
var TableBody =
|
|
2967
|
+
var TableBody = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2415
2968
|
"tbody",
|
|
2416
2969
|
{
|
|
2417
2970
|
ref,
|
|
@@ -2420,7 +2973,7 @@ var TableBody = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
2420
2973
|
}
|
|
2421
2974
|
));
|
|
2422
2975
|
TableBody.displayName = "TableBody";
|
|
2423
|
-
var TableFooter =
|
|
2976
|
+
var TableFooter = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2424
2977
|
"tfoot",
|
|
2425
2978
|
{
|
|
2426
2979
|
ref,
|
|
@@ -2432,7 +2985,7 @@ var TableFooter = React16.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
2432
2985
|
}
|
|
2433
2986
|
));
|
|
2434
2987
|
TableFooter.displayName = "TableFooter";
|
|
2435
|
-
var TableRow =
|
|
2988
|
+
var TableRow = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2436
2989
|
"tr",
|
|
2437
2990
|
{
|
|
2438
2991
|
ref,
|
|
@@ -2444,7 +2997,7 @@ var TableRow = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
2444
2997
|
}
|
|
2445
2998
|
));
|
|
2446
2999
|
TableRow.displayName = "TableRow";
|
|
2447
|
-
var TableHead =
|
|
3000
|
+
var TableHead = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2448
3001
|
"th",
|
|
2449
3002
|
{
|
|
2450
3003
|
ref,
|
|
@@ -2456,7 +3009,7 @@ var TableHead = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
2456
3009
|
}
|
|
2457
3010
|
));
|
|
2458
3011
|
TableHead.displayName = "TableHead";
|
|
2459
|
-
var TableCell =
|
|
3012
|
+
var TableCell = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2460
3013
|
"td",
|
|
2461
3014
|
{
|
|
2462
3015
|
ref,
|
|
@@ -2465,7 +3018,7 @@ var TableCell = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
2465
3018
|
}
|
|
2466
3019
|
));
|
|
2467
3020
|
TableCell.displayName = "TableCell";
|
|
2468
|
-
var TableCaption =
|
|
3021
|
+
var TableCaption = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2469
3022
|
"caption",
|
|
2470
3023
|
{
|
|
2471
3024
|
ref,
|
|
@@ -2477,7 +3030,7 @@ TableCaption.displayName = "TableCaption";
|
|
|
2477
3030
|
|
|
2478
3031
|
// src/components/PublicLayout/EventLogo.tsx
|
|
2479
3032
|
import { useMemo as useMemo6 } from "react";
|
|
2480
|
-
import { jsx as
|
|
3033
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2481
3034
|
var sizeClasses = {
|
|
2482
3035
|
xs: "h-4 w-4 text-xs",
|
|
2483
3036
|
sm: "h-6 w-6 text-sm",
|
|
@@ -2522,7 +3075,7 @@ function EventLogo({
|
|
|
2522
3075
|
const hasValidOrganisationId = organisationId && uuidRegex.test(organisationId);
|
|
2523
3076
|
const { supabase } = usePublicPageContext();
|
|
2524
3077
|
if (!supabase) {
|
|
2525
|
-
return /* @__PURE__ */
|
|
3078
|
+
return /* @__PURE__ */ jsx21("div", { className: `${sizeClasses[size]} ${className}`.trim(), title: `${eventName} logo (Supabase not configured)`, children: eventName ? defaultGenerateFallbackText(eventName) : "EV" });
|
|
2526
3079
|
}
|
|
2527
3080
|
const {
|
|
2528
3081
|
logoUrl,
|
|
@@ -2546,30 +3099,30 @@ function EventLogo({
|
|
|
2546
3099
|
return `${baseClasses} ${sizeClass} ${className}`.trim();
|
|
2547
3100
|
}, [sizeClass, className]);
|
|
2548
3101
|
if (!hasValidOrganisationId && !isLoading && !logoUrl && showFallback) {
|
|
2549
|
-
return /* @__PURE__ */
|
|
3102
|
+
return /* @__PURE__ */ jsx21("div", { className: combinedClasses, title: `${eventName} logo (invalid organisation ID)`, children: fallbackText });
|
|
2550
3103
|
}
|
|
2551
3104
|
if (isLoading) {
|
|
2552
3105
|
if (LoadingComponent) {
|
|
2553
|
-
return /* @__PURE__ */
|
|
3106
|
+
return /* @__PURE__ */ jsx21(LoadingComponent, {});
|
|
2554
3107
|
}
|
|
2555
|
-
return /* @__PURE__ */
|
|
3108
|
+
return /* @__PURE__ */ jsx21("div", { className: `${combinedClasses} animate-pulse`, children: /* @__PURE__ */ jsx21("div", { className: "w-3/4 h-3/4 bg-gray-300 rounded" }) });
|
|
2556
3109
|
}
|
|
2557
3110
|
if (error) {
|
|
2558
3111
|
if (ErrorComponent) {
|
|
2559
|
-
return /* @__PURE__ */
|
|
3112
|
+
return /* @__PURE__ */ jsx21(ErrorComponent, { error });
|
|
2560
3113
|
}
|
|
2561
3114
|
if (showFallback) {
|
|
2562
|
-
return /* @__PURE__ */
|
|
3115
|
+
return /* @__PURE__ */ jsx21("div", { className: combinedClasses, title: `${eventName} (logo unavailable)`, children: fallbackText });
|
|
2563
3116
|
}
|
|
2564
3117
|
return null;
|
|
2565
3118
|
}
|
|
2566
3119
|
if (!logoUrl) {
|
|
2567
3120
|
if (showFallback) {
|
|
2568
|
-
return /* @__PURE__ */
|
|
3121
|
+
return /* @__PURE__ */ jsx21("div", { className: combinedClasses, title: `${eventName} logo`, children: fallbackText });
|
|
2569
3122
|
}
|
|
2570
3123
|
return null;
|
|
2571
3124
|
}
|
|
2572
|
-
return /* @__PURE__ */
|
|
3125
|
+
return /* @__PURE__ */ jsx21(
|
|
2573
3126
|
"img",
|
|
2574
3127
|
{
|
|
2575
3128
|
src: logoUrl,
|
|
@@ -2588,7 +3141,7 @@ function EventLogo({
|
|
|
2588
3141
|
);
|
|
2589
3142
|
}
|
|
2590
3143
|
function EventLogoCompact(props) {
|
|
2591
|
-
return /* @__PURE__ */
|
|
3144
|
+
return /* @__PURE__ */ jsx21(
|
|
2592
3145
|
EventLogo,
|
|
2593
3146
|
{
|
|
2594
3147
|
...props,
|
|
@@ -2598,7 +3151,7 @@ function EventLogoCompact(props) {
|
|
|
2598
3151
|
);
|
|
2599
3152
|
}
|
|
2600
3153
|
function EventLogoLarge(props) {
|
|
2601
|
-
return /* @__PURE__ */
|
|
3154
|
+
return /* @__PURE__ */ jsx21(
|
|
2602
3155
|
EventLogo,
|
|
2603
3156
|
{
|
|
2604
3157
|
...props,
|
|
@@ -2609,7 +3162,7 @@ function EventLogoLarge(props) {
|
|
|
2609
3162
|
}
|
|
2610
3163
|
|
|
2611
3164
|
// src/components/PublicLayout/PublicPageHeader.tsx
|
|
2612
|
-
import { Fragment as Fragment5, jsx as
|
|
3165
|
+
import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2613
3166
|
function PublicPageHeader({
|
|
2614
3167
|
event,
|
|
2615
3168
|
eventCode,
|
|
@@ -2624,10 +3177,10 @@ function PublicPageHeader({
|
|
|
2624
3177
|
}) {
|
|
2625
3178
|
const { appName } = useAppConfig();
|
|
2626
3179
|
const headerClasses = `bg-white border-b border-gray-200 ${className}`.trim();
|
|
2627
|
-
return /* @__PURE__ */
|
|
2628
|
-
/* @__PURE__ */
|
|
2629
|
-
showAppLogo && /* @__PURE__ */
|
|
2630
|
-
/* @__PURE__ */
|
|
3180
|
+
return /* @__PURE__ */ jsx22("header", { className: headerClasses, children: /* @__PURE__ */ jsxs16("div", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto", children: [
|
|
3181
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between py-4", children: [
|
|
3182
|
+
showAppLogo && /* @__PURE__ */ jsx22("div", { className: "flex-shrink-0", children: customAppLogo || /* @__PURE__ */ jsxs16("div", { className: "flex items-center", children: [
|
|
3183
|
+
/* @__PURE__ */ jsx22(
|
|
2631
3184
|
"img",
|
|
2632
3185
|
{
|
|
2633
3186
|
className: "h-8 w-auto",
|
|
@@ -2635,9 +3188,9 @@ function PublicPageHeader({
|
|
|
2635
3188
|
alt: appName
|
|
2636
3189
|
}
|
|
2637
3190
|
),
|
|
2638
|
-
/* @__PURE__ */
|
|
3191
|
+
/* @__PURE__ */ jsx22("span", { className: "ml-2 text-lg font-semibold text-gray-900", children: appName })
|
|
2639
3192
|
] }) }),
|
|
2640
|
-
showEventLogo && event && /* @__PURE__ */
|
|
3193
|
+
showEventLogo && event && /* @__PURE__ */ jsx22("div", { className: "flex-shrink-0", children: customEventLogo || /* @__PURE__ */ jsx22(
|
|
2641
3194
|
EventLogo,
|
|
2642
3195
|
{
|
|
2643
3196
|
eventId: event.event_id,
|
|
@@ -2648,23 +3201,23 @@ function PublicPageHeader({
|
|
|
2648
3201
|
}
|
|
2649
3202
|
) })
|
|
2650
3203
|
] }),
|
|
2651
|
-
/* @__PURE__ */
|
|
2652
|
-
event && /* @__PURE__ */
|
|
2653
|
-
/* @__PURE__ */
|
|
2654
|
-
event.event_venue && /* @__PURE__ */
|
|
3204
|
+
/* @__PURE__ */ jsx22("div", { className: "pb-4", children: /* @__PURE__ */ jsxs16("div", { className: "text-center", children: [
|
|
3205
|
+
event && /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
3206
|
+
/* @__PURE__ */ jsx22("h1", { className: "text-3xl font-bold text-gray-900 mb-2", children: event.event_name }),
|
|
3207
|
+
event.event_venue && /* @__PURE__ */ jsx22("p", { className: "text-md text-gray-500 mb-4", children: event.event_venue })
|
|
2655
3208
|
] }),
|
|
2656
|
-
title && /* @__PURE__ */
|
|
2657
|
-
/* @__PURE__ */
|
|
2658
|
-
description && /* @__PURE__ */
|
|
3209
|
+
title && /* @__PURE__ */ jsxs16("div", { className: "mt-6", children: [
|
|
3210
|
+
/* @__PURE__ */ jsx22("h2", { className: "text-2xl font-semibold text-gray-800 mb-2", children: title }),
|
|
3211
|
+
description && /* @__PURE__ */ jsx22("p", { className: "text-lg text-gray-600 max-w-3xl mx-auto", children: description })
|
|
2659
3212
|
] }),
|
|
2660
|
-
children && /* @__PURE__ */
|
|
3213
|
+
children && /* @__PURE__ */ jsx22("div", { className: "mt-4", children })
|
|
2661
3214
|
] }) })
|
|
2662
3215
|
] }) });
|
|
2663
3216
|
}
|
|
2664
3217
|
|
|
2665
3218
|
// src/components/PublicLayout/PublicPageFooter.tsx
|
|
2666
3219
|
init_cn();
|
|
2667
|
-
import { Fragment as Fragment6, jsx as
|
|
3220
|
+
import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2668
3221
|
function PublicPageFooter({
|
|
2669
3222
|
event,
|
|
2670
3223
|
companyName = "Solvera Solutions Pty Ltd",
|
|
@@ -2676,16 +3229,16 @@ function PublicPageFooter({
|
|
|
2676
3229
|
children
|
|
2677
3230
|
}) {
|
|
2678
3231
|
const copyrightText = copyright || `\xA9 Copyright 2022\u2013${year} all rights reserved, ${companyName}.`;
|
|
2679
|
-
return /* @__PURE__ */
|
|
2680
|
-
logo && /* @__PURE__ */
|
|
2681
|
-
children && /* @__PURE__ */
|
|
2682
|
-
/* @__PURE__ */
|
|
2683
|
-
links && links.length > 0 && /* @__PURE__ */
|
|
3232
|
+
return /* @__PURE__ */ jsx23("footer", { className: cn("mt-8 py-6 flex justify-center border-t border-border bg-main-100", className), children: /* @__PURE__ */ jsxs17("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
|
|
3233
|
+
logo && /* @__PURE__ */ jsx23("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
|
|
3234
|
+
children && /* @__PURE__ */ jsx23(Fragment6, { children }),
|
|
3235
|
+
/* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: copyrightText }),
|
|
3236
|
+
links && links.length > 0 && /* @__PURE__ */ jsx23("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx23("li", { children: /* @__PURE__ */ jsx23("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
|
|
2684
3237
|
] }) });
|
|
2685
3238
|
}
|
|
2686
3239
|
|
|
2687
3240
|
// src/components/PublicLayout/PublicLoadingSpinner.tsx
|
|
2688
|
-
import { jsx as
|
|
3241
|
+
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2689
3242
|
var sizeClasses2 = {
|
|
2690
3243
|
sm: "h-4 w-4",
|
|
2691
3244
|
md: "h-8 w-8",
|
|
@@ -2702,8 +3255,8 @@ function PublicLoadingSpinner({
|
|
|
2702
3255
|
}) {
|
|
2703
3256
|
const sizeClass = sizeClasses2[size];
|
|
2704
3257
|
const displayMessage = customMessage || message;
|
|
2705
|
-
const content = /* @__PURE__ */
|
|
2706
|
-
showLogo && /* @__PURE__ */
|
|
3258
|
+
const content = /* @__PURE__ */ jsxs18("div", { className: `flex flex-col items-center ${className}`, children: [
|
|
3259
|
+
showLogo && /* @__PURE__ */ jsx24("div", { className: "mb-4", children: /* @__PURE__ */ jsx24(
|
|
2707
3260
|
"img",
|
|
2708
3261
|
{
|
|
2709
3262
|
className: "h-8 w-auto",
|
|
@@ -2711,8 +3264,8 @@ function PublicLoadingSpinner({
|
|
|
2711
3264
|
alt: "PACE Core"
|
|
2712
3265
|
}
|
|
2713
3266
|
) }),
|
|
2714
|
-
/* @__PURE__ */
|
|
2715
|
-
/* @__PURE__ */
|
|
3267
|
+
/* @__PURE__ */ jsxs18("div", { className: "relative", children: [
|
|
3268
|
+
/* @__PURE__ */ jsx24(
|
|
2716
3269
|
"div",
|
|
2717
3270
|
{
|
|
2718
3271
|
className: `${sizeClass} border-2 border-gray-200 border-t-blue-600 rounded-full animate-spin`,
|
|
@@ -2720,12 +3273,12 @@ function PublicLoadingSpinner({
|
|
|
2720
3273
|
"aria-label": "Loading"
|
|
2721
3274
|
}
|
|
2722
3275
|
),
|
|
2723
|
-
/* @__PURE__ */
|
|
3276
|
+
/* @__PURE__ */ jsx24("span", { className: "sr-only", children: displayMessage })
|
|
2724
3277
|
] }),
|
|
2725
|
-
displayMessage && /* @__PURE__ */
|
|
3278
|
+
displayMessage && /* @__PURE__ */ jsx24("p", { className: "mt-4 text-sm text-gray-600 text-center", children: displayMessage })
|
|
2726
3279
|
] });
|
|
2727
3280
|
if (centered) {
|
|
2728
|
-
return /* @__PURE__ */
|
|
3281
|
+
return /* @__PURE__ */ jsx24("div", { className: "min-h-screen bg-white flex items-center justify-center", children: /* @__PURE__ */ jsx24("div", { className: "max-w-md mx-auto px-4", children: content }) });
|
|
2729
3282
|
}
|
|
2730
3283
|
return content;
|
|
2731
3284
|
}
|
|
@@ -2734,8 +3287,8 @@ function PublicLoadingSpinnerFullPage({
|
|
|
2734
3287
|
eventName,
|
|
2735
3288
|
className = ""
|
|
2736
3289
|
}) {
|
|
2737
|
-
return /* @__PURE__ */
|
|
2738
|
-
/* @__PURE__ */
|
|
3290
|
+
return /* @__PURE__ */ jsx24("div", { className: `min-h-screen bg-white flex items-center justify-center ${className}`, children: /* @__PURE__ */ jsxs18("div", { className: "max-w-md mx-auto text-center px-4", children: [
|
|
3291
|
+
/* @__PURE__ */ jsx24("div", { className: "mb-8", children: /* @__PURE__ */ jsx24(
|
|
2739
3292
|
"img",
|
|
2740
3293
|
{
|
|
2741
3294
|
className: "h-12 w-auto mx-auto",
|
|
@@ -2743,8 +3296,8 @@ function PublicLoadingSpinnerFullPage({
|
|
|
2743
3296
|
alt: "PACE Core"
|
|
2744
3297
|
}
|
|
2745
3298
|
) }),
|
|
2746
|
-
eventName && /* @__PURE__ */
|
|
2747
|
-
/* @__PURE__ */
|
|
3299
|
+
eventName && /* @__PURE__ */ jsx24("h1", { className: "text-2xl font-bold text-gray-900 mb-4", children: eventName }),
|
|
3300
|
+
/* @__PURE__ */ jsx24("div", { className: "relative mb-6", children: /* @__PURE__ */ jsx24(
|
|
2748
3301
|
"div",
|
|
2749
3302
|
{
|
|
2750
3303
|
className: "h-12 w-12 border-4 border-gray-200 border-t-blue-600 rounded-full animate-spin mx-auto",
|
|
@@ -2752,11 +3305,11 @@ function PublicLoadingSpinnerFullPage({
|
|
|
2752
3305
|
"aria-label": "Loading"
|
|
2753
3306
|
}
|
|
2754
3307
|
) }),
|
|
2755
|
-
/* @__PURE__ */
|
|
2756
|
-
/* @__PURE__ */
|
|
2757
|
-
/* @__PURE__ */
|
|
2758
|
-
/* @__PURE__ */
|
|
2759
|
-
/* @__PURE__ */
|
|
3308
|
+
/* @__PURE__ */ jsx24("p", { className: "text-lg text-gray-600", children: message }),
|
|
3309
|
+
/* @__PURE__ */ jsxs18("div", { className: "mt-4 flex justify-center space-x-1", children: [
|
|
3310
|
+
/* @__PURE__ */ jsx24("div", { className: "h-2 w-2 bg-blue-600 rounded-full animate-bounce", style: { animationDelay: "0ms" } }),
|
|
3311
|
+
/* @__PURE__ */ jsx24("div", { className: "h-2 w-2 bg-blue-600 rounded-full animate-bounce", style: { animationDelay: "150ms" } }),
|
|
3312
|
+
/* @__PURE__ */ jsx24("div", { className: "h-2 w-2 bg-blue-600 rounded-full animate-bounce", style: { animationDelay: "300ms" } })
|
|
2760
3313
|
] })
|
|
2761
3314
|
] }) });
|
|
2762
3315
|
}
|
|
@@ -2764,7 +3317,7 @@ function PublicLoadingSkeleton({
|
|
|
2764
3317
|
lines = 3,
|
|
2765
3318
|
className = ""
|
|
2766
3319
|
}) {
|
|
2767
|
-
return /* @__PURE__ */
|
|
3320
|
+
return /* @__PURE__ */ jsx24("div", { className: `animate-pulse ${className}`, children: Array.from({ length: lines }).map((_, index) => /* @__PURE__ */ jsx24(
|
|
2768
3321
|
"div",
|
|
2769
3322
|
{
|
|
2770
3323
|
className: `h-4 bg-gray-200 rounded mb-2 ${index === lines - 1 ? "w-3/4" : "w-full"}`
|
|
@@ -2775,7 +3328,7 @@ function PublicLoadingSkeleton({
|
|
|
2775
3328
|
|
|
2776
3329
|
// src/components/PublicLayout/PublicPageLayout.tsx
|
|
2777
3330
|
import { useMemo as useMemo7 } from "react";
|
|
2778
|
-
import { jsx as
|
|
3331
|
+
import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2779
3332
|
function PublicPageLayout({
|
|
2780
3333
|
eventCode,
|
|
2781
3334
|
children,
|
|
@@ -2797,17 +3350,17 @@ function PublicPageLayout({
|
|
|
2797
3350
|
return `${baseClasses} ${className}`.trim();
|
|
2798
3351
|
}, [className]);
|
|
2799
3352
|
if (isLoading) {
|
|
2800
|
-
return /* @__PURE__ */
|
|
3353
|
+
return /* @__PURE__ */ jsx25("div", { className: layoutClasses, children: /* @__PURE__ */ jsx25("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsx25(LoadingFallback, {}) }) });
|
|
2801
3354
|
}
|
|
2802
3355
|
if (error && showValidationErrors) {
|
|
2803
|
-
return /* @__PURE__ */
|
|
2804
|
-
/* @__PURE__ */
|
|
2805
|
-
/* @__PURE__ */
|
|
3356
|
+
return /* @__PURE__ */ jsx25("div", { className: layoutClasses, children: /* @__PURE__ */ jsx25("div", { className: "flex-1 flex items-center justify-center", children: ErrorFallback ? /* @__PURE__ */ jsx25(ErrorFallback, { error, retry: refetch }) : /* @__PURE__ */ jsxs19("div", { className: "text-center p-8", children: [
|
|
3357
|
+
/* @__PURE__ */ jsx25("h1", { className: "text-2xl font-bold text-gray-900 mb-4", children: "Event Not Found" }),
|
|
3358
|
+
/* @__PURE__ */ jsxs19("p", { className: "text-gray-600 mb-6", children: [
|
|
2806
3359
|
'The event code "',
|
|
2807
3360
|
eventCode,
|
|
2808
3361
|
'" is invalid or the event is not available for public viewing.'
|
|
2809
3362
|
] }),
|
|
2810
|
-
/* @__PURE__ */
|
|
3363
|
+
/* @__PURE__ */ jsx25(
|
|
2811
3364
|
"button",
|
|
2812
3365
|
{
|
|
2813
3366
|
onClick: refetch,
|
|
@@ -2818,10 +3371,10 @@ function PublicPageLayout({
|
|
|
2818
3371
|
] }) }) });
|
|
2819
3372
|
}
|
|
2820
3373
|
if (!event) {
|
|
2821
|
-
return /* @__PURE__ */
|
|
2822
|
-
/* @__PURE__ */
|
|
2823
|
-
/* @__PURE__ */
|
|
2824
|
-
/* @__PURE__ */
|
|
3374
|
+
return /* @__PURE__ */ jsx25("div", { className: layoutClasses, children: /* @__PURE__ */ jsx25("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsxs19("div", { className: "text-center p-8", children: [
|
|
3375
|
+
/* @__PURE__ */ jsx25("h1", { className: "text-2xl font-bold text-gray-900 mb-4", children: "Event Not Available" }),
|
|
3376
|
+
/* @__PURE__ */ jsx25("p", { className: "text-gray-600 mb-6", children: "This event is not available for public viewing." }),
|
|
3377
|
+
/* @__PURE__ */ jsx25(
|
|
2825
3378
|
"button",
|
|
2826
3379
|
{
|
|
2827
3380
|
onClick: refetch,
|
|
@@ -2831,16 +3384,16 @@ function PublicPageLayout({
|
|
|
2831
3384
|
)
|
|
2832
3385
|
] }) }) });
|
|
2833
3386
|
}
|
|
2834
|
-
return /* @__PURE__ */
|
|
2835
|
-
customHeader || /* @__PURE__ */
|
|
3387
|
+
return /* @__PURE__ */ jsx25(PublicErrorBoundary, { children: /* @__PURE__ */ jsxs19("div", { className: layoutClasses, children: [
|
|
3388
|
+
customHeader || /* @__PURE__ */ jsx25(
|
|
2836
3389
|
PublicPageHeader,
|
|
2837
3390
|
{
|
|
2838
3391
|
event,
|
|
2839
3392
|
eventCode
|
|
2840
3393
|
}
|
|
2841
3394
|
),
|
|
2842
|
-
/* @__PURE__ */
|
|
2843
|
-
showFooter && (customFooter || /* @__PURE__ */
|
|
3395
|
+
/* @__PURE__ */ jsx25("main", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children }),
|
|
3396
|
+
showFooter && (customFooter || /* @__PURE__ */ jsx25(PublicPageFooter, { event }))
|
|
2844
3397
|
] }) });
|
|
2845
3398
|
}
|
|
2846
3399
|
function usePublicPageContext2() {
|
|
@@ -2857,10 +3410,10 @@ function usePublicPageContext2() {
|
|
|
2857
3410
|
}
|
|
2858
3411
|
|
|
2859
3412
|
// src/components/PublicLayout/PublicPageDebugger.tsx
|
|
2860
|
-
import { useEffect as
|
|
2861
|
-
import { jsx as
|
|
3413
|
+
import { useEffect as useEffect6 } from "react";
|
|
3414
|
+
import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2862
3415
|
function PublicPageDebugger({ enabled = true, label = "PublicPage" }) {
|
|
2863
|
-
|
|
3416
|
+
useEffect6(() => {
|
|
2864
3417
|
if (!enabled) return;
|
|
2865
3418
|
console.log(`[${label}] Component mounted`);
|
|
2866
3419
|
try {
|
|
@@ -2901,7 +3454,7 @@ function PublicPageDebugger({ enabled = true, label = "PublicPage" }) {
|
|
|
2901
3454
|
};
|
|
2902
3455
|
}, [enabled, label]);
|
|
2903
3456
|
if (!enabled) return null;
|
|
2904
|
-
return /* @__PURE__ */
|
|
3457
|
+
return /* @__PURE__ */ jsxs20("div", { style: {
|
|
2905
3458
|
position: "fixed",
|
|
2906
3459
|
top: 0,
|
|
2907
3460
|
right: 0,
|
|
@@ -2912,16 +3465,16 @@ function PublicPageDebugger({ enabled = true, label = "PublicPage" }) {
|
|
|
2912
3465
|
zIndex: 9999,
|
|
2913
3466
|
fontFamily: "monospace"
|
|
2914
3467
|
}, children: [
|
|
2915
|
-
/* @__PURE__ */
|
|
2916
|
-
/* @__PURE__ */
|
|
3468
|
+
/* @__PURE__ */ jsx26("div", { children: "Public Page Debugger" }),
|
|
3469
|
+
/* @__PURE__ */ jsx26("div", { children: "Check console for context analysis" })
|
|
2917
3470
|
] });
|
|
2918
3471
|
}
|
|
2919
3472
|
|
|
2920
3473
|
// src/components/PublicLayout/PublicPageDiagnostic.tsx
|
|
2921
|
-
import { useEffect as
|
|
2922
|
-
import { jsx as
|
|
3474
|
+
import { useEffect as useEffect7, useState as useState12 } from "react";
|
|
3475
|
+
import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2923
3476
|
function PublicPageDiagnostic({ enabled = true, label = "PublicPage" }) {
|
|
2924
|
-
const [diagnostics, setDiagnostics] =
|
|
3477
|
+
const [diagnostics, setDiagnostics] = useState12({
|
|
2925
3478
|
hasPublicPageContext: false,
|
|
2926
3479
|
hasAuthContext: false,
|
|
2927
3480
|
hasOrgContext: false,
|
|
@@ -2929,7 +3482,7 @@ function PublicPageDiagnostic({ enabled = true, label = "PublicPage" }) {
|
|
|
2929
3482
|
hasEnvironmentVars: false,
|
|
2930
3483
|
routeParams: null
|
|
2931
3484
|
});
|
|
2932
|
-
|
|
3485
|
+
useEffect7(() => {
|
|
2933
3486
|
if (!enabled) return;
|
|
2934
3487
|
const runDiagnostics = () => {
|
|
2935
3488
|
const newDiagnostics = {
|
|
@@ -3000,7 +3553,7 @@ function PublicPageDiagnostic({ enabled = true, label = "PublicPage" }) {
|
|
|
3000
3553
|
runDiagnostics();
|
|
3001
3554
|
}, [enabled, label]);
|
|
3002
3555
|
if (!enabled) return null;
|
|
3003
|
-
return /* @__PURE__ */
|
|
3556
|
+
return /* @__PURE__ */ jsxs21("div", { style: {
|
|
3004
3557
|
position: "fixed",
|
|
3005
3558
|
top: 0,
|
|
3006
3559
|
left: 0,
|
|
@@ -3013,40 +3566,40 @@ function PublicPageDiagnostic({ enabled = true, label = "PublicPage" }) {
|
|
|
3013
3566
|
maxWidth: "300px",
|
|
3014
3567
|
borderRadius: "0 0 8px 0"
|
|
3015
3568
|
}, children: [
|
|
3016
|
-
/* @__PURE__ */
|
|
3017
|
-
/* @__PURE__ */
|
|
3569
|
+
/* @__PURE__ */ jsx27("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: "\u{1F50D} Public Page Diagnostics" }),
|
|
3570
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
3018
3571
|
"Public Context: ",
|
|
3019
3572
|
diagnostics.hasPublicPageContext ? "\u2705" : "\u274C"
|
|
3020
3573
|
] }),
|
|
3021
|
-
/* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
3022
3575
|
"Auth Context: ",
|
|
3023
3576
|
diagnostics.hasAuthContext ? "\u274C BAD" : "\u2705 GOOD"
|
|
3024
3577
|
] }),
|
|
3025
|
-
/* @__PURE__ */
|
|
3578
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
3026
3579
|
"Org Context: ",
|
|
3027
3580
|
diagnostics.hasOrgContext ? "\u274C BAD" : "\u2705 GOOD"
|
|
3028
3581
|
] }),
|
|
3029
|
-
/* @__PURE__ */
|
|
3582
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
3030
3583
|
"Event Context: ",
|
|
3031
3584
|
diagnostics.hasEventContext ? "\u274C BAD" : "\u2705 GOOD"
|
|
3032
3585
|
] }),
|
|
3033
|
-
/* @__PURE__ */
|
|
3586
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
3034
3587
|
"Env Vars: ",
|
|
3035
3588
|
diagnostics.hasEnvironmentVars ? "\u2705" : "\u274C"
|
|
3036
3589
|
] }),
|
|
3037
|
-
/* @__PURE__ */
|
|
3590
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
3038
3591
|
"Route Params: ",
|
|
3039
3592
|
diagnostics.routeParams ? "\u2705" : "\u274C"
|
|
3040
3593
|
] }),
|
|
3041
|
-
/* @__PURE__ */
|
|
3594
|
+
/* @__PURE__ */ jsx27("div", { style: { marginTop: "8px", fontSize: "10px", opacity: 0.8 }, children: "Check console for detailed analysis" })
|
|
3042
3595
|
] });
|
|
3043
3596
|
}
|
|
3044
3597
|
|
|
3045
3598
|
// src/components/PublicLayout/PublicPageContextChecker.tsx
|
|
3046
|
-
import { useEffect as
|
|
3047
|
-
import { jsx as
|
|
3599
|
+
import { useEffect as useEffect8 } from "react";
|
|
3600
|
+
import { jsx as jsx28, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3048
3601
|
function PublicPageContextChecker({ enabled = true, label = "PublicPage" }) {
|
|
3049
|
-
|
|
3602
|
+
useEffect8(() => {
|
|
3050
3603
|
if (!enabled) return;
|
|
3051
3604
|
console.group(`\u{1F6A8} [${label}] PUBLIC PAGE CONTEXT CHECK`);
|
|
3052
3605
|
try {
|
|
@@ -3108,7 +3661,7 @@ function PublicPageContextChecker({ enabled = true, label = "PublicPage" }) {
|
|
|
3108
3661
|
console.groupEnd();
|
|
3109
3662
|
}, [enabled, label]);
|
|
3110
3663
|
if (!enabled) return null;
|
|
3111
|
-
return /* @__PURE__ */
|
|
3664
|
+
return /* @__PURE__ */ jsxs22("div", { style: {
|
|
3112
3665
|
position: "fixed",
|
|
3113
3666
|
top: 0,
|
|
3114
3667
|
left: 0,
|
|
@@ -3122,9 +3675,9 @@ function PublicPageContextChecker({ enabled = true, label = "PublicPage" }) {
|
|
|
3122
3675
|
borderRadius: "0 0 8px 0",
|
|
3123
3676
|
border: "2px solid #dc2626"
|
|
3124
3677
|
}, children: [
|
|
3125
|
-
/* @__PURE__ */
|
|
3126
|
-
/* @__PURE__ */
|
|
3127
|
-
/* @__PURE__ */
|
|
3678
|
+
/* @__PURE__ */ jsx28("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: "\u{1F6A8} PUBLIC PAGE CONTEXT CHECK" }),
|
|
3679
|
+
/* @__PURE__ */ jsx28("div", { children: "Check console for authentication context analysis" }),
|
|
3680
|
+
/* @__PURE__ */ jsx28("div", { style: { marginTop: "8px", fontSize: "10px", opacity: 0.9 }, children: "If you see \u274C errors in console, your public page is inside auth context!" })
|
|
3128
3681
|
] });
|
|
3129
3682
|
}
|
|
3130
3683
|
|
|
@@ -3175,6 +3728,9 @@ export {
|
|
|
3175
3728
|
StorageUtils,
|
|
3176
3729
|
useStorage,
|
|
3177
3730
|
useFileUpload,
|
|
3731
|
+
useFileReference,
|
|
3732
|
+
useFileReferenceForRecord,
|
|
3733
|
+
FileDisplay,
|
|
3178
3734
|
Table,
|
|
3179
3735
|
TableHeader,
|
|
3180
3736
|
TableBody,
|
|
@@ -3197,4 +3753,4 @@ export {
|
|
|
3197
3753
|
PublicPageDiagnostic,
|
|
3198
3754
|
PublicPageContextChecker
|
|
3199
3755
|
};
|
|
3200
|
-
//# sourceMappingURL=chunk-
|
|
3756
|
+
//# sourceMappingURL=chunk-2NWIXRSB.js.map
|