@famgia/omnify-react-sso 2.2.3 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/ant/index.cjs +3235 -0
  2. package/dist/ant/index.cjs.map +1 -0
  3. package/dist/ant/index.d.cts +685 -0
  4. package/dist/ant/index.d.ts +685 -0
  5. package/dist/ant/index.js +3268 -0
  6. package/dist/ant/index.js.map +1 -0
  7. package/dist/core/index.cjs +2432 -0
  8. package/dist/core/index.cjs.map +1 -0
  9. package/dist/core/index.d.cts +112 -0
  10. package/dist/core/index.d.ts +112 -0
  11. package/dist/core/index.js +2360 -0
  12. package/dist/core/index.js.map +1 -0
  13. package/dist/{testing → core/testing}/index.cjs +1 -1
  14. package/dist/core/testing/index.cjs.map +1 -0
  15. package/dist/{testing → core/testing}/index.d.cts +1 -1
  16. package/dist/{testing → core/testing}/index.d.ts +1 -1
  17. package/dist/{testing → core/testing}/index.js +1 -1
  18. package/dist/core/testing/index.js.map +1 -0
  19. package/dist/index-CHuDTvHg.d.ts +2250 -0
  20. package/dist/index-DVssHZFD.d.cts +2250 -0
  21. package/dist/index.cjs +2464 -784
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +10 -1822
  24. package/dist/index.d.ts +10 -1822
  25. package/dist/index.js +2528 -771
  26. package/dist/index.js.map +1 -1
  27. package/dist/{types-bD5deLxs.d.cts → types-BxClyvTX.d.cts} +2 -3
  28. package/dist/{types-bD5deLxs.d.ts → types-BxClyvTX.d.ts} +2 -3
  29. package/dist/userService-DH9-vPSg.d.cts +269 -0
  30. package/dist/userService-DH9-vPSg.d.ts +269 -0
  31. package/package.json +32 -53
  32. package/dist/@omnify-base/package.json +0 -16
  33. package/dist/@omnify-base/schemas/Branch.ts +0 -131
  34. package/dist/@omnify-base/schemas/BranchCache.ts +0 -131
  35. package/dist/@omnify-base/schemas/OrganizationCache.ts +0 -117
  36. package/dist/@omnify-base/schemas/Permission.ts +0 -114
  37. package/dist/@omnify-base/schemas/Role.ts +0 -128
  38. package/dist/@omnify-base/schemas/RolePermission.ts +0 -97
  39. package/dist/@omnify-base/schemas/Team.ts +0 -110
  40. package/dist/@omnify-base/schemas/TeamCache.ts +0 -110
  41. package/dist/@omnify-base/schemas/TeamPermission.ts +0 -109
  42. package/dist/@omnify-base/schemas/User.ts +0 -135
  43. package/dist/@omnify-base/schemas/UserCache.ts +0 -142
  44. package/dist/@omnify-base/schemas/common.ts +0 -47
  45. package/dist/@omnify-base/schemas/i18n.ts +0 -118
  46. package/dist/schemas/index.cjs +0 -645
  47. package/dist/schemas/index.cjs.map +0 -1
  48. package/dist/schemas/index.d.cts +0 -260
  49. package/dist/schemas/index.d.ts +0 -260
  50. package/dist/schemas/index.js +0 -557
  51. package/dist/schemas/index.js.map +0 -1
  52. package/dist/testing/index.cjs.map +0 -1
  53. package/dist/testing/index.js.map +0 -1
  54. package/scripts/build-schemas.ts +0 -191
  55. package/scripts/postinstall.cjs +0 -43
package/dist/index.d.cts CHANGED
@@ -1,1823 +1,11 @@
1
- export { DateString, DateTimeString, LocaleMap, ValidationRule } from '@omnify-base/schemas/common';
2
- export { fallbackLocale, getMessage, getMessages, supportedLocales, validationMessages } from '@omnify-base/schemas/i18n';
3
- export { BranchCache, BranchCacheCreate, BranchCacheUpdate, OrganizationCache, OrganizationCacheCreate, OrganizationCacheUpdate, PermissionCreate, PermissionUpdate, RoleCreate, RolePermission, RolePermissionCreate, RolePermissionUpdate, RoleUpdate, TeamCache, TeamCacheCreate, TeamCacheUpdate, TeamPermission, TeamPermissionCreate, TeamPermissionUpdate, UserCache, UserCacheCreate, UserCacheUpdate, branchCacheCreateSchema, branchCacheSchemas, branchCacheUpdateSchema, organizationCacheCreateSchema, organizationCacheSchemas, organizationCacheUpdateSchema, permissionCreateSchema, permissionSchemas, permissionUpdateSchema, roleCreateSchema, rolePermissionCreateSchema, rolePermissionSchemas, rolePermissionUpdateSchema, roleSchemas, roleUpdateSchema, teamCacheCreateSchema, teamCacheSchemas, teamCacheUpdateSchema, teamPermissionCreateSchema, teamPermissionSchemas, teamPermissionUpdateSchema, userCacheCreateSchema, userCacheSchemas, userCacheUpdateSchema } from './schemas/index.cjs';
4
- import * as react from 'react';
5
- import { ReactNode } from 'react';
6
- import { b as SsoContextValue, c as SsoProviderProps, B as BranchContextValue, d as BranchProviderProps, S as SsoUser$2, a as SsoOrganization, e as SsoConfig, f as SsoCallbackProps, O as OrganizationSwitcherProps, P as ProtectedRouteProps, g as OrgBranchSelectorModalProps, h as BranchGateProps, i as BranchGateSelection } from './types-bD5deLxs.cjs';
7
- export { j as OrgBranchSelection, k as SsoBranch, l as SsoCallbackResponse } from './types-bD5deLxs.cjs';
8
- import * as react_jsx_runtime from 'react/jsx-runtime';
9
- export { branchCacheI18n, getBranchCacheFieldLabel, getBranchCacheFieldPlaceholder, getBranchCacheLabel } from '@omnify-base/schemas/BranchCache';
10
- export { getOrganizationCacheFieldLabel, getOrganizationCacheFieldPlaceholder, getOrganizationCacheLabel, organizationCacheI18n } from '@omnify-base/schemas/OrganizationCache';
11
- export { getPermissionFieldLabel, getPermissionFieldPlaceholder, getPermissionLabel, permissionI18n } from '@omnify-base/schemas/Permission';
12
- export { getRoleFieldLabel, getRoleFieldPlaceholder, getRoleLabel, roleI18n } from '@omnify-base/schemas/Role';
13
- export { getRolePermissionFieldLabel, getRolePermissionFieldPlaceholder, getRolePermissionLabel, rolePermissionI18n } from '@omnify-base/schemas/RolePermission';
14
- export { getTeamCacheFieldLabel, getTeamCacheFieldPlaceholder, getTeamCacheLabel, teamCacheI18n } from '@omnify-base/schemas/TeamCache';
15
- export { getTeamPermissionFieldLabel, getTeamPermissionFieldPlaceholder, getTeamPermissionLabel, teamPermissionI18n } from '@omnify-base/schemas/TeamPermission';
16
- export { getUserCacheFieldLabel, getUserCacheFieldPlaceholder, getUserCacheLabel, userCacheI18n } from '@omnify-base/schemas/UserCache';
1
+ export { A as ApiToken, a as AssignRoleInput, b as AssignRoleResponse, c as AuthCallbackInput, d as AuthCallbackResponse, e as AuthService, S as AuthUser, f as AuthUserResponse, B as BRANCH_HEADERS, g as Branch, h as BranchCache, i as BranchCacheCreate, j as BranchCacheUpdate, k as BranchContext, l as BranchProvider, m as BranchService, n as BranchesResponse, C as CleanupOrphanedInput, o as CreatePermissionInput, D as DateString, p as DateTimeString, I as I18nContextValue, q as I18nProvider, r as I18nProviderProps, L as Locale, s as LocaleMap, O as Organization, t as OrganizationCache, u as OrganizationCacheCreate, v as OrganizationCacheUpdate, w as OrphanedTeam, P as PermissionCreate, x as PermissionListParams, y as PermissionMatrix, z as PermissionService, E as PermissionUpdate, R as RemoveRoleResponse, F as RoleAssignment, G as RoleCreate, H as RolePermission, J as RolePermissionCreate, K as RolePermissionUpdate, M as RoleScope, N as RoleUpdate, Q as SsoContext, T as SsoProvider, U as SsoService, V as SsoServiceConfig, S as SsoServiceUser, W as SyncRolesInput, X as SyncRolesResponse, Y as SyncTeamPermissionsInput, Z as TeamCache, _ as TeamCacheCreate, $ as TeamCacheUpdate, a0 as TeamPermission, a1 as TeamPermissionCreate, a2 as TeamPermissionDetail, a3 as TeamPermissionUpdate, a4 as TeamService, a5 as TeamWithPermissions, a6 as TokenService, a7 as UpdatePermissionInput, a8 as UseAuthReturn, a9 as UseBranchReturn, aa as UseOrganizationReturn, ab as UseSsoReturn, ac as UserCache, ad as UserCacheCreate, ae as UserCacheUpdate, af as UserRoleService, ag as ValidationRule, ah as branchCacheCreateSchema, ai as branchCacheI18n, aj as branchCacheSchemas, ak as branchCacheUpdateSchema, al as changeLanguage, am as createAuthService, an as createBranchHeaderSetter, ao as createBranchService, ap as createPermissionService, aq as createSsoService, ar as createTeamService, as as createTokenService, at as createUserRoleService, au as defaultLocale, av as defaultTranslations, aw as fallbackLocale, ax as getBranchCacheFieldLabel, ay as getBranchCacheFieldPlaceholder, az as getBranchCacheLabel, aA as getCurrentLocale, aB as getEffectivePermissions, aC as getMessage, aD as getMessages, aE as getOrganizationCacheFieldLabel, aF as getOrganizationCacheFieldPlaceholder, aG as getOrganizationCacheLabel, aH as getPermissionFieldLabel, aI as getPermissionFieldPlaceholder, aJ as getPermissionLabel, aK as getRoleFieldLabel, aL as getRoleFieldPlaceholder, aM as getRoleLabel, aN as getRolePermissionFieldLabel, aO as getRolePermissionFieldPlaceholder, aP as getRolePermissionLabel, aQ as getScopeLabel, aR as getTeamCacheFieldLabel, aS as getTeamCacheFieldPlaceholder, aT as getTeamCacheLabel, aU as getTeamPermissionFieldLabel, aV as getTeamPermissionFieldPlaceholder, aW as getTeamPermissionLabel, aX as getUserCacheFieldLabel, aY as getUserCacheFieldPlaceholder, aZ as getUserCacheLabel, a_ as localeNames, a$ as locales, b0 as organizationCacheCreateSchema, b1 as organizationCacheI18n, b2 as organizationCacheSchemas, b3 as organizationCacheUpdateSchema, b4 as permissionCreateSchema, b5 as permissionI18n, b6 as permissionSchemas, b7 as permissionUpdateSchema, b8 as roleCreateSchema, b9 as roleI18n, ba as rolePermissionCreateSchema, bb as rolePermissionI18n, bc as rolePermissionSchemas, bd as rolePermissionUpdateSchema, be as roleSchemas, bf as roleUpdateSchema, bg as setBranchHeaders, bh as ssoNamespace, bi as ssoQueryKeys, bj as supportedLocales, bk as teamCacheCreateSchema, bl as teamCacheI18n, bm as teamCacheSchemas, bn as teamCacheUpdateSchema, bo as teamPermissionCreateSchema, bp as teamPermissionI18n, bq as teamPermissionSchemas, br as teamPermissionUpdateSchema, bs as useAuth, bt as useBranch, bu as useLocale, bv as useOrganization, bw as useSso, bx as useSsoTranslation, by as useTranslations, bz as userCacheCreateSchema, bA as userCacheI18n, bB as userCacheSchemas, bC as userCacheUpdateSchema, bD as validationMessages } from './index-DVssHZFD.cjs';
2
+ export { AntdThemeProvider, AntdThemeProviderProps, ApiResponse, BranchGate, BranchLike, LocaleSwitcher, OrgBranchSelectorModal, OrganizationLike, OrganizationSwitcher, PROTABLE_DEFAULT_TEXTS, PageContainer, PageContainerProps, PaginationMeta, PermissionsListCard, PermissionsListCardProps, ProTable, ProTableColumn, ProTableProps, ProTableTexts, ProtectedRoute, QueryParams, RoleCreateModal, RoleCreateModalProps, RolesListCard, RolesListCardProps, RowAction, ScopeLabel, ScopeLabelProps, ScopeTag, ScopeTagProps, ScopeType, SearchField, SsoCallback, StatusConfig, TeamData, TeamsListCard, TeamsListCardProps, UserDetailCard, UserDetailCardProps, UserPermissionsModal, UserPermissionsModalProps, UserRoleAssignModal, UserRoleAssignModalProps, ValueType, getScopeColor, getScopeIcon, useBranchGate } from './ant/index.cjs';
3
+ export { C as CreateRoleInput, P as Permission, a as PermissionDetail, R as Role, b as RoleAssignmentWithPermissions, c as RoleService, d as RoleWithPermissions, S as ServiceConfig, P as ServicePermission, R as ServiceRole, e as SyncPermissionsInput, f as SyncPermissionsResponse, T as TeamMembershipWithPermissions, U as UpdateRoleInput, g as User, h as UserListParams, i as UserListResponse, j as UserPermissionsBreakdown, k as UserService, l as UserWithOrg, m as createRoleService, n as createUserService } from './userService-DH9-vPSg.cjs';
4
+ export { B as BranchContextValue, a as BranchGateProps, b as BranchGateSelection, c as BranchProviderProps, O as OrgBranchSelection, d as OrgBranchSelectorModalProps, e as OrganizationSwitcherProps, P as ProtectedRouteProps, S as SsoBranch, f as SsoCallbackProps, g as SsoCallbackResponse, h as SsoConfig, i as SsoContextValue, j as SsoOrganization, k as SsoProviderProps, l as SsoUser } from './types-BxClyvTX.cjs';
17
5
  import 'zod';
