@cdx-extensions/di-sdk-web
v2.0.46
Published
Development harness for building web extensions locally - Part of Candescent Developer Experience (CDX)
Downloads
248
Readme
CDX Extensibility SDK - Web Harness
Part of the Candescent Developer Experience (CDX)
Published as @cdx-extensions/di-sdk-web. Mock implementation of the CDX Extensibility SDK for local development of web extensions. Same package name as the real web SDK; the registry (public npm vs JFrog) determines which implementation is installed.
Overview
The Web Harness provides a realistic development environment for building platform extensions without the full production platform. It includes:
- Mock user context data
- Simulated network delays
- Configurable API endpoints
- Branding/theming support
- Secure HTTP client with error simulation
This library is independent. Dependencies are resolved from JFrog when you run npm install in this folder. Build and publish from this directory.
Installation
npm install @cdx-extensions/di-sdk-web(When using public npm, consumers get this harness; when using Candescent JFrog, they get the real implementation.)
Usage
The harness exposes a Platform instance. Get it via WebPlatform.getInstance() and use its methods in your React components.
import {
getUserContext,
getConfig,
getBranding,
httpClient,
UserContext,
ExtensibilityConfig,
BrandingConfig,
} from '@cdx-extensions/di-sdk-web';
const platform = WebPlatform.getInstance();
// Get configuration
const config: ExtensibilityConfig = getConfig();
console.log(config.apiBaseUrl);
// Get branding
const branding: BrandingConfig = getBranding();
// Make API calls (use httpClient, not fetch directly)
const response = await httpClient.post('/api/agent/chat', {
message: 'Hello',
conversationId: 'conv-123',
});Development
From the repository root:
cd libs/public/extensibility-sdk-web-harness
npm install
npm run buildPublishing under development: To publish this lib while it is under development without affecting the main version, run from this directory: npm publish --tag development.
Production versions are updated when changes are merged to main (CI runs the publish workflow).
API Reference
getUserContext(): Promise<UserContext>— Returns mock user context.getConfig(): ExtensibilityConfig— Returns platform configuration (environment, API base URL, feature flags).getBranding(): BrandingConfig— Returns branding/theming configuration.httpClient— Secure HTTP client; use instead offetch(). Methods:get,post,put,patch,delete.
Mock Data
Customize mocks under src/mocks/ (e.g. userContext.json). Set API_BASE_URL environment variable to customize the API endpoint.
Documentation
License
ISC
CDX = Candescent Developer Experience
