@bikematrix/web-components 1.3.15 → 1.3.16

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.
@@ -1718,7 +1718,7 @@ const os = Ae(!1), Z = Ae(null), xr = Ae([]), hr = Ae(!1), Ee = Ae(!1), _r = Ae(
1718
1718
  Ed(() => {
1719
1719
  Z.value = null, xr.value = [], hr.value = !1, Ee.value = !1, _r.value = [], Qe.value = !1, mn.value = null, ke.value = null, Wi.value = !1, bn.value = !0, _t.value = !1;
1720
1720
  });
1721
- }, qs = "bm_currentBike", Md = "v2", Ln = 2, as = "https://cdn.bikematrix.io", vn = "https://imagestore.bikematrix.io", Pd = "1.0.2", jo = {
1721
+ }, qs = "bm_currentBike", Md = "v2", Ln = 2, as = "https://cdn.bikematrix.io", vn = "https://imagestore.bikematrix.io", Pd = "1.0.3", jo = {
1722
1722
  // Shopify specific
1723
1723
  isShopify: !1,
1724
1724
  skuField: "sku",
@@ -4747,7 +4747,7 @@ class Se {
4747
4747
  ...this._apiToken && {
4748
4748
  "bm-app-token": this._apiToken
4749
4749
  },
4750
- "bm-sdk-version": "1.3.15",
4750
+ "bm-sdk-version": "1.3.16",
4751
4751
  // Added globally so request origin context is available on every endpoint.
4752
4752
  "bm-url": window.location.href,
4753
4753
  // Added globally so all endpoints can be tied to the same page-load event.
@@ -6534,7 +6534,7 @@ const e2 = Be(`bm_translation_${Pd}.json`), t2 = async () => {
6534
6534
  return await me.use(Ml).use(Cd).init({
6535
6535
  debug: !1,
6536
6536
  resources: t,
6537
- supportedLngs: ["en", "en-GB", "en-US", "de", "fr", "es", "it", "nl", "fi", "pl"],
6537
+ supportedLngs: ["en", "en-GB", "en-US", "de", "fr", "es", "it", "nl", "fi", "pl", "da", "sl"],
6538
6538
  fallbackLng: "en-GB",
6539
6539
  ns: ["translation"],
6540
6540
  defaultNS: "translation",
@@ -6557,7 +6557,7 @@ const e2 = Be(`bm_translation_${Pd}.json`), t2 = async () => {
6557
6557
  ...e
6558
6558
  }), this.initializeConfig(), this.service = new Se(this.config.apiUrl, this.config.apiKey, this.config.apiToken, this.config.isShopify), this.initializeActiveSubscription(), localStorage.bm_currentBike && (this.currentBike = JSON.parse(localStorage.bm_currentBike)), await t2(), (this.config.logLevel === "verbose" || this.config.logLevel === "core") && console.log(`Core: Resolved Language: ${me.resolvedLanguage}`), this.setupEventListeners(), this.registerComponents(), this.initialized = !0, os.value = !0;
6559
6559
  const t = new Event("BM:Initialized");
6560
- document.dispatchEvent(t), (this.config.logLevel === "verbose" || this.config.logLevel === "core") && (console.log("Core: BikeMatrix WebComponent Version: 1.3.15"), console.log("Core: BikeMatrixCore initialized"));
6560
+ document.dispatchEvent(t), (this.config.logLevel === "verbose" || this.config.logLevel === "core") && (console.log("Core: BikeMatrix WebComponent Version: 1.3.16"), console.log("Core: BikeMatrixCore initialized"));
6561
6561
  }
6562
6562
  // Singleton pattern to ensure a single global instance
6563
6563
  static getInstance() {
@@ -8950,7 +8950,7 @@ function rt({
8950
8950
  if (!f.current)
8951
8951
  return;
8952
8952
  const C = f.current.querySelectorAll("&>div")[A];
8953
- f.current.scrollLeft = C.clientWidth * A;
8953
+ C && (f.current.scrollLeft = C.offsetLeft);
8954
8954
  }
8955
8955
  function g() {
8956
8956
  b != 0 && m(b - 1);
@@ -8963,7 +8963,7 @@ function rt({
8963
8963
  class: X("rounded-xl select-none border py-4 relative", e ? "border-gray-950" : "border-gray-300"),
8964
8964
  ...d,
8965
8965
  onClick: (A) => {
8966
- if (w.current && !w.current.contains(A.target))
8966
+ if (a && w.current && !w.current.contains(A.target))
8967
8967
  a(A);
8968
8968
  else {
8969
8969
  A.preventDefault();
@@ -9644,7 +9644,7 @@ function Ef() {
9644
9644
  const g = new URLSearchParams(window.location.search).get("bikematrixid"), x = sessionStorage.getItem("bm_passed_id");
9645
9645
  if (!(x && x !== null && g === x) && (!x || g !== x)) {
9646
9646
  const _ = n.find((y) => y.key === g);
9647
- _ ? (i(_), sessionStorage.setItem("bm_passed_id", g)) : _ || (await w(g), sessionStorage.setItem("bm_passed_id", g));
9647
+ _ && g ? (i(_), sessionStorage.setItem("bm_passed_id", g)) : !_ && g && (await w(g), sessionStorage.setItem("bm_passed_id", g));
9648
9648
  }
9649
9649
  }, w = async (m) => {
9650
9650
  const g = await b.getBikeBom(m);
@@ -9710,7 +9710,7 @@ function Ef() {
9710
9710
  onClick: (m) => {
9711
9711
  m.preventDefault(), o(), re("/add");
9712
9712
  },
9713
- class: X("duration-300 transition-colors sticky bottom-[128px] mt-auto rounded-xl p-3 pr-5 w-full flex justify-center items-center", n.length && !(t != null && t.key) ? "bg-gray-950 text-white" : n.length ? "bg-gray-200 text-gray-800" : "bg-gray-950 text-white", !t && "bottom-0", t && f && "bottom-[128px]", t && !f && "bottom-[72px]"),
9713
+ class: X("duration-300 transition-colors sticky bottom-[128px] mt-auto rounded-xl p-3 pr-5 w-full flex justify-center items-center z-20", n.length && !(t != null && t.key) ? "bg-gray-950 text-white" : n.length ? "bg-gray-200 text-gray-800" : "bg-gray-950 text-white", !t && "bottom-0", t && f && "bottom-[128px]", t && !f && "bottom-[72px]"),
9714
9714
  children: [l("bikeselector_home_add_btn"), p(gi, {
9715
9715
  class: "h-3 absolute [&>path]:stroke-[2px] right-5 justify-self-end rotate-45"
9716
9716
  })]
@@ -9718,7 +9718,7 @@ function Ef() {
9718
9718
  onClick: (m) => {
9719
9719
  m.preventDefault(), !(t != null && t.isCustom) && !(t != null && t.isShared) ? re("/workshop") : t != null && t.isCustom && !(t != null && t.isShared) ? re("/bom") : !(t != null && t.isCustom) && (t != null && t.isShared) && re("/read-only");
9720
9720
  },
9721
- class: X("duration-300 sticky bottom-[72px] transition-colors mt-4 rounded-xl p-3 w-full flex justify-center items-center", "bg-gray-200 text-gray-800"),
9721
+ class: X("duration-300 sticky bottom-[72px] transition-colors mt-4 rounded-xl p-3 w-full flex justify-center items-center z-20", "bg-gray-200 text-gray-800"),
9722
9722
  children: [l("virtualworkshop_title"), p(Sf, {
9723
9723
  class: "h-5 absolute right-5 justify-self-end"
9724
9724
  })]
@@ -9726,7 +9726,7 @@ function Ef() {
9726
9726
  onClick: (m) => {
9727
9727
  m.preventDefault(), !r.showBrowseCategoryButtons && r.browseCompatibilityUrl ? window.location.href = r.browseCompatibilityUrl : re("/browse");
9728
9728
  },
9729
- class: X("duration-300 sticky bottom-4 transition-colors mt-4 rounded-xl p-3 w-full flex justify-center items-center", n.length ? "bg-gray-950 text-white" : "bg-gray-200 text-gray-800"),
9729
+ class: X("duration-300 sticky bottom-4 transition-colors mt-4 rounded-xl p-3 w-full flex justify-center items-center z-20", n.length ? "bg-gray-950 text-white" : "bg-gray-200 text-gray-800"),
9730
9730
  children: l("bikeselector_home_browse_btn")
9731
9731
  }), p(Bt, {})]
9732
9732
  });
@@ -14305,7 +14305,7 @@ function F1() {
14305
14305
  s.logLevel === "verbose" && console.error(F.logError), E(F.error);
14306
14306
  return;
14307
14307
  }
14308
- } else if (/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/g.test(g)) {
14308
+ } else if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(g)) {
14309
14309
  const F = await C.saveCustomBike(e.key, g);
14310
14310
  if (F.success)
14311
14311
  B();
@@ -14313,7 +14313,8 @@ function F1() {
14313
14313
  s.logLevel === "verbose" && console.error(F.logError), E(F.error);
14314
14314
  return;
14315
14315
  }
14316
- }
14316
+ } else
14317
+ E("error_invalid_email");
14317
14318
  };
14318
14319
  U(() => {
14319
14320
  k && _ && y("");
@@ -14822,16 +14823,17 @@ const z1 = `.edit-field__wrapper{position:relative}.edit-container{display:flex;
14822
14823
  });
14823
14824
  };
14824
14825
  return U(() => {
14825
- a && d.current.focus();
14826
+ var x;
14827
+ a && ((x = d == null ? void 0 : d.current) == null || x.focus());
14826
14828
  }, [a]), U(() => {
14827
14829
  n ? (g(), b({
14828
14830
  type: "success",
14829
14831
  message: o("virtualworkshop_saved", {
14830
14832
  label: i
14831
14833
  })
14832
- })) : !n && n !== null && (g(), b({
14834
+ })) : !n && n !== null && s && (g(), b({
14833
14835
  type: "error",
14834
- message: s
14836
+ message: o(s)
14835
14837
  }));
14836
14838
  }, [n]), p("div", {
14837
14839
  className: "edit-field__wrapper",
@@ -14845,8 +14847,8 @@ const z1 = `.edit-field__wrapper{position:relative}.edit-container{display:flex;
14845
14847
  className: "edit-container",
14846
14848
  children: [p("div", {
14847
14849
  className: "edit-input_wrapper",
14848
- style: a && {
14849
- border: "1px solid #000"
14850
+ style: {
14851
+ border: a ? "1px solid #000" : "1px solid #d1d5db"
14850
14852
  },
14851
14853
  children: [a && p("div", {
14852
14854
  className: "input-wrapper",
@@ -14854,12 +14856,12 @@ const z1 = `.edit-field__wrapper{position:relative}.edit-container{display:flex;
14854
14856
  maxLength: 80,
14855
14857
  type: "text",
14856
14858
  className: "edit-input",
14857
- placeholder: u,
14859
+ placeholder: u || void 0,
14858
14860
  onChange: (x) => c(x.currentTarget.value),
14859
- value: u,
14861
+ value: u || void 0,
14860
14862
  ref: d,
14861
14863
  onKeyDown: (x) => {
14862
- x.key === "Enter" && e(u);
14864
+ x.key === "Enter" && u && e(u);
14863
14865
  }
14864
14866
  })
14865
14867
  }), !a && p("div", {
@@ -14889,7 +14891,12 @@ const z1 = `.edit-field__wrapper{position:relative}.edit-container{display:flex;
14889
14891
  children: [p("div", {
14890
14892
  className: "edit-button",
14891
14893
  onClick: () => {
14892
- t || e(u);
14894
+ !t && u && e(u);
14895
+ },
14896
+ style: {
14897
+ opacity: u ? 1 : 0.5,
14898
+ cursor: u ? "pointer" : "not-allowed",
14899
+ pointerEvents: u ? "auto" : "none"
14893
14900
  },
14894
14901
  children: [p("div", {
14895
14902
  className: "label-wrapper",
@@ -14996,7 +15003,7 @@ function W1() {
14996
15003
  const r = ke.value, t = window.BikeMatrix.getConfig(), {
14997
15004
  currentBike: i,
14998
15005
  saveBike: n
14999
- } = Ie(), [s, o] = R(r == null ? void 0 : r.owner_Email_Address), [a, l] = R(!1), [u, c] = R(null), [d, h] = R(null), [f, b] = R(i.name), [v, w] = R(null), [m, g] = R(null), [x, _] = R(null), y = new Se(t.apiUrl, t.apiKey, t.apiToken, t.isShopify), {
15006
+ } = Ie(), [s, o] = R((r == null ? void 0 : r.owner_Email_Address) || null), [a, l] = R(!1), [u, c] = R(null), [d, h] = R(null), [f, b] = R(i.name), [v, w] = R(null), [m, g] = R(null), [x, _] = R(null), y = new Se(t.apiUrl, t.apiKey, t.apiToken, t.isShopify), {
15000
15007
  t: k
15001
15008
  } = te(), A = async (D, S) => {
15002
15009
  if (S === "name") {
@@ -15005,13 +15012,15 @@ function W1() {
15005
15012
  n({
15006
15013
  ...i,
15007
15014
  name: D
15008
- }), w(!1), B.success ? g(!0) : (_(B.error), t.logLevel === "verbose" && console.error(B.logError));
15009
- }
15010
- if (S === "email") {
15011
- o(D), l(!0), c(null), h(null);
15012
- const B = await y.saveCustomBike(i.key, D);
15013
- l(!1), B.success ? c(!0) : (c(!1), h(B.error), t.logLevel === "verbose" && console.error(B.logError));
15015
+ }), w(!1), B.success ? g(!0) : (_(B.error || null), t.logLevel === "verbose" && console.error(B.logError));
15014
15016
  }
15017
+ if (S === "email")
15018
+ if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(D)) {
15019
+ o(D), l(!0), c(null), h(null);
15020
+ const B = await y.saveCustomBike(i.key, D);
15021
+ l(!1), B.success ? c(!0) : (c(!1), h(B.error || null), t.logLevel === "verbose" && console.error(B.logError));
15022
+ } else
15023
+ c(!1), h("error_invalid_email");
15015
15024
  }, C = (D) => {
15016
15025
  navigator.share({
15017
15026
  title: k("virtualworkshop_settings_id"),