camox 0.41.1 → 0.43.0

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.
Files changed (93) hide show
  1. package/dist/core/components/lexical/{GradientNode.js → HighlightNode.js} +34 -34
  2. package/dist/core/components/lexical/InlineLexicalEditor.js +14 -14
  3. package/dist/core/components/lexical/InlineStylesPlugin.js +6 -6
  4. package/dist/core/components/lexical/SelectionBroadcaster.js +5 -5
  5. package/dist/core/components/lexical/SidebarLexicalEditor.js +52 -49
  6. package/dist/core/components/lexical/TextLinkPopover.js +191 -208
  7. package/dist/core/components/lexical/editorConfig.js +2 -2
  8. package/dist/core/createApp.d.ts +19 -4
  9. package/dist/core/createApp.js +2 -1
  10. package/dist/core/createLayout.d.ts +16 -3
  11. package/dist/core/createLayout.js +15 -15
  12. package/dist/core/derivedRoutes.js +1 -1
  13. package/dist/core/dom.d.ts +17 -0
  14. package/dist/core/dom.js +22 -0
  15. package/dist/core/editing/createEditableBlock.d.ts +8 -1
  16. package/dist/core/editing/createEditableBlock.js +636 -459
  17. package/dist/core/hooks/useOverlayState.js +11 -0
  18. package/dist/core/lib/fieldTypes.js +5 -5
  19. package/dist/core/lib/lexicalReact.js +4 -4
  20. package/dist/core/lib/lexicalState.js +20 -4
  21. package/dist/core/lib/modifierFormats.js +1 -1
  22. package/dist/core/lib/textLinks.js +5 -2
  23. package/dist/core/lib/textStyles.d.ts +2 -2
  24. package/dist/core/lib/textStyles.js +6 -11
  25. package/dist/core/pageDestinations.js +37 -0
  26. package/dist/features/og/imageResponse.node.js +11 -9
  27. package/dist/features/preview/CamoxPreview.js +108 -124
  28. package/dist/features/preview/commentsEnabled.js +8 -0
  29. package/dist/features/preview/components/AddBlockSidebar.js +80 -90
  30. package/dist/features/preview/components/AssetLightbox.js +4 -11
  31. package/dist/features/preview/components/AttachedComments.js +194 -0
  32. package/dist/features/preview/components/BlockActionsPopover.js +14 -65
  33. package/dist/features/preview/components/CommentHeader.js +122 -0
  34. package/dist/features/preview/components/CommentSidebar.js +29 -0
  35. package/dist/features/preview/components/CommentTargetQuote.js +166 -0
  36. package/dist/features/preview/components/CreatePageModal.js +4 -10
  37. package/dist/features/preview/components/DerivedLayoutSidebar.js +45 -26
  38. package/dist/features/preview/components/DerivedPageInfoSidebar.js +38 -26
  39. package/dist/features/preview/components/FieldToolbar.js +7 -7
  40. package/dist/features/preview/components/ItemFieldsEditor.js +275 -204
  41. package/dist/features/preview/components/LeftSidebar.js +18 -18
  42. package/dist/features/preview/components/LinkFieldEditor.js +212 -209
  43. package/dist/features/preview/components/OverlayTracker.js +14 -20
  44. package/dist/features/preview/components/Overlays.js +26 -35
  45. package/dist/features/preview/components/PageEditorSidebar.js +90 -91
  46. package/dist/features/preview/components/PageInfoSidebar.js +128 -159
  47. package/dist/features/preview/components/PagePicker.js +29 -24
  48. package/dist/features/preview/components/PageTree.js +159 -157
  49. package/dist/features/preview/components/PreviewComments.js +56 -0
  50. package/dist/features/preview/components/PreviewPanel.js +122 -78
  51. package/dist/features/preview/components/PreviewToolbar.js +280 -231
  52. package/dist/features/preview/components/PublicationRow.js +8 -11
  53. package/dist/features/preview/components/RightSidebar.js +14 -11
  54. package/dist/features/preview/components/SidebarSection.js +121 -0
  55. package/dist/features/preview/components/useRepeatableItemActions.js +1 -1
  56. package/dist/features/preview/previewCommentsStore.js +115 -0
  57. package/dist/features/preview/previewSelection.js +75 -0
  58. package/dist/features/preview/previewStore.js +19 -39
  59. package/dist/features/preview/publication.js +10 -0
  60. package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -34
  61. package/dist/features/provider/CoreCamoxProvider.js +1 -1
  62. package/dist/features/provider/components/CommandPalette.js +142 -58
  63. package/dist/features/provider/useAdminShortcuts.js +19 -8
  64. package/dist/features/routes/pageRuntime.js +0 -6
  65. package/dist/features/runtime/RuntimeChrome.js +40 -37
  66. package/dist/features/runtime/runtime.js +20 -21
  67. package/dist/features/studio/CamoxStudio.js +30 -50
  68. package/dist/features/studio/components/EnvironmentMenu.js +3 -2
  69. package/dist/features/studio/components/Navbar.js +53 -80
  70. package/dist/features/vite/layoutGeneration.js +7 -3
  71. package/dist/features/vite/runtimeDev.js +4 -1
  72. package/dist/features/vite/vite.d.ts +3 -2
  73. package/dist/features/vite/vite.js +14 -6
  74. package/dist/hooks/use-file-upload.js +0 -2
  75. package/dist/hooks/use-page-destinations.js +53 -0
  76. package/dist/lib/auth.js +11 -14
  77. package/dist/lib/server-auth-cookie.js +21 -0
  78. package/dist/studio.css +1 -1
  79. package/package.json +9 -7
  80. package/skills/camox/SKILL.md +32 -9
  81. package/skills/camox/references/block-definitions.md +84 -290
  82. package/skills/camox/references/cli-common.md +2 -4
  83. package/skills/camox/references/cli-content.md +147 -0
  84. package/skills/camox/references/cli-environments.md +1 -1
  85. package/skills/camox/references/dom-integrations.md +93 -0
  86. package/skills/camox/references/field-styling.md +50 -0
  87. package/skills/camox/references/layout-definitions.md +33 -147
  88. package/skills/camox/references/routed-layouts.md +71 -0
  89. package/skills/camoxify/SKILL.md +52 -0
  90. package/dist/lib/telemetry-client.js +0 -66
  91. package/dist/lib/telemetry.js +0 -26
  92. package/skills/camox/references/cli-blocks.md +0 -78
  93. package/skills/camox/references/cli-pages.md +0 -53
