umwd-components 0.1.836 → 0.1.838
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/cjs/src/components/common/module-config/ModuleGuard.js +7 -0
- package/dist/cjs/src/index.js +1 -1
- package/dist/cjs/src/lib/module-config/config.js +6 -0
- package/dist/cjs/src/lib/module-config/navigation-filter.js +6 -0
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/common/module-config/ModuleGuard.js +39 -0
- package/dist/esm/src/index.js +3 -0
- package/dist/esm/src/lib/module-config/config.js +231 -0
- package/dist/esm/src/lib/module-config/navigation-filter.js +58 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/components/common/module-config/ModuleGuard.d.ts +22 -0
- package/dist/esm/types/index.d.ts +4 -0
- package/dist/esm/types/lib/module-config/config.d.ts +33 -0
- package/dist/esm/types/lib/module-config/navigation-filter.d.ts +10 -0
- package/dist/esm/types/types/module-config/types.d.ts +20 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ModuleName } from "../../../types/module-config/types";
|
|
3
|
+
interface ModuleGuardProps {
|
|
4
|
+
module: ModuleName;
|
|
5
|
+
feature?: string;
|
|
6
|
+
fallback?: React.ReactNode;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Component that conditionally renders children based on module/feature enablement
|
|
11
|
+
*/
|
|
12
|
+
export declare function ModuleGuard({ module, feature, fallback, children, }: ModuleGuardProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
interface ConditionalModuleProps {
|
|
14
|
+
module: ModuleName;
|
|
15
|
+
feature?: string;
|
|
16
|
+
children: (isEnabled: boolean) => React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Render prop component that provides module/feature status to children
|
|
20
|
+
*/
|
|
21
|
+
export declare function ConditionalModule({ module, feature, children, }: ConditionalModuleProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -257,3 +257,7 @@ export { MinioItemList as MinioItemList } from "./components/common/media/minio/
|
|
|
257
257
|
export { MinioDisplay as MinioDisplay } from "./components/common/media/minio/MinioDisplay";
|
|
258
258
|
export { contactFormAction as contactFormAction } from "./data/actions/e-commerce/lead/contactFormAction";
|
|
259
259
|
export { ShippingStatusIndicator as ShippingStatusIndicator } from "./components/e-commerce/opo/ShippingStatusIndicator";
|
|
260
|
+
export { getModuleConfig as getModuleConfig, isModuleEnabled as isModuleEnabled, isModuleFeatureEnabled as isModuleFeatureEnabled, getFullConfig as getFullConfig, getEnabledModules as getEnabledModules, validateCurrentConfig as validateCurrentConfig, clearConfigCache as clearConfigCache, getConfigFilePath as getConfigFilePath, } from "./lib/module-config/config";
|
|
261
|
+
export { filterNavigationByModules as filterNavigationByModules } from "./lib/module-config/navigation-filter";
|
|
262
|
+
export { ModuleGuard as ModuleGuard, ConditionalModule as ConditionalModule, } from "./components/common/module-config/ModuleGuard";
|
|
263
|
+
export type { UMWDConfig, UMWDModuleConfig, ModuleName, ConfigValidationError, ConfigValidationResult, } from "./types/module-config/types";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { UMWDConfig, ModuleName, ConfigValidationResult } from "../../types/module-config/types";
|
|
2
|
+
/**
|
|
3
|
+
* Get the configuration for a specific module
|
|
4
|
+
*/
|
|
5
|
+
export declare function getModuleConfig(moduleName: ModuleName): UMWDConfig["modules"][ModuleName];
|
|
6
|
+
/**
|
|
7
|
+
* Check if a specific module is enabled
|
|
8
|
+
*/
|
|
9
|
+
export declare function isModuleEnabled(moduleName: ModuleName): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Check if a specific feature within a module is enabled
|
|
12
|
+
*/
|
|
13
|
+
export declare function isModuleFeatureEnabled(moduleName: ModuleName, featureName: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Get the full configuration object
|
|
16
|
+
*/
|
|
17
|
+
export declare function getFullConfig(): UMWDConfig;
|
|
18
|
+
/**
|
|
19
|
+
* Get all enabled modules
|
|
20
|
+
*/
|
|
21
|
+
export declare function getEnabledModules(): ModuleName[];
|
|
22
|
+
/**
|
|
23
|
+
* Validate the current configuration without throwing
|
|
24
|
+
*/
|
|
25
|
+
export declare function validateCurrentConfig(): ConfigValidationResult;
|
|
26
|
+
/**
|
|
27
|
+
* Clear the configuration cache (useful for testing or dynamic config reloading)
|
|
28
|
+
*/
|
|
29
|
+
export declare function clearConfigCache(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Get the path to the configuration file (useful for debugging)
|
|
32
|
+
*/
|
|
33
|
+
export declare function getConfigFilePath(): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface NavigationItem {
|
|
2
|
+
href?: string;
|
|
3
|
+
label?: string;
|
|
4
|
+
children?: NavigationItem[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Filter navigation items based on enabled modules and features
|
|
8
|
+
*/
|
|
9
|
+
export declare function filterNavigationByModules(navigation: NavigationItem[]): NavigationItem[];
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface UMWDModuleConfig {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
features?: Record<string, boolean>;
|
|
4
|
+
}
|
|
5
|
+
export interface UMWDConfig {
|
|
6
|
+
modules: {
|
|
7
|
+
pageBuilder: UMWDModuleConfig;
|
|
8
|
+
ecommerce: UMWDModuleConfig;
|
|
9
|
+
logistics?: UMWDModuleConfig;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export type ModuleName = keyof UMWDConfig["modules"];
|
|
13
|
+
export interface ConfigValidationError {
|
|
14
|
+
field: string;
|
|
15
|
+
message: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ConfigValidationResult {
|
|
18
|
+
isValid: boolean;
|
|
19
|
+
errors: ConfigValidationError[];
|
|
20
|
+
}
|