@timardex/cluemart-shared 1.5.829 → 1.5.831

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 (80) hide show
  1. package/dist/{ad-CZBOdoLr.d.mts → ad-Cu-M8Xzf.d.mts} +2 -2
  2. package/dist/{ad-CCm6QYXb.d.ts → ad-DfqgAPOk.d.ts} +2 -2
  3. package/dist/auth/index.cjs +107 -36
  4. package/dist/auth/index.cjs.map +1 -1
  5. package/dist/auth/index.d.mts +28 -6
  6. package/dist/auth/index.d.ts +28 -6
  7. package/dist/auth/index.mjs +19 -13
  8. package/dist/auth/index.mjs.map +1 -1
  9. package/dist/{chunk-KMLUQVNM.mjs → chunk-43SLZVBF.mjs} +1 -1
  10. package/dist/chunk-43SLZVBF.mjs.map +1 -0
  11. package/dist/{chunk-MOB5R5BF.mjs → chunk-G3CMTXQV.mjs} +2 -3
  12. package/dist/chunk-G3CMTXQV.mjs.map +1 -0
  13. package/dist/{chunk-AQR53ECY.mjs → chunk-LN5LS2GJ.mjs} +3 -3
  14. package/dist/{chunk-Y62E7JLT.mjs → chunk-NU7IZZQY.mjs} +2 -2
  15. package/dist/{chunk-UOFI3LKZ.mjs → chunk-P4XULG5P.mjs} +1 -28
  16. package/dist/chunk-P4XULG5P.mjs.map +1 -0
  17. package/dist/{chunk-VNF22ITY.mjs → chunk-SWWVD4J5.mjs} +2 -2
  18. package/dist/{chunk-JL4MCXKK.mjs → chunk-VPANTTZI.mjs} +101 -2
  19. package/dist/chunk-VPANTTZI.mjs.map +1 -0
  20. package/dist/{chunk-VR3TDBJL.mjs → chunk-X3OLM35T.mjs} +1 -4
  21. package/dist/chunk-X3OLM35T.mjs.map +1 -0
  22. package/dist/{chunk-4NGXTQWT.mjs → chunk-YKJUZUAP.mjs} +4 -4
  23. package/dist/{contactUs-b5SfvqmJ.d.mts → contactUs-09e9ThN0.d.mts} +1 -1
  24. package/dist/{contactUs-Bwxzw-cB.d.ts → contactUs-DI70VJ9T.d.ts} +1 -1
  25. package/dist/enums/index.cjs +0 -3
  26. package/dist/enums/index.cjs.map +1 -1
  27. package/dist/enums/index.d.mts +0 -3
  28. package/dist/enums/index.d.ts +0 -3
  29. package/dist/enums/index.mjs +1 -1
  30. package/dist/formFields/index.cjs.map +1 -1
  31. package/dist/formFields/index.d.mts +1 -1
  32. package/dist/formFields/index.d.ts +1 -1
  33. package/dist/formFields/index.mjs +5 -5
  34. package/dist/{global-wVC9VaCx.d.ts → global--iSLy2cE.d.ts} +2 -9
  35. package/dist/{global-959zf6qy.d.mts → global-BHwZPjT8.d.mts} +2 -9
  36. package/dist/graphql/index.cjs +0 -28
  37. package/dist/graphql/index.cjs.map +1 -1
  38. package/dist/graphql/index.d.mts +4 -4
  39. package/dist/graphql/index.d.ts +4 -4
  40. package/dist/graphql/index.mjs +3 -3
  41. package/dist/hooks/index.cjs +56 -61
  42. package/dist/hooks/index.cjs.map +1 -1
  43. package/dist/hooks/index.d.mts +4 -4
  44. package/dist/hooks/index.d.ts +4 -4
  45. package/dist/hooks/index.mjs +10 -31
  46. package/dist/hooks/index.mjs.map +1 -1
  47. package/dist/index.cjs +106 -31
  48. package/dist/index.cjs.map +1 -1
  49. package/dist/index.d.mts +25 -14
  50. package/dist/index.d.ts +25 -14
  51. package/dist/index.mjs +99 -31
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/map/index.d.mts +1 -1
  54. package/dist/map/index.d.ts +1 -1
  55. package/dist/{resourceActivities-ZPT9JlfH.d.mts → resourceActivities-BDIjVrI4.d.mts} +1 -2
  56. package/dist/{resourceActivities-ChZcl5wJ.d.ts → resourceActivities-JNcJxpTh.d.ts} +1 -2
  57. package/dist/sharing/index.cjs.map +1 -1
  58. package/dist/sharing/index.d.mts +1 -1
  59. package/dist/sharing/index.d.ts +1 -1
  60. package/dist/sharing/index.mjs +3 -3
  61. package/dist/types/index.cjs.map +1 -1
  62. package/dist/types/index.d.mts +6 -6
  63. package/dist/types/index.d.ts +6 -6
  64. package/dist/types/index.mjs +2 -2
  65. package/dist/{user-duZdr5Nn.d.mts → user-Bhkd3l06.d.mts} +1 -2
  66. package/dist/{user-IVhCYYTM.d.ts → user-C_kCo0Fm.d.ts} +1 -2
  67. package/dist/utils/index.cjs.map +1 -1
  68. package/dist/utils/index.d.mts +1 -1
  69. package/dist/utils/index.d.ts +1 -1
  70. package/dist/utils/index.mjs +4 -4
  71. package/package.json +1 -1
  72. package/dist/chunk-JL4MCXKK.mjs.map +0 -1
  73. package/dist/chunk-KMLUQVNM.mjs.map +0 -1
  74. package/dist/chunk-MOB5R5BF.mjs.map +0 -1
  75. package/dist/chunk-UOFI3LKZ.mjs.map +0 -1
  76. package/dist/chunk-VR3TDBJL.mjs.map +0 -1
  77. /package/dist/{chunk-AQR53ECY.mjs.map → chunk-LN5LS2GJ.mjs.map} +0 -0
  78. /package/dist/{chunk-Y62E7JLT.mjs.map → chunk-NU7IZZQY.mjs.map} +0 -0
  79. /package/dist/{chunk-VNF22ITY.mjs.map → chunk-SWWVD4J5.mjs.map} +0 -0
  80. /package/dist/{chunk-4NGXTQWT.mjs.map → chunk-YKJUZUAP.mjs.map} +0 -0
@@ -1,9 +1,9 @@
1
1
  import { EnumUserRole, EnumResourceType, EnumUserLicence } from '../enums/index.mjs';
2
- import { P as Permission, S as SafeUserType } from '../user-duZdr5Nn.mjs';
3
- export { a as PERMISSIONS, W as WILDCARD_PERMISSION } from '../user-duZdr5Nn.mjs';
2
+ import { P as Permission, S as SafeUserType } from '../user-Bhkd3l06.mjs';
3
+ export { a as PERMISSIONS, W as WILDCARD_PERMISSION } from '../user-Bhkd3l06.mjs';
4
4
  import { T as Tier } from '../subscription-bmAdrnfi.mjs';
5
5
  import React, { ReactNode } from 'react';
6
- import '../global-959zf6qy.mjs';
6
+ import '../global-BHwZPjT8.mjs';
7
7
  import 'react-hook-form';
8
8
 
