@fishawack/lab-velocity 2.0.0-beta.50 → 2.0.0-beta.51

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,33 @@
1
+ /**
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)
10
+ */
11
+ export default function clearCookies() {
12
+ const hostname = location.hostname;
13
+ const parts = hostname.split(".");
14
+ const domains = [hostname];
15
+
16
+ // Build domain variants: .360.avalerehealth.com, .avalerehealth.com
17
+ for (let i = 0; i < parts.length - 1; i++) {
18
+ domains.push("." + parts.slice(i).join("."));
19
+ }
20
+
21
+ document.cookie.split(";").forEach((cookie) => {
22
+ const name = cookie.split("=")[0].trim();
23
+ if (!name) return;
24
+
25
+ // Clear with no domain (browser default)
26
+ document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
27
+
28
+ // Clear on each domain variant
29
+ domains.forEach((domain) => {
30
+ document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=${domain}`;
31
+ });
32
+ });
33
+ }
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import axios from "axios";
3
- import Cookies from "js-cookie";
3
+ import clearCookies from "../js/clear-cookies";
4
4
 
5
5
  export default {
6
6
  metaInfo() {
@@ -16,10 +16,7 @@ export default {
16
16
  /* empty */
17
17
  }
18
18
 
19
- // Clear all cookies
20
- Object.keys(Cookies.get()).forEach(function (cookie, attributes) {
21
- Cookies.remove(cookie, attributes);
22
- });
19
+ clearCookies();
23
20
 
24
21
  try {
25
22
  await axios.get("/sanctum/csrf-cookie");
@@ -3,6 +3,8 @@
3
3
  </template>
4
4
 
5
5
  <script>
6
+ import clearCookies from "../js/clear-cookies";
7
+
6
8
  export default {
7
9
  metaInfo() {
8
10
  return {
@@ -20,6 +22,8 @@ export default {
20
22
  } finally {
21
23
  this.done = true;
22
24
  }
25
+
26
+ clearCookies();
23
27
  },
24
28
  };
25
29
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishawack/lab-velocity",
3
- "version": "2.0.0-beta.50",
3
+ "version": "2.0.0-beta.51",
4
4
  "description": "Avalere Health branded style system",
5
5
  "scripts": {
6
6
  "setup": "npm ci || npm i && npm run content",
@@ -57,7 +57,6 @@
57
57
  "dayjs": "^1.11.20",
58
58
  "element-plus": "^2.11.8",
59
59
  "form-backend-validation": "github:mikemellor11/form-backend-validation#master",
60
- "js-cookie": "^3.0.5",
61
60
  "lodash": "^4.17.21",
62
61
  "quill": "^1.3.7",
63
62
  "sanitize-html": "^2.13.1"