@@ -1,7 +1,6 @@
1
1
  import { Link as Link$1, useLocation, useNavigate } from "../../navigation/navigation.js";
2
2
  import { actionsStore } from "../../provider/actionsStore.js";
3
- import { useProjectSlug } from "../../../lib/auth.js";
4
- import { pageQueries, projectQueries } from "../../../lib/queries.js";
3
+ import { usePageDestinations } from "../../../hooks/use-page-destinations.js";
5
4
  import { PlatformLabel } from "../../../components/PlatformLabel.js";
6
5
  import { cn } from "../../../lib/utils.js";
7
6
  import { STUDIO_CONTENT_PATH } from "../routes.js";
@@ -10,7 +9,6 @@ import { EnvironmentMenu } from "./EnvironmentMenu.js";
10
9
  import { ProjectMenu } from "./ProjectMenu.js";
11
10
  import { UserButton } from "./UserButton.js";
12
11
  import { c } from "react/compiler-runtime";
13
- import { useQuery } from "@tanstack/react-query";
14
12
  import * as React from "react";
15
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
14
  import { Kbd } from "@camox/ui/kbd";
@@ -36,97 +34,72 @@ const links = [{
36
34
  ]
37
35
  }];
38
36
  const Navbar = (t0) => {
39
- const $ = c(20);
40
- if ($[0] !== "4608f306773df1a594409c84a68bc5a0c72c93c4fbda9136da94d4900e84546d") {
41
- for (let $i = 0; $i < 20; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
42
- $[0] = "4608f306773df1a594409c84a68bc5a0c72c93c4fbda9136da94d4900e84546d";
37
+ const $ = c(13);
38
+ if ($[0] !== "9182f23e40dc6d439cec2c533b4f9436ee59f885213d6d7a79d434c7aa8349c6") {
39
+ for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
40
+ $[0] = "9182f23e40dc6d439cec2c533b4f9436ee59f885213d6d7a79d434c7aa8349c6";
43
41
  }
44
42
  const { isPreview: t1 } = t0;
45
43
  const isPreview = t1 === void 0 ? false : t1;
46
- const projectSlug = useProjectSlug();
47
- let t2;
48
- if ($[1] !== projectSlug) {
49
- t2 = projectQueries.getBySlug(projectSlug);
50
- $[1] = projectSlug;
51
- $[2] = t2;
52
- } else t2 = $[2];
53
- const { data: project } = useQuery(t2);
54
- let t3;
55
- if ($[3] !== project?.id) {
56
- t3 = pageQueries.list(project?.id ?? 0);
57
- $[3] = project?.id;
58
- $[4] = t3;
59
- } else t3 = $[4];
60
- const t4 = !!project;
61
- let t5;
62
- if ($[5] !== t3 || $[6] !== t4) {
63
- t5 = {
64
- ...t3,
65
- enabled: t4
66
- };
67
- $[5] = t3;
68
- $[6] = t4;
69
- $[7] = t5;
70
- } else t5 = $[7];
71
- const { data: pages } = useQuery(t5);
44
+ const pages = usePageDestinations();
72
45
  const { pathname } = useLocation();
73
- let t6;
74
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
75
- t6 = /* @__PURE__ */ jsxs("div", {
46
+ let t2;
47
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
48
+ t2 = /* @__PURE__ */ jsxs("div", {
76
49
  className: "flew-row flex gap-1",
77
50
  children: [/* @__PURE__ */ jsx(ProjectMenu, {}), /* @__PURE__ */ jsx(EnvironmentMenu, {})]
78
51
  });
79
- $[8] = t6;
80
- } else t6 = $[8];
81
- let t7;
82
- if ($[9] !== isPreview || $[10] !== pages || $[11] !== pathname) {
83
- t7 = links.map((link, index) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link$1, {
52
+ $[1] = t2;
53
+ } else t2 = $[1];
54
+ let t3;
55
+ if ($[2] !== isPreview || $[3] !== pages || $[4] !== pathname) {
56
+ t3 = links.map((link, index) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link$1, {
84
57
  to: link.to,
85
58
  className: cn("flex gap-2 items-center rounded-md px-4 py-2 text-sm font-medium", "hover:bg-accent hover:text-accent-foreground outline-none transition-[color,box-shadow] focus-visible:ring-ring/50 focus-visible:ring-[3px] focus-visible:outline-1", (isPreview || pages?.some((page) => page.fullPath === pathname)) && index === 0 ? "bg-accent hover:bg-accent text-accent-foreground" : "text-muted-foreground"),
86
59
  activeProps: { className: "bg-accent hover:bg-accent text-accent-foreground!" },
87
60
  children: link.children
88
61
  }) }, link.to));
89
- $[9] = isPreview;
90
- $[10] = pages;
91
- $[11] = pathname;
92
- $[12] = t7;
93
- } else t7 = $[12];
94
- let t8;
95
- if ($[13] !== t7) {
96
- t8 = /* @__PURE__ */ jsxs("div", {
62
+ $[2] = isPreview;
63
+ $[3] = pages;
64
+ $[4] = pathname;
65
+ $[5] = t3;
66
+ } else t3 = $[5];
67
+ let t4;
68
+ if ($[6] !== t3) {
69
+ t4 = /* @__PURE__ */ jsxs("div", {
97
70
  className: "flex flex-row gap-2",
98
- children: [t6, /* @__PURE__ */ jsx("ul", {
71
+ children: [t2, /* @__PURE__ */ jsx("ul", {
99
72
  className: "flex items-center gap-1",
100
- children: t7
73
+ children: t3
101
74
  })]
102
75
  });
103
- $[13] = t7;
104
- $[14] = t8;
105
- } else t8 = $[14];
106
- let t10;
107
- let t9;
108
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
109
- t9 = /* @__PURE__ */ jsx(SearchIcon, { className: "text-muted-foreground size-4" });
110
- t10 = /* @__PURE__ */ jsx("span", {
76
+ $[6] = t3;
77
+ $[7] = t4;
78
+ } else t4 = $[7];
79
+ let t5;
80
+ let t6;
81
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
82
+ t5 = /* @__PURE__ */ jsx(SearchIcon, { className: "text-muted-foreground size-4" });
83
+ t6 = /* @__PURE__ */ jsx("span", {
111
84
  className: "text-muted-foreground",
112
85
  children: "Quick find"
113
86
  });
114
- $[15] = t10;
115
- $[16] = t9;
87
+ $[8] = t5;
88
+ $[9] = t6;
116
89
  } else {
117
- t10 = $[15];
118
- t9 = $[16];
90
+ t5 = $[8];
91
+ t6 = $[9];
119
92
  }
120
- let t11;
121
- if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
122
- t11 = /* @__PURE__ */ jsxs("div", {
93
+ let t7;
94
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
95
+ t7 = /* @__PURE__ */ jsxs("div", {
123
96
  className: "flex items-center gap-2",
124
97
  children: [/* @__PURE__ */ jsxs(Button, {
125
98
  variant: "outline",
126
99
  onClick: _temp,
127
100
  children: [
128
- t9,
129
- t10,
101
+ t5,
102
+ t6,
130
103
  /* @__PURE__ */ jsx(Kbd, {
131
104
  className: "ml-4",
132
105
  children: /* @__PURE__ */ jsx(PlatformLabel, {
@@ -137,24 +110,24 @@ const Navbar = (t0) => {
137
110
  ]
138
111
  }), /* @__PURE__ */ jsx(UserButton, {})]
139
112
  });
140
- $[17] = t11;
141
- } else t11 = $[17];
142
- let t12;
143
- if ($[18] !== t8) {
144
- t12 = /* @__PURE__ */ jsxs("nav", {
113
+ $[10] = t7;
114
+ } else t7 = $[10];
115
+ let t8;
116
+ if ($[11] !== t4) {
117
+ t8 = /* @__PURE__ */ jsxs("nav", {
145
118
  className: "bg-background relative flex items-center justify-between gap-4 border-b-2 px-2 py-2",
146
- children: [t8, t11]
119
+ children: [t4, t7]
147
120
  });
148
- $[18] = t8;
149
- $[19] = t12;
150
- } else t12 = $[19];
151
- return t12;
121
+ $[11] = t4;
122
+ $[12] = t8;
123
+ } else t8 = $[12];
124
+ return t8;
152
125
  };
153
126
  function useNavbarActions() {
154
127
  const $ = c(4);
155
- if ($[0] !== "4608f306773df1a594409c84a68bc5a0c72c93c4fbda9136da94d4900e84546d") {
128
+ if ($[0] !== "9182f23e40dc6d439cec2c533b4f9436ee59f885213d6d7a79d434c7aa8349c6") {
156
129
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
157
- $[0] = "4608f306773df1a594409c84a68bc5a0c72c93c4fbda9136da94d4900e84546d";
130
+ $[0] = "9182f23e40dc6d439cec2c533b4f9436ee59f885213d6d7a79d434c7aa8349c6";
158
131
  }
159
132
  const navigate = useNavigate();
160
133
  let t0;
@@ -3,6 +3,9 @@ import { existsSync, readFileSync, readdirSync } from "node:fs";
3
3
  import { basename, resolve } from "node:path";
4
4
 
5
5
  //#region src/features/vite/layoutGeneration.ts
6
+ function propertyName(name) {
7
+ return /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u.test(name) ? name : JSON.stringify(name);
8
+ }
6
9
  /** Keep file identities stable across moves without executing application modules. */
7
10
  function generateLayoutFiles(appRoot) {
8
11
  const directory = resolve(appRoot, "src/layouts");
@@ -28,10 +31,11 @@ export const Layout = createLayout(${JSON.stringify(id)})({
28
31
  writeIfChanged(path, source);
29
32
  const segments = id.split(".");
30
33
  const route = "/" + segments.map((segment) => segment.startsWith("$") ? `:${segment.slice(1)}` : segment).join("/");
31
- const params = segments.filter((segment) => segment.startsWith("$")).map((segment) => `${JSON.stringify(segment.slice(1))}: string`).join("; ");
32
- declarations.push(`${JSON.stringify(id)}: { route: ${JSON.stringify(route)}; params: { ${params} } };`);
34
+ const params = segments.filter((segment) => segment.startsWith("$")).map((segment) => ` ${propertyName(segment.slice(1))}: string;`);
35
+ const paramsType = params.length ? `{\n${params.join("\n")}\n }` : "{}";
36
+ declarations.push(` ${propertyName(id)}: {\n route: ${JSON.stringify(route)};\n params: ${paramsType};\n };`);
33
37
  }
34
- writeIfChanged(resolve(appRoot, "src/camox/layouts.gen.d.ts"), `// Generated by Camox.\nimport "camox/createLayout";\ndeclare module "camox/createLayout" {\n interface LayoutFileRoutes {\n ${declarations.join("\n ")}\n }\n}\n`);
38
+ writeIfChanged(resolve(appRoot, "src/camox/layouts.gen.d.ts"), `// Generated by Camox.\nimport "camox/createLayout";\ndeclare module "camox/createLayout" {\n interface LayoutFileRoutes ${declarations.length ? `{\n${declarations.join("\n")}\n }` : "{}"}\n}\n`);
35
39
  }
36
40
 
37
41
  //#endregion
@@ -267,7 +267,10 @@ function loadRuntimeDevModule(id, options = {}) {
267
267
  if (id === RESOLVED_VIRTUAL_STUDIO_CLIENT) return generateVirtualStudioClient();
268
268
  if (id === RESOLVED_VIRTUAL_STUDIO_CLIENT_URL) return generateVirtualStudioClientUrl();
269
269
  if (id === RESOLVED_VIRTUAL_APP_STYLESHEET_URL) return generateVirtualAppStylesheetUrl();
270
- if (id === RESOLVED_VIRTUAL_STUDIO_CSS) return `export default "/@fs/${resolve(sdkRoot, "dist/studio.css")}";`;
270
+ if (id === RESOLVED_VIRTUAL_STUDIO_CSS) {
271
+ const cssUrl = `/@fs/${resolve(sdkRoot, "dist/studio.css").replaceAll("\\", "/").replace(/^\/+/, "")}`;
272
+ return `export default ${JSON.stringify(cssUrl)};`;
273
+ }
271
274
  if (id === RESOLVED_VIRTUAL_OVERLAY_CSS) return `export default ${JSON.stringify(readFileSync(resolve(sdkRoot, "dist/studio-overlays.css"), "utf-8"))};`;
272
275
  }
273
276
  function normalizeRuntimeBasePath(basePath) {
@@ -23,13 +23,14 @@ type CamoxVitePlugin = Plugin & {
23
23
  interface CamoxPluginOptions {
24
24
  /** Stable, human-readable slug identifying this project (e.g. "prestigious-impala-84") */
25
25
  projectSlug: string;
26
- /** Disable PostHog telemetry collection (default: false) */
26
+ /** Disable telemetry collection (default: false) */
27
27
  disableTelemetry?: boolean;
28
28
  /** Internal options (intended for Camox contributors in development, not for public use) */
29
29
  _internal?: {
30
30
  /** URL of the Camox API backend, used for data fetching */apiUrl?: string; /** URL of the Camox authentication backend (default: https://app.camox.dev) */
31
31
  authenticationUrl?: string; /** Show Tanstack query devtools (default: false) */
32
- enableTanstackDevtools?: boolean; /** Disable automatic code generation (route files and app file) (default: false) */
32
+ enableTanstackDevtools?: boolean; /** Enable the frontend-only comments prototype (default: false). */
33
+ enableComments?: boolean; /** Disable automatic code generation (route files and app file) (default: false) */
33
34
  disableCodeGen?: boolean; /** Mount the Camox-owned dev runtime at this base path. Use "/" for root mode. */
34
35
  runtimeBasePath?: string;
35
36
  };
@@ -11,7 +11,9 @@ import { fileURLToPath } from "node:url";
11
11
  import { createServer } from "vite-plus";
12
12
 
13
13
  //#region src/features/vite/vite.ts
14
- const sdkRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../../..");
14
+ const pluginDir = dirname(fileURLToPath(import.meta.url));
15
+ const sdkRoot = resolve(pluginDir, "../../..");
16
+ const isSdkSource = pluginDir === resolve(sdkRoot, "src/features/vite");
15
17
  const VIRTUAL_STUDIO_CSS = "virtual:camox-studio-css";
16
18
  const RESOLVED_VIRTUAL_STUDIO_CSS = "\0" + VIRTUAL_STUDIO_CSS;
17
19
  const VIRTUAL_OVERLAY_CSS = "virtual:camox-overlay-css";
@@ -58,17 +60,19 @@ function camox(options) {
58
60
  if (id === VIRTUAL_OVERLAY_CSS) return RESOLVED_VIRTUAL_OVERLAY_CSS;
59
61
  },
60
62
  load(id) {
63
+ const stylesDir = resolve(sdkRoot, !isBuild && isSdkSource ? ".dev" : "dist");
61
64
  if (id === RESOLVED_VIRTUAL_STUDIO_CSS) {
62
- const cssPath = resolve(sdkRoot, "dist/studio.css");
65
+ const cssPath = resolve(stylesDir, "studio.css");
63
66
  if (isBuild) {
64
67
  const css = readFileSync(cssPath, "utf-8");
65
68
  const dataUrl = `data:text/css;base64,${Buffer.from(css).toString("base64")}`;
66
69
  return `export default ${JSON.stringify(dataUrl)};`;
67
70
  }
68
- return `export default "/@fs/${cssPath}";`;
71
+ const cssUrl = `/@fs/${cssPath.replaceAll("\\", "/").replace(/^\/+/, "")}`;
72
+ return `export default ${JSON.stringify(cssUrl)};`;
69
73
  }
70
74
  if (id === RESOLVED_VIRTUAL_OVERLAY_CSS) {
71
- const css = readFileSync(resolve(sdkRoot, "dist/studio-overlays.css"), "utf-8");
75
+ const css = readFileSync(resolve(stylesDir, "studio-overlays.css"), "utf-8");
72
76
  return `export default ${JSON.stringify(css)};`;
73
77
  }
74
78
  if (id === RESOLVED_VIRTUAL_PAGE_CLIENT_URL && isBuild) return "export default \"/_chunks/camox-page-client.mjs\";";
@@ -78,7 +82,11 @@ function camox(options) {
78
82
  nitro: { setup(nitro) {
79
83
  if (nitro.options.noExternals !== true) {
80
84
  const noExternals = Array.isArray(nitro.options.noExternals) ? nitro.options.noExternals : [];
81
- nitro.options.noExternals = [...noExternals, "camox"];
85
+ nitro.options.noExternals = [
86
+ ...noExternals,
87
+ "camox",
88
+ "tslib"
89
+ ];
82
90
  }
83
91
  installRuntimeNitroRoutes(nitro, { runtimeBasePath });
84
92
  nitro.hooks.hook("compiled", ({ options }) => {
@@ -101,6 +109,7 @@ function camox(options) {
101
109
  define: {
102
110
  __CAMOX_TELEMETRY_DISABLED__: JSON.stringify(!!options.disableTelemetry),
103
111
  __ENABLE_TANSTACK_DEVTOOLS__: JSON.stringify(enableTanstackDevtools),
112
+ __CAMOX_ENABLE_COMMENTS__: JSON.stringify(options._internal?.enableComments ?? false),
104
113
  __CAMOX_ENVIRONMENT_NAME__: JSON.stringify(environmentName),
105
114
  __CAMOX_API_URL__: JSON.stringify(apiUrl),
106
115
  __CAMOX_AUTHENTICATION_URL__: JSON.stringify(authenticationUrl),
@@ -181,7 +190,6 @@ function camox(options) {
181
190
  "camox > fractional-indexing",
182
191
  "camox > lexical",
183
192
  "camox > lucide-react",
184
- "camox > posthog-js",
185
193
  "camox > @tanstack/react-query-devtools/production",
186
194
  "camox > partysocket/react"
187
195
  ] }
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { getAuthCookieHeader } from "../lib/auth.js";
4
4
  import { getApiUrl, getEnvironmentName } from "../lib/api-client.js";
5
- import { trackClientEvent } from "../lib/telemetry-client.js";
6
5
  import { useCallback, useRef, useState } from "react";
7
6
 
8
7
  //#region src/hooks/use-file-upload.ts
@@ -54,7 +53,6 @@ function useFileUpload(options) {
54
53
  filename: result.filename,
55
54
  mimeType: result.mimeType
56
55
  });
57
- trackClientEvent("file_uploaded", { mimeType: file.type });
58
56
  setUploads((prev_0) => prev_0.map((u_0) => u_0.id === itemId ? {
59
57
  ...u_0,
60
58
  status: "complete",
@@ -0,0 +1,53 @@
1
+ import { useProjectSlug } from "../lib/auth.js";
2
+ import { getPageDestinations } from "../core/pageDestinations.js";
3
+ import { useCamoxApp } from "../features/provider/components/CamoxAppContext.js";
4
+ import { pageQueries, projectQueries } from "../lib/queries.js";
5
+ import { c } from "react/compiler-runtime";
6
+ import { useQuery } from "@tanstack/react-query";
7
+
8
+ //#region src/hooks/use-page-destinations.ts
9
+ function usePageDestinations() {
10
+ const $ = c(11);
11
+ if ($[0] !== "5104e69847ee48202a1abdefc32d4e478db3a82331029421687a5ec8f7a46eaa") {
12
+ for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
13
+ $[0] = "5104e69847ee48202a1abdefc32d4e478db3a82331029421687a5ec8f7a46eaa";
14
+ }
15
+ const app = useCamoxApp();
16
+ const projectSlug = useProjectSlug();
17
+ let t0;
18
+ if ($[1] !== projectSlug) {
19
+ t0 = projectQueries.getBySlug(projectSlug);
20
+ $[1] = projectSlug;
21
+ $[2] = t0;
22
+ } else t0 = $[2];
23
+ const { data: project } = useQuery(t0);
24
+ let t1;
25
+ if ($[3] !== project?.id) {
26
+ t1 = pageQueries.list(project?.id ?? 0);
27
+ $[3] = project?.id;
28
+ $[4] = t1;
29
+ } else t1 = $[4];
30
+ const t2 = !!project;
31
+ let t3;
32
+ if ($[5] !== t1 || $[6] !== t2) {
33
+ t3 = {
34
+ ...t1,
35
+ enabled: t2
36
+ };
37
+ $[5] = t1;
38
+ $[6] = t2;
39
+ $[7] = t3;
40
+ } else t3 = $[7];
41
+ const { data: pages } = useQuery(t3);
42
+ let t4;
43
+ if ($[8] !== app || $[9] !== pages) {
44
+ t4 = getPageDestinations(pages ?? [], app.getLayouts());
45
+ $[8] = app;
46
+ $[9] = pages;
47
+ $[10] = t4;
48
+ } else t4 = $[10];
49
+ return t4;
50
+ }
51
+
52
+ //#endregion
53
+ export { usePageDestinations };
package/dist/lib/auth.js CHANGED
@@ -1,14 +1,11 @@
1
1
  import { actionsStore } from "../features/provider/actionsStore.js";
2
+ import { SERVER_AUTH_COOKIE_NAME, buildClearServerAuthCookieHeader, getServerAuthCookieHeader } from "./server-auth-cookie.js";
2
3
  import { c } from "react/compiler-runtime";
3
4
  import * as React from "react";
4
5
  import { oneTimeTokenClient, organizationClient } from "better-auth/client/plugins";
5
6
  import { createAuthClient } from "better-auth/react";
6
7
 
7
8
  //#region src/lib/auth.ts
8
- const SERVER_AUTH_COOKIE_NAME = "camox_auth_cookie";
9
- function buildClearServerAuthCookieHeader() {
10
- return `${SERVER_AUTH_COOKIE_NAME}=; Path=/; SameSite=Lax; Max-Age=0`;
11
- }
12
9
  function writeServerAuthCookie(cookie) {
13
10
  if (typeof document === "undefined") return;
14
11
  const secure = window.location.protocol === "https:" ? "; Secure" : "";
@@ -217,9 +214,9 @@ function useProcessOtt(authClient) {
217
214
  const AuthContext = React.createContext(null);
218
215
  function useAuthContext() {
219
216
  const $ = c(1);
220
- if ($[0] !== "613abd4be0f81de0bf8df48c671a83e40c3e6ac86dab4c38ebcffe92268b614b") {
217
+ if ($[0] !== "49cbba734e7826ee7cc1d1d95d5d7895a7a71f25806548ac312288b5b8a802f3") {
221
218
  for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
222
- $[0] = "613abd4be0f81de0bf8df48c671a83e40c3e6ac86dab4c38ebcffe92268b614b";
219
+ $[0] = "49cbba734e7826ee7cc1d1d95d5d7895a7a71f25806548ac312288b5b8a802f3";
223
220
  }
224
221
  const ctx = React.useContext(AuthContext);
225
222
  if (!ctx) throw new Error("Missing CamoxProvider");
@@ -227,9 +224,9 @@ function useAuthContext() {
227
224
  }
228
225
  function useProjectSlug() {
229
226
  const $ = c(1);
230
- if ($[0] !== "613abd4be0f81de0bf8df48c671a83e40c3e6ac86dab4c38ebcffe92268b614b") {
227
+ if ($[0] !== "49cbba734e7826ee7cc1d1d95d5d7895a7a71f25806548ac312288b5b8a802f3") {
231
228
  for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
232
- $[0] = "613abd4be0f81de0bf8df48c671a83e40c3e6ac86dab4c38ebcffe92268b614b";
229
+ $[0] = "49cbba734e7826ee7cc1d1d95d5d7895a7a71f25806548ac312288b5b8a802f3";
233
230
  }
234
231
  return useAuthContext().projectSlug;
235
232
  }
@@ -245,18 +242,18 @@ function useAuthState() {
245
242
  }
246
243
  function useIsAuthenticated() {
247
244
  const $ = c(1);
248
- if ($[0] !== "613abd4be0f81de0bf8df48c671a83e40c3e6ac86dab4c38ebcffe92268b614b") {
245
+ if ($[0] !== "49cbba734e7826ee7cc1d1d95d5d7895a7a71f25806548ac312288b5b8a802f3") {
249
246
  for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
250
- $[0] = "613abd4be0f81de0bf8df48c671a83e40c3e6ac86dab4c38ebcffe92268b614b";
247
+ $[0] = "49cbba734e7826ee7cc1d1d95d5d7895a7a71f25806548ac312288b5b8a802f3";
251
248
  }
252
249
  const { isAuthenticated } = useAuthState();
253
250
  return isAuthenticated;
254
251
  }
255
252
  function useSignInRedirect(callbackHref) {
256
253
  const $ = c(4);
257
- if ($[0] !== "613abd4be0f81de0bf8df48c671a83e40c3e6ac86dab4c38ebcffe92268b614b") {
254
+ if ($[0] !== "49cbba734e7826ee7cc1d1d95d5d7895a7a71f25806548ac312288b5b8a802f3") {
258
255
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
259
- $[0] = "613abd4be0f81de0bf8df48c671a83e40c3e6ac86dab4c38ebcffe92268b614b";
256
+ $[0] = "49cbba734e7826ee7cc1d1d95d5d7895a7a71f25806548ac312288b5b8a802f3";
260
257
  }
261
258
  const { authenticationUrl } = useAuthContext();
262
259
  let t0;
@@ -278,9 +275,9 @@ function useSignInRedirect(callbackHref) {
278
275
  */
279
276
  function useAuthActions() {
280
277
  const $ = c(5);
281
- if ($[0] !== "613abd4be0f81de0bf8df48c671a83e40c3e6ac86dab4c38ebcffe92268b614b") {
278
+ if ($[0] !== "49cbba734e7826ee7cc1d1d95d5d7895a7a71f25806548ac312288b5b8a802f3") {
282
279
  for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
283
- $[0] = "613abd4be0f81de0bf8df48c671a83e40c3e6ac86dab4c38ebcffe92268b614b";
280
+ $[0] = "49cbba734e7826ee7cc1d1d95d5d7895a7a71f25806548ac312288b5b8a802f3";
284
281
  }
285
282
  const { authClient, authenticationUrl } = useAuthContext();
286
283
  let t0;
@@ -0,0 +1,21 @@
1
+ //#region src/lib/server-auth-cookie.ts
2
+ const SERVER_AUTH_COOKIE_NAME = "camox_auth_cookie";
3
+ function buildClearServerAuthCookieHeader() {
4
+ return `${SERVER_AUTH_COOKIE_NAME}=; Path=/; SameSite=Lax; Max-Age=0`;
5
+ }
6
+ /** Forward credentials to the API for validation; cookie presence is not authentication.
7
+ * Cross-domain sessions use the mirror. Same-host sessions (including localhost
8
+ * on different ports) may only have Better Auth's native, HttpOnly cookie.
9
+ */
10
+ function getServerAuthCookieHeader(headers) {
11
+ const cookies = (headers.get("Cookie") ?? "").split(";").map((part) => part.trim());
12
+ const mirror = cookies.find((part) => part.startsWith(`${SERVER_AUTH_COOKIE_NAME}=`));
13
+ if (mirror) try {
14
+ const value = decodeURIComponent(mirror.slice(18));
15
+ if (value) return value;
16
+ } catch {}
17
+ return cookies.filter((part) => part.startsWith("better-auth.session_token=") || part.startsWith("__Secure-better-auth.session_token=")).join("; ");
18
+ }
19
+
20
+ //#endregion
21
+ export { SERVER_AUTH_COOKIE_NAME, buildClearServerAuthCookieHeader, getServerAuthCookieHeader };