9
9
  type AuthManager = {
@@ -21,6 +21,29 @@ type AuthManager = {
21
21
  */
22
22
  declare function createAuthManager(): AuthManager;
23
23
 
24
+ /** Roles allowed to sign into the admin web app (CUSTOMER-only is denied). */
25
+ declare const ADMIN_APP_ROLES: readonly [EnumUserRole.SUPER_ADMIN, EnumUserRole.ADMIN, EnumUserRole.EVENT, EnumUserRole.VENDOR, EnumUserRole.PARTNER, EnumUserRole.SCHOOL, EnumUserRole.AFFILIATE];
26
+ type AdminAppRole = (typeof ADMIN_APP_ROLES)[number];
27
+ type AdminDashboardContext = "staff" | "event" | "vendor" | "partner" | "school" | "affiliate";
28
+ type AdminDashboardContextInfo = {
29
+ context: AdminDashboardContext;
30
+ home: string;
31
+ label: string;
32
+ /** Path prefixes that belong to this context (including home). */
33
+ pathPrefixes: readonly string[];
34
+ roles: readonly EnumUserRole[];
35
+ };
36
+ /**
37
+ * Priority order for default home + role switcher.
38
+ * Staff first, then product roles.
39
+ */
40
+ declare const ADMIN_DASHBOARD_CONTEXTS: readonly AdminDashboardContextInfo[];
41
+ declare function canAccessAdminApp(roles: EnumUserRole[] | null | undefined): boolean;
42
+ declare function getUsableAdminContexts(roles: EnumUserRole[] | null | undefined): AdminDashboardContextInfo[];
43
+ declare function getDefaultAdminHome(roles: EnumUserRole[] | null | undefined, preferredContext?: AdminDashboardContext | null): string;
44
+ declare function resolveAdminContextFromPath(pathname: string): AdminDashboardContext | null;
45
+ declare function canAccessAdminPath(roles: EnumUserRole[] | null | undefined, pathname: string): boolean;
46
+
24
47
  /**
25
48
  * Union of permissions for the given roles (deduped, stable order).
26
49
  */
@@ -42,7 +65,7 @@ declare function hasAnyRole(roles: EnumUserRole[] | null | undefined, checkRoles
42
65
  */
43
66
  declare const ROLE_PERMISSIONS: Record<EnumUserRole, readonly Permission[]>;
44
67
 
45
- type LimitType = "availability" | "images" | "calendar" | "associates" | "posters" | "productsList" | "statistics" | "relationShare";
68
+ type LimitType = "availability" | "images" | "calendar" | "posters" | "productsList" | "statistics" | "relationShare";
46
69
  interface RoleLicences {
47
70
  pro_plus: boolean;
48
71
  pro: boolean;
@@ -59,7 +82,6 @@ type LicencedResourceType = Exclude<EnumResourceType, EnumResourceType.AFFILIATE
59
82
  type ProfileBadgeLicence = Exclude<EnumUserLicence, EnumUserLicence.STANDARD_AFFILIATE | EnumUserLicence.STANDARD_SCHOOL>;
60
83
  type HasLicenceResult = {
61
84
  directLicence: boolean;
62
- associateLicence: boolean;
63
85
  };
64
86
  type LogoutReason = "manual" | "expired";
65
87
  type AuthStorageAdapter = {
@@ -138,4 +160,4 @@ declare const UserProvider: React.FC<{
138
160
  }>;
139
161
  declare const useAuthUser: () => UseAuthReturnType;
140
162
 
141
- export { type AuthManager, type AuthManagerLike, type AuthStorageAdapter, DEFAULT_LIMITS, type HasLicenceResult, type LicencedResourceType, type LicencesByRole, type LimitType, type LogoutReason, Permission, type ProfileBadgeLicence, ROLE_PERMISSIONS, type RoleLicences, type UseAuthCoreAdapters, type UseAuthReturnType, UserProvider, createAuthManager, getLicenceFlagsByRole, getPermissionsForRoles, hasAllPermissions, hasAnyPermission, hasAnyRole, hasLicence, hasPermission, hasRole, hasUserLicenceType, isLicencedResourceType, isProfileBadgeLicence, permissionListIncludes, useAuthCore, useAuthUser };
163
+ export { ADMIN_APP_ROLES, ADMIN_DASHBOARD_CONTEXTS, type AdminAppRole, type AdminDashboardContext, type AdminDashboardContextInfo, type AuthManager, type AuthManagerLike, type AuthStorageAdapter, DEFAULT_LIMITS, type HasLicenceResult, type LicencedResourceType, type LicencesByRole, type LimitType, type LogoutReason, Permission, type ProfileBadgeLicence, ROLE_PERMISSIONS, type RoleLicences, type UseAuthCoreAdapters, type UseAuthReturnType, UserProvider, canAccessAdminApp, canAccessAdminPath, createAuthManager, getDefaultAdminHome, getLicenceFlagsByRole, getPermissionsForRoles, getUsableAdminContexts, hasAllPermissions, hasAnyPermission, hasAnyRole, hasLicence, hasPermission, hasRole, hasUserLicenceType, isLicencedResourceType, isProfileBadgeLicence, permissionListIncludes, resolveAdminContextFromPath, useAuthCore, useAuthUser };
@@ -1,9 +1,9 @@
1
1
  import { EnumUserRole, EnumResourceType, EnumUserLicence } from '../enums/index.js';
2
- import { P as Permission, S as SafeUserType } from '../user-IVhCYYTM.js';
3
- export { a as PERMISSIONS, W as WILDCARD_PERMISSION } from '../user-IVhCYYTM.js';
2
+ import { P as Permission, S as SafeUserType } from '../user-C_kCo0Fm.js';
3
+ export { a as PERMISSIONS, W as WILDCARD_PERMISSION } from '../user-C_kCo0Fm.js';
4
4
  import { T as Tier } from '../subscription-BU8GvH2K.js';
5
5
  import React, { ReactNode } from 'react';
6
- import '../global-wVC9VaCx.js';
6
+ import '../global--iSLy2cE.js';
7
7
  import 'react-hook-form';
8
8
 
9
9
  type AuthManager = {
@@ -21,6 +21,29 @@ type AuthManager = {
21
21
  */
22
22
  declare function createAuthManager(): AuthManager;
23
23
 
24
+ /** Roles allowed to sign into the admin web app (CUSTOMER-only is denied). */
25
+ declare const ADMIN_APP_ROLES: readonly [EnumUserRole.SUPER_ADMIN, EnumUserRole.ADMIN, EnumUserRole.EVENT, EnumUserRole.VENDOR, EnumUserRole.PARTNER, EnumUserRole.SCHOOL, EnumUserRole.AFFILIATE];
26
+ type AdminAppRole = (typeof ADMIN_APP_ROLES)[number];
27
+ type AdminDashboardContext = "staff" | "event" | "vendor" | "partner" | "school" | "affiliate";
28
+ type AdminDashboardContextInfo = {
29
+ context: AdminDashboardContext;
30
+ home: string;
31
+ label: string;
32
+ /** Path prefixes that belong to this context (including home). */
33
+ pathPrefixes: readonly string[];
34
+ roles: readonly EnumUserRole[];
35
+ };
36
+ /**
37
+ * Priority order for default home + role switcher.
38
+ * Staff first, then product roles.
39
+ */
40
+ declare const ADMIN_DASHBOARD_CONTEXTS: readonly AdminDashboardContextInfo[];
41
+ declare function canAccessAdminApp(roles: EnumUserRole[] | null | undefined): boolean;
42
+ declare function getUsableAdminContexts(roles: EnumUserRole[] | null | undefined): AdminDashboardContextInfo[];
43
+ declare function getDefaultAdminHome(roles: EnumUserRole[] | null | undefined, preferredContext?: AdminDashboardContext | null): string;
44
+ declare function resolveAdminContextFromPath(pathname: string): AdminDashboardContext | null;
45
+ declare function canAccessAdminPath(roles: EnumUserRole[] | null | undefined, pathname: string): boolean;
46
+
24
47
  /**
25
48
  * Union of permissions for the given roles (deduped, stable order).
26
49
  */
@@ -42,7 +65,7 @@ declare function hasAnyRole(roles: EnumUserRole[] | null | undefined, checkRoles
42
65
  */
43
66
  declare const ROLE_PERMISSIONS: Record<EnumUserRole, readonly Permission[]>;
44
67
 
45
- type LimitType = "availability" | "images" | "calendar" | "associates" | "posters" | "productsList" | "statistics" | "relationShare";
68
+ type LimitType = "availability" | "images" | "calendar" | "posters" | "productsList" | "statistics" | "relationShare";
46
69
  interface RoleLicences {
47
70
  pro_plus: boolean;
48
71
  pro: boolean;
@@ -59,7 +82,6 @@ type LicencedResourceType = Exclude<EnumResourceType, EnumResourceType.AFFILIATE
59
82
  type ProfileBadgeLicence = Exclude<EnumUserLicence, EnumUserLicence.STANDARD_AFFILIATE | EnumUserLicence.STANDARD_SCHOOL>;
60
83
  type HasLicenceResult = {
61
84
  directLicence: boolean;
62
- associateLicence: boolean;
63
85
  };
64
86
  type LogoutReason = "manual" | "expired";
65
87
  type AuthStorageAdapter = {
@@ -138,4 +160,4 @@ declare const UserProvider: React.FC<{
138
160
  }>;
139
161
  declare const useAuthUser: () => UseAuthReturnType;
140
162
 
141
- export { type AuthManager, type AuthManagerLike, type AuthStorageAdapter, DEFAULT_LIMITS, type HasLicenceResult, type LicencedResourceType, type LicencesByRole, type LimitType, type LogoutReason, Permission, type ProfileBadgeLicence, ROLE_PERMISSIONS, type RoleLicences, type UseAuthCoreAdapters, type UseAuthReturnType, UserProvider, createAuthManager, getLicenceFlagsByRole, getPermissionsForRoles, hasAllPermissions, hasAnyPermission, hasAnyRole, hasLicence, hasPermission, hasRole, hasUserLicenceType, isLicencedResourceType, isProfileBadgeLicence, permissionListIncludes, useAuthCore, useAuthUser };
163
+ export { ADMIN_APP_ROLES, ADMIN_DASHBOARD_CONTEXTS, type AdminAppRole, type AdminDashboardContext, type AdminDashboardContextInfo, type AuthManager, type AuthManagerLike, type AuthStorageAdapter, DEFAULT_LIMITS, type HasLicenceResult, type LicencedResourceType, type LicencesByRole, type LimitType, type LogoutReason, Permission, type ProfileBadgeLicence, ROLE_PERMISSIONS, type RoleLicences, type UseAuthCoreAdapters, type UseAuthReturnType, UserProvider, canAccessAdminApp, canAccessAdminPath, createAuthManager, getDefaultAdminHome, getLicenceFlagsByRole, getPermissionsForRoles, getUsableAdminContexts, hasAllPermissions, hasAnyPermission, hasAnyRole, hasLicence, hasPermission, hasRole, hasUserLicenceType, isLicencedResourceType, isProfileBadgeLicence, permissionListIncludes, resolveAdminContextFromPath, useAuthCore, useAuthUser };
@@ -1,16 +1,23 @@
1
1
  "use client";
2
2
  import {
3
+ ADMIN_APP_ROLES,
4
+ ADMIN_DASHBOARD_CONTEXTS,
3
5
  PERMISSIONS,
4
6
  ROLE_PERMISSIONS,
5
7
  WILDCARD_PERMISSION,
8
+ canAccessAdminApp,
9
+ canAccessAdminPath,
10
+ getDefaultAdminHome,
6
11
  getPermissionsForRoles,
12
+ getUsableAdminContexts,
7
13
  hasAllPermissions,
8
14
  hasAnyPermission,
9
15
  hasAnyRole,
10
16
  hasPermission,
11
17
  hasRole,
12
- permissionListIncludes
13
- } from "../chunk-JL4MCXKK.mjs";
18
+ permissionListIncludes,
19
+ resolveAdminContextFromPath
20
+ } from "../chunk-VPANTTZI.mjs";
14
21
  import {
15
22
  USER_STORAGE_KEY
16
23
  } from "../chunk-DWO35OY4.mjs";
@@ -20,8 +27,8 @@ import {
20
27
  import {
21
28
  useGetUser,
22
29
  useLogout
23
- } from "../chunk-UOFI3LKZ.mjs";
24
- import "../chunk-VR3TDBJL.mjs";
30
+ } from "../chunk-P4XULG5P.mjs";
31
+ import "../chunk-X3OLM35T.mjs";
25
32
 
26
33
  // src/auth/createAuthManager.ts
27
34
  function createAuthManager() {
@@ -68,17 +75,12 @@ var hasLicence = (authUser, licenceType) => {
68
75
  const directLicence = authUser?.licences?.some(
69
76
  (licence) => licence.licenceType?.includes(licenceType)
70
77
  ) ?? false;
71
- const associateLicence = authUser?.associates?.some(
72
- (associate) => associate.licence?.licenceType?.includes(licenceType)
73
- ) ?? false;
74
78
  return {
75
- associateLicence,
76
79
  directLicence
77
80
  };
78
81
  };
79
82
  var DEFAULT_LIMITS = {
80
83
  // 1 means calendar/productMenu is enabled, 0 means disabled
81
- associates: { pro: 3, pro_plus: 3, standard: 0 },
82
84
  availability: { pro: 1, pro_plus: 1, standard: 0 },
83
85
  calendar: { pro: 1, pro_plus: 1, standard: 0 },
84
86
  images: { pro: 12, pro_plus: 12, standard: 6 },
@@ -157,9 +159,6 @@ function useAuthCore(adapters) {
157
159
  const licences = useCallback(
158
160
  (resourceId) => {
159
161
  const myLicences = authUser?.licences?.map((licence) => licence.licenceType) ?? [];
160
- const associateLicences = authUser?.associates?.map(
161
- (associate) => associate.licence.licenceType
162
- ) ?? [];
163
162
  if (resourceId === "") {
164
163
  return getLicenceFlagsByRole(myLicences);
165
164
  }
@@ -168,7 +167,7 @@ function useAuthCore(adapters) {
168
167
  authUser?.partner ?? null,
169
168
  ...authUser?.events ?? []
170
169
  ].filter((id) => id !== null);
171
- return myResourceIds.includes(resourceId) ? getLicenceFlagsByRole(myLicences) : getLicenceFlagsByRole(associateLicences);
170
+ return myResourceIds.includes(resourceId) ? getLicenceFlagsByRole(myLicences) : getLicenceFlagsByRole();
172
171
  },
173
172
  [authUser]
174
173
  );
@@ -325,14 +324,20 @@ var useAuthUser = () => {
325
324
  return context;
326
325
  };
327
326
  export {
327
+ ADMIN_APP_ROLES,
328
+ ADMIN_DASHBOARD_CONTEXTS,
328
329
  DEFAULT_LIMITS,
329
330
  PERMISSIONS,
330
331
  ROLE_PERMISSIONS,
331
332
  UserProvider,
332
333
  WILDCARD_PERMISSION,
334
+ canAccessAdminApp,
335
+ canAccessAdminPath,
333
336
  createAuthManager,
337
+ getDefaultAdminHome,
334
338
  getLicenceFlagsByRole,
335
339
  getPermissionsForRoles,
340
+ getUsableAdminContexts,
336
341
  hasAllPermissions,
337
342
  hasAnyPermission,
338
343
  hasAnyRole,
@@ -343,6 +348,7 @@ export {
343
348
  isLicencedResourceType,
344
349
  isProfileBadgeLicence,
345
350
  permissionListIncludes,
351
+ resolveAdminContextFromPath,
346
352
  useAuthCore,
347
353
  useAuthUser
348
354
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/auth/createAuthManager.ts","../../src/auth/licenceUtils.ts","../../src/auth/useAuthCore.ts","../../src/auth/UserProvider.tsx"],"sourcesContent":["export type AuthManager = {\n logout: () => Promise<void>;\n setLogout: (fn: () => Promise<void>) => void;\n handleRefetchUser: () => Promise<void>;\n setUserRefetch: (fn: () => Promise<void>) => void;\n};\n\n/**\n * Creates an auth manager used by Apollo error links to trigger logout/refetch\n * without importing React. Matches the former mobile authManager shape.\n *\n * `logout()` dedupes concurrent calls via an in-flight promise so token-refresh\n * failures do not kick off multiple logout sequences.\n */\nexport function createAuthManager(): AuthManager {\n let logoutFn: (() => Promise<void>) | null = null;\n let userRefetchFn: (() => Promise<void>) | null = null;\n let logoutPromise: Promise<void> | null = null;\n\n return {\n handleRefetchUser: async () => {\n if (userRefetchFn) {\n await userRefetchFn();\n } else {\n console.warn(\"❌ User refetch function not set!\");\n }\n },\n logout(): Promise<void> {\n if (logoutPromise !== null) return logoutPromise;\n if (logoutFn === null) {\n console.warn(\"❌ Logout function not set!\");\n return Promise.resolve();\n }\n logoutPromise = logoutFn().finally(() => {\n logoutPromise = null;\n });\n return logoutPromise;\n },\n setLogout(fn: () => Promise<void>) {\n logoutFn = fn;\n },\n setUserRefetch(fn: () => Promise<void>) {\n userRefetchFn = fn;\n },\n };\n}\n","/* eslint-disable camelcase */\nimport { EnumResourceType, EnumUserLicence } from \"../enums\";\nimport type { SafeUserType } from \"../types\";\nimport { TIERS_BY_PRIORITY, type Tier } from \"../types/subscription\";\n\nimport type {\n HasLicenceResult,\n LicencedResourceType,\n LicencesByRole,\n LimitType,\n ProfileBadgeLicence,\n RoleLicences,\n} from \"./types\";\n\nexport function isLicencedResourceType(\n resourceType: EnumResourceType,\n): resourceType is LicencedResourceType {\n return (\n resourceType !== EnumResourceType.AFFILIATE &&\n resourceType !== EnumResourceType.SCHOOL\n );\n}\n\nexport function isProfileBadgeLicence(\n licenceType: EnumUserLicence,\n): licenceType is ProfileBadgeLicence {\n return (\n licenceType !== EnumUserLicence.STANDARD_AFFILIATE &&\n licenceType !== EnumUserLicence.STANDARD_SCHOOL\n );\n}\n\nexport const hasUserLicenceType = (\n authUser: SafeUserType | null,\n licenceType: EnumUserLicence,\n): boolean =>\n authUser?.licences?.some((licence) => licence.licenceType === licenceType) ??\n false;\n\nexport const hasLicence = (\n authUser: SafeUserType | null,\n licenceType: \"vendor\" | \"partner\" | \"event\",\n): HasLicenceResult => {\n const directLicence =\n authUser?.licences?.some((licence) =>\n licence.licenceType?.includes(licenceType),\n ) ?? false;\n\n const associateLicence =\n authUser?.associates?.some((associate) =>\n associate.licence?.licenceType?.includes(licenceType),\n ) ?? false;\n\n return {\n associateLicence,\n directLicence,\n };\n};\n\n/** Default limits per subscription tier. */\nexport const DEFAULT_LIMITS: Record<LimitType, Record<Tier, number>> = {\n // 1 means calendar/productMenu is enabled, 0 means disabled\n associates: { pro: 3, pro_plus: 3, standard: 0 },\n availability: { pro: 1, pro_plus: 1, standard: 0 },\n calendar: { pro: 1, pro_plus: 1, standard: 0 },\n images: { pro: 12, pro_plus: 12, standard: 6 },\n posters: { pro: 5, pro_plus: 5, standard: 5 },\n productsList: { pro: 1, pro_plus: 1, standard: 0 },\n relationShare: { pro: 1, pro_plus: 1, standard: 0 },\n statistics: { pro: 1, pro_plus: 1, standard: 0 },\n};\n\n/**\n * Parses an array of licence strings into structured, role-based licences.\n */\nexport function getLicenceFlagsByRole(licences?: string[]): LicencesByRole {\n const normalized = licences?.map((l) => l.toLowerCase()) ?? [];\n\n function resolve(role: EnumResourceType): RoleLicences {\n const result: RoleLicences = {\n pro_plus: false,\n // eslint-disable-next-line sort-keys\n pro: false,\n standard: false,\n };\n\n for (const tier of TIERS_BY_PRIORITY) {\n if (normalized.some((l) => l.startsWith(`${tier}_${role}`))) {\n result[tier] = true;\n break; // stop at first match → ensures mutual exclusivity\n }\n }\n\n return result;\n }\n\n return {\n event: resolve(EnumResourceType.EVENT),\n partner: resolve(EnumResourceType.PARTNER),\n vendor: resolve(EnumResourceType.VENDOR),\n };\n}\n","import { useCallback, useEffect, useMemo, useState } from \"react\";\n\nimport { EnumResourceType, EnumUserLicence, EnumUserRole } from \"../enums\";\nimport { useLogout } from \"../graphql/hooks/auth\";\nimport { useGetUser } from \"../graphql/hooks/user/hooksQuery\";\nimport { USER_STORAGE_KEY } from \"../storage\";\nimport type { SafeUserType } from \"../types\";\n\nimport {\n DEFAULT_LIMITS,\n getLicenceFlagsByRole,\n hasLicence,\n hasUserLicenceType,\n isLicencedResourceType,\n} from \"./licenceUtils\";\nimport {\n getPermissionsForRoles,\n hasRole as roleHasRole,\n permissionListIncludes,\n} from \"./permissions\";\nimport type { Permission } from \"./permissions\";\nimport type {\n LimitType,\n LogoutReason,\n UseAuthCoreAdapters,\n UseAuthReturnType,\n} from \"./types\";\n\n/**\n * Platform-agnostic auth session core (source of truth for shared useAuth).\n *\n * Owns: persisted user load/set, refetch, role/licence flags, logout orchestration.\n * Does not own: AsyncStorage vs localStorage, Expo/Next navigation, toasts,\n * Apollo/WS reset, Firebase — those stay in each app's adapter wrapper.\n */\nexport function useAuthCore(adapters: UseAuthCoreAdapters): UseAuthReturnType {\n const {\n storage,\n authManager,\n afterLogout,\n shouldCallLogoutMutation = () => true,\n notifyLogoutSuccess,\n notifySessionExpired,\n onError,\n } = adapters;\n\n const [authUser, setAuthUser] = useState<SafeUserType | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n\n const userId = useMemo(() => authUser?._id ?? \"\", [authUser?._id]);\n const { refetch } = useGetUser(userId);\n const { logout, loading } = useLogout();\n\n const handleSetAuthUser = useCallback(\n async (user: SafeUserType | null) => {\n setAuthUser(user);\n if (user) {\n await storage.setItem(USER_STORAGE_KEY, JSON.stringify(user));\n } else {\n await storage.removeItem(USER_STORAGE_KEY);\n }\n },\n [storage],\n );\n\n const handleRefetchUser = useCallback(async () => {\n if (!authUser) return;\n try {\n const result = await refetch();\n if (!result) return;\n const { data } = result;\n if (data?.user) await handleSetAuthUser(data.user);\n } catch (error: unknown) {\n onError?.(error, { action: \"refetchUser\" });\n console.warn(\n \"Failed to refetch user:\",\n error instanceof Error ? error.message : error,\n );\n }\n }, [authUser, handleSetAuthUser, onError, refetch]);\n\n const licences = useCallback(\n (resourceId: string) => {\n const myLicences =\n authUser?.licences?.map((licence) => licence.licenceType) ?? [];\n const associateLicences =\n authUser?.associates?.map(\n (associate) => associate.licence.licenceType,\n ) ?? [];\n\n // No resource yet (e.g. create flow / unloaded id): use the user's own\n // licences only — never hard-code elevated tiers for an empty id.\n if (resourceId === \"\") {\n return getLicenceFlagsByRole(myLicences);\n }\n\n const myResourceIds = [\n authUser?.vendor ?? null,\n authUser?.partner ?? null,\n ...(authUser?.events ?? []),\n ].filter((id): id is string => id !== null);\n\n return myResourceIds.includes(resourceId)\n ? getLicenceFlagsByRole(myLicences)\n : getLicenceFlagsByRole(associateLicences);\n },\n [authUser],\n );\n\n const getLicenseAccessLevel = useCallback(\n (\n limitType: LimitType,\n resourceId: string,\n resourceType: EnumResourceType,\n ): number => {\n if (!isLicencedResourceType(resourceType)) {\n return 0;\n }\n\n const roleLicences = licences(resourceId)[resourceType];\n\n if (roleLicences.pro_plus) return DEFAULT_LIMITS[limitType].pro_plus;\n if (roleLicences.pro) return DEFAULT_LIMITS[limitType].pro;\n if (roleLicences.standard) return DEFAULT_LIMITS[limitType].standard;\n\n return 0;\n },\n [licences],\n );\n\n const hasVendorLicence = useMemo(\n () => hasLicence(authUser, \"vendor\"),\n [authUser],\n );\n\n const hasPartnerLicence = useMemo(\n () => hasLicence(authUser, \"partner\"),\n [authUser],\n );\n\n const hasEventLicence = useMemo(\n () => hasLicence(authUser, \"event\"),\n [authUser],\n );\n\n const hasUserLicence = useCallback(\n (licenceType: EnumUserLicence) => hasUserLicenceType(authUser, licenceType),\n [authUser],\n );\n\n const permissions = useMemo(() => {\n if (authUser?.permissions != null) {\n return authUser.permissions;\n }\n return getPermissionsForRoles(authUser?.roles);\n }, [authUser?.permissions, authUser?.roles]);\n\n const hasPermissionFn = useCallback(\n (permission: Permission) => permissionListIncludes(permissions, permission),\n [permissions],\n );\n\n const hasRoleFn = useCallback(\n (role: EnumUserRole) => roleHasRole(authUser?.roles, role),\n [authUser?.roles],\n );\n\n const isAdmin = useMemo(\n () =>\n roleHasRole(authUser?.roles, EnumUserRole.ADMIN) ||\n permissionListIncludes(permissions, \"dashboard.admin\") ||\n permissionListIncludes(permissions, \"*\"),\n [authUser?.roles, permissions],\n );\n\n const isSuperAdmin = useMemo(\n () => roleHasRole(authUser?.roles, EnumUserRole.SUPER_ADMIN),\n [authUser?.roles],\n );\n\n const isAffiliate = useMemo(\n () =>\n roleHasRole(authUser?.roles, EnumUserRole.AFFILIATE) &&\n authUser?.affiliate !== null &&\n authUser?.affiliate !== undefined,\n [authUser?.roles, authUser?.affiliate],\n );\n\n const isSchool = useMemo(\n () =>\n roleHasRole(authUser?.roles, EnumUserRole.SCHOOL) &&\n authUser?.school !== null &&\n authUser?.school !== undefined,\n [authUser?.roles, authUser?.school],\n );\n\n // Mount-only hydrate from storage. Do not re-run when adapter identities\n // change — that can overwrite a newer in-memory user (e.g. post-login setUser).\n useEffect(() => {\n const loadUser = async () => {\n try {\n const userJson = await storage.getItem(USER_STORAGE_KEY);\n await handleSetAuthUser(userJson ? JSON.parse(userJson) : null);\n } catch (error: unknown) {\n onError?.(error, { action: \"loadUserFromStorage\" });\n console.error(\"Failed to load user from storage:\", error);\n } finally {\n setIsLoading(false);\n }\n };\n\n void loadUser();\n }, []);\n\n const logoutWithReason = useCallback(\n async (reason: LogoutReason) => {\n try {\n if (shouldCallLogoutMutation(reason)) {\n try {\n const result = await logout();\n const message = result?.data?.logout?.message as string | undefined;\n if (message) {\n notifyLogoutSuccess?.(message);\n }\n } catch (err: unknown) {\n onError?.(err, { action: \"logout\" });\n console.warn(\"Logout request failed (ignored):\", err);\n }\n }\n } finally {\n await afterLogout(reason);\n setAuthUser(null);\n await storage.removeItem(USER_STORAGE_KEY);\n }\n },\n [\n afterLogout,\n logout,\n notifyLogoutSuccess,\n onError,\n shouldCallLogoutMutation,\n storage,\n ],\n );\n\n const handleLogoutExplicit = useCallback(\n () => logoutWithReason(\"manual\"),\n [logoutWithReason],\n );\n\n const handleLogoutExpired = useCallback(async () => {\n const hadSession = authUser != null;\n if (!hadSession) return;\n await logoutWithReason(\"expired\");\n notifySessionExpired?.();\n }, [authUser, logoutWithReason, notifySessionExpired]);\n\n useEffect(() => {\n authManager.setLogout(() => handleLogoutExpired());\n authManager.setUserRefetch(() => handleRefetchUser());\n }, [authManager, handleLogoutExpired, handleRefetchUser]);\n\n return {\n authUser,\n getLicenseAccessLevel,\n handleLogoutExplicit,\n hasEventLicence,\n hasPartnerLicence,\n hasPermission: hasPermissionFn,\n hasRole: hasRoleFn,\n hasUserLicence,\n hasVendorLicence,\n isAdmin,\n isAffiliate,\n isLoading: loading || isLoading,\n isSchool,\n isSuperAdmin,\n permissions,\n refetchUser: handleRefetchUser,\n setUser: handleSetAuthUser,\n };\n}\n","/**\n * Shared React context for auth session state.\n *\n * Apps keep a thin local UserProvider that calls their platform `useAuth`\n * (adapters) and pass the result here as `value`. Import `useAuthUser` from\n * this module (or re-export it) so consumers share one context instance.\n *\n * `\"use client\"`: required for Next.js; ignored by React Native.\n */\n\"use client\";\n\nimport React, { createContext, useContext, type ReactNode } from \"react\";\n\nimport type { UseAuthReturnType } from \"./types\";\n\nconst UserContext = createContext<UseAuthReturnType | undefined>(undefined);\n\n/**\n * Provides auth session value from the app's thin useAuth wrapper.\n */\nexport const UserProvider: React.FC<{\n children: ReactNode;\n value: UseAuthReturnType;\n}> = ({ children, value }) => {\n return <UserContext.Provider value={value}>{children}</UserContext.Provider>;\n};\n\nexport const useAuthUser = (): UseAuthReturnType => {\n const context = useContext(UserContext);\n if (!context) {\n throw new Error(\"useAuthUser must be used within a UserProvider\");\n }\n return context;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAcO,SAAS,oBAAiC;AAC/C,MAAI,WAAyC;AAC7C,MAAI,gBAA8C;AAClD,MAAI,gBAAsC;AAE1C,SAAO;AAAA,IACL,mBAAmB,YAAY;AAC7B,UAAI,eAAe;AACjB,cAAM,cAAc;AAAA,MACtB,OAAO;AACL,gBAAQ,KAAK,uCAAkC;AAAA,MACjD;AAAA,IACF;AAAA,IACA,SAAwB;AACtB,UAAI,kBAAkB,KAAM,QAAO;AACnC,UAAI,aAAa,MAAM;AACrB,gBAAQ,KAAK,iCAA4B;AACzC,eAAO,QAAQ,QAAQ;AAAA,MACzB;AACA,sBAAgB,SAAS,EAAE,QAAQ,MAAM;AACvC,wBAAgB;AAAA,MAClB,CAAC;AACD,aAAO;AAAA,IACT;AAAA,IACA,UAAU,IAAyB;AACjC,iBAAW;AAAA,IACb;AAAA,IACA,eAAe,IAAyB;AACtC,sBAAgB;AAAA,IAClB;AAAA,EACF;AACF;;;AC/BO,SAAS,uBACd,cACsC;AACtC,SACE,gDACA;AAEJ;AAEO,SAAS,sBACd,aACoC;AACpC,SACE,iEACA;AAEJ;AAEO,IAAM,qBAAqB,CAChC,UACA,gBAEA,UAAU,UAAU,KAAK,CAAC,YAAY,QAAQ,gBAAgB,WAAW,KACzE;AAEK,IAAM,aAAa,CACxB,UACA,gBACqB;AACrB,QAAM,gBACJ,UAAU,UAAU;AAAA,IAAK,CAAC,YACxB,QAAQ,aAAa,SAAS,WAAW;AAAA,EAC3C,KAAK;AAEP,QAAM,mBACJ,UAAU,YAAY;AAAA,IAAK,CAAC,cAC1B,UAAU,SAAS,aAAa,SAAS,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AGR,CAAC,EAAE,UAAU,MAAM,MAAM;AAC5B,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAe,UAAS;AACvD;AAEO,IAAM,cAAc,MAAyB;AAClD,QAAM,UAAU,WAAW,WAAW;AACtC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/auth/createAuthManager.ts","../../src/auth/licenceUtils.ts","../../src/auth/useAuthCore.ts","../../src/auth/UserProvider.tsx"],"sourcesContent":["export type AuthManager = {\n logout: () => Promise<void>;\n setLogout: (fn: () => Promise<void>) => void;\n handleRefetchUser: () => Promise<void>;\n setUserRefetch: (fn: () => Promise<void>) => void;\n};\n\n/**\n * Creates an auth manager used by Apollo error links to trigger logout/refetch\n * without importing React. Matches the former mobile authManager shape.\n *\n * `logout()` dedupes concurrent calls via an in-flight promise so token-refresh\n * failures do not kick off multiple logout sequences.\n */\nexport function createAuthManager(): AuthManager {\n let logoutFn: (() => Promise<void>) | null = null;\n let userRefetchFn: (() => Promise<void>) | null = null;\n let logoutPromise: Promise<void> | null = null;\n\n return {\n handleRefetchUser: async () => {\n if (userRefetchFn) {\n await userRefetchFn();\n } else {\n console.warn(\"❌ User refetch function not set!\");\n }\n },\n logout(): Promise<void> {\n if (logoutPromise !== null) return logoutPromise;\n if (logoutFn === null) {\n console.warn(\"❌ Logout function not set!\");\n return Promise.resolve();\n }\n logoutPromise = logoutFn().finally(() => {\n logoutPromise = null;\n });\n return logoutPromise;\n },\n setLogout(fn: () => Promise<void>) {\n logoutFn = fn;\n },\n setUserRefetch(fn: () => Promise<void>) {\n userRefetchFn = fn;\n },\n };\n}\n","/* eslint-disable camelcase */\nimport { EnumResourceType, EnumUserLicence } from \"../enums\";\nimport type { SafeUserType } from \"../types\";\nimport { TIERS_BY_PRIORITY, type Tier } from \"../types/subscription\";\n\nimport type {\n HasLicenceResult,\n LicencedResourceType,\n LicencesByRole,\n LimitType,\n ProfileBadgeLicence,\n RoleLicences,\n} from \"./types\";\n\nexport function isLicencedResourceType(\n resourceType: EnumResourceType,\n): resourceType is LicencedResourceType {\n return (\n resourceType !== EnumResourceType.AFFILIATE &&\n resourceType !== EnumResourceType.SCHOOL\n );\n}\n\nexport function isProfileBadgeLicence(\n licenceType: EnumUserLicence,\n): licenceType is ProfileBadgeLicence {\n return (\n licenceType !== EnumUserLicence.STANDARD_AFFILIATE &&\n licenceType !== EnumUserLicence.STANDARD_SCHOOL\n );\n}\n\nexport const hasUserLicenceType = (\n authUser: SafeUserType | null,\n licenceType: EnumUserLicence,\n): boolean =>\n authUser?.licences?.some((licence) => licence.licenceType === licenceType) ??\n false;\n\nexport const hasLicence = (\n authUser: SafeUserType | null,\n licenceType: \"vendor\" | \"partner\" | \"event\",\n): HasLicenceResult => {\n const directLicence =\n authUser?.licences?.some((licence) =>\n licence.licenceType?.includes(licenceType),\n ) ?? false;\n\n return {\n directLicence,\n };\n};\n\n/** Default limits per subscription tier. */\nexport const DEFAULT_LIMITS: Record<LimitType, Record<Tier, number>> = {\n // 1 means calendar/productMenu is enabled, 0 means disabled\n availability: { pro: 1, pro_plus: 1, standard: 0 },\n calendar: { pro: 1, pro_plus: 1, standard: 0 },\n images: { pro: 12, pro_plus: 12, standard: 6 },\n posters: { pro: 5, pro_plus: 5, standard: 5 },\n productsList: { pro: 1, pro_plus: 1, standard: 0 },\n relationShare: { pro: 1, pro_plus: 1, standard: 0 },\n statistics: { pro: 1, pro_plus: 1, standard: 0 },\n};\n\n/**\n * Parses an array of licence strings into structured, role-based licences.\n */\nexport function getLicenceFlagsByRole(licences?: string[]): LicencesByRole {\n const normalized = licences?.map((l) => l.toLowerCase()) ?? [];\n\n function resolve(role: EnumResourceType): RoleLicences {\n const result: RoleLicences = {\n pro_plus: false,\n // eslint-disable-next-line sort-keys\n pro: false,\n standard: false,\n };\n\n for (const tier of TIERS_BY_PRIORITY) {\n if (normalized.some((l) => l.startsWith(`${tier}_${role}`))) {\n result[tier] = true;\n break; // stop at first match → ensures mutual exclusivity\n }\n }\n\n return result;\n }\n\n return {\n event: resolve(EnumResourceType.EVENT),\n partner: resolve(EnumResourceType.PARTNER),\n vendor: resolve(EnumResourceType.VENDOR),\n };\n}\n","import { useCallback, useEffect, useMemo, useState } from \"react\";\n\nimport { EnumResourceType, EnumUserLicence, EnumUserRole } from \"../enums\";\nimport { useLogout } from \"../graphql/hooks/auth\";\nimport { useGetUser } from \"../graphql/hooks/user/hooksQuery\";\nimport { USER_STORAGE_KEY } from \"../storage\";\nimport type { SafeUserType } from \"../types\";\n\nimport {\n DEFAULT_LIMITS,\n getLicenceFlagsByRole,\n hasLicence,\n hasUserLicenceType,\n isLicencedResourceType,\n} from \"./licenceUtils\";\nimport {\n getPermissionsForRoles,\n hasRole as roleHasRole,\n permissionListIncludes,\n} from \"./permissions\";\nimport type { Permission } from \"./permissions\";\nimport type {\n LimitType,\n LogoutReason,\n UseAuthCoreAdapters,\n UseAuthReturnType,\n} from \"./types\";\n\n/**\n * Platform-agnostic auth session core (source of truth for shared useAuth).\n *\n * Owns: persisted user load/set, refetch, role/licence flags, logout orchestration.\n * Does not own: AsyncStorage vs localStorage, Expo/Next navigation, toasts,\n * Apollo/WS reset, Firebase — those stay in each app's adapter wrapper.\n */\nexport function useAuthCore(adapters: UseAuthCoreAdapters): UseAuthReturnType {\n const {\n storage,\n authManager,\n afterLogout,\n shouldCallLogoutMutation = () => true,\n notifyLogoutSuccess,\n notifySessionExpired,\n onError,\n } = adapters;\n\n const [authUser, setAuthUser] = useState<SafeUserType | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n\n const userId = useMemo(() => authUser?._id ?? \"\", [authUser?._id]);\n const { refetch } = useGetUser(userId);\n const { logout, loading } = useLogout();\n\n const handleSetAuthUser = useCallback(\n async (user: SafeUserType | null) => {\n setAuthUser(user);\n if (user) {\n await storage.setItem(USER_STORAGE_KEY, JSON.stringify(user));\n } else {\n await storage.removeItem(USER_STORAGE_KEY);\n }\n },\n [storage],\n );\n\n const handleRefetchUser = useCallback(async () => {\n if (!authUser) return;\n try {\n const result = await refetch();\n if (!result) return;\n const { data } = result;\n if (data?.user) await handleSetAuthUser(data.user);\n } catch (error: unknown) {\n onError?.(error, { action: \"refetchUser\" });\n console.warn(\n \"Failed to refetch user:\",\n error instanceof Error ? error.message : error,\n );\n }\n }, [authUser, handleSetAuthUser, onError, refetch]);\n\n const licences = useCallback(\n (resourceId: string) => {\n const myLicences =\n authUser?.licences?.map((licence) => licence.licenceType) ?? [];\n\n // No resource yet (e.g. create flow / unloaded id): use the user's own\n // licences only — never hard-code elevated tiers for an empty id.\n if (resourceId === \"\") {\n return getLicenceFlagsByRole(myLicences);\n }\n\n const myResourceIds = [\n authUser?.vendor ?? null,\n authUser?.partner ?? null,\n ...(authUser?.events ?? []),\n ].filter((id): id is string => id !== null);\n\n return myResourceIds.includes(resourceId)\n ? getLicenceFlagsByRole(myLicences)\n : getLicenceFlagsByRole();\n },\n [authUser],\n );\n\n const getLicenseAccessLevel = useCallback(\n (\n limitType: LimitType,\n resourceId: string,\n resourceType: EnumResourceType,\n ): number => {\n if (!isLicencedResourceType(resourceType)) {\n return 0;\n }\n\n const roleLicences = licences(resourceId)[resourceType];\n\n if (roleLicences.pro_plus) return DEFAULT_LIMITS[limitType].pro_plus;\n if (roleLicences.pro) return DEFAULT_LIMITS[limitType].pro;\n if (roleLicences.standard) return DEFAULT_LIMITS[limitType].standard;\n\n return 0;\n },\n [licences],\n );\n\n const hasVendorLicence = useMemo(\n () => hasLicence(authUser, \"vendor\"),\n [authUser],\n );\n\n const hasPartnerLicence = useMemo(\n () => hasLicence(authUser, \"partner\"),\n [authUser],\n );\n\n const hasEventLicence = useMemo(\n () => hasLicence(authUser, \"event\"),\n [authUser],\n );\n\n const hasUserLicence = useCallback(\n (licenceType: EnumUserLicence) => hasUserLicenceType(authUser, licenceType),\n [authUser],\n );\n\n const permissions = useMemo(() => {\n if (authUser?.permissions != null) {\n return authUser.permissions;\n }\n return getPermissionsForRoles(authUser?.roles);\n }, [authUser?.permissions, authUser?.roles]);\n\n const hasPermissionFn = useCallback(\n (permission: Permission) => permissionListIncludes(permissions, permission),\n [permissions],\n );\n\n const hasRoleFn = useCallback(\n (role: EnumUserRole) => roleHasRole(authUser?.roles, role),\n [authUser?.roles],\n );\n\n const isAdmin = useMemo(\n () =>\n roleHasRole(authUser?.roles, EnumUserRole.ADMIN) ||\n permissionListIncludes(permissions, \"dashboard.admin\") ||\n permissionListIncludes(permissions, \"*\"),\n [authUser?.roles, permissions],\n );\n\n const isSuperAdmin = useMemo(\n () => roleHasRole(authUser?.roles, EnumUserRole.SUPER_ADMIN),\n [authUser?.roles],\n );\n\n const isAffiliate = useMemo(\n () =>\n roleHasRole(authUser?.roles, EnumUserRole.AFFILIATE) &&\n authUser?.affiliate !== null &&\n authUser?.affiliate !== undefined,\n [authUser?.roles, authUser?.affiliate],\n );\n\n const isSchool = useMemo(\n () =>\n roleHasRole(authUser?.roles, EnumUserRole.SCHOOL) &&\n authUser?.school !== null &&\n authUser?.school !== undefined,\n [authUser?.roles, authUser?.school],\n );\n\n // Mount-only hydrate from storage. Do not re-run when adapter identities\n // change — that can overwrite a newer in-memory user (e.g. post-login setUser).\n useEffect(() => {\n const loadUser = async () => {\n try {\n const userJson = await storage.getItem(USER_STORAGE_KEY);\n await handleSetAuthUser(userJson ? JSON.parse(userJson) : null);\n } catch (error: unknown) {\n onError?.(error, { action: \"loadUserFromStorage\" });\n console.error(\"Failed to load user from storage:\", error);\n } finally {\n setIsLoading(false);\n }\n };\n\n void loadUser();\n }, []);\n\n const logoutWithReason = useCallback(\n async (reason: LogoutReason) => {\n try {\n if (shouldCallLogoutMutation(reason)) {\n try {\n const result = await logout();\n const message = result?.data?.logout?.message as string | undefined;\n if (message) {\n notifyLogoutSuccess?.(message);\n }\n } catch (err: unknown) {\n onError?.(err, { action: \"logout\" });\n console.warn(\"Logout request failed (ignored):\", err);\n }\n }\n } finally {\n await afterLogout(reason);\n setAuthUser(null);\n await storage.removeItem(USER_STORAGE_KEY);\n }\n },\n [\n afterLogout,\n logout,\n notifyLogoutSuccess,\n onError,\n shouldCallLogoutMutation,\n storage,\n ],\n );\n\n const handleLogoutExplicit = useCallback(\n () => logoutWithReason(\"manual\"),\n [logoutWithReason],\n );\n\n const handleLogoutExpired = useCallback(async () => {\n const hadSession = authUser != null;\n if (!hadSession) return;\n await logoutWithReason(\"expired\");\n notifySessionExpired?.();\n }, [authUser, logoutWithReason, notifySessionExpired]);\n\n useEffect(() => {\n authManager.setLogout(() => handleLogoutExpired());\n authManager.setUserRefetch(() => handleRefetchUser());\n }, [authManager, handleLogoutExpired, handleRefetchUser]);\n\n return {\n authUser,\n getLicenseAccessLevel,\n handleLogoutExplicit,\n hasEventLicence,\n hasPartnerLicence,\n hasPermission: hasPermissionFn,\n hasRole: hasRoleFn,\n hasUserLicence,\n hasVendorLicence,\n isAdmin,\n isAffiliate,\n isLoading: loading || isLoading,\n isSchool,\n isSuperAdmin,\n permissions,\n refetchUser: handleRefetchUser,\n setUser: handleSetAuthUser,\n };\n}\n","/**\n * Shared React context for auth session state.\n *\n * Apps keep a thin local UserProvider that calls their platform `useAuth`\n * (adapters) and pass the result here as `value`. Import `useAuthUser` from\n * this module (or re-export it) so consumers share one context instance.\n *\n * `\"use client\"`: required for Next.js; ignored by React Native.\n */\n\"use client\";\n\nimport React, { createContext, useContext, type ReactNode } from \"react\";\n\nimport type { UseAuthReturnType } from \"./types\";\n\nconst UserContext = createContext<UseAuthReturnType | undefined>(undefined);\n\n/**\n * Provides auth session value from the app's thin useAuth wrapper.\n */\nexport const UserProvider: React.FC<{\n children: ReactNode;\n value: UseAuthReturnType;\n}> = ({ children, value }) => {\n return <UserContext.Provider value={value}>{children}</UserContext.Provider>;\n};\n\nexport const useAuthUser = (): UseAuthReturnType => {\n const context = useContext(UserContext);\n if (!context) {\n throw new Error(\"useAuthUser must be used within a UserProvider\");\n }\n return context;\n};\n"],"m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ACF;AAEA,QAAM,uBAAuB;AAAA,IAC3B,MAAM,iBAAiB,QAAQ;AAAA,IAC/B,CAAC,gBAAgB;AAAA,EACnB;AAEA,QAAM,sBAAsB,YAAY,YAAY;AAClD,UAAM,aAAa,YAAY;AAC/B,QAAI,CAAC,WAAY;AACjB,UAAM,iBAAiB,SAAS;AAChC,2BAAuB;AAAA,EACzB,GAAG,CAAC,UAAU,kBAAkB,oBAAoB,CAAC;AAErD,YAAU,MAAM;AACd,gBAAY,UAAU,MAAM,oBAAoB,CAAC;AACjD,gBAAY,eAAe,MAAM,kBAAkB,CAAC;AAAA,EACtD,GAAG,CAAC,aAAa,qBAAqB,iBAAiB,CAAC;AAExD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,WAAW;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AACF;;;AC1QA,SAAgB,eAAe,kBAAkC;AAaxD;AATT,IAAM,cAAc,cAA6C,MAAS;AAKnE,IAAM,eAGR,CAAC,EAAE,UAAU,MAAM,MAAM;AAC5B,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAe,UAAS;AACvD;AAEO,IAAM,cAAc,MAAyB;AAClD,QAAM,UAAU,WAAW,WAAW;AACtC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AACA,SAAO;AACT;","names":[]}
@@ -216,4 +216,4 @@ export {
216
216
  EnumAffiliateParticipantType,
217
217
  EnumAffiliateRewardType
218
218
  };
219
- //# sourceMappingURL=chunk-KMLUQVNM.mjs.map
219
+ //# sourceMappingURL=chunk-43SLZVBF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/auth.ts","../src/types/global.ts","../src/types/ad.ts","../src/types/resourceActivities.ts","../src/types/post.ts","../src/types/game/index.ts","../src/types/game/dailyClue.ts","../src/types/game/global.ts","../src/types/affiliate.ts"],"sourcesContent":["import {\n CreateFormData,\n EnumOSPlatform,\n PromoCodeType,\n TermsAgreement,\n} from \"src\";\n\nimport { SafeUserType } from \"./user\";\n\nexport enum EnumVerificationType {\n REGISTER = \"register\",\n RESET_PASSWORD = \"resetPassword\",\n}\n\nexport type LoginFormData = {\n email: string;\n isAdminPage?: boolean;\n password: string;\n platform?: EnumOSPlatform;\n};\n\nexport type CreateLoginFormData = CreateFormData<LoginFormData>;\n\nexport type RegisterFormData = {\n email: string;\n firstName: string;\n lastName: string;\n password: string;\n platform?: EnumOSPlatform;\n preferredRegion: string;\n promoCode?: PromoCodeType | null;\n termsAgreement?: TermsAgreement | null;\n};\n\nexport type CreateRegisterFormData = CreateFormData<RegisterFormData>;\n\nexport type RequestPasswordResetFormData = {\n email: string;\n};\n\nexport type CreateRequestPasswordResetFormData =\n CreateFormData<RequestPasswordResetFormData>;\n\nexport type ResetPasswordFormData = {\n confirmPassword: string;\n email: string;\n password: string;\n};\n\nexport type CreateResetPasswordFormData = CreateFormData<ResetPasswordFormData>;\n\nexport type ValidateVerificationTokenFormData = {\n email: string;\n verificationToken: string;\n verificationType?: EnumVerificationType;\n};\n\nexport type CreateValidateVerificationTokenFormData =\n CreateFormData<ValidateVerificationTokenFormData>;\n\nexport type AuthPayloadType = {\n message: string;\n token: string;\n refreshToken: string | null;\n user: SafeUserType;\n};\n\nexport type RefreshTokenPayloadType = {\n refreshToken: string;\n token: string;\n};\n","import {\n Control,\n FieldValues,\n FormState,\n UseFormGetValues,\n UseFormHandleSubmit,\n UseFormReset,\n UseFormSetValue,\n UseFormWatch,\n} from \"react-hook-form\";\n\nimport {\n EnumEventDateStatus,\n EnumEventType,\n EnumResourceType,\n EnumSocialMedia,\n EnumUserLicence,\n} from \"../enums\";\n\nimport { EventListItemType } from \"./event\";\nimport { EnumPostType } from \"./post\";\nimport { VendorType } from \"./vendor\";\n\nexport const PROMO_CODE_PREFIX = \"CM-\";\n\nexport type PromoCodeType = `${typeof PROMO_CODE_PREFIX}${string}`;\n\nexport type Nullable<T> = {\n [K in keyof T]: T[K] | null | undefined;\n};\n\nexport type DeviceInfo = {\n appBuildNumber: string;\n appId: string;\n appVersion: string;\n brand: string;\n deviceName: string;\n installationId: string;\n manufacturer: string;\n modelName: string;\n osName: string;\n osVersion: string;\n timestamp: string;\n};\n\nexport type TermsAgreement = DeviceInfo & {\n termVersion: string;\n};\n\nexport type ResourceContactDetailsType = {\n email?: string | null;\n landlinePhone?: string | null;\n mobilePhone?: string | null;\n};\n\nexport type ResourceImageType = {\n active: boolean;\n source: string;\n title: string;\n};\n\nexport type SocialMediaType = {\n name?: EnumSocialMedia;\n link?: string;\n};\n\nexport type UserLicenceType = {\n expiryDate: Date;\n issuedDate: Date;\n licenceType: EnumUserLicence;\n prevLicenceType?: EnumUserLicence | null;\n};\n\nexport type OwnerType = {\n email: string;\n userId: string;\n};\n\nexport interface BaseResourceTypeFormData {\n _id?: string;\n active: boolean;\n contactDetails: ResourceContactDetailsType | null;\n cover: ResourceImageType;\n coverUpload?: ResourceImageType | null;\n description: string;\n images?: ResourceImageType[] | null;\n imagesUpload?: ResourceImageType[] | null;\n logo?: ResourceImageType | null;\n logoUpload?: ResourceImageType | null;\n name: string;\n owner?: OwnerType | null;\n promoCodes?: PromoCodeType[] | null;\n region: string;\n socialMedia: SocialMediaType[] | null;\n termsAgreement?: TermsAgreement | null;\n}\n\nexport type PosterUsageType = {\n month: string;\n count: number;\n};\n\nexport type RelatedPostType = {\n postActive: boolean;\n postId: string;\n postSlug: string;\n postType: EnumPostType;\n};\n\nexport type SocialShareResourceType = {\n qrCode: ResourceImageType;\n socialImage: ResourceImageType;\n};\n\nexport type BaseResourceType = Omit<\n BaseResourceTypeFormData,\n \"_id\" | \"coverUpload\" | \"imagesUpload\" | \"logoUpload\"\n> & {\n _id: string;\n adIds?: string[] | null;\n approvedAt?: Date | null;\n createdAt: Date;\n deletedAt: Date | null;\n posterUsage?: PosterUsageType | null;\n rating?: number | null;\n relatedPost?: RelatedPostType | null;\n reviewCount?: number | null;\n slug: string;\n updatedAt: Date | null;\n};\n\nexport type LocationGeoType = {\n coordinates: number[]; // [longitude, latitude]\n type: \"Point\"; // Mongoose GeoJSON type\n};\n\nexport type LocationType = {\n city: string;\n country: string;\n fullAddress: string;\n geo: LocationGeoType;\n latitude: number;\n longitude: number;\n region: string;\n};\n\nexport type DateTimeType = {\n dateStatus: EnumEventDateStatus;\n endDate: string;\n endTime: string;\n startDate: string;\n startTime: string;\n};\n\nexport type Region = {\n latitude: number;\n latitudeDelta: number;\n longitude: number;\n longitudeDelta: number;\n};\n\nexport type ResourceDetails = {\n dateTime: DateTimeType[] | null;\n description: string | null;\n eventStatus?: EventStatusType | null;\n location: LocationType | null;\n resourceCover: ResourceImageType | null;\n resourceId: string;\n resourceLogo: ResourceImageType | null;\n resourceName: string;\n resourceType: EnumResourceType;\n};\n\nexport type GeocodeLocation = Pick<LocationType, \"latitude\" | \"longitude\">;\n\nexport type EventStatusType = {\n claimed: boolean;\n eventType: EnumEventType;\n googlePlaceId?: string | null;\n};\n\nexport interface FormField {\n disabled?: boolean;\n helperText?: string;\n isTextArea?: boolean;\n keyboardType?:\n | \"default\"\n | \"email-address\"\n | \"number-pad\"\n | \"url\"\n | \"decimal-pad\"\n | \"phone-pad\";\n name: string;\n placeholder: string;\n required?: boolean;\n secureTextEntry?: boolean;\n}\n\nexport interface FormDateField {\n dateMode: \"date\" | \"time\";\n helperText?: string;\n name: \"endDate\" | \"endTime\" | \"startDate\" | \"startTime\";\n placeholder: string;\n}\n\nexport interface SubcategoryItems {\n id: string;\n name: string;\n description?: string | null;\n}\n\nexport interface Subcategory {\n id: string;\n name: string;\n items?: SubcategoryItems[] | null;\n}\n\nexport interface Category {\n color?: string | null;\n description?: string | null;\n id: string;\n name: string;\n subcategories: Subcategory[];\n}\n\nexport type OptionItem = {\n value: string;\n label: string;\n};\n\nexport type ImageObjectType = {\n uri: string;\n type: string;\n name: string;\n};\n\nexport interface ResourceConnectionsType {\n events: EventListItemType[] | null;\n vendors: VendorType[] | null;\n}\n\nexport interface CreateFormData<T extends FieldValues> {\n control: Control<T, any>;\n fields: T;\n formState: FormState<T>;\n handleSubmit: UseFormHandleSubmit<T, any>;\n reset: UseFormReset<T>;\n setValue: UseFormSetValue<T>;\n watch: UseFormWatch<T>;\n getValues: UseFormGetValues<T>;\n}\n\nexport interface UseGetResourcesByRegionOptions {\n onlyClaimed?: boolean;\n limit?: number;\n offset?: number;\n}\n","import { EnumResourceType } from \"src/enums\";\n\nimport { CreateFormData } from \"./global\";\n\nexport enum EnumAdShowOn {\n EVENTS_PAGE = \"Events_page\",\n FRONT_PAGE = \"Front_page\",\n PARTNERS_PAGE = \"Partners_page\",\n VENDORS_PAGE = \"Vendors_page\",\n}\n\nexport enum EnumAdStatus {\n ACTIVE = \"Active\",\n PAUSED = \"Paused\",\n EXPIRED = \"Expired\",\n}\n\nexport enum EnumAdType {\n SPONSORED = \"Sponsored\",\n FREE = \"Free\",\n}\n\nexport enum EnumAdStyle {\n BLOOM = \"Bloom\",\n RISE = \"Rise\",\n}\n\nexport type AdResource = {\n adDescription: string;\n adImage: string;\n adStyle: EnumAdStyle;\n adTitle: string;\n adType: EnumAdType;\n resourceId: string;\n resourceName: string;\n resourceRegion: string;\n resourceType: EnumResourceType;\n resourceSlug: string;\n};\n\nexport interface AdFormData {\n active: boolean;\n end: Date; // ISO date string\n resource: AdResource;\n showOn: EnumAdShowOn[];\n start?: Date; // ISO date string\n status: EnumAdStatus;\n targetRegion: string[];\n}\n\n// Form state matches the validation schema: all resource fields are present.\n// Use empty strings / explicit enum defaults in `defaultValues` for \"create\" flows.\nexport type AdFormState = AdFormData;\n\nexport type CreateAdFormData = CreateFormData<AdFormData>;\nexport type CreateAdFormState = CreateFormData<AdFormState>;\n\nexport interface AdType extends AdFormData {\n _id: string;\n clicks?: number; // How many times the ad was clicked\n createdAt: Date;\n impressions?: number; // How often the ad was seen\n start: Date; // ISO date string\n updatedAt: Date | null;\n}\n","import {\n EnumEventDateStatus,\n EnumOSPlatform,\n EnumResourceType,\n} from \"src/enums\";\n\nimport { LocationGeoType } from \"./global\";\n\nexport enum EnumActivity {\n FAVORITE = \"FAVORITE\",\n GOING = \"GOING\",\n INTERESTED = \"INTERESTED\",\n PRESENT = \"PRESENT\",\n VIEW = \"VIEW\",\n}\n\nexport type ResourceActivityEntry = {\n activityType: EnumActivity;\n location: LocationGeoType | null;\n dateStatus?: EnumEventDateStatus | null;\n startDate?: string | null;\n startTime?: string | null;\n timestamp: Date;\n userAgent: EnumOSPlatform;\n userId?: string | null;\n};\n\nexport type ResourceActivityType = {\n _id: string;\n resourceType: EnumResourceType;\n resourceId: string;\n activity: ResourceActivityEntry[];\n};\n\nexport type ResourceActivityInputType = {\n resourceId: string;\n resourceType: EnumResourceType;\n activity: Omit<ResourceActivityEntry, \"timestamp\">;\n};\n","import { EnumResourceType } from \"src/enums\";\n\nimport { BaseGameType } from \"./game\";\nimport {\n CreateFormData,\n ResourceImageType,\n SocialShareResourceType,\n} from \"./global\";\n\nexport enum EnumPostType {\n MARKET_FACES = \"market_faces\",\n CLUE_BITES = \"clue_bites\",\n PLAY_AND_WIN = \"play_and_win\",\n}\n\nexport enum EnumPostContentType {\n GAME = \"game\",\n IMAGE = \"image\",\n LIST = \"list\",\n TEXTAREA = \"textarea\",\n VIDEO = \"video\",\n}\n\nexport type PostFileInput = {\n source: File;\n title?: string;\n};\n\nexport type PostContentTextarea = {\n textarea: {\n title?: string;\n data: string;\n };\n};\n\nexport type PostContentImage = {\n images: ResourceImageType[] | null;\n imagesUpload?: PostFileInput[] | null;\n};\n\nexport type PostContentVideo = {\n video: {\n source: string;\n title?: string;\n };\n};\n\nexport type PostContentList = {\n list: {\n title?: string;\n items: {\n text: string;\n }[];\n };\n};\n\nexport type PostContentGame = {\n game: BaseGameType;\n};\n\nexport type PostContentData =\n | PostContentGame\n | PostContentTextarea\n | PostContentImage\n | PostContentVideo\n | PostContentList;\n\nexport type PostContentFormData = {\n contentData?: PostContentData | null;\n contentOrder?: number | null;\n contentType?: EnumPostContentType | null;\n};\n\nexport type PostResource = {\n resourceSlug: string;\n resourceId: string;\n resourceType: EnumResourceType;\n resourceRegion: string;\n};\n\nexport interface PostFormData {\n active: boolean;\n caption: string;\n content: PostContentFormData[];\n cover?: ResourceImageType | null;\n coverUpload?: PostFileInput | null;\n postType: EnumPostType;\n resource?: PostResource | null;\n tags?: string[] | null;\n title: string;\n notifyUsers?: boolean | null;\n}\n\nexport type CreatePostFormData = CreateFormData<PostFormData>;\n\nexport type PostContentType = Omit<PostContentFormData, \"contentData\"> & {\n contentData: Omit<PostContentData, \"imagesUpload\">;\n};\n\nexport type PostType = Omit<\n PostFormData,\n \"content\" | \"coverUpload\" | \"resource\"\n> & {\n _id: string;\n approvedAt?: Date | null;\n content: PostContentType[];\n createdAt: Date;\n deletedAt: Date | null;\n resource?: PostResource | null;\n slug: string;\n sharePublic?: SocialShareResourceType | null;\n updatedAt: Date | null;\n};\n","import { OwnerType } from \"../global\";\n\nimport { DailyClueBaseGame, DailyClueGameData } from \"./dailyClue\";\nimport { EnumGameType, GameDate } from \"./global\";\nimport { PuzzleBaseGame, PuzzleGameData } from \"./puzzleGame\";\n\nexport type BaseGameMap = {\n [EnumGameType.DAILY_CLUE]: DailyClueBaseGame;\n [EnumGameType.MINI_QUIZ]: PuzzleBaseGame;\n [EnumGameType.ODD_ONE_OUT]: PuzzleBaseGame;\n};\n\nexport type BaseGameType = {\n gameType: EnumGameType;\n gameTypeId: string;\n gameTitle: string;\n} & {\n [K in keyof BaseGameMap]?: BaseGameMap[K] | null;\n};\n\nexport enum EnumGameStatus {\n GAME_COMPLETED = \"GAME_COMPLETED\",\n GAME_IN_PROGRESS = \"GAME_IN_PROGRESS\",\n GAME_LEFT = \"GAME_LEFT\",\n GAME_STARTED = \"GAME_STARTED\",\n}\n\nexport type GameHistory = Pick<\n BaseGameType,\n \"gameTitle\" | \"gameType\" | \"gameTypeId\"\n> & {\n createdAt: Date;\n gameDate: GameDate;\n gameStatus: EnumGameStatus;\n /** Per-event delta. Not persisted for overallGamePoints (computed at read time). */\n pointsEarned: number;\n /** Running total for this game instance; computed at read time, not stored in Mongo. */\n overallGamePoints?: number;\n};\n\ntype GameDataMap = {\n [EnumGameType.DAILY_CLUE]: DailyClueGameData;\n [EnumGameType.MINI_QUIZ]: PuzzleGameData;\n [EnumGameType.ODD_ONE_OUT]: PuzzleGameData;\n};\ntype GameDataType = {\n [K in keyof GameDataMap]?: GameDataMap[K] | null;\n};\n\nexport type GameType = Pick<\n BaseGameType,\n \"gameTitle\" | \"gameType\" | \"gameTypeId\"\n> & {\n _id: string;\n active: boolean;\n createdAt: Date;\n gameData: GameDataType;\n gameHistory: GameHistory[] | null;\n updatedAt: Date | null;\n};\n\nexport type GameDocType = {\n _id: string;\n active: boolean;\n createdAt: Date;\n deletedAt: Date | null;\n games: GameType[] | null;\n owner: OwnerType;\n points: number;\n updatedAt: Date | null;\n};\n\nexport type GameLeaderboard = {\n gameHistory: GameHistory[] | null;\n overallPoints: number;\n owner: OwnerType;\n};\n","import { GameDate, GlobalGameData } from \"./global\";\n\nconst OBJECT_ID_PATH_SEGMENT = \"[a-f0-9]{24}\";\nconst OBJECT_ID_PATH_SEGMENT_END = `${OBJECT_ID_PATH_SEGMENT}$`;\n\nexport const gameScreenIdentifierList = [\n {\n clue: \"Where your actions turn into a timeline.\",\n id: \"activities\",\n match: \"/profile/activities\",\n },\n {\n clue: \"Where conversations happen without speaking.\",\n id: \"chat\",\n match: \"/profile/chat\",\n },\n {\n clue: \"The place to redefine who you are.\",\n id: \"edit-profile\",\n match: \"/profile/edit-profile\",\n },\n {\n clue: \"A single moment worth showing up for.\",\n id: \"single-event\",\n match: new RegExp(`^/events/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"What’s happening around you, right now.\",\n id: \"events-near-me\",\n match: \"/events/events-near-me\",\n },\n {\n clue: \"Where events appear as pins on a map.\",\n id: \"events-map\",\n match: \"/events/events-map\",\n },\n {\n clue: \"A collection of events worth attending.\",\n id: \"events\",\n match: \"/events\",\n },\n {\n clue: \"What’s happening in a wider area — not just nearby.\",\n id: \"events-region\",\n match: /^\\/events\\/region\\/[^/]+$/,\n },\n {\n clue: \"Where fun becomes a challenge.\",\n id: \"games\",\n match: \"/games\",\n },\n {\n clue: \"Your starting point for everything.\",\n id: \"home\",\n match: \"/\",\n },\n {\n clue: \"Where the app whispers what you shouldn’t miss.\",\n id: \"notifications\",\n match: \"/notifications\",\n },\n {\n clue: \"Where you fine-tune your experience.\",\n id: \"options\",\n match: \"/options\",\n },\n {\n clue: \"An organisation or creator supporting the community.\",\n id: \"single-partner\",\n match: new RegExp(`^/partners/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"Organisations and creators supporting the community.\",\n id: \"partners\",\n match: \"/partners\",\n },\n {\n clue: \"A single published post in full view.\",\n id: \"single-visitor-post\",\n match: new RegExp(`^/visitors/post/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"Your identity, on display.\",\n id: \"profile\",\n match: \"/profile\",\n },\n {\n clue: \"One stallholder offering something valuable.\",\n id: \"single-vendor\",\n match: new RegExp(`^/vendors/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"Where every stallholder waits under the right category.\",\n id: \"vendors\",\n match: \"/vendors\",\n },\n {\n clue: \"Where you browse articles and posts from around the platform.\",\n id: \"visitors\",\n match: \"/visitors\",\n },\n] as const;\n\nexport type GamePlacement = (typeof gameScreenIdentifierList)[number][\"id\"];\nexport type GamePlacementClue =\n (typeof gameScreenIdentifierList)[number][\"clue\"];\n\nexport type DailyClueBaseGame = {\n gameDate: GameDate;\n gameSolution: string;\n};\n\nexport type DailyClueGameData = GlobalGameData & {\n gameFields: DailyClueBaseGame;\n lastFoundDate: Date | null;\n letterInfo: {\n collected: string[] | null; // The letters the user has found, e.g. [\"C\", \"L\", \"U\"]\n solutionShuffled: string[]; // The letters of the solution, but shuffled, e.g. [\"L\", \"C\", \"U\"]\n todaysClue: GamePlacementClue | null; // The clue for user to find the letter, e.g. related to {todaysPlacement}\n todaysLetter: string | null; // The letter the user has to find today, e.g. \"C\"\n todaysPlacement: GamePlacement | null; // The screen where the user has to find the clue, e.g. \"HomeScreen\"\n };\n};\n","export enum EnumGameType {\n DAILY_CLUE = \"dailyClue\",\n MINI_QUIZ = \"miniQuiz\",\n ODD_ONE_OUT = \"oddOneOut\",\n}\n\nexport type GameDate = {\n startDate: Date;\n endDate: Date;\n};\n\nexport const gameTypeToDisplayName: Record<EnumGameType, string> = {\n [EnumGameType.DAILY_CLUE]: \"Daily Clue\",\n [EnumGameType.MINI_QUIZ]: \"Mini Quiz\",\n [EnumGameType.ODD_ONE_OUT]: \"Odd One Out\",\n};\n\nexport type GlobalGameData = {\n points: number;\n // User has found the clue 3 days in a row, this is incrementing if the user finds the clue and decrements if user misses a day\n streak: number;\n};\n","import { EnumResourceType } from \"src/enums\";\n\nimport {\n CreateFormData,\n LocationType,\n OwnerType,\n PromoCodeType,\n SocialMediaType,\n} from \"./global\";\nimport { UserFormData } from \"./user\";\n\nexport enum EnumAffiliateParticipantType {\n INDIVIDUAL = \"INDIVIDUAL\",\n SOLE_TRADER = \"SOLE_TRADER\",\n COMPANY = \"COMPANY\",\n}\n\nexport type AffiliateContactDetails = {\n mobilePhone: string;\n};\n\nexport type AffiliateBankAccountDetailsType = {\n accountHolderName: string;\n accountNumber: string;\n};\n\nexport type AffiliateUserDefaultFields = Pick<\n UserFormData,\n \"email\" | \"firstName\" | \"lastName\" | \"termsAgreement\"\n>;\n\nexport type AffiliateDetailsType = AffiliateUserDefaultFields & {\n bankAccountDetails: AffiliateBankAccountDetailsType;\n contactDetails: AffiliateContactDetails;\n irdNumber: string;\n location: LocationType;\n participantType: EnumAffiliateParticipantType;\n region: string;\n socialMedia: SocialMediaType[] | null;\n};\n\nexport enum EnumAffiliateRewardType {\n ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS = \"ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS\",\n ACTIVE_VENDOR_BONUS_REWARD = \"ACTIVE_VENDOR_BONUS_REWARD\",\n ACTIVE_VENDOR_PRO_SUBSCRIPTION = \"ACTIVE_VENDOR_PRO_SUBSCRIPTION\",\n ACTIVE_VENDOR_STANDARD_SUBSCRIPTION = \"ACTIVE_VENDOR_STANDARD_SUBSCRIPTION\",\n NEW_EVENT_REGISTRATION = \"NEW_EVENT_REGISTRATION\",\n NEW_VENDOR_REGISTRATION = \"NEW_VENDOR_REGISTRATION\",\n}\n\nexport type AffiliateRewardType = {\n createdAt: Date;\n redeemedAt: Date | null;\n rewardDescription: string;\n rewardType: EnumAffiliateRewardType;\n rewardValue: number;\n};\n\nexport type AffiliateResourceType = {\n resourceActive: boolean;\n resourceDeletedAt: Date | null;\n resourceId: string;\n resourceName: string;\n resourceType: EnumResourceType;\n rewards: AffiliateRewardType[];\n};\n\nexport type RedeemHistoryType = {\n redeemedAt: Date;\n rewardValue: number;\n};\n\nexport interface AffiliateType {\n _id: string;\n active: boolean;\n approvedAt?: Date | null;\n affiliateBonusRewards?: AffiliateRewardType[] | null;\n affiliateCode: PromoCodeType | null;\n affiliateDetails: AffiliateDetailsType | null;\n affiliateResources: AffiliateResourceType[];\n createdAt: Date;\n deletedAt: Date | null;\n overallPoints: number;\n owner: OwnerType;\n redeemHistory?: RedeemHistoryType[] | null;\n updatedAt: Date | null;\n}\n\nexport type AffiliateFormData = AffiliateDetailsType &\n Pick<AffiliateType, \"_id\">;\n\nexport type CreateAffiliateFormData = CreateFormData<AffiliateFormData>;\n"],"mappings":";AASO,IAAK,uBAAL,kBAAKA,0BAAL;AACL,EAAAA,sBAAA,cAAW;AACX,EAAAA,sBAAA,oBAAiB;AAFP,SAAAA;AAAA,GAAA;;;ACcL,IAAM,oBAAoB;;;AC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;AAAA,EACnE;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,IAAI;AAAA,IACJ,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,IAAI;AAAA,IACJ,OAAO,IAAI,OAAO,aAAa,0BAA0B,EAAE;AAAA,EAC7D;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,IAAI;AAAA,IACJ,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,IAAI;AAAA,IACJ,OAAO;AAAA,EACT;AACF;;;ACrGO,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,gBAAa;AACb,EAAAA,cAAA,eAAY;AACZ,EAAAA,cAAA,iBAAc;AAHJ,SAAAA;AAAA,GAAA;AAWL,IAAM,wBAAsD;AAAA,EACjE,CAAC,4BAAuB,GAAG;AAAA,EAC3B,CAAC,0BAAsB,GAAG;AAAA,EAC1B,CAAC,6BAAwB,GAAG;AAC9B;;;ACJO,IAAK,+BAAL,kBAAKC,kCAAL;AACL,EAAAA,8BAAA,gBAAa;AACb,EAAAA,8BAAA,iBAAc;AACd,EAAAA,8BAAA,aAAU;AAHA,SAAAA;AAAA,GAAA;AA8BL,IAAK,0BAAL,kBAAKC,6BAAL;AACL,EAAAA,yBAAA,4CAAyC;AACzC,EAAAA,yBAAA,gCAA6B;AAC7B,EAAAA,yBAAA,oCAAiC;AACjC,EAAAA,yBAAA,yCAAsC;AACtC,EAAAA,yBAAA,4BAAyB;AACzB,EAAAA,yBAAA,6BAA0B;AANhB,SAAAA;AAAA,GAAA;","names":["EnumVerificationType","EnumAdShowOn","EnumAdStatus","EnumAdType","EnumAdStyle","EnumActivity","EnumPostType","EnumPostContentType","EnumGameStatus","EnumGameType","EnumAffiliateParticipantType","EnumAffiliateRewardType"]}
@@ -42,7 +42,7 @@ import {
42
42
  USER_FIELDS_FRAGMENT,
43
43
  VENDOR,
44
44
  VENDOR_INFO
45
- } from "./chunk-UOFI3LKZ.mjs";
45
+ } from "./chunk-P4XULG5P.mjs";
46
46
 
47
47
  // src/graphql/queries/post.ts
48
48
  import { gql as gql3 } from "@apollo/client";
@@ -466,7 +466,6 @@ var CHAT_MESSAGE_FIELDS_FRAGMENT = gql7`
466
466
  var CHAT_PARTICIPANT = gql7`
467
467
  fragment ChatParticipantFields on ChatParticipantType {
468
468
  active
469
- isAssociate
470
469
  userAvatar
471
470
  userEmail
472
471
  userId
@@ -3470,4 +3469,4 @@ export {
3470
3469
  useDeleteAffiliate,
3471
3470
  useRedeemAffiliateReward
3472
3471
  };
3473
- //# sourceMappingURL=chunk-MOB5R5BF.mjs.map
3472
+ //# sourceMappingURL=chunk-G3CMTXQV.mjs.map