@revenexx/cover 0.1.14 → 0.1.15

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,7 @@
1
+ export default defineNuxtPlugin(() => {
2
+ const auth = useAuthStore();
3
+ const cart = useCartStore();
4
+ // auth.init() must complete first: it detects auth-session expiry and clears
5
+ // the cart (case 2) before cart.initFromServer() tries to restore from server.
6
+ void auth.init().then(() => cart.initFromServer());
7
+ });
@@ -0,0 +1,24 @@
1
+ import { getCookie } from "h3";
2
+
3
+ import type { StoredSession } from "../interfaces/auth";
4
+
5
+ export default defineNuxtPlugin(() => {
6
+ const event = useRequestEvent();
7
+ if (!event) {
8
+ return;
9
+ }
10
+
11
+ const raw = getCookie(event, "cover-session");
12
+ if (!raw) {
13
+ return;
14
+ }
15
+
16
+ try {
17
+ const parsed = JSON.parse(raw) as StoredSession;
18
+ const auth = useAuthStore();
19
+ auth.session = parsed;
20
+ }
21
+ catch {
22
+ // Invalid cookie value — ignore
23
+ }
24
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenexx/cover",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Cover \u2014 revenexx design system for Nuxt. Distributed as a Nuxt layer: generic UI components, theming tokens and stores shared by the demo shop, custom storefronts and the Blokkli theme.",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",