@moonbase.sh/vue
Advanced tools
Comparing version
@@ -15,3 +15,3 @@ // src/index.ts | ||
import { v4 as uuidv4 } from "uuid"; | ||
import { ref, watch } from "vue"; | ||
import { ref, toRaw, watch } from "vue"; | ||
@@ -145,10 +145,13 @@ // src/symbols.ts | ||
}); | ||
if (this.hasUtm && configuration.persistUtm) { | ||
localStorage.setItem(_StorefrontContextImpl.utmKey, JSON.stringify(this.utm.value)); | ||
} else if (configuration.persistUtm) { | ||
const cachedUtm = localStorage.getItem(_StorefrontContextImpl.utmKey); | ||
if (this.hasUtm) { | ||
(configuration.persistUtm ? localStorage : sessionStorage).setItem(_StorefrontContextImpl.utmKey, JSON.stringify(this.utm.value)); | ||
console.log("Caching given UTM parameters:", toRaw(this.utm.value)); | ||
} else { | ||
const cachedUtm = (configuration.persistUtm ? localStorage : sessionStorage).getItem(_StorefrontContextImpl.utmKey); | ||
if (cachedUtm) { | ||
try { | ||
this.utm = stateFactory(_StorefrontContextImpl.utmKey, JSON.parse(cachedUtm)); | ||
} catch (e) { | ||
console.log("Using cached UTM parameters:", toRaw(this.utm.value)); | ||
} catch (err) { | ||
console.warn(`Could not parse cached UTM from ${_StorefrontContextImpl.utmKey}`, err); | ||
} | ||
@@ -155,0 +158,0 @@ } |
{ | ||
"name": "@moonbase.sh/vue", | ||
"type": "module", | ||
"version": "0.3.29", | ||
"version": "0.3.31", | ||
"description": "Package to let you build vue.js storefronts with Moonbase.sh as payment and delivery provider", | ||
@@ -22,3 +22,3 @@ "author": "Tobias Lønnerød Madsen <m@dsen.tv>", | ||
"zod": "^3.23.8", | ||
"@moonbase.sh/storefront-api": "0.3.29" | ||
"@moonbase.sh/storefront-api": "0.3.31" | ||
}, | ||
@@ -25,0 +25,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
254415
0.24%3974
0.15%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed