@skylabs-digital/react-identity-access 2.13.0 → 2.14.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/components/ZoneRoute.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +1011 -962
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/providers/RoutingProvider.d.ts +56 -0
- package/dist/providers/RoutingProvider.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { RoutingConfig, ZoneRoots, ZonePresets, ZonePresetConfig, AccessDeniedReason, ReturnToStorage } from '../types/zoneRouting';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Context value provided by RoutingProvider
|
|
6
|
+
*/
|
|
7
|
+
export interface RoutingContextValue {
|
|
8
|
+
zoneRoots: Required<ZoneRoots>;
|
|
9
|
+
presets: ZonePresets;
|
|
10
|
+
loadingFallback: ReactNode;
|
|
11
|
+
accessDeniedFallback: ReactNode;
|
|
12
|
+
onAccessDenied?: (reason: AccessDeniedReason) => void;
|
|
13
|
+
returnToParam: string;
|
|
14
|
+
returnToStorage: ReturnToStorage;
|
|
15
|
+
}
|
|
16
|
+
export interface RoutingProviderProps {
|
|
17
|
+
config?: RoutingConfig;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* RoutingProvider - Global configuration for zone-based routing
|
|
22
|
+
*
|
|
23
|
+
* Provides default redirect paths, presets, and fallbacks that ZoneRoute
|
|
24
|
+
* components will use. Can be customized per-application.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <RoutingProvider config={{
|
|
29
|
+
* zoneRoots: {
|
|
30
|
+
* tenantGuest: '/auth/login',
|
|
31
|
+
* tenantUser: '/app/dashboard',
|
|
32
|
+
* tenantAdmin: '/admin',
|
|
33
|
+
* },
|
|
34
|
+
* loadingFallback: <Spinner />,
|
|
35
|
+
* onAccessDenied: (reason) => console.log('Access denied:', reason),
|
|
36
|
+
* }}>
|
|
37
|
+
* <App />
|
|
38
|
+
* </RoutingProvider>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function RoutingProvider({ config, children }: RoutingProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* Hook to access routing configuration
|
|
44
|
+
* @throws Error if used outside RoutingProvider
|
|
45
|
+
*/
|
|
46
|
+
export declare function useRouting(): RoutingContextValue;
|
|
47
|
+
/**
|
|
48
|
+
* Optional hook that returns RoutingContext if available, defaults otherwise.
|
|
49
|
+
* Useful for ZoneRoute which should work with or without RoutingProvider.
|
|
50
|
+
*/
|
|
51
|
+
export declare function useRoutingOptional(): RoutingContextValue;
|
|
52
|
+
/**
|
|
53
|
+
* Get a specific preset configuration
|
|
54
|
+
*/
|
|
55
|
+
export declare function useZonePreset(presetName: keyof ZonePresets | string): ZonePresetConfig | undefined;
|
|
56
|
+
//# sourceMappingURL=RoutingProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoutingProvider.d.ts","sourceRoot":"","sources":["../../src/providers/RoutingProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAW,MAAM,OAAO,CAAC;AACtE,OAAO,EACL,aAAa,EACb,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAGhB,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,eAAe,EAAE,SAAS,CAAC;IAC3B,oBAAoB,EAAE,SAAS,CAAC;IAChC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACtD,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,eAAe,CAAC;CAClC;AAID,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,EAAE,MAAW,EAAE,QAAQ,EAAE,EAAE,oBAAoB,2CAyB9E;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,mBAAmB,CAMhD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,mBAAmB,CAiBxD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,MAAM,WAAW,GAAG,MAAM,GACrC,gBAAgB,GAAG,SAAS,CAG9B"}
|