@abpjs/saas 2.9.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +480 -27
- package/dist/index.d.ts +480 -27
- package/dist/index.js +470 -143
- package/dist/index.mjs +353 -54
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,118 @@
|
|
|
1
|
-
import { ABP, RestService } from '@abpjs/core';
|
|
1
|
+
import { ABP, RoutesService, RestService } from '@abpjs/core';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* SaaS Policy Names
|
|
6
|
+
* Translated from @volo/abp.ng.saas/config v3.0.0
|
|
7
|
+
*
|
|
8
|
+
* Policy name constants for SaaS module permission checking.
|
|
9
|
+
* @since 3.0.0
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Enum-like const object for SaaS policy names.
|
|
13
|
+
* Used for permission checking in SaaS module.
|
|
14
|
+
* @since 3.0.0
|
|
15
|
+
*/
|
|
16
|
+
declare const eSaasPolicyNames: {
|
|
17
|
+
/** Policy for SaaS module (Tenants OR Editions) */
|
|
18
|
+
readonly Saas: "Saas.Tenants || Saas.Editions";
|
|
19
|
+
/** Policy for Tenants management */
|
|
20
|
+
readonly Tenants: "Saas.Tenants";
|
|
21
|
+
/** Policy for Editions management */
|
|
22
|
+
readonly Editions: "Saas.Editions";
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Type for SaaS policy name values
|
|
26
|
+
* @since 3.0.0
|
|
27
|
+
*/
|
|
28
|
+
type SaasPolicyNameKey = (typeof eSaasPolicyNames)[keyof typeof eSaasPolicyNames];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* SaaS Route Names
|
|
32
|
+
* Translated from @volo/abp.ng.saas/config v3.0.0
|
|
33
|
+
*
|
|
34
|
+
* Route name localization keys for SaaS module navigation.
|
|
35
|
+
* @since 3.0.0 (moved from lib/enums to config/enums)
|
|
36
|
+
*
|
|
37
|
+
* Breaking changes in v3.0.0:
|
|
38
|
+
* - Removed 'Administration' key
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* Enum-like const object for SaaS route names.
|
|
42
|
+
* Used for localization and navigation configuration.
|
|
43
|
+
*
|
|
44
|
+
* @since 2.7.0
|
|
45
|
+
* @updated 3.0.0 - Removed Administration key, moved to config subpackage
|
|
46
|
+
*/
|
|
47
|
+
declare const eSaasRouteNames: {
|
|
48
|
+
/** SaaS menu route name */
|
|
49
|
+
readonly Saas: "Saas::Menu:Saas";
|
|
50
|
+
/** Tenants route name */
|
|
51
|
+
readonly Tenants: "Saas::Tenants";
|
|
52
|
+
/** Editions route name */
|
|
53
|
+
readonly Editions: "Saas::Editions";
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Type for SaaS route name values
|
|
57
|
+
* @since 2.7.0
|
|
58
|
+
*/
|
|
59
|
+
type SaasRouteNameKey = (typeof eSaasRouteNames)[keyof typeof eSaasRouteNames];
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* SaaS Route Provider
|
|
63
|
+
* Translated from @volo/abp.ng.saas/config v3.0.0
|
|
64
|
+
*
|
|
65
|
+
* Provides route configuration functionality for SaaS module.
|
|
66
|
+
* @since 3.0.0
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Default SaaS route configuration
|
|
71
|
+
* @since 3.0.0
|
|
72
|
+
*/
|
|
73
|
+
declare const SAAS_ROUTE_CONFIG: ABP.Route;
|
|
74
|
+
/**
|
|
75
|
+
* Configure SaaS routes
|
|
76
|
+
* @param routes - The routes service instance
|
|
77
|
+
* @returns A function that adds SaaS routes
|
|
78
|
+
* @since 3.0.0
|
|
79
|
+
*/
|
|
80
|
+
declare function configureRoutes(routes: RoutesService): () => void;
|
|
81
|
+
/**
|
|
82
|
+
* Initialize SaaS routes
|
|
83
|
+
* Helper function to immediately configure routes
|
|
84
|
+
* @param routes - The routes service instance
|
|
85
|
+
* @since 3.0.0
|
|
86
|
+
*/
|
|
87
|
+
declare function initializeSaasRoutes(routes: RoutesService): void;
|
|
88
|
+
/**
|
|
89
|
+
* SaaS route providers configuration object
|
|
90
|
+
* React equivalent of Angular's APP_INITIALIZER pattern
|
|
91
|
+
* @since 3.0.0
|
|
92
|
+
*/
|
|
93
|
+
declare const SAAS_ROUTE_PROVIDERS: {
|
|
94
|
+
/** Configure function factory */
|
|
95
|
+
useFactory: typeof configureRoutes;
|
|
96
|
+
/** Dependencies required by the factory */
|
|
97
|
+
deps: readonly ["RoutesService"];
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* SaaS Component Identifiers
|
|
102
|
+
* Used for component registration and routing
|
|
103
|
+
*
|
|
104
|
+
* @since 2.4.0
|
|
105
|
+
* @updated 2.7.0 - Changed from enum to const object
|
|
106
|
+
*/
|
|
107
|
+
declare const eSaasComponents: {
|
|
108
|
+
readonly Editions: "Saas.EditionsComponent";
|
|
109
|
+
readonly Tenants: "Saas.TenantsComponent";
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Type for SaaS component key values
|
|
113
|
+
*/
|
|
114
|
+
type SaasComponentKey = (typeof eSaasComponents)[keyof typeof eSaasComponents];
|
|
115
|
+
|
|
4
116
|
/**
|
|
5
117
|
* SaaS Models
|
|
6
118
|
* Translated from @volo/abp.ng.saas v2.4.0
|
|
@@ -105,6 +217,315 @@ declare namespace Saas {
|
|
|
105
217
|
}
|
|
106
218
|
}
|
|
107
219
|
|
|
220
|
+
/**
|
|
221
|
+
* SaaS Extension Tokens
|
|
222
|
+
* Translated from @volo/abp.ng.saas v3.0.0
|
|
223
|
+
*
|
|
224
|
+
* Default entity actions, toolbar actions, entity props, and form props
|
|
225
|
+
* for the SaaS module extensibility system.
|
|
226
|
+
*
|
|
227
|
+
* @since 3.0.0
|
|
228
|
+
*/
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Entity action type for extensibility
|
|
232
|
+
* @since 3.0.0
|
|
233
|
+
*/
|
|
234
|
+
interface EntityAction<T = unknown> {
|
|
235
|
+
text: string;
|
|
236
|
+
action?: (record: T) => void;
|
|
237
|
+
permission?: string;
|
|
238
|
+
visible?: (record: T) => boolean;
|
|
239
|
+
icon?: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Toolbar action type for extensibility
|
|
243
|
+
* @since 3.0.0
|
|
244
|
+
*/
|
|
245
|
+
interface ToolbarAction<T = unknown> {
|
|
246
|
+
text: string;
|
|
247
|
+
action?: (data: T) => void;
|
|
248
|
+
permission?: string;
|
|
249
|
+
visible?: (data: T) => boolean;
|
|
250
|
+
icon?: string;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Entity prop type for extensibility
|
|
254
|
+
* @since 3.0.0
|
|
255
|
+
*/
|
|
256
|
+
interface EntityProp<T = unknown> {
|
|
257
|
+
name: string;
|
|
258
|
+
displayName?: string;
|
|
259
|
+
sortable?: boolean;
|
|
260
|
+
valueResolver?: (record: T) => string | number | boolean | null | undefined;
|
|
261
|
+
permission?: string;
|
|
262
|
+
visible?: boolean;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Form prop type for extensibility
|
|
266
|
+
* @since 3.0.0
|
|
267
|
+
*/
|
|
268
|
+
interface FormProp<T = unknown> {
|
|
269
|
+
name: string;
|
|
270
|
+
displayName?: string;
|
|
271
|
+
type?: 'string' | 'number' | 'boolean' | 'date' | 'select' | 'textarea';
|
|
272
|
+
defaultValue?: unknown;
|
|
273
|
+
validators?: Array<{
|
|
274
|
+
type: string;
|
|
275
|
+
value?: unknown;
|
|
276
|
+
message?: string;
|
|
277
|
+
}>;
|
|
278
|
+
options?: Array<{
|
|
279
|
+
label: string;
|
|
280
|
+
value: unknown;
|
|
281
|
+
}>;
|
|
282
|
+
permission?: string;
|
|
283
|
+
visible?: boolean | ((record?: T) => boolean);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Default entity actions for Editions component
|
|
287
|
+
* @since 3.0.0
|
|
288
|
+
*/
|
|
289
|
+
declare const DEFAULT_EDITIONS_ENTITY_ACTIONS: EntityAction<Saas.Edition>[];
|
|
290
|
+
/**
|
|
291
|
+
* Default entity actions for Tenants component
|
|
292
|
+
* @since 3.0.0
|
|
293
|
+
*/
|
|
294
|
+
declare const DEFAULT_TENANTS_ENTITY_ACTIONS: EntityAction<Saas.Tenant>[];
|
|
295
|
+
/**
|
|
296
|
+
* Default entity actions aggregated by component
|
|
297
|
+
* @since 3.0.0
|
|
298
|
+
*/
|
|
299
|
+
declare const DEFAULT_SAAS_ENTITY_ACTIONS: {
|
|
300
|
+
readonly "Saas.EditionsComponent": EntityAction<Saas.Edition>[];
|
|
301
|
+
readonly "Saas.TenantsComponent": EntityAction<Saas.Tenant>[];
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Default toolbar actions for Editions component
|
|
305
|
+
* @since 3.0.0
|
|
306
|
+
*/
|
|
307
|
+
declare const DEFAULT_EDITIONS_TOOLBAR_ACTIONS: ToolbarAction<Saas.Edition[]>[];
|
|
308
|
+
/**
|
|
309
|
+
* Default toolbar actions for Tenants component
|
|
310
|
+
* @since 3.0.0
|
|
311
|
+
*/
|
|
312
|
+
declare const DEFAULT_TENANTS_TOOLBAR_ACTIONS: ToolbarAction<Saas.Tenant[]>[];
|
|
313
|
+
/**
|
|
314
|
+
* Default toolbar actions aggregated by component
|
|
315
|
+
* @since 3.0.0
|
|
316
|
+
*/
|
|
317
|
+
declare const DEFAULT_SAAS_TOOLBAR_ACTIONS: {
|
|
318
|
+
readonly "Saas.EditionsComponent": ToolbarAction<Saas.Edition[]>[];
|
|
319
|
+
readonly "Saas.TenantsComponent": ToolbarAction<Saas.Tenant[]>[];
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* Default entity props for Editions component
|
|
323
|
+
* @since 3.0.0
|
|
324
|
+
*/
|
|
325
|
+
declare const DEFAULT_EDITIONS_ENTITY_PROPS: EntityProp<Saas.Edition>[];
|
|
326
|
+
/**
|
|
327
|
+
* Default entity props for Tenants component
|
|
328
|
+
* @since 3.0.0
|
|
329
|
+
*/
|
|
330
|
+
declare const DEFAULT_TENANTS_ENTITY_PROPS: EntityProp<Saas.Tenant>[];
|
|
331
|
+
/**
|
|
332
|
+
* Default entity props aggregated by component
|
|
333
|
+
* @since 3.0.0
|
|
334
|
+
*/
|
|
335
|
+
declare const DEFAULT_SAAS_ENTITY_PROPS: {
|
|
336
|
+
readonly "Saas.EditionsComponent": EntityProp<Saas.Edition>[];
|
|
337
|
+
readonly "Saas.TenantsComponent": EntityProp<Saas.Tenant>[];
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Default create form props for Editions component
|
|
341
|
+
* @since 3.0.0
|
|
342
|
+
*/
|
|
343
|
+
declare const DEFAULT_EDITIONS_CREATE_FORM_PROPS: FormProp<Saas.Edition>[];
|
|
344
|
+
/**
|
|
345
|
+
* Default create form props for Tenants component
|
|
346
|
+
* @since 3.0.0
|
|
347
|
+
*/
|
|
348
|
+
declare const DEFAULT_TENANTS_CREATE_FORM_PROPS: FormProp<Saas.Tenant>[];
|
|
349
|
+
/**
|
|
350
|
+
* Default create form props aggregated by component
|
|
351
|
+
* @since 3.0.0
|
|
352
|
+
*/
|
|
353
|
+
declare const DEFAULT_SAAS_CREATE_FORM_PROPS: {
|
|
354
|
+
readonly "Saas.EditionsComponent": FormProp<Saas.Edition>[];
|
|
355
|
+
readonly "Saas.TenantsComponent": FormProp<Saas.Tenant>[];
|
|
356
|
+
};
|
|
357
|
+
/**
|
|
358
|
+
* Default edit form props for Editions component
|
|
359
|
+
* @since 3.0.0
|
|
360
|
+
*/
|
|
361
|
+
declare const DEFAULT_EDITIONS_EDIT_FORM_PROPS: FormProp<Saas.Edition>[];
|
|
362
|
+
/**
|
|
363
|
+
* Default edit form props for Tenants component
|
|
364
|
+
* @since 3.0.0
|
|
365
|
+
*/
|
|
366
|
+
declare const DEFAULT_TENANTS_EDIT_FORM_PROPS: FormProp<Saas.Tenant>[];
|
|
367
|
+
/**
|
|
368
|
+
* Default edit form props aggregated by component
|
|
369
|
+
* @since 3.0.0
|
|
370
|
+
*/
|
|
371
|
+
declare const DEFAULT_SAAS_EDIT_FORM_PROPS: {
|
|
372
|
+
readonly "Saas.EditionsComponent": FormProp<Saas.Edition>[];
|
|
373
|
+
readonly "Saas.TenantsComponent": FormProp<Saas.Tenant>[];
|
|
374
|
+
};
|
|
375
|
+
/**
|
|
376
|
+
* Entity action contributor callback type
|
|
377
|
+
* @since 3.0.0
|
|
378
|
+
*/
|
|
379
|
+
type EntityActionContributorCallback<T> = (actions: EntityAction<T>[]) => EntityAction<T>[];
|
|
380
|
+
/**
|
|
381
|
+
* Toolbar action contributor callback type
|
|
382
|
+
* @since 3.0.0
|
|
383
|
+
*/
|
|
384
|
+
type ToolbarActionContributorCallback<T> = (actions: ToolbarAction<T>[]) => ToolbarAction<T>[];
|
|
385
|
+
/**
|
|
386
|
+
* Entity prop contributor callback type
|
|
387
|
+
* @since 3.0.0
|
|
388
|
+
*/
|
|
389
|
+
type EntityPropContributorCallback<T> = (props: EntityProp<T>[]) => EntityProp<T>[];
|
|
390
|
+
/**
|
|
391
|
+
* Create form prop contributor callback type
|
|
392
|
+
* @since 3.0.0
|
|
393
|
+
*/
|
|
394
|
+
type CreateFormPropContributorCallback<T> = (props: FormProp<T>[]) => FormProp<T>[];
|
|
395
|
+
/**
|
|
396
|
+
* Edit form prop contributor callback type
|
|
397
|
+
* @since 3.0.0
|
|
398
|
+
*/
|
|
399
|
+
type EditFormPropContributorCallback<T> = (props: FormProp<T>[]) => FormProp<T>[];
|
|
400
|
+
/**
|
|
401
|
+
* Token for entity action contributors
|
|
402
|
+
* React equivalent of Angular InjectionToken
|
|
403
|
+
* @since 3.0.0
|
|
404
|
+
*/
|
|
405
|
+
declare const SAAS_ENTITY_ACTION_CONTRIBUTORS: unique symbol;
|
|
406
|
+
/**
|
|
407
|
+
* Token for toolbar action contributors
|
|
408
|
+
* React equivalent of Angular InjectionToken
|
|
409
|
+
* @since 3.0.0
|
|
410
|
+
*/
|
|
411
|
+
declare const SAAS_TOOLBAR_ACTION_CONTRIBUTORS: unique symbol;
|
|
412
|
+
/**
|
|
413
|
+
* Token for entity prop contributors
|
|
414
|
+
* React equivalent of Angular InjectionToken
|
|
415
|
+
* @since 3.0.0
|
|
416
|
+
*/
|
|
417
|
+
declare const SAAS_ENTITY_PROP_CONTRIBUTORS: unique symbol;
|
|
418
|
+
/**
|
|
419
|
+
* Token for create form prop contributors
|
|
420
|
+
* React equivalent of Angular InjectionToken
|
|
421
|
+
* @since 3.0.0
|
|
422
|
+
*/
|
|
423
|
+
declare const SAAS_CREATE_FORM_PROP_CONTRIBUTORS: unique symbol;
|
|
424
|
+
/**
|
|
425
|
+
* Token for edit form prop contributors
|
|
426
|
+
* React equivalent of Angular InjectionToken
|
|
427
|
+
* @since 3.0.0
|
|
428
|
+
*/
|
|
429
|
+
declare const SAAS_EDIT_FORM_PROP_CONTRIBUTORS: unique symbol;
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* SaaS Config Options
|
|
433
|
+
* Translated from @volo/abp.ng.saas v3.0.0
|
|
434
|
+
*
|
|
435
|
+
* Configuration options for SaaS module extensibility.
|
|
436
|
+
*
|
|
437
|
+
* @since 3.0.0
|
|
438
|
+
*/
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* SaaS entity action contributors type
|
|
442
|
+
* Maps component keys to their entity action contributor callbacks
|
|
443
|
+
* @since 3.0.0
|
|
444
|
+
*/
|
|
445
|
+
type SaasEntityActionContributors = Partial<{
|
|
446
|
+
[eSaasComponents.Editions]: EntityActionContributorCallback<Saas.Edition>[];
|
|
447
|
+
[eSaasComponents.Tenants]: EntityActionContributorCallback<Saas.Tenant>[];
|
|
448
|
+
}>;
|
|
449
|
+
/**
|
|
450
|
+
* SaaS toolbar action contributors type
|
|
451
|
+
* Maps component keys to their toolbar action contributor callbacks
|
|
452
|
+
* @since 3.0.0
|
|
453
|
+
*/
|
|
454
|
+
type SaasToolbarActionContributors = Partial<{
|
|
455
|
+
[eSaasComponents.Editions]: ToolbarActionContributorCallback<Saas.Edition[]>[];
|
|
456
|
+
[eSaasComponents.Tenants]: ToolbarActionContributorCallback<Saas.Tenant[]>[];
|
|
457
|
+
}>;
|
|
458
|
+
/**
|
|
459
|
+
* SaaS entity prop contributors type
|
|
460
|
+
* Maps component keys to their entity prop contributor callbacks
|
|
461
|
+
* @since 3.0.0
|
|
462
|
+
*/
|
|
463
|
+
type SaasEntityPropContributors = Partial<{
|
|
464
|
+
[eSaasComponents.Editions]: EntityPropContributorCallback<Saas.Edition>[];
|
|
465
|
+
[eSaasComponents.Tenants]: EntityPropContributorCallback<Saas.Tenant>[];
|
|
466
|
+
}>;
|
|
467
|
+
/**
|
|
468
|
+
* SaaS create form prop contributors type
|
|
469
|
+
* Maps component keys to their create form prop contributor callbacks
|
|
470
|
+
* @since 3.0.0
|
|
471
|
+
*/
|
|
472
|
+
type SaasCreateFormPropContributors = Partial<{
|
|
473
|
+
[eSaasComponents.Editions]: CreateFormPropContributorCallback<Saas.Edition>[];
|
|
474
|
+
[eSaasComponents.Tenants]: CreateFormPropContributorCallback<Saas.Tenant>[];
|
|
475
|
+
}>;
|
|
476
|
+
/**
|
|
477
|
+
* SaaS edit form prop contributors type
|
|
478
|
+
* Maps component keys to their edit form prop contributor callbacks
|
|
479
|
+
* @since 3.0.0
|
|
480
|
+
*/
|
|
481
|
+
type SaasEditFormPropContributors = Partial<{
|
|
482
|
+
[eSaasComponents.Editions]: EditFormPropContributorCallback<Saas.Edition>[];
|
|
483
|
+
[eSaasComponents.Tenants]: EditFormPropContributorCallback<Saas.Tenant>[];
|
|
484
|
+
}>;
|
|
485
|
+
/**
|
|
486
|
+
* SaaS module configuration options
|
|
487
|
+
* Used to customize the SaaS module behavior through contributors
|
|
488
|
+
* @since 3.0.0
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```tsx
|
|
492
|
+
* const options: SaasConfigOptions = {
|
|
493
|
+
* entityActionContributors: {
|
|
494
|
+
* [eSaasComponents.Tenants]: [
|
|
495
|
+
* (actions) => [...actions, { text: 'Custom Action', icon: 'fa fa-star' }]
|
|
496
|
+
* ]
|
|
497
|
+
* },
|
|
498
|
+
* entityPropContributors: {
|
|
499
|
+
* [eSaasComponents.Tenants]: [
|
|
500
|
+
* (props) => [...props, { name: 'customField', displayName: 'Custom' }]
|
|
501
|
+
* ]
|
|
502
|
+
* }
|
|
503
|
+
* };
|
|
504
|
+
* ```
|
|
505
|
+
*/
|
|
506
|
+
interface SaasConfigOptions {
|
|
507
|
+
/**
|
|
508
|
+
* Entity action contributors for customizing row actions
|
|
509
|
+
*/
|
|
510
|
+
entityActionContributors?: SaasEntityActionContributors;
|
|
511
|
+
/**
|
|
512
|
+
* Toolbar action contributors for customizing toolbar buttons
|
|
513
|
+
*/
|
|
514
|
+
toolbarActionContributors?: SaasToolbarActionContributors;
|
|
515
|
+
/**
|
|
516
|
+
* Entity prop contributors for customizing table columns
|
|
517
|
+
*/
|
|
518
|
+
entityPropContributors?: SaasEntityPropContributors;
|
|
519
|
+
/**
|
|
520
|
+
* Create form prop contributors for customizing create form fields
|
|
521
|
+
*/
|
|
522
|
+
createFormPropContributors?: SaasCreateFormPropContributors;
|
|
523
|
+
/**
|
|
524
|
+
* Edit form prop contributors for customizing edit form fields
|
|
525
|
+
*/
|
|
526
|
+
editFormPropContributors?: SaasEditFormPropContributors;
|
|
527
|
+
}
|
|
528
|
+
|
|
108
529
|
/**
|
|
109
530
|
* SaaS Routes
|
|
110
531
|
* Translated from @volo/abp.ng.saas v0.7.2
|
|
@@ -118,40 +539,72 @@ declare const SAAS_ROUTES: {
|
|
|
118
539
|
};
|
|
119
540
|
|
|
120
541
|
/**
|
|
121
|
-
* SaaS
|
|
122
|
-
*
|
|
542
|
+
* SaaS Extensions Guard
|
|
543
|
+
* Translated from @volo/abp.ng.saas v3.0.0
|
|
123
544
|
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
|
|
127
|
-
declare const eSaasComponents: {
|
|
128
|
-
readonly Editions: "Saas.EditionsComponent";
|
|
129
|
-
readonly Tenants: "Saas.TenantsComponent";
|
|
130
|
-
};
|
|
131
|
-
/**
|
|
132
|
-
* Type for SaaS component key values
|
|
545
|
+
* Guard for protecting SaaS routes and ensuring extensions are loaded.
|
|
546
|
+
*
|
|
547
|
+
* @since 3.0.0
|
|
133
548
|
*/
|
|
134
|
-
type SaasComponentKey = (typeof eSaasComponents)[keyof typeof eSaasComponents];
|
|
135
|
-
|
|
136
549
|
/**
|
|
137
|
-
* SaaS
|
|
138
|
-
*
|
|
550
|
+
* SaaS extensions guard function
|
|
551
|
+
* Async guard function that can be used for route protection.
|
|
552
|
+
*
|
|
553
|
+
* @returns Promise<boolean> - True if navigation should proceed
|
|
554
|
+
* @since 3.0.0
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* ```tsx
|
|
558
|
+
* // In route configuration
|
|
559
|
+
* const canActivate = await saasExtensionsGuard();
|
|
560
|
+
* if (canActivate) {
|
|
561
|
+
* // Proceed with navigation
|
|
562
|
+
* }
|
|
563
|
+
* ```
|
|
139
564
|
*/
|
|
565
|
+
declare function saasExtensionsGuard(): Promise<boolean>;
|
|
140
566
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
567
|
+
* Hook for SaaS extensions guard state
|
|
568
|
+
* Provides reactive state for extension loading.
|
|
569
|
+
*
|
|
570
|
+
* @returns Object with isLoaded and loading state
|
|
571
|
+
* @since 3.0.0
|
|
572
|
+
*
|
|
573
|
+
* @example
|
|
574
|
+
* ```tsx
|
|
575
|
+
* function ProtectedRoute({ children }) {
|
|
576
|
+
* const { isLoaded, loading } = useSaasExtensionsGuard();
|
|
577
|
+
*
|
|
578
|
+
* if (loading) return <Loading />;
|
|
579
|
+
* if (!isLoaded) return <Navigate to="/unauthorized" />;
|
|
580
|
+
*
|
|
581
|
+
* return children;
|
|
582
|
+
* }
|
|
583
|
+
* ```
|
|
144
584
|
*/
|
|
145
|
-
declare
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
readonly Tenants: "Saas::Tenants";
|
|
149
|
-
readonly Editions: "Saas::Editions";
|
|
585
|
+
declare function useSaasExtensionsGuard(): {
|
|
586
|
+
isLoaded: boolean;
|
|
587
|
+
loading: boolean;
|
|
150
588
|
};
|
|
151
589
|
/**
|
|
152
|
-
*
|
|
590
|
+
* SaaS Extensions Guard class
|
|
591
|
+
* Class-based guard implementation for compatibility with Angular patterns.
|
|
592
|
+
*
|
|
593
|
+
* @since 3.0.0
|
|
594
|
+
*
|
|
595
|
+
* @example
|
|
596
|
+
* ```tsx
|
|
597
|
+
* const guard = new SaasExtensionsGuard();
|
|
598
|
+
* const canActivate = await guard.canActivate();
|
|
599
|
+
* ```
|
|
153
600
|
*/
|
|
154
|
-
|
|
601
|
+
declare class SaasExtensionsGuard {
|
|
602
|
+
/**
|
|
603
|
+
* Check if the route can be activated
|
|
604
|
+
* @returns Promise<boolean> - True if navigation should proceed
|
|
605
|
+
*/
|
|
606
|
+
canActivate(): Promise<boolean>;
|
|
607
|
+
}
|
|
155
608
|
|
|
156
609
|
/**
|
|
157
610
|
* SaaS Service
|
|
@@ -659,4 +1112,4 @@ interface EditionsComponentProps {
|
|
|
659
1112
|
*/
|
|
660
1113
|
declare function EditionsComponent({ onEditionCreated, onEditionUpdated, onEditionDeleted, onManageFeatures, }: EditionsComponentProps): react_jsx_runtime.JSX.Element;
|
|
661
1114
|
|
|
662
|
-
export { type EditionOperationResult, EditionsComponent, type EditionsComponentProps, SAAS_ROUTES, Saas, type SaasComponentKey, type SaasRouteNameKey, SaasService, SaasStateService, type SortOrder$1 as SortOrder, type TenantOperationResult, TenantsComponent, type TenantsComponentProps, type UseEditionsReturn, type UseTenantsReturn, eSaasComponents, eSaasRouteNames, useEditions, useTenants };
|
|
1115
|
+
export { type CreateFormPropContributorCallback, DEFAULT_EDITIONS_CREATE_FORM_PROPS, DEFAULT_EDITIONS_EDIT_FORM_PROPS, DEFAULT_EDITIONS_ENTITY_ACTIONS, DEFAULT_EDITIONS_ENTITY_PROPS, DEFAULT_EDITIONS_TOOLBAR_ACTIONS, DEFAULT_SAAS_CREATE_FORM_PROPS, DEFAULT_SAAS_EDIT_FORM_PROPS, DEFAULT_SAAS_ENTITY_ACTIONS, DEFAULT_SAAS_ENTITY_PROPS, DEFAULT_SAAS_TOOLBAR_ACTIONS, DEFAULT_TENANTS_CREATE_FORM_PROPS, DEFAULT_TENANTS_EDIT_FORM_PROPS, DEFAULT_TENANTS_ENTITY_ACTIONS, DEFAULT_TENANTS_ENTITY_PROPS, DEFAULT_TENANTS_TOOLBAR_ACTIONS, type EditFormPropContributorCallback, type EditionOperationResult, EditionsComponent, type EditionsComponentProps, type EntityAction, type EntityActionContributorCallback, type EntityProp, type EntityPropContributorCallback, type FormProp, SAAS_CREATE_FORM_PROP_CONTRIBUTORS, SAAS_EDIT_FORM_PROP_CONTRIBUTORS, SAAS_ENTITY_ACTION_CONTRIBUTORS, SAAS_ENTITY_PROP_CONTRIBUTORS, SAAS_ROUTES, SAAS_ROUTE_CONFIG, SAAS_ROUTE_PROVIDERS, SAAS_TOOLBAR_ACTION_CONTRIBUTORS, Saas, type SaasComponentKey, type SaasConfigOptions, type SaasCreateFormPropContributors, type SaasEditFormPropContributors, type SaasEntityActionContributors, type SaasEntityPropContributors, SaasExtensionsGuard, type SaasPolicyNameKey, type SaasRouteNameKey, SaasService, SaasStateService, type SaasToolbarActionContributors, type SortOrder$1 as SortOrder, type TenantOperationResult, TenantsComponent, type TenantsComponentProps, type ToolbarAction, type ToolbarActionContributorCallback, type UseEditionsReturn, type UseTenantsReturn, configureRoutes, eSaasComponents, eSaasPolicyNames, eSaasRouteNames, initializeSaasRoutes, saasExtensionsGuard, useEditions, useSaasExtensionsGuard, useTenants };
|