@gomusdev/web-components 1.8.0 → 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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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];
|
|
@@ -11309,7 +11312,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
11309
11312
|
},
|
|
11310
11313
|
newPassword: {
|
|
11311
11314
|
key: "password",
|
|
11312
|
-
apiKey: "
|
|
11315
|
+
apiKey: "password",
|
|
11313
11316
|
type: "password",
|
|
11314
11317
|
label: "Password",
|
|
11315
11318
|
placeholder: "",
|
|
@@ -11319,6 +11322,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
11319
11322
|
},
|
|
11320
11323
|
confirmPassword: {
|
|
11321
11324
|
key: "confirmPassword",
|
|
11325
|
+
apiKey: "password_confirmation",
|
|
11322
11326
|
type: "password",
|
|
11323
11327
|
label: "Confirm password",
|
|
11324
11328
|
placeholder: "",
|
|
@@ -11493,8 +11497,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
11493
11497
|
window.go = go;
|
|
11494
11498
|
const _Forms = class _Forms {
|
|
11495
11499
|
static defineForm(options) {
|
|
11496
|
-
debugger;
|
|
11497
|
-
console.log({ fields: options.fields });
|
|
11498
11500
|
go.defineConfig({ forms: { [options.id]: { fields: options.fields } } });
|
|
11499
11501
|
__privateGet(_Forms, _requiredApiKeysMap)[options.id] = options.requiredApiKeys || [];
|
|
11500
11502
|
}
|
|
@@ -11549,6 +11551,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
11549
11551
|
return function(host, details) {
|
|
11550
11552
|
if (host) {
|
|
11551
11553
|
host.addEventListener(KEY2, (e) => {
|
|
11554
|
+
e.stopPropagation();
|
|
11552
11555
|
e.detail.data = details;
|
|
11553
11556
|
});
|
|
11554
11557
|
}
|
|
@@ -11570,7 +11573,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
11570
11573
|
constructor(formId, form) {
|
|
11571
11574
|
__privateAdd(this, _fields, /* @__PURE__ */ state(proxy([])));
|
|
11572
11575
|
__privateAdd(this, _apiErrors, /* @__PURE__ */ state(proxy([])));
|
|
11573
|
-
__privateAdd(this, _isValid, /* @__PURE__ */ user_derived(() => errors(this
|
|
11576
|
+
__privateAdd(this, _isValid, /* @__PURE__ */ user_derived(() => errors(get(__privateGet(this, _fields))) == 0));
|
|
11574
11577
|
this.formId = formId;
|
|
11575
11578
|
this.form = form;
|
|
11576
11579
|
}
|
|
@@ -11687,7 +11690,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
11687
11690
|
}
|
|
11688
11691
|
}
|
|
11689
11692
|
onMount(() => {
|
|
11690
|
-
const form = wrapInElement($$props.$$host, "form", {
|
|
11693
|
+
const form = wrapInElement($$props.$$host, "form", { novalidate: true });
|
|
11691
11694
|
form.addEventListener("submit", handleSubmit);
|
|
11692
11695
|
details.form = form;
|
|
11693
11696
|
});
|
|
@@ -13835,7 +13838,16 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
13835
13838
|
}
|
|
13836
13839
|
});
|
|
13837
13840
|
}
|
|
13838
|
-
customElements.define("go-if", create_custom_element(
|
|
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
|
+
));
|
|
13839
13851
|
function GomusInit($$anchor, $$props) {
|
|
13840
13852
|
push($$props, true);
|
|
13841
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];
|
|
@@ -11309,7 +11312,7 @@ var allFields = {
|
|
|
11309
11312
|
},
|
|
11310
11313
|
newPassword: {
|
|
11311
11314
|
key: "password",
|
|
11312
|
-
apiKey: "
|
|
11315
|
+
apiKey: "password",
|
|
11313
11316
|
type: "password",
|
|
11314
11317
|
label: "Password",
|
|
11315
11318
|
placeholder: "",
|
|
@@ -11319,6 +11322,7 @@ var allFields = {
|
|
|
11319
11322
|
},
|
|
11320
11323
|
confirmPassword: {
|
|
11321
11324
|
key: "confirmPassword",
|
|
11325
|
+
apiKey: "password_confirmation",
|
|
11322
11326
|
type: "password",
|
|
11323
11327
|
label: "Confirm password",
|
|
11324
11328
|
placeholder: "",
|
|
@@ -11493,8 +11497,6 @@ const go = new Config();
|
|
|
11493
11497
|
window.go = go;
|
|
11494
11498
|
const _Forms = class _Forms {
|
|
11495
11499
|
static defineForm(options) {
|
|
11496
|
-
debugger;
|
|
11497
|
-
console.log({ fields: options.fields });
|
|
11498
11500
|
go.defineConfig({ forms: { [options.id]: { fields: options.fields } } });
|
|
11499
11501
|
__privateGet(_Forms, _requiredApiKeysMap)[options.id] = options.requiredApiKeys || [];
|
|
11500
11502
|
}
|
|
@@ -11549,6 +11551,7 @@ function createSetDetails(KEY2) {
|
|
|
11549
11551
|
return function(host, details) {
|
|
11550
11552
|
if (host) {
|
|
11551
11553
|
host.addEventListener(KEY2, (e) => {
|
|
11554
|
+
e.stopPropagation();
|
|
11552
11555
|
e.detail.data = details;
|
|
11553
11556
|
});
|
|
11554
11557
|
}
|
|
@@ -11570,7 +11573,7 @@ class FormDetails {
|
|
|
11570
11573
|
constructor(formId, form) {
|
|
11571
11574
|
__privateAdd(this, _fields, /* @__PURE__ */ state(proxy([])));
|
|
11572
11575
|
__privateAdd(this, _apiErrors, /* @__PURE__ */ state(proxy([])));
|
|
11573
|
-
__privateAdd(this, _isValid, /* @__PURE__ */ user_derived(() => errors(this
|
|
11576
|
+
__privateAdd(this, _isValid, /* @__PURE__ */ user_derived(() => errors(get(__privateGet(this, _fields))) == 0));
|
|
11574
11577
|
this.formId = formId;
|
|
11575
11578
|
this.form = form;
|
|
11576
11579
|
}
|
|
@@ -11687,7 +11690,7 @@ function Form($$anchor, $$props) {
|
|
|
11687
11690
|
}
|
|
11688
11691
|
}
|
|
11689
11692
|
onMount(() => {
|
|
11690
|
-
const form = wrapInElement($$props.$$host, "form", {
|
|
11693
|
+
const form = wrapInElement($$props.$$host, "form", { novalidate: true });
|
|
11691
11694
|
form.addEventListener("submit", handleSubmit);
|
|
11692
11695
|
details.form = form;
|
|
11693
11696
|
});
|
|
@@ -13835,7 +13838,16 @@ function If($$anchor, $$props) {
|
|
|
13835
13838
|
}
|
|
13836
13839
|
});
|
|
13837
13840
|
}
|
|
13838
|
-
customElements.define("go-if", create_custom_element(
|
|
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
|
+
));
|
|
13839
13851
|
function GomusInit($$anchor, $$props) {
|
|
13840
13852
|
push($$props, true);
|
|
13841
13853
|
let apiUrl = prop($$props, "apiUrl", 7), shopDomain = prop($$props, "shopDomain", 7), locale = prop($$props, "locale", 7);
|