@timardex/cluemart-shared 1.6.130 → 1.7.0

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 (168) hide show
  1. package/dist/ad-CVkVX_z5.d.ts +296 -0
  2. package/dist/ad-DA9ECAhK.d.mts +296 -0
  3. package/dist/affiliate-1RtkLnLP.d.ts +35 -0
  4. package/dist/affiliate-Cos2Syz5.d.mts +35 -0
  5. package/dist/chunk-HZMP7GXC.mjs +5330 -0
  6. package/dist/chunk-HZMP7GXC.mjs.map +1 -0
  7. package/dist/chunk-KZTOISPA.mjs +272 -0
  8. package/dist/chunk-KZTOISPA.mjs.map +1 -0
  9. package/dist/chunk-MVQ3CFQR.mjs +230 -0
  10. package/dist/chunk-MVQ3CFQR.mjs.map +1 -0
  11. package/dist/chunk-NPFJ2CN2.mjs +109 -0
  12. package/dist/chunk-NPFJ2CN2.mjs.map +1 -0
  13. package/dist/chunk-RKIRWZCH.mjs +368 -0
  14. package/dist/chunk-RKIRWZCH.mjs.map +1 -0
  15. package/dist/{chunk-OHHJ3KJJ.mjs → chunk-TAECMXM4.mjs} +267 -304
  16. package/dist/chunk-TAECMXM4.mjs.map +1 -0
  17. package/dist/chunk-VA5YN2K3.mjs +48 -0
  18. package/dist/chunk-VA5YN2K3.mjs.map +1 -0
  19. package/dist/chunk-ZZJSCYJK.mjs +958 -0
  20. package/dist/chunk-ZZJSCYJK.mjs.map +1 -0
  21. package/dist/contactUs-DGrDzJaM.d.mts +11 -0
  22. package/dist/contactUs-H7799pWe.d.ts +11 -0
  23. package/dist/enums/index.cjs +223 -2
  24. package/dist/enums/index.cjs.map +1 -1
  25. package/dist/enums/index.d.mts +164 -5
  26. package/dist/enums/index.d.ts +164 -5
  27. package/dist/enums/index.mjs +41 -1
  28. package/dist/formFields/index.cjs +168 -403
  29. package/dist/formFields/index.cjs.map +1 -1
  30. package/dist/formFields/index.d.mts +3 -6
  31. package/dist/formFields/index.d.ts +3 -6
  32. package/dist/formFields/index.mjs +47 -921
  33. package/dist/formFields/index.mjs.map +1 -1
  34. package/dist/global-BUUfmCo7.d.mts +698 -0
  35. package/dist/global-fKbMmluy.d.ts +698 -0
  36. package/dist/graphql/index.cjs +3329 -3340
  37. package/dist/graphql/index.cjs.map +1 -1
  38. package/dist/graphql/index.d.mts +487 -690
  39. package/dist/graphql/index.d.ts +487 -690
  40. package/dist/graphql/index.mjs +153 -2552
  41. package/dist/graphql/index.mjs.map +1 -1
  42. package/dist/hooks/index.cjs +3478 -773
  43. package/dist/hooks/index.cjs.map +1 -1
  44. package/dist/hooks/index.d.mts +6 -13
  45. package/dist/hooks/index.d.ts +6 -13
  46. package/dist/hooks/index.mjs +99 -193
  47. package/dist/hooks/index.mjs.map +1 -1
  48. package/dist/images/apple-maps-icon.webp.d.ts +1 -8
  49. package/dist/images/banner-horizontal.webp.d.ts +1 -8
  50. package/dist/images/banner-vertical.webp.d.ts +1 -8
  51. package/dist/images/cluiTui.webp.d.ts +1 -8
  52. package/dist/images/corporate.webp.d.ts +1 -8
  53. package/dist/images/facebook.webp.d.ts +1 -8
  54. package/dist/images/gazebo-top.webp.d.ts +1 -8
  55. package/dist/images/google-maps-icon.webp.d.ts +1 -8
  56. package/dist/images/googleMaps-logo-dark.webp.d.ts +1 -8
  57. package/dist/images/googleMaps-logo-light.webp.d.ts +1 -8
  58. package/dist/images/index.mjs +21 -86
  59. package/dist/images/index.mjs.map +1 -1
  60. package/dist/images/instagram.webp.d.ts +1 -8
  61. package/dist/images/logo-atr.webp.d.ts +1 -8
  62. package/dist/images/logo-dark.webp.d.ts +1 -8
  63. package/dist/images/logo.webp.d.ts +1 -8
  64. package/dist/images/meet.webp.d.ts +1 -8
  65. package/dist/images/mini-market1.webp.d.ts +1 -8
  66. package/dist/images/mini-market2.webp.d.ts +1 -8
  67. package/dist/images/mini-market3.webp.d.ts +1 -8
  68. package/dist/images/mini-market4.webp.d.ts +1 -8
  69. package/dist/images/mini-market5.webp.d.ts +1 -8
  70. package/dist/images/poll.webp.d.ts +1 -8
  71. package/dist/images/poster1.webp.d.ts +1 -8
  72. package/dist/images/poster2.webp.d.ts +1 -8
  73. package/dist/images/poster3.webp.d.ts +1 -8
  74. package/dist/images/poster4.webp.d.ts +1 -8
  75. package/dist/images/private.webp.d.ts +1 -8
  76. package/dist/images/qr-code.webp.d.ts +1 -8
  77. package/dist/images/school.webp.d.ts +1 -8
  78. package/dist/images/sima.webp.d.ts +1 -8
  79. package/dist/images/store-android.webp.d.ts +1 -8
  80. package/dist/images/store-ios.webp.d.ts +1 -8
  81. package/dist/images/tablas.webp.d.ts +1 -8
  82. package/dist/images/telefonos.webp.d.ts +1 -8
  83. package/dist/images/tiktok.webp.d.ts +1 -8
  84. package/dist/images/tip.webp.d.ts +1 -8
  85. package/dist/images/ugralos.webp.d.ts +1 -8
  86. package/dist/images/waze-maps-icon.webp.d.ts +1 -8
  87. package/dist/images/website.webp.d.ts +1 -8
  88. package/dist/images/youtube.webp.d.ts +1 -8
  89. package/dist/index.cjs +5883 -7079
  90. package/dist/index.cjs.map +1 -1
  91. package/dist/index.d.mts +1692 -2966
  92. package/dist/index.d.ts +1692 -2966
  93. package/dist/index.mjs +5020 -6162
  94. package/dist/index.mjs.map +1 -1
  95. package/dist/map/index.cjs +9 -14
  96. package/dist/map/index.cjs.map +1 -1
  97. package/dist/map/index.d.mts +14 -18
  98. package/dist/map/index.d.ts +14 -18
  99. package/dist/map/index.mjs +9 -14
  100. package/dist/map/index.mjs.map +1 -1
  101. package/dist/resourceActivities-BL_12IAo.d.ts +125 -0
  102. package/dist/resourceActivities-zczOntNk.d.mts +125 -0
  103. package/dist/sharing/index.cjs +1272 -63
  104. package/dist/sharing/index.cjs.map +1 -1
  105. package/dist/sharing/index.d.mts +7 -32
  106. package/dist/sharing/index.d.ts +7 -32
  107. package/dist/sharing/index.mjs +30 -188
  108. package/dist/sharing/index.mjs.map +1 -1
  109. package/dist/theme/index.mjs +5 -41
  110. package/dist/theme/index.mjs.map +1 -1
  111. package/dist/types/index.cjs +110 -868
  112. package/dist/types/index.cjs.map +1 -1
  113. package/dist/types/index.d.mts +24 -230
  114. package/dist/types/index.d.ts +24 -230
  115. package/dist/types/index.mjs +27 -61
  116. package/dist/utils/index.cjs +214 -608
  117. package/dist/utils/index.cjs.map +1 -1
  118. package/dist/utils/index.d.mts +53 -107
  119. package/dist/utils/index.d.ts +53 -107
  120. package/dist/utils/index.mjs +15 -43
  121. package/package.json +12 -40
  122. package/dist/affiliate-Bqqlffw8.d.mts +0 -36
  123. package/dist/affiliate-Btlp5XUp.d.ts +0 -36
  124. package/dist/affiliateAdapters-BW3BY7c5.d.mts +0 -118
  125. package/dist/affiliateAdapters-C51ISmuA.d.ts +0 -118
  126. package/dist/apollo/index.cjs +0 -1383
  127. package/dist/apollo/index.cjs.map +0 -1
  128. package/dist/apollo/index.d.mts +0 -323
  129. package/dist/apollo/index.d.ts +0 -323
  130. package/dist/apollo/index.mjs +0 -1295
  131. package/dist/apollo/index.mjs.map +0 -1
  132. package/dist/auth/index.cjs +0 -3322
  133. package/dist/auth/index.cjs.map +0 -1
  134. package/dist/auth/index.d.mts +0 -164
  135. package/dist/auth/index.d.ts +0 -164
  136. package/dist/auth/index.mjs +0 -379
  137. package/dist/auth/index.mjs.map +0 -1
  138. package/dist/auth-BOmAO53v.d.ts +0 -169
  139. package/dist/auth-CsITA95p.d.mts +0 -169
  140. package/dist/chunk-DATBGC2K.mjs +0 -347
  141. package/dist/chunk-DATBGC2K.mjs.map +0 -1
  142. package/dist/chunk-DDHECBJR.mjs +0 -726
  143. package/dist/chunk-DDHECBJR.mjs.map +0 -1
  144. package/dist/chunk-INQCDU24.mjs +0 -139
  145. package/dist/chunk-INQCDU24.mjs.map +0 -1
  146. package/dist/chunk-NWWKI4PJ.mjs +0 -297
  147. package/dist/chunk-NWWKI4PJ.mjs.map +0 -1
  148. package/dist/chunk-OHHJ3KJJ.mjs.map +0 -1
  149. package/dist/chunk-RAYUJODN.mjs +0 -45
  150. package/dist/chunk-RAYUJODN.mjs.map +0 -1
  151. package/dist/chunk-TOEFAEF2.mjs +0 -69
  152. package/dist/chunk-TOEFAEF2.mjs.map +0 -1
  153. package/dist/chunk-UKW7NZEQ.mjs +0 -2813
  154. package/dist/chunk-UKW7NZEQ.mjs.map +0 -1
  155. package/dist/dailyClue-C6WXY73z.d.mts +0 -105
  156. package/dist/dailyClue-C6WXY73z.d.ts +0 -105
  157. package/dist/event-C9K7CSg4.d.ts +0 -53
  158. package/dist/event-W0NhL5Cd.d.mts +0 -53
  159. package/dist/global-BbSFfYdd.d.ts +0 -181
  160. package/dist/global-C6v9tRji.d.mts +0 -181
  161. package/dist/graphql-CDOfA79A.d.ts +0 -1253
  162. package/dist/graphql-CcvzTs9k.d.mts +0 -1253
  163. package/dist/resourceActivities-CS8YRIIL.d.mts +0 -89
  164. package/dist/resourceActivities-DOdNPkhW.d.ts +0 -89
  165. package/dist/subscription-Cj_qBA7u.d.mts +0 -20
  166. package/dist/subscription-OiJ50uJb.d.ts +0 -20
  167. package/dist/vendor-DmMi2qmx.d.mts +0 -73
  168. package/dist/vendor-M9hVZlni.d.ts +0 -73
