@kizlo/woocommerce 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5,6 +5,11 @@ import z$1, { z } from "zod/v4";
5
5
  import z$2 from "zod";
6
6
 
7
7
  //#region src/session.ts
8
+ const GUEST_COOKIE_OPTIONS = {
9
+ httpOnly: true,
10
+ path: "/",
11
+ sameSite: "lax"
12
+ };
8
13
  async function mintGuestToken(secret, ttlSeconds) {
9
14
  const sub = random({
10
15
  length: 32,
@@ -49,10 +54,7 @@ function sessionMiddleware(options) {
49
54
  await context.cookies.set({
50
55
  name: cookieName,
51
56
  value: jwt,
52
- options: {
53
- httpOnly: true,
54
- sameSite: "lax"
55
- }
57
+ options: GUEST_COOKIE_OPTIONS
56
58
  });
57
59
  return next({ context: { sessionHeaders: getCartHeaders({
58
60
  token: sub,
@@ -65,10 +67,7 @@ function sessionMiddleware(options) {
65
67
  await context.cookies.set({
66
68
  name: cookieName,
67
69
  value: jwt,
68
- options: {
69
- httpOnly: true,
70
- sameSite: "lax"
71
- }
70
+ options: GUEST_COOKIE_OPTIONS
72
71
  });
73
72
  throw new KizloError("CART_SESSION_EXPIRED");
74
73
  }
@@ -87,7 +86,7 @@ function sessionMiddleware(options) {
87
86
  }) });
88
87
  if (response.error) context.logger.error("CART_MERGE_FAILED", response.error);
89
88
  }
90
- await context.cookies.delete(cookieName);
89
+ await context.cookies.delete(cookieName, GUEST_COOKIE_OPTIONS);
91
90
  }
92
91
  return next({ context: { sessionHeaders: getCartHeaders({
93
92
  userId: auth.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kizlo/woocommerce",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "WooCommerce extension for Kizlo.",