@zoiq.io/dev-kit 0.1.0 → 0.1.1

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/index.js CHANGED
@@ -1,34 +1,22 @@
1
+ "use client";
1
2
  'use strict';
2
3
 
3
4
  var react = require('react');
4
5
  var jsxRuntime = require('react/jsx-runtime');
5
- var clsx = require('clsx');
6
- var tailwindMerge = require('tailwind-merge');
7
-
8
- // src/context/ZOIQProvider.tsx
9
6
 
10
7
  // src/api/client.ts
11
- async function fetchProjectConfig(projectKey, apiBaseUrl) {
12
- const base = apiBaseUrl ?? (typeof window !== "undefined" ? window.location.origin : "");
8
+ async function fetchProjectConfig(projectKey, apiBaseUrl2) {
9
+ const base = apiBaseUrl2 ?? (typeof window !== "undefined" ? window.location.origin : "");
13
10
  const url = `${base.replace(/\/$/, "")}/api/zoiq/project/${encodeURIComponent(projectKey)}`;
14
- const res = await fetch(url);
11
+ const res = await fetch(url, { credentials: "include" });
15
12
  if (!res.ok) {
16
13
  throw new Error(`Failed to fetch project config: ${res.status} ${res.statusText}`);
17
14
  }
18
15
  const data = await res.json();
19
16
  return data;
20
17
  }
21
- async function fetchSectionFlags(projectKey, apiBaseUrl) {
22
- const base = apiBaseUrl ?? (typeof window !== "undefined" ? window.location.origin : "");
23
- const url = `${base.replace(/\/$/, "")}/api/zoiq/project/${encodeURIComponent(projectKey)}/sections`;
24
- const res = await fetch(url);
25
- if (!res.ok) {
26
- throw new Error(`Failed to fetch section flags: ${res.status} ${res.statusText}`);
27
- }
28
- return res.json();
29
- }
30
- async function fetchEntityData(projectKey, entity, options, apiBaseUrl) {
31
- const base = apiBaseUrl ?? (typeof window !== "undefined" ? window.location.origin : "");
18
+ async function fetchEntityData(projectKey, entity, options, apiBaseUrl2) {
19
+ const base = apiBaseUrl2 ?? (typeof window !== "undefined" ? window.location.origin : "");
32
20
  const params = new URLSearchParams();
33
21
  if (options.id) params.set("id", options.id);
34
22
  if (options.query) {
@@ -36,7 +24,9 @@ async function fetchEntityData(projectKey, entity, options, apiBaseUrl) {
36
24
  }
37
25
  const qs = params.toString();
38
26
  const url = `${base.replace(/\/$/, "")}/api/zoiq/project/${encodeURIComponent(projectKey)}/data/${encodeURIComponent(entity)}${qs ? `?${qs}` : ""}`;
39
- const res = await fetch(url);
27
+ const headers = {};
28
+ if (options.apiKey) headers["x-api-key"] = options.apiKey;
29
+ const res = await fetch(url, { credentials: "include", headers: Object.keys(headers).length ? headers : void 0 });
40
30
  if (!res.ok) {
41
31
  throw new Error(`Failed to fetch entity ${entity}: ${res.status} ${res.statusText}`);
42
32
  }
@@ -63,6 +53,11 @@ var STYLE_GUIDE_TO_CSS_VAR = {
63
53
  border: "--border",
64
54
  input: "--input",
65
55
  ring: "--ring",
56
+ chart1: "--chart-1",
57
+ chart2: "--chart-2",
58
+ chart3: "--chart-3",
59
+ chart4: "--chart-4",
60
+ chart5: "--chart-5",
66
61
  sidebar: "--sidebar",
67
62
  sidebarForeground: "--sidebar-foreground",
68
63
  sidebarPrimary: "--sidebar-primary",
@@ -70,23 +65,35 @@ var STYLE_GUIDE_TO_CSS_VAR = {
70
65
  sidebarAccent: "--sidebar-accent",
71
66
  sidebarAccentForeground: "--sidebar-accent-foreground",
72
67
  sidebarBorder: "--sidebar-border",
68
+ sidebarRing: "--sidebar-ring",
73
69
  radius: "--radius"
74
70
  };
71
+ var ZOIQ_THEME_STYLE_ID = "zoiq-theme-override";
72
+ function toTailwindHsl(value) {
73
+ if (!value || typeof value !== "string") return value;
74
+ const trimmed = value.trim();
75
+ return trimmed.replace(/,/g, " ");
76
+ }
75
77
  function applyTheme(settings) {
76
78
  if (typeof document === "undefined") return;
77
79
  const root = document.documentElement;
80
+ const declarations = [];
78
81
  if (settings.styleGuide && typeof settings.styleGuide === "object") {
79
82
  for (const [key, value] of Object.entries(settings.styleGuide)) {
80
83
  if (value == null || value === "") continue;
81
84
  const cssVar = STYLE_GUIDE_TO_CSS_VAR[key] ?? `--${key}`;
82
- root.style.setProperty(cssVar, value);
85
+ const normalized = typeof value === "string" && /^\s*[\d.-]+\s*,/.test(value) ? toTailwindHsl(value) : value;
86
+ declarations.push(`${cssVar}: ${normalized};`);
87
+ root.style.setProperty(cssVar, normalized);
83
88
  }
84
89
  }
85
90
  if (settings.definedColors?.length) {
86
91
  for (const color of settings.definedColors) {
87
92
  if (!color?.name || !color?.value) continue;
88
93
  const varName = `--color-${color.name.replace(/\s+/g, "-").toLowerCase()}`;
89
- root.style.setProperty(varName, color.value);
94
+ const normalized = /^\s*[\d.-]+\s*,/.test(color.value) ? toTailwindHsl(color.value) : color.value;
95
+ declarations.push(`${varName}: ${normalized};`);
96
+ root.style.setProperty(varName, normalized);
90
97
  }
91
98
  }
92
99
  if (settings.clientDefinedColors?.length) {
@@ -95,9 +102,27 @@ function applyTheme(settings) {
95
102
  const name = item?.name;
96
103
  if (!name || !value) continue;
97
104
  const varName = `--${name.replace(/\s+/g, "-").toLowerCase()}`;
98
- root.style.setProperty(varName, value);
105
+ const normalized = /^\s*[\d.-]+\s*,/.test(value) ? toTailwindHsl(value) : value;
106
+ declarations.push(`${varName}: ${normalized};`);
107
+ root.style.setProperty(varName, normalized);
99
108
  }
100
109
  }
110
+ if (declarations.length > 0) {
111
+ const css = `:root {
112
+ ${declarations.join("\n ")}
113
+ }
114
+ .dark {
115
+ ${declarations.join("\n ")}
116
+ }
117
+ `;
118
+ let styleEl = document.getElementById(ZOIQ_THEME_STYLE_ID);
119
+ if (!styleEl) {
120
+ styleEl = document.createElement("style");
121
+ styleEl.id = ZOIQ_THEME_STYLE_ID;
122
+ document.head.appendChild(styleEl);
123
+ }
124
+ styleEl.textContent = css;
125
+ }
101
126
  const branding = settings.branding;
102
127
  if (branding?.primaryFont?.link || branding?.secondaryFont?.link || branding?.tertiaryFont?.link) {
103
128
  const fontLinks = [];
@@ -118,12 +143,8 @@ function applyTheme(settings) {
118
143
  }
119
144
  }
120
145
  var ZOIQContext = react.createContext(null);
121
- function ZOIQProvider({
122
- projectKey,
123
- apiBaseUrl,
124
- fetchProjectConfig: customFetch,
125
- children
126
- }) {
146
+ var apiBaseUrl = process.env.NEXT_PUBLIC_ZOIQ_API_BASE_URL || "https://portal.zoiq.io";
147
+ function ZOIQProvider({ projectKey, children }) {
127
148
  const [settings, setSettings] = react.useState(null);
128
149
  const [loading, setLoading] = react.useState(true);
129
150
  const [error, setError] = react.useState(null);
@@ -135,95 +156,80 @@ function ZOIQProvider({
135
156
  setLoading(true);
136
157
  setError(null);
137
158
  try {
138
- const data = customFetch ? await customFetch(projectKey) : await fetchProjectConfig(projectKey, apiBaseUrl);
159
+ const data = await fetchProjectConfig(projectKey, apiBaseUrl);
139
160
  setSettings(data ?? null);
140
- if (data) {
141
- applyTheme(data);
142
- }
143
161
  } catch (err) {
144
162
  setError(err instanceof Error ? err : new Error(String(err)));
145
163
  setSettings(null);
146
164
  } finally {
147
165
  setLoading(false);
148
166
  }
149
- }, [projectKey, apiBaseUrl, customFetch]);
167
+ }, [projectKey]);
168
+ react.useEffect(() => {
169
+ if (!projectKey || typeof window === "undefined") return;
170
+ const params = new URLSearchParams(window.location.search);
171
+ const isPreview = params.get("preview") === "true";
172
+ const previewUrl = params.get("previewUrl");
173
+ if (!isPreview) {
174
+ fetchAndApply();
175
+ return;
176
+ }
177
+ const applyPayload = (payload) => {
178
+ setSettings(payload);
179
+ setError(null);
180
+ setLoading(false);
181
+ };
182
+ if (!previewUrl || !previewUrl.trim()) {
183
+ fetchAndApply();
184
+ return;
185
+ }
186
+ const url = previewUrl.trim();
187
+ let cancelled = false;
188
+ fetch(url, { credentials: "omit" }).then((res) => {
189
+ if (cancelled) return;
190
+ if (!res.ok) throw new Error(res.statusText || "Failed to load preview");
191
+ return res.json();
192
+ }).then((data) => {
193
+ if (cancelled) return;
194
+ applyPayload(data);
195
+ }).catch((err) => {
196
+ if (cancelled) return;
197
+ setError(err instanceof Error ? err : new Error(String(err)));
198
+ setSettings(null);
199
+ setLoading(false);
200
+ });
201
+ return () => {
202
+ cancelled = true;
203
+ };
204
+ }, [projectKey, fetchAndApply]);
150
205
  react.useEffect(() => {
151
- fetchAndApply();
152
- }, [fetchAndApply]);
206
+ if (settings) {
207
+ applyTheme(settings);
208
+ }
209
+ }, [settings]);
153
210
  const value = {
154
211
  projectKey,
155
- apiBaseUrl,
156
212
  settings,
157
213
  loading,
158
214
  error,
215
+ branding: settings?.branding,
216
+ apiBaseUrl,
159
217
  refetch: fetchAndApply
160
218
  };
161
- return /* @__PURE__ */ jsxRuntime.jsx(ZOIQContext.Provider, { value, children });
219
+ return /* @__PURE__ */ jsxRuntime.jsx(ZOIQContext.Provider, { value, children: loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Loading..." }) : children });
162
220
  }
163
221
  function useZOIQContext() {
164
222
  return react.useContext(ZOIQContext);
165
223
  }
166
-
167
- // src/hooks/useProjectSettings.ts
168
- function useProjectSettings() {
224
+ function useZOIQBranding() {
169
225
  const ctx = useZOIQContext();
170
- if (!ctx) {
171
- return {
172
- data: null,
173
- loading: false,
174
- error: new Error("useProjectSettings must be used within ZOIQProvider"),
175
- refetch: async () => {
176
- }
177
- };
178
- }
179
- return {
180
- data: ctx.settings,
181
- loading: ctx.loading,
182
- error: ctx.error,
183
- refetch: ctx.refetch
184
- };
226
+ return ctx?.branding ?? null;
185
227
  }
186
- function useSectionFlags() {
228
+ function useStyleGuide() {
187
229
  const ctx = useZOIQContext();
188
- const [enabledIds, setEnabledIds] = react.useState(/* @__PURE__ */ new Set());
189
- const [disabledIds, setDisabledIds] = react.useState(/* @__PURE__ */ new Set());
190
- const [loading, setLoading] = react.useState(true);
191
- const [error, setError] = react.useState(null);
192
- const fetch2 = react.useCallback(async () => {
193
- if (!ctx?.projectKey) {
194
- setLoading(false);
195
- return;
196
- }
197
- setLoading(true);
198
- setError(null);
199
- try {
200
- const data = await fetchSectionFlags(ctx.projectKey, ctx.apiBaseUrl);
201
- setEnabledIds(new Set(data.enabledIds ?? []));
202
- setDisabledIds(new Set(data.disabledIds ?? []));
203
- } catch (err) {
204
- setError(err instanceof Error ? err : new Error(String(err)));
205
- setEnabledIds(/* @__PURE__ */ new Set());
206
- setDisabledIds(/* @__PURE__ */ new Set());
207
- } finally {
208
- setLoading(false);
209
- }
210
- }, [ctx?.projectKey, ctx?.apiBaseUrl]);
211
- react.useEffect(() => {
212
- fetch2();
213
- }, [fetch2]);
214
- if (!ctx) {
215
- return {
216
- enabledIds: /* @__PURE__ */ new Set(),
217
- disabledIds: /* @__PURE__ */ new Set(),
218
- loading: false,
219
- error: new Error("useSectionFlags must be used within ZOIQProvider"),
220
- refetch: async () => {
221
- }
222
- };
223
- }
224
- return { enabledIds, disabledIds, loading, error, refetch: fetch2 };
230
+ return ctx?.settings?.styleGuide ?? null;
225
231
  }
226
- function useZOIQApi(entity, options = {}) {
232
+ function useZOIQEntity(entity, options = {}) {
227
233
  const ctx = useZOIQContext();
228
234
  const [data, setData] = react.useState(null);
229
235
  const [loading, setLoading] = react.useState(true);
@@ -239,7 +245,11 @@ function useZOIQApi(entity, options = {}) {
239
245
  const result = await fetchEntityData(
240
246
  ctx.projectKey,
241
247
  entity,
242
- { id: options.id, query: options.query },
248
+ {
249
+ id: options.id,
250
+ query: options.query,
251
+ apiKey: ctx.settings?.apiKey ?? void 0
252
+ },
243
253
  ctx.apiBaseUrl
244
254
  );
245
255
  setData(result);
@@ -257,123 +267,24 @@ function useZOIQApi(entity, options = {}) {
257
267
  return {
258
268
  data: null,
259
269
  loading: false,
260
- error: new Error("useZOIQApi must be used within ZOIQProvider"),
270
+ error: new Error("useZOIQEntity must be used within ZOIQProvider"),
261
271
  refetch: async () => {
262
272
  }
263
273
  };
264
274
  }
265
275
  return { data, loading, error, refetch: fetch2 };
266
276
  }
267
- function cn(...inputs) {
268
- return tailwindMerge.twMerge(clsx.clsx(inputs));
269
- }
270
- var Text = ({
271
- children,
272
- className,
273
- as: As = "span",
274
- ...props
275
- }) => {
276
- return /* @__PURE__ */ jsxRuntime.jsx(As, { className: cn("text-[var(--text-primary,#111)]", className), ...props, children });
277
- };
278
- var Title = ({ children, className }) => {
279
- return /* @__PURE__ */ jsxRuntime.jsx(
280
- "h1",
281
- {
282
- className: cn(
283
- "text-2xl md:text-3xl mb-0 font-semibold text-pretty text-[var(--text-primary,#111)]",
284
- className
285
- ),
286
- children
287
- }
288
- );
289
- };
290
- var Subtitle = ({ children, className }) => {
291
- return /* @__PURE__ */ jsxRuntime.jsx(Text, { as: "div", className: cn("text-sm md:text-base text-[var(--text-secondary,#666)]", className), children });
292
- };
293
- var ScrollButton = ({ className, threshold = 200 }) => {
294
- const [isVisible, setIsVisible] = react.useState(false);
295
- react.useEffect(() => {
296
- const onScroll = () => setIsVisible(typeof window !== "undefined" ? window.scrollY > threshold : false);
297
- window.addEventListener("scroll", onScroll, { passive: true });
298
- onScroll();
299
- return () => window.removeEventListener("scroll", onScroll);
300
- }, [threshold]);
301
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("fixed bottom-10 right-10 z-50 hidden md:block", className), children: /* @__PURE__ */ jsxRuntime.jsx(
302
- "button",
303
- {
304
- type: "button",
305
- className: cn(
306
- "rounded-full p-2 cursor-pointer shadow-lg transition-all duration-300",
307
- "bg-[var(--primary,hsl(220,70%,50%))] text-[var(--primary-foreground,#fff)]",
308
- isVisible ? "opacity-100" : "opacity-0 pointer-events-none"
309
- ),
310
- onClick: () => window.scrollTo({ top: 0, behavior: "smooth" }),
311
- "aria-label": "Scroll to top",
312
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block w-6 h-6", "aria-hidden": true, children: "\u2191" })
313
- }
314
- ) });
315
- };
316
- var ToggleTheme = ({ className, onToggle, theme, children }) => {
317
- return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onToggle, className: cn(className), "aria-label": `Toggle theme (current: ${theme ?? "unknown"})`, children: children ?? "Theme" });
318
- };
319
- var Section = ({ children, className }) => {
320
- return /* @__PURE__ */ jsxRuntime.jsx("section", { className: cn("max-w-7xl mx-auto w-full px-8 md:px-0 pt-12 md:pt-24 pb-12 md:pb-24", className), children });
321
- };
322
277
 
323
- // src/components/molecules/ToastContainer.tsx
324
- var ToastContainer = () => {
325
- return null;
326
- };
327
- var Page = ({ children, className, fullWidth }) => {
328
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full flex-1 flex flex-col min-h-screen", className), children: /* @__PURE__ */ jsxRuntime.jsx("main", { className: cn("w-full flex-1 flex flex-col", fullWidth ? "px-0" : "px-4 md:px-8"), children }) });
329
- };
330
- var Header = ({ children, className, left, right }) => {
331
- return /* @__PURE__ */ jsxRuntime.jsx(
332
- "header",
333
- {
334
- className: cn(
335
- "w-full h-14 sticky top-0 z-50 border-b border-[var(--border,transparent)]",
336
- "bg-[var(--sidebar,var(--background))]",
337
- className
338
- ),
339
- children: /* @__PURE__ */ jsxRuntime.jsxs("nav", { className: "flex h-full w-full items-center justify-between gap-4 px-4 md:px-6", "aria-label": "Main", children: [
340
- left != null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-3", children: left }) : null,
341
- children,
342
- right != null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-3", children: right }) : null
343
- ] })
344
- }
345
- );
346
- };
347
- var Footer = ({ children, className }) => {
348
- return /* @__PURE__ */ jsxRuntime.jsx("footer", { className: cn("w-full border-t border-[var(--border,transparent)] py-6 px-4 md:px-8", className), children });
349
- };
350
- var SecondarySidebar = ({ items, className, isActive, renderLink }) => {
351
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-4", className), children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "flex p-1 rounded-lg bg-[var(--accent,#f4f4f5)] border border-[var(--border,#e4e4e7)] w-full justify-between gap-4", children: items.map((item) => {
352
- const active = isActive?.(item) ?? false;
353
- const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
354
- item.icon,
355
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
356
- ] });
357
- const child = renderLink ? renderLink(item, content) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: item.href, className: cn("flex items-center justify-center gap-2 text-center h-8 w-full rounded-md text-sm font-medium transition-colors", active ? "bg-[var(--sidebar-accent,var(--accent))] text-[var(--foreground)]" : "text-[var(--muted-foreground,#71717a)]"), children: content });
358
- return /* @__PURE__ */ jsxRuntime.jsx("li", { className: "w-full", children: child }, item.href);
359
- }) }) });
360
- };
278
+ // src/utils/test.ts
279
+ function test() {
280
+ console.log("test!");
281
+ }
361
282
 
