@famgia/omnify-react-sso 2.2.2 → 2.2.4

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 +2514 -234
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +10 -1451
  24. package/dist/index.d.ts +10 -1451
  25. package/dist/index.js +2578 -234
  26. package/dist/index.js.map +1 -1
  27. package/dist/{types-CJmA2a9r.d.ts → types-BxClyvTX.d.cts} +2 -3
  28. package/dist/{types-CJmA2a9r.d.cts → 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 +102 -110
  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 -121
  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 -135
  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 -635
  47. package/dist/schemas/index.cjs.map +0 -1
  48. package/dist/schemas/index.d.cts +0 -254
  49. package/dist/schemas/index.d.ts +0 -254
  50. package/dist/schemas/index.js +0 -547
  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
@@ -0,0 +1,2250 @@
1
+ import { z } from 'zod';
2
+ import * as react from 'react';
3
+ import { ReactNode } from 'react';
4
+ import { i as SsoContextValue, k as SsoProviderProps, B as BranchContextValue, c as BranchProviderProps, l as SsoUser$2, j as SsoOrganization, h as SsoConfig, b as BranchGateSelection } from './types-BxClyvTX.js';
5
+ import * as react_jsx_runtime from 'react/jsx-runtime';
6
+ import { R as Role$3, P as Permission$3, S as ServiceConfig } from './userService-DH9-vPSg.js';
7
+ import * as react_i18next from 'react-i18next';
8
+ import * as i18next from 'i18next';
9
+
10
+ /**
11
+ * ⚠️ DO NOT EDIT THIS FILE! ⚠️
12
+ * このファイルを編集しないでください!
13
+ * KHÔNG ĐƯỢC SỬA FILE NÀY!
14
+ *
15
+ * Auto-generated TypeScript types from Omnify schemas.
16
+ * Any manual changes will be OVERWRITTEN on next generation.
17
+ *
18
+ * To modify: Edit the schema YAML file and run: npx omnify generate
19
+ */
20
+ /**
21
+ * Locale map for multi-language support.
22
+ */
23
+ interface LocaleMap {
24
+ [locale: string]: string;
25
+ }
26
+ /**
27
+ * Supported locales in this project.
28
+ */
29
+ type Locale$1 = 'ja' | 'en';
30
+ /**
31
+ * Validation rule with multi-locale messages.
32
+ * Use get{Model}Rules(locale) to get Ant Design compatible rules with string messages.
33
+ */
34
+ interface ValidationRule {
35
+ required?: boolean;
36
+ type?: 'string' | 'number' | 'email' | 'url' | 'integer' | 'array' | 'object';
37
+ min?: number;
38
+ max?: number;
39
+ len?: number;
40
+ pattern?: RegExp;
41
+ message: LocaleMap;
42
+ }
43
+ /**
44
+ * ISO 8601 date-time string.
45
+ */
46
+ type DateTimeString = string;
47
+ /**
48
+ * ISO 8601 date string (YYYY-MM-DD).
49
+ */
50
+ type DateString = string;
51
+
52
+ /**
53
+ * SSO i18n Configuration
54
+ */
55
+ /**
56
+ * Default locale for this project.
57
+ */
58
+ declare const defaultLocale$1: "ja";
59
+ /**
60
+ * Fallback locale when requested locale is not found.
61
+ */
62
+ declare const fallbackLocale: "en";
63
+ /**
64
+ * Supported locales in this project.
65
+ */
66
+ declare const supportedLocales: readonly ["ja", "en"];
67
+ /**
68
+ * Validation messages for all supported locales.
69
+ * Use getMessage(key, locale, params) to get formatted message.
70
+ */
71
+ declare const validationMessages: {
72
+ readonly required: {
73
+ readonly ja: "${displayName}は必須です";
74
+ readonly en: "${displayName} is required";
75
+ };
76
+ readonly minLength: {
77
+ readonly ja: "${displayName}は${min}文字以上で入力してください";
78
+ readonly en: "${displayName} must be at least ${min} characters";
79
+ };
80
+ readonly maxLength: {
81
+ readonly ja: "${displayName}は${max}文字以内で入力してください";
82
+ readonly en: "${displayName} must be at most ${max} characters";
83
+ };
84
+ readonly min: {
85
+ readonly ja: "${displayName}は${min}以上で入力してください";
86
+ readonly en: "${displayName} must be at least ${min}";
87
+ };
88
+ readonly max: {
89
+ readonly ja: "${displayName}は${max}以下で入力してください";
90
+ readonly en: "${displayName} must be at most ${max}";
91
+ };
92
+ readonly email: {
93
+ readonly ja: "有効なメールアドレスを入力してください";
94
+ readonly en: "Please enter a valid email address";
95
+ };
96
+ readonly url: {
97
+ readonly ja: "有効なURLを入力してください";
98
+ readonly en: "Please enter a valid URL";
99
+ };
100
+ readonly pattern: {
101
+ readonly ja: "${displayName}の形式が正しくありません";
102
+ readonly en: "${displayName} format is invalid";
103
+ };
104
+ };
105
+ /**
106
+ * Get validation message for a specific key and locale.
107
+ * Supports template placeholders: ${displayName}, ${min}, ${max}, etc.
108
+ *
109
+ * @param key - Message key (e.g., 'required', 'minLength')
110
+ * @param locale - Locale code (e.g., 'ja', 'en')
111
+ * @param params - Template parameters to replace
112
+ * @returns Formatted message string
113
+ *
114
+ * @example
115
+ * getMessage('required', 'ja', { displayName: '氏名' })
116
+ * // => '氏名は必須です'
117
+ */
118
+ declare function getMessage(key: string, locale: string, params?: Record<string, string | number>): string;
119
+ /**
120
+ * Get all validation messages for a specific locale.
121
+ *
122
+ * @param locale - Locale code
123
+ * @returns Object with all messages for the locale
124
+ */
125
+ declare function getMessages(locale: string): Record<string, string>;
126
+
127
+ /**
128
+ * ⚠️ DO NOT EDIT THIS FILE! ⚠️
129
+ * このファイルを編集しないでください!
130
+ * KHÔNG ĐƯỢC SỬA FILE NÀY!
131
+ *
132
+ * Auto-generated TypeScript types from Omnify schemas.
133
+ * Any manual changes will be OVERWRITTEN on next generation.
134
+ *
135
+ * To modify: Edit the schema YAML file and run: npx omnify generate
136
+ */
137
+
138
+ /**
139
+ * 支店キャッシュ
140
+ */
141
+ interface BranchCache$1 {
142
+ /** Primary key */
143
+ id: string;
144
+ /** Console Branch ID */
145
+ console_branch_id: unknown;
146
+ /** Console Organization ID */
147
+ console_org_id: unknown;
148
+ /** 支店コード */
149
+ code: string;
150
+ /** 支店名 */
151
+ name: string;
152
+ /** 本社 */
153
+ is_headquarters: boolean;
154
+ /** 有効 */
155
+ is_active: boolean;
156
+ /** Creation timestamp */
157
+ created_at?: DateTimeString;
158
+ /** Last update timestamp */
159
+ updated_at?: DateTimeString;
160
+ /** Soft delete timestamp */
161
+ deleted_at?: DateTimeString;
162
+ }
163
+ /**
164
+ * Unified i18n object for BranchCache
165
+ * Contains model label and all field labels/placeholders
166
+ */
167
+ declare const branchCacheI18n: {
168
+ /** Model display name */
169
+ readonly label: {
170
+ readonly ja: "支店キャッシュ";
171
+ readonly en: "Branch Cache";
172
+ };
173
+ /** Field labels and placeholders */
174
+ readonly fields: {
175
+ readonly console_branch_id: {
176
+ readonly label: {
177
+ readonly ja: "Console Branch ID";
178
+ readonly en: "Console Branch ID";
179
+ };
180
+ };
181
+ readonly console_org_id: {
182
+ readonly label: {
183
+ readonly ja: "Console Organization ID";
184
+ readonly en: "Console Organization ID";
185
+ };
186
+ };
187
+ readonly code: {
188
+ readonly label: {
189
+ readonly ja: "支店コード";
190
+ readonly en: "Branch Code";
191
+ };
192
+ };
193
+ readonly name: {
194
+ readonly label: {
195
+ readonly ja: "支店名";
196
+ readonly en: "Branch Name";
197
+ };
198
+ };
199
+ readonly is_headquarters: {
200
+ readonly label: {
201
+ readonly ja: "本社";
202
+ readonly en: "Is Headquarters";
203
+ };
204
+ };
205
+ readonly is_active: {
206
+ readonly label: {
207
+ readonly ja: "有効";
208
+ readonly en: "Active";
209
+ };
210
+ };
211
+ };
212
+ };
213
+ /** Get model label for a specific locale */
214
+ declare function getBranchCacheLabel(locale: string): string;
215
+ /** Get field label for a specific locale */
216
+ declare function getBranchCacheFieldLabel(field: string, locale: string): string;
217
+ /** Get field placeholder for a specific locale */
218
+ declare function getBranchCacheFieldPlaceholder(field: string, locale: string): string;
219
+
220
+ /**
221
+ * BranchCache Model
222
+ *
223
+ * This file extends the auto-generated base interface.
224
+ * You can add custom methods, computed properties, or override types/schemas here.
225
+ * This file will NOT be overwritten by the generator.
226
+ */
227
+
228
+ interface BranchCache extends BranchCache$1 {
229
+ }
230
+ declare const branchCacheSchemas: {
231
+ console_branch_id: z.ZodString;
232
+ console_org_id: z.ZodString;
233
+ code: z.ZodString;
234
+ name: z.ZodString;
235
+ is_headquarters: z.ZodBoolean;
236
+ is_active: z.ZodBoolean;
237
+ };
238
+ declare const branchCacheCreateSchema: z.ZodObject<{
239
+ console_branch_id: z.ZodString;
240
+ console_org_id: z.ZodString;
241
+ code: z.ZodString;
242
+ name: z.ZodString;
243
+ is_headquarters: z.ZodBoolean;
244
+ is_active: z.ZodBoolean;
245
+ }, z.core.$strip>;
246
+ declare const branchCacheUpdateSchema: z.ZodObject<{
247
+ console_branch_id: z.ZodOptional<z.ZodString>;
248
+ console_org_id: z.ZodOptional<z.ZodString>;
249
+ code: z.ZodOptional<z.ZodString>;
250
+ name: z.ZodOptional<z.ZodString>;
251
+ is_headquarters: z.ZodOptional<z.ZodBoolean>;
252
+ is_active: z.ZodOptional<z.ZodBoolean>;
253
+ }, z.core.$strip>;
254
+ type BranchCacheCreate = z.infer<typeof branchCacheCreateSchema>;
255
+ type BranchCacheUpdate = z.infer<typeof branchCacheUpdateSchema>;
256
+
257
+ /**
258
+ * ⚠️ DO NOT EDIT THIS FILE! ⚠️
259
+ * このファイルを編集しないでください!
260
+ * KHÔNG ĐƯỢC SỬA FILE NÀY!
261
+ *
262
+ * Auto-generated TypeScript types from Omnify schemas.
263
+ * Any manual changes will be OVERWRITTEN on next generation.
264
+ *
265
+ * To modify: Edit the schema YAML file and run: npx omnify generate
266
+ */
267
+
268
+ /**
269
+ * 組織キャッシュ
270
+ */
271
+ interface OrganizationCache$1 {
272
+ /** Primary key */
273
+ id: string;
274
+ /** Console Organization ID */
275
+ console_org_id: unknown;
276
+ /** 組織名 */
277
+ name: string;
278
+ /** 組織コード */
279
+ code: string;
280
+ /** 有効 */
281
+ is_active: boolean;
282
+ /** Creation timestamp */
283
+ created_at?: DateTimeString;
284
+ /** Last update timestamp */
285
+ updated_at?: DateTimeString;
286
+ /** Soft delete timestamp */
287
+ deleted_at?: DateTimeString;
288
+ }
289
+ /**
290
+ * Unified i18n object for OrganizationCache
291
+ * Contains model label and all field labels/placeholders
292
+ */
293
+ declare const organizationCacheI18n: {
294
+ /** Model display name */
295
+ readonly label: {
296
+ readonly ja: "組織キャッシュ";
297
+ readonly en: "Organization Cache";
298
+ };
299
+ /** Field labels and placeholders */
300
+ readonly fields: {
301
+ readonly console_org_id: {
302
+ readonly label: {
303
+ readonly ja: "Console Organization ID";
304
+ readonly en: "Console Organization ID";
305
+ };
306
+ };
307
+ readonly name: {
308
+ readonly label: {
309
+ readonly ja: "組織名";
310
+ readonly en: "Organization Name";
311
+ };
312
+ };
313
+ readonly code: {
314
+ readonly label: {
315
+ readonly ja: "組織コード";
316
+ readonly en: "Organization Code";
317
+ };
318
+ };
319
+ readonly is_active: {
320
+ readonly label: {
321
+ readonly ja: "有効";
322
+ readonly en: "Active";
323
+ };
324
+ };
325
+ };
326
+ };
327
+ /** Get model label for a specific locale */
328
+ declare function getOrganizationCacheLabel(locale: string): string;
329
+ /** Get field label for a specific locale */
330
+ declare function getOrganizationCacheFieldLabel(field: string, locale: string): string;
331
+ /** Get field placeholder for a specific locale */
332
+ declare function getOrganizationCacheFieldPlaceholder(field: string, locale: string): string;
333
+
334
+ /**
335
+ * OrganizationCache Model
336
+ *
337
+ * This file extends the auto-generated base interface.
338
+ * You can add custom methods, computed properties, or override types/schemas here.
339
+ * This file will NOT be overwritten by the generator.
340
+ */
341
+
342
+ interface OrganizationCache extends OrganizationCache$1 {
343
+ }
344
+ declare const organizationCacheSchemas: {
345
+ console_org_id: z.ZodString;
346
+ name: z.ZodString;
347
+ code: z.ZodString;
348
+ is_active: z.ZodBoolean;
349
+ };
350
+ declare const organizationCacheCreateSchema: z.ZodObject<{
351
+ console_org_id: z.ZodString;
352
+ name: z.ZodString;
353
+ code: z.ZodString;
354
+ is_active: z.ZodBoolean;
355
+ }, z.core.$strip>;
356
+ declare const organizationCacheUpdateSchema: z.ZodObject<{
357
+ console_org_id: z.ZodOptional<z.ZodString>;
358
+ name: z.ZodOptional<z.ZodString>;
359
+ code: z.ZodOptional<z.ZodString>;
360
+ is_active: z.ZodOptional<z.ZodBoolean>;
361
+ }, z.core.$strip>;
362
+ type OrganizationCacheCreate = z.infer<typeof organizationCacheCreateSchema>;
363
+ type OrganizationCacheUpdate = z.infer<typeof organizationCacheUpdateSchema>;
364
+
365
+ /**
366
+ * ⚠️ DO NOT EDIT THIS FILE! ⚠️
367
+ * このファイルを編集しないでください!
368
+ * KHÔNG ĐƯỢC SỬA FILE NÀY!
369
+ *
370
+ * Auto-generated TypeScript types from Omnify schemas.
371
+ * Any manual changes will be OVERWRITTEN on next generation.
372
+ *
373
+ * To modify: Edit the schema YAML file and run: npx omnify generate
374
+ */
375
+
376
+ /**
377
+ * ロール
378
+ */
379
+ interface Role$2 {
380
+ /** Primary key */
381
+ id: string;
382
+ /** 組織ID */
383
+ console_org_id?: string;
384
+ /** ロール名 */
385
+ name: string;
386
+ /** スラッグ */
387
+ slug: string;
388
+ /** 説明 */
389
+ description?: string;
390
+ /** レベル */
391
+ level: number;
392
+ /** 権限 */
393
+ permissions: Permission$2[];
394
+ /** Creation timestamp */
395
+ created_at?: DateTimeString;
396
+ /** Last update timestamp */
397
+ updated_at?: DateTimeString;
398
+ }
399
+ /**
400
+ * Unified i18n object for Role
401
+ * Contains model label and all field labels/placeholders
402
+ */
403
+ declare const roleI18n: {
404
+ /** Model display name */
405
+ readonly label: {
406
+ readonly ja: "ロール";
407
+ readonly en: "Role";
408
+ };
409
+ /** Field labels and placeholders */
410
+ readonly fields: {
411
+ readonly console_org_id: {
412
+ readonly label: {
413
+ readonly ja: "組織ID";
414
+ readonly en: "Organization ID";
415
+ };
416
+ };
417
+ readonly name: {
418
+ readonly label: {
419
+ readonly ja: "ロール名";
420
+ readonly en: "Role Name";
421
+ };
422
+ };
423
+ readonly slug: {
424
+ readonly label: {
425
+ readonly ja: "スラッグ";
426
+ readonly en: "Slug";
427
+ };
428
+ };
429
+ readonly description: {
430
+ readonly label: {
431
+ readonly ja: "説明";
432
+ readonly en: "Description";
433
+ };
434
+ };
435
+ readonly level: {
436
+ readonly label: {
437
+ readonly ja: "レベル";
438
+ readonly en: "Level";
439
+ };
440
+ };
441
+ readonly permissions: {
442
+ readonly label: {
443
+ readonly ja: "権限";
444
+ readonly en: "Permissions";
445
+ };
446
+ };
447
+ };
448
+ };
449
+ /** Get model label for a specific locale */
450
+ declare function getRoleLabel(locale: string): string;
451
+ /** Get field label for a specific locale */
452
+ declare function getRoleFieldLabel(field: string, locale: string): string;
453
+ /** Get field placeholder for a specific locale */
454
+ declare function getRoleFieldPlaceholder(field: string, locale: string): string;
455
+
456
+ /**
457
+ * ⚠️ DO NOT EDIT THIS FILE! ⚠️
458
+ * このファイルを編集しないでください!
459
+ * KHÔNG ĐƯỢC SỬA FILE NÀY!
460
+ *
461
+ * Auto-generated TypeScript types from Omnify schemas.
462
+ * Any manual changes will be OVERWRITTEN on next generation.
463
+ *
464
+ * To modify: Edit the schema YAML file and run: npx omnify generate
465
+ */
466
+
467
+ /**
468
+ * 権限
469
+ */
470
+ interface Permission$2 {
471
+ /** Primary key */
472
+ id: string;
473
+ /** 権限名 */
474
+ name: string;
475
+ /** スラッグ */
476
+ slug: string;
477
+ /** グループ */
478
+ group?: string;
479
+ /** ロール */
480
+ roles: Role$2[];
481
+ /** Creation timestamp */
482
+ created_at?: DateTimeString;
483
+ /** Last update timestamp */
484
+ updated_at?: DateTimeString;
485
+ }
486
+ /**
487
+ * Unified i18n object for Permission
488
+ * Contains model label and all field labels/placeholders
489
+ */
490
+ declare const permissionI18n: {
491
+ /** Model display name */
492
+ readonly label: {
493
+ readonly ja: "権限";
494
+ readonly en: "Permission";
495
+ };
496
+ /** Field labels and placeholders */
497
+ readonly fields: {
498
+ readonly name: {
499
+ readonly label: {
500
+ readonly ja: "権限名";
501
+ readonly en: "Permission Name";
502
+ };
503
+ };
504
+ readonly slug: {
505
+ readonly label: {
506
+ readonly ja: "スラッグ";
507
+ readonly en: "Slug";
508
+ };
509
+ };
510
+ readonly group: {
511
+ readonly label: {
512
+ readonly ja: "グループ";
513
+ readonly en: "Group";
514
+ };
515
+ };
516
+ readonly roles: {
517
+ readonly label: {
518
+ readonly ja: "ロール";
519
+ readonly en: "Roles";
520
+ };
521
+ };
522
+ };
523
+ };
524
+ /** Get model label for a specific locale */
525
+ declare function getPermissionLabel(locale: string): string;
526
+ /** Get field label for a specific locale */
527
+ declare function getPermissionFieldLabel(field: string, locale: string): string;
528
+ /** Get field placeholder for a specific locale */
529
+ declare function getPermissionFieldPlaceholder(field: string, locale: string): string;
530
+
531
+ /**
532
+ * Permission Model
533
+ *
534
+ * This file extends the auto-generated base interface.
535
+ * You can add custom methods, computed properties, or override types/schemas here.
536
+ * This file will NOT be overwritten by the generator.
537
+ */
538
+
539
+ interface Permission$1 extends Permission$2 {
540
+ }
541
+ declare const permissionSchemas: {
542
+ name: z.ZodString;
543
+ slug: z.ZodString;
544
+ group: z.ZodNullable<z.ZodOptional<z.ZodString>>;
545
+ };
546
+ declare const permissionCreateSchema: z.ZodObject<{
547
+ name: z.ZodString;
548
+ slug: z.ZodString;
549
+ group: z.ZodNullable<z.ZodOptional<z.ZodString>>;
550
+ }, z.core.$strip>;
551
+ declare const permissionUpdateSchema: z.ZodObject<{
552
+ name: z.ZodOptional<z.ZodString>;
553
+ slug: z.ZodOptional<z.ZodString>;
554
+ group: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
555
+ }, z.core.$strip>;
556
+ type PermissionCreate = z.infer<typeof permissionCreateSchema>;
557
+ type PermissionUpdate = z.infer<typeof permissionUpdateSchema>;
558
+
559
+ /**
560
+ * Role Model
561
+ *
562
+ * This file extends the auto-generated base interface.
563
+ * You can add custom methods, computed properties, or override types/schemas here.
564
+ * This file will NOT be overwritten by the generator.
565
+ */
566
+
567
+ interface Role$1 extends Role$2 {
568
+ }
569
+ declare const roleSchemas: {
570
+ console_org_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
571
+ name: z.ZodString;
572
+ slug: z.ZodString;
573
+ description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
574
+ level: z.ZodNumber;
575
+ };
576
+ declare const roleCreateSchema: z.ZodObject<{
577
+ console_org_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
578
+ name: z.ZodString;
579
+ slug: z.ZodString;
580
+ description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
581
+ level: z.ZodNumber;
582
+ }, z.core.$strip>;
583
+ declare const roleUpdateSchema: z.ZodObject<{
584
+ console_org_id: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
585
+ name: z.ZodOptional<z.ZodString>;
586
+ slug: z.ZodOptional<z.ZodString>;
587
+ description: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
588
+ level: z.ZodOptional<z.ZodNumber>;
589
+ }, z.core.$strip>;
590
+ type RoleCreate = z.infer<typeof roleCreateSchema>;
591
+ type RoleUpdate = z.infer<typeof roleUpdateSchema>;
592
+
593
+ /**
594
+ * ⚠️ DO NOT EDIT THIS FILE! ⚠️
595
+ * このファイルを編集しないでください!
596
+ * KHÔNG ĐƯỢC SỬA FILE NÀY!
597
+ *
598
+ * Auto-generated TypeScript types from Omnify schemas.
599
+ * Any manual changes will be OVERWRITTEN on next generation.
600
+ *
601
+ * To modify: Edit the schema YAML file and run: npx omnify generate
602
+ */
603
+
604
+ /**
605
+ * ロール権限
606
+ */
607
+ interface RolePermission$1 {
608
+ /** ロール */
609
+ role: Role$2;
610
+ /** 権限 */
611
+ permission: Permission$2;
612
+ /** Creation timestamp */
613
+ created_at?: DateTimeString;
614
+ /** Last update timestamp */
615
+ updated_at?: DateTimeString;
616
+ }
617
+ /**
618
+ * Unified i18n object for RolePermission
619
+ * Contains model label and all field labels/placeholders
620
+ */
621
+ declare const rolePermissionI18n: {
622
+ /** Model display name */
623
+ readonly label: {
624
+ readonly ja: "ロール権限";
625
+ readonly en: "Role Permission";
626
+ };
627
+ /** Field labels and placeholders */
628
+ readonly fields: {
629
+ readonly role: {
630
+ readonly label: {
631
+ readonly ja: "ロール";
632
+ readonly en: "Role";
633
+ };
634
+ };
635
+ readonly permission: {
636
+ readonly label: {
637
+ readonly ja: "権限";
638
+ readonly en: "Permission";
639
+ };
640
+ };
641
+ };
642
+ };
643
+ /** Get model label for a specific locale */
644
+ declare function getRolePermissionLabel(locale: string): string;
645
+ /** Get field label for a specific locale */
646
+ declare function getRolePermissionFieldLabel(field: string, locale: string): string;
647
+ /** Get field placeholder for a specific locale */
648
+ declare function getRolePermissionFieldPlaceholder(field: string, locale: string): string;
649
+
650
+ /**
651
+ * RolePermission Model
652
+ *
653
+ * This file extends the auto-generated base interface.
654
+ * You can add custom methods, computed properties, or override types/schemas here.
655
+ * This file will NOT be overwritten by the generator.
656
+ */
657
+
658
+ interface RolePermission extends RolePermission$1 {
659
+ }
660
+ declare const rolePermissionSchemas: {};
661
+ declare const rolePermissionCreateSchema: z.ZodObject<{}, z.core.$strip>;
662
+ declare const rolePermissionUpdateSchema: z.ZodObject<{}, z.core.$strip>;
663
+ type RolePermissionCreate = z.infer<typeof rolePermissionCreateSchema>;
664
+ type RolePermissionUpdate = z.infer<typeof rolePermissionUpdateSchema>;
665
+
666
+ /**
667
+ * ⚠️ DO NOT EDIT THIS FILE! ⚠️
668
+ * このファイルを編集しないでください!
669
+ * KHÔNG ĐƯỢC SỬA FILE NÀY!
670
+ *
671
+ * Auto-generated TypeScript types from Omnify schemas.
672
+ * Any manual changes will be OVERWRITTEN on next generation.
673
+ *
674
+ * To modify: Edit the schema YAML file and run: npx omnify generate
675
+ */
676
+
677
+ /**
678
+ * チームキャッシュ
679
+ */
680
+ interface TeamCache$1 {
681
+ /** Primary key */
682
+ id: string;
683
+ /** Console Team ID */
684
+ console_team_id: unknown;
685
+ /** Console Organization ID */
686
+ console_org_id: unknown;
687
+ /** チーム名 */
688
+ name: string;
689
+ /** Creation timestamp */
690
+ created_at?: DateTimeString;
691
+ /** Last update timestamp */
692
+ updated_at?: DateTimeString;
693
+ /** Soft delete timestamp */
694
+ deleted_at?: DateTimeString;
695
+ }
696
+ /**
697
+ * Unified i18n object for TeamCache
698
+ * Contains model label and all field labels/placeholders
699
+ */
700
+ declare const teamCacheI18n: {
701
+ /** Model display name */
702
+ readonly label: {
703
+ readonly ja: "チームキャッシュ";
704
+ readonly en: "Team Cache";
705
+ };
706
+ /** Field labels and placeholders */
707
+ readonly fields: {
708
+ readonly console_team_id: {
709
+ readonly label: {
710
+ readonly ja: "Console Team ID";
711
+ readonly en: "Console Team ID";
712
+ };
713
+ };
714
+ readonly console_org_id: {
715
+ readonly label: {
716
+ readonly ja: "Console Organization ID";
717
+ readonly en: "Console Organization ID";
718
+ };
719
+ };
720
+ readonly name: {
721
+ readonly label: {
722
+ readonly ja: "チーム名";
723
+ readonly en: "Team Name";
724
+ };
725
+ };
726
+ };
727
+ };
728
+ /** Get model label for a specific locale */
729
+ declare function getTeamCacheLabel(locale: string): string;
730
+ /** Get field label for a specific locale */
731
+ declare function getTeamCacheFieldLabel(field: string, locale: string): string;
732
+ /** Get field placeholder for a specific locale */
733
+ declare function getTeamCacheFieldPlaceholder(field: string, locale: string): string;
734
+
735
+ /**
736
+ * TeamCache Model
737
+ *
738
+ * This file extends the auto-generated base interface.
739
+ * You can add custom methods, computed properties, or override types/schemas here.
740
+ * This file will NOT be overwritten by the generator.
741
+ */
742
+
743
+ interface TeamCache extends TeamCache$1 {
744
+ }
745
+ declare const teamCacheSchemas: {
746
+ console_team_id: z.ZodString;
747
+ console_org_id: z.ZodString;
748
+ name: z.ZodString;
749
+ };
750
+ declare const teamCacheCreateSchema: z.ZodObject<{
751
+ console_team_id: z.ZodString;
752
+ console_org_id: z.ZodString;
753
+ name: z.ZodString;
754
+ }, z.core.$strip>;
755
+ declare const teamCacheUpdateSchema: z.ZodObject<{
756
+ console_team_id: z.ZodOptional<z.ZodString>;
757
+ console_org_id: z.ZodOptional<z.ZodString>;
758
+ name: z.ZodOptional<z.ZodString>;
759
+ }, z.core.$strip>;
760
+ type TeamCacheCreate = z.infer<typeof teamCacheCreateSchema>;
761
+ type TeamCacheUpdate = z.infer<typeof teamCacheUpdateSchema>;
762
+
763
+ /**
764
+ * ⚠️ DO NOT EDIT THIS FILE! ⚠️
765
+ * このファイルを編集しないでください!
766
+ * KHÔNG ĐƯỢC SỬA FILE NÀY!
767
+ *
768
+ * Auto-generated TypeScript types from Omnify schemas.
769
+ * Any manual changes will be OVERWRITTEN on next generation.
770
+ *
771
+ * To modify: Edit the schema YAML file and run: npx omnify generate
772
+ */
773
+
774
+ /**
775
+ * チーム権限
776
+ */
777
+ interface TeamPermission$1 {
778
+ /** Primary key */
779
+ id: string;
780
+ /** Console Organization ID */
781
+ console_org_id: unknown;
782
+ /** Console Team ID */
783
+ console_team_id: unknown;
784
+ /** 権限 */
785
+ permission: Permission$2;
786
+ /** Creation timestamp */
787
+ created_at?: DateTimeString;
788
+ /** Last update timestamp */
789
+ updated_at?: DateTimeString;
790
+ /** Soft delete timestamp */
791
+ deleted_at?: DateTimeString;
792
+ }
793
+ /**
794
+ * Unified i18n object for TeamPermission
795
+ * Contains model label and all field labels/placeholders
796
+ */
797
+ declare const teamPermissionI18n: {
798
+ /** Model display name */
799
+ readonly label: {
800
+ readonly ja: "チーム権限";
801
+ readonly en: "Team Permission";
802
+ };
803
+ /** Field labels and placeholders */
804
+ readonly fields: {
805
+ readonly console_org_id: {
806
+ readonly label: {
807
+ readonly ja: "Console Organization ID";
808
+ readonly en: "Console Organization ID";
809
+ };
810
+ };
811
+ readonly console_team_id: {
812
+ readonly label: {
813
+ readonly ja: "Console Team ID";
814
+ readonly en: "Console Team ID";
815
+ };
816
+ };
817
+ readonly permission: {
818
+ readonly label: {
819
+ readonly ja: "権限";
820
+ readonly en: "Permission";
821
+ };
822
+ };
823
+ };
824
+ };
825
+ /** Get model label for a specific locale */
826
+ declare function getTeamPermissionLabel(locale: string): string;
827
+ /** Get field label for a specific locale */
828
+ declare function getTeamPermissionFieldLabel(field: string, locale: string): string;
829
+ /** Get field placeholder for a specific locale */
830
+ declare function getTeamPermissionFieldPlaceholder(field: string, locale: string): string;
831
+
832
+ /**
833
+ * TeamPermission Model
834
+ *
835
+ * This file extends the auto-generated base interface.
836
+ * You can add custom methods, computed properties, or override types/schemas here.
837
+ * This file will NOT be overwritten by the generator.
838
+ */
839
+
840
+ interface TeamPermission extends TeamPermission$1 {
841
+ }
842
+ declare const teamPermissionSchemas: {
843
+ console_org_id: z.ZodString;
844
+ console_team_id: z.ZodString;
845
+ };
846
+ declare const teamPermissionCreateSchema: z.ZodObject<{
847
+ console_org_id: z.ZodString;
848
+ console_team_id: z.ZodString;
849
+ }, z.core.$strip>;
850
+ declare const teamPermissionUpdateSchema: z.ZodObject<{
851
+ console_org_id: z.ZodOptional<z.ZodString>;
852
+ console_team_id: z.ZodOptional<z.ZodString>;
853
+ }, z.core.$strip>;
854
+ type TeamPermissionCreate = z.infer<typeof teamPermissionCreateSchema>;
855
+ type TeamPermissionUpdate = z.infer<typeof teamPermissionUpdateSchema>;
856
+
857
+ /**
858
+ * ⚠️ DO NOT EDIT THIS FILE! ⚠️
859
+ * このファイルを編集しないでください!
860
+ * KHÔNG ĐƯỢC SỬA FILE NÀY!
861
+ *
862
+ * Auto-generated TypeScript types from Omnify schemas.
863
+ * Any manual changes will be OVERWRITTEN on next generation.
864
+ *
865
+ * To modify: Edit the schema YAML file and run: npx omnify generate
866
+ */
867
+
868
+ /**
869
+ * ユーザーキャッシュ
870
+ */
871
+ interface UserCache$1 {
872
+ /** Primary key */
873
+ id: string;
874
+ /** 名前 */
875
+ name: string;
876
+ /** メールアドレス */
877
+ email: string;
878
+ /** Console User ID */
879
+ console_user_id?: unknown;
880
+ /** 所属組織ID */
881
+ console_org_id?: unknown;
882
+ /** Console Access Token */
883
+ console_access_token?: string;
884
+ /** Console Refresh Token */
885
+ console_refresh_token?: string;
886
+ /** Console Token有効期限 */
887
+ console_token_expires_at?: DateTimeString;
888
+ /** ロール */
889
+ roles: Role$2[];
890
+ /** Creation timestamp */
891
+ created_at?: DateTimeString;
892
+ /** Last update timestamp */
893
+ updated_at?: DateTimeString;
894
+ }
895
+ /**
896
+ * Unified i18n object for UserCache
897
+ * Contains model label and all field labels/placeholders
898
+ */
899
+ declare const userCacheI18n: {
900
+ /** Model display name */
901
+ readonly label: {
902
+ readonly ja: "ユーザーキャッシュ";
903
+ readonly en: "User Cache";
904
+ };
905
+ /** Field labels and placeholders */
906
+ readonly fields: {
907
+ readonly name: {
908
+ readonly label: {
909
+ readonly ja: "名前";
910
+ readonly en: "Name";
911
+ };
912
+ };
913
+ readonly email: {
914
+ readonly label: {
915
+ readonly ja: "メールアドレス";
916
+ readonly en: "Email";
917
+ };
918
+ };
919
+ readonly console_user_id: {
920
+ readonly label: {
921
+ readonly ja: "Console User ID";
922
+ readonly en: "Console User ID";
923
+ };
924
+ };
925
+ readonly console_org_id: {
926
+ readonly label: {
927
+ readonly ja: "所属組織ID";
928
+ readonly en: "Organization ID";
929
+ };
930
+ };
931
+ readonly console_access_token: {
932
+ readonly label: {
933
+ readonly ja: "Console Access Token";
934
+ readonly en: "Console Access Token";
935
+ };
936
+ };
937
+ readonly console_refresh_token: {
938
+ readonly label: {
939
+ readonly ja: "Console Refresh Token";
940
+ readonly en: "Console Refresh Token";
941
+ };
942
+ };
943
+ readonly console_token_expires_at: {
944
+ readonly label: {
945
+ readonly ja: "Console Token有効期限";
946
+ readonly en: "Console Token Expiry";
947
+ };
948
+ };
949
+ readonly roles: {
950
+ readonly label: {
951
+ readonly ja: "ロール";
952
+ readonly en: "Roles";
953
+ };
954
+ };
955
+ };
956
+ };
957
+ /** Get model label for a specific locale */
958
+ declare function getUserCacheLabel(locale: string): string;
959
+ /** Get field label for a specific locale */
960
+ declare function getUserCacheFieldLabel(field: string, locale: string): string;
961
+ /** Get field placeholder for a specific locale */
962
+ declare function getUserCacheFieldPlaceholder(field: string, locale: string): string;
963
+
964
+ /**
965
+ * UserCache Model
966
+ *
967
+ * This file extends the auto-generated base interface.
968
+ * You can add custom methods, computed properties, or override types/schemas here.
969
+ * This file will NOT be overwritten by the generator.
970
+ */
971
+
972
+ interface UserCache extends UserCache$1 {
973
+ }
974
+ declare const userCacheSchemas: {
975
+ name: z.ZodString;
976
+ email: z.ZodString;
977
+ console_user_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
978
+ console_org_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
979
+ console_access_token: z.ZodNullable<z.ZodOptional<z.ZodString>>;
980
+ console_refresh_token: z.ZodNullable<z.ZodOptional<z.ZodString>>;
981
+ console_token_expires_at: z.ZodNullable<z.ZodOptional<z.ZodString>>;
982
+ };
983
+ declare const userCacheCreateSchema: z.ZodObject<{
984
+ name: z.ZodString;
985
+ email: z.ZodString;
986
+ console_user_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
987
+ console_org_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
988
+ console_access_token: z.ZodNullable<z.ZodOptional<z.ZodString>>;
989
+ console_refresh_token: z.ZodNullable<z.ZodOptional<z.ZodString>>;
990
+ console_token_expires_at: z.ZodNullable<z.ZodOptional<z.ZodString>>;
991
+ }, z.core.$strip>;
992
+ declare const userCacheUpdateSchema: z.ZodObject<{
993
+ name: z.ZodOptional<z.ZodString>;
994
+ email: z.ZodOptional<z.ZodString>;
995
+ console_user_id: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
996
+ console_org_id: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
997
+ console_access_token: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
998
+ console_refresh_token: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
999
+ console_token_expires_at: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
1000
+ }, z.core.$strip>;
1001
+ type UserCacheCreate = z.infer<typeof userCacheCreateSchema>;
1002
+ type UserCacheUpdate = z.infer<typeof userCacheUpdateSchema>;
1003
+
1004
+ /**
1005
+ * SSO Context
1006
+ */
1007
+ declare const SsoContext: react.Context<SsoContextValue | null>;
1008
+ /**
1009
+ * Hook to access SSO context
1010
+ * @throws Error if used outside SsoProvider
1011
+ */
1012
+ declare function useSsoContext(): SsoContextValue;
1013
+
1014
+ /**
1015
+ * SSO Provider component
1016
+ */
1017
+ declare function SsoProvider({ children, config, onAuthChange }: SsoProviderProps): react_jsx_runtime.JSX.Element;
1018
+
1019
+ /**
1020
+ * Branch Context
1021
+ *
1022
+ * Provides branch state management across the application.
1023
+ * Must be used within a BranchProvider.
1024
+ */
1025
+ declare const BranchContext: react.Context<BranchContextValue | null>;
1026
+ /**
1027
+ * Hook to access Branch context
1028
+ * @throws Error if used outside BranchProvider
1029
+ */
1030
+ declare function useBranchContext(): BranchContextValue;
1031
+
1032
+ /**
1033
+ * BranchProvider component
1034
+ *
1035
+ * Provides branch state management for the application.
1036
+ * Automatically fetches branches when organization changes.
1037
+ *
1038
+ * @example
1039
+ * ```tsx
1040
+ * // In your app
1041
+ * <SsoProvider config={ssoConfig}>
1042
+ * <BranchProvider>
1043
+ * <App />
1044
+ * </BranchProvider>
1045
+ * </SsoProvider>
1046
+ *
1047
+ * // In a component
1048
+ * function MyComponent() {
1049
+ * const { branches, currentBranch, switchBranch } = useBranch();
1050
+ * // ...
1051
+ * }
1052
+ * ```
1053
+ */
1054
+ declare function BranchProvider({ children, storage, storageKey, onBranchChange, }: BranchProviderProps): react_jsx_runtime.JSX.Element;
1055
+
1056
+ /**
1057
+ * Hook for authentication actions and state
1058
+ */
1059
+ interface UseAuthReturn {
1060
+ /** Current user or null */
1061
+ user: SsoUser$2 | null;
1062
+ /** Whether auth is being loaded */
1063
+ isLoading: boolean;
1064
+ /** Whether user is authenticated */
1065
+ isAuthenticated: boolean;
1066
+ /** Redirect to login */
1067
+ login: (redirectTo?: string) => void;
1068
+ /** Logout from service only */
1069
+ logout: () => Promise<void>;
1070
+ /** Logout from service and Console */
1071
+ globalLogout: (redirectTo?: string) => void;
1072
+ /** Refresh user data */
1073
+ refreshUser: () => Promise<void>;
1074
+ }
1075
+ /**
1076
+ * Hook for authentication
1077
+ *
1078
+ * @example
1079
+ * ```tsx
1080
+ * function LoginButton() {
1081
+ * const { isAuthenticated, login, logout, user } = useAuth();
1082
+ *
1083
+ * if (isAuthenticated) {
1084
+ * return (
1085
+ * <div>
1086
+ * <span>Hello, {user?.name}</span>
1087
+ * <button onClick={() => logout()}>Logout</button>
1088
+ * </div>
1089
+ * );
1090
+ * }
1091
+ *
1092
+ * return <button onClick={() => login()}>Login</button>;
1093
+ * }
1094
+ * ```
1095
+ */
1096
+ declare function useAuth(): UseAuthReturn;
1097
+
1098
+ /**
1099
+ * Hook return type for organization management
1100
+ */
1101
+ interface UseOrganizationReturn {
1102
+ /** List of organizations user has access to */
1103
+ organizations: SsoOrganization[];
1104
+ /** Currently selected organization */
1105
+ currentOrg: SsoOrganization | null;
1106
+ /** Whether user has multiple organizations */
1107
+ hasMultipleOrgs: boolean;
1108
+ /** Switch to a different organization */
1109
+ switchOrg: (orgId: string) => void;
1110
+ /** Get current org's role */
1111
+ currentRole: string | null;
1112
+ /** Check if user has at least the given role in current org */
1113
+ hasRole: (role: string) => boolean;
1114
+ }
1115
+ /**
1116
+ * Hook for organization management
1117
+ *
1118
+ * @example
1119
+ * ```tsx
1120
+ * function OrgInfo() {
1121
+ * const { currentOrg, organizations, switchOrg, hasRole } = useOrganization();
1122
+ *
1123
+ * return (
1124
+ * <div>
1125
+ * <p>Current: {currentOrg?.name}</p>
1126
+ * {hasRole('admin') && <AdminPanel />}
1127
+ * <select onChange={(e) => switchOrg(e.target.value)}>
1128
+ * {organizations.map((org) => (
1129
+ * <option key={org.slug} value={org.slug}>{org.name}</option>
1130
+ * ))}
1131
+ * </select>
1132
+ * </div>
1133
+ * );
1134
+ * }
1135
+ * ```
1136
+ */
1137
+ declare function useOrganization(): UseOrganizationReturn;
1138
+
1139
+ /**
1140
+ * Combined SSO hook return type
1141
+ */
1142
+ interface UseSsoReturn {
1143
+ user: SsoUser$2 | null;
1144
+ isLoading: boolean;
1145
+ isAuthenticated: boolean;
1146
+ login: (redirectTo?: string) => void;
1147
+ logout: () => Promise<void>;
1148
+ globalLogout: (redirectTo?: string) => void;
1149
+ refreshUser: () => Promise<void>;
1150
+ organizations: SsoOrganization[];
1151
+ currentOrg: SsoOrganization | null;
1152
+ hasMultipleOrgs: boolean;
1153
+ switchOrg: (orgId: string) => void;
1154
+ getHeaders: () => Record<string, string>;
1155
+ config: SsoConfig;
1156
+ }
1157
+ /**
1158
+ * Combined hook for all SSO functionality
1159
+ *
1160
+ * @example
1161
+ * ```tsx
1162
+ * function MyComponent() {
1163
+ * const {
1164
+ * user,
1165
+ * isAuthenticated,
1166
+ * currentOrg,
1167
+ * getHeaders,
1168
+ * login,
1169
+ * logout,
1170
+ * } = useSso();
1171
+ *
1172
+ * const fetchData = async () => {
1173
+ * const response = await fetch('/api/data', {
1174
+ * headers: getHeaders(),
1175
+ * });
1176
+ * // ...
1177
+ * };
1178
+ *
1179
+ * if (!isAuthenticated) {
1180
+ * return <button onClick={() => login()}>Login</button>;
1181
+ * }
1182
+ *
1183
+ * return (
1184
+ * <div>
1185
+ * <p>Welcome, {user?.name}</p>
1186
+ * <p>Organization: {currentOrg?.name}</p>
1187
+ * <button onClick={() => logout()}>Logout</button>
1188
+ * </div>
1189
+ * );
1190
+ * }
1191
+ * ```
1192
+ */
1193
+ declare function useSso(): UseSsoReturn;
1194
+
1195
+ /**
1196
+ * Hook return type for branch management
1197
+ */
1198
+ type UseBranchReturn = BranchContextValue;
1199
+ /**
1200
+ * Hook for branch management
1201
+ *
1202
+ * Provides access to branch state and operations.
1203
+ * Must be used within a BranchProvider.
1204
+ *
1205
+ * @example
1206
+ * ```tsx
1207
+ * function BranchInfo() {
1208
+ * const {
1209
+ * branches,
1210
+ * currentBranch,
1211
+ * hasMultipleBranches,
1212
+ * switchBranch
1213
+ * } = useBranch();
1214
+ *
1215
+ * // Auto-selection logic is handled by the provider
1216
+ * // - If only 1 branch: auto-selected
1217
+ * // - If multiple: use saved preference or primary branch
1218
+ *
1219
+ * return (
1220
+ * <div>
1221
+ * <p>Current: {currentBranch?.name}</p>
1222
+ * {hasMultipleBranches && (
1223
+ * <select onChange={(e) => switchBranch(Number(e.target.value))}>
1224
+ * {branches.map((branch) => (
1225
+ * <option key={branch.id} value={branch.id}>
1226
+ * {branch.name}
1227
+ * </option>
1228
+ * ))}
1229
+ * </select>
1230
+ * )}
1231
+ * </div>
1232
+ * );
1233
+ * }
1234
+ * ```
1235
+ */
1236
+ declare function useBranch(): UseBranchReturn;
1237
+
1238
+ /**
1239
+ * Permission Service - Permission Management
1240
+ *
1241
+ * CRUD operations for permissions and permission matrix
1242
+ */
1243
+
1244
+ interface PermissionMatrix$1 {
1245
+ roles: Pick<Role$3, "id" | "slug" | "name">[];
1246
+ permissions: Record<string, Pick<Permission$3, "id" | "slug" | "name">[]>;
1247
+ matrix: Record<string, string[]>;
1248
+ }
1249
+ interface CreatePermissionInput$1 {
1250
+ slug: string;
1251
+ name: string;
1252
+ group?: string;
1253
+ description?: string;
1254
+ }
1255
+ interface UpdatePermissionInput$1 {
1256
+ name?: string;
1257
+ group?: string | null;
1258
+ description?: string | null;
1259
+ }
1260
+ interface PermissionListParams {
1261
+ group?: string;
1262
+ search?: string;
1263
+ grouped?: boolean;
1264
+ }
1265
+ declare function createPermissionService(config: ServiceConfig): {
1266
+ /**
1267
+ * Get all permissions
1268
+ * GET /api/sso/permissions
1269
+ */
1270
+ list: (params?: PermissionListParams) => Promise<{
1271
+ data: Permission$3[];
1272
+ groups: string[];
1273
+ }>;
1274
+ /**
1275
+ * Get permission matrix (roles x permissions)
1276
+ * GET /api/sso/permission-matrix
1277
+ */
1278
+ getMatrix: () => Promise<PermissionMatrix$1>;
1279
+ /**
1280
+ * List all permissions (admin)
1281
+ * GET /api/admin/sso/permissions
1282
+ */
1283
+ adminList: (orgId: string, params?: PermissionListParams) => Promise<{
1284
+ data: Permission$3[];
1285
+ groups: string[];
1286
+ }>;
1287
+ /**
1288
+ * Get single permission (admin)
1289
+ * GET /api/admin/sso/permissions/{id}
1290
+ */
1291
+ adminGet: (id: number | string, orgId: string) => Promise<{
1292
+ data: Permission$3;
1293
+ }>;
1294
+ /**
1295
+ * Create permission (admin only)
1296
+ * POST /api/admin/sso/permissions
1297
+ */
1298
+ create: (input: CreatePermissionInput$1, orgId: string) => Promise<{
1299
+ data: Permission$3;
1300
+ message: string;
1301
+ }>;
1302
+ /**
1303
+ * Update permission (admin only)
1304
+ * PUT /api/admin/sso/permissions/{id}
1305
+ */
1306
+ update: (id: number | string, input: UpdatePermissionInput$1, orgId: string) => Promise<{
1307
+ data: Permission$3;
1308
+ message: string;
1309
+ }>;
1310
+ /**
1311
+ * Delete permission (admin only)
1312
+ * DELETE /api/admin/sso/permissions/{id}
1313
+ */
1314
+ delete: (id: number | string, orgId: string) => Promise<void>;
1315
+ /**
1316
+ * Get permission matrix (admin)
1317
+ * GET /api/admin/sso/permission-matrix
1318
+ */
1319
+ adminGetMatrix: (orgId: string) => Promise<PermissionMatrix$1>;
1320
+ };
1321
+ type PermissionService = ReturnType<typeof createPermissionService>;
1322
+
1323
+ /**
1324
+ * Branch header utilities for API clients
1325
+ *
1326
+ * These utilities help set branch context headers on axios instances.
1327
+ * Works with BranchGate's onSelectionChange callback.
1328
+ *
1329
+ * @example
1330
+ * ```typescript
1331
+ * import { createBranchHeaderSetter } from '@famgia/omnify-react-sso';
1332
+ * import api from './api'; // your axios instance
1333
+ *
1334
+ * // Create setter for your axios instance
1335
+ * const setBranchHeaders = createBranchHeaderSetter(api);
1336
+ *
1337
+ * // Use in BranchGate
1338
+ * <BranchGate onSelectionChange={setBranchHeaders}>
1339
+ * <App />
1340
+ * </BranchGate>
1341
+ * ```
1342
+ */
1343
+
1344
+ /**
1345
+ * Headers set by branch selection
1346
+ */
1347
+ declare const BRANCH_HEADERS: {
1348
+ readonly BRANCH_ID: "X-Branch-Id";
1349
+ readonly ORG_ID: "X-Organization-Id";
1350
+ };
1351
+ /**
1352
+ * Minimal axios-like interface for header management
1353
+ */
1354
+ interface AxiosLike {
1355
+ defaults: {
1356
+ headers: {
1357
+ common: Record<string, string | undefined>;
1358
+ };
1359
+ };
1360
+ }
1361
+ /**
1362
+ * Create a branch header setter function for an axios instance
1363
+ *
1364
+ * @param axiosInstance - Your axios instance
1365
+ * @returns A function to pass to BranchGate's onSelectionChange
1366
+ *
1367
+ * @example
1368
+ * ```typescript
1369
+ * const setBranchHeaders = createBranchHeaderSetter(api);
1370
+ *
1371
+ * <BranchGate onSelectionChange={setBranchHeaders}>
1372
+ * <App />
1373
+ * </BranchGate>
1374
+ * ```
1375
+ */
1376
+ declare function createBranchHeaderSetter(axiosInstance: AxiosLike): (selection: BranchGateSelection | null) => void;
1377
+ /**
1378
+ * Set branch headers directly on an axios instance
1379
+ *
1380
+ * @example
1381
+ * ```typescript
1382
+ * import api from './api';
1383
+ * import { setBranchHeaders } from '@famgia/omnify-react-sso';
1384
+ *
1385
+ * // In BranchGate onSelectionChange
1386
+ * <BranchGate onSelectionChange={(s) => setBranchHeaders(api, s)}>
1387
+ * <App />
1388
+ * </BranchGate>
1389
+ * ```
1390
+ */
1391
+ declare function setBranchHeaders(axiosInstance: AxiosLike, selection: BranchGateSelection | null): void;
1392
+
1393
+ /**
1394
+ * Auth Service - SSO Authentication
1395
+ *
1396
+ * Handles SSO callback, logout, user info
1397
+ */
1398
+
1399
+ interface SsoUser$1 {
1400
+ id: number;
1401
+ console_user_id: number;
1402
+ email: string;
1403
+ name: string;
1404
+ }
1405
+ interface Organization$1 {
1406
+ id: number;
1407
+ slug: string;
1408
+ name: string;
1409
+ role: string;
1410
+ }
1411
+ interface AuthCallbackInput {
1412
+ code: string;
1413
+ device_name?: string;
1414
+ }
1415
+ interface AuthCallbackResponse {
1416
+ user: SsoUser$1;
1417
+ organizations: Organization$1[];
1418
+ token?: string;
1419
+ }
1420
+ interface AuthUserResponse {
1421
+ user: SsoUser$1;
1422
+ organizations: Organization$1[];
1423
+ }
1424
+ declare function createAuthService(config: ServiceConfig): {
1425
+ /**
1426
+ * Exchange SSO authorization code for tokens
1427
+ * POST /api/sso/callback
1428
+ */
1429
+ callback: (input: AuthCallbackInput) => Promise<AuthCallbackResponse>;
1430
+ /**
1431
+ * Logout current user and revoke tokens
1432
+ * POST /api/sso/logout
1433
+ */
1434
+ logout: () => Promise<{
1435
+ message: string;
1436
+ }>;
1437
+ /**
1438
+ * Get current authenticated user with organizations
1439
+ * GET /api/sso/user
1440
+ */
1441
+ getUser: () => Promise<AuthUserResponse>;
1442
+ /**
1443
+ * Get Console SSO global logout URL
1444
+ * GET /api/sso/global-logout-url
1445
+ */
1446
+ getGlobalLogoutUrl: (redirectUri?: string) => Promise<{
1447
+ logout_url: string;
1448
+ }>;
1449
+ };
1450
+ type AuthService = ReturnType<typeof createAuthService>;
1451
+
1452
+ /**
1453
+ * Token Service - API Token Management
1454
+ *
1455
+ * For mobile apps using bearer tokens
1456
+ */
1457
+
1458
+ interface ApiToken$1 {
1459
+ id: number;
1460
+ name: string;
1461
+ last_used_at: string | null;
1462
+ created_at: string;
1463
+ is_current: boolean;
1464
+ }
1465
+ declare function createTokenService(config: ServiceConfig): {
1466
+ /**
1467
+ * List all API tokens for current user
1468
+ * GET /api/sso/tokens
1469
+ */
1470
+ list: () => Promise<{
1471
+ tokens: ApiToken$1[];
1472
+ }>;
1473
+ /**
1474
+ * Revoke a specific token
1475
+ * DELETE /api/sso/tokens/{tokenId}
1476
+ */
1477
+ revoke: (tokenId: number) => Promise<{
1478
+ message: string;
1479
+ }>;
1480
+ /**
1481
+ * Revoke all tokens except current
1482
+ * POST /api/sso/tokens/revoke-others
1483
+ */
1484
+ revokeOthers: () => Promise<{
1485
+ message: string;
1486
+ revoked_count: number;
1487
+ }>;
1488
+ };
1489
+ type TokenService = ReturnType<typeof createTokenService>;
1490
+
1491
+ /**
1492
+ * Team Service - Team Permission Management
1493
+ *
1494
+ * Manage team permissions and orphaned team cleanup
1495
+ */
1496
+
1497
+ interface TeamWithPermissions$1 {
1498
+ console_team_id: number;
1499
+ name: string;
1500
+ path: string | null;
1501
+ permissions: Pick<Permission$3, "id" | "slug">[];
1502
+ }
1503
+ interface TeamPermissionDetail$1 {
1504
+ console_team_id: number;
1505
+ permissions: Pick<Permission$3, "id" | "slug" | "name">[];
1506
+ }
1507
+ interface OrphanedTeam$1 {
1508
+ console_team_id: number;
1509
+ permissions_count: number;
1510
+ permissions: string[];
1511
+ deleted_at: string | null;
1512
+ }
1513
+ interface SyncTeamPermissionsInput {
1514
+ permissions: (number | string)[];
1515
+ }
1516
+ interface CleanupOrphanedInput$1 {
1517
+ console_team_id?: number;
1518
+ older_than_days?: number;
1519
+ }
1520
+ declare function createTeamService(config: ServiceConfig): {
1521
+ /**
1522
+ * Get all teams with their permissions (admin only)
1523
+ * GET /api/admin/sso/teams/permissions
1524
+ */
1525
+ list: (orgId: string) => Promise<{
1526
+ teams: TeamWithPermissions$1[];
1527
+ }>;
1528
+ /**
1529
+ * Get specific team permissions (admin only)
1530
+ * GET /api/admin/sso/teams/{teamId}/permissions
1531
+ */
1532
+ getPermissions: (teamId: number, orgId: string) => Promise<TeamPermissionDetail$1>;
1533
+ /**
1534
+ * Sync team permissions (admin only)
1535
+ * PUT /api/admin/sso/teams/{teamId}/permissions
1536
+ */
1537
+ syncPermissions: (teamId: number, input: SyncTeamPermissionsInput, orgId: string) => Promise<{
1538
+ message: string;
1539
+ console_team_id: number;
1540
+ attached: number;
1541
+ detached: number;
1542
+ }>;
1543
+ /**
1544
+ * Remove all permissions for a team (admin only)
1545
+ * DELETE /api/admin/sso/teams/{teamId}/permissions
1546
+ */
1547
+ removePermissions: (teamId: number, orgId: string) => Promise<void>;
1548
+ /**
1549
+ * List orphaned team permissions (admin only)
1550
+ * GET /api/admin/sso/teams/orphaned
1551
+ */
1552
+ listOrphaned: (orgId: string) => Promise<{
1553
+ orphaned_teams: OrphanedTeam$1[];
1554
+ total_orphaned_permissions: number;
1555
+ }>;
1556
+ /**
1557
+ * Restore orphaned team permissions (admin only)
1558
+ * POST /api/admin/sso/teams/orphaned/{teamId}/restore
1559
+ */
1560
+ restoreOrphaned: (teamId: number, orgId: string) => Promise<{
1561
+ message: string;
1562
+ console_team_id: number;
1563
+ restored_count: number;
1564
+ }>;
1565
+ /**
1566
+ * Cleanup orphaned team permissions (admin only)
1567
+ * DELETE /api/admin/sso/teams/orphaned
1568
+ */
1569
+ cleanupOrphaned: (orgId: string, input?: CleanupOrphanedInput$1) => Promise<{
1570
+ message: string;
1571
+ deleted_count: number;
1572
+ }>;
1573
+ };
1574
+ type TeamService = ReturnType<typeof createTeamService>;
1575
+
1576
+ /**
1577
+ * User Role Service - Scoped Role Assignments
1578
+ *
1579
+ * Implements Branch-Level Permissions management:
1580
+ * - Global: org_id=null, branch_id=null → Role applies everywhere
1581
+ * - Org-wide: org_id=X, branch_id=null → Role applies to all branches in org
1582
+ * - Branch: org_id=X, branch_id=Y → Role applies only to specific branch
1583
+ */
1584
+
1585
+ type RoleScope = "global" | "org-wide" | "branch";
1586
+ interface RoleAssignment {
1587
+ id: string | null;
1588
+ role: {
1589
+ id: string;
1590
+ name: string;
1591
+ slug: string;
1592
+ level: number;
1593
+ };
1594
+ console_org_id: string | null;
1595
+ console_branch_id: string | null;
1596
+ scope: RoleScope;
1597
+ created_at: string | null;
1598
+ }
1599
+ interface AssignRoleInput {
1600
+ role_id: string;
1601
+ console_org_id?: string | null;
1602
+ console_branch_id?: string | null;
1603
+ }
1604
+ interface AssignRoleResponse {
1605
+ message: string;
1606
+ data: {
1607
+ role: {
1608
+ id: string;
1609
+ name: string;
1610
+ slug: string;
1611
+ level: number;
1612
+ };
1613
+ console_org_id: string | null;
1614
+ console_branch_id: string | null;
1615
+ scope: RoleScope;
1616
+ };
1617
+ }
1618
+ interface SyncRolesInput {
1619
+ roles: string[];
1620
+ console_org_id?: string | null;
1621
+ console_branch_id?: string | null;
1622
+ }
1623
+ interface SyncRolesResponse {
1624
+ message: string;
1625
+ attached: string[];
1626
+ detached: string[];
1627
+ scope: RoleScope;
1628
+ }
1629
+ interface RemoveRoleResponse {
1630
+ message: string;
1631
+ removed: number;
1632
+ }
1633
+ declare function createUserRoleService(config: ServiceConfig): {
1634
+ /**
1635
+ * List user's role assignments with scope information
1636
+ * GET /api/admin/sso/users/{userId}/roles
1637
+ */
1638
+ list: (userId: string, orgId?: string) => Promise<RoleAssignment[]>;
1639
+ /**
1640
+ * List user's role assignments filtered by branch context
1641
+ * Returns roles applicable to the given org/branch
1642
+ */
1643
+ listByBranch: (userId: string, consoleOrgId: string, branchId: string | null, orgId?: string) => Promise<RoleAssignment[]>;
1644
+ /**
1645
+ * Assign a role to user with scope
1646
+ * POST /api/admin/sso/users/{userId}/roles
1647
+ */
1648
+ assign: (userId: string, input: AssignRoleInput, orgId?: string) => Promise<AssignRoleResponse>;
1649
+ /**
1650
+ * Remove a role assignment from user
1651
+ * DELETE /api/admin/sso/users/{userId}/roles/{roleId}
1652
+ */
1653
+ remove: (userId: string, roleId: string, consoleOrgId?: string | null, branchId?: string | null, orgId?: string) => Promise<RemoveRoleResponse>;
1654
+ /**
1655
+ * Sync roles for user in a specific scope
1656
+ * PUT /api/admin/sso/users/{userId}/roles/sync
1657
+ */
1658
+ sync: (userId: string, input: SyncRolesInput, orgId?: string) => Promise<SyncRolesResponse>;
1659
+ };
1660
+ type UserRoleService = ReturnType<typeof createUserRoleService>;
1661
+ /**
1662
+ * Get scope label for display
1663
+ */
1664
+ declare const getScopeLabel: (scope: RoleScope, locale?: "en" | "ja" | "vi") => string;
1665
+ /**
1666
+ * Get effective permissions for a user at a specific branch
1667
+ * based on their role assignments
1668
+ */
1669
+ declare const getEffectivePermissions: <TRole extends {
1670
+ id: string;
1671
+ permissions?: Array<string | {
1672
+ slug: string;
1673
+ }>;
1674
+ }>(roleAssignments: RoleAssignment[], allRoles: TRole[], orgId: string, branchId: string | null) => string[];
1675
+
1676
+ /**
1677
+ * Branch Service - Branch Management
1678
+ *
1679
+ * Provides methods to fetch branches for the current user/organization
1680
+ */
1681
+
1682
+ /**
1683
+ * Branch from SSO API - extends BranchCache with SSO-specific fields
1684
+ */
1685
+ interface Branch extends Omit<BranchCache$1, 'id' | 'console_branch_id' | 'console_org_id' | 'is_active' | 'created_at' | 'updated_at' | 'deleted_at'> {
1686
+ /** SSO Branch ID (number from API) */
1687
+ id: number;
1688
+ /** Is user's primary branch */
1689
+ is_primary: boolean;
1690
+ /** Is branch assigned to user */
1691
+ is_assigned: boolean;
1692
+ /** Access type */
1693
+ access_type: "explicit" | "implicit";
1694
+ /** Timezone */
1695
+ timezone: string | null;
1696
+ /** Currency */
1697
+ currency: string | null;
1698
+ /** Locale */
1699
+ locale: string | null;
1700
+ }
1701
+ interface BranchesResponse {
1702
+ all_branches_access: boolean;
1703
+ branches: Branch[];
1704
+ primary_branch_id: number | null;
1705
+ organization: {
1706
+ id: number;
1707
+ slug: string;
1708
+ name: string;
1709
+ };
1710
+ }
1711
+ declare function createBranchService(config: ServiceConfig): {
1712
+ /**
1713
+ * Get branches for current user in organization
1714
+ * GET /api/sso/branches
1715
+ * @param orgId - Organization ID or slug (sent via X-Organization-Id header)
1716
+ */
1717
+ list: (orgId?: string) => Promise<BranchesResponse>;
1718
+ /**
1719
+ * Get a specific branch by ID
1720
+ * GET /api/sso/branches/{id}
1721
+ */
1722
+ get: (branchId: number) => Promise<Branch>;
1723
+ /**
1724
+ * Get headquarters branch for organization
1725
+ * @param orgId - Organization ID or slug (sent via X-Organization-Id header)
1726
+ */
1727
+ getHeadquarters: (orgId?: string) => Promise<Branch | null>;
1728
+ /**
1729
+ * Get primary branch for current user
1730
+ * @param orgId - Organization ID or slug (sent via X-Organization-Id header)
1731
+ */
1732
+ getPrimary: (orgId?: string) => Promise<Branch | null>;
1733
+ };
1734
+ type BranchService = ReturnType<typeof createBranchService>;
1735
+
1736
+ /**
1737
+ * SSO Service - API client for SSO endpoints
1738
+ *
1739
+ * Provides methods for SSO authentication, tokens, roles, permissions, teams
1740
+ */
1741
+ interface SsoUser {
1742
+ id: number;
1743
+ console_user_id: number;
1744
+ email: string;
1745
+ name: string;
1746
+ }
1747
+ interface Organization {
1748
+ id: number;
1749
+ slug: string;
1750
+ name: string;
1751
+ role: string;
1752
+ }
1753
+ interface Role {
1754
+ id: number;
1755
+ name: string;
1756
+ slug: string;
1757
+ description: string | null;
1758
+ level: number;
1759
+ permissions_count?: number;
1760
+ created_at: string;
1761
+ updated_at: string;
1762
+ }
1763
+ interface Permission {
1764
+ id: number;
1765
+ name: string;
1766
+ slug: string;
1767
+ group: string | null;
1768
+ description?: string | null;
1769
+ roles_count?: number;
1770
+ created_at: string;
1771
+ updated_at: string;
1772
+ }
1773
+ interface RoleWithPermissions extends Role {
1774
+ permissions: Permission[];
1775
+ }
1776
+ interface PermissionMatrix {
1777
+ roles: Pick<Role, "id" | "slug" | "name">[];
1778
+ permissions: Record<string, Pick<Permission, "id" | "slug" | "name">[]>;
1779
+ matrix: Record<string, string[]>;
1780
+ }
1781
+ interface ApiToken {
1782
+ id: number;
1783
+ name: string;
1784
+ last_used_at: string | null;
1785
+ created_at: string;
1786
+ is_current: boolean;
1787
+ }
1788
+ interface TeamWithPermissions {
1789
+ console_team_id: number;
1790
+ name: string;
1791
+ path: string | null;
1792
+ permissions: Pick<Permission, "id" | "slug">[];
1793
+ }
1794
+ interface TeamPermissionDetail {
1795
+ console_team_id: number;
1796
+ permissions: Pick<Permission, "id" | "slug" | "name">[];
1797
+ }
1798
+ interface OrphanedTeam {
1799
+ console_team_id: number;
1800
+ permissions_count: number;
1801
+ permissions: string[];
1802
+ deleted_at: string | null;
1803
+ }
1804
+ interface SsoCallbackInput {
1805
+ code: string;
1806
+ device_name?: string;
1807
+ }
1808
+ interface CreateRoleInput {
1809
+ slug: string;
1810
+ name: string;
1811
+ level: number;
1812
+ description?: string;
1813
+ }
1814
+ interface UpdateRoleInput {
1815
+ name?: string;
1816
+ level?: number;
1817
+ description?: string | null;
1818
+ }
1819
+ interface CreatePermissionInput {
1820
+ slug: string;
1821
+ name: string;
1822
+ group?: string;
1823
+ description?: string;
1824
+ }
1825
+ interface UpdatePermissionInput {
1826
+ name?: string;
1827
+ group?: string | null;
1828
+ description?: string | null;
1829
+ }
1830
+ interface SyncPermissionsInput {
1831
+ permissions: (number | string)[];
1832
+ }
1833
+ interface CleanupOrphanedInput {
1834
+ console_team_id?: number;
1835
+ older_than_days?: number;
1836
+ }
1837
+ interface SsoServiceConfig {
1838
+ apiUrl: string;
1839
+ }
1840
+ declare function createSsoService(config: SsoServiceConfig): {
1841
+ /**
1842
+ * Exchange SSO authorization code for tokens
1843
+ * POST /api/sso/callback
1844
+ */
1845
+ callback: (input: SsoCallbackInput) => Promise<{
1846
+ user: SsoUser;
1847
+ organizations: Organization[];
1848
+ token?: string;
1849
+ }>;
1850
+ /**
1851
+ * Logout current user and revoke tokens
1852
+ * POST /api/sso/logout
1853
+ */
1854
+ logout: () => Promise<{
1855
+ message: string;
1856
+ }>;
1857
+ /**
1858
+ * Get current authenticated user with organizations
1859
+ * GET /api/sso/user
1860
+ */
1861
+ getUser: () => Promise<{
1862
+ user: SsoUser;
1863
+ organizations: Organization[];
1864
+ }>;
1865
+ /**
1866
+ * Get Console SSO global logout URL
1867
+ * GET /api/sso/global-logout-url
1868
+ */
1869
+ getGlobalLogoutUrl: (redirectUri?: string) => Promise<{
1870
+ logout_url: string;
1871
+ }>;
1872
+ /**
1873
+ * List all API tokens for current user
1874
+ * GET /api/sso/tokens
1875
+ */
1876
+ getTokens: () => Promise<{
1877
+ tokens: ApiToken[];
1878
+ }>;
1879
+ /**
1880
+ * Revoke a specific token
1881
+ * DELETE /api/sso/tokens/{tokenId}
1882
+ */
1883
+ revokeToken: (tokenId: number) => Promise<{
1884
+ message: string;
1885
+ }>;
1886
+ /**
1887
+ * Revoke all tokens except current
1888
+ * POST /api/sso/tokens/revoke-others
1889
+ */
1890
+ revokeOtherTokens: () => Promise<{
1891
+ message: string;
1892
+ revoked_count: number;
1893
+ }>;
1894
+ /**
1895
+ * Get all roles
1896
+ * GET /api/sso/roles
1897
+ */
1898
+ getRoles: () => Promise<{
1899
+ data: Role[];
1900
+ }>;
1901
+ /**
1902
+ * Get single role with permissions
1903
+ * GET /api/sso/roles/{id}
1904
+ */
1905
+ getRole: (id: number) => Promise<{
1906
+ data: RoleWithPermissions;
1907
+ }>;
1908
+ /**
1909
+ * Get all permissions
1910
+ * GET /api/sso/permissions
1911
+ */
1912
+ getPermissions: (params?: {
1913
+ group?: string;
1914
+ search?: string;
1915
+ grouped?: boolean;
1916
+ }) => Promise<{
1917
+ data: Permission[];
1918
+ groups: string[];
1919
+ }>;
1920
+ /**
1921
+ * Get permission matrix (roles x permissions)
1922
+ * GET /api/sso/permission-matrix
1923
+ */
1924
+ getPermissionMatrix: () => Promise<PermissionMatrix>;
1925
+ /**
1926
+ * List all roles (admin)
1927
+ * GET /api/admin/sso/roles
1928
+ */
1929
+ adminGetRoles: (orgId: string) => Promise<{
1930
+ data: Role[];
1931
+ }>;
1932
+ /**
1933
+ * Get single role (admin)
1934
+ * GET /api/admin/sso/roles/{id}
1935
+ */
1936
+ adminGetRole: (id: number, orgId: string) => Promise<{
1937
+ data: RoleWithPermissions;
1938
+ }>;
1939
+ /**
1940
+ * Create role (admin only)
1941
+ * POST /api/admin/sso/roles
1942
+ */
1943
+ createRole: (input: CreateRoleInput, orgId: string) => Promise<{
1944
+ data: Role;
1945
+ message: string;
1946
+ }>;
1947
+ /**
1948
+ * Update role (admin only)
1949
+ * PUT /api/admin/sso/roles/{id}
1950
+ */
1951
+ updateRole: (id: number, input: UpdateRoleInput, orgId: string) => Promise<{
1952
+ data: Role;
1953
+ message: string;
1954
+ }>;
1955
+ /**
1956
+ * Delete role (admin only)
1957
+ * DELETE /api/admin/sso/roles/{id}
1958
+ */
1959
+ deleteRole: (id: number, orgId: string) => Promise<void>;
1960
+ /**
1961
+ * Get role's permissions (admin)
1962
+ * GET /api/admin/sso/roles/{id}/permissions
1963
+ */
1964
+ getRolePermissions: (id: number, orgId: string) => Promise<{
1965
+ role: Pick<Role, "id" | "slug" | "name">;
1966
+ permissions: Permission[];
1967
+ }>;
1968
+ /**
1969
+ * Sync role's permissions (admin)
1970
+ * PUT /api/admin/sso/roles/{id}/permissions
1971
+ */
1972
+ syncRolePermissions: (id: number, input: SyncPermissionsInput, orgId: string) => Promise<{
1973
+ message: string;
1974
+ attached: number;
1975
+ detached: number;
1976
+ }>;
1977
+ /**
1978
+ * List all permissions (admin)
1979
+ * GET /api/admin/sso/permissions
1980
+ */
1981
+ adminGetPermissions: (orgId: string, params?: {
1982
+ group?: string;
1983
+ search?: string;
1984
+ grouped?: boolean;
1985
+ }) => Promise<{
1986
+ data: Permission[];
1987
+ groups: string[];
1988
+ }>;
1989
+ /**
1990
+ * Get single permission (admin)
1991
+ * GET /api/admin/sso/permissions/{id}
1992
+ */
1993
+ adminGetPermission: (id: number, orgId: string) => Promise<{
1994
+ data: Permission;
1995
+ }>;
1996
+ /**
1997
+ * Create permission (admin only)
1998
+ * POST /api/admin/sso/permissions
1999
+ */
2000
+ createPermission: (input: CreatePermissionInput, orgId: string) => Promise<{
2001
+ data: Permission;
2002
+ message: string;
2003
+ }>;
2004
+ /**
2005
+ * Update permission (admin only)
2006
+ * PUT /api/admin/sso/permissions/{id}
2007
+ */
2008
+ updatePermission: (id: number, input: UpdatePermissionInput, orgId: string) => Promise<{
2009
+ data: Permission;
2010
+ message: string;
2011
+ }>;
2012
+ /**
2013
+ * Delete permission (admin only)
2014
+ * DELETE /api/admin/sso/permissions/{id}
2015
+ */
2016
+ deletePermission: (id: number, orgId: string) => Promise<void>;
2017
+ /**
2018
+ * Get permission matrix (admin)
2019
+ * GET /api/admin/sso/permission-matrix
2020
+ */
2021
+ adminGetPermissionMatrix: (orgId: string) => Promise<PermissionMatrix>;
2022
+ /**
2023
+ * Get all teams with their permissions (admin only)
2024
+ * GET /api/admin/sso/teams/permissions
2025
+ */
2026
+ getTeamPermissions: (orgId: string) => Promise<{
2027
+ teams: TeamWithPermissions[];
2028
+ }>;
2029
+ /**
2030
+ * Get specific team permissions (admin only)
2031
+ * GET /api/admin/sso/teams/{teamId}/permissions
2032
+ */
2033
+ getTeamPermission: (teamId: number, orgId: string) => Promise<TeamPermissionDetail>;
2034
+ /**
2035
+ * Sync team permissions (admin only)
2036
+ * PUT /api/admin/sso/teams/{teamId}/permissions
2037
+ */
2038
+ syncTeamPermissions: (teamId: number, input: SyncPermissionsInput, orgId: string) => Promise<{
2039
+ message: string;
2040
+ console_team_id: number;
2041
+ attached: number;
2042
+ detached: number;
2043
+ }>;
2044
+ /**
2045
+ * Remove all permissions for a team (admin only)
2046
+ * DELETE /api/admin/sso/teams/{teamId}/permissions
2047
+ */
2048
+ removeTeamPermissions: (teamId: number, orgId: string) => Promise<void>;
2049
+ /**
2050
+ * List orphaned team permissions (admin only)
2051
+ * GET /api/admin/sso/teams/orphaned
2052
+ */
2053
+ getOrphanedTeamPermissions: (orgId: string) => Promise<{
2054
+ orphaned_teams: OrphanedTeam[];
2055
+ total_orphaned_permissions: number;
2056
+ }>;
2057
+ /**
2058
+ * Restore orphaned team permissions (admin only)
2059
+ * POST /api/admin/sso/teams/orphaned/{teamId}/restore
2060
+ */
2061
+ restoreOrphanedTeamPermissions: (teamId: number, orgId: string) => Promise<{
2062
+ message: string;
2063
+ console_team_id: number;
2064
+ restored_count: number;
2065
+ }>;
2066
+ /**
2067
+ * Cleanup orphaned team permissions (admin only)
2068
+ * DELETE /api/admin/sso/teams/orphaned
2069
+ */
2070
+ cleanupOrphanedTeamPermissions: (orgId: string, input?: CleanupOrphanedInput) => Promise<{
2071
+ message: string;
2072
+ deleted_count: number;
2073
+ }>;
2074
+ };
2075
+ type SsoService = ReturnType<typeof createSsoService>;
2076
+
2077
+ /**
2078
+ * SSO Query Keys - For TanStack Query / React Query
2079
+ *
2080
+ * Centralized key management for SSO-related queries.
2081
+ * Structure matches the service organization.
2082
+ */
2083
+ declare const ssoQueryKeys: {
2084
+ readonly all: readonly ["sso"];
2085
+ readonly auth: {
2086
+ readonly all: () => readonly ["sso", "auth"];
2087
+ readonly user: () => readonly ["sso", "auth", "user"];
2088
+ readonly globalLogoutUrl: (redirectUri?: string) => readonly ["sso", "auth", "global-logout-url", string | undefined];
2089
+ };
2090
+ readonly tokens: {
2091
+ readonly all: () => readonly ["sso", "tokens"];
2092
+ readonly list: () => readonly ["sso", "tokens", "list"];
2093
+ };
2094
+ readonly roles: {
2095
+ readonly all: () => readonly ["sso", "roles"];
2096
+ readonly list: () => readonly ["sso", "roles", "list"];
2097
+ readonly detail: (id: number | string) => readonly ["sso", "roles", "detail", string | number];
2098
+ readonly permissions: (id: number | string) => readonly ["sso", "roles", string | number, "permissions"];
2099
+ };
2100
+ readonly permissions: {
2101
+ readonly all: () => readonly ["sso", "permissions"];
2102
+ readonly list: (params?: {
2103
+ group?: string;
2104
+ search?: string;
2105
+ grouped?: boolean;
2106
+ }) => readonly ["sso", "permissions", "list", {
2107
+ group?: string;
2108
+ search?: string;
2109
+ grouped?: boolean;
2110
+ } | undefined];
2111
+ readonly detail: (id: number | string) => readonly ["sso", "permissions", "detail", string | number];
2112
+ readonly matrix: () => readonly ["sso", "permissions", "matrix"];
2113
+ };
2114
+ readonly teams: {
2115
+ readonly all: () => readonly ["sso", "teams"];
2116
+ readonly list: () => readonly ["sso", "teams", "list"];
2117
+ readonly permissions: (teamId: number) => readonly ["sso", "teams", number, "permissions"];
2118
+ readonly orphaned: () => readonly ["sso", "teams", "orphaned"];
2119
+ };
2120
+ readonly userRoles: {
2121
+ readonly all: () => readonly ["sso", "user-roles"];
2122
+ readonly list: (userId: string) => readonly ["sso", "user-roles", string];
2123
+ readonly byBranch: (userId: string, orgId: string, branchId: string | null) => readonly ["sso", "user-roles", string, string, string | null];
2124
+ };
2125
+ readonly branches: {
2126
+ readonly all: () => readonly ["sso", "branches"];
2127
+ readonly list: (orgId?: string) => readonly ["sso", "branches", "list", string | undefined];
2128
+ readonly detail: (branchId: number) => readonly ["sso", "branches", "detail", number];
2129
+ readonly headquarters: (orgId?: string) => readonly ["sso", "branches", "headquarters", string | undefined];
2130
+ readonly primary: (orgId?: string) => readonly ["sso", "branches", "primary", string | undefined];
2131
+ };
2132
+ readonly admin: {
2133
+ readonly roles: {
2134
+ readonly all: (orgId: string) => readonly ["sso", "admin", string, "roles"];
2135
+ readonly list: (orgId: string) => readonly ["sso", "admin", string, "roles", "list"];
2136
+ readonly detail: (orgId: string, id: number | string) => readonly ["sso", "admin", string, "roles", "detail", string | number];
2137
+ readonly permissions: (orgId: string, id: number | string) => readonly ["sso", "admin", string, "roles", string | number, "permissions"];
2138
+ };
2139
+ readonly permissions: {
2140
+ readonly all: (orgId: string) => readonly ["sso", "admin", string, "permissions"];
2141
+ readonly list: (orgId: string, params?: {
2142
+ group?: string;
2143
+ search?: string;
2144
+ grouped?: boolean;
2145
+ }) => readonly ["sso", "admin", string, "permissions", "list", {
2146
+ group?: string;
2147
+ search?: string;
2148
+ grouped?: boolean;
2149
+ } | undefined];
2150
+ readonly detail: (orgId: string, id: number | string) => readonly ["sso", "admin", string, "permissions", "detail", string | number];
2151
+ readonly matrix: (orgId: string) => readonly ["sso", "admin", string, "permissions", "matrix"];
2152
+ };
2153
+ readonly teams: {
2154
+ readonly all: (orgId: string) => readonly ["sso", "admin", string, "teams"];
2155
+ readonly list: (orgId: string) => readonly ["sso", "admin", string, "teams", "list"];
2156
+ readonly permissions: (orgId: string, teamId: number) => readonly ["sso", "admin", string, "teams", number, "permissions"];
2157
+ readonly orphaned: (orgId: string) => readonly ["sso", "admin", string, "teams", "orphaned"];
2158
+ };
2159
+ readonly userRoles: {
2160
+ readonly all: (orgId: string) => readonly ["sso", "admin", string, "user-roles"];
2161
+ readonly list: (orgId: string, userId: string) => readonly ["sso", "admin", string, "user-roles", string];
2162
+ readonly byBranch: (orgId: string, userId: string, consoleOrgId: string, branchId: string | null) => readonly ["sso", "admin", string, "user-roles", string, string, string | null];
2163
+ };
2164
+ readonly users: {
2165
+ readonly all: (orgId: string) => readonly ["sso", "admin", string, "users"];
2166
+ readonly list: (orgId: string, params?: {
2167
+ search?: string;
2168
+ }) => readonly ["sso", "admin", string, "users", "list", {
2169
+ search?: string;
2170
+ } | undefined];
2171
+ readonly detail: (orgId: string, id: string) => readonly ["sso", "admin", string, "users", "detail", string];
2172
+ readonly permissions: (orgId: string, userId: string, consoleOrgId?: string, branchId?: string) => readonly ["sso", "admin", string, "users", string, "permissions", string | undefined, string | undefined];
2173
+ };
2174
+ };
2175
+ };
2176
+
2177
+ type Locale = 'ja' | 'en' | 'vi';
2178
+ declare const locales: Locale[];
2179
+ declare const localeNames: Record<Locale, string>;
2180
+ declare const defaultLocale: Locale;
2181
+ interface I18nContextValue {
2182
+ locale: Locale;
2183
+ setLocale: (locale: Locale) => void;
2184
+ t: (key: string, options?: Record<string, unknown>) => string;
2185
+ }
2186
+ interface I18nProviderProps {
2187
+ children: ReactNode;
2188
+ defaultLocale?: Locale;
2189
+ fallbackLocale?: Locale;
2190
+ translations?: Record<string, Record<string, unknown>>;
2191
+ }
2192
+ declare function I18nProvider({ children, defaultLocale: initialLocale, fallbackLocale, translations, }: I18nProviderProps): react_jsx_runtime.JSX.Element;
2193
+ declare function useLocale(): Locale;
2194
+ declare function useTranslations(): i18next.TFunction<"translation", undefined>;
2195
+ declare function useSsoTranslation(): react_i18next.UseTranslationResponse<"sso", undefined>;
2196
+ declare function getCurrentLocale(): Locale;
2197
+ declare function changeLanguage(locale: Locale): void;
2198
+ declare const ssoNamespace = "sso";
2199
+ declare const defaultTranslations: {
2200
+ ja: {
2201
+ login: string;
2202
+ logout: string;
2203
+ loading: string;
2204
+ error: string;
2205
+ retry: string;
2206
+ cancel: string;
2207
+ save: string;
2208
+ delete: string;
2209
+ edit: string;
2210
+ create: string;
2211
+ search: string;
2212
+ reset: string;
2213
+ noData: string;
2214
+ confirmDelete: string;
2215
+ };
2216
+ en: {
2217
+ login: string;
2218
+ logout: string;
2219
+ loading: string;
2220
+ error: string;
2221
+ retry: string;
2222
+ cancel: string;
2223
+ save: string;
2224
+ delete: string;
2225
+ edit: string;
2226
+ create: string;
2227
+ search: string;
2228
+ reset: string;
2229
+ noData: string;
2230
+ confirmDelete: string;
2231
+ };
2232
+ vi: {
2233
+ login: string;
2234
+ logout: string;
2235
+ loading: string;
2236
+ error: string;
2237
+ retry: string;
2238
+ cancel: string;
2239
+ save: string;
2240
+ delete: string;
2241
+ edit: string;
2242
+ create: string;
2243
+ search: string;
2244
+ reset: string;
2245
+ noData: string;
2246
+ confirmDelete: string;
2247
+ };
2248
+ };
2249
+
2250
+ export { type TeamCacheUpdate as $, type ApiToken$1 as A, BRANCH_HEADERS as B, type CleanupOrphanedInput$1 as C, type DateString as D, type PermissionUpdate as E, type RoleAssignment as F, type RoleCreate as G, type RolePermission as H, type I18nContextValue as I, type RolePermissionCreate as J, type RolePermissionUpdate as K, type Locale as L, type RoleScope as M, type RoleUpdate as N, type Organization$1 as O, type PermissionCreate as P, SsoContext as Q, type RemoveRoleResponse as R, type SsoUser$1 as S, SsoProvider as T, type SsoService as U, type SsoServiceConfig as V, type SyncRolesInput as W, type SyncRolesResponse as X, type SyncTeamPermissionsInput as Y, type TeamCache as Z, type TeamCacheCreate as _, type AssignRoleInput as a, locales as a$, type TeamPermission as a0, type TeamPermissionCreate as a1, type TeamPermissionDetail$1 as a2, type TeamPermissionUpdate as a3, type TeamService as a4, type TeamWithPermissions$1 as a5, type TokenService as a6, type UpdatePermissionInput$1 as a7, type UseAuthReturn as a8, type UseBranchReturn as a9, getCurrentLocale as aA, getEffectivePermissions as aB, getMessage as aC, getMessages as aD, getOrganizationCacheFieldLabel as aE, getOrganizationCacheFieldPlaceholder as aF, getOrganizationCacheLabel as aG, getPermissionFieldLabel as aH, getPermissionFieldPlaceholder as aI, getPermissionLabel as aJ, getRoleFieldLabel as aK, getRoleFieldPlaceholder as aL, getRoleLabel as aM, getRolePermissionFieldLabel as aN, getRolePermissionFieldPlaceholder as aO, getRolePermissionLabel as aP, getScopeLabel as aQ, getTeamCacheFieldLabel as aR, getTeamCacheFieldPlaceholder as aS, getTeamCacheLabel as aT, getTeamPermissionFieldLabel as aU, getTeamPermissionFieldPlaceholder as aV, getTeamPermissionLabel as aW, getUserCacheFieldLabel as aX, getUserCacheFieldPlaceholder as aY, getUserCacheLabel as aZ, localeNames as a_, type UseOrganizationReturn as aa, type UseSsoReturn as ab, type UserCache as ac, type UserCacheCreate as ad, type UserCacheUpdate as ae, type UserRoleService as af, type ValidationRule as ag, branchCacheCreateSchema as ah, branchCacheI18n as ai, branchCacheSchemas as aj, branchCacheUpdateSchema as ak, changeLanguage as al, createAuthService as am, createBranchHeaderSetter as an, createBranchService as ao, createPermissionService as ap, createSsoService as aq, createTeamService as ar, createTokenService as as, createUserRoleService as at, defaultLocale as au, defaultTranslations as av, fallbackLocale as aw, getBranchCacheFieldLabel as ax, getBranchCacheFieldPlaceholder as ay, getBranchCacheLabel as az, type AssignRoleResponse as b, organizationCacheCreateSchema as b0, organizationCacheI18n as b1, organizationCacheSchemas as b2, organizationCacheUpdateSchema as b3, permissionCreateSchema as b4, permissionI18n as b5, permissionSchemas as b6, permissionUpdateSchema as b7, roleCreateSchema as b8, roleI18n as b9, userCacheI18n as bA, userCacheSchemas as bB, userCacheUpdateSchema as bC, validationMessages as bD, type Locale$1 as bE, type Permission$1 as bF, type Role$1 as bG, defaultLocale$1 as bH, useBranchContext as bI, useSsoContext as bJ, rolePermissionCreateSchema as ba, rolePermissionI18n as bb, rolePermissionSchemas as bc, rolePermissionUpdateSchema as bd, roleSchemas as be, roleUpdateSchema as bf, setBranchHeaders as bg, ssoNamespace as bh, ssoQueryKeys as bi, supportedLocales as bj, teamCacheCreateSchema as bk, teamCacheI18n as bl, teamCacheSchemas as bm, teamCacheUpdateSchema as bn, teamPermissionCreateSchema as bo, teamPermissionI18n as bp, teamPermissionSchemas as bq, teamPermissionUpdateSchema as br, useAuth as bs, useBranch as bt, useLocale as bu, useOrganization as bv, useSso as bw, useSsoTranslation as bx, useTranslations as by, userCacheCreateSchema as bz, type AuthCallbackInput as c, type AuthCallbackResponse as d, type AuthService as e, type AuthUserResponse as f, type Branch as g, type BranchCache as h, type BranchCacheCreate as i, type BranchCacheUpdate as j, BranchContext as k, BranchProvider as l, type BranchService as m, type BranchesResponse as n, type CreatePermissionInput$1 as o, type DateTimeString as p, I18nProvider as q, type I18nProviderProps as r, type LocaleMap as s, type OrganizationCache as t, type OrganizationCacheCreate as u, type OrganizationCacheUpdate as v, type OrphanedTeam$1 as w, type PermissionListParams as x, type PermissionMatrix$1 as y, type PermissionService as z };