@gomusdev/web-components 3.0.0 → 3.1.0

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.
package/README.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.1.0 (2026-05-26)
4
+
5
+ ### Features
6
+
7
+ * **coupon:** ensure coupon codes are stored in uppercase and update tests/documentation
8
+
9
+ ### Bug Fixes
10
+
11
+ * **auth:** replace 1s localStorage poll with storage event
12
+
3
13
  ## 3.0.0 (2026-05-26)
4
14
 
5
15
  ### ⚠ BREAKING CHANGES
@@ -5684,7 +5684,11 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
5684
5684
  };
5685
5685
  constructor() {
5686
5686
  this.load();
5687
- setInterval(() => this.load(), 1e3);
5687
+ if (typeof window !== "undefined") {
5688
+ window.addEventListener("storage", (e) => {
5689
+ if (e.key === "go-auth") this.load();
5690
+ });
5691
+ }
5688
5692
  }
5689
5693
  customerLevel() {
5690
5694
  if (this.isGuest()) return 10;
@@ -5726,9 +5730,11 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
5726
5730
  return JSON.stringify(this.#data);
5727
5731
  }
5728
5732
  save() {
5733
+ if (typeof localStorage === "undefined") return;
5729
5734
  localStorage.setItem("go-auth", this.toString());
5730
5735
  }
5731
5736
  load() {
5737
+ if (typeof localStorage === "undefined") return;
5732
5738
  const str = localStorage.getItem("go-auth");
5733
5739
  if (!str) {
5734
5740
  this.signOut();
@@ -17726,7 +17732,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17726
17732
  });
17727
17733
  async function runRedeem(form) {
17728
17734
  const field = form.details.fields.find((f) => f.key === "token");
17729
- const token = (form.details.fieldValue("token") ?? "").trim();
17735
+ const token = (form.details.fieldValue("token") ?? "").trim().toUpperCase();
17730
17736
  if (!token) return { success: true };
17731
17737
  const result = await redeem(token);
17732
17738
  if (!result.success) {
@@ -5684,7 +5684,11 @@ class Auth {
5684
5684
  };
5685
5685
  constructor() {
5686
5686
  this.load();
5687
- setInterval(() => this.load(), 1e3);
5687
+ if (typeof window !== "undefined") {
5688
+ window.addEventListener("storage", (e) => {
5689
+ if (e.key === "go-auth") this.load();
5690
+ });
5691
+ }
5688
5692
  }
5689
5693
  customerLevel() {
5690
5694
  if (this.isGuest()) return 10;
@@ -5726,9 +5730,11 @@ class Auth {
5726
5730
  return JSON.stringify(this.#data);
5727
5731
  }
5728
5732
  save() {
5733
+ if (typeof localStorage === "undefined") return;
5729
5734
  localStorage.setItem("go-auth", this.toString());
5730
5735
  }
5731
5736
  load() {
5737
+ if (typeof localStorage === "undefined") return;
5732
5738
  const str = localStorage.getItem("go-auth");
5733
5739
  if (!str) {
5734
5740
  this.signOut();
@@ -17726,7 +17732,7 @@ function CouponRedemption($$anchor, $$props) {
17726
17732
  });
17727
17733
  async function runRedeem(form) {
17728
17734
  const field = form.details.fields.find((f) => f.key === "token");
17729
- const token = (form.details.fieldValue("token") ?? "").trim();
17735
+ const token = (form.details.fieldValue("token") ?? "").trim().toUpperCase();
17730
17736
  if (!token) return { success: true };
17731
17737
  const result = await redeem(token);
17732
17738
  if (!result.success) {