@fishawack/lab-velocity 2.0.0-beta.53 → 2.0.0-beta.54

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.
@@ -1,19 +1,22 @@
1
+ import axios from "axios";
2
+
1
3
  /**
2
- * Clears all client-accessible cookies on both the current hostname
3
- * and the apex domain, with path=/ to match cookies set with a path.
4
- *
5
- * e.g. for 360.avalerehealth.com this clears cookies on:
6
- * - 360.avalerehealth.com
7
- * - .360.avalerehealth.com
8
- * - .avalerehealth.com
9
- * - (no domain — browser default)
4
+ * Clears all cookies by:
5
+ * 1. Calling the server endpoint to expire HttpOnly cookies (remember token, session)
6
+ * across all parent domain variants
7
+ * 2. Clearing all client-accessible cookies via document.cookie as a fallback
10
8
  */
11
- export default function clearCookies() {
9
+ export default async function clearCookies() {
10
+ try {
11
+ await axios.post("/hydrate/clear-cookies");
12
+ } catch {
13
+ /* endpoint may not exist on older backends */
14
+ }
15
+
12
16
  const hostname = location.hostname;
13
17
  const parts = hostname.split(".");
14
18
  const domains = [hostname];
15
19
 
16
- // Build domain variants: .360.avalerehealth.com, .avalerehealth.com
17
20
  for (let i = 0; i < parts.length - 1; i++) {
18
21
  domains.push("." + parts.slice(i).join("."));
19
22
  }
@@ -22,10 +25,8 @@ export default function clearCookies() {
22
25
  const name = cookie.split("=")[0].trim();
23
26
  if (!name) return;
24
27
 
25
- // Clear with no domain (browser default)
26
28
  document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
27
29
 
28
- // Clear on each domain variant
29
30
  domains.forEach((domain) => {
30
31
  document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=${domain}`;
31
32
  });
@@ -79,7 +79,7 @@ export default {
79
79
  email: this.$route.query.email ?? "",
80
80
  password: "",
81
81
  device_name: "Mobile device",
82
- remember: false, // (DISABLE REMEMBER UNTIL SUBDOMAIN ISSUE RESOLVED FOR ALL .avh-det.com & .avalereheatlth.com domains
82
+ remember: true,
83
83
  },
84
84
  { resetOnSuccess: false },
85
85
  ),
@@ -70,7 +70,7 @@ export default {
70
70
  {
71
71
  email: "",
72
72
  device_name: "Mobile device",
73
- remember: false, // (DISABLE REMEMBER UNTIL SUBDOMAIN ISSUE RESOLVED FOR ALL .avh-det.com & .avalereheatlth.com domains
73
+ remember: true,
74
74
  },
75
75
  { resetOnSuccess: false },
76
76
  ),
@@ -16,7 +16,7 @@ export default {
16
16
  /* empty */
17
17
  }
18
18
 
19
- clearCookies();
19
+ await clearCookies();
20
20
 
21
21
  try {
22
22
  await axios.get("/sanctum/csrf-cookie");
@@ -24,7 +24,7 @@ export default {
24
24
  /* empty */
25
25
  }
26
26
 
27
- clearCookies();
27
+ await clearCookies();
28
28
 
29
29
  try {
30
30
  await axios.get("/sanctum/csrf-cookie");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishawack/lab-velocity",
3
- "version": "2.0.0-beta.53",
3
+ "version": "2.0.0-beta.54",
4
4
  "description": "Avalere Health branded style system",
5
5
  "scripts": {
6
6
  "setup": "npm ci || npm i && npm run content",