camox 0.60.2 → 0.62.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.
@@ -0,0 +1,74 @@
1
+ import { SettingsPart } from "./SettingsPart.js";
2
+ import { useProjectMutation } from "./useProjectMutation.js";
3
+ import { c } from "react/compiler-runtime";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Label } from "@camox/ui/label";
6
+ import { Switch } from "@camox/ui/switch";
7
+
8
+ //#region src/features/settings/ExperimentalFeaturesSettings.tsx
9
+ function ExperimentalFeaturesSettings(t0) {
10
+ const $ = c(11);
11
+ const { project } = t0;
12
+ let t1;
13
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
14
+ t1 = {
15
+ success: _temp,
16
+ failure: "Could not change the experimental features"
17
+ };
18
+ $[0] = t1;
19
+ } else t1 = $[0];
20
+ const save = useProjectMutation(project, "updateExperimentalFeatures", t1);
21
+ const checked = save.isPending ? save.variables.experimentalFeatures : project.experimentalFeatures;
22
+ let t2;
23
+ if ($[1] !== project.id || $[2] !== save) {
24
+ t2 = (experimentalFeatures_0) => save.mutate({
25
+ id: project.id,
26
+ experimentalFeatures: experimentalFeatures_0
27
+ });
28
+ $[1] = project.id;
29
+ $[2] = save;
30
+ $[3] = t2;
31
+ } else t2 = $[3];
32
+ let t3;
33
+ if ($[4] !== checked || $[5] !== save.isPending || $[6] !== t2) {
34
+ t3 = /* @__PURE__ */ jsx(Switch, {
35
+ id: "camox-experimental-features",
36
+ checked,
37
+ disabled: save.isPending,
38
+ onCheckedChange: t2
39
+ });
40
+ $[4] = checked;
41
+ $[5] = save.isPending;
42
+ $[6] = t2;
43
+ $[7] = t3;
44
+ } else t3 = $[7];
45
+ let t4;
46
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
47
+ t4 = /* @__PURE__ */ jsx(Label, {
48
+ htmlFor: "camox-experimental-features",
49
+ children: "Show experimental features"
50
+ });
51
+ $[8] = t4;
52
+ } else t4 = $[8];
53
+ let t5;
54
+ if ($[9] !== t3) {
55
+ t5 = /* @__PURE__ */ jsx(SettingsPart, {
56
+ title: "Experimental features",
57
+ description: "Features still in development, such as collections. They may change or break.",
58
+ children: /* @__PURE__ */ jsxs("div", {
59
+ className: "flex items-center gap-3",
60
+ children: [t3, t4]
61
+ })
62
+ });
63
+ $[9] = t3;
64
+ $[10] = t5;
65
+ } else t5 = $[10];
66
+ return t5;
67
+ }
68
+ function _temp(t0) {
69
+ const { experimentalFeatures } = t0;
70
+ return experimentalFeatures ? "Experimental features turned on" : "Experimental features turned off";
71
+ }
72
+
73
+ //#endregion
74
+ export { ExperimentalFeaturesSettings };
@@ -5,6 +5,8 @@ import { useMutation } from "@tanstack/react-query";
5
5
  import { toast } from "@camox/ui/toaster";
6
6
 
7
7
  //#region src/features/settings/useProjectMutation.ts
8
+ /** Each project mutation's options, as far as saving with it needs them. */
9
+ const projectMutationOptions = projectMutations;
8
10
  /**
9
11
  * One of the project's mutations, as a Settings part saves with it: once it succeeds the studio
10
12
  * reads the project afresh, then `onSuccess` runs and a toast says `success`; a failure toasts the
@@ -16,11 +18,10 @@ function useProjectMutation(project, mutation, t0) {
16
18
  const studioCache = useStudioCache();
17
19
  let t1;
18
20
  if ($[0] !== mutation) {
19
- t1 = projectMutations[mutation]();
21
+ t1 = projectMutationOptions[mutation]();
20
22
  $[0] = mutation;
21
23
  $[1] = t1;
22
24
  } else t1 = $[1];
23
- const options = t1;
24
25
  let t2;
25
26
  if ($[2] !== onSuccess || $[3] !== project || $[4] !== studioCache || $[5] !== success) {
26
27
  t2 = async (_, variables) => {
@@ -43,13 +44,13 @@ function useProjectMutation(project, mutation, t0) {
43
44
  $[8] = t3;
44
45
  } else t3 = $[8];
45
46
  let t4;
46
- if ($[9] !== options || $[10] !== t2 || $[11] !== t3) {
47
+ if ($[9] !== t1 || $[10] !== t2 || $[11] !== t3) {
47
48
  t4 = {
48
- ...options,
49
+ ...t1,
49
50
  onSuccess: t2,
50
51
  onError: t3
51
52
  };
52
- $[9] = options;
53
+ $[9] = t1;
53
54
  $[10] = t2;
54
55
  $[11] = t3;
55
56
  $[12] = t4;
@@ -29,8 +29,6 @@ export interface CamoxPluginOptions {
29
29
  apiUrl?: string;
30
30
  /** URL of the Camox authentication backend (default: https://app.camox.ai) */
31
31
  authenticationUrl?: string;
32
- /** Enable experimental features (default: false). */
33
- enableExperimentalFeatures?: boolean;
34
32
  /** Disable automatic code generation (route and layout files) (default: false) */
35
33
  disableCodeGen?: boolean;
36
34
  /** Mount the Camox-owned dev runtime at this base path. Use "/" for root mode. */
@@ -304,7 +304,6 @@ function camox(options) {
304
304
  settings: {
305
305
  iconIds,
306
306
  telemetryDisabled: !!options.disableTelemetry,
307
- experimentalFeatures: options._internal?.enableExperimentalFeatures ?? false,
308
307
  apiUrl
309
308
  },
310
309
  mayBuild: !(isRelease && process.env["CAMOX_INTERNAL_HOSTED"] === "1")
@@ -326,7 +325,6 @@ function camox(options) {
326
325
  define: {
327
326
  __CAMOX_ICON_IDS__: JSON.stringify(iconIds),
328
327
  __CAMOX_TELEMETRY_DISABLED__: JSON.stringify(!!options.disableTelemetry),
329
- __CAMOX_ENABLE_EXPERIMENTAL_FEATURES__: JSON.stringify(options._internal?.enableExperimentalFeatures ?? false),
330
328
  __CAMOX_API_URL__: JSON.stringify(apiUrl),
331
329
  __CAMOX_AUTHENTICATION_URL__: JSON.stringify(authenticationUrl),
332
330
  __CAMOX_PROJECT_ID__: JSON.stringify(projectUuid),
@@ -28,6 +28,7 @@ const projectMutations = {
28
28
  update: () => getOrpc().projects.update.mutationOptions(),
29
29
  updateAnalytics: () => getOrpc().projects.updateAnalytics.mutationOptions(),
30
30
  updateSocialProfiles: () => getOrpc().projects.updateSocialProfiles.mutationOptions(),
31
+ updateExperimentalFeatures: () => getOrpc().projects.updateExperimentalFeatures.mutationOptions(),
31
32
  uploadFavicon: () => ({ mutationFn: async ({ projectId, file }) => {
32
33
  const formData = new FormData();
33
34
  formData.append("file", file);
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.60.2";
2
+ var version = "0.62.0";
3
3
 
4
4
  //#endregion
5
5
  export { version };