camox 0.35.0 → 0.36.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.
@@ -8,19 +8,19 @@ import { Button } from "@camox/ui/button";
8
8
  import { Monitor, Smartphone, Tablet, X } from "lucide-react";
9
9
  import { Label } from "@camox/ui/label";
10
10
  import { ButtonGroup } from "@camox/ui/button-group";
11
- import { Switch } from "@camox/ui/switch";
12
11
  import * as Tooltip$1 from "@camox/ui/tooltip";
12
+ import { Switch } from "@camox/ui/switch";
13
13
  import { FloatingToolbar } from "@camox/ui/floating-toolbar";
14
14
  import { Toggle } from "@camox/ui/toggle";
15
15
 
16
16
  //#region src/features/preview/components/PreviewToolbar.tsx
17
17
  const PreviewToolbar = (t0) => {
18
- const $ = c(68);
19
- if ($[0] !== "68e35a20462160afd6c2aeaffaf03edcd93240318bca212e17001e624c1d829c") {
20
- for (let $i = 0; $i < 68; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
21
- $[0] = "68e35a20462160afd6c2aeaffaf03edcd93240318bca212e17001e624c1d829c";
18
+ const $ = c(74);
19
+ if ($[0] !== "f9ff999569a69264033e31a270ebbb7097b2072aec97a7129d1758e95b5b6407") {
20
+ for (let $i = 0; $i < 74; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
21
+ $[0] = "f9ff999569a69264033e31a270ebbb7097b2072aec97a7129d1758e95b5b6407";
22
22
  }
23
- const { onEditModeChange } = t0;
23
+ const { onEditModeChange, pageStatus, hasLiveVersion } = t0;
24
24
  const isEditMode = useSelector(previewStore, _temp);
25
25
  const isToolbarHidden = useSelector(previewStore, _temp2);
26
26
  const actions = useSelector(actionsStore, _temp3);
@@ -70,7 +70,7 @@ const PreviewToolbar = (t0) => {
70
70
  let t5;
71
71
  if ($[11] !== t2 || $[12] !== t4) {
72
72
  t5 = /* @__PURE__ */ jsxs("div", {
73
- className: "flex items-center gap-2 px-2",
73
+ className: "flex shrink-0 items-center gap-2 px-2",
74
74
  children: [t2, t4]
75
75
  });
76
76
  $[11] = t2;
@@ -246,65 +246,88 @@ const PreviewToolbar = (t0) => {
246
246
  $[53] = t30;
247
247
  } else t30 = $[53];
248
248
  let t31;
249
- if ($[54] !== isEditMode) {
250
- t31 = /* @__PURE__ */ jsx(Button, {
249
+ if ($[54] !== hasLiveVersion || $[55] !== pageStatus) {
250
+ t31 = pageStatus && /* @__PURE__ */ jsx(Button, {
251
+ type: "button",
252
+ variant: "outline",
253
+ disabled: pageStatus === "published" || !hasLiveVersion,
254
+ onClick: _temp5,
255
+ children: "View live site"
256
+ });
257
+ $[54] = hasLiveVersion;
258
+ $[55] = pageStatus;
259
+ $[56] = t31;
260
+ } else t31 = $[56];
261
+ let t32;
262
+ if ($[57] !== isEditMode) {
263
+ t32 = /* @__PURE__ */ jsx(Button, {
251
264
  type: "button",
252
265
  variant: "ghost",
253
266
  size: "icon",
254
267
  disabled: isEditMode,
255
- onClick: _temp5,
268
+ onClick: _temp6,
256
269
  "aria-label": "Hide toolbar",
257
270
  className: "text-muted-foreground"
258
271
  });
259
- $[54] = isEditMode;
260
- $[55] = t31;
261
- } else t31 = $[55];
262
- let t32;
263
- if ($[56] === Symbol.for("react.memo_cache_sentinel")) {
264
- t32 = /* @__PURE__ */ jsx(X, {});
265
- $[56] = t32;
266
- } else t32 = $[56];
272
+ $[57] = isEditMode;
273
+ $[58] = t32;
274
+ } else t32 = $[58];
267
275
  let t33;
268
- if ($[57] !== t31) {
269
- t33 = /* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
270
- render: t31,
271
- children: t32
272
- });
273
- $[57] = t31;
274
- $[58] = t33;
275
- } else t33 = $[58];
276
- let t34;
277
276
  if ($[59] === Symbol.for("react.memo_cache_sentinel")) {
278
- t34 = /* @__PURE__ */ jsx(Tooltip$1.TooltipContent, { children: "Hide toolbar" });
279
- $[59] = t34;
280
- } else t34 = $[59];
277
+ t33 = /* @__PURE__ */ jsx(X, {});
278
+ $[59] = t33;
279
+ } else t33 = $[59];
280
+ let t34;
281
+ if ($[60] !== t32) {
282
+ t34 = /* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
283
+ render: t32,
284
+ children: t33
285
+ });
286
+ $[60] = t32;
287
+ $[61] = t34;
288
+ } else t34 = $[61];
281
289
  let t35;
282
- if ($[60] !== t33) {
283
- t35 = /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [t33, t34] });
284
- $[60] = t33;
285
- $[61] = t35;
286
- } else t35 = $[61];
290
+ if ($[62] === Symbol.for("react.memo_cache_sentinel")) {
291
+ t35 = /* @__PURE__ */ jsx(Tooltip$1.TooltipContent, { children: "Hide toolbar" });
292
+ $[62] = t35;
293
+ } else t35 = $[62];
287
294
  let t36;
288
- if ($[62] !== t30 || $[63] !== t35) {
289
- t36 = /* @__PURE__ */ jsxs("div", {
290
- className: "flex items-center gap-2",
291
- children: [t30, t35]
292
- });
293
- $[62] = t30;
294
- $[63] = t35;
295
+ if ($[63] !== t34) {
296
+ t36 = /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [t34, t35] });
297
+ $[63] = t34;
295
298
  $[64] = t36;
296
299
  } else t36 = $[64];
297
300
  let t37;
298
- if ($[65] !== t36 || $[66] !== t5) {
299
- t37 = /* @__PURE__ */ jsxs(FloatingToolbar, {
300
- className: "bottom-2 justify-between gap-8 transition-none",
301
- children: [t5, t36]
301
+ if ($[65] !== t31 || $[66] !== t36) {
302
+ t37 = /* @__PURE__ */ jsxs("div", {
303
+ className: "flex items-center gap-2",
304
+ children: [t31, t36]
302
305
  });
303
- $[65] = t36;
304
- $[66] = t5;
306
+ $[65] = t31;
307
+ $[66] = t36;
305
308
  $[67] = t37;
306
309
  } else t37 = $[67];
307
- return t37;
310
+ let t38;
311
+ if ($[68] !== t30 || $[69] !== t37) {
312
+ t38 = /* @__PURE__ */ jsxs("div", {
313
+ className: "flex shrink-0 items-center gap-8 self-stretch",
314
+ children: [t30, t37]
315
+ });
316
+ $[68] = t30;
317
+ $[69] = t37;
318
+ $[70] = t38;
319
+ } else t38 = $[70];
320
+ let t39;
321
+ if ($[71] !== t38 || $[72] !== t5) {
322
+ t39 = /* @__PURE__ */ jsxs(FloatingToolbar, {
323
+ className: "bottom-2 w-max justify-between gap-8 transition-none",
324
+ children: [t5, t38]
325
+ });
326
+ $[71] = t38;
327
+ $[72] = t5;
328
+ $[73] = t39;
329
+ } else t39 = $[73];
330
+ return t39;
308
331
  };
309
332
  function _temp(state) {
310
333
  return state.context.isEditMode;
@@ -319,6 +342,9 @@ function _temp4(state_2) {
319
342
  return state_2.context.viewportMode;
320
343
  }
321
344
  function _temp5() {
345
+ return previewStore.send({ type: "viewLivePage" });
346
+ }
347
+ function _temp6() {
322
348
  return previewStore.send({ type: "hideToolbar" });
323
349
  }
324
350
 
@@ -26,7 +26,6 @@ const previewStore = createStore({
26
26
  context: {
27
27
  isEditMode: false,
28
28
  isToolbarHidden: false,
29
- isSidebarOpen: true,
30
29
  isPageEditorSidebarOpen: false,
31
30
  isAddBlockSidebarOpen: false,
32
31
  addBlockSource: null,
@@ -64,17 +63,25 @@ const previewStore = createStore({
64
63
  return {
65
64
  ...context,
66
65
  isEditMode: true,
67
- isSidebarOpen: true
66
+ isToolbarHidden: false
68
67
  };
69
68
  },
70
69
  hideToolbar: (context) => ({
71
70
  ...context,
72
71
  isToolbarHidden: true
73
72
  }),
74
- toggleSidebar: (context) => ({
75
- ...context,
76
- isSidebarOpen: true
77
- }),
73
+ viewLivePage: (context, _, enqueue) => {
74
+ enqueue.effect(() => {
75
+ if (context.isEditMode) trackClientEvent("edit_mode_toggled", { enabled: false });
76
+ toast("Viewing live version of the site");
77
+ });
78
+ return {
79
+ ...context,
80
+ isEditMode: false,
81
+ isToolbarHidden: true,
82
+ previewSource: "live"
83
+ };
84
+ },
78
85
  setViewportMode: (context, event) => {
79
86
  if (context.viewportMode === event.mode) return context;
80
87
  return {
@@ -39,9 +39,9 @@ function getStudioTarget(to, runtimeBasePath) {
39
39
  }
40
40
  function StudioNavigationProvider(t0) {
41
41
  const $ = c(19);
42
- if ($[0] !== "df5809d38cc8796db839fa5b8c8d05f562a3e4cba7d51a1fec989dc85db9136b") {
42
+ if ($[0] !== "8131144acb7b9faccf5f5924d863b9186349bfc7c842e7feba7a3ac1e01ed910") {
43
43
  for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
44
- $[0] = "df5809d38cc8796db839fa5b8c8d05f562a3e4cba7d51a1fec989dc85db9136b";
44
+ $[0] = "8131144acb7b9faccf5f5924d863b9186349bfc7c842e7feba7a3ac1e01ed910";
45
45
  }
46
46
  const { children, href, pathname, runtimeBasePath } = t0;
47
47
  let t1;
@@ -53,6 +53,11 @@ function StudioNavigationProvider(t0) {
53
53
  window.location.assign(to);
54
54
  return;
55
55
  }
56
+ const currentPathname = normalizeRuntimePathname(window.location.pathname, runtimeBasePath);
57
+ if (normalizeRuntimePathname(target.pathname, runtimeBasePath) !== currentPathname) {
58
+ window.location.assign(target.href);
59
+ return;
60
+ }
56
61
  if (replace) window.history.replaceState(null, "", target.href);
57
62
  else window.history.pushState(null, "", target.href);
58
63
  window.dispatchEvent(new Event("camox:navigation"));
@@ -36,9 +36,9 @@ const links = [{
36
36
  }];
37
37
  const Navbar = () => {
38
38
  const $ = c(19);
39
- if ($[0] !== "9b1adcbc6464388cc572701469e917a5652b82c7ccc4e66be74fb1820176f49e") {
39
+ if ($[0] !== "4fd5828728ac76dc7c63a1b38dbea3991a6750be46540e90d91c5dccb46797e2") {
40
40
  for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
41
- $[0] = "9b1adcbc6464388cc572701469e917a5652b82c7ccc4e66be74fb1820176f49e";
41
+ $[0] = "4fd5828728ac76dc7c63a1b38dbea3991a6750be46540e90d91c5dccb46797e2";
42
42
  }
43
43
  const projectSlug = useProjectSlug();
44
44
  let t0;
@@ -136,7 +136,7 @@ const Navbar = () => {
136
136
  let t10;
137
137
  if ($[17] !== t6) {
138
138
  t10 = /* @__PURE__ */ jsxs("nav", {
139
- className: "relative flex items-center justify-between gap-4 border-b-2 bg-transparent px-2 py-2",
139
+ className: "bg-background relative flex items-center justify-between gap-4 border-b-2 px-2 py-2",
140
140
  children: [t6, t9]
141
141
  });
142
142
  $[17] = t6;
@@ -146,9 +146,9 @@ const Navbar = () => {
146
146
  };
147
147
  function useNavbarActions() {
148
148
  const $ = c(4);
149
- if ($[0] !== "9b1adcbc6464388cc572701469e917a5652b82c7ccc4e66be74fb1820176f49e") {
149
+ if ($[0] !== "4fd5828728ac76dc7c63a1b38dbea3991a6750be46540e90d91c5dccb46797e2") {
150
150
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
151
- $[0] = "9b1adcbc6464388cc572701469e917a5652b82c7ccc4e66be74fb1820176f49e";
151
+ $[0] = "4fd5828728ac76dc7c63a1b38dbea3991a6750be46540e90d91c5dccb46797e2";
152
152
  }
153
153
  const navigate = useNavigate();
154
154
  let t0;
@@ -13,9 +13,9 @@ import { Skeleton } from "@camox/ui/skeleton";
13
13
  //#region src/features/studio/components/ProjectMenu.tsx
14
14
  const Favicon = (t0) => {
15
15
  const $ = c(19);
16
- if ($[0] !== "5b6284d7940526e6093811e0cb2663e0916c58abe0f07e36b7140e4a9eb93d0f") {
16
+ if ($[0] !== "d995cbe0a8e25c463e5078777395b1432b84ff5ecc4a4a3cc0e7e416badd244d") {
17
17
  for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
18
- $[0] = "5b6284d7940526e6093811e0cb2663e0916c58abe0f07e36b7140e4a9eb93d0f";
18
+ $[0] = "d995cbe0a8e25c463e5078777395b1432b84ff5ecc4a4a3cc0e7e416badd244d";
19
19
  }
20
20
  const { size: t1 } = t0;
21
21
  const size = t1 === void 0 ? 16 : t1;
@@ -113,9 +113,9 @@ const Favicon = (t0) => {
113
113
  };
114
114
  const ProjectMenu = () => {
115
115
  const $ = c(41);
116
- if ($[0] !== "5b6284d7940526e6093811e0cb2663e0916c58abe0f07e36b7140e4a9eb93d0f") {
116
+ if ($[0] !== "d995cbe0a8e25c463e5078777395b1432b84ff5ecc4a4a3cc0e7e416badd244d") {
117
117
  for (let $i = 0; $i < 41; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
118
- $[0] = "5b6284d7940526e6093811e0cb2663e0916c58abe0f07e36b7140e4a9eb93d0f";
118
+ $[0] = "d995cbe0a8e25c463e5078777395b1432b84ff5ecc4a4a3cc0e7e416badd244d";
119
119
  }
120
120
  const authCtx = React.useContext(AuthContext);
121
121
  let t0;
@@ -282,7 +282,7 @@ const ProjectMenu = () => {
282
282
  if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
283
283
  t22 = /* @__PURE__ */ jsxs(DropdownMenuItem, {
284
284
  render: /* @__PURE__ */ jsx(Link$1, {
285
- to: "https://camox.ai",
285
+ to: "https://camox.dev",
286
286
  target: "_blank"
287
287
  }),
288
288
  children: [/* @__PURE__ */ jsx(Info, { className: "h-4 w-4" }), "Powered by Camox"]
@@ -28,7 +28,7 @@ interface CamoxPluginOptions {
28
28
  disableTelemetry?: boolean;
29
29
  /** Internal options (intended for Camox contributors in development, not for public use) */
30
30
  _internal?: {
31
- /** URL of the Camox API backend, used for data fetching */apiUrl?: string; /** URL of the Camox authentication backend (default: https://app.camox.ai) */
31
+ /** URL of the Camox API backend, used for data fetching */apiUrl?: string; /** URL of the Camox authentication backend (default: https://app.camox.dev) */
32
32
  authenticationUrl?: string; /** Show Tanstack query devtools (default: false) */
33
33
  enableTanstackDevtools?: boolean; /** Disable automatic code generation (route files, app file, skill files) (default: false) */
34
34
  disableCodeGen?: boolean; /** Mount the Camox-owned dev runtime at this base path. Use "/" for root mode. */
@@ -21,9 +21,9 @@ const VIRTUAL_PAGE_CLIENT = "virtual:camox/page-client";
21
21
  const RESOLVED_VIRTUAL_PAGE_CLIENT_URL = "\0virtual:camox/page-client-url";
22
22
  const VIRTUAL_STUDIO_CLIENT = "virtual:camox/studio-client";
23
23
  const RESOLVED_VIRTUAL_STUDIO_CLIENT_URL = "\0virtual:camox/studio-client-url";
24
- const PRODUCTION_API_URL = "https://api.camox.ai";
24
+ const PRODUCTION_API_URL = "https://api.camox.dev";
25
25
  /** Authentication URL to use for Camox authentication (production Camox Dashboard) */
26
- const DEFAULT_AUTHENTICATION_URL = "https://app.camox.ai";
26
+ const DEFAULT_AUTHENTICATION_URL = "https://app.camox.dev";
27
27
  const authTokenSchema = z.object({
28
28
  token: z.string(),
29
29
  name: z.string(),
@@ -8,7 +8,7 @@ function ensureInitialized() {
8
8
  if (typeof window === "undefined") return false;
9
9
  if (initialized) return true;
10
10
  posthog.init(POSTHOG_PUBLIC_KEY, {
11
- api_host: "https://t.camox.ai",
11
+ api_host: "https://t.camox.dev",
12
12
  ui_host: "https://us.posthog.com",
13
13
  defaults: "2026-01-30",
14
14
  autocapture: false,
@@ -56,7 +56,7 @@ function identifyProject(options) {
56
56
  slug: options.projectSlug
57
57
  });
58
58
  }
59
- /** Client-side tracking for CMS actions. Events route through t.camox.ai reverse proxy. */
59
+ /** Client-side tracking for CMS actions. Events route through t.camox.dev reverse proxy. */
60
60
  function trackClientEvent(event, properties) {
61
61
  if (!ensureInitialized()) return;
62
62
  posthog.capture(event, properties);