@moonbase.sh/vue 0.3.29 → 0.3.32

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.cjs CHANGED
@@ -171,14 +171,18 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
171
171
  term: urlParams.get("utm_term") || void 0,
172
172
  content: urlParams.get("utm_content") || void 0
173
173
  });
174
- if (this.hasUtm && configuration.persistUtm) {
175
- localStorage.setItem(_StorefrontContextImpl.utmKey, JSON.stringify(this.utm.value));
176
- } else if (configuration.persistUtm) {
177
- const cachedUtm = localStorage.getItem(_StorefrontContextImpl.utmKey);
174
+ if (this.hasUtm) {
175
+ (configuration.persistUtm ? localStorage : sessionStorage).setItem(_StorefrontContextImpl.utmKey, JSON.stringify(this.utm.value));
176
+ console.log("Caching given UTM parameters:", (0, import_vue.toRaw)(this.utm.value));
177
+ } else {
178
+ const cachedUtm = (configuration.persistUtm ? localStorage : sessionStorage).getItem(_StorefrontContextImpl.utmKey);
178
179
  if (cachedUtm) {
179
180
  try {
180
- this.utm = stateFactory(_StorefrontContextImpl.utmKey, JSON.parse(cachedUtm));
181
- } catch (e) {
181
+ const parsedUtm = JSON.parse(cachedUtm);
182
+ this.utm.value = parsedUtm;
183
+ console.log("Using cached UTM parameters:", parsedUtm);
184
+ } catch (err) {
185
+ console.warn(`Could not parse cached UTM from ${_StorefrontContextImpl.utmKey}`, err);
182
186
  }
183
187
  }
184
188
  }
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  TokenStore
13
13
  } from "@moonbase.sh/storefront-api";
14
14
  import { v4 as uuidv4 } from "uuid";
15
- import { ref, watch } from "vue";
15
+ import { ref, toRaw, watch } from "vue";
16
16
 
17
17
  // src/symbols.ts
18
18
  var storefrontKey = Symbol("storefront");
@@ -141,14 +141,18 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
141
141
  term: urlParams.get("utm_term") || void 0,
142
142
  content: urlParams.get("utm_content") || void 0
143
143
  });
144
- if (this.hasUtm && configuration.persistUtm) {
145
- localStorage.setItem(_StorefrontContextImpl.utmKey, JSON.stringify(this.utm.value));
146
- } else if (configuration.persistUtm) {
147
- const cachedUtm = localStorage.getItem(_StorefrontContextImpl.utmKey);
144
+ if (this.hasUtm) {
145
+ (configuration.persistUtm ? localStorage : sessionStorage).setItem(_StorefrontContextImpl.utmKey, JSON.stringify(this.utm.value));
146
+ console.log("Caching given UTM parameters:", toRaw(this.utm.value));
147
+ } else {
148
+ const cachedUtm = (configuration.persistUtm ? localStorage : sessionStorage).getItem(_StorefrontContextImpl.utmKey);
148
149
  if (cachedUtm) {
149
150
  try {
150
- this.utm = stateFactory(_StorefrontContextImpl.utmKey, JSON.parse(cachedUtm));
151
- } catch (e) {
151
+ const parsedUtm = JSON.parse(cachedUtm);
152
+ this.utm.value = parsedUtm;
153
+ console.log("Using cached UTM parameters:", parsedUtm);
154
+ } catch (err) {
155
+ console.warn(`Could not parse cached UTM from ${_StorefrontContextImpl.utmKey}`, err);
152
156
  }
153
157
  }
154
158
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/vue",
3
3
  "type": "module",
4
- "version": "0.3.29",
4
+ "version": "0.3.32",
5
5
  "description": "Package to let you build vue.js storefronts with Moonbase.sh as payment and delivery provider",
6
6
  "author": "Tobias Lønnerød Madsen <m@dsen.tv>",
7
7
  "license": "MIT",
@@ -19,7 +19,7 @@
19
19
  "@vue/devtools-api": "^6.6.3",
20
20
  "uuid": "^9.0.1",
21
21
  "zod": "^3.23.8",
22
- "@moonbase.sh/storefront-api": "0.3.29"
22
+ "@moonbase.sh/storefront-api": "0.3.32"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/uuid": "^9.0.8",