@@ -1,164 +0,0 @@
1
- import { U as UserRoleEnumType, f as ResourceTypeEnum, e as LicencesEnumType, C as UserType } from '../graphql-CcvzTs9k.mjs';
2
- import { P as Permission, T as Tier } from '../subscription-Cj_qBA7u.mjs';
3
- export { a as PERMISSIONS, W as WILDCARD_PERMISSION } from '../subscription-Cj_qBA7u.mjs';
4
- import React, { ReactNode } from 'react';
5
- import '../images/index.mjs';
6
-
7
- type AuthManager = {
8
- logout: () => Promise<void>;
9
- setLogout: (fn: () => Promise<void>) => void;
10
- handleRefetchUser: () => Promise<void>;
11
- setUserRefetch: (fn: () => Promise<void>) => void;
12
- };
13
- /**
14
- * Creates an auth manager used by Apollo error links to trigger logout/refetch
15
- * without importing React. Matches the former mobile authManager shape.
16
- *
17
- * `logout()` dedupes concurrent calls via an in-flight promise so token-refresh
18
- * failures do not kick off multiple logout sequences.
19
- */
20
- declare function createAuthManager(): AuthManager;
21
-
22
- /** Roles allowed to sign into the admin web app (CUSTOMER-only is denied). */
23
- declare const ADMIN_APP_ROLES: readonly [UserRoleEnumType.SuperAdmin, UserRoleEnumType.Admin, UserRoleEnumType.Event, UserRoleEnumType.Vendor, UserRoleEnumType.Partner, UserRoleEnumType.School, UserRoleEnumType.Affiliate];
24
- type AdminAppRole = (typeof ADMIN_APP_ROLES)[number];
25
- type AdminDashboardContext = "staff" | "event" | "vendor" | "partner" | "school" | "affiliate";
26
- type AdminDashboardContextInfo = {
27
- context: AdminDashboardContext;
28
- home: string;
29
- label: string;
30
- /** Path prefixes that belong to this context (including home). */
31
- pathPrefixes: readonly string[];
32
- roles: readonly UserRoleEnumType[];
33
- };
34
- /**
35
- * Priority order for default home + role switcher.
36
- * Staff first, then product roles.
37
- */
38
- declare const ADMIN_DASHBOARD_CONTEXTS: readonly AdminDashboardContextInfo[];
39
- declare function canAccessAdminApp(roles: UserRoleEnumType[] | null | undefined): boolean;
40
- declare function getUsableAdminContexts(roles: UserRoleEnumType[] | null | undefined): AdminDashboardContextInfo[];
41
- declare function getDefaultAdminHome(roles: UserRoleEnumType[] | null | undefined, preferredContext?: AdminDashboardContext | null): string;
42
- declare function resolveAdminContextFromPath(pathname: string): AdminDashboardContext | null;
43
- declare function canAccessAdminPath(roles: UserRoleEnumType[] | null | undefined, pathname: string): boolean;
44
-
45
- /**
46
- * Union of permissions for the given roles (deduped, stable order).
47
- */
48
- declare function getPermissionsForRoles(roles: UserRoleEnumType[] | null | undefined): Permission[];
49
- /**
50
- * Check a concrete permission list (e.g. authUser.permissions) for a grant.
51
- * Honours the "*" wildcard.
52
- */
53
- declare function permissionListIncludes(permissions: readonly Permission[] | null | undefined, permission: Permission): boolean;
54
- declare function hasPermission(roles: UserRoleEnumType[] | null | undefined, permission: Permission): boolean;
55
- declare function hasAnyPermission(roles: UserRoleEnumType[] | null | undefined, permissions: readonly Permission[]): boolean;
56
- declare function hasAllPermissions(roles: UserRoleEnumType[] | null | undefined, permissions: readonly Permission[]): boolean;
57
- declare function hasRole(roles: UserRoleEnumType[] | null | undefined, role: UserRoleEnumType): boolean;
58
- declare function hasAnyRole(roles: UserRoleEnumType[] | null | undefined, checkRoles: readonly UserRoleEnumType[]): boolean;
59
-
60
- /**
61
- * Static role → permissions map. Source of truth for access.
62
- * Permissions for a user = union of all their roles' lists.
63
- */
64
- declare const ROLE_PERMISSIONS: Record<UserRoleEnumType, readonly Permission[]>;
65
-
66
- type LimitType = "availability" | "images" | "calendar" | "posters" | "productsList" | "statistics" | "relationShare";
67
- interface RoleLicences {
68
- pro_plus: boolean;
69
- pro: boolean;
70
- standard: boolean;
71
- }
72
- interface LicencesByRole {
73
- event: RoleLicences;
74
- vendor: RoleLicences;
75
- partner: RoleLicences;
76
- }
77
- /** Resource types with subscription/licence limits (excludes affiliate & school). */
78
- type LicencedResourceType = Exclude<ResourceTypeEnum, ResourceTypeEnum.Affiliate | ResourceTypeEnum.School>;
79
- /** Licence badges shown on the profile screen (excludes affiliate & school). */
80
- type ProfileBadgeLicence = Exclude<LicencesEnumType, LicencesEnumType.StandardAffiliate | LicencesEnumType.StandardSchool>;
81
- type HasLicenceResult = {
82
- directLicence: boolean;
83
- };
84
- type LogoutReason = "manual" | "expired";
85
- type AuthStorageAdapter = {
86
- getItem: (key: string) => Promise<string | null>;
87
- setItem: (key: string, value: string) => Promise<void>;
88
- removeItem: (key: string) => Promise<void>;
89
- };
90
- type AuthManagerLike = {
91
- setLogout: (fn: () => Promise<void>) => void;
92
- setUserRefetch: (fn: () => Promise<void>) => void;
93
- };
94
- type UseAuthCoreAdapters = {
95
- storage: AuthStorageAdapter;
96
- authManager: AuthManagerLike;
97
- /**
98
- * Platform cleanup after optional GraphQL logout (tokens, nav, Apollo/WS, etc.).
99
- * Core clears `authUser` + `USER_STORAGE_KEY` after this resolves.
100
- */
101
- afterLogout: (reason: LogoutReason) => Promise<void>;
102
- /** Defaults to always true (mobile). Admin should return true only for `"manual"`. */
103
- shouldCallLogoutMutation?: (reason: LogoutReason) => boolean;
104
- /** Called when GraphQL logout returns a message (mobile success toast). */
105
- notifyLogoutSuccess?: (message: string) => void;
106
- /** Called after an expired-session logout completes (mobile/admin expired toasts). */
107
- notifySessionExpired?: () => void;
108
- onError?: (error: unknown, meta: {
109
- action: string;
110
- }) => void;
111
- };
112
- interface UseAuthReturnType {
113
- authUser: UserType | null;
114
- isAffiliate: boolean;
115
- isSchool: boolean;
116
- handleLogoutExplicit: () => Promise<void>;
117
- hasEventLicence: HasLicenceResult;
118
- hasPartnerLicence: HasLicenceResult;
119
- hasPermission: (permission: Permission) => boolean;
120
- hasRole: (role: UserRoleEnumType) => boolean;
121
- hasUserLicence: (licenceType: LicencesEnumType) => boolean;
122
- hasVendorLicence: HasLicenceResult;
123
- isAdmin: boolean;
124
- isSuperAdmin: boolean;
125
- isLoading: boolean;
126
- permissions: Permission[];
127
- getLicenseAccessLevel: (limitType: LimitType, resourceId: string, resourceType: ResourceTypeEnum) => number;
128
- refetchUser: () => Promise<void>;
129
- setUser: (user: UserType | null) => Promise<void>;
130
- }
131
-
132
- declare function isLicencedResourceType(resourceType: ResourceTypeEnum): resourceType is LicencedResourceType;
133
- declare function isProfileBadgeLicence(licenceType: LicencesEnumType): licenceType is ProfileBadgeLicence;
134
- declare const hasUserLicenceType: (authUser: UserType | null, licenceType: LicencesEnumType) => boolean;
135
- declare const hasLicence: (authUser: UserType | null, licenceType: "vendor" | "partner" | "event") => HasLicenceResult;
136
- /** Default limits per subscription tier. */
137
- declare const DEFAULT_LIMITS: Record<LimitType, Record<Tier, number>>;
138
- /** All tiers off — used when the viewer does not own the resource. */
139
- declare const NO_LICENCE_FLAGS: LicencesByRole;
140
- /**
141
- * Parses an array of licence strings into structured, role-based licences.
142
- * Users with no licences yet default to pro (create / trial access).
143
- */
144
- declare function getLicenceFlagsByRole(licences?: string[]): LicencesByRole;
145
-
146
- /**
147
- * Platform-agnostic auth session core (source of truth for shared useAuth).
148
- *
149
- * Owns: persisted user load/set, refetch, role/licence flags, logout orchestration.
150
- * Does not own: AsyncStorage vs localStorage, Expo/Next navigation, toasts,
151
- * Apollo/WS reset, Firebase — those stay in each app's adapter wrapper.
152
- */
153
- declare function useAuthCore(adapters: UseAuthCoreAdapters): UseAuthReturnType;
154
-
155
- /**
156
- * Provides auth session value from the app's thin useAuth wrapper.
157
- */
158
- declare const UserProvider: React.FC<{
159
- children: ReactNode;
160
- value: UseAuthReturnType;
161
- }>;
162
- declare const useAuthUser: () => UseAuthReturnType;
163
-
164
- 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, NO_LICENCE_FLAGS, 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,164 +0,0 @@
1
- import { U as UserRoleEnumType, f as ResourceTypeEnum, e as LicencesEnumType, C as UserType } from '../graphql-CDOfA79A.js';
2
- import { P as Permission, T as Tier } from '../subscription-OiJ50uJb.js';
3
- export { a as PERMISSIONS, W as WILDCARD_PERMISSION } from '../subscription-OiJ50uJb.js';
4
- import React, { ReactNode } from 'react';
5
- import '../images/index.js';
6
-
7
- type AuthManager = {
8
- logout: () => Promise<void>;
9
- setLogout: (fn: () => Promise<void>) => void;
10
- handleRefetchUser: () => Promise<void>;
11
- setUserRefetch: (fn: () => Promise<void>) => void;
12
- };
13
- /**
14
- * Creates an auth manager used by Apollo error links to trigger logout/refetch
15
- * without importing React. Matches the former mobile authManager shape.
16
- *
17
- * `logout()` dedupes concurrent calls via an in-flight promise so token-refresh
18
- * failures do not kick off multiple logout sequences.
19
- */
20
- declare function createAuthManager(): AuthManager;
21
-
22
- /** Roles allowed to sign into the admin web app (CUSTOMER-only is denied). */
23
- declare const ADMIN_APP_ROLES: readonly [UserRoleEnumType.SuperAdmin, UserRoleEnumType.Admin, UserRoleEnumType.Event, UserRoleEnumType.Vendor, UserRoleEnumType.Partner, UserRoleEnumType.School, UserRoleEnumType.Affiliate];
24
- type AdminAppRole = (typeof ADMIN_APP_ROLES)[number];
25
- type AdminDashboardContext = "staff" | "event" | "vendor" | "partner" | "school" | "affiliate";
26
- type AdminDashboardContextInfo = {
27
- context: AdminDashboardContext;
28
- home: string;
29
- label: string;
30
- /** Path prefixes that belong to this context (including home). */
31
- pathPrefixes: readonly string[];
32
- roles: readonly UserRoleEnumType[];
33
- };
34
- /**
35
- * Priority order for default home + role switcher.
36
- * Staff first, then product roles.
37
- */
38
- declare const ADMIN_DASHBOARD_CONTEXTS: readonly AdminDashboardContextInfo[];
39
- declare function canAccessAdminApp(roles: UserRoleEnumType[] | null | undefined): boolean;
40
- declare function getUsableAdminContexts(roles: UserRoleEnumType[] | null | undefined): AdminDashboardContextInfo[];
41
- declare function getDefaultAdminHome(roles: UserRoleEnumType[] | null | undefined, preferredContext?: AdminDashboardContext | null): string;
42
- declare function resolveAdminContextFromPath(pathname: string): AdminDashboardContext | null;
43
- declare function canAccessAdminPath(roles: UserRoleEnumType[] | null | undefined, pathname: string): boolean;
44
-
45
- /**
46
- * Union of permissions for the given roles (deduped, stable order).
47
- */
48
- declare function getPermissionsForRoles(roles: UserRoleEnumType[] | null | undefined): Permission[];
49
- /**
50
- * Check a concrete permission list (e.g. authUser.permissions) for a grant.
51
- * Honours the "*" wildcard.
52
- */
53
- declare function permissionListIncludes(permissions: readonly Permission[] | null | undefined, permission: Permission): boolean;
54
- declare function hasPermission(roles: UserRoleEnumType[] | null | undefined, permission: Permission): boolean;
55
- declare function hasAnyPermission(roles: UserRoleEnumType[] | null | undefined, permissions: readonly Permission[]): boolean;
56
- declare function hasAllPermissions(roles: UserRoleEnumType[] | null | undefined, permissions: readonly Permission[]): boolean;
57
- declare function hasRole(roles: UserRoleEnumType[] | null | undefined, role: UserRoleEnumType): boolean;
58
- declare function hasAnyRole(roles: UserRoleEnumType[] | null | undefined, checkRoles: readonly UserRoleEnumType[]): boolean;
59
-
60
- /**
61
- * Static role → permissions map. Source of truth for access.
62
- * Permissions for a user = union of all their roles' lists.
63
- */
64
- declare const ROLE_PERMISSIONS: Record<UserRoleEnumType, readonly Permission[]>;
65
-
66
- type LimitType = "availability" | "images" | "calendar" | "posters" | "productsList" | "statistics" | "relationShare";
67
- interface RoleLicences {
68
- pro_plus: boolean;
69
- pro: boolean;
70
- standard: boolean;
71
- }
72
- interface LicencesByRole {
73
- event: RoleLicences;
74
- vendor: RoleLicences;
75
- partner: RoleLicences;
76
- }
77
- /** Resource types with subscription/licence limits (excludes affiliate & school). */
78
- type LicencedResourceType = Exclude<ResourceTypeEnum, ResourceTypeEnum.Affiliate | ResourceTypeEnum.School>;
79
- /** Licence badges shown on the profile screen (excludes affiliate & school). */
80
- type ProfileBadgeLicence = Exclude<LicencesEnumType, LicencesEnumType.StandardAffiliate | LicencesEnumType.StandardSchool>;
81
- type HasLicenceResult = {
82
- directLicence: boolean;
83
- };
84
- type LogoutReason = "manual" | "expired";
85
- type AuthStorageAdapter = {
86
- getItem: (key: string) => Promise<string | null>;
87
- setItem: (key: string, value: string) => Promise<void>;
88
- removeItem: (key: string) => Promise<void>;
89
- };
90
- type AuthManagerLike = {
91
- setLogout: (fn: () => Promise<void>) => void;
92
- setUserRefetch: (fn: () => Promise<void>) => void;
93
- };
94
- type UseAuthCoreAdapters = {
95
- storage: AuthStorageAdapter;
96
- authManager: AuthManagerLike;
97
- /**
98
- * Platform cleanup after optional GraphQL logout (tokens, nav, Apollo/WS, etc.).
99
- * Core clears `authUser` + `USER_STORAGE_KEY` after this resolves.
100
- */
101
- afterLogout: (reason: LogoutReason) => Promise<void>;
102
- /** Defaults to always true (mobile). Admin should return true only for `"manual"`. */
103
- shouldCallLogoutMutation?: (reason: LogoutReason) => boolean;
104
- /** Called when GraphQL logout returns a message (mobile success toast). */
105
- notifyLogoutSuccess?: (message: string) => void;
106
- /** Called after an expired-session logout completes (mobile/admin expired toasts). */
107
- notifySessionExpired?: () => void;
108
- onError?: (error: unknown, meta: {
109
- action: string;
110
- }) => void;
111
- };
112
- interface UseAuthReturnType {
113
- authUser: UserType | null;
114
- isAffiliate: boolean;
115
- isSchool: boolean;
116
- handleLogoutExplicit: () => Promise<void>;
117
- hasEventLicence: HasLicenceResult;
118
- hasPartnerLicence: HasLicenceResult;
119
- hasPermission: (permission: Permission) => boolean;
120
- hasRole: (role: UserRoleEnumType) => boolean;
121
- hasUserLicence: (licenceType: LicencesEnumType) => boolean;
122
- hasVendorLicence: HasLicenceResult;
123
- isAdmin: boolean;
124
- isSuperAdmin: boolean;
125
- isLoading: boolean;
126
- permissions: Permission[];
127
- getLicenseAccessLevel: (limitType: LimitType, resourceId: string, resourceType: ResourceTypeEnum) => number;
128
- refetchUser: () => Promise<void>;
129
- setUser: (user: UserType | null) => Promise<void>;
130
- }
131
-
132
- declare function isLicencedResourceType(resourceType: ResourceTypeEnum): resourceType is LicencedResourceType;
133
- declare function isProfileBadgeLicence(licenceType: LicencesEnumType): licenceType is ProfileBadgeLicence;
134
- declare const hasUserLicenceType: (authUser: UserType | null, licenceType: LicencesEnumType) => boolean;
135
- declare const hasLicence: (authUser: UserType | null, licenceType: "vendor" | "partner" | "event") => HasLicenceResult;
136
- /** Default limits per subscription tier. */
137
- declare const DEFAULT_LIMITS: Record<LimitType, Record<Tier, number>>;
138
- /** All tiers off — used when the viewer does not own the resource. */
139
- declare const NO_LICENCE_FLAGS: LicencesByRole;
140
- /**
141
- * Parses an array of licence strings into structured, role-based licences.
142
- * Users with no licences yet default to pro (create / trial access).
143
- */
144
- declare function getLicenceFlagsByRole(licences?: string[]): LicencesByRole;
145
-
146
- /**
147
- * Platform-agnostic auth session core (source of truth for shared useAuth).
148
- *
149
- * Owns: persisted user load/set, refetch, role/licence flags, logout orchestration.
150
- * Does not own: AsyncStorage vs localStorage, Expo/Next navigation, toasts,
151
- * Apollo/WS reset, Firebase — those stay in each app's adapter wrapper.
152
- */
153
- declare function useAuthCore(adapters: UseAuthCoreAdapters): UseAuthReturnType;
154
-
155
- /**
156
- * Provides auth session value from the app's thin useAuth wrapper.
157
- */
158
- declare const UserProvider: React.FC<{
159
- children: ReactNode;
160
- value: UseAuthReturnType;
161
- }>;
162
- declare const useAuthUser: () => UseAuthReturnType;
163
-
164
- 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, NO_LICENCE_FLAGS, 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 };