@elevasis/ui 1.0.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.
- package/dist/api/index.d.ts +87 -0
- package/dist/api/index.js +3 -0
- package/dist/auth/context.d.ts +19 -0
- package/dist/auth/context.js +1 -0
- package/dist/auth/index.d.ts +85 -0
- package/dist/auth/index.js +3 -0
- package/dist/chunk-3KMDHCAR.js +52 -0
- package/dist/chunk-5UWFGBFM.js +129 -0
- package/dist/chunk-6BJOYF6E.js +8 -0
- package/dist/chunk-6M6OLGQY.js +36 -0
- package/dist/chunk-7AI5ZYJ4.js +202 -0
- package/dist/chunk-7PLEQFHO.js +18 -0
- package/dist/chunk-GDV44UWF.js +138 -0
- package/dist/chunk-GEFB5YIR.js +338 -0
- package/dist/chunk-HBRMWW6V.js +43 -0
- package/dist/chunk-HUWJXLLF.js +681 -0
- package/dist/chunk-J3FALDQE.js +176 -0
- package/dist/chunk-JKERRYVS.js +109 -0
- package/dist/chunk-KA7LO7U5.js +28 -0
- package/dist/chunk-LHQTTUL2.js +27 -0
- package/dist/chunk-MAAS6CGR.js +1299 -0
- package/dist/chunk-NE36BUGQ.js +146 -0
- package/dist/chunk-NGXCFBCS.js +398 -0
- package/dist/chunk-OEYU5O27.js +235 -0
- package/dist/chunk-OUHGHTE7.js +748 -0
- package/dist/chunk-OXVOHOP3.js +661 -0
- package/dist/chunk-PSLKGOBZ.js +58 -0
- package/dist/chunk-PYL4XW6H.js +107 -0
- package/dist/chunk-Q47SPRY7.js +1 -0
- package/dist/chunk-Q7DJKLEN.js +18 -0
- package/dist/chunk-RJCA5672.js +1664 -0
- package/dist/chunk-S66I2PYB.js +748 -0
- package/dist/chunk-W7ZBF5AA.js +1 -0
- package/dist/chunk-WNWKOCGJ.js +1067 -0
- package/dist/chunk-XCYKC6OZ.js +1 -0
- package/dist/chunk-YULUKCS6.js +56 -0
- package/dist/chunk-YZ6GTZXL.js +48 -0
- package/dist/chunk-ZGHDPDTF.js +379 -0
- package/dist/components/command-queue/index.css +53 -0
- package/dist/components/command-queue/index.d.ts +204 -0
- package/dist/components/command-queue/index.js +10 -0
- package/dist/components/forms/index.d.ts +56 -0
- package/dist/components/forms/index.js +2 -0
- package/dist/components/index.css +443 -0
- package/dist/components/index.d.ts +1354 -0
- package/dist/components/index.js +18 -0
- package/dist/components/monitoring/index.d.ts +66 -0
- package/dist/components/monitoring/index.js +2 -0
- package/dist/components/navigation/index.d.ts +54 -0
- package/dist/components/navigation/index.js +91 -0
- package/dist/components/notifications/index.d.ts +52 -0
- package/dist/components/notifications/index.js +4 -0
- package/dist/components/resource-definition/index.css +388 -0
- package/dist/components/resource-definition/index.d.ts +301 -0
- package/dist/components/resource-definition/index.js +3 -0
- package/dist/display/index.css +53 -0
- package/dist/display/index.d.ts +606 -0
- package/dist/display/index.js +6 -0
- package/dist/execution/index.css +388 -0
- package/dist/execution/index.d.ts +1090 -0
- package/dist/execution/index.js +4 -0
- package/dist/graph/index.css +388 -0
- package/dist/graph/index.d.ts +429 -0
- package/dist/graph/index.js +1 -0
- package/dist/hooks/index.d.ts +1927 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/published.d.ts +1653 -0
- package/dist/hooks/published.js +4 -0
- package/dist/index.css +505 -0
- package/dist/index.d.ts +7284 -0
- package/dist/index.js +31 -0
- package/dist/initialization/index.d.ts +2325 -0
- package/dist/initialization/index.js +4 -0
- package/dist/organization/index.d.ts +225 -0
- package/dist/organization/index.js +4 -0
- package/dist/profile/index.d.ts +2265 -0
- package/dist/profile/index.js +3 -0
- package/dist/provider/index.css +61 -0
- package/dist/provider/index.d.ts +291 -0
- package/dist/provider/index.js +7 -0
- package/dist/provider/published.d.ts +198 -0
- package/dist/provider/published.js +6 -0
- package/dist/router/context.d.ts +19 -0
- package/dist/router/context.js +1 -0
- package/dist/router/index.d.ts +31 -0
- package/dist/router/index.js +2 -0
- package/dist/sse/index.d.ts +83 -0
- package/dist/sse/index.js +185 -0
- package/dist/supabase/index.d.ts +4289 -0
- package/dist/supabase/index.js +47 -0
- package/dist/typeform/index.d.ts +458 -0
- package/dist/typeform/index.js +1976 -0
- package/dist/typeform/schemas.d.ts +67 -0
- package/dist/typeform/schemas.js +1 -0
- package/dist/utils/index.d.ts +177 -0
- package/dist/utils/index.js +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { UseBoundStore, StoreApi } from 'zustand';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Multi-tenancy configuration types
|
|
6
|
+
*
|
|
7
|
+
* Config is stored in dedicated `config` columns (NOT nested in metadata):
|
|
8
|
+
* - organizations.config: Org-level feature config
|
|
9
|
+
* - org_memberships.config: Per-user-per-org feature overrides
|
|
10
|
+
* - users.config: User-global config (training)
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Valid course groups (matches Category type from training)
|
|
14
|
+
*/
|
|
15
|
+
type CourseGroup = 'foundation' | 'sales' | 'technical';
|
|
16
|
+
/**
|
|
17
|
+
* Org-level feature config (stored in organizations.config)
|
|
18
|
+
* Controls which features are available to all org members
|
|
19
|
+
* Valid feature keys: operations, monitoring, acquisition, calibration, seo
|
|
20
|
+
*/
|
|
21
|
+
interface OrgFeatureConfig {
|
|
22
|
+
features?: {
|
|
23
|
+
operations?: boolean;
|
|
24
|
+
monitoring?: boolean;
|
|
25
|
+
acquisition?: boolean;
|
|
26
|
+
calibration?: boolean;
|
|
27
|
+
seo?: boolean;
|
|
28
|
+
};
|
|
29
|
+
training?: {
|
|
30
|
+
allowed_course_groups?: CourseGroup[];
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Per-user-per-org config (stored in org_memberships.config)
|
|
35
|
+
* Overrides org-level feature config for specific users
|
|
36
|
+
*/
|
|
37
|
+
type MembershipFeatureConfig = OrgFeatureConfig;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Organization Membership types based on WorkOS API
|
|
41
|
+
*/
|
|
42
|
+
interface OrganizationMembership {
|
|
43
|
+
object: 'organization_membership';
|
|
44
|
+
id: string;
|
|
45
|
+
userId: string;
|
|
46
|
+
organizationId: string;
|
|
47
|
+
role: {
|
|
48
|
+
slug: string;
|
|
49
|
+
};
|
|
50
|
+
status: 'active' | 'inactive';
|
|
51
|
+
createdAt: string;
|
|
52
|
+
updatedAt: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Extended membership with user and organization details for UI
|
|
56
|
+
*/
|
|
57
|
+
interface MembershipWithDetails extends OrganizationMembership {
|
|
58
|
+
user?: {
|
|
59
|
+
id: string;
|
|
60
|
+
email: string;
|
|
61
|
+
firstName?: string;
|
|
62
|
+
lastName?: string;
|
|
63
|
+
profilePictureUrl?: string;
|
|
64
|
+
};
|
|
65
|
+
organization?: {
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
workos_org_id: string;
|
|
69
|
+
primaryDomain?: string;
|
|
70
|
+
is_test?: boolean;
|
|
71
|
+
status?: string;
|
|
72
|
+
metadata?: Record<string, unknown>;
|
|
73
|
+
config?: OrgFeatureConfig;
|
|
74
|
+
};
|
|
75
|
+
config?: MembershipFeatureConfig;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface OrganizationsState {
|
|
79
|
+
currentWorkOSOrganizationId: string | null;
|
|
80
|
+
currentSupabaseOrganizationId: string | null;
|
|
81
|
+
currentMembership: MembershipWithDetails | null;
|
|
82
|
+
isInitializing: boolean;
|
|
83
|
+
isOrgRefreshing: boolean;
|
|
84
|
+
error: string | null;
|
|
85
|
+
}
|
|
86
|
+
interface OrganizationsActions {
|
|
87
|
+
setCurrentWorkOSOrganizationId: (workOSorgId: string | null) => void;
|
|
88
|
+
setCurrentMembership: (membership: MembershipWithDetails | null) => void;
|
|
89
|
+
setOrganizationsInitializing: (initializing: boolean) => void;
|
|
90
|
+
setOrganizationsLoading: (loading: boolean) => void;
|
|
91
|
+
setOrganizationsError: (error: string | null) => void;
|
|
92
|
+
}
|
|
93
|
+
interface OrganizationsSlice extends OrganizationsActions {
|
|
94
|
+
organizations: OrganizationsState;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Type for Zustand's immer set function.
|
|
99
|
+
* This is a simplified version that works with immer middleware.
|
|
100
|
+
* The replace parameter uses false | undefined to match Zustand's type for immer mutation support.
|
|
101
|
+
*/
|
|
102
|
+
type ImmerSet<T> = (partial: T | Partial<T> | ((state: T) => void), replace?: false | undefined, action?: string) => void;
|
|
103
|
+
/**
|
|
104
|
+
* Creates the organizations slice for Zustand store.
|
|
105
|
+
*
|
|
106
|
+
* Usage in app:
|
|
107
|
+
* ```typescript
|
|
108
|
+
* import { createOrganizationsSlice } from '@repo/ui/organization'
|
|
109
|
+
*
|
|
110
|
+
* // Define AppState that extends OrganizationsSlice
|
|
111
|
+
* interface AppState extends OrganizationsSlice {
|
|
112
|
+
* // other slices...
|
|
113
|
+
* }
|
|
114
|
+
*
|
|
115
|
+
* // Pass the slice creator to your store
|
|
116
|
+
* const useAppStore = create<AppState>()(
|
|
117
|
+
* devtools(
|
|
118
|
+
* immer((...a) => ({
|
|
119
|
+
* ...createOrganizationsSlice(...a),
|
|
120
|
+
* // other slices...
|
|
121
|
+
* }))
|
|
122
|
+
* )
|
|
123
|
+
* )
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* Note: The slice creator accepts set/get/store from any Zustand store
|
|
127
|
+
* that extends OrganizationsSlice. It returns the slice state and actions.
|
|
128
|
+
*/
|
|
129
|
+
declare const createOrganizationsSlice: <TAppState extends OrganizationsSlice>(set: ImmerSet<TAppState>, _get: () => TAppState, _store: unknown) => OrganizationsSlice;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Factory function to create a useOrganizations hook for your app's store.
|
|
133
|
+
*
|
|
134
|
+
* Usage in app:
|
|
135
|
+
* ```typescript
|
|
136
|
+
* import { createUseOrganizations } from '@repo/ui/organization'
|
|
137
|
+
* import { useAppStore } from './zustand/store'
|
|
138
|
+
*
|
|
139
|
+
* export const useOrganizations = createUseOrganizations(useAppStore)
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* This pattern allows the shared package to provide the hook logic
|
|
143
|
+
* while each app provides its own store instance.
|
|
144
|
+
*/
|
|
145
|
+
declare function createUseOrganizations<TStore extends OrganizationsSlice>(useStore: UseBoundStore<StoreApi<TStore>>): () => {
|
|
146
|
+
setCurrentWorkOSOrganizationId: (workOSorgId: string | null) => void;
|
|
147
|
+
setCurrentMembership: (membership: MembershipWithDetails | null) => void;
|
|
148
|
+
setOrganizationsInitializing: (initializing: boolean) => void;
|
|
149
|
+
setOrganizationsLoading: (loading: boolean) => void;
|
|
150
|
+
setOrganizationsError: (error: string | null) => void;
|
|
151
|
+
organizations: OrganizationsState;
|
|
152
|
+
currentWorkOSOrganizationId: string | null;
|
|
153
|
+
currentSupabaseOrganizationId: string | null;
|
|
154
|
+
currentMembership: MembershipWithDetails | null;
|
|
155
|
+
isInitializing: boolean;
|
|
156
|
+
isOrgRefreshing: boolean;
|
|
157
|
+
error: string | null;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Type for the useOrganizations hook return value
|
|
162
|
+
*/
|
|
163
|
+
interface UseOrganizationsReturn {
|
|
164
|
+
currentWorkOSOrganizationId: string | null;
|
|
165
|
+
currentMembership: MembershipWithDetails | null;
|
|
166
|
+
setCurrentWorkOSOrganizationId: (id: string | null) => void;
|
|
167
|
+
setCurrentMembership: (membership: MembershipWithDetails | null) => void;
|
|
168
|
+
setOrganizationsInitializing: (initializing: boolean) => void;
|
|
169
|
+
setOrganizationsLoading: (loading: boolean) => void;
|
|
170
|
+
setOrganizationsError: (error: string | null) => void;
|
|
171
|
+
organizations: {
|
|
172
|
+
isInitializing: boolean;
|
|
173
|
+
isOrgRefreshing: boolean;
|
|
174
|
+
error: string | null;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Type for the useApiClient hook return value
|
|
179
|
+
*/
|
|
180
|
+
interface UseApiClientReturn {
|
|
181
|
+
apiRequest: <T = unknown>(path: string, options?: RequestInit) => Promise<T>;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Return type for useOrgInitialization hook
|
|
185
|
+
*/
|
|
186
|
+
interface UseOrgInitializationReturn {
|
|
187
|
+
memberships: MembershipWithDetails[];
|
|
188
|
+
isInitializing: boolean;
|
|
189
|
+
isLoading: boolean;
|
|
190
|
+
isInitialized: boolean;
|
|
191
|
+
error: string | null;
|
|
192
|
+
currentOrganization: MembershipWithDetails['organization'] | null;
|
|
193
|
+
retry: () => Promise<void>;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Factory function to create a useOrgInitialization hook for your app.
|
|
197
|
+
*
|
|
198
|
+
* Usage in app:
|
|
199
|
+
* ```typescript
|
|
200
|
+
* import { createUseOrgInitialization } from '@repo/ui/organization'
|
|
201
|
+
* import { useOrganizations } from './hooks/useOrganizations'
|
|
202
|
+
* import { useApiClient } from './api/hooks/useApiClient'
|
|
203
|
+
*
|
|
204
|
+
* export const useOrgInitialization = createUseOrgInitialization(
|
|
205
|
+
* useOrganizations,
|
|
206
|
+
* useApiClient
|
|
207
|
+
* )
|
|
208
|
+
* ```
|
|
209
|
+
*
|
|
210
|
+
* This pattern allows the shared package to provide the hook logic
|
|
211
|
+
* while each app provides its own hook instances.
|
|
212
|
+
*/
|
|
213
|
+
declare function createUseOrgInitialization(useOrganizations: () => UseOrganizationsReturn, useApiClient: () => UseApiClientReturn): () => UseOrgInitializationReturn;
|
|
214
|
+
|
|
215
|
+
type Organization = NonNullable<MembershipWithDetails['organization']>;
|
|
216
|
+
interface OrganizationSwitcherProps {
|
|
217
|
+
currentOrganization: Organization | undefined;
|
|
218
|
+
memberships: MembershipWithDetails[];
|
|
219
|
+
isLoading: boolean;
|
|
220
|
+
onSwitch: (workosOrgId: string) => Promise<void>;
|
|
221
|
+
}
|
|
222
|
+
declare function OrganizationSwitcher({ currentOrganization, memberships, isLoading, onSwitch }: OrganizationSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
223
|
+
|
|
224
|
+
export { OrganizationSwitcher, createOrganizationsSlice, createUseOrgInitialization, createUseOrganizations };
|
|
225
|
+
export type { OrganizationsActions, OrganizationsSlice, OrganizationsState, UseApiClientReturn, UseOrgInitializationReturn, UseOrganizationsReturn };
|