@viamrobotics/motion-tools 0.14.5 → 0.14.6

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.
@@ -19,7 +19,11 @@ const addCookie = (name, value, days, path = '/') => {
19
19
  document.cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}${expires}; path=${path}`;
20
20
  };
21
21
  const getCookieExperiments = () => {
22
- return getCookie('weblab_experiments')?.split(',') ?? [];
22
+ const cookie = getCookie('weblab_experiments');
23
+ if (!cookie) {
24
+ return [];
25
+ }
26
+ return decodeURIComponent(cookie).split(',');
23
27
  };
24
28
  export const createWeblabs = () => {
25
29
  const activeExperiments = new SvelteSet();
@@ -41,7 +45,8 @@ export const createWeblabs = () => {
41
45
  export const provideWeblabs = () => {
42
46
  const urlExperiment = new URLSearchParams(window.location.search).get('experiment');
43
47
  if (urlExperiment) {
44
- addCookie('weblab_experiments', [...getCookieExperiments(), urlExperiment].join(','));
48
+ const experimentSet = new Set([...getCookieExperiments(), urlExperiment]);
49
+ addCookie('weblab_experiments', Array.from(experimentSet).join(','));
45
50
  }
46
51
  setContext(WEBLABS_CONTEXT_KEY, createWeblabs());
47
52
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viamrobotics/motion-tools",
3
- "version": "0.14.5",
3
+ "version": "0.14.6",
4
4
  "description": "Motion visualization with Viam",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -90,6 +90,9 @@
90
90
  "svelte": ">=5",
91
91
  "svelte-virtuallists": ">=1"
92
92
  },
93
+ "engines": {
94
+ "node": ">=22.0.0"
95
+ },
93
96
  "svelte": "./dist/index.js",
94
97
  "types": "./dist/index.d.ts",
95
98
  "exports": {