@zoiq.io/dev-kit 0.1.0 → 0.1.2
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/README.md +5 -5
- package/dist/client.d.mts +120 -0
- package/dist/client.d.ts +120 -0
- package/dist/client.js +453 -0
- package/dist/client.js.map +1 -0
- package/dist/client.mjs +436 -0
- package/dist/client.mjs.map +1 -0
- package/dist/index.d.mts +6 -234
- package/dist/index.d.ts +6 -234
- package/dist/index.js +114 -203
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +112 -191
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +24 -0
- package/dist/server.d.ts +24 -0
- package/dist/server.js +22 -0
- package/dist/server.js.map +1 -0
- package/dist/server.mjs +20 -0
- package/dist/server.mjs.map +1 -0
- package/dist/types-DaSMeWe9.d.mts +151 -0
- package/dist/types-DaSMeWe9.d.ts +151 -0
- package/dist/useZOIQEntity-CfY8Ag40.d.ts +46 -0
- package/dist/useZOIQEntity-Cv9WBq8W.d.mts +46 -0
- package/package.json +14 -3
package/dist/server.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/server.ts
|
|
2
|
+
async function getProjectSettingsServer(projectKey, baseUrl) {
|
|
3
|
+
if (!projectKey?.trim() || !baseUrl?.trim()) return null;
|
|
4
|
+
const url = `${baseUrl.replace(/\/$/, "")}/api/zoiq/project/${encodeURIComponent(projectKey)}`;
|
|
5
|
+
try {
|
|
6
|
+
const res = await fetch(url, {
|
|
7
|
+
cache: "no-store",
|
|
8
|
+
headers: { Accept: "application/json" }
|
|
9
|
+
});
|
|
10
|
+
if (!res.ok) return null;
|
|
11
|
+
const data = await res.json();
|
|
12
|
+
return data;
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { getProjectSettingsServer };
|
|
19
|
+
//# sourceMappingURL=server.mjs.map
|
|
20
|
+
//# sourceMappingURL=server.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server.ts"],"names":[],"mappings":";AAoBA,eAAsB,wBAAA,CACpB,YACA,OAAA,EACiC;AACjC,EAAA,IAAI,CAAC,YAAY,IAAA,EAAK,IAAK,CAAC,OAAA,EAAS,IAAA,IAAQ,OAAO,IAAA;AAEpD,EAAA,MAAM,GAAA,GAAM,CAAA,EAAG,OAAA,CAAQ,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAC,CAAA,kBAAA,EAAqB,kBAAA,CAAmB,UAAU,CAAC,CAAA,CAAA;AAE5F,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,MAAM,KAAA,CAAM,GAAA,EAAK;AAAA,MAC3B,KAAA,EAAO,UAAA;AAAA,MACP,OAAA,EAAS,EAAE,MAAA,EAAQ,kBAAA;AAAmB,KACvC,CAAA;AACD,IAAA,IAAI,CAAC,GAAA,CAAI,EAAA,EAAI,OAAO,IAAA;AACpB,IAAA,MAAM,IAAA,GAAQ,MAAM,GAAA,CAAI,IAAA,EAAK;AAC7B,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"server.mjs","sourcesContent":["/**\n * Server-only: load project settings for ZOIQ (styleGuide, branding, definedColors, etc.).\n * Use in Next.js Server Components, layout, or Route Handlers. Requires baseUrl (no window on server).\n *\n * @example\n * // In a Server Component or layout\n * import { getProjectSettingsServer } from '@zoiq.io/dev-kit/server'\n * const baseUrl = process.env.NEXT_PUBLIC_ZOIQ_API_BASE_URL || 'https://your-portal.com'\n * const settings = await getProjectSettingsServer(projectKey, baseUrl)\n */\nimport type { ProjectSettings } from './context/types'\n\n/**\n * Load project settings on the server by fetching from the ZOIQ project config API.\n * Use in Next.js Server Components, getServerSideProps, or Route Handlers.\n *\n * @param projectKey - Project ID or public API key\n * @param baseUrl - Base URL of the portal (e.g. https://your-portal.com). No trailing slash.\n * @returns ProjectSettings or null if not found / request failed\n */\nexport async function getProjectSettingsServer(\n projectKey: string,\n baseUrl: string,\n): Promise<ProjectSettings | null> {\n if (!projectKey?.trim() || !baseUrl?.trim()) return null\n\n const url = `${baseUrl.replace(/\\/$/, '')}/api/zoiq/project/${encodeURIComponent(projectKey)}`\n\n try {\n const res = await fetch(url, {\n cache: 'no-store',\n headers: { Accept: 'application/json' },\n })\n if (!res.ok) return null\n const data = (await res.json()) as ProjectSettings\n return data\n } catch {\n return null\n }\n}\n\nexport type { ProjectSettings } from './context/types'\n"]}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
type ProjectStyleGuide = {
|
|
2
|
+
__typename: "ProjectStyleGuide";
|
|
3
|
+
background?: string | null;
|
|
4
|
+
foreground?: string | null;
|
|
5
|
+
card?: string | null;
|
|
6
|
+
cardForeground?: string | null;
|
|
7
|
+
popover?: string | null;
|
|
8
|
+
popoverForeground?: string | null;
|
|
9
|
+
primary?: string | null;
|
|
10
|
+
primaryForeground?: string | null;
|
|
11
|
+
secondary?: string | null;
|
|
12
|
+
secondaryForeground?: string | null;
|
|
13
|
+
muted?: string | null;
|
|
14
|
+
mutedForeground?: string | null;
|
|
15
|
+
accent?: string | null;
|
|
16
|
+
accentForeground?: string | null;
|
|
17
|
+
destructive?: string | null;
|
|
18
|
+
destructiveForeground?: string | null;
|
|
19
|
+
border?: string | null;
|
|
20
|
+
input?: string | null;
|
|
21
|
+
ring?: string | null;
|
|
22
|
+
chart1?: string | null;
|
|
23
|
+
chart2?: string | null;
|
|
24
|
+
chart3?: string | null;
|
|
25
|
+
chart4?: string | null;
|
|
26
|
+
chart5?: string | null;
|
|
27
|
+
sidebar?: string | null;
|
|
28
|
+
sidebarForeground?: string | null;
|
|
29
|
+
sidebarPrimary?: string | null;
|
|
30
|
+
sidebarPrimaryForeground?: string | null;
|
|
31
|
+
sidebarAccent?: string | null;
|
|
32
|
+
sidebarAccentForeground?: string | null;
|
|
33
|
+
sidebarBorder?: string | null;
|
|
34
|
+
sidebarBorderDescription?: string | null;
|
|
35
|
+
sidebarRing?: string | null;
|
|
36
|
+
fontPrimary?: StyleGuideFont | null;
|
|
37
|
+
fontSecondary?: StyleGuideFont | null;
|
|
38
|
+
fontTertiary?: StyleGuideFont | null;
|
|
39
|
+
radius?: string | null;
|
|
40
|
+
trackingNormal?: string | null;
|
|
41
|
+
spacing?: string | null;
|
|
42
|
+
shadow2xs?: string | null;
|
|
43
|
+
shadowXs?: string | null;
|
|
44
|
+
shadowSm?: string | null;
|
|
45
|
+
shadow?: string | null;
|
|
46
|
+
shadowMd?: string | null;
|
|
47
|
+
shadowLg?: string | null;
|
|
48
|
+
shadowXl?: string | null;
|
|
49
|
+
shadow2xl?: string | null;
|
|
50
|
+
variables?: Array<Variable | null> | null;
|
|
51
|
+
};
|
|
52
|
+
type StyleGuideFont = {
|
|
53
|
+
__typename: "StyleGuideFont";
|
|
54
|
+
url: string;
|
|
55
|
+
name: string;
|
|
56
|
+
};
|
|
57
|
+
type Variable = {
|
|
58
|
+
__typename: "Variable";
|
|
59
|
+
key: string;
|
|
60
|
+
default?: boolean | null;
|
|
61
|
+
value: string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Project theme/settings shape returned by the config API and consumed by ZOIQProvider.
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
interface ProjectSettings {
|
|
70
|
+
styleGuide?: ProjectStyleGuide;
|
|
71
|
+
branding?: {
|
|
72
|
+
navbarLogo?: {
|
|
73
|
+
fileID?: string | null;
|
|
74
|
+
link?: string | null;
|
|
75
|
+
} | null;
|
|
76
|
+
footerLogo?: {
|
|
77
|
+
fileID?: string | null;
|
|
78
|
+
link?: string | null;
|
|
79
|
+
} | null;
|
|
80
|
+
loaderLogo?: {
|
|
81
|
+
fileID?: string | null;
|
|
82
|
+
link?: string | null;
|
|
83
|
+
} | null;
|
|
84
|
+
faviconLogo?: {
|
|
85
|
+
fileID?: string | null;
|
|
86
|
+
link?: string | null;
|
|
87
|
+
} | null;
|
|
88
|
+
authImage?: {
|
|
89
|
+
fileID?: string | null;
|
|
90
|
+
link?: string | null;
|
|
91
|
+
} | null;
|
|
92
|
+
customLogos?: Array<{
|
|
93
|
+
name: string;
|
|
94
|
+
description?: string | null;
|
|
95
|
+
fileID?: string | null;
|
|
96
|
+
link?: string | null;
|
|
97
|
+
} | null> | null;
|
|
98
|
+
primaryFont?: {
|
|
99
|
+
name?: string | null;
|
|
100
|
+
link?: string | null;
|
|
101
|
+
} | null;
|
|
102
|
+
secondaryFont?: {
|
|
103
|
+
name?: string | null;
|
|
104
|
+
link?: string | null;
|
|
105
|
+
} | null;
|
|
106
|
+
tertiaryFont?: {
|
|
107
|
+
name?: string | null;
|
|
108
|
+
link?: string | null;
|
|
109
|
+
} | null;
|
|
110
|
+
} | null;
|
|
111
|
+
definedColors?: Array<{
|
|
112
|
+
id: string;
|
|
113
|
+
name: string;
|
|
114
|
+
value: string;
|
|
115
|
+
} | null> | null;
|
|
116
|
+
clientDefinedColors?: Array<{
|
|
117
|
+
name: string;
|
|
118
|
+
description?: string | null;
|
|
119
|
+
definedColor?: {
|
|
120
|
+
name: string;
|
|
121
|
+
value: string;
|
|
122
|
+
} | null;
|
|
123
|
+
} | null> | null;
|
|
124
|
+
navbarSettings?: {
|
|
125
|
+
isSticky?: boolean | null;
|
|
126
|
+
fontSize?: string | null;
|
|
127
|
+
alignment?: string | null;
|
|
128
|
+
logoSize?: string | null;
|
|
129
|
+
navbarType?: string | null;
|
|
130
|
+
gutters?: string | null;
|
|
131
|
+
subCategoryAnimation?: string | null;
|
|
132
|
+
} | null;
|
|
133
|
+
/** API key for fetching project/DynamoDB data from the API (stored in project dynamo as zoiqApiKey). */
|
|
134
|
+
apiKey?: string | null;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Section flag: enabled/disabled per section ID.
|
|
138
|
+
*/
|
|
139
|
+
interface SectionFlag {
|
|
140
|
+
id: string;
|
|
141
|
+
enabled: boolean;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Response shape for section flags API.
|
|
145
|
+
*/
|
|
146
|
+
interface SectionFlagsData {
|
|
147
|
+
enabledIds: string[];
|
|
148
|
+
disabledIds: string[];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export type { ProjectSettings as P, SectionFlag as S, SectionFlagsData as a };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
type ProjectStyleGuide = {
|
|
2
|
+
__typename: "ProjectStyleGuide";
|
|
3
|
+
background?: string | null;
|
|
4
|
+
foreground?: string | null;
|
|
5
|
+
card?: string | null;
|
|
6
|
+
cardForeground?: string | null;
|
|
7
|
+
popover?: string | null;
|
|
8
|
+
popoverForeground?: string | null;
|
|
9
|
+
primary?: string | null;
|
|
10
|
+
primaryForeground?: string | null;
|
|
11
|
+
secondary?: string | null;
|
|
12
|
+
secondaryForeground?: string | null;
|
|
13
|
+
muted?: string | null;
|
|
14
|
+
mutedForeground?: string | null;
|
|
15
|
+
accent?: string | null;
|
|
16
|
+
accentForeground?: string | null;
|
|
17
|
+
destructive?: string | null;
|
|
18
|
+
destructiveForeground?: string | null;
|
|
19
|
+
border?: string | null;
|
|
20
|
+
input?: string | null;
|
|
21
|
+
ring?: string | null;
|
|
22
|
+
chart1?: string | null;
|
|
23
|
+
chart2?: string | null;
|
|
24
|
+
chart3?: string | null;
|
|
25
|
+
chart4?: string | null;
|
|
26
|
+
chart5?: string | null;
|
|
27
|
+
sidebar?: string | null;
|
|
28
|
+
sidebarForeground?: string | null;
|
|
29
|
+
sidebarPrimary?: string | null;
|
|
30
|
+
sidebarPrimaryForeground?: string | null;
|
|
31
|
+
sidebarAccent?: string | null;
|
|
32
|
+
sidebarAccentForeground?: string | null;
|
|
33
|
+
sidebarBorder?: string | null;
|
|
34
|
+
sidebarBorderDescription?: string | null;
|
|
35
|
+
sidebarRing?: string | null;
|
|
36
|
+
fontPrimary?: StyleGuideFont | null;
|
|
37
|
+
fontSecondary?: StyleGuideFont | null;
|
|
38
|
+
fontTertiary?: StyleGuideFont | null;
|
|
39
|
+
radius?: string | null;
|
|
40
|
+
trackingNormal?: string | null;
|
|
41
|
+
spacing?: string | null;
|
|
42
|
+
shadow2xs?: string | null;
|
|
43
|
+
shadowXs?: string | null;
|
|
44
|
+
shadowSm?: string | null;
|
|
45
|
+
shadow?: string | null;
|
|
46
|
+
shadowMd?: string | null;
|
|
47
|
+
shadowLg?: string | null;
|
|
48
|
+
shadowXl?: string | null;
|
|
49
|
+
shadow2xl?: string | null;
|
|
50
|
+
variables?: Array<Variable | null> | null;
|
|
51
|
+
};
|
|
52
|
+
type StyleGuideFont = {
|
|
53
|
+
__typename: "StyleGuideFont";
|
|
54
|
+
url: string;
|
|
55
|
+
name: string;
|
|
56
|
+
};
|
|
57
|
+
type Variable = {
|
|
58
|
+
__typename: "Variable";
|
|
59
|
+
key: string;
|
|
60
|
+
default?: boolean | null;
|
|
61
|
+
value: string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Project theme/settings shape returned by the config API and consumed by ZOIQProvider.
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
interface ProjectSettings {
|
|
70
|
+
styleGuide?: ProjectStyleGuide;
|
|
71
|
+
branding?: {
|
|
72
|
+
navbarLogo?: {
|
|
73
|
+
fileID?: string | null;
|
|
74
|
+
link?: string | null;
|
|
75
|
+
} | null;
|
|
76
|
+
footerLogo?: {
|
|
77
|
+
fileID?: string | null;
|
|
78
|
+
link?: string | null;
|
|
79
|
+
} | null;
|
|
80
|
+
loaderLogo?: {
|
|
81
|
+
fileID?: string | null;
|
|
82
|
+
link?: string | null;
|
|
83
|
+
} | null;
|
|
84
|
+
faviconLogo?: {
|
|
85
|
+
fileID?: string | null;
|
|
86
|
+
link?: string | null;
|
|
87
|
+
} | null;
|
|
88
|
+
authImage?: {
|
|
89
|
+
fileID?: string | null;
|
|
90
|
+
link?: string | null;
|
|
91
|
+
} | null;
|
|
92
|
+
customLogos?: Array<{
|
|
93
|
+
name: string;
|
|
94
|
+
description?: string | null;
|
|
95
|
+
fileID?: string | null;
|
|
96
|
+
link?: string | null;
|
|
97
|
+
} | null> | null;
|
|
98
|
+
primaryFont?: {
|
|
99
|
+
name?: string | null;
|
|
100
|
+
link?: string | null;
|
|
101
|
+
} | null;
|
|
102
|
+
secondaryFont?: {
|
|
103
|
+
name?: string | null;
|
|
104
|
+
link?: string | null;
|
|
105
|
+
} | null;
|
|
106
|
+
tertiaryFont?: {
|
|
107
|
+
name?: string | null;
|
|
108
|
+
link?: string | null;
|
|
109
|
+
} | null;
|
|
110
|
+
} | null;
|
|
111
|
+
definedColors?: Array<{
|
|
112
|
+
id: string;
|
|
113
|
+
name: string;
|
|
114
|
+
value: string;
|
|
115
|
+
} | null> | null;
|
|
116
|
+
clientDefinedColors?: Array<{
|
|
117
|
+
name: string;
|
|
118
|
+
description?: string | null;
|
|
119
|
+
definedColor?: {
|
|
120
|
+
name: string;
|
|
121
|
+
value: string;
|
|
122
|
+
} | null;
|
|
123
|
+
} | null> | null;
|
|
124
|
+
navbarSettings?: {
|
|
125
|
+
isSticky?: boolean | null;
|
|
126
|
+
fontSize?: string | null;
|
|
127
|
+
alignment?: string | null;
|
|
128
|
+
logoSize?: string | null;
|
|
129
|
+
navbarType?: string | null;
|
|
130
|
+
gutters?: string | null;
|
|
131
|
+
subCategoryAnimation?: string | null;
|
|
132
|
+
} | null;
|
|
133
|
+
/** API key for fetching project/DynamoDB data from the API (stored in project dynamo as zoiqApiKey). */
|
|
134
|
+
apiKey?: string | null;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Section flag: enabled/disabled per section ID.
|
|
138
|
+
*/
|
|
139
|
+
interface SectionFlag {
|
|
140
|
+
id: string;
|
|
141
|
+
enabled: boolean;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Response shape for section flags API.
|
|
145
|
+
*/
|
|
146
|
+
interface SectionFlagsData {
|
|
147
|
+
enabledIds: string[];
|
|
148
|
+
disabledIds: string[];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export type { ProjectSettings as P, SectionFlag as S, SectionFlagsData as a };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { P as ProjectSettings } from './types-DaSMeWe9.js';
|
|
4
|
+
|
|
5
|
+
interface ZOIQProviderProps {
|
|
6
|
+
/** Project key (e.g. project ID or public API key) to fetch theme and config */
|
|
7
|
+
projectKey: string;
|
|
8
|
+
/** Base URL for the project config API (e.g. https://your-portal.com/api/zoiq) */
|
|
9
|
+
/** Optional custom fetcher; if provided, apiBaseUrl is ignored for config fetch */
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
interface ZOIQContextValue {
|
|
13
|
+
projectKey: string;
|
|
14
|
+
apiBaseUrl?: string;
|
|
15
|
+
settings: ProjectSettings | null;
|
|
16
|
+
loading: boolean;
|
|
17
|
+
error: Error | null;
|
|
18
|
+
refetch: () => Promise<void>;
|
|
19
|
+
branding: ProjectSettings['branding'] | null;
|
|
20
|
+
}
|
|
21
|
+
declare function ZOIQProvider({ projectKey, children }: ZOIQProviderProps): react_jsx_runtime.JSX.Element;
|
|
22
|
+
declare function useZOIQContext(): ZOIQContextValue | null;
|
|
23
|
+
declare function useZOIQBranding(): ZOIQContextValue['branding'] | null;
|
|
24
|
+
declare function useStyleGuide(): ProjectSettings['styleGuide'] | null;
|
|
25
|
+
|
|
26
|
+
interface UseZOIQEntityOptions {
|
|
27
|
+
id?: string;
|
|
28
|
+
query?: Record<string, string>;
|
|
29
|
+
}
|
|
30
|
+
interface UseZOIQEntityResult<T> {
|
|
31
|
+
data: T | null;
|
|
32
|
+
loading: boolean;
|
|
33
|
+
error: Error | null;
|
|
34
|
+
refetch: () => Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Fetches custom entity data for the current project.
|
|
38
|
+
* Must be used within ZOIQProvider.
|
|
39
|
+
*
|
|
40
|
+
* For entities with REFERENCE fields (e.g. events with a partner field pointing to partners),
|
|
41
|
+
* the API expands the field value so the id is replaced with the full referenced record:
|
|
42
|
+
* e.g. events → { id, partner: { id, name, ... }, ...other event values }.
|
|
43
|
+
*/
|
|
44
|
+
declare function useZOIQEntity<T = unknown>(entity: string, options?: UseZOIQEntityOptions): UseZOIQEntityResult<T>;
|
|
45
|
+
|
|
46
|
+
export { ZOIQProvider as Z, useZOIQEntity as a, useStyleGuide as b, useZOIQBranding as c, useZOIQContext as u };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { P as ProjectSettings } from './types-DaSMeWe9.mjs';
|
|
4
|
+
|
|
5
|
+
interface ZOIQProviderProps {
|
|
6
|
+
/** Project key (e.g. project ID or public API key) to fetch theme and config */
|
|
7
|
+
projectKey: string;
|
|
8
|
+
/** Base URL for the project config API (e.g. https://your-portal.com/api/zoiq) */
|
|
9
|
+
/** Optional custom fetcher; if provided, apiBaseUrl is ignored for config fetch */
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
interface ZOIQContextValue {
|
|
13
|
+
projectKey: string;
|
|
14
|
+
apiBaseUrl?: string;
|
|
15
|
+
settings: ProjectSettings | null;
|
|
16
|
+
loading: boolean;
|
|
17
|
+
error: Error | null;
|
|
18
|
+
refetch: () => Promise<void>;
|
|
19
|
+
branding: ProjectSettings['branding'] | null;
|
|
20
|
+
}
|
|
21
|
+
declare function ZOIQProvider({ projectKey, children }: ZOIQProviderProps): react_jsx_runtime.JSX.Element;
|
|
22
|
+
declare function useZOIQContext(): ZOIQContextValue | null;
|
|
23
|
+
declare function useZOIQBranding(): ZOIQContextValue['branding'] | null;
|
|
24
|
+
declare function useStyleGuide(): ProjectSettings['styleGuide'] | null;
|
|
25
|
+
|
|
26
|
+
interface UseZOIQEntityOptions {
|
|
27
|
+
id?: string;
|
|
28
|
+
query?: Record<string, string>;
|
|
29
|
+
}
|
|
30
|
+
interface UseZOIQEntityResult<T> {
|
|
31
|
+
data: T | null;
|
|
32
|
+
loading: boolean;
|
|
33
|
+
error: Error | null;
|
|
34
|
+
refetch: () => Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Fetches custom entity data for the current project.
|
|
38
|
+
* Must be used within ZOIQProvider.
|
|
39
|
+
*
|
|
40
|
+
* For entities with REFERENCE fields (e.g. events with a partner field pointing to partners),
|
|
41
|
+
* the API expands the field value so the id is replaced with the full referenced record:
|
|
42
|
+
* e.g. events → { id, partner: { id, name, ... }, ...other event values }.
|
|
43
|
+
*/
|
|
44
|
+
declare function useZOIQEntity<T = unknown>(entity: string, options?: UseZOIQEntityOptions): UseZOIQEntityResult<T>;
|
|
45
|
+
|
|
46
|
+
export { ZOIQProvider as Z, useZOIQEntity as a, useStyleGuide as b, useZOIQBranding as c, useZOIQContext as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zoiq.io/dev-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "ZOIQ - React component library and framework with project-key-driven theme, hooks, and UI primitives",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,6 +11,16 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"import": "./dist/index.mjs",
|
|
13
13
|
"require": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./client": {
|
|
16
|
+
"types": "./dist/client.d.ts",
|
|
17
|
+
"import": "./dist/client.mjs",
|
|
18
|
+
"require": "./dist/client.js"
|
|
19
|
+
},
|
|
20
|
+
"./server": {
|
|
21
|
+
"types": "./dist/server.d.ts",
|
|
22
|
+
"import": "./dist/server.mjs",
|
|
23
|
+
"require": "./dist/server.js"
|
|
14
24
|
}
|
|
15
25
|
},
|
|
16
26
|
"files": [
|
|
@@ -18,7 +28,7 @@
|
|
|
18
28
|
"README.md"
|
|
19
29
|
],
|
|
20
30
|
"scripts": {
|
|
21
|
-
"build": "tsup",
|
|
31
|
+
"build": "tsup && node scripts/add-use-client.js",
|
|
22
32
|
"dev": "tsup --watch"
|
|
23
33
|
},
|
|
24
34
|
"peerDependencies": {
|
|
@@ -27,7 +37,8 @@
|
|
|
27
37
|
},
|
|
28
38
|
"dependencies": {
|
|
29
39
|
"clsx": "^2.1.1",
|
|
30
|
-
"tailwind-merge": "^3.
|
|
40
|
+
"tailwind-merge": "^3.5.0",
|
|
41
|
+
"tailwindcss": "^4.1.18"
|
|
31
42
|
},
|
|
32
43
|
"devDependencies": {
|
|
33
44
|
"@types/react": "^19.0.0",
|