@contractspec/lib.example-shared-ui 6.0.6 → 6.0.7
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/.turbo/turbo-build.log +90 -84
- package/AGENTS.md +43 -25
- package/README.md +63 -35
- package/dist/EvolutionDashboard.js +9 -9
- package/dist/EvolutionSidebar.js +15 -15
- package/dist/LocalDataIndicator.js +3 -3
- package/dist/MarkdownView.d.ts +0 -7
- package/dist/MarkdownView.js +76 -172
- package/dist/PersonalizationInsights.js +12 -12
- package/dist/SaveToStudioButton.js +2 -2
- package/dist/SpecDrivenTemplateShell.d.ts +1 -1
- package/dist/SpecDrivenTemplateShell.js +10 -10
- package/dist/SpecEditorPanel.js +3 -3
- package/dist/TemplateShell.js +10 -10
- package/dist/browser/EvolutionDashboard.js +9 -9
- package/dist/browser/EvolutionSidebar.js +15 -15
- package/dist/browser/LocalDataIndicator.js +3 -3
- package/dist/browser/MarkdownView.js +76 -172
- package/dist/browser/PersonalizationInsights.js +12 -12
- package/dist/browser/SaveToStudioButton.js +2 -2
- package/dist/browser/SpecDrivenTemplateShell.js +10 -10
- package/dist/browser/SpecEditorPanel.js +3 -3
- package/dist/browser/TemplateShell.js +10 -10
- package/dist/browser/hooks/index.js +29 -29
- package/dist/browser/index.js +193 -286
- package/dist/browser/lib/component-registry.js +1 -1
- package/dist/browser/markdown/formatPresentationName.js +9 -0
- package/dist/browser/markdown/useMarkdownPresentation.js +65 -0
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/index.js +29 -29
- package/dist/index.d.ts +12 -11
- package/dist/index.js +193 -286
- package/dist/lib/component-registry.js +1 -1
- package/dist/markdown/formatPresentationName.d.ts +1 -0
- package/dist/markdown/formatPresentationName.js +10 -0
- package/dist/markdown/useMarkdownPresentation.d.ts +21 -0
- package/dist/markdown/useMarkdownPresentation.js +66 -0
- package/dist/node/EvolutionDashboard.js +9 -9
- package/dist/node/EvolutionSidebar.js +15 -15
- package/dist/node/LocalDataIndicator.js +3 -3
- package/dist/node/MarkdownView.js +76 -172
- package/dist/node/PersonalizationInsights.js +12 -12
- package/dist/node/SaveToStudioButton.js +2 -2
- package/dist/node/SpecDrivenTemplateShell.js +10 -10
- package/dist/node/SpecEditorPanel.js +3 -3
- package/dist/node/TemplateShell.js +10 -10
- package/dist/node/hooks/index.js +29 -29
- package/dist/node/index.js +193 -286
- package/dist/node/lib/component-registry.js +1 -1
- package/dist/node/markdown/formatPresentationName.js +9 -0
- package/dist/node/markdown/useMarkdownPresentation.js +65 -0
- package/dist/utils/index.d.ts +1 -1
- package/package.json +38 -11
- package/src/EvolutionDashboard.tsx +415 -415
- package/src/EvolutionSidebar.tsx +245 -245
- package/src/LocalDataIndicator.tsx +28 -28
- package/src/MarkdownView.tsx +119 -372
- package/src/OverlayContextProvider.tsx +272 -272
- package/src/PersonalizationInsights.tsx +232 -232
- package/src/SaveToStudioButton.tsx +51 -51
- package/src/SpecDrivenTemplateShell.tsx +59 -59
- package/src/SpecEditorPanel.tsx +138 -138
- package/src/TemplateShell.tsx +50 -50
- package/src/bundles/ExampleTemplateBundle.ts +78 -78
- package/src/hooks/index.ts +3 -3
- package/src/hooks/useBehaviorTracking.ts +252 -252
- package/src/hooks/useEvolution.ts +437 -437
- package/src/hooks/useRegistryTemplates.ts +42 -42
- package/src/hooks/useSpecContent.ts +214 -214
- package/src/hooks/useWorkflowComposer.ts +567 -567
- package/src/index.ts +12 -11
- package/src/lib/component-registry.tsx +40 -40
- package/src/lib/runtime-context.tsx +31 -31
- package/src/lib/types.ts +57 -57
- package/src/markdown/formatPresentationName.ts +9 -0
- package/src/markdown/useMarkdownPresentation.ts +107 -0
- package/src/overlay-types.ts +15 -15
- package/src/utils/fetchPresentationData.ts +13 -13
- package/src/utils/generateSpecFromTemplate.ts +29 -29
- package/src/utils/index.ts +1 -1
- package/tsconfig.json +8 -8
package/src/index.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './SpecDrivenTemplateShell';
|
|
3
|
-
export * from './LocalDataIndicator';
|
|
4
|
-
export * from './SaveToStudioButton';
|
|
5
|
-
export * from './overlay-types';
|
|
6
|
-
export * from './MarkdownView';
|
|
7
|
-
export * from './SpecEditorPanel';
|
|
1
|
+
export { MarkdownRenderer } from '@contractspec/lib.design-system';
|
|
8
2
|
export * from './EvolutionDashboard';
|
|
9
3
|
export * from './EvolutionSidebar';
|
|
10
|
-
export * from './OverlayContextProvider';
|
|
11
|
-
export * from './PersonalizationInsights';
|
|
12
4
|
export * from './hooks';
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './lib/runtime-context';
|
|
5
|
+
export * from './LocalDataIndicator';
|
|
15
6
|
export * from './lib/component-registry';
|
|
7
|
+
export * from './lib/runtime-context';
|
|
16
8
|
export * from './lib/types';
|
|
9
|
+
export * from './MarkdownView';
|
|
10
|
+
export * from './OverlayContextProvider';
|
|
11
|
+
export * from './overlay-types';
|
|
12
|
+
export * from './PersonalizationInsights';
|
|
13
|
+
export * from './SaveToStudioButton';
|
|
14
|
+
export * from './SpecDrivenTemplateShell';
|
|
15
|
+
export * from './SpecEditorPanel';
|
|
16
|
+
export * from './TemplateShell';
|
|
17
|
+
export * from './utils';
|
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useEffect, useState } from 'react';
|
|
4
4
|
import type { TemplateId } from './types';
|
|
5
5
|
|
|
6
6
|
export interface TemplateComponentRegistration {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
list: React.ComponentType<any>; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
8
|
+
detail: React.ComponentType<any>; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
9
|
+
form?: React.ComponentType<any>; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export class TemplateComponentRegistry {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
private readonly components = new Map<
|
|
14
|
+
TemplateId,
|
|
15
|
+
TemplateComponentRegistration
|
|
16
|
+
>();
|
|
17
|
+
private readonly listeners = new Set<(templateId: TemplateId) => void>();
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
register(
|
|
20
|
+
templateId: TemplateId,
|
|
21
|
+
registration: TemplateComponentRegistration
|
|
22
|
+
) {
|
|
23
|
+
this.components.set(templateId, registration);
|
|
24
|
+
this.listeners.forEach((l) => l(templateId));
|
|
25
|
+
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
get(templateId: TemplateId) {
|
|
28
|
+
return this.components.get(templateId);
|
|
29
|
+
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
subscribe(listener: (templateId: TemplateId) => void) {
|
|
32
|
+
this.listeners.add(listener);
|
|
33
|
+
return () => {
|
|
34
|
+
this.listeners.delete(listener);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export const templateComponentRegistry = new TemplateComponentRegistry();
|
|
40
40
|
|
|
41
41
|
export function registerTemplateComponents(
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
templateId: TemplateId,
|
|
43
|
+
components: TemplateComponentRegistration
|
|
44
44
|
) {
|
|
45
|
-
|
|
45
|
+
templateComponentRegistry.register(templateId, components);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export function useTemplateComponents(
|
|
49
|
-
|
|
49
|
+
templateId: TemplateId
|
|
50
50
|
): TemplateComponentRegistration | undefined {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
const [components, setComponents] = useState(() =>
|
|
52
|
+
templateComponentRegistry.get(templateId)
|
|
53
|
+
);
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
return templateComponentRegistry.subscribe((updatedId) => {
|
|
57
|
+
if (updatedId === templateId) {
|
|
58
|
+
setComponents(templateComponentRegistry.get(templateId));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}, [templateId]);
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
return components;
|
|
64
64
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { createContext, useContext } from 'react';
|
|
4
3
|
import type { ApolloClient } from '@apollo/client';
|
|
5
4
|
import type { TransformEngine } from '@contractspec/lib.contracts-spec/presentations/transform-engine';
|
|
5
|
+
import { createContext, useContext } from 'react';
|
|
6
6
|
import type {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
TemplateDefinition,
|
|
8
|
+
TemplateId,
|
|
9
|
+
TemplateInstaller,
|
|
10
10
|
} from './types';
|
|
11
11
|
|
|
12
12
|
// Generic interface for handlers to avoid circular dependencies
|
|
@@ -14,41 +14,41 @@ import type {
|
|
|
14
14
|
export type GenericTemplateHandlers = unknown;
|
|
15
15
|
|
|
16
16
|
export interface TemplateRuntimeContextValue<
|
|
17
|
-
|
|
17
|
+
THandlers = GenericTemplateHandlers,
|
|
18
18
|
> {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
template: TemplateDefinition;
|
|
20
|
+
runtime: unknown; // LocalRuntimeServices
|
|
21
|
+
installer: TemplateInstaller;
|
|
22
|
+
client: ApolloClient;
|
|
23
|
+
components?: unknown; // TemplateComponentRegistration
|
|
24
|
+
/** @deprecated use template.id */
|
|
25
|
+
templateId: TemplateId;
|
|
26
|
+
projectId: string;
|
|
27
|
+
engine: TransformEngine;
|
|
28
|
+
fetchData: (
|
|
29
|
+
presentationName: string
|
|
30
|
+
) => Promise<{ data: unknown; metadata?: unknown }>;
|
|
31
|
+
handlers: THandlers;
|
|
32
|
+
resolvePresentation?: (presentationName: string) => unknown;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export const TemplateRuntimeContext =
|
|
36
|
-
|
|
36
|
+
createContext<TemplateRuntimeContextValue | null>(null);
|
|
37
37
|
|
|
38
38
|
export function useTemplateRuntime<
|
|
39
|
-
|
|
39
|
+
THandlers = GenericTemplateHandlers,
|
|
40
40
|
>(): TemplateRuntimeContextValue<THandlers> {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
const context = useContext(TemplateRuntimeContext);
|
|
42
|
+
if (!context) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
'useTemplateRuntime must be used within a TemplateRuntimeProvider'
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return context as TemplateRuntimeContextValue<THandlers>;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export interface TemplateRuntimeProviderProps {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
templateId: TemplateId;
|
|
52
|
+
projectId?: string;
|
|
53
|
+
lazy?: boolean;
|
|
54
54
|
}
|
package/src/lib/types.ts
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
1
|
export type TemplateId = string;
|
|
2
2
|
|
|
3
3
|
export type TemplateCategory =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
| 'productivity'
|
|
5
|
+
| 'communication'
|
|
6
|
+
| 'content'
|
|
7
|
+
| 'business'
|
|
8
|
+
| 'ai';
|
|
9
9
|
|
|
10
10
|
export type TemplateComplexity = 'beginner' | 'intermediate' | 'advanced';
|
|
11
11
|
|
|
12
12
|
export interface TemplateDefinition {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
13
|
+
id: TemplateId;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
category: TemplateCategory;
|
|
17
|
+
complexity: TemplateComplexity;
|
|
18
|
+
icon: string;
|
|
19
|
+
features: string[];
|
|
20
|
+
tags: string[];
|
|
21
|
+
schema: {
|
|
22
|
+
models: string[];
|
|
23
|
+
contracts: string[];
|
|
24
|
+
};
|
|
25
|
+
components: {
|
|
26
|
+
list: string;
|
|
27
|
+
detail: string;
|
|
28
|
+
form?: string;
|
|
29
|
+
dashboard?: string;
|
|
30
|
+
};
|
|
31
|
+
preview?: {
|
|
32
|
+
demoUrl?: string;
|
|
33
|
+
videoUrl?: string;
|
|
34
|
+
};
|
|
35
|
+
docs?: {
|
|
36
|
+
quickstart?: string;
|
|
37
|
+
reference?: string;
|
|
38
|
+
};
|
|
39
|
+
/** Package name for external examples that can be cloned via Git */
|
|
40
|
+
package?: string;
|
|
41
|
+
/** Whether this template uses the new cross-cutting modules */
|
|
42
|
+
usesModules?: string[];
|
|
43
|
+
/** Feature spec key from the example package */
|
|
44
|
+
featureSpec?: string;
|
|
45
|
+
/** List of presentation names available for this template */
|
|
46
|
+
presentations?: string[];
|
|
47
|
+
/** List of render targets supported (default: ['react']) */
|
|
48
|
+
renderTargets?: ('react' | 'markdown' | 'json' | 'xml')[];
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export interface TemplateFilter {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
category?: TemplateCategory;
|
|
53
|
+
complexity?: TemplateComplexity;
|
|
54
|
+
tag?: string;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export interface InstallTemplateOptions {
|
|
58
|
-
|
|
58
|
+
projectId?: string;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
export interface SaveTemplateOptions {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
endpoint?: string;
|
|
63
|
+
token?: string;
|
|
64
|
+
projectName: string;
|
|
65
|
+
organizationId: string;
|
|
66
|
+
templateId: TemplateId;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
export interface SaveTemplateResult {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
projectId: string;
|
|
71
|
+
status: string;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
/**
|
|
@@ -76,9 +76,9 @@ export interface SaveTemplateResult {
|
|
|
76
76
|
* Mirrors the public API of the implementation in @contractspec/module.examples
|
|
77
77
|
*/
|
|
78
78
|
export interface TemplateInstaller {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
install(
|
|
80
|
+
templateId: TemplateId,
|
|
81
|
+
options?: InstallTemplateOptions
|
|
82
|
+
): Promise<void>;
|
|
83
|
+
saveToStudio(options: SaveTemplateOptions): Promise<SaveTemplateResult>;
|
|
84
84
|
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { PresentationTarget } from '@contractspec/lib.contracts-spec/presentations';
|
|
4
|
+
import type { TransformEngine } from '@contractspec/lib.contracts-spec/presentations/transform-engine';
|
|
5
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
interface MarkdownOutput {
|
|
8
|
+
mimeType: string;
|
|
9
|
+
body: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface UseMarkdownPresentationOptions {
|
|
13
|
+
engine?: TransformEngine | null;
|
|
14
|
+
fetchData: (presentationId: string) => Promise<{ data: unknown }>;
|
|
15
|
+
presentationId?: string;
|
|
16
|
+
presentations: string[];
|
|
17
|
+
resolvePresentation?: (presentationId: string) => unknown;
|
|
18
|
+
templateId?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface UseMarkdownPresentationResult {
|
|
22
|
+
error: Error | null;
|
|
23
|
+
loading: boolean;
|
|
24
|
+
markdownContent: string;
|
|
25
|
+
renderMarkdown: () => Promise<void>;
|
|
26
|
+
selectedPresentation: string;
|
|
27
|
+
setSelectedPresentation: (presentationId: string) => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function useMarkdownPresentation({
|
|
31
|
+
engine,
|
|
32
|
+
fetchData,
|
|
33
|
+
presentationId,
|
|
34
|
+
presentations,
|
|
35
|
+
resolvePresentation,
|
|
36
|
+
templateId,
|
|
37
|
+
}: UseMarkdownPresentationOptions): UseMarkdownPresentationResult {
|
|
38
|
+
const [selectedPresentation, setSelectedPresentation] = useState<string>('');
|
|
39
|
+
const [markdownContent, setMarkdownContent] = useState<string>('');
|
|
40
|
+
const [loading, setLoading] = useState(false);
|
|
41
|
+
const [error, setError] = useState<Error | null>(null);
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (presentationId && presentations.includes(presentationId)) {
|
|
45
|
+
setSelectedPresentation(presentationId);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (presentations.length === 0) {
|
|
50
|
+
setSelectedPresentation('');
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!presentations.includes(selectedPresentation)) {
|
|
55
|
+
setSelectedPresentation(presentations[0] ?? '');
|
|
56
|
+
}
|
|
57
|
+
}, [presentationId, presentations, selectedPresentation, templateId]);
|
|
58
|
+
|
|
59
|
+
const renderMarkdown = useCallback(async () => {
|
|
60
|
+
if (!selectedPresentation || !engine) return;
|
|
61
|
+
|
|
62
|
+
setLoading(true);
|
|
63
|
+
setError(null);
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
if (!resolvePresentation) {
|
|
67
|
+
throw new Error('resolvePresentation not available in runtime context');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const descriptor = resolvePresentation(selectedPresentation);
|
|
71
|
+
|
|
72
|
+
if (!descriptor) {
|
|
73
|
+
throw new Error(
|
|
74
|
+
`Presentation descriptor not found: ${selectedPresentation}`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const dataResult = await fetchData(selectedPresentation);
|
|
79
|
+
const result = await engine.render<MarkdownOutput>(
|
|
80
|
+
'markdown' as PresentationTarget,
|
|
81
|
+
descriptor as Parameters<TransformEngine['render']>[1],
|
|
82
|
+
{ data: dataResult.data }
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
setMarkdownContent(result.body);
|
|
86
|
+
} catch (err) {
|
|
87
|
+
setError(
|
|
88
|
+
err instanceof Error ? err : new Error('Failed to render markdown')
|
|
89
|
+
);
|
|
90
|
+
} finally {
|
|
91
|
+
setLoading(false);
|
|
92
|
+
}
|
|
93
|
+
}, [engine, fetchData, resolvePresentation, selectedPresentation]);
|
|
94
|
+
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
void renderMarkdown();
|
|
97
|
+
}, [renderMarkdown]);
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
error,
|
|
101
|
+
loading,
|
|
102
|
+
markdownContent,
|
|
103
|
+
renderMarkdown,
|
|
104
|
+
selectedPresentation,
|
|
105
|
+
setSelectedPresentation,
|
|
106
|
+
};
|
|
107
|
+
}
|
package/src/overlay-types.ts
CHANGED
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export interface OverlayDefinition {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
overlayId: string;
|
|
9
|
+
version: string;
|
|
10
|
+
description: string;
|
|
11
|
+
appliesTo: {
|
|
12
|
+
presentation?: string;
|
|
13
|
+
role?: string;
|
|
14
|
+
feature?: string;
|
|
15
|
+
tier?: string;
|
|
16
|
+
};
|
|
17
|
+
modifications: OverlayModification[];
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export type OverlayModification =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
| { type: 'hideField'; field: string; reason?: string }
|
|
22
|
+
| { type: 'renameLabel'; field: string; newLabel: string }
|
|
23
|
+
| { type: 'addBadge'; position: string; label: string; variant?: string }
|
|
24
|
+
| { type: 'setDefault'; field: string; value: unknown }
|
|
25
|
+
| { type: 'setLimit'; field: string; max: number; message?: string };
|
|
@@ -10,12 +10,12 @@ import type { TemplateId } from '../lib/types';
|
|
|
10
10
|
* Data fetcher result type
|
|
11
11
|
*/
|
|
12
12
|
export interface PresentationDataResult {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
data: unknown;
|
|
14
|
+
metadata?: {
|
|
15
|
+
total?: number;
|
|
16
|
+
timestamp?: Date;
|
|
17
|
+
source?: string;
|
|
18
|
+
};
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -25,24 +25,24 @@ export interface PresentationDataResult {
|
|
|
25
25
|
* @deprecated Use fetchData from TemplateRuntimeContext instead.
|
|
26
26
|
*/
|
|
27
27
|
export async function fetchPresentationData(
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
_presentationName: string,
|
|
29
|
+
_templateId: TemplateId
|
|
30
30
|
): Promise<PresentationDataResult> {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
throw new Error(
|
|
32
|
+
'fetchPresentationData is deprecated. Use fetchData from TemplateRuntimeContext.'
|
|
33
|
+
);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* @deprecated
|
|
38
38
|
*/
|
|
39
39
|
export function hasPresentationDataFetcher(_presentationName: string): boolean {
|
|
40
|
-
|
|
40
|
+
return false;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* @deprecated
|
|
45
45
|
*/
|
|
46
46
|
export function getRegisteredPresentationFetchers(): string[] {
|
|
47
|
-
|
|
47
|
+
return [];
|
|
48
48
|
}
|