@gomusdev/web-components 3.0.0-next.3 → 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 +43 -0
- package/dist-js/gomus-webcomponents.iife.js +25 -13
- package/dist-js/gomus-webcomponents.js +25 -13
- package/dist-js/gomus-webcomponents.min.iife.js +2 -2
- package/dist-js/gomus-webcomponents.min.js +47 -37
- package/dist-js/src/components/cart/components/Cart.submit.spec.d.ts +1 -0
- package/package.json +1 -1
|
@@ -3765,7 +3765,9 @@ class Ld {
|
|
|
3765
3765
|
// Unix time (seconds)
|
|
3766
3766
|
};
|
|
3767
3767
|
constructor() {
|
|
3768
|
-
this.load(),
|
|
3768
|
+
this.load(), typeof window < "u" && window.addEventListener("storage", (e) => {
|
|
3769
|
+
e.key === "go-auth" && this.load();
|
|
3770
|
+
});
|
|
3769
3771
|
}
|
|
3770
3772
|
customerLevel() {
|
|
3771
3773
|
if (this.isGuest()) return 10;
|
|
@@ -3795,9 +3797,10 @@ class Ld {
|
|
|
3795
3797
|
return JSON.stringify(this.#e);
|
|
3796
3798
|
}
|
|
3797
3799
|
save() {
|
|
3798
|
-
localStorage.setItem("go-auth", this.toString());
|
|
3800
|
+
typeof localStorage > "u" || localStorage.setItem("go-auth", this.toString());
|
|
3799
3801
|
}
|
|
3800
3802
|
load() {
|
|
3803
|
+
if (typeof localStorage > "u") return;
|
|
3801
3804
|
const e = localStorage.getItem("go-auth");
|
|
3802
3805
|
if (!e) {
|
|
3803
3806
|
this.signOut();
|
|
@@ -12612,17 +12615,34 @@ function T1(t, e) {
|
|
|
12612
12615
|
s1(e.$$host, n), pe(() => {
|
|
12613
12616
|
n.preview = r();
|
|
12614
12617
|
}), pe(() => {
|
|
12615
|
-
S.cart && (S.cart.items.map((
|
|
12618
|
+
S.cart && (S.cart.items.map((o) => o.uuid + ":" + o.quantity + ":" + o.time), S.cart.coupons.join("|"), je(() => n.calculateDisplayCart()));
|
|
12616
12619
|
});
|
|
12617
|
-
|
|
12620
|
+
async function i() {
|
|
12621
|
+
const o = e.$$host.querySelectorAll("go-coupon-redemption");
|
|
12622
|
+
let a = !0;
|
|
12623
|
+
for (const l of o) {
|
|
12624
|
+
const u = await l.flush?.();
|
|
12625
|
+
u && !u.success && (a = !1);
|
|
12626
|
+
}
|
|
12627
|
+
return a;
|
|
12628
|
+
}
|
|
12629
|
+
e.$$host.addEventListener("click", async (o) => {
|
|
12630
|
+
const a = o.target.closest("go-submit");
|
|
12631
|
+
if (!a) return;
|
|
12632
|
+
const l = a.closest("go-form");
|
|
12633
|
+
if (l && e.$$host.contains(l)) return;
|
|
12634
|
+
const u = await i();
|
|
12635
|
+
e.$$host.dispatchEvent(new CustomEvent("go-submit", { detail: { ok: u }, bubbles: !0, composed: !0 }));
|
|
12636
|
+
});
|
|
12637
|
+
var s = {
|
|
12618
12638
|
get preview() {
|
|
12619
12639
|
return r();
|
|
12620
12640
|
},
|
|
12621
|
-
set preview(
|
|
12622
|
-
r(
|
|
12641
|
+
set preview(o = !1) {
|
|
12642
|
+
r(o), y();
|
|
12623
12643
|
}
|
|
12624
12644
|
};
|
|
12625
|
-
return ne(
|
|
12645
|
+
return ne(s);
|
|
12626
12646
|
}
|
|
12627
12647
|
customElements.define("go-cart", ie(
|
|
12628
12648
|
T1,
|
|
@@ -12692,45 +12712,35 @@ function F1(t, e) {
|
|
|
12692
12712
|
{ key: "acceptTerms", required: !0 },
|
|
12693
12713
|
{ key: "paymentMode", required: !0 }
|
|
12694
12714
|
]
|
|
12695
|
-
}), pi(e.$$host, "go-form", { "form-id": "checkoutGuest", custom: r() })
|
|
12696
|
-
|
|
12697
|
-
|
|
12698
|
-
|
|
12699
|
-
|
|
12700
|
-
|
|
12701
|
-
u && !u.success && (a = !1);
|
|
12702
|
-
}
|
|
12703
|
-
return a;
|
|
12704
|
-
}
|
|
12705
|
-
e.$$host.addEventListener("go-after-validation", i), e.$$host.addEventListener("submit", async (o) => {
|
|
12706
|
-
const a = o.target;
|
|
12707
|
-
if (!h(n) || !await i()) return;
|
|
12708
|
-
const l = await S.signUp(a.details.formData, !0);
|
|
12709
|
-
if (l.error) {
|
|
12710
|
-
a.details.apiErrors = l.error.errors;
|
|
12715
|
+
}), pi(e.$$host, "go-form", { "form-id": "checkoutGuest", custom: r() }), e.$$host.addEventListener("submit", async (s) => {
|
|
12716
|
+
const o = s.target;
|
|
12717
|
+
if (!h(n)) return;
|
|
12718
|
+
const a = await S.signUp(o.details.formData, !0);
|
|
12719
|
+
if (a.error) {
|
|
12720
|
+
o.details.apiErrors = a.error.errors;
|
|
12711
12721
|
return;
|
|
12712
12722
|
}
|
|
12713
|
-
const
|
|
12714
|
-
h(n).paymentModeId =
|
|
12715
|
-
const
|
|
12716
|
-
if (
|
|
12717
|
-
|
|
12723
|
+
const l = o.details.fieldValue("paymentMode");
|
|
12724
|
+
h(n).paymentModeId = l == null ? void 0 : String(l);
|
|
12725
|
+
const u = await S.checkout(h(n).orderData());
|
|
12726
|
+
if (u.error) {
|
|
12727
|
+
o.details.apiErrors = u.error;
|
|
12718
12728
|
return;
|
|
12719
12729
|
}
|
|
12720
|
-
const
|
|
12721
|
-
|
|
12722
|
-
const
|
|
12723
|
-
et.config.navigateTo?.(
|
|
12730
|
+
const c = et.config.forms.checkoutGuest?.beforeSubmit;
|
|
12731
|
+
c && await c(o.details.formData);
|
|
12732
|
+
const d = u.data.meta.payment_url;
|
|
12733
|
+
et.config.navigateTo?.(d);
|
|
12724
12734
|
});
|
|
12725
|
-
var
|
|
12735
|
+
var i = {
|
|
12726
12736
|
get custom() {
|
|
12727
12737
|
return r();
|
|
12728
12738
|
},
|
|
12729
|
-
set custom(
|
|
12730
|
-
r(
|
|
12739
|
+
set custom(s = !1) {
|
|
12740
|
+
r(s), y();
|
|
12731
12741
|
}
|
|
12732
12742
|
};
|
|
12733
|
-
return ne(
|
|
12743
|
+
return ne(i);
|
|
12734
12744
|
}
|
|
12735
12745
|
customElements.define("go-checkout-form", ie(F1, { custom: {} }, [], []));
|
|
12736
12746
|
const N1 = "TokenActions::ApplyOrderDiscount";
|
|
@@ -12763,7 +12773,7 @@ function Z1(t, e) {
|
|
|
12763
12773
|
fields: [{ key: "token", required: !0 }]
|
|
12764
12774
|
});
|
|
12765
12775
|
async function r(a) {
|
|
12766
|
-
const l = a.details.fields.find((d) => d.key === "token"), u = (a.details.fieldValue("token") ?? "").trim();
|
|
12776
|
+
const l = a.details.fields.find((d) => d.key === "token"), u = (a.details.fieldValue("token") ?? "").trim().toUpperCase();
|
|
12767
12777
|
if (!u) return { success: !0 };
|
|
12768
12778
|
const c = await R1(u);
|
|
12769
12779
|
return c.success ? (l && (l.value = ""), a.dispatchEvent(new Event("go-success", { bubbles: !0, composed: !0 })), c) : (a.details.apiErrors = c.errors, c);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|