@gomusdev/web-components 1.8.1 → 1.8.2

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.
@@ -11167,10 +11167,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11167
11167
  */
11168
11168
  fetchAndCache(endpoint, dataKey, responseKey, options) {
11169
11169
  var _a2;
11170
- __privateGet(this, _ensureApi).call(this);
11171
11170
  options ?? (options = {});
11172
11171
  options.query ?? (options.query = {});
11173
11172
  options.cache ?? (options.cache = 1e3);
11173
+ if (!__privateGet(this, _canFetch).call(this)) {
11174
+ console.warn("(fetchAndCache) Shop not loaded!");
11175
+ return get(__privateGet(this, _data2))[dataKey];
11176
+ }
11174
11177
  const query = assign(options.query, { per_page: 1e3 });
11175
11178
  const fetchId = endpoint + JSON.stringify(query);
11176
11179
  const isNotFetchedYet = !__privateGet(this, _fetchStatus)[fetchId];
@@ -11494,8 +11497,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11494
11497
  window.go = go;
11495
11498
  const _Forms = class _Forms {
11496
11499
  static defineForm(options) {
11497
- debugger;
11498
- console.log({ fields: options.fields });
11499
11500
  go.defineConfig({ forms: { [options.id]: { fields: options.fields } } });
11500
11501
  __privateGet(_Forms, _requiredApiKeysMap)[options.id] = options.requiredApiKeys || [];
11501
11502
  }
@@ -11550,6 +11551,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11550
11551
  return function(host, details) {
11551
11552
  if (host) {
11552
11553
  host.addEventListener(KEY2, (e) => {
11554
+ e.stopPropagation();
11553
11555
  e.detail.data = details;
11554
11556
  });
11555
11557
  }
@@ -11571,7 +11573,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11571
11573
  constructor(formId, form) {
11572
11574
  __privateAdd(this, _fields, /* @__PURE__ */ state(proxy([])));
11573
11575
  __privateAdd(this, _apiErrors, /* @__PURE__ */ state(proxy([])));
11574
- __privateAdd(this, _isValid, /* @__PURE__ */ user_derived(() => errors(this.fields) == 0));
11576
+ __privateAdd(this, _isValid, /* @__PURE__ */ user_derived(() => errors(get(__privateGet(this, _fields))) == 0));
11575
11577
  this.formId = formId;
11576
11578
  this.form = form;
11577
11579
  }
@@ -11688,7 +11690,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11688
11690
  }
11689
11691
  }
11690
11692
  onMount(() => {
11691
- const form = wrapInElement($$props.$$host, "form", { id: "login-form", novalidate: true });
11693
+ const form = wrapInElement($$props.$$host, "form", { novalidate: true });
11692
11694
  form.addEventListener("submit", handleSubmit);
11693
11695
  details.form = form;
11694
11696
  });
@@ -13836,7 +13838,16 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
13836
13838
  }
13837
13839
  });
13838
13840
  }
13839
- customElements.define("go-if", create_custom_element(If, { when: {}, then: {} }, [], ["data"], false));
13841
+ customElements.define("go-if", create_custom_element(
13842
+ If,
13843
+ {
13844
+ when: { attribute: "when", reflect: true, type: "String" },
13845
+ then: { attribute: "then", reflect: true, type: "String" }
13846
+ },
13847
+ [],
13848
+ ["data"],
13849
+ false
13850
+ ));
13840
13851
  function GomusInit($$anchor, $$props) {
13841
13852
  push($$props, true);
13842
13853
  let apiUrl = prop($$props, "apiUrl", 7), shopDomain = prop($$props, "shopDomain", 7), locale = prop($$props, "locale", 7);
@@ -11167,10 +11167,13 @@ class Shop {
11167
11167
  */
11168
11168
  fetchAndCache(endpoint, dataKey, responseKey, options) {
11169
11169
  var _a2;
11170
- __privateGet(this, _ensureApi).call(this);
11171
11170
  options ?? (options = {});
11172
11171
  options.query ?? (options.query = {});
11173
11172
  options.cache ?? (options.cache = 1e3);
11173
+ if (!__privateGet(this, _canFetch).call(this)) {
11174
+ console.warn("(fetchAndCache) Shop not loaded!");
11175
+ return get(__privateGet(this, _data2))[dataKey];
11176
+ }
11174
11177
  const query = assign(options.query, { per_page: 1e3 });
11175
11178
  const fetchId = endpoint + JSON.stringify(query);
11176
11179
  const isNotFetchedYet = !__privateGet(this, _fetchStatus)[fetchId];
@@ -11494,8 +11497,6 @@ const go = new Config();
11494
11497
  window.go = go;
11495
11498
  const _Forms = class _Forms {
11496
11499
  static defineForm(options) {
11497
- debugger;
11498
- console.log({ fields: options.fields });
11499
11500
  go.defineConfig({ forms: { [options.id]: { fields: options.fields } } });
11500
11501
  __privateGet(_Forms, _requiredApiKeysMap)[options.id] = options.requiredApiKeys || [];
11501
11502
  }
@@ -11550,6 +11551,7 @@ function createSetDetails(KEY2) {
11550
11551
  return function(host, details) {
11551
11552
  if (host) {
11552
11553
  host.addEventListener(KEY2, (e) => {
11554
+ e.stopPropagation();
11553
11555
  e.detail.data = details;
11554
11556
  });
11555
11557
  }
@@ -11571,7 +11573,7 @@ class FormDetails {
11571
11573
  constructor(formId, form) {
11572
11574
  __privateAdd(this, _fields, /* @__PURE__ */ state(proxy([])));
11573
11575
  __privateAdd(this, _apiErrors, /* @__PURE__ */ state(proxy([])));
11574
- __privateAdd(this, _isValid, /* @__PURE__ */ user_derived(() => errors(this.fields) == 0));
11576
+ __privateAdd(this, _isValid, /* @__PURE__ */ user_derived(() => errors(get(__privateGet(this, _fields))) == 0));
11575
11577
  this.formId = formId;
11576
11578
  this.form = form;
11577
11579
  }
@@ -11688,7 +11690,7 @@ function Form($$anchor, $$props) {
11688
11690
  }
11689
11691
  }
11690
11692
  onMount(() => {
11691
- const form = wrapInElement($$props.$$host, "form", { id: "login-form", novalidate: true });
11693
+ const form = wrapInElement($$props.$$host, "form", { novalidate: true });
11692
11694
  form.addEventListener("submit", handleSubmit);
11693
11695
  details.form = form;
11694
11696
  });
@@ -13836,7 +13838,16 @@ function If($$anchor, $$props) {
13836
13838
  }
13837
13839
  });
13838
13840
  }
13839
- customElements.define("go-if", create_custom_element(If, { when: {}, then: {} }, [], ["data"], false));
13841
+ customElements.define("go-if", create_custom_element(
13842
+ If,
13843
+ {
13844
+ when: { attribute: "when", reflect: true, type: "String" },
13845
+ then: { attribute: "then", reflect: true, type: "String" }
13846
+ },
13847
+ [],
13848
+ ["data"],
13849
+ false
13850
+ ));
13840
13851
  function GomusInit($$anchor, $$props) {
13841
13852
  push($$props, true);
13842
13853
  let apiUrl = prop($$props, "apiUrl", 7), shopDomain = prop($$props, "shopDomain", 7), locale = prop($$props, "locale", 7);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "1.8.1",
7
+ "version": "1.8.2",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",