18
-
19
- /**
20
- * SSO Context
21
- */
22
- declare const SsoContext: react.Context<SsoContextValue | null>;
23
-
24
- /**
25
- * SSO Provider component
26
- */
27
- declare function SsoProvider({ children, config, onAuthChange }: SsoProviderProps): react_jsx_runtime.JSX.Element;
28
-
29
- /**
30
- * Branch Context
31
- *
32
- * Provides branch state management across the application.
33
- * Must be used within a BranchProvider.
34
- */
35
- declare const BranchContext: react.Context<BranchContextValue | null>;
36
-
37
- /**
38
- * BranchProvider component
39
- *
40
- * Provides branch state management for the application.
41
- * Automatically fetches branches when organization changes.
42
- *
43
- * @example
44
- * ```tsx
45
- * // In your app
46
- * <SsoProvider config={ssoConfig}>
47
- * <BranchProvider>
48
- * <App />
49
- * </BranchProvider>
50
- * </SsoProvider>
51
- *
52
- * // In a component
53
- * function MyComponent() {
54
- * const { branches, currentBranch, switchBranch } = useBranch();
55
- * // ...
56
- * }
57
- * ```
58
- */
59
- declare function BranchProvider({ children, storage, storageKey, onBranchChange, }: BranchProviderProps): react_jsx_runtime.JSX.Element;
60
-
61
- /**
62
- * Hook for authentication actions and state
63
- */
64
- interface UseAuthReturn {
65
- /** Current user or null */
66
- user: SsoUser$2 | null;
67
- /** Whether auth is being loaded */
68
- isLoading: boolean;
69
- /** Whether user is authenticated */
70
- isAuthenticated: boolean;
71
- /** Redirect to login */
72
- login: (redirectTo?: string) => void;
73
- /** Logout from service only */
74
- logout: () => Promise<void>;
75
- /** Logout from service and Console */
76
- globalLogout: (redirectTo?: string) => void;
77
- /** Refresh user data */
78
- refreshUser: () => Promise<void>;
79
- }
80
- /**
81
- * Hook for authentication
82
- *
83
- * @example
84
- * ```tsx
85
- * function LoginButton() {
86
- * const { isAuthenticated, login, logout, user } = useAuth();
87
- *
88
- * if (isAuthenticated) {
89
- * return (
90
- * <div>
91
- * <span>Hello, {user?.name}</span>
92
- * <button onClick={() => logout()}>Logout</button>
93
- * </div>
94
- * );
95
- * }
96
- *
97
- * return <button onClick={() => login()}>Login</button>;
98
- * }
99
- * ```
100
- */
101
- declare function useAuth(): UseAuthReturn;
102
-
103
- /**
104
- * Hook return type for organization management
105
- */
106
- interface UseOrganizationReturn {
107
- /** List of organizations user has access to */
108
- organizations: SsoOrganization[];
109
- /** Currently selected organization */
110
- currentOrg: SsoOrganization | null;
111
- /** Whether user has multiple organizations */
112
- hasMultipleOrgs: boolean;
113
- /** Switch to a different organization */
114
- switchOrg: (orgSlug: string) => void;
115
- /** Get current org's role */
116
- currentRole: string | null;
117
- /** Check if user has at least the given role in current org */
118
- hasRole: (role: string) => boolean;
119
- }
120
- /**
121
- * Hook for organization management
122
- *
123
- * @example
124
- * ```tsx
125
- * function OrgInfo() {
126
- * const { currentOrg, organizations, switchOrg, hasRole } = useOrganization();
127
- *
128
- * return (
129
- * <div>
130
- * <p>Current: {currentOrg?.name}</p>
131
- * {hasRole('admin') && <AdminPanel />}
132
- * <select onChange={(e) => switchOrg(e.target.value)}>
133
- * {organizations.map((org) => (
134
- * <option key={org.slug} value={org.slug}>{org.name}</option>
135
- * ))}
136
- * </select>
137
- * </div>
138
- * );
139
- * }
140
- * ```
141
- */
142
- declare function useOrganization(): UseOrganizationReturn;
143
-
144
- /**
145
- * Combined SSO hook return type
146
- */
147
- interface UseSsoReturn {
148
- user: SsoUser$2 | null;
149
- isLoading: boolean;
150
- isAuthenticated: boolean;
151
- login: (redirectTo?: string) => void;
152
- logout: () => Promise<void>;
153
- globalLogout: (redirectTo?: string) => void;
154
- refreshUser: () => Promise<void>;
155
- organizations: SsoOrganization[];
156
- currentOrg: SsoOrganization | null;
157
- hasMultipleOrgs: boolean;
158
- switchOrg: (orgSlug: string) => void;
159
- getHeaders: () => Record<string, string>;
160
- config: SsoConfig;
161
- }
162
- /**
163
- * Combined hook for all SSO functionality
164
- *
165
- * @example
166
- * ```tsx
167
- * function MyComponent() {
168
- * const {
169
- * user,
170
- * isAuthenticated,
171
- * currentOrg,
172
- * getHeaders,
173
- * login,
174
- * logout,
175
- * } = useSso();
176
- *
177
- * const fetchData = async () => {
178
- * const response = await fetch('/api/data', {
179
- * headers: getHeaders(),
180
- * });
181
- * // ...
182
- * };
183
- *
184
- * if (!isAuthenticated) {
185
- * return <button onClick={() => login()}>Login</button>;
186
- * }
187
- *
188
- * return (
189
- * <div>
190
- * <p>Welcome, {user?.name}</p>
191
- * <p>Organization: {currentOrg?.name}</p>
192
- * <button onClick={() => logout()}>Logout</button>
193
- * </div>
194
- * );
195
- * }
196
- * ```
197
- */
198
- declare function useSso(): UseSsoReturn;
199
-
200
- /**
201
- * Hook return type for branch management
202
- */
203
- type UseBranchReturn = BranchContextValue;
204
- /**
205
- * Hook for branch management
206
- *
207
- * Provides access to branch state and operations.
208
- * Must be used within a BranchProvider.
209
- *
210
- * @example
211
- * ```tsx
212
- * function BranchInfo() {
213
- * const {
214
- * branches,
215
- * currentBranch,
216
- * hasMultipleBranches,
217
- * switchBranch
218
- * } = useBranch();
219
- *
220
- * // Auto-selection logic is handled by the provider
221
- * // - If only 1 branch: auto-selected
222
- * // - If multiple: use saved preference or primary branch
223
- *
224
- * return (
225
- * <div>
226
- * <p>Current: {currentBranch?.name}</p>
227
- * {hasMultipleBranches && (
228
- * <select onChange={(e) => switchBranch(Number(e.target.value))}>
229
- * {branches.map((branch) => (
230
- * <option key={branch.id} value={branch.id}>
231
- * {branch.name}
232
- * </option>
233
- * ))}
234
- * </select>
235
- * )}
236
- * </div>
237
- * );
238
- * }
239
- * ```
240
- */
241
- declare function useBranch(): UseBranchReturn;
242
-
243
- /**
244
- * SSO Callback component
245
- *
246
- * Place this component at your callback route (e.g., /sso/callback)
247
- * It handles the SSO code exchange and redirects after successful login.
248
- *
249
- * @example
250
- * ```tsx
251
- * // pages/sso/callback.tsx or app/sso/callback/page.tsx
252
- * export default function CallbackPage() {
253
- * return (
254
- * <SsoCallback
255
- * redirectTo="/dashboard"
256
- * onSuccess={(user, orgs) => console.log('Logged in:', user)}
257
- * onError={(error) => console.error('Login failed:', error)}
258
- * />
259
- * );
260
- * }
261
- * ```
262
- */
263
- declare function SsoCallback({ onSuccess, onError, redirectTo, loadingComponent, errorComponent, }: SsoCallbackProps): react_jsx_runtime.JSX.Element | null;
264
-
265
- /**
266
- * Organization Switcher component using Ant Design
267
- *
268
- * A dropdown component for switching between organizations.
269
- * Only renders if user has access to multiple organizations.
270
- *
271
- * @example
272
- * ```tsx
273
- * // Basic usage
274
- * <OrganizationSwitcher />
275
- *
276
- * // With custom styling
277
- * <OrganizationSwitcher className="my-switcher" />
278
- *
279
- * // With custom render
280
- * <OrganizationSwitcher
281
- * renderTrigger={(org, isOpen) => (
282
- * <Button>{org?.name} {isOpen ? '▲' : '▼'}</Button>
283
- * )}
284
- * renderOption={(org, isSelected) => (
285
- * <div className={isSelected ? 'selected' : ''}>{org.name}</div>
286
- * )}
287
- * />
288
- * ```
289
- */
290
- declare function OrganizationSwitcher({ className, renderTrigger, renderOption, onChange, }: OrganizationSwitcherProps): react_jsx_runtime.JSX.Element | null;
291
-
292
- /**
293
- * Protected Route component
294
- *
295
- * Wraps content that requires authentication and optionally specific roles/permissions.
296
- *
297
- * @example
298
- * ```tsx
299
- * // Basic protection
300
- * <ProtectedRoute>
301
- * <Dashboard />
302
- * </ProtectedRoute>
303
- *
304
- * // With role requirement
305
- * <ProtectedRoute requiredRole="admin">
306
- * <AdminPanel />
307
- * </ProtectedRoute>
308
- *
309
- * // With custom fallbacks
310
- * <ProtectedRoute
311
- * fallback={<Spinner />}
312
- * loginFallback={<CustomLoginPage />}
313
- * onAccessDenied={(reason) => console.log(reason)}
314
- * >
315
- * <ProtectedContent />
316
- * </ProtectedRoute>
317
- * ```
318
- */
319
- declare function ProtectedRoute({ children, fallback, loginFallback, requiredRole, requiredPermission, onAccessDenied, }: ProtectedRouteProps): react_jsx_runtime.JSX.Element;
320
-
321
- /**
322
- * Organization and Branch Selector Modal
323
- *
324
- * A modal component for selecting organization and branch.
325
- * - If user has only one organization, it's auto-selected
326
- * - If user has only one branch, it's auto-selected
327
- * - Shows selection UI only when there are multiple options
328
- *
329
- * @example
330
- * ```tsx
331
- * function CreateProjectButton() {
332
- * const [modalOpen, setModalOpen] = useState(false);
333
- *
334
- * const handleConfirm = (orgId: number, branchId: number) => {
335
- * // Create project with selected org and branch
336
- * createProject({ organization_id: orgId, branch_id: branchId });
337
- * setModalOpen(false);
338
- * };
339
- *
340
- * return (
341
- * <>
342
- * <Button onClick={() => setModalOpen(true)}>
343
- * Create Project
344
- * </Button>
345
- * <OrgBranchSelectorModal
346
- * open={modalOpen}
347
- * onClose={() => setModalOpen(false)}
348
- * onConfirm={handleConfirm}
349
- * />
350
- * </>
351
- * );
352
- * }
353
- * ```
354
- */
355
- declare function OrgBranchSelectorModal({ open, onClose, onConfirm, title, requireBranch, loadingComponent, }: OrgBranchSelectorModalProps): react_jsx_runtime.JSX.Element;
356
-
357
- type StoredSelection = {
358
- orgId: string;
359
- orgSlug: string;
360
- orgName: string;
361
- branchId: string;
362
- branchName: string;
363
- branchCode: string;
364
- };
365
- /**
366
- * BranchGate - Ensures user has selected an org/branch before accessing the app.
367
- *
368
- * Different from OrgBranchSelectorModal:
369
- * - OrgBranchSelectorModal: Modal for one-time selection (e.g., creating a project)
370
- * - BranchGate: Gate that blocks app access until selection is made, persists globally
371
- *
372
- * Auto-selection behavior:
373
- * - If user has only 1 org and 1 branch: auto-selects and allows access
374
- * - If user has multiple options: shows selection modal first
375
- * - Stores selection in localStorage for persistence
376
- *
377
- * @example
378
- * ```tsx
379
- * // In your app layout
380
- * function DashboardLayout({ children }) {
381
- * return (
382
- * <BranchGate
383
- * onSelectionChange={(selection) => {
384
- * // Set API headers globally
385
- * api.defaults.headers['X-Branch-Id'] = selection.branchId;
386
- * api.defaults.headers['X-Org-Id'] = selection.orgId;
387
- * }}
388
- * >
389
- * {children}
390
- * </BranchGate>
391
- * );
392
- * }
393
- * ```
394
- */
395
- declare function BranchGate({ children, onSelectionChange, storageKey, loadingComponent, title, description, }: BranchGateProps): react_jsx_runtime.JSX.Element;
396
- declare function useBranchGate(storageKey?: string): {
397
- selection: StoredSelection | null;
398
- selectedOrg: {
399
- id: string;
400
- slug: string;
401
- name: string;
402
- } | null;
403
- selectedBranch: {
404
- id: string;
405
- name: string;
406
- code: string;
407
- } | null;
408
- clearSelection: () => void;
409
- };
410
-
411
- /**
412
- * Base service configuration
413
- */
414
- interface ServiceConfig {
415
- apiUrl: string;
416
- }
417
-
418
- /**
419
- * User Service - Admin User CRUD operations
420
- *
421
- * Provides user management functionality for admin users.
422
- * Uses the /api/admin/sso/users endpoints.
423
- */
424
-
425
- interface User {
426
- id: string;
427
- name: string;
428
- email: string;
429
- console_user_id?: string;
430
- created_at?: string;
431
- updated_at?: string;
432
- }
433
- interface UserListParams {
434
- page?: number;
435
- per_page?: number;
436
- "filter[search]"?: string;
437
- "filter[org_id]"?: string;
438
- sort?: string;
439
- }
440
- interface UserListResponse {
441
- data: User[];
442
- links?: {
443
- first?: string;
444
- last?: string;
445
- prev?: string | null;
446
- next?: string | null;
447
- };
448
- meta: {
449
- current_page: number;
450
- from: number | null;
451
- last_page: number;
452
- per_page: number;
453
- to: number | null;
454
- total: number;
455
- };
456
- }
457
- interface UpdateUserInput {
458
- name?: string;
459
- email?: string;
460
- }
461
- interface RoleAssignmentWithPermissions {
462
- role: {
463
- id: string;
464
- name: string;
465
- slug: string;
466
- level: number;
467
- };
468
- scope: "global" | "org-wide" | "branch";
469
- console_org_id: string | null;
470
- console_branch_id: string | null;
471
- org_name?: string | null;
472
- branch_name?: string | null;
473
- permissions: string[];
474
- }
475
- interface TeamMembershipWithPermissions {
476
- team: {
477
- id: string | number;
478
- name: string;
479
- path: string | null;
480
- };
481
- is_leader: boolean;
482
- permissions: string[];
483
- }
484
- interface UserPermissionsBreakdown {
485
- user: {
486
- id: string;
487
- name: string;
488
- email: string;
489
- console_org_id?: string | null;
490
- organization?: {
491
- id: string;
492
- console_org_id: string;
493
- name: string;
494
- code: string;
495
- } | null;
496
- };
497
- context: {
498
- org_id: string | null;
499
- branch_id: string | null;
500
- };
501
- role_assignments: RoleAssignmentWithPermissions[];
502
- team_memberships: TeamMembershipWithPermissions[];
503
- aggregated_permissions: string[];
504
- }
505
- interface UserService {
506
- list(params?: UserListParams, orgSlug?: string): Promise<UserListResponse>;
507
- get(id: string, orgSlug?: string): Promise<User>;
508
- update(id: string, input: UpdateUserInput, orgSlug?: string): Promise<User>;
509
- delete(id: string, orgSlug?: string): Promise<void>;
510
- search(email: string, orgSlug?: string): Promise<User[]>;
511
- getPermissions(userId: string, orgId?: string, branchId?: string, orgSlug?: string): Promise<UserPermissionsBreakdown>;
512
- }
513
- declare function createUserService(config: ServiceConfig): UserService;
514
-
515
- interface UserTableProps {
516
- users: User[];
517
- loading?: boolean;
518
- pagination?: UserListResponse["meta"];
519
- sortField?: string;
520
- sortOrder?: "asc" | "desc";
521
- onPageChange?: (page: number, pageSize: number) => void;
522
- onSortChange?: (field: string | undefined, order: "asc" | "desc" | undefined) => void;
523
- onSearch?: (value: string) => void;
524
- onEdit?: (user: User) => void;
525
- onDelete?: (user: User) => void;
526
- deleteLoading?: boolean;
527
- showSearch?: boolean;
528
- showActions?: boolean;
529
- }
530
- declare function UserTable({ users, loading, pagination, sortField, sortOrder, onPageChange, onSortChange, onSearch, onEdit, onDelete, deleteLoading, showSearch, showActions, }: UserTableProps): react_jsx_runtime.JSX.Element;
531
-
532
- interface UserFormProps {
533
- initialValues?: Partial<User>;
534
- onSubmit: (values: UpdateUserInput) => void;
535
- onCancel?: () => void;
536
- loading?: boolean;
537
- submitText?: string;
538
- }
539
- declare function UserForm({ initialValues, onSubmit, onCancel, loading, submitText, }: UserFormProps): react_jsx_runtime.JSX.Element;
540
-
541
- /**
542
- * Default translations for SSO components
543
- *
544
- * Apps can override these by adding to their i18n resources under the "sso" namespace.
545
- */
546
- declare const ssoNamespace = "sso";
547
- declare const defaultTranslations: {
548
- en: {
549
- actions: string;
550
- save: string;
551
- cancel: string;
552
- delete: string;
553
- edit: string;
554
- search: string;
555
- loading: string;
556
- yes: string;
557
- no: string;
558
- confirmDelete: string;
559
- users: string;
560
- user: string;
561
- name: string;
562
- email: string;
563
- ssoUser: string;
564
- localUser: string;
565
- userList: string;
566
- userDetails: string;
567
- editUser: string;
568
- deleteUser: string;
569
- searchUsers: string;
570
- noUsersFound: string;
571
- userDeleted: string;
572
- userUpdated: string;
573
- roles: string;
574
- role: string;
575
- roleName: string;
576
- roleDescription: string;
577
- permissions: string;
578
- assignRole: string;
579
- removeRole: string;
580
- permission: string;
581
- permissionName: string;
582
- permissionDescription: string;
583
- required: string;
584
- maxLength: string;
585
- invalidEmail: string;
586
- total: string;
587
- page: string;
588
- };
589
- ja: {
590
- actions: string;
591
- save: string;
592
- cancel: string;
593
- delete: string;
594
- edit: string;
595
- search: string;
596
- loading: string;
597
- yes: string;
598
- no: string;
599
- confirmDelete: string;
600
- users: string;
601
- user: string;
602
- name: string;
603
- email: string;
604
- ssoUser: string;
605
- localUser: string;
606
- userList: string;
607
- userDetails: string;
608
- editUser: string;
609
- deleteUser: string;
610
- searchUsers: string;
611
- noUsersFound: string;
612
- userDeleted: string;
613
- userUpdated: string;
614
- roles: string;
615
- role: string;
616
- roleName: string;
617
- roleDescription: string;
618
- permissions: string;
619
- assignRole: string;
620
- removeRole: string;
621
- permission: string;
622
- permissionName: string;
623
- permissionDescription: string;
624
- required: string;
625
- maxLength: string;
626
- invalidEmail: string;
627
- total: string;
628
- page: string;
629
- };
630
- vi: {
631
- actions: string;
632
- save: string;
633
- cancel: string;
634
- delete: string;
635
- edit: string;
636
- search: string;
637
- loading: string;
638
- yes: string;
639
- no: string;
640
- confirmDelete: string;
641
- users: string;
642
- user: string;
643
- name: string;
644
- email: string;
645
- ssoUser: string;
646
- localUser: string;
647
- userList: string;
648
- userDetails: string;
649
- editUser: string;
650
- deleteUser: string;
651
- searchUsers: string;
652
- noUsersFound: string;
653
- userDeleted: string;
654
- userUpdated: string;
655
- roles: string;
656
- role: string;
657
- roleName: string;
658
- roleDescription: string;
659
- permissions: string;
660
- assignRole: string;
661
- removeRole: string;
662
- permission: string;
663
- permissionName: string;
664
- permissionDescription: string;
665
- required: string;
666
- maxLength: string;
667
- invalidEmail: string;
668
- total: string;
669
- page: string;
670
- };
671
- };
672
-
673
- /**
674
- * Hook for SSO translations using react-i18next
675
- *
676
- * Falls back to English if translation not found.
677
- * Apps should initialize i18next and add SSO translations to their resources.
678
- */
679
-
680
- type TranslationKey = keyof typeof defaultTranslations.en;
681
- /**
682
- * Hook for SSO component translations
683
- *
684
- * Falls back to English if react-i18next is not available or translation not found.
685
- *
686
- * @example
687
- * const { t } = useSsoTranslation();
688
- * <span>{t("users")}</span>
689
- * <span>{t("required", { field: t("email") })}</span>
690
- */
691
- declare function useSsoTranslation(): {
692
- t: (key: TranslationKey, options?: Record<string, unknown>) => string;
693
- };
694
-
695
- type TranslationMessages = Record<string, any>;
696
- interface I18nProviderProps {
697
- children: ReactNode;
698
- /** App-specific translations for each locale */
699
- translations?: {
700
- en?: TranslationMessages;
701
- ja?: TranslationMessages;
702
- vi?: TranslationMessages;
703
- };
704
- /** Default locale (defaults to "ja") */
705
- fallbackLocale?: string;
706
- }
707
- declare function I18nProvider({ children, translations, fallbackLocale }: I18nProviderProps): react_jsx_runtime.JSX.Element;
708
-
709
- type TranslationValues = Record<string, string | number>;
710
- /**
711
- * Hook that mimics next-intl's useTranslations API
712
- *
713
- * @example
714
- * // Without namespace (uses default "translation" namespace)
715
- * const t = useTranslations();
716
- * t("common.save") // "Save"
717
- *
718
- * // With namespace prefix
719
- * const t = useTranslations("auth");
720
- * t("login") // accesses "auth.login"
721
- */
722
- declare function useTranslations(namespace?: string): (key: string, values?: TranslationValues) => string;
723
-
724
- /**
725
- * i18n configuration constants
726
- */
727
- declare const locales: readonly ["ja", "en", "vi"];
728
- type Locale = (typeof locales)[number];
729
- declare const defaultLocale: Locale;
730
- declare const localeNames: Record<Locale, string>;
731
- declare const changeLanguage: (locale: Locale) => void;
732
- declare const getCurrentLocale: () => Locale;
733
-
734
- /**
735
- * Hook to get the current locale
736
- * This provides the same API as next-intl's useLocale()
737
- */
738
- declare function useLocale(): Locale;
739
-
740
- /**
741
- * Branch header utilities for API clients
742
- *
743
- * These utilities help set branch context headers on axios instances.
744
- * Works with BranchGate's onSelectionChange callback.
745
- *
746
- * @example
747
- * ```typescript
748
- * import { createBranchHeaderSetter } from '@famgia/omnify-react-sso';
749
- * import api from './api'; // your axios instance
750
- *
751
- * // Create setter for your axios instance
752
- * const setBranchHeaders = createBranchHeaderSetter(api);
753
- *
754
- * // Use in BranchGate
755
- * <BranchGate onSelectionChange={setBranchHeaders}>
756
- * <App />
757
- * </BranchGate>
758
- * ```
759
- */
760
-
761
- /**
762
- * Headers set by branch selection
763
- */
764
- declare const BRANCH_HEADERS: {
765
- readonly BRANCH_ID: "X-Branch-Id";
766
- readonly ORG_ID: "X-Org-Id";
767
- readonly BRANCH_NAME: "X-Branch-Name";
768
- readonly BRANCH_CODE: "X-Branch-Code";
769
- };
770
- /**
771
- * Minimal axios-like interface for header management
772
- */
773
- interface AxiosLike {
774
- defaults: {
775
- headers: {
776
- common: Record<string, string | undefined>;
777
- };
778
- };
779
- }
780
- /**
781
- * Create a branch header setter function for an axios instance
782
- *
783
- * @param axiosInstance - Your axios instance
784
- * @returns A function to pass to BranchGate's onSelectionChange
785
- *
786
- * @example
787
- * ```typescript
788
- * const setBranchHeaders = createBranchHeaderSetter(api);
789
- *
790
- * <BranchGate onSelectionChange={setBranchHeaders}>
791
- * <App />
792
- * </BranchGate>
793
- * ```
794
- */
795
- declare function createBranchHeaderSetter(axiosInstance: AxiosLike): (selection: BranchGateSelection | null) => void;
796
- /**
797
- * Set branch headers directly on an axios instance
798
- *
799
- * @example
800
- * ```typescript
801
- * import api from './api';
802
- * import { setBranchHeaders } from '@famgia/omnify-react-sso';
803
- *
804
- * // In BranchGate onSelectionChange
805
- * <BranchGate onSelectionChange={(s) => setBranchHeaders(api, s)}>
806
- * <App />
807
- * </BranchGate>
808
- * ```
809
- */
810
- declare function setBranchHeaders(axiosInstance: AxiosLike, selection: BranchGateSelection | null): void;
811
-
812
- /**
813
- * Auth Service - SSO Authentication
814
- *
815
- * Handles SSO callback, logout, user info
816
- */
817
-
818
- interface SsoUser$1 {
819
- id: number;
820
- console_user_id: number;
821
- email: string;
822
- name: string;
823
- }
824
- interface Organization$1 {
825
- id: number;
826
- slug: string;
827
- name: string;
828
- role: string;
829
- }
830
- interface AuthCallbackInput {
831
- code: string;
832
- device_name?: string;
833
- }
834
- interface AuthCallbackResponse {
835
- user: SsoUser$1;
836
- organizations: Organization$1[];
837
- token?: string;
838
- }
839
- interface AuthUserResponse {
840
- user: SsoUser$1;
841
- organizations: Organization$1[];
842
- }
843
- declare function createAuthService(config: ServiceConfig): {
844
- /**
845
- * Exchange SSO authorization code for tokens
846
- * POST /api/sso/callback
847
- */
848
- callback: (input: AuthCallbackInput) => Promise<AuthCallbackResponse>;
849
- /**
850
- * Logout current user and revoke tokens
851
- * POST /api/sso/logout
852
- */
853
- logout: () => Promise<{
854
- message: string;
855
- }>;
856
- /**
857
- * Get current authenticated user with organizations
858
- * GET /api/sso/user
859
- */
860
- getUser: () => Promise<AuthUserResponse>;
861
- /**
862
- * Get Console SSO global logout URL
863
- * GET /api/sso/global-logout-url
864
- */
865
- getGlobalLogoutUrl: (redirectUri?: string) => Promise<{
866
- logout_url: string;
867
- }>;
868
- };
869
- type AuthService = ReturnType<typeof createAuthService>;
870
-
871
- /**
872
- * Token Service - API Token Management
873
- *
874
- * For mobile apps using bearer tokens
875
- */
876
-
877
- interface ApiToken$1 {
878
- id: number;
879
- name: string;
880
- last_used_at: string | null;
881
- created_at: string;
882
- is_current: boolean;
883
- }
884
- declare function createTokenService(config: ServiceConfig): {
885
- /**
886
- * List all API tokens for current user
887
- * GET /api/sso/tokens
888
- */
889
- list: () => Promise<{
890
- tokens: ApiToken$1[];
891
- }>;
892
- /**
893
- * Revoke a specific token
894
- * DELETE /api/sso/tokens/{tokenId}
895
- */
896
- revoke: (tokenId: number) => Promise<{
897
- message: string;
898
- }>;
899
- /**
900
- * Revoke all tokens except current
901
- * POST /api/sso/tokens/revoke-others
902
- */
903
- revokeOthers: () => Promise<{
904
- message: string;
905
- revoked_count: number;
906
- }>;
907
- };
908
- type TokenService = ReturnType<typeof createTokenService>;
909
-
910
- /**
911
- * Role Service - Role Management
912
- *
913
- * CRUD operations for roles and role-permission assignments
914
- */
915
-
916
- interface Role$1 {
917
- id: string;
918
- name: string;
919
- slug: string;
920
- description: string | null;
921
- level: number;
922
- console_org_id?: string | null;
923
- permissions_count?: number;
924
- organization?: {
925
- id: string;
926
- console_org_id: string;
927
- name: string;
928
- code: string;
929
- } | null;
930
- created_at: string;
931
- updated_at: string;
932
- }
933
- interface Permission$1 {
934
- id: string;
935
- name: string;
936
- slug: string;
937
- group: string | null;
938
- description?: string | null;
939
- roles_count?: number;
940
- created_at: string;
941
- updated_at: string;
942
- }
943
- interface RoleWithPermissions$1 extends Role$1 {
944
- permissions: Permission$1[];
945
- }
946
- interface CreateRoleInput$1 {
947
- slug: string;
948
- name: string;
949
- level: number;
950
- description?: string;
951
- scope?: 'global' | 'org';
952
- console_org_id?: string | null;
953
- }
954
- interface RoleListParams {
955
- 'filter[scope]'?: 'global' | 'org' | 'all';
956
- 'filter[org_id]'?: string;
957
- }
958
- interface UpdateRoleInput$1 {
959
- name?: string;
960
- level?: number;
961
- description?: string | null;
962
- }
963
- interface SyncPermissionsInput$1 {
964
- permissions: (number | string)[];
965
- }
966
- interface SyncPermissionsResponse {
967
- message: string;
968
- attached: number;
969
- detached: number;
970
- }
971
- declare function createRoleService(config: ServiceConfig): {
972
- /**
973
- * Get all roles
974
- * GET /api/sso/roles
975
- */
976
- list: () => Promise<{
977
- data: Role$1[];
978
- }>;
979
- /**
980
- * Get single role with permissions
981
- * GET /api/sso/roles/{id}
982
- */
983
- get: (id: number | string) => Promise<{
984
- data: RoleWithPermissions$1;
985
- }>;
986
- /**
987
- * List all roles (admin)
988
- * GET /api/admin/sso/roles
989
- */
990
- adminList: (orgSlug: string, params?: RoleListParams) => Promise<{
991
- data: Role$1[];
992
- }>;
993
- /**
994
- * Get single role (admin)
995
- * GET /api/admin/sso/roles/{id}
996
- */
997
- adminGet: (id: number | string, orgSlug: string) => Promise<{
998
- data: RoleWithPermissions$1;
999
- }>;
1000
- /**
1001
- * Create role (admin only)
1002
- * POST /api/admin/sso/roles
1003
- */
1004
- create: (input: CreateRoleInput$1, orgSlug: string) => Promise<{
1005
- data: Role$1;
1006
- message: string;
1007
- }>;
1008
- /**
1009
- * Update role (admin only)
1010
- * PUT /api/admin/sso/roles/{id}
1011
- */
1012
- update: (id: number | string, input: UpdateRoleInput$1, orgSlug: string) => Promise<{
1013
- data: Role$1;
1014
- message: string;
1015
- }>;
1016
- /**
1017
- * Delete role (admin only)
1018
- * DELETE /api/admin/sso/roles/{id}
1019
- */
1020
- delete: (id: number | string, orgSlug: string) => Promise<void>;
1021
- /**
1022
- * Get role's permissions (admin)
1023
- * GET /api/admin/sso/roles/{id}/permissions
1024
- */
1025
- getPermissions: (id: number | string, orgSlug: string) => Promise<{
1026
- role: Pick<Role$1, "id" | "slug" | "name">;
1027
- permissions: Permission$1[];
1028
- }>;
1029
- /**
1030
- * Sync role's permissions (admin)
1031
- * PUT /api/admin/sso/roles/{id}/permissions
1032
- */
1033
- syncPermissions: (id: number | string, input: SyncPermissionsInput$1, orgSlug: string) => Promise<SyncPermissionsResponse>;
1034
- };
1035
- type RoleService = ReturnType<typeof createRoleService>;
1036
-
1037
- /**
1038
- * Permission Service - Permission Management
1039
- *
1040
- * CRUD operations for permissions and permission matrix
1041
- */
1042
-
1043
- interface PermissionMatrix$1 {
1044
- roles: Pick<Role$1, "id" | "slug" | "name">[];
1045
- permissions: Record<string, Pick<Permission$1, "id" | "slug" | "name">[]>;
1046
- matrix: Record<string, string[]>;
1047
- }
1048
- interface CreatePermissionInput$1 {
1049
- slug: string;
1050
- name: string;
1051
- group?: string;
1052
- description?: string;
1053
- }
1054
- interface UpdatePermissionInput$1 {
1055
- name?: string;
1056
- group?: string | null;
1057
- description?: string | null;
1058
- }
1059
- interface PermissionListParams {
1060
- group?: string;
1061
- search?: string;
1062
- grouped?: boolean;
1063
- }
1064
- declare function createPermissionService(config: ServiceConfig): {
1065
- /**
1066
- * Get all permissions
1067
- * GET /api/sso/permissions
1068
- */
1069
- list: (params?: PermissionListParams) => Promise<{
1070
- data: Permission$1[];
1071
- groups: string[];
1072
- }>;
1073
- /**
1074
- * Get permission matrix (roles x permissions)
1075
- * GET /api/sso/permission-matrix
1076
- */
1077
- getMatrix: () => Promise<PermissionMatrix$1>;
1078
- /**
1079
- * List all permissions (admin)
1080
- * GET /api/admin/sso/permissions
1081
- */
1082
- adminList: (orgSlug: string, params?: PermissionListParams) => Promise<{
1083
- data: Permission$1[];
1084
- groups: string[];
1085
- }>;
1086
- /**
1087
- * Get single permission (admin)
1088
- * GET /api/admin/sso/permissions/{id}
1089
- */
1090
- adminGet: (id: number | string, orgSlug: string) => Promise<{
1091
- data: Permission$1;
1092
- }>;
1093
- /**
1094
- * Create permission (admin only)
1095
- * POST /api/admin/sso/permissions
1096
- */
1097
- create: (input: CreatePermissionInput$1, orgSlug: string) => Promise<{
1098
- data: Permission$1;
1099
- message: string;
1100
- }>;
1101
- /**
1102
- * Update permission (admin only)
1103
- * PUT /api/admin/sso/permissions/{id}
1104
- */
1105
- update: (id: number | string, input: UpdatePermissionInput$1, orgSlug: string) => Promise<{
1106
- data: Permission$1;
1107
- message: string;
1108
- }>;
1109
- /**
1110
- * Delete permission (admin only)
1111
- * DELETE /api/admin/sso/permissions/{id}
1112
- */
1113
- delete: (id: number | string, orgSlug: string) => Promise<void>;
1114
- /**
1115
- * Get permission matrix (admin)
1116
- * GET /api/admin/sso/permission-matrix
1117
- */
1118
- adminGetMatrix: (orgSlug: string) => Promise<PermissionMatrix$1>;
1119
- };
1120
- type PermissionService = ReturnType<typeof createPermissionService>;
1121
-
1122
- /**
1123
- * Team Service - Team Permission Management
1124
- *
1125
- * Manage team permissions and orphaned team cleanup
1126
- */
1127
-
1128
- interface TeamWithPermissions$1 {
1129
- console_team_id: number;
1130
- name: string;
1131
- path: string | null;
1132
- permissions: Pick<Permission$1, "id" | "slug">[];
1133
- }
1134
- interface TeamPermissionDetail$1 {
1135
- console_team_id: number;
1136
- permissions: Pick<Permission$1, "id" | "slug" | "name">[];
1137
- }
1138
- interface OrphanedTeam$1 {
1139
- console_team_id: number;
1140
- permissions_count: number;
1141
- permissions: string[];
1142
- deleted_at: string | null;
1143
- }
1144
- interface SyncTeamPermissionsInput {
1145
- permissions: (number | string)[];
1146
- }
1147
- interface CleanupOrphanedInput$1 {
1148
- console_team_id?: number;
1149
- older_than_days?: number;
1150
- }
1151
- declare function createTeamService(config: ServiceConfig): {
1152
- /**
1153
- * Get all teams with their permissions (admin only)
1154
- * GET /api/admin/sso/teams/permissions
1155
- */
1156
- list: (orgSlug: string) => Promise<{
1157
- teams: TeamWithPermissions$1[];
1158
- }>;
1159
- /**
1160
- * Get specific team permissions (admin only)
1161
- * GET /api/admin/sso/teams/{teamId}/permissions
1162
- */
1163
- getPermissions: (teamId: number, orgSlug: string) => Promise<TeamPermissionDetail$1>;
1164
- /**
1165
- * Sync team permissions (admin only)
1166
- * PUT /api/admin/sso/teams/{teamId}/permissions
1167
- */
1168
- syncPermissions: (teamId: number, input: SyncTeamPermissionsInput, orgSlug: string) => Promise<{
1169
- message: string;
1170
- console_team_id: number;
1171
- attached: number;
1172
- detached: number;
1173
- }>;
1174
- /**
1175
- * Remove all permissions for a team (admin only)
1176
- * DELETE /api/admin/sso/teams/{teamId}/permissions
1177
- */
1178
- removePermissions: (teamId: number, orgSlug: string) => Promise<void>;
1179
- /**
1180
- * List orphaned team permissions (admin only)
1181
- * GET /api/admin/sso/teams/orphaned
1182
- */
1183
- listOrphaned: (orgSlug: string) => Promise<{
1184
- orphaned_teams: OrphanedTeam$1[];
1185
- total_orphaned_permissions: number;
1186
- }>;
1187
- /**
1188
- * Restore orphaned team permissions (admin only)
1189
- * POST /api/admin/sso/teams/orphaned/{teamId}/restore
1190
- */
1191
- restoreOrphaned: (teamId: number, orgSlug: string) => Promise<{
1192
- message: string;
1193
- console_team_id: number;
1194
- restored_count: number;
1195
- }>;
1196
- /**
1197
- * Cleanup orphaned team permissions (admin only)
1198
- * DELETE /api/admin/sso/teams/orphaned
1199
- */
1200
- cleanupOrphaned: (orgSlug: string, input?: CleanupOrphanedInput$1) => Promise<{
1201
- message: string;
1202
- deleted_count: number;
1203
- }>;
1204
- };
1205
- type TeamService = ReturnType<typeof createTeamService>;
1206
-
1207
- /**
1208
- * User Role Service - Scoped Role Assignments
1209
- *
1210
- * Implements Branch-Level Permissions management:
1211
- * - Global: org_id=null, branch_id=null → Role applies everywhere
1212
- * - Org-wide: org_id=X, branch_id=null → Role applies to all branches in org
1213
- * - Branch: org_id=X, branch_id=Y → Role applies only to specific branch
1214
- */
1215
-
1216
- type RoleScope = "global" | "org-wide" | "branch";
1217
- interface RoleAssignment {
1218
- id: string | null;
1219
- role: {
1220
- id: string;
1221
- name: string;
1222
- slug: string;
1223
- level: number;
1224
- };
1225
- console_org_id: string | null;
1226
- console_branch_id: string | null;
1227
- scope: RoleScope;
1228
- created_at: string | null;
1229
- }
1230
- interface AssignRoleInput {
1231
- role_id: string;
1232
- console_org_id?: string | null;
1233
- console_branch_id?: string | null;
1234
- }
1235
- interface AssignRoleResponse {
1236
- message: string;
1237
- data: {
1238
- role: {
1239
- id: string;
1240
- name: string;
1241
- slug: string;
1242
- level: number;
1243
- };
1244
- console_org_id: string | null;
1245
- console_branch_id: string | null;
1246
- scope: RoleScope;
1247
- };
1248
- }
1249
- interface SyncRolesInput {
1250
- roles: string[];
1251
- console_org_id?: string | null;
1252
- console_branch_id?: string | null;
1253
- }
1254
- interface SyncRolesResponse {
1255
- message: string;
1256
- attached: string[];
1257
- detached: string[];
1258
- scope: RoleScope;
1259
- }
1260
- interface RemoveRoleResponse {
1261
- message: string;
1262
- removed: number;
1263
- }
1264
- declare function createUserRoleService(config: ServiceConfig): {
1265
- /**
1266
- * List user's role assignments with scope information
1267
- * GET /api/admin/sso/users/{userId}/roles
1268
- */
1269
- list: (userId: string, orgSlug?: string) => Promise<RoleAssignment[]>;
1270
- /**
1271
- * List user's role assignments filtered by branch context
1272
- * Returns roles applicable to the given org/branch
1273
- */
1274
- listByBranch: (userId: string, orgId: string, branchId: string | null, orgSlug?: string) => Promise<RoleAssignment[]>;
1275
- /**
1276
- * Assign a role to user with scope
1277
- * POST /api/admin/sso/users/{userId}/roles
1278
- */
1279
- assign: (userId: string, input: AssignRoleInput, orgSlug?: string) => Promise<AssignRoleResponse>;
1280
- /**
1281
- * Remove a role assignment from user
1282
- * DELETE /api/admin/sso/users/{userId}/roles/{roleId}
1283
- */
1284
- remove: (userId: string, roleId: string, orgId?: string | null, branchId?: string | null, orgSlug?: string) => Promise<RemoveRoleResponse>;
1285
- /**
1286
- * Sync roles for user in a specific scope
1287
- * PUT /api/admin/sso/users/{userId}/roles/sync
1288
- */
1289
- sync: (userId: string, input: SyncRolesInput, orgSlug?: string) => Promise<SyncRolesResponse>;
1290
- };
1291
- type UserRoleService = ReturnType<typeof createUserRoleService>;
1292
- /**
1293
- * Get scope label for display
1294
- */
1295
- declare const getScopeLabel: (scope: RoleScope, locale?: "en" | "ja" | "vi") => string;
1296
- /**
1297
- * Get effective permissions for a user at a specific branch
1298
- * based on their role assignments
1299
- */
1300
- declare const getEffectivePermissions: <TRole extends {
1301
- id: string;
1302
- permissions?: Array<string | {
1303
- slug: string;
1304
- }>;
1305
- }>(roleAssignments: RoleAssignment[], allRoles: TRole[], orgId: string, branchId: string | null) => string[];
1306
-
1307
- /**
1308
- * Branch Service - Branch Management
1309
- *
1310
- * Provides methods to fetch branches for the current user/organization
1311
- */
1312
-
1313
- interface Branch {
1314
- id: number;
1315
- code: string;
1316
- name: string;
1317
- is_headquarters: boolean;
1318
- is_primary: boolean;
1319
- is_assigned: boolean;
1320
- access_type: "explicit" | "implicit";
1321
- timezone: string | null;
1322
- currency: string | null;
1323
- locale: string | null;
1324
- }
1325
- interface BranchesResponse {
1326
- all_branches_access: boolean;
1327
- branches: Branch[];
1328
- primary_branch_id: number | null;
1329
- organization: {
1330
- id: number;
1331
- slug: string;
1332
- name: string;
1333
- };
1334
- }
1335
- declare function createBranchService(config: ServiceConfig): {
1336
- /**
1337
- * Get branches for current user in organization
1338
- * GET /api/sso/branches
1339
- */
1340
- list: (orgSlug?: string) => Promise<BranchesResponse>;
1341
- /**
1342
- * Get a specific branch by ID
1343
- * GET /api/sso/branches/{id}
1344
- */
1345
- get: (branchId: number) => Promise<Branch>;
1346
- /**
1347
- * Get headquarters branch for organization
1348
- */
1349
- getHeadquarters: (orgSlug?: string) => Promise<Branch | null>;
1350
- /**
1351
- * Get primary branch for current user
1352
- */
1353
- getPrimary: (orgSlug?: string) => Promise<Branch | null>;
1354
- };
1355
- type BranchService = ReturnType<typeof createBranchService>;
1356
-
1357
- /**
1358
- * SSO Service - API client for SSO endpoints
1359
- *
1360
- * Provides methods for SSO authentication, tokens, roles, permissions, teams
1361
- */
1362
- interface SsoUser {
1363
- id: number;
1364
- console_user_id: number;
1365
- email: string;
1366
- name: string;
1367
- }
1368
- interface Organization {
1369
- id: number;
1370
- slug: string;
1371
- name: string;
1372
- role: string;
1373
- }
1374
- interface Role {
1375
- id: string;
1376
- name: string;
1377
- slug: string;
1378
- description: string | null;
1379
- level: number;
1380
- console_org_id?: string | null;
1381
- permissions_count?: number;
1382
- created_at: string;
1383
- updated_at: string;
1384
- }
1385
- interface Permission {
1386
- id: string;
1387
- name: string;
1388
- slug: string;
1389
- group: string | null;
1390
- description?: string | null;
1391
- roles_count?: number;
1392
- created_at: string;
1393
- updated_at: string;
1394
- }
1395
- interface RoleWithPermissions extends Role {
1396
- permissions: Permission[];
1397
- }
1398
- interface PermissionMatrix {
1399
- roles: Pick<Role, "id" | "slug" | "name">[];
1400
- permissions: Record<string, Pick<Permission, "id" | "slug" | "name">[]>;
1401
- matrix: Record<string, string[]>;
1402
- }
1403
- interface ApiToken {
1404
- id: number;
1405
- name: string;
1406
- last_used_at: string | null;
1407
- created_at: string;
1408
- is_current: boolean;
1409
- }
1410
- interface TeamWithPermissions {
1411
- console_team_id: number;
1412
- name: string;
1413
- path: string | null;
1414
- permissions: Pick<Permission, "id" | "slug">[];
1415
- }
1416
- interface TeamPermissionDetail {
1417
- console_team_id: number;
1418
- permissions: Pick<Permission, "id" | "slug" | "name">[];
1419
- }
1420
- interface OrphanedTeam {
1421
- console_team_id: number;
1422
- permissions_count: number;
1423
- permissions: string[];
1424
- deleted_at: string | null;
1425
- }
1426
- interface SsoCallbackInput {
1427
- code: string;
1428
- device_name?: string;
1429
- }
1430
- interface CreateRoleInput {
1431
- slug: string;
1432
- name: string;
1433
- level: number;
1434
- description?: string;
1435
- }
1436
- interface UpdateRoleInput {
1437
- name?: string;
1438
- level?: number;
1439
- description?: string | null;
1440
- }
1441
- interface CreatePermissionInput {
1442
- slug: string;
1443
- name: string;
1444
- group?: string;
1445
- description?: string;
1446
- }
1447
- interface UpdatePermissionInput {
1448
- name?: string;
1449
- group?: string | null;
1450
- description?: string | null;
1451
- }
1452
- interface SyncPermissionsInput {
1453
- permissions: (number | string)[];
1454
- }
1455
- interface CleanupOrphanedInput {
1456
- console_team_id?: number;
1457
- older_than_days?: number;
1458
- }
1459
- interface SsoServiceConfig {
1460
- apiUrl: string;
1461
- }
1462
- declare function createSsoService(config: SsoServiceConfig): {
1463
- /**
1464
- * Exchange SSO authorization code for tokens
1465
- * POST /api/sso/callback
1466
- */
1467
- callback: (input: SsoCallbackInput) => Promise<{
1468
- user: SsoUser;
1469
- organizations: Organization[];
1470
- token?: string;
1471
- }>;
1472
- /**
1473
- * Logout current user and revoke tokens
1474
- * POST /api/sso/logout
1475
- */
1476
- logout: () => Promise<{
1477
- message: string;
1478
- }>;
1479
- /**
1480
- * Get current authenticated user with organizations
1481
- * GET /api/sso/user
1482
- */
1483
- getUser: () => Promise<{
1484
- user: SsoUser;
1485
- organizations: Organization[];
1486
- }>;
1487
- /**
1488
- * Get Console SSO global logout URL
1489
- * GET /api/sso/global-logout-url
1490
- */
1491
- getGlobalLogoutUrl: (redirectUri?: string) => Promise<{
1492
- logout_url: string;
1493
- }>;
1494
- /**
1495
- * List all API tokens for current user
1496
- * GET /api/sso/tokens
1497
- */
1498
- getTokens: () => Promise<{
1499
- tokens: ApiToken[];
1500
- }>;
1501
- /**
1502
- * Revoke a specific token
1503
- * DELETE /api/sso/tokens/{tokenId}
1504
- */
1505
- revokeToken: (tokenId: number) => Promise<{
1506
- message: string;
1507
- }>;
1508
- /**
1509
- * Revoke all tokens except current
1510
- * POST /api/sso/tokens/revoke-others
1511
- */
1512
- revokeOtherTokens: () => Promise<{
1513
- message: string;
1514
- revoked_count: number;
1515
- }>;
1516
- /**
1517
- * Get all roles
1518
- * GET /api/sso/roles
1519
- */
1520
- getRoles: () => Promise<{
1521
- data: Role[];
1522
- }>;
1523
- /**
1524
- * Get single role with permissions
1525
- * GET /api/sso/roles/{id}
1526
- */
1527
- getRole: (id: number) => Promise<{
1528
- data: RoleWithPermissions;
1529
- }>;
1530
- /**
1531
- * Get all permissions
1532
- * GET /api/sso/permissions
1533
- */
1534
- getPermissions: (params?: {
1535
- group?: string;
1536
- search?: string;
1537
- grouped?: boolean;
1538
- }) => Promise<{
1539
- data: Permission[];
1540
- groups: string[];
1541
- }>;
1542
- /**
1543
- * Get permission matrix (roles x permissions)
1544
- * GET /api/sso/permission-matrix
1545
- */
1546
- getPermissionMatrix: () => Promise<PermissionMatrix>;
1547
- /**
1548
- * List all roles (admin)
1549
- * GET /api/admin/sso/roles
1550
- */
1551
- adminGetRoles: (orgSlug: string) => Promise<{
1552
- data: Role[];
1553
- }>;
1554
- /**
1555
- * Get single role (admin)
1556
- * GET /api/admin/sso/roles/{id}
1557
- */
1558
- adminGetRole: (id: number, orgSlug: string) => Promise<{
1559
- data: RoleWithPermissions;
1560
- }>;
1561
- /**
1562
- * Create role (admin only)
1563
- * POST /api/admin/sso/roles
1564
- */
1565
- createRole: (input: CreateRoleInput, orgSlug: string) => Promise<{
1566
- data: Role;
1567
- message: string;
1568
- }>;
1569
- /**
1570
- * Update role (admin only)
1571
- * PUT /api/admin/sso/roles/{id}
1572
- */
1573
- updateRole: (id: number, input: UpdateRoleInput, orgSlug: string) => Promise<{
1574
- data: Role;
1575
- message: string;
1576
- }>;
1577
- /**
1578
- * Delete role (admin only)
1579
- * DELETE /api/admin/sso/roles/{id}
1580
- */
1581
- deleteRole: (id: number, orgSlug: string) => Promise<void>;
1582
- /**
1583
- * Get role's permissions (admin)
1584
- * GET /api/admin/sso/roles/{id}/permissions
1585
- */
1586
- getRolePermissions: (id: number, orgSlug: string) => Promise<{
1587
- role: Pick<Role, "id" | "slug" | "name">;
1588
- permissions: Permission[];
1589
- }>;
1590
- /**
1591
- * Sync role's permissions (admin)
1592
- * PUT /api/admin/sso/roles/{id}/permissions
1593
- */
1594
- syncRolePermissions: (id: number, input: SyncPermissionsInput, orgSlug: string) => Promise<{
1595
- message: string;
1596
- attached: number;
1597
- detached: number;
1598
- }>;
1599
- /**
1600
- * List all permissions (admin)
1601
- * GET /api/admin/sso/permissions
1602
- */
1603
- adminGetPermissions: (orgSlug: string, params?: {
1604
- group?: string;
1605
- search?: string;
1606
- grouped?: boolean;
1607
- }) => Promise<{
1608
- data: Permission[];
1609
- groups: string[];
1610
- }>;
1611
- /**
1612
- * Get single permission (admin)
1613
- * GET /api/admin/sso/permissions/{id}
1614
- */
1615
- adminGetPermission: (id: number, orgSlug: string) => Promise<{
1616
- data: Permission;
1617
- }>;
1618
- /**
1619
- * Create permission (admin only)
1620
- * POST /api/admin/sso/permissions
1621
- */
1622
- createPermission: (input: CreatePermissionInput, orgSlug: string) => Promise<{
1623
- data: Permission;
1624
- message: string;
1625
- }>;
1626
- /**
1627
- * Update permission (admin only)
1628
- * PUT /api/admin/sso/permissions/{id}
1629
- */
1630
- updatePermission: (id: number, input: UpdatePermissionInput, orgSlug: string) => Promise<{
1631
- data: Permission;
1632
- message: string;
1633
- }>;
1634
- /**
1635
- * Delete permission (admin only)
1636
- * DELETE /api/admin/sso/permissions/{id}
1637
- */
1638
- deletePermission: (id: number, orgSlug: string) => Promise<void>;
1639
- /**
1640
- * Get permission matrix (admin)
1641
- * GET /api/admin/sso/permission-matrix
1642
- */
1643
- adminGetPermissionMatrix: (orgSlug: string) => Promise<PermissionMatrix>;
1644
- /**
1645
- * Get all teams with their permissions (admin only)
1646
- * GET /api/admin/sso/teams/permissions
1647
- */
1648
- getTeamPermissions: (orgSlug: string) => Promise<{
1649
- teams: TeamWithPermissions[];
1650
- }>;
1651
- /**
1652
- * Get specific team permissions (admin only)
1653
- * GET /api/admin/sso/teams/{teamId}/permissions
1654
- */
1655
- getTeamPermission: (teamId: number, orgSlug: string) => Promise<TeamPermissionDetail>;
1656
- /**
1657
- * Sync team permissions (admin only)
1658
- * PUT /api/admin/sso/teams/{teamId}/permissions
1659
- */
1660
- syncTeamPermissions: (teamId: number, input: SyncPermissionsInput, orgSlug: string) => Promise<{
1661
- message: string;
1662
- console_team_id: number;
1663
- attached: number;
1664
- detached: number;
1665
- }>;
1666
- /**
1667
- * Remove all permissions for a team (admin only)
1668
- * DELETE /api/admin/sso/teams/{teamId}/permissions
1669
- */
1670
- removeTeamPermissions: (teamId: number, orgSlug: string) => Promise<void>;
1671
- /**
1672
- * List orphaned team permissions (admin only)
1673
- * GET /api/admin/sso/teams/orphaned
1674
- */
1675
- getOrphanedTeamPermissions: (orgSlug: string) => Promise<{
1676
- orphaned_teams: OrphanedTeam[];
1677
- total_orphaned_permissions: number;
1678
- }>;
1679
- /**
1680
- * Restore orphaned team permissions (admin only)
1681
- * POST /api/admin/sso/teams/orphaned/{teamId}/restore
1682
- */
1683
- restoreOrphanedTeamPermissions: (teamId: number, orgSlug: string) => Promise<{
1684
- message: string;
1685
- console_team_id: number;
1686
- restored_count: number;
1687
- }>;
1688
- /**
1689
- * Cleanup orphaned team permissions (admin only)
1690
- * DELETE /api/admin/sso/teams/orphaned
1691
- */
1692
- cleanupOrphanedTeamPermissions: (orgSlug: string, input?: CleanupOrphanedInput) => Promise<{
1693
- message: string;
1694
- deleted_count: number;
1695
- }>;
1696
- };
1697
- type SsoService = ReturnType<typeof createSsoService>;
1698
-
1699
- /**
1700
- * SSO Query Keys - For TanStack Query / React Query
1701
- *
1702
- * Centralized key management for SSO-related queries.
1703
- * Structure matches the service organization.
1704
- */
1705
- declare const ssoQueryKeys: {
1706
- readonly all: readonly ["sso"];
1707
- readonly auth: {
1708
- readonly all: () => readonly ["sso", "auth"];
1709
- readonly user: () => readonly ["sso", "auth", "user"];
1710
- readonly globalLogoutUrl: (redirectUri?: string) => readonly ["sso", "auth", "global-logout-url", string | undefined];
1711
- };
1712
- readonly tokens: {
1713
- readonly all: () => readonly ["sso", "tokens"];
1714
- readonly list: () => readonly ["sso", "tokens", "list"];
1715
- };
1716
- readonly roles: {
1717
- readonly all: () => readonly ["sso", "roles"];
1718
- readonly list: () => readonly ["sso", "roles", "list"];
1719
- readonly detail: (id: number | string) => readonly ["sso", "roles", "detail", string | number];
1720
- readonly permissions: (id: number | string) => readonly ["sso", "roles", string | number, "permissions"];
1721
- };
1722
- readonly permissions: {
1723
- readonly all: () => readonly ["sso", "permissions"];
1724
- readonly list: (params?: {
1725
- group?: string;
1726
- search?: string;
1727
- grouped?: boolean;
1728
- }) => readonly ["sso", "permissions", "list", {
1729
- group?: string;
1730
- search?: string;
1731
- grouped?: boolean;
1732
- } | undefined];
1733
- readonly detail: (id: number | string) => readonly ["sso", "permissions", "detail", string | number];
1734
- readonly matrix: () => readonly ["sso", "permissions", "matrix"];
1735
- };
1736
- readonly teams: {
1737
- readonly all: () => readonly ["sso", "teams"];
1738
- readonly list: () => readonly ["sso", "teams", "list"];
1739
- readonly permissions: (teamId: number) => readonly ["sso", "teams", number, "permissions"];
1740
- readonly orphaned: () => readonly ["sso", "teams", "orphaned"];
1741
- };
1742
- readonly userRoles: {
1743
- readonly all: () => readonly ["sso", "user-roles"];
1744
- readonly list: (userId: string) => readonly ["sso", "user-roles", string];
1745
- readonly byBranch: (userId: string, orgId: string, branchId: string | null) => readonly ["sso", "user-roles", string, string, string | null];
1746
- };
1747
- readonly users: {
1748
- readonly all: () => readonly ["sso", "users"];
1749
- readonly list: (params?: {
1750
- page?: number;
1751
- per_page?: number;
1752
- search?: string;
1753
- sort?: string;
1754
- order?: string;
1755
- }) => readonly ["sso", "users", "list", {
1756
- page?: number;
1757
- per_page?: number;
1758
- search?: string;
1759
- sort?: string;
1760
- order?: string;
1761
- } | undefined];
1762
- readonly detail: (id: number | string) => readonly ["sso", "users", "detail", string | number];
1763
- };
1764
- readonly branches: {
1765
- readonly all: () => readonly ["sso", "branches"];
1766
- readonly list: (orgSlug?: string) => readonly ["sso", "branches", "list", string | undefined];
1767
- readonly detail: (branchId: number) => readonly ["sso", "branches", "detail", number];
1768
- readonly headquarters: (orgSlug?: string) => readonly ["sso", "branches", "headquarters", string | undefined];
1769
- readonly primary: (orgSlug?: string) => readonly ["sso", "branches", "primary", string | undefined];
1770
- };
1771
- readonly admin: {
1772
- readonly users: {
1773
- readonly all: (orgSlug: string) => readonly ["sso", "admin", string, "users"];
1774
- readonly list: (orgSlug: string, params?: {
1775
- page?: number;
1776
- per_page?: number;
1777
- search?: string;
1778
- sort?: string;
1779
- order?: string;
1780
- }) => readonly ["sso", "admin", string, "users", "list", {
1781
- page?: number;
1782
- per_page?: number;
1783
- search?: string;
1784
- sort?: string;
1785
- order?: string;
1786
- } | undefined];
1787
- readonly detail: (orgSlug: string, id: number | string) => readonly ["sso", "admin", string, "users", "detail", string | number];
1788
- };
1789
- readonly roles: {
1790
- readonly all: (orgSlug: string) => readonly ["sso", "admin", string, "roles"];
1791
- readonly list: (orgSlug: string) => readonly ["sso", "admin", string, "roles", "list"];
1792
- readonly detail: (orgSlug: string, id: number | string) => readonly ["sso", "admin", string, "roles", "detail", string | number];
1793
- readonly permissions: (orgSlug: string, id: number | string) => readonly ["sso", "admin", string, "roles", string | number, "permissions"];
1794
- };
1795
- readonly permissions: {
1796
- readonly all: (orgSlug: string) => readonly ["sso", "admin", string, "permissions"];
1797
- readonly list: (orgSlug: string, params?: {
1798
- group?: string;
1799
- search?: string;
1800
- grouped?: boolean;
1801
- }) => readonly ["sso", "admin", string, "permissions", "list", {
1802
- group?: string;
1803
- search?: string;
1804
- grouped?: boolean;
1805
- } | undefined];
1806
- readonly detail: (orgSlug: string, id: number | string) => readonly ["sso", "admin", string, "permissions", "detail", string | number];
1807
- readonly matrix: (orgSlug: string) => readonly ["sso", "admin", string, "permissions", "matrix"];
1808
- };
1809
- readonly teams: {
1810
- readonly all: (orgSlug: string) => readonly ["sso", "admin", string, "teams"];
1811
- readonly list: (orgSlug: string) => readonly ["sso", "admin", string, "teams", "list"];
1812
- readonly permissions: (orgSlug: string, teamId: number) => readonly ["sso", "admin", string, "teams", number, "permissions"];
1813
- readonly orphaned: (orgSlug: string) => readonly ["sso", "admin", string, "teams", "orphaned"];
1814
- };
1815
- readonly userRoles: {
1816
- readonly all: (orgSlug: string) => readonly ["sso", "admin", string, "user-roles"];
1817
- readonly list: (orgSlug: string, userId: string) => readonly ["sso", "admin", string, "user-roles", string];
1818
- readonly byBranch: (orgSlug: string, userId: string, orgId: string, branchId: string | null) => readonly ["sso", "admin", string, "user-roles", string, string, string | null];
1819
- };
1820
- };
1821
- };
1822
-
1823
- export { type ApiToken$1 as ApiToken, type AssignRoleInput, type AssignRoleResponse, type AuthCallbackInput, type AuthCallbackResponse, type AuthService, type SsoUser$1 as AuthUser, type AuthUserResponse, BRANCH_HEADERS, type Branch, BranchContext, BranchContextValue, BranchGate, BranchGateProps, BranchGateSelection, BranchProvider, BranchProviderProps, type BranchService, type BranchesResponse, type CleanupOrphanedInput$1 as CleanupOrphanedInput, type CreatePermissionInput$1 as CreatePermissionInput, type CreateRoleInput$1 as CreateRoleInput, I18nProvider, type I18nProviderProps, type Locale, OrgBranchSelectorModal, OrgBranchSelectorModalProps, type Organization$1 as Organization, OrganizationSwitcher, OrganizationSwitcherProps, type OrphanedTeam$1 as OrphanedTeam, type Permission$1 as Permission, type PermissionListParams, type PermissionMatrix$1 as PermissionMatrix, type PermissionService, ProtectedRoute, ProtectedRouteProps, type RemoveRoleResponse, type Role$1 as Role, type RoleAssignment, type RoleAssignmentWithPermissions, type RoleScope, type RoleService, type RoleWithPermissions$1 as RoleWithPermissions, type ServiceConfig, type Permission$1 as ServicePermission, type Role$1 as ServiceRole, SsoCallback, SsoCallbackProps, SsoConfig, SsoContext, SsoContextValue, SsoOrganization, SsoProvider, SsoProviderProps, type SsoService, type SsoServiceConfig, type SsoUser$1 as SsoServiceUser, SsoUser$2 as SsoUser, type SyncPermissionsInput$1 as SyncPermissionsInput, type SyncPermissionsResponse, type SyncRolesInput, type SyncRolesResponse, type SyncTeamPermissionsInput, type TeamMembershipWithPermissions, type TeamPermissionDetail$1 as TeamPermissionDetail, type TeamService, type TeamWithPermissions$1 as TeamWithPermissions, type TokenService, type UpdatePermissionInput$1 as UpdatePermissionInput, type UpdateRoleInput$1 as UpdateRoleInput, type UpdateUserInput, type UseAuthReturn, type UseBranchReturn, type UseOrganizationReturn, type UseSsoReturn, type User, UserForm, type UserFormProps, type UserListParams, type UserListResponse, type UserPermissionsBreakdown, type UserRoleService, type UserService, UserTable, type UserTableProps, changeLanguage, createAuthService, createBranchHeaderSetter, createBranchService, createPermissionService, createRoleService, createSsoService, createTeamService, createTokenService, createUserRoleService, createUserService, defaultLocale, defaultTranslations, getCurrentLocale, getEffectivePermissions, getScopeLabel, localeNames, locales, setBranchHeaders, ssoNamespace, ssoQueryKeys, useAuth, useBranch, useBranchGate, useLocale, useOrganization, useSso, useSsoTranslation, useTranslations };
6
+ import 'react';
7
+ import 'react/jsx-runtime';
8
+ import 'react-i18next';
9
+ import 'i18next';
10
+ import 'antd';
11
+ import '@tanstack/react-query';