362
- exports.Footer = Footer;
363
- exports.Header = Header;
364
- exports.Page = Page;
365
- exports.ScrollButton = ScrollButton;
366
- exports.SecondarySidebar = SecondarySidebar;
367
- exports.Section = Section;
368
- exports.Subtitle = Subtitle;
369
- exports.Text = Text;
370
- exports.Title = Title;
371
- exports.ToastContainer = ToastContainer;
372
- exports.ToggleTheme = ToggleTheme;
373
283
  exports.ZOIQProvider = ZOIQProvider;
374
- exports.useProjectSettings = useProjectSettings;
375
- exports.useSectionFlags = useSectionFlags;
376
- exports.useZOIQApi = useZOIQApi;
284
+ exports.test = test;
285
+ exports.useStyleGuide = useStyleGuide;
286
+ exports.useZOIQBranding = useZOIQBranding;
377
287
  exports.useZOIQContext = useZOIQContext;
288
+ exports.useZOIQEntity = useZOIQEntity;
378
289
  //# sourceMappingURL=index.js.map
379
290
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/client.ts","../src/theme/applyTheme.ts","../src/context/ZOIQProvider.tsx","../src/hooks/useProjectSettings.ts","../src/hooks/useSectionFlags.ts","../src/hooks/useZOIQApi.ts","../src/utils/cn.ts","../src/components/atoms/Text.tsx","../src/components/atoms/Title.tsx","../src/components/atoms/Subtitle.tsx","../src/components/atoms/ScrollButton.tsx","../src/components/atoms/ToggleTheme.tsx","../src/components/molecules/Section.tsx","../src/components/molecules/ToastContainer.tsx","../src/components/layout/Page.tsx","../src/components/layout/Header.tsx","../src/components/layout/Footer.tsx","../src/components/layout/SecondarySidebar.tsx"],"names":["createContext","useState","useCallback","useEffect","jsx","useContext","fetch","twMerge","clsx","jsxs","Fragment"],"mappings":";;;;;;;;;;AAMA,eAAsB,kBAAA,CACpB,YACA,UAAA,EACiC;AACjC,EAAA,MAAM,OAAO,UAAA,KAAe,OAAO,WAAW,WAAA,GAAc,MAAA,CAAO,SAAS,MAAA,GAAS,EAAA,CAAA;AACrF,EAAA,MAAM,GAAA,GAAM,CAAA,EAAG,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAC,CAAA,kBAAA,EAAqB,kBAAA,CAAmB,UAAU,CAAC,CAAA,CAAA;AACzF,EAAA,MAAM,GAAA,GAAM,MAAM,KAAA,CAAM,GAAG,CAAA;AAC3B,EAAA,IAAI,CAAC,IAAI,EAAA,EAAI;AACX,IAAA,MAAM,IAAI,MAAM,CAAA,gCAAA,EAAmC,GAAA,CAAI,MAAM,CAAA,CAAA,EAAI,GAAA,CAAI,UAAU,CAAA,CAAE,CAAA;AAAA,EACnF;AACA,EAAA,MAAM,IAAA,GAAQ,MAAM,GAAA,CAAI,IAAA,EAAK;AAC7B,EAAA,OAAO,IAAA;AACT;AAKA,eAAsB,iBAAA,CACpB,YACA,UAAA,EAC0D;AAC1D,EAAA,MAAM,OAAO,UAAA,KAAe,OAAO,WAAW,WAAA,GAAc,MAAA,CAAO,SAAS,MAAA,GAAS,EAAA,CAAA;AACrF,EAAA,MAAM,GAAA,GAAM,CAAA,EAAG,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAC,CAAA,kBAAA,EAAqB,kBAAA,CAAmB,UAAU,CAAC,CAAA,SAAA,CAAA;AACzF,EAAA,MAAM,GAAA,GAAM,MAAM,KAAA,CAAM,GAAG,CAAA;AAC3B,EAAA,IAAI,CAAC,IAAI,EAAA,EAAI;AACX,IAAA,MAAM,IAAI,MAAM,CAA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CAAC,EAAE,OAAO,SAAA,EAAW,QAAA,EAAU,YAAW,KAA6B;AACrG,EAAA,uBACEA,cAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,EAAA,CAAG,QAAQ,SAAS,CAAA,EAClC,QAAA,kBAAAA,cAAAA,CAAC,QAAG,SAAA,EAAU,mHAAA,EACX,QAAA,EAAA,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,KAAS;AACnB,IAAA,MAAM,MAAA,GAAS,QAAA,GAAW,IAAI,CAAA,IAAK,KAAA;AACnC,IAAA,MAAM,OAAA,mBACJK,eAAAA,CAAAC,mBAAA,EAAA,EACG,QAAA,EAAA;AAAA,MAAA,IAAA,CAAK,IAAA;AAAA,sBACNN,cAAAA,CAAC,MAAA,EAAA,EAAM,QAAA,EAAA,IAAA,CAAK,KAAA,EAAM;AAAA,KAAA,EACpB,CAAA;AAEF,IAAA,MAAM,QAAQ,UAAA,GACZ,UAAA,CAAW,MAAM,OAAO,CAAA,mBAExBA,cAAAA,CAAC,GAAA,EAAA,EAAE,MAAM,IAAA,CAAK,IAAA,EAAM,WAAW,EAAA,CAAG,gHAAA,EAAkH,SAAS,mEAAA,GAAsE,wCAAwC,GACxQ,QAAA,EAAA,OAAA,EACH,CAAA;AAEF,IAAA,uBACEA,cAAAA,CAAC,IAAA,EAAA,EAAmB,WAAU,QAAA,EAC3B,QAAA,EAAA,KAAA,EAAA,EADM,KAAK,IAEd,CAAA;AAAA,EAEJ,CAAC,GACH,CAAA,EACF,CAAA;AAEJ","file":"index.js","sourcesContent":["import type { ProjectSettings } from '../context/types'\n\n/**\n * Default fetch for project config. Calls GET {apiBaseUrl}/project/{projectKey}\n * and expects JSON matching ProjectSettings.\n */\nexport async function fetchProjectConfig(\n projectKey: string,\n apiBaseUrl?: string\n): Promise<ProjectSettings | null> {\n const base = apiBaseUrl ?? (typeof window !== 'undefined' ? window.location.origin : '')\n const url = `${base.replace(/\\/$/, '')}/api/zoiq/project/${encodeURIComponent(projectKey)}`\n const res = await fetch(url)\n if (!res.ok) {\n throw new Error(`Failed to fetch project config: ${res.status} ${res.statusText}`)\n }\n const data = (await res.json()) as ProjectSettings\n return data\n}\n\n/**\n * Fetch section flags for the project. Calls GET {apiBaseUrl}/project/{projectKey}/sections\n */\nexport async function fetchSectionFlags(\n projectKey: string,\n apiBaseUrl?: string\n): Promise<{ enabledIds: string[]; disabledIds: string[] }> {\n const base = apiBaseUrl ?? (typeof window !== 'undefined' ? window.location.origin : '')\n const url = `${base.replace(/\\/$/, '')}/api/zoiq/project/${encodeURIComponent(projectKey)}/sections`\n const res = await fetch(url)\n if (!res.ok) {\n throw new Error(`Failed to fetch section flags: ${res.status} ${res.statusText}`)\n }\n return res.json() as Promise<{ enabledIds: string[]; disabledIds: string[] }>\n}\n\n/**\n * Fetch entity data for the project. Calls GET {apiBaseUrl}/project/{projectKey}/data/{entity}?id=...\n */\nexport async function fetchEntityData<T>(\n projectKey: string,\n entity: string,\n options: { id?: string; query?: Record<string, string> },\n apiBaseUrl?: string\n): Promise<T | null> {\n const base = apiBaseUrl ?? (typeof window !== 'undefined' ? window.location.origin : '')\n const params = new URLSearchParams()\n if (options.id) params.set('id', options.id)\n if (options.query) {\n Object.entries(options.query).forEach(([k, v]) => params.set(k, v))\n }\n const qs = params.toString()\n const url = `${base.replace(/\\/$/, '')}/api/zoiq/project/${encodeURIComponent(projectKey)}/data/${encodeURIComponent(entity)}${qs ? `?${qs}` : ''}`\n const res = await fetch(url)\n if (!res.ok) {\n throw new Error(`Failed to fetch entity ${entity}: ${res.status} ${res.statusText}`)\n }\n const data = (await res.json()) as T\n return data\n}\n","import type { ProjectSettings } from '../context/types'\n\n/**\n * Maps styleGuide keys to CSS variable names (e.g. for :root or a wrapper).\n * Aligns with portal globals.css tokens.\n */\nconst STYLE_GUIDE_TO_CSS_VAR: Record<string, string> = {\n background: '--background',\n foreground: '--foreground',\n primary: '--primary',\n secondary: '--secondary',\n card: '--card',\n cardForeground: '--card-foreground',\n popover: '--popover',\n popoverForeground: '--popover-foreground',\n muted: '--muted',\n mutedForeground: '--muted-foreground',\n accent: '--accent',\n accentForeground: '--accent-foreground',\n destructive: '--destructive',\n destructiveForeground: '--destructive-foreground',\n border: '--border',\n input: '--input',\n ring: '--ring',\n sidebar: '--sidebar',\n sidebarForeground: '--sidebar-foreground',\n sidebarPrimary: '--sidebar-primary',\n sidebarPrimaryForeground: '--sidebar-primary-foreground',\n sidebarAccent: '--sidebar-accent',\n sidebarAccentForeground: '--sidebar-accent-foreground',\n sidebarBorder: '--sidebar-border',\n radius: '--radius',\n}\n\n/**\n * Injects theme from ProjectSettings into document: CSS variables and optional font links.\n */\nexport function applyTheme(settings: ProjectSettings): void {\n if (typeof document === 'undefined') return\n\n const root = document.documentElement\n\n if (settings.styleGuide && typeof settings.styleGuide === 'object') {\n for (const [key, value] of Object.entries(settings.styleGuide)) {\n if (value == null || value === '') continue\n const cssVar = STYLE_GUIDE_TO_CSS_VAR[key] ?? `--${key}`\n root.style.setProperty(cssVar, value)\n }\n }\n\n if (settings.definedColors?.length) {\n for (const color of settings.definedColors) {\n if (!color?.name || !color?.value) continue\n const varName = `--color-${color.name.replace(/\\s+/g, '-').toLowerCase()}`\n root.style.setProperty(varName, color.value)\n }\n }\n\n if (settings.clientDefinedColors?.length) {\n for (const item of settings.clientDefinedColors) {\n const value = item?.definedColor?.value\n const name = item?.name\n if (!name || !value) continue\n const varName = `--${name.replace(/\\s+/g, '-').toLowerCase()}`\n root.style.setProperty(varName, value)\n }\n }\n\n const branding = settings.branding\n if (branding?.primaryFont?.link || branding?.secondaryFont?.link || branding?.tertiaryFont?.link) {\n const fontLinks: string[] = []\n if (branding.primaryFont?.link) fontLinks.push(`<link rel=\"stylesheet\" href=\"${branding.primaryFont.link}\" />`)\n if (branding.secondaryFont?.link) fontLinks.push(`<link rel=\"stylesheet\" href=\"${branding.secondaryFont.link}\" />`)\n if (branding.tertiaryFont?.link) fontLinks.push(`<link rel=\"stylesheet\" href=\"${branding.tertiaryFont.link}\" />`)\n if (fontLinks.length > 0) {\n const id = 'zoiq-fonts'\n let el = document.getElementById(id)\n if (!el) {\n el = document.createElement('div')\n el.id = id\n el.innerHTML = fontLinks.join('')\n document.head.append(...el.children)\n el.remove()\n }\n }\n }\n}\n","'use client'\n\nimport React, { createContext, useCallback, useContext, useEffect, useState } from 'react'\nimport type { ProjectSettings } from './types'\nimport { fetchProjectConfig } from '../api/client'\nimport { applyTheme } from '../theme/applyTheme'\n\nexport interface ZOIQProviderProps {\n /** Project key (e.g. project ID or public API key) to fetch theme and config */\n projectKey: string\n /** Base URL for the project config API (e.g. https://your-portal.com/api/zoiq) */\n apiBaseUrl?: string\n /** Optional custom fetcher; if provided, apiBaseUrl is ignored for config fetch */\n fetchProjectConfig?: (key: string) => Promise<ProjectSettings | null>\n children: React.ReactNode\n}\n\ninterface ZOIQContextValue {\n projectKey: string\n apiBaseUrl?: string\n settings: ProjectSettings | null\n loading: boolean\n error: Error | null\n refetch: () => Promise<void>\n}\n\nconst ZOIQContext = createContext<ZOIQContextValue | null>(null)\n\nexport function ZOIQProvider({\n projectKey,\n apiBaseUrl,\n fetchProjectConfig: customFetch,\n children,\n}: ZOIQProviderProps) {\n const [settings, setSettings] = useState<ProjectSettings | null>(null)\n const [loading, setLoading] = useState(true)\n const [error, setError] = useState<Error | null>(null)\n\n const fetchAndApply = useCallback(async () => {\n if (!projectKey) {\n setLoading(false)\n return\n }\n setLoading(true)\n setError(null)\n try {\n const data = customFetch\n ? await customFetch(projectKey)\n : await fetchProjectConfig(projectKey, apiBaseUrl)\n setSettings(data ?? null)\n if (data) {\n applyTheme(data)\n }\n } catch (err) {\n setError(err instanceof Error ? err : new Error(String(err)))\n setSettings(null)\n } finally {\n setLoading(false)\n }\n }, [projectKey, apiBaseUrl, customFetch])\n\n useEffect(() => {\n fetchAndApply()\n }, [fetchAndApply])\n\n const value: ZOIQContextValue = {\n projectKey,\n apiBaseUrl,\n settings,\n loading,\n error,\n refetch: fetchAndApply,\n }\n\n return <ZOIQContext.Provider value={value}>{children}</ZOIQContext.Provider>\n}\n\nexport function useZOIQContext(): ZOIQContextValue | null {\n return useContext(ZOIQContext)\n}\n","'use client'\n\nimport { useZOIQContext } from '../context/ZOIQProvider'\n\nexport interface UseProjectSettingsResult {\n data: import('../context/types').ProjectSettings | null\n loading: boolean\n error: Error | null\n refetch: () => Promise<void>\n}\n\n/**\n * Returns the full project theme/settings for the current project key.\n * Must be used within ZOIQProvider. Data is the same that the provider used to apply theme.\n */\nexport function useProjectSettings(): UseProjectSettingsResult {\n const ctx = useZOIQContext()\n if (!ctx) {\n return {\n data: null,\n loading: false,\n error: new Error('useProjectSettings must be used within ZOIQProvider'),\n refetch: async () => {},\n }\n }\n return {\n data: ctx.settings,\n loading: ctx.loading,\n error: ctx.error,\n refetch: ctx.refetch,\n }\n}\n","'use client'\n\nimport { useCallback, useContext, useEffect, useState } from 'react'\nimport { useZOIQContext } from '../context/ZOIQProvider'\nimport { fetchSectionFlags } from '../api/client'\n\nexport interface UseSectionFlagsResult {\n enabledIds: Set<string>\n disabledIds: Set<string>\n loading: boolean\n error: Error | null\n refetch: () => Promise<void>\n}\n\n/**\n * Returns which section IDs are enabled or disabled for the current project.\n * Must be used within ZOIQProvider. Uses the same apiBaseUrl as the provider.\n */\nexport function useSectionFlags(): UseSectionFlagsResult {\n const ctx = useZOIQContext()\n const [enabledIds, setEnabledIds] = useState<Set<string>>(new Set())\n const [disabledIds, setDisabledIds] = useState<Set<string>>(new Set())\n const [loading, setLoading] = useState(true)\n const [error, setError] = useState<Error | null>(null)\n\n const fetch = useCallback(async () => {\n if (!ctx?.projectKey) {\n setLoading(false)\n return\n }\n setLoading(true)\n setError(null)\n try {\n const data = await fetchSectionFlags(ctx.projectKey, ctx.apiBaseUrl)\n setEnabledIds(new Set(data.enabledIds ?? []))\n setDisabledIds(new Set(data.disabledIds ?? []))\n } catch (err) {\n setError(err instanceof Error ? err : new Error(String(err)))\n setEnabledIds(new Set())\n setDisabledIds(new Set())\n } finally {\n setLoading(false)\n }\n }, [ctx?.projectKey, ctx?.apiBaseUrl])\n\n useEffect(() => {\n fetch()\n }, [fetch])\n\n if (!ctx) {\n return {\n enabledIds: new Set(),\n disabledIds: new Set(),\n loading: false,\n error: new Error('useSectionFlags must be used within ZOIQProvider'),\n refetch: async () => {},\n }\n }\n\n return { enabledIds, disabledIds, loading, error, refetch: fetch }\n}\n","'use client'\n\nimport { useCallback, useContext, useEffect, useState } from 'react'\nimport { useZOIQContext } from '../context/ZOIQProvider'\nimport { fetchEntityData } from '../api/client'\n\nexport interface UseZOIQApiOptions {\n id?: string\n query?: Record<string, string>\n}\n\nexport interface UseZOIQApiResult<T> {\n data: T | null\n loading: boolean\n error: Error | null\n refetch: () => Promise<void>\n}\n\n/**\n * Fetches custom entity data for the current project.\n * Must be used within ZOIQProvider.\n */\nexport function useZOIQApi<T = unknown>(\n entity: string,\n options: UseZOIQApiOptions = {}\n): UseZOIQApiResult<T> {\n const ctx = useZOIQContext()\n const [data, setData] = useState<T | null>(null)\n const [loading, setLoading] = useState(true)\n const [error, setError] = useState<Error | null>(null)\n\n const fetch = useCallback(async () => {\n if (!ctx?.projectKey) {\n setLoading(false)\n return\n }\n setLoading(true)\n setError(null)\n try {\n const result = await fetchEntityData<T>(\n ctx.projectKey,\n entity,\n { id: options.id, query: options.query },\n ctx.apiBaseUrl\n )\n setData(result)\n } catch (err) {\n setError(err instanceof Error ? err : new Error(String(err)))\n setData(null)\n } finally {\n setLoading(false)\n }\n }, [ctx?.projectKey, entity, options.id, JSON.stringify(options.query)])\n\n useEffect(() => {\n fetch()\n }, [fetch])\n\n if (!ctx) {\n return {\n data: null,\n loading: false,\n error: new Error('useZOIQApi must be used within ZOIQProvider'),\n refetch: async () => {},\n }\n }\n\n return { data, loading, error, refetch: fetch }\n}\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","'use client'\n\nimport React from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface TextProps extends React.HTMLAttributes<HTMLElement> {\n children?: React.ReactNode\n className?: string\n as?: 'span' | 'p' | 'div'\n}\n\nexport const Text = ({\n children,\n className,\n as: As = 'span',\n ...props\n}: TextProps) => {\n return (\n <As className={cn('text-[var(--text-primary,#111)]', className)} {...props}>\n {children}\n </As>\n )\n}\n\nexport default Text\n","'use client'\n\nimport React from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface TitleProps {\n children?: React.ReactNode\n className?: string\n}\n\nexport const Title = ({ children, className }: TitleProps) => {\n return (\n <h1\n className={cn(\n 'text-2xl md:text-3xl mb-0 font-semibold text-pretty text-[var(--text-primary,#111)]',\n className\n )}\n >\n {children}\n </h1>\n )\n}\n\nexport default Title\n","'use client'\n\nimport React from 'react'\nimport { Text } from './Text'\nimport { cn } from '../../utils/cn'\n\nexport interface SubtitleProps {\n children?: React.ReactNode\n className?: string\n}\n\nexport const Subtitle = ({ children, className }: SubtitleProps) => {\n return (\n <Text as=\"div\" className={cn('text-sm md:text-base text-[var(--text-secondary,#666)]', className)}>\n {children}\n </Text>\n )\n}\n\nexport default Subtitle\n","'use client'\n\nimport React, { useState, useEffect } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface ScrollButtonProps {\n className?: string\n /** Scroll Y threshold above which the button is shown (default 200) */\n threshold?: number\n}\n\nexport const ScrollButton = ({ className, threshold = 200 }: ScrollButtonProps) => {\n const [isVisible, setIsVisible] = useState(false)\n\n useEffect(() => {\n const onScroll = () => setIsVisible(typeof window !== 'undefined' ? window.scrollY > threshold : false)\n window.addEventListener('scroll', onScroll, { passive: true })\n onScroll()\n return () => window.removeEventListener('scroll', onScroll)\n }, [threshold])\n\n return (\n <div className={cn('fixed bottom-10 right-10 z-50 hidden md:block', className)}>\n <button\n type=\"button\"\n className={cn(\n 'rounded-full p-2 cursor-pointer shadow-lg transition-all duration-300',\n 'bg-[var(--primary,hsl(220,70%,50%))] text-[var(--primary-foreground,#fff)]',\n isVisible ? 'opacity-100' : 'opacity-0 pointer-events-none'\n )}\n onClick={() => window.scrollTo({ top: 0, behavior: 'smooth' })}\n aria-label=\"Scroll to top\"\n >\n <span className=\"inline-block w-6 h-6\" aria-hidden>\n ↑\n </span>\n </button>\n </div>\n )\n}\n\nexport default ScrollButton\n","'use client'\n\nimport React from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface ToggleThemeProps {\n className?: string\n /** Callback when user requests theme toggle; host app controls actual theme state */\n onToggle?: () => void\n /** Optional current theme name for rendering (e.g. \"light\" | \"dark\") */\n theme?: string\n /** Content to show (e.g. icon). If not provided, shows \"Theme\" */\n children?: React.ReactNode\n}\n\nexport const ToggleTheme = ({ className, onToggle, theme, children }: ToggleThemeProps) => {\n return (\n <button type=\"button\" onClick={onToggle} className={cn(className)} aria-label={`Toggle theme (current: ${theme ?? 'unknown'})`}>\n {children ?? 'Theme'}\n </button>\n )\n}\n\nexport default ToggleTheme\n","'use client'\n\nimport React from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface SectionProps {\n children?: React.ReactNode\n className?: string\n}\n\nexport const Section = ({ children, className }: SectionProps) => {\n return (\n <section className={cn('max-w-7xl mx-auto w-full px-8 md:px-0 pt-12 md:pt-24 pb-12 md:pb-24', className)}>\n {children}\n </section>\n )\n}\n\nexport default Section\n","'use client'\n\nimport React from 'react'\n\n/**\n * Placeholder for toast container. Host app should render Toaster from \"sonner\" (or similar)\n * inside the app; ZOIQ does not bundle a toast library.\n */\nexport const ToastContainer = () => {\n return null\n}\n\nexport default ToastContainer\n","'use client'\n\nimport React from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface PageProps {\n children?: React.ReactNode\n className?: string\n /** Optional full-width layout (no horizontal padding) */\n fullWidth?: boolean\n}\n\nexport const Page = ({ children, className, fullWidth }: PageProps) => {\n return (\n <div className={cn('w-full flex-1 flex flex-col min-h-screen', className)}>\n <main className={cn('w-full flex-1 flex flex-col', fullWidth ? 'px-0' : 'px-4 md:px-8')}>\n {children}\n </main>\n </div>\n )\n}\n\nexport default Page\n","'use client'\n\nimport React from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface HeaderProps {\n children?: React.ReactNode\n className?: string\n /** Optional left slot (e.g. logo, nav) */\n left?: React.ReactNode\n /** Optional right slot (e.g. user menu, theme toggle) */\n right?: React.ReactNode\n}\n\nexport const Header = ({ children, className, left, right }: HeaderProps) => {\n return (\n <header\n className={cn(\n 'w-full h-14 sticky top-0 z-50 border-b border-[var(--border,transparent)]',\n 'bg-[var(--sidebar,var(--background))]',\n className\n )}\n >\n <nav className=\"flex h-full w-full items-center justify-between gap-4 px-4 md:px-6\" aria-label=\"Main\">\n {left != null ? <div className=\"flex items-center gap-3\">{left}</div> : null}\n {children}\n {right != null ? <div className=\"flex items-center gap-3\">{right}</div> : null}\n </nav>\n </header>\n )\n}\n\nexport default Header\n","'use client'\n\nimport React from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface FooterProps {\n children?: React.ReactNode\n className?: string\n}\n\nexport const Footer = ({ children, className }: FooterProps) => {\n return (\n <footer className={cn('w-full border-t border-[var(--border,transparent)] py-6 px-4 md:px-8', className)}>\n {children}\n </footer>\n )\n}\n\nexport default Footer\n","'use client'\n\nimport React from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface SecondarySidebarItem {\n label: string\n href: string\n icon?: React.ReactNode\n}\n\nexport interface SecondarySidebarProps {\n items: SecondarySidebarItem[]\n className?: string\n /** Optional: return true if item is active (e.g. from pathname) */\n isActive?: (item: SecondarySidebarItem) => boolean\n /** Optional: custom link renderer (e.g. Next.js Link). Default: <a> */\n renderLink?: (item: SecondarySidebarItem, children: React.ReactNode) => React.ReactNode\n}\n\nexport const SecondarySidebar = ({ items, className, isActive, renderLink }: SecondarySidebarProps) => {\n return (\n <div className={cn('px-4', className)}>\n <ul className=\"flex p-1 rounded-lg bg-[var(--accent,#f4f4f5)] border border-[var(--border,#e4e4e7)] w-full justify-between gap-4\">\n {items.map((item) => {\n const active = isActive?.(item) ?? false\n const content = (\n <>\n {item.icon}\n <span>{item.label}</span>\n </>\n )\n const child = renderLink ? (\n renderLink(item, content)\n ) : (\n <a href={item.href} className={cn('flex items-center justify-center gap-2 text-center h-8 w-full rounded-md text-sm font-medium transition-colors', active ? 'bg-[var(--sidebar-accent,var(--accent))] text-[var(--foreground)]' : 'text-[var(--muted-foreground,#71717a)]')}>\n {content}\n </a>\n )\n return (\n <li key={item.href} className=\"w-full\">\n {child}\n </li>\n )\n })}\n </ul>\n </div>\n )\n}\n\nexport default SecondarySidebar\n"]}
1
+ {"version":3,"sources":["../src/api/client.ts","../src/theme/applyTheme.ts","../src/context/ZOIQProvider.tsx","../src/hooks/useZOIQEntity.ts","../src/utils/test.ts"],"names":["apiBaseUrl","createContext","useState","useCallback","useEffect","jsx","useContext","fetch"],"mappings":";;;;;;AAMA,eAAsB,kBAAA,CAAmB,YAAoBA,WAAAA,EAAsD;AACjH,EAAA,MAAM,OAAOA,WAAAA,KAAe,OAAO,WAAW,WAAA,GAAc,MAAA,CAAO,SAAS,MAAA,GAAS,EAAA,CAAA;AACrF,EAAA,MAAM,GAAA,GAAM,CAAA,EAAG,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAC,CAAA,kBAAA,EAAqB,kBAAA,CAAmB,UAAU,CAAC,CAAA,CAAA;AACzF,EAAA,MAAM,MAAM,MAAM,KAAA,CAAM,KAAK,EAAE,WAAA,EAAa,WAAW,CAAA;AACvD,EAAA,IAAI,CAAC,IAAI,EAAA,EAAI;AACX,IAAA,MAAM,IAAI,MAAM,CAAA,gCAAA,EAAmC,GAAA,CAAI,MAAM,CAAA,CAAA,EAAI,GAAA,CAAI,UAAU,CAAA,CAAE,CAAA;AAAA,EACnF;AACA,EAAA,MAAM,IAAA,GAAQ,MAAM,GAAA,CAAI,IAAA,EAAK;AAC7B,EAAA,OAAO,IAAA;AACT;AAmBA,eAAsB,eAAA,CAAmB,UAA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AI,IAAA,CAAK,SAAA,CAAU,OAAA,CAAQ,KAAK,CAAC,CAAC,CAAA;AAEvE,EAAAC,gBAAU,MAAM;AACd,IAAAG,MAAAA,EAAM;AAAA,EACR,CAAA,EAAG,CAACA,MAAK,CAAC,CAAA;AAEV,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,IAAA;AAAA,MACN,OAAA,EAAS,KAAA;AAAA,MACT,KAAA,EAAO,IAAI,KAAA,CAAM,gDAAgD,CAAA;AAAA,MACjE,SAAS,YAAY;AAAA,MAAC;AAAA,KACxB;AAAA,EACF;AAEA,EAAA,OAAO,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAO,SAASA,MAAAA,EAAM;AAChD;;;ACrEO,SAAS,IAAA,GAAO;AACrB,EAAA,OAAA,CAAQ,IAAI,OAAO,CAAA;AACrB","file":"index.js","sourcesContent":["import type { ProjectSettings } from '../context/types'\n\n/**\n * Default fetch for project config. Calls GET {apiBaseUrl}/project/{projectKey}\n * and expects JSON matching ProjectSettings.\n */\nexport async function fetchProjectConfig(projectKey: string, apiBaseUrl?: string): Promise<ProjectSettings | null> {\n const base = apiBaseUrl ?? (typeof window !== 'undefined' ? window.location.origin : '')\n const url = `${base.replace(/\\/$/, '')}/api/zoiq/project/${encodeURIComponent(projectKey)}`\n const res = await fetch(url, { credentials: 'include' })\n if (!res.ok) {\n throw new Error(`Failed to fetch project config: ${res.status} ${res.statusText}`)\n }\n const data = (await res.json()) as ProjectSettings\n return data\n}\n\n/**\n * Fetch section flags for the project. Calls GET {apiBaseUrl}/project/{projectKey}/sections\n */\nexport async function fetchSectionFlags(projectKey: string, apiBaseUrl?: string): Promise<{ enabledIds: string[]; disabledIds: string[] }> {\n const base = apiBaseUrl ?? (typeof window !== 'undefined' ? window.location.origin : '')\n const url = `${base.replace(/\\/$/, '')}/api/zoiq/project/${encodeURIComponent(projectKey)}/sections`\n const res = await fetch(url, { credentials: 'include' })\n if (!res.ok) {\n throw new Error(`Failed to fetch section flags: ${res.status} ${res.statusText}`)\n }\n return res.json() as Promise<{ enabledIds: string[]; disabledIds: string[] }>\n}\n\n/**\n * Fetch entity data for the project. Calls GET {apiBaseUrl}/project/{projectKey}/data/{entity}?id=...\n * If apiKey is provided (e.g. from project settings), it is sent as x-api-key header for auth.\n */\nexport async function fetchEntityData<T>(projectKey: string, entity: string, options: { id?: string; query?: Record<string, string>; apiKey?: string | null }, apiBaseUrl?: string): Promise<T | null> {\n const base = apiBaseUrl ?? (typeof window !== 'undefined' ? window.location.origin : '')\n const params = new URLSearchParams()\n if (options.id) params.set('id', options.id)\n if (options.query) {\n Object.entries(options.query).forEach(([k, v]) => params.set(k, v))\n }\n const qs = params.toString()\n const url = `${base.replace(/\\/$/, '')}/api/zoiq/project/${encodeURIComponent(projectKey)}/data/${encodeURIComponent(entity)}${qs ? `?${qs}` : ''}`\n const headers: Record<string, string> = {}\n if (options.apiKey) headers['x-api-key'] = options.apiKey\n const res = await fetch(url, { credentials: 'include', headers: Object.keys(headers).length ? headers : undefined })\n if (!res.ok) {\n throw new Error(`Failed to fetch entity ${entity}: ${res.status} ${res.statusText}`)\n }\n const data = (await res.json()) as T\n return data\n}\n","import type { ProjectSettings } from '../context/types'\n\n/**\n * Maps styleGuide keys to CSS variable names (e.g. for :root or a wrapper).\n * Aligns with portal globals.css / Tailwind tokens.\n */\nconst STYLE_GUIDE_TO_CSS_VAR: Record<string, string> = {\n background: '--background',\n foreground: '--foreground',\n primary: '--primary',\n secondary: '--secondary',\n card: '--card',\n cardForeground: '--card-foreground',\n popover: '--popover',\n popoverForeground: '--popover-foreground',\n muted: '--muted',\n mutedForeground: '--muted-foreground',\n accent: '--accent',\n accentForeground: '--accent-foreground',\n destructive: '--destructive',\n destructiveForeground: '--destructive-foreground',\n border: '--border',\n input: '--input',\n ring: '--ring',\n chart1: '--chart-1',\n chart2: '--chart-2',\n chart3: '--chart-3',\n chart4: '--chart-4',\n chart5: '--chart-5',\n sidebar: '--sidebar',\n sidebarForeground: '--sidebar-foreground',\n sidebarPrimary: '--sidebar-primary',\n sidebarPrimaryForeground: '--sidebar-primary-foreground',\n sidebarAccent: '--sidebar-accent',\n sidebarAccentForeground: '--sidebar-accent-foreground',\n sidebarBorder: '--sidebar-border',\n sidebarRing: '--sidebar-ring',\n radius: '--radius',\n}\n\nconst ZOIQ_THEME_STYLE_ID = 'zoiq-theme-override'\n\n/** Normalize \"H, S%, L%\" (DB) to \"H S% L%\" for Tailwind hsl(var(--x)) */\nfunction toTailwindHsl(value: string): string {\n if (!value || typeof value !== 'string') return value\n const trimmed = value.trim()\n return trimmed.replace(/,/g, ' ')\n}\n\n/**\n * Injects theme from ProjectSettings into document so it overrides layout.css / globals.css.\n * Injects a <style id=\"zoiq-theme-override\"> with :root { ... } at the end of <head>,\n * so it wins in the cascade. Values from DB are \"H, S%, L%\"; we output \"H S% L%\" for Tailwind.\n */\nexport function applyTheme(settings: ProjectSettings): void {\n if (typeof document === 'undefined') return\n\n const root = document.documentElement\n const declarations: string[] = []\n\n if (settings.styleGuide && typeof settings.styleGuide === 'object') {\n for (const [key, value] of Object.entries(settings.styleGuide)) {\n if (value == null || value === '') continue\n const cssVar = STYLE_GUIDE_TO_CSS_VAR[key] ?? `--${key}`\n const normalized = typeof value === 'string' && /^\\s*[\\d.-]+\\s*,/.test(value) ? toTailwindHsl(value) : (value as string)\n declarations.push(`${cssVar}: ${normalized};`)\n root.style.setProperty(cssVar, normalized)\n }\n }\n\n if (settings.definedColors?.length) {\n for (const color of settings.definedColors) {\n if (!color?.name || !color?.value) continue\n const varName = `--color-${color.name.replace(/\\s+/g, '-').toLowerCase()}`\n const normalized = /^\\s*[\\d.-]+\\s*,/.test(color.value) ? toTailwindHsl(color.value) : color.value\n declarations.push(`${varName}: ${normalized};`)\n root.style.setProperty(varName, normalized)\n }\n }\n\n if (settings.clientDefinedColors?.length) {\n for (const item of settings.clientDefinedColors) {\n const value = item?.definedColor?.value\n const name = item?.name\n if (!name || !value) continue\n const varName = `--${name.replace(/\\s+/g, '-').toLowerCase()}`\n const normalized = /^\\s*[\\d.-]+\\s*,/.test(value) ? toTailwindHsl(value) : value\n declarations.push(`${varName}: ${normalized};`)\n root.style.setProperty(varName, normalized)\n }\n }\n\n if (declarations.length > 0) {\n const css = `:root {\\n ${declarations.join('\\n ')}\\n}\\n.dark {\\n ${declarations.join('\\n ')}\\n}\\n`\n let styleEl = document.getElementById(ZOIQ_THEME_STYLE_ID) as HTMLStyleElement | null\n if (!styleEl) {\n styleEl = document.createElement('style')\n styleEl.id = ZOIQ_THEME_STYLE_ID\n document.head.appendChild(styleEl)\n }\n styleEl.textContent = css\n }\n\n const branding = settings.branding\n if (branding?.primaryFont?.link || branding?.secondaryFont?.link || branding?.tertiaryFont?.link) {\n const fontLinks: string[] = []\n if (branding.primaryFont?.link) fontLinks.push(`<link rel=\"stylesheet\" href=\"${branding.primaryFont.link}\" />`)\n if (branding.secondaryFont?.link) fontLinks.push(`<link rel=\"stylesheet\" href=\"${branding.secondaryFont.link}\" />`)\n if (branding.tertiaryFont?.link) fontLinks.push(`<link rel=\"stylesheet\" href=\"${branding.tertiaryFont.link}\" />`)\n if (fontLinks.length > 0) {\n const id = 'zoiq-fonts'\n let el = document.getElementById(id)\n if (!el) {\n el = document.createElement('div')\n el.id = id\n el.innerHTML = fontLinks.join('')\n document.head.append(...el.children)\n el.remove()\n }\n }\n }\n}\n","'use client'\n\nimport React, { createContext, useCallback, useContext, useEffect, useState } from 'react'\nimport { fetchProjectConfig } from '../api/client'\nimport { applyTheme } from '../theme/applyTheme'\nimport type { ProjectSettings } from './types'\n\nexport interface ZOIQProviderProps {\n /** Project key (e.g. project ID or public API key) to fetch theme and config */\n projectKey: string\n /** Base URL for the project config API (e.g. https://your-portal.com/api/zoiq) */\n /** Optional custom fetcher; if provided, apiBaseUrl is ignored for config fetch */\n children: React.ReactNode\n}\n\ninterface ZOIQContextValue {\n projectKey: string\n apiBaseUrl?: string\n settings: ProjectSettings | null\n loading: boolean\n error: Error | null\n refetch: () => Promise<void>\n branding: ProjectSettings['branding'] | null\n}\n\nconst ZOIQContext = createContext<ZOIQContextValue | null>(null)\n\nconst apiBaseUrl = process.env.NEXT_PUBLIC_ZOIQ_API_BASE_URL || 'https://portal.zoiq.io'\n\nexport function ZOIQProvider({ projectKey, children }: ZOIQProviderProps) {\n const [settings, setSettings] = useState<ProjectSettings | null>(null)\n const [loading, setLoading] = useState(true)\n const [error, setError] = useState<Error | null>(null)\n\n const fetchAndApply = useCallback(async () => {\n if (!projectKey) {\n setLoading(false)\n return\n }\n setLoading(true)\n setError(null)\n try {\n const data = await fetchProjectConfig(projectKey, apiBaseUrl)\n setSettings(data ?? null)\n } catch (err) {\n setError(err instanceof Error ? err : new Error(String(err)))\n setSettings(null)\n } finally {\n setLoading(false)\n }\n }, [projectKey])\n\n // Preview mode: ?preview=true&previewUrl=... — load project settings by fetching the preview JSON URL directly (S3 public URL)\n useEffect(() => {\n if (!projectKey || typeof window === 'undefined') return\n\n const params = new URLSearchParams(window.location.search)\n const isPreview = params.get('preview') === 'true'\n const previewUrl = params.get('previewUrl')\n\n if (!isPreview) {\n fetchAndApply()\n return\n }\n\n const applyPayload = (payload: ProjectSettings) => {\n setSettings(payload)\n setError(null)\n setLoading(false)\n }\n\n if (!previewUrl || !previewUrl.trim()) {\n fetchAndApply()\n return\n }\n\n const url = previewUrl.trim()\n let cancelled = false\n fetch(url, { credentials: 'omit' })\n .then(res => {\n if (cancelled) return\n if (!res.ok) throw new Error(res.statusText || 'Failed to load preview')\n return res.json()\n })\n .then((data: ProjectSettings) => {\n if (cancelled) return\n applyPayload(data)\n })\n .catch(err => {\n if (cancelled) return\n setError(err instanceof Error ? err : new Error(String(err)))\n setSettings(null)\n setLoading(false)\n })\n\n return () => {\n cancelled = true\n }\n }, [projectKey, fetchAndApply])\n\n // Apply theme to document root whenever settings change so Tailwind in the client app\n // picks up CSS variables (e.g. --primary, --background) from :root\n useEffect(() => {\n if (settings) {\n applyTheme(settings)\n }\n }, [settings])\n\n const value: ZOIQContextValue = {\n projectKey,\n settings,\n loading,\n error,\n branding: settings?.branding,\n apiBaseUrl,\n refetch: fetchAndApply,\n }\n\n return <ZOIQContext.Provider value={value}>{loading ? <div>Loading...</div> : children}</ZOIQContext.Provider>\n}\n\nexport function useZOIQContext(): ZOIQContextValue | null {\n return useContext(ZOIQContext)\n}\n\nexport function useZOIQBranding(): ZOIQContextValue['branding'] | null {\n const ctx = useZOIQContext()\n return ctx?.branding ?? null\n}\n\nexport function useStyleGuide(): ProjectSettings['styleGuide'] | null {\n const ctx = useZOIQContext()\n return ctx?.settings?.styleGuide ?? (null as ProjectSettings['styleGuide'] | null)\n}\n","'use client'\n\nimport { useCallback, useEffect, useState } from 'react'\nimport { fetchEntityData } from '../api/client'\nimport { useZOIQContext } from '../context/ZOIQProvider'\n\nexport interface UseZOIQEntityOptions {\n id?: string\n query?: Record<string, string>\n}\n\nexport interface UseZOIQEntityResult<T> {\n data: T | null\n loading: boolean\n error: Error | null\n refetch: () => Promise<void>\n}\n\n/**\n * Fetches custom entity data for the current project.\n * Must be used within ZOIQProvider.\n */\nexport function useZOIQEntity<T = unknown>(entity: string, options: UseZOIQEntityOptions = {}): UseZOIQEntityResult<T> {\n const ctx = useZOIQContext()\n const [data, setData] = useState<T | null>(null)\n const [loading, setLoading] = useState(true)\n const [error, setError] = useState<Error | null>(null)\n\n const fetch = useCallback(async () => {\n if (!ctx?.projectKey) {\n setLoading(false)\n return\n }\n setLoading(true)\n setError(null)\n try {\n const result = await fetchEntityData<T>(\n ctx.projectKey,\n entity,\n {\n id: options.id,\n query: options.query,\n apiKey: ctx.settings?.apiKey ?? undefined,\n },\n ctx.apiBaseUrl,\n )\n setData(result)\n } catch (err) {\n setError(err instanceof Error ? err : new Error(String(err)))\n setData(null)\n } finally {\n setLoading(false)\n }\n }, [ctx?.projectKey, entity, options.id, JSON.stringify(options.query)])\n\n useEffect(() => {\n fetch()\n }, [fetch])\n\n if (!ctx) {\n return {\n data: null,\n loading: false,\n error: new Error('useZOIQEntity must be used within ZOIQProvider'),\n refetch: async () => {},\n }\n }\n\n return { data, loading, error, refetch: fetch }\n}\n","export function test() {\r\n console.log('test!')\r\n}\r\n"]}