@getlupa/client 1.15.5 → 1.15.6
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/dist/lupaSearch.iife.js +44 -17
- package/dist/lupaSearch.js +44 -17
- package/dist/lupaSearch.mjs +44 -17
- package/dist/lupaSearch.umd.js +44 -17
- package/package.json +2 -2
package/dist/lupaSearch.iife.js
CHANGED
|
@@ -18177,6 +18177,17 @@ and ensure you are accounting for this risk.
|
|
|
18177
18177
|
const rendered = mustache.render(template, document2);
|
|
18178
18178
|
return sanitizeHtml$1(rendered);
|
|
18179
18179
|
};
|
|
18180
|
+
const getDynamicAttributes = (dynamicAttributes = [], document2 = {}) => {
|
|
18181
|
+
var _a, _b;
|
|
18182
|
+
const parsedAttributes = {};
|
|
18183
|
+
for (const attribute of dynamicAttributes) {
|
|
18184
|
+
if (!((_a = attribute == null ? void 0 : attribute.key) == null ? void 0 : _a.startsWith("data-"))) {
|
|
18185
|
+
continue;
|
|
18186
|
+
}
|
|
18187
|
+
parsedAttributes[attribute == null ? void 0 : attribute.key] = escapeHtml$1(mustache.render((_b = attribute == null ? void 0 : attribute.value) != null ? _b : "", document2));
|
|
18188
|
+
}
|
|
18189
|
+
return parsedAttributes;
|
|
18190
|
+
};
|
|
18180
18191
|
const getFieldValue = (doc2, field = "") => {
|
|
18181
18192
|
var _a;
|
|
18182
18193
|
if (typeof field === "number") {
|
|
@@ -18862,7 +18873,8 @@ and ensure you are accounting for this risk.
|
|
|
18862
18873
|
props: {
|
|
18863
18874
|
item: {},
|
|
18864
18875
|
options: {},
|
|
18865
|
-
inStock: { type: Boolean }
|
|
18876
|
+
inStock: { type: Boolean },
|
|
18877
|
+
dynamicAttributes: {}
|
|
18866
18878
|
},
|
|
18867
18879
|
emits: ["productEvent"],
|
|
18868
18880
|
setup(__props, { emit: emit2 }) {
|
|
@@ -18892,13 +18904,13 @@ and ensure you are accounting for this risk.
|
|
|
18892
18904
|
return (_ctx, _cache) => {
|
|
18893
18905
|
return openBlock(), createElementBlock("div", _hoisted_1$15, [
|
|
18894
18906
|
createBaseVNode("div", _hoisted_2$O, [
|
|
18895
|
-
createBaseVNode("button", {
|
|
18907
|
+
createBaseVNode("button", mergeProps({
|
|
18896
18908
|
onClick: withModifiers(handleClick, ["stop", "prevent"]),
|
|
18897
|
-
class:
|
|
18909
|
+
class: loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart",
|
|
18898
18910
|
"data-cy": "lupa-add-to-cart",
|
|
18899
18911
|
type: "button",
|
|
18900
18912
|
disabled: !inStockValue.value || loading.value
|
|
18901
|
-
}, toDisplayString(label.value),
|
|
18913
|
+
}, _ctx.dynamicAttributes), toDisplayString(label.value), 17, _hoisted_3$B)
|
|
18902
18914
|
])
|
|
18903
18915
|
]);
|
|
18904
18916
|
};
|
|
@@ -18953,6 +18965,9 @@ and ensure you are accounting for this risk.
|
|
|
18953
18965
|
}
|
|
18954
18966
|
return "search-box-product-title";
|
|
18955
18967
|
});
|
|
18968
|
+
const renderDynamicAttributesOnParentElement = computed(() => {
|
|
18969
|
+
return props.element.type !== DocumentElementType.ADDTOCART;
|
|
18970
|
+
});
|
|
18956
18971
|
const displayElement = computed(() => {
|
|
18957
18972
|
const element = props.element;
|
|
18958
18973
|
const item = props.item;
|
|
@@ -18969,20 +18984,24 @@ and ensure you are accounting for this risk.
|
|
|
18969
18984
|
const enhancementData = (_d = (_c = dynamicDataIdMap.value) == null ? void 0 : _c[(_b = props.item) == null ? void 0 : _b.id]) != null ? _d : {};
|
|
18970
18985
|
return __spreadValues2(__spreadValues2({}, props.item), enhancementData);
|
|
18971
18986
|
});
|
|
18987
|
+
const dynamicAttributes = computed(() => {
|
|
18988
|
+
return getDynamicAttributes(props.element.dynamicAttributes, enhancedItem.value);
|
|
18989
|
+
});
|
|
18972
18990
|
const isLoadingDynamicData = (id) => {
|
|
18973
18991
|
return Boolean(props.element.dynamic && id && loading.value && (loadingIds == null ? void 0 : loadingIds.value[id]));
|
|
18974
18992
|
};
|
|
18975
18993
|
return (_ctx, _cache) => {
|
|
18976
18994
|
var _a, _b;
|
|
18977
18995
|
return !_ctx.$slots.badges ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
18978
|
-
displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), {
|
|
18996
|
+
displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), mergeProps({
|
|
18979
18997
|
key: 0,
|
|
18980
18998
|
item: enhancedItem.value,
|
|
18981
18999
|
options: _ctx.element,
|
|
18982
19000
|
labels: _ctx.labels,
|
|
18983
|
-
class:
|
|
18984
|
-
inStock: _ctx.isInStock
|
|
18985
|
-
|
|
19001
|
+
class: { "lupa-loading-dynamic-data": isLoadingDynamicData((_a = _ctx.item) == null ? void 0 : _a.id) },
|
|
19002
|
+
inStock: _ctx.isInStock,
|
|
19003
|
+
"dynamic-attributes": dynamicAttributes.value
|
|
19004
|
+
}, renderDynamicAttributesOnParentElement.value && dynamicAttributes.value), null, 16, ["item", "options", "labels", "class", "inStock", "dynamic-attributes"])) : createCommentVNode("", true)
|
|
18986
19005
|
], 64)) : (openBlock(), createElementBlock("div", _hoisted_1$14, [
|
|
18987
19006
|
displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), {
|
|
18988
19007
|
key: 0,
|
|
@@ -23858,7 +23877,8 @@ and ensure you are accounting for this risk.
|
|
|
23858
23877
|
props: {
|
|
23859
23878
|
item: {},
|
|
23860
23879
|
options: {},
|
|
23861
|
-
inStock: { type: Boolean }
|
|
23880
|
+
inStock: { type: Boolean },
|
|
23881
|
+
dynamicAttributes: {}
|
|
23862
23882
|
},
|
|
23863
23883
|
emits: ["productEvent"],
|
|
23864
23884
|
setup(__props, { emit: emit2 }) {
|
|
@@ -23893,13 +23913,14 @@ and ensure you are accounting for this risk.
|
|
|
23893
23913
|
return (_ctx, _cache) => {
|
|
23894
23914
|
return openBlock(), createElementBlock("div", _hoisted_1$r, [
|
|
23895
23915
|
createBaseVNode("div", _hoisted_2$m, [
|
|
23896
|
-
createBaseVNode("button", {
|
|
23916
|
+
createBaseVNode("button", mergeProps({
|
|
23897
23917
|
id: id.value,
|
|
23898
|
-
class:
|
|
23918
|
+
class: loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart",
|
|
23899
23919
|
"data-cy": "lupa-add-to-cart",
|
|
23900
|
-
disabled: !inStockValue.value || loading.value
|
|
23920
|
+
disabled: !inStockValue.value || loading.value
|
|
23921
|
+
}, _ctx.dynamicAttributes, {
|
|
23901
23922
|
onClick: withModifiers(handleClick, ["stop"])
|
|
23902
|
-
}, toDisplayString(label.value),
|
|
23923
|
+
}), toDisplayString(label.value), 17, _hoisted_3$g)
|
|
23903
23924
|
])
|
|
23904
23925
|
]);
|
|
23905
23926
|
};
|
|
@@ -24095,6 +24116,9 @@ and ensure you are accounting for this risk.
|
|
|
24095
24116
|
}
|
|
24096
24117
|
return "searchResultsProductTitle";
|
|
24097
24118
|
});
|
|
24119
|
+
const renderDynamicAttributesOnParentElement = computed(() => {
|
|
24120
|
+
return props.element.type !== DocumentElementType.ADDTOCART;
|
|
24121
|
+
});
|
|
24098
24122
|
const enhancedItem = computed(() => {
|
|
24099
24123
|
var _a, _b, _c, _d;
|
|
24100
24124
|
if (!((_a = props.item) == null ? void 0 : _a.id)) {
|
|
@@ -24111,6 +24135,9 @@ and ensure you are accounting for this risk.
|
|
|
24111
24135
|
}
|
|
24112
24136
|
return typeof element.display === "function" ? element.display(item) : processDisplayCondition(element.display, item);
|
|
24113
24137
|
});
|
|
24138
|
+
const dynamicAttributes = computed(() => {
|
|
24139
|
+
return getDynamicAttributes(props.element.dynamicAttributes, enhancedItem.value);
|
|
24140
|
+
});
|
|
24114
24141
|
const handleProductEvent = (item) => {
|
|
24115
24142
|
emit2("productEvent", item);
|
|
24116
24143
|
};
|
|
@@ -24119,16 +24146,16 @@ and ensure you are accounting for this risk.
|
|
|
24119
24146
|
};
|
|
24120
24147
|
return (_ctx, _cache) => {
|
|
24121
24148
|
var _a;
|
|
24122
|
-
return displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), {
|
|
24149
|
+
return displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), mergeProps({
|
|
24123
24150
|
key: 0,
|
|
24124
24151
|
item: enhancedItem.value,
|
|
24125
24152
|
options: _ctx.element,
|
|
24126
24153
|
labels: _ctx.labels,
|
|
24127
24154
|
inStock: _ctx.inStock,
|
|
24128
24155
|
link: _ctx.link,
|
|
24129
|
-
class:
|
|
24130
|
-
|
|
24131
|
-
}, null,
|
|
24156
|
+
class: { "lupa-loading-dynamic-data": isLoadingDynamicData((_a = _ctx.item) == null ? void 0 : _a.id) },
|
|
24157
|
+
"dynamic-attributes": dynamicAttributes.value
|
|
24158
|
+
}, renderDynamicAttributesOnParentElement.value && dynamicAttributes.value, { onProductEvent: handleProductEvent }), null, 16, ["item", "options", "labels", "inStock", "link", "class", "dynamic-attributes"])) : createCommentVNode("", true);
|
|
24132
24159
|
};
|
|
24133
24160
|
}
|
|
24134
24161
|
}));
|
package/dist/lupaSearch.js
CHANGED
|
@@ -18177,6 +18177,17 @@ const renderHtmlTemplate = (template, document2 = {}) => {
|
|
|
18177
18177
|
const rendered = mustache.render(template, document2);
|
|
18178
18178
|
return sanitizeHtml$1(rendered);
|
|
18179
18179
|
};
|
|
18180
|
+
const getDynamicAttributes = (dynamicAttributes = [], document2 = {}) => {
|
|
18181
|
+
var _a, _b;
|
|
18182
|
+
const parsedAttributes = {};
|
|
18183
|
+
for (const attribute of dynamicAttributes) {
|
|
18184
|
+
if (!((_a = attribute == null ? void 0 : attribute.key) == null ? void 0 : _a.startsWith("data-"))) {
|
|
18185
|
+
continue;
|
|
18186
|
+
}
|
|
18187
|
+
parsedAttributes[attribute == null ? void 0 : attribute.key] = escapeHtml$1(mustache.render((_b = attribute == null ? void 0 : attribute.value) != null ? _b : "", document2));
|
|
18188
|
+
}
|
|
18189
|
+
return parsedAttributes;
|
|
18190
|
+
};
|
|
18180
18191
|
const getFieldValue = (doc2, field = "") => {
|
|
18181
18192
|
var _a;
|
|
18182
18193
|
if (typeof field === "number") {
|
|
@@ -18862,7 +18873,8 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
|
18862
18873
|
props: {
|
|
18863
18874
|
item: {},
|
|
18864
18875
|
options: {},
|
|
18865
|
-
inStock: { type: Boolean }
|
|
18876
|
+
inStock: { type: Boolean },
|
|
18877
|
+
dynamicAttributes: {}
|
|
18866
18878
|
},
|
|
18867
18879
|
emits: ["productEvent"],
|
|
18868
18880
|
setup(__props, { emit: emit2 }) {
|
|
@@ -18892,13 +18904,13 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
|
18892
18904
|
return (_ctx, _cache) => {
|
|
18893
18905
|
return openBlock(), createElementBlock("div", _hoisted_1$15, [
|
|
18894
18906
|
createBaseVNode("div", _hoisted_2$O, [
|
|
18895
|
-
createBaseVNode("button", {
|
|
18907
|
+
createBaseVNode("button", mergeProps({
|
|
18896
18908
|
onClick: withModifiers(handleClick, ["stop", "prevent"]),
|
|
18897
|
-
class:
|
|
18909
|
+
class: loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart",
|
|
18898
18910
|
"data-cy": "lupa-add-to-cart",
|
|
18899
18911
|
type: "button",
|
|
18900
18912
|
disabled: !inStockValue.value || loading.value
|
|
18901
|
-
}, toDisplayString(label.value),
|
|
18913
|
+
}, _ctx.dynamicAttributes), toDisplayString(label.value), 17, _hoisted_3$B)
|
|
18902
18914
|
])
|
|
18903
18915
|
]);
|
|
18904
18916
|
};
|
|
@@ -18953,6 +18965,9 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
18953
18965
|
}
|
|
18954
18966
|
return "search-box-product-title";
|
|
18955
18967
|
});
|
|
18968
|
+
const renderDynamicAttributesOnParentElement = computed(() => {
|
|
18969
|
+
return props.element.type !== DocumentElementType.ADDTOCART;
|
|
18970
|
+
});
|
|
18956
18971
|
const displayElement = computed(() => {
|
|
18957
18972
|
const element = props.element;
|
|
18958
18973
|
const item = props.item;
|
|
@@ -18969,20 +18984,24 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
18969
18984
|
const enhancementData = (_d = (_c = dynamicDataIdMap.value) == null ? void 0 : _c[(_b = props.item) == null ? void 0 : _b.id]) != null ? _d : {};
|
|
18970
18985
|
return __spreadValues2(__spreadValues2({}, props.item), enhancementData);
|
|
18971
18986
|
});
|
|
18987
|
+
const dynamicAttributes = computed(() => {
|
|
18988
|
+
return getDynamicAttributes(props.element.dynamicAttributes, enhancedItem.value);
|
|
18989
|
+
});
|
|
18972
18990
|
const isLoadingDynamicData = (id) => {
|
|
18973
18991
|
return Boolean(props.element.dynamic && id && loading.value && (loadingIds == null ? void 0 : loadingIds.value[id]));
|
|
18974
18992
|
};
|
|
18975
18993
|
return (_ctx, _cache) => {
|
|
18976
18994
|
var _a, _b;
|
|
18977
18995
|
return !_ctx.$slots.badges ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
18978
|
-
displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), {
|
|
18996
|
+
displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), mergeProps({
|
|
18979
18997
|
key: 0,
|
|
18980
18998
|
item: enhancedItem.value,
|
|
18981
18999
|
options: _ctx.element,
|
|
18982
19000
|
labels: _ctx.labels,
|
|
18983
|
-
class:
|
|
18984
|
-
inStock: _ctx.isInStock
|
|
18985
|
-
|
|
19001
|
+
class: { "lupa-loading-dynamic-data": isLoadingDynamicData((_a = _ctx.item) == null ? void 0 : _a.id) },
|
|
19002
|
+
inStock: _ctx.isInStock,
|
|
19003
|
+
"dynamic-attributes": dynamicAttributes.value
|
|
19004
|
+
}, renderDynamicAttributesOnParentElement.value && dynamicAttributes.value), null, 16, ["item", "options", "labels", "class", "inStock", "dynamic-attributes"])) : createCommentVNode("", true)
|
|
18986
19005
|
], 64)) : (openBlock(), createElementBlock("div", _hoisted_1$14, [
|
|
18987
19006
|
displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), {
|
|
18988
19007
|
key: 0,
|
|
@@ -23858,7 +23877,8 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
23858
23877
|
props: {
|
|
23859
23878
|
item: {},
|
|
23860
23879
|
options: {},
|
|
23861
|
-
inStock: { type: Boolean }
|
|
23880
|
+
inStock: { type: Boolean },
|
|
23881
|
+
dynamicAttributes: {}
|
|
23862
23882
|
},
|
|
23863
23883
|
emits: ["productEvent"],
|
|
23864
23884
|
setup(__props, { emit: emit2 }) {
|
|
@@ -23893,13 +23913,14 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
23893
23913
|
return (_ctx, _cache) => {
|
|
23894
23914
|
return openBlock(), createElementBlock("div", _hoisted_1$r, [
|
|
23895
23915
|
createBaseVNode("div", _hoisted_2$m, [
|
|
23896
|
-
createBaseVNode("button", {
|
|
23916
|
+
createBaseVNode("button", mergeProps({
|
|
23897
23917
|
id: id.value,
|
|
23898
|
-
class:
|
|
23918
|
+
class: loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart",
|
|
23899
23919
|
"data-cy": "lupa-add-to-cart",
|
|
23900
|
-
disabled: !inStockValue.value || loading.value
|
|
23920
|
+
disabled: !inStockValue.value || loading.value
|
|
23921
|
+
}, _ctx.dynamicAttributes, {
|
|
23901
23922
|
onClick: withModifiers(handleClick, ["stop"])
|
|
23902
|
-
}, toDisplayString(label.value),
|
|
23923
|
+
}), toDisplayString(label.value), 17, _hoisted_3$g)
|
|
23903
23924
|
])
|
|
23904
23925
|
]);
|
|
23905
23926
|
};
|
|
@@ -24095,6 +24116,9 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
24095
24116
|
}
|
|
24096
24117
|
return "searchResultsProductTitle";
|
|
24097
24118
|
});
|
|
24119
|
+
const renderDynamicAttributesOnParentElement = computed(() => {
|
|
24120
|
+
return props.element.type !== DocumentElementType.ADDTOCART;
|
|
24121
|
+
});
|
|
24098
24122
|
const enhancedItem = computed(() => {
|
|
24099
24123
|
var _a, _b, _c, _d;
|
|
24100
24124
|
if (!((_a = props.item) == null ? void 0 : _a.id)) {
|
|
@@ -24111,6 +24135,9 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
24111
24135
|
}
|
|
24112
24136
|
return typeof element.display === "function" ? element.display(item) : processDisplayCondition(element.display, item);
|
|
24113
24137
|
});
|
|
24138
|
+
const dynamicAttributes = computed(() => {
|
|
24139
|
+
return getDynamicAttributes(props.element.dynamicAttributes, enhancedItem.value);
|
|
24140
|
+
});
|
|
24114
24141
|
const handleProductEvent = (item) => {
|
|
24115
24142
|
emit2("productEvent", item);
|
|
24116
24143
|
};
|
|
@@ -24119,16 +24146,16 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
24119
24146
|
};
|
|
24120
24147
|
return (_ctx, _cache) => {
|
|
24121
24148
|
var _a;
|
|
24122
|
-
return displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), {
|
|
24149
|
+
return displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), mergeProps({
|
|
24123
24150
|
key: 0,
|
|
24124
24151
|
item: enhancedItem.value,
|
|
24125
24152
|
options: _ctx.element,
|
|
24126
24153
|
labels: _ctx.labels,
|
|
24127
24154
|
inStock: _ctx.inStock,
|
|
24128
24155
|
link: _ctx.link,
|
|
24129
|
-
class:
|
|
24130
|
-
|
|
24131
|
-
}, null,
|
|
24156
|
+
class: { "lupa-loading-dynamic-data": isLoadingDynamicData((_a = _ctx.item) == null ? void 0 : _a.id) },
|
|
24157
|
+
"dynamic-attributes": dynamicAttributes.value
|
|
24158
|
+
}, renderDynamicAttributesOnParentElement.value && dynamicAttributes.value, { onProductEvent: handleProductEvent }), null, 16, ["item", "options", "labels", "inStock", "link", "class", "dynamic-attributes"])) : createCommentVNode("", true);
|
|
24132
24159
|
};
|
|
24133
24160
|
}
|
|
24134
24161
|
}));
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -18175,6 +18175,17 @@ const renderHtmlTemplate = (template, document2 = {}) => {
|
|
|
18175
18175
|
const rendered = mustache.render(template, document2);
|
|
18176
18176
|
return sanitizeHtml$1(rendered);
|
|
18177
18177
|
};
|
|
18178
|
+
const getDynamicAttributes = (dynamicAttributes = [], document2 = {}) => {
|
|
18179
|
+
var _a, _b;
|
|
18180
|
+
const parsedAttributes = {};
|
|
18181
|
+
for (const attribute of dynamicAttributes) {
|
|
18182
|
+
if (!((_a = attribute == null ? void 0 : attribute.key) == null ? void 0 : _a.startsWith("data-"))) {
|
|
18183
|
+
continue;
|
|
18184
|
+
}
|
|
18185
|
+
parsedAttributes[attribute == null ? void 0 : attribute.key] = escapeHtml$1(mustache.render((_b = attribute == null ? void 0 : attribute.value) != null ? _b : "", document2));
|
|
18186
|
+
}
|
|
18187
|
+
return parsedAttributes;
|
|
18188
|
+
};
|
|
18178
18189
|
const getFieldValue = (doc2, field = "") => {
|
|
18179
18190
|
var _a;
|
|
18180
18191
|
if (typeof field === "number") {
|
|
@@ -18860,7 +18871,8 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
|
18860
18871
|
props: {
|
|
18861
18872
|
item: {},
|
|
18862
18873
|
options: {},
|
|
18863
|
-
inStock: { type: Boolean }
|
|
18874
|
+
inStock: { type: Boolean },
|
|
18875
|
+
dynamicAttributes: {}
|
|
18864
18876
|
},
|
|
18865
18877
|
emits: ["productEvent"],
|
|
18866
18878
|
setup(__props, { emit: emit2 }) {
|
|
@@ -18890,13 +18902,13 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
|
18890
18902
|
return (_ctx, _cache) => {
|
|
18891
18903
|
return openBlock(), createElementBlock("div", _hoisted_1$15, [
|
|
18892
18904
|
createBaseVNode("div", _hoisted_2$O, [
|
|
18893
|
-
createBaseVNode("button", {
|
|
18905
|
+
createBaseVNode("button", mergeProps({
|
|
18894
18906
|
onClick: withModifiers(handleClick, ["stop", "prevent"]),
|
|
18895
|
-
class:
|
|
18907
|
+
class: loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart",
|
|
18896
18908
|
"data-cy": "lupa-add-to-cart",
|
|
18897
18909
|
type: "button",
|
|
18898
18910
|
disabled: !inStockValue.value || loading.value
|
|
18899
|
-
}, toDisplayString(label.value),
|
|
18911
|
+
}, _ctx.dynamicAttributes), toDisplayString(label.value), 17, _hoisted_3$B)
|
|
18900
18912
|
])
|
|
18901
18913
|
]);
|
|
18902
18914
|
};
|
|
@@ -18951,6 +18963,9 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
18951
18963
|
}
|
|
18952
18964
|
return "search-box-product-title";
|
|
18953
18965
|
});
|
|
18966
|
+
const renderDynamicAttributesOnParentElement = computed(() => {
|
|
18967
|
+
return props.element.type !== DocumentElementType.ADDTOCART;
|
|
18968
|
+
});
|
|
18954
18969
|
const displayElement = computed(() => {
|
|
18955
18970
|
const element = props.element;
|
|
18956
18971
|
const item = props.item;
|
|
@@ -18967,20 +18982,24 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
18967
18982
|
const enhancementData = (_d = (_c = dynamicDataIdMap.value) == null ? void 0 : _c[(_b = props.item) == null ? void 0 : _b.id]) != null ? _d : {};
|
|
18968
18983
|
return __spreadValues2(__spreadValues2({}, props.item), enhancementData);
|
|
18969
18984
|
});
|
|
18985
|
+
const dynamicAttributes = computed(() => {
|
|
18986
|
+
return getDynamicAttributes(props.element.dynamicAttributes, enhancedItem.value);
|
|
18987
|
+
});
|
|
18970
18988
|
const isLoadingDynamicData = (id) => {
|
|
18971
18989
|
return Boolean(props.element.dynamic && id && loading.value && (loadingIds == null ? void 0 : loadingIds.value[id]));
|
|
18972
18990
|
};
|
|
18973
18991
|
return (_ctx, _cache) => {
|
|
18974
18992
|
var _a, _b;
|
|
18975
18993
|
return !_ctx.$slots.badges ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
18976
|
-
displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), {
|
|
18994
|
+
displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), mergeProps({
|
|
18977
18995
|
key: 0,
|
|
18978
18996
|
item: enhancedItem.value,
|
|
18979
18997
|
options: _ctx.element,
|
|
18980
18998
|
labels: _ctx.labels,
|
|
18981
|
-
class:
|
|
18982
|
-
inStock: _ctx.isInStock
|
|
18983
|
-
|
|
18999
|
+
class: { "lupa-loading-dynamic-data": isLoadingDynamicData((_a = _ctx.item) == null ? void 0 : _a.id) },
|
|
19000
|
+
inStock: _ctx.isInStock,
|
|
19001
|
+
"dynamic-attributes": dynamicAttributes.value
|
|
19002
|
+
}, renderDynamicAttributesOnParentElement.value && dynamicAttributes.value), null, 16, ["item", "options", "labels", "class", "inStock", "dynamic-attributes"])) : createCommentVNode("", true)
|
|
18984
19003
|
], 64)) : (openBlock(), createElementBlock("div", _hoisted_1$14, [
|
|
18985
19004
|
displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), {
|
|
18986
19005
|
key: 0,
|
|
@@ -23856,7 +23875,8 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
23856
23875
|
props: {
|
|
23857
23876
|
item: {},
|
|
23858
23877
|
options: {},
|
|
23859
|
-
inStock: { type: Boolean }
|
|
23878
|
+
inStock: { type: Boolean },
|
|
23879
|
+
dynamicAttributes: {}
|
|
23860
23880
|
},
|
|
23861
23881
|
emits: ["productEvent"],
|
|
23862
23882
|
setup(__props, { emit: emit2 }) {
|
|
@@ -23891,13 +23911,14 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
23891
23911
|
return (_ctx, _cache) => {
|
|
23892
23912
|
return openBlock(), createElementBlock("div", _hoisted_1$r, [
|
|
23893
23913
|
createBaseVNode("div", _hoisted_2$m, [
|
|
23894
|
-
createBaseVNode("button", {
|
|
23914
|
+
createBaseVNode("button", mergeProps({
|
|
23895
23915
|
id: id.value,
|
|
23896
|
-
class:
|
|
23916
|
+
class: loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart",
|
|
23897
23917
|
"data-cy": "lupa-add-to-cart",
|
|
23898
|
-
disabled: !inStockValue.value || loading.value
|
|
23918
|
+
disabled: !inStockValue.value || loading.value
|
|
23919
|
+
}, _ctx.dynamicAttributes, {
|
|
23899
23920
|
onClick: withModifiers(handleClick, ["stop"])
|
|
23900
|
-
}, toDisplayString(label.value),
|
|
23921
|
+
}), toDisplayString(label.value), 17, _hoisted_3$g)
|
|
23901
23922
|
])
|
|
23902
23923
|
]);
|
|
23903
23924
|
};
|
|
@@ -24093,6 +24114,9 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
24093
24114
|
}
|
|
24094
24115
|
return "searchResultsProductTitle";
|
|
24095
24116
|
});
|
|
24117
|
+
const renderDynamicAttributesOnParentElement = computed(() => {
|
|
24118
|
+
return props.element.type !== DocumentElementType.ADDTOCART;
|
|
24119
|
+
});
|
|
24096
24120
|
const enhancedItem = computed(() => {
|
|
24097
24121
|
var _a, _b, _c, _d;
|
|
24098
24122
|
if (!((_a = props.item) == null ? void 0 : _a.id)) {
|
|
@@ -24109,6 +24133,9 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
24109
24133
|
}
|
|
24110
24134
|
return typeof element.display === "function" ? element.display(item) : processDisplayCondition(element.display, item);
|
|
24111
24135
|
});
|
|
24136
|
+
const dynamicAttributes = computed(() => {
|
|
24137
|
+
return getDynamicAttributes(props.element.dynamicAttributes, enhancedItem.value);
|
|
24138
|
+
});
|
|
24112
24139
|
const handleProductEvent = (item) => {
|
|
24113
24140
|
emit2("productEvent", item);
|
|
24114
24141
|
};
|
|
@@ -24117,16 +24144,16 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
24117
24144
|
};
|
|
24118
24145
|
return (_ctx, _cache) => {
|
|
24119
24146
|
var _a;
|
|
24120
|
-
return displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), {
|
|
24147
|
+
return displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), mergeProps({
|
|
24121
24148
|
key: 0,
|
|
24122
24149
|
item: enhancedItem.value,
|
|
24123
24150
|
options: _ctx.element,
|
|
24124
24151
|
labels: _ctx.labels,
|
|
24125
24152
|
inStock: _ctx.inStock,
|
|
24126
24153
|
link: _ctx.link,
|
|
24127
|
-
class:
|
|
24128
|
-
|
|
24129
|
-
}, null,
|
|
24154
|
+
class: { "lupa-loading-dynamic-data": isLoadingDynamicData((_a = _ctx.item) == null ? void 0 : _a.id) },
|
|
24155
|
+
"dynamic-attributes": dynamicAttributes.value
|
|
24156
|
+
}, renderDynamicAttributesOnParentElement.value && dynamicAttributes.value, { onProductEvent: handleProductEvent }), null, 16, ["item", "options", "labels", "inStock", "link", "class", "dynamic-attributes"])) : createCommentVNode("", true);
|
|
24130
24157
|
};
|
|
24131
24158
|
}
|
|
24132
24159
|
}));
|
package/dist/lupaSearch.umd.js
CHANGED
|
@@ -18179,6 +18179,17 @@ and ensure you are accounting for this risk.
|
|
|
18179
18179
|
const rendered = mustache.render(template, document2);
|
|
18180
18180
|
return sanitizeHtml$1(rendered);
|
|
18181
18181
|
};
|
|
18182
|
+
const getDynamicAttributes = (dynamicAttributes = [], document2 = {}) => {
|
|
18183
|
+
var _a, _b;
|
|
18184
|
+
const parsedAttributes = {};
|
|
18185
|
+
for (const attribute of dynamicAttributes) {
|
|
18186
|
+
if (!((_a = attribute == null ? void 0 : attribute.key) == null ? void 0 : _a.startsWith("data-"))) {
|
|
18187
|
+
continue;
|
|
18188
|
+
}
|
|
18189
|
+
parsedAttributes[attribute == null ? void 0 : attribute.key] = escapeHtml$1(mustache.render((_b = attribute == null ? void 0 : attribute.value) != null ? _b : "", document2));
|
|
18190
|
+
}
|
|
18191
|
+
return parsedAttributes;
|
|
18192
|
+
};
|
|
18182
18193
|
const getFieldValue = (doc2, field = "") => {
|
|
18183
18194
|
var _a;
|
|
18184
18195
|
if (typeof field === "number") {
|
|
@@ -18864,7 +18875,8 @@ and ensure you are accounting for this risk.
|
|
|
18864
18875
|
props: {
|
|
18865
18876
|
item: {},
|
|
18866
18877
|
options: {},
|
|
18867
|
-
inStock: { type: Boolean }
|
|
18878
|
+
inStock: { type: Boolean },
|
|
18879
|
+
dynamicAttributes: {}
|
|
18868
18880
|
},
|
|
18869
18881
|
emits: ["productEvent"],
|
|
18870
18882
|
setup(__props, { emit: emit2 }) {
|
|
@@ -18894,13 +18906,13 @@ and ensure you are accounting for this risk.
|
|
|
18894
18906
|
return (_ctx, _cache) => {
|
|
18895
18907
|
return openBlock(), createElementBlock("div", _hoisted_1$15, [
|
|
18896
18908
|
createBaseVNode("div", _hoisted_2$O, [
|
|
18897
|
-
createBaseVNode("button", {
|
|
18909
|
+
createBaseVNode("button", mergeProps({
|
|
18898
18910
|
onClick: withModifiers(handleClick, ["stop", "prevent"]),
|
|
18899
|
-
class:
|
|
18911
|
+
class: loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart",
|
|
18900
18912
|
"data-cy": "lupa-add-to-cart",
|
|
18901
18913
|
type: "button",
|
|
18902
18914
|
disabled: !inStockValue.value || loading.value
|
|
18903
|
-
}, toDisplayString(label.value),
|
|
18915
|
+
}, _ctx.dynamicAttributes), toDisplayString(label.value), 17, _hoisted_3$B)
|
|
18904
18916
|
])
|
|
18905
18917
|
]);
|
|
18906
18918
|
};
|
|
@@ -18955,6 +18967,9 @@ and ensure you are accounting for this risk.
|
|
|
18955
18967
|
}
|
|
18956
18968
|
return "search-box-product-title";
|
|
18957
18969
|
});
|
|
18970
|
+
const renderDynamicAttributesOnParentElement = computed(() => {
|
|
18971
|
+
return props.element.type !== DocumentElementType.ADDTOCART;
|
|
18972
|
+
});
|
|
18958
18973
|
const displayElement = computed(() => {
|
|
18959
18974
|
const element = props.element;
|
|
18960
18975
|
const item = props.item;
|
|
@@ -18971,20 +18986,24 @@ and ensure you are accounting for this risk.
|
|
|
18971
18986
|
const enhancementData = (_d = (_c = dynamicDataIdMap.value) == null ? void 0 : _c[(_b = props.item) == null ? void 0 : _b.id]) != null ? _d : {};
|
|
18972
18987
|
return __spreadValues2(__spreadValues2({}, props.item), enhancementData);
|
|
18973
18988
|
});
|
|
18989
|
+
const dynamicAttributes = computed(() => {
|
|
18990
|
+
return getDynamicAttributes(props.element.dynamicAttributes, enhancedItem.value);
|
|
18991
|
+
});
|
|
18974
18992
|
const isLoadingDynamicData = (id) => {
|
|
18975
18993
|
return Boolean(props.element.dynamic && id && loading.value && (loadingIds == null ? void 0 : loadingIds.value[id]));
|
|
18976
18994
|
};
|
|
18977
18995
|
return (_ctx, _cache) => {
|
|
18978
18996
|
var _a, _b;
|
|
18979
18997
|
return !_ctx.$slots.badges ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
18980
|
-
displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), {
|
|
18998
|
+
displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), mergeProps({
|
|
18981
18999
|
key: 0,
|
|
18982
19000
|
item: enhancedItem.value,
|
|
18983
19001
|
options: _ctx.element,
|
|
18984
19002
|
labels: _ctx.labels,
|
|
18985
|
-
class:
|
|
18986
|
-
inStock: _ctx.isInStock
|
|
18987
|
-
|
|
19003
|
+
class: { "lupa-loading-dynamic-data": isLoadingDynamicData((_a = _ctx.item) == null ? void 0 : _a.id) },
|
|
19004
|
+
inStock: _ctx.isInStock,
|
|
19005
|
+
"dynamic-attributes": dynamicAttributes.value
|
|
19006
|
+
}, renderDynamicAttributesOnParentElement.value && dynamicAttributes.value), null, 16, ["item", "options", "labels", "class", "inStock", "dynamic-attributes"])) : createCommentVNode("", true)
|
|
18988
19007
|
], 64)) : (openBlock(), createElementBlock("div", _hoisted_1$14, [
|
|
18989
19008
|
displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), {
|
|
18990
19009
|
key: 0,
|
|
@@ -23860,7 +23879,8 @@ and ensure you are accounting for this risk.
|
|
|
23860
23879
|
props: {
|
|
23861
23880
|
item: {},
|
|
23862
23881
|
options: {},
|
|
23863
|
-
inStock: { type: Boolean }
|
|
23882
|
+
inStock: { type: Boolean },
|
|
23883
|
+
dynamicAttributes: {}
|
|
23864
23884
|
},
|
|
23865
23885
|
emits: ["productEvent"],
|
|
23866
23886
|
setup(__props, { emit: emit2 }) {
|
|
@@ -23895,13 +23915,14 @@ and ensure you are accounting for this risk.
|
|
|
23895
23915
|
return (_ctx, _cache) => {
|
|
23896
23916
|
return openBlock(), createElementBlock("div", _hoisted_1$r, [
|
|
23897
23917
|
createBaseVNode("div", _hoisted_2$m, [
|
|
23898
|
-
createBaseVNode("button", {
|
|
23918
|
+
createBaseVNode("button", mergeProps({
|
|
23899
23919
|
id: id.value,
|
|
23900
|
-
class:
|
|
23920
|
+
class: loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart",
|
|
23901
23921
|
"data-cy": "lupa-add-to-cart",
|
|
23902
|
-
disabled: !inStockValue.value || loading.value
|
|
23922
|
+
disabled: !inStockValue.value || loading.value
|
|
23923
|
+
}, _ctx.dynamicAttributes, {
|
|
23903
23924
|
onClick: withModifiers(handleClick, ["stop"])
|
|
23904
|
-
}, toDisplayString(label.value),
|
|
23925
|
+
}), toDisplayString(label.value), 17, _hoisted_3$g)
|
|
23905
23926
|
])
|
|
23906
23927
|
]);
|
|
23907
23928
|
};
|
|
@@ -24097,6 +24118,9 @@ and ensure you are accounting for this risk.
|
|
|
24097
24118
|
}
|
|
24098
24119
|
return "searchResultsProductTitle";
|
|
24099
24120
|
});
|
|
24121
|
+
const renderDynamicAttributesOnParentElement = computed(() => {
|
|
24122
|
+
return props.element.type !== DocumentElementType.ADDTOCART;
|
|
24123
|
+
});
|
|
24100
24124
|
const enhancedItem = computed(() => {
|
|
24101
24125
|
var _a, _b, _c, _d;
|
|
24102
24126
|
if (!((_a = props.item) == null ? void 0 : _a.id)) {
|
|
@@ -24113,6 +24137,9 @@ and ensure you are accounting for this risk.
|
|
|
24113
24137
|
}
|
|
24114
24138
|
return typeof element.display === "function" ? element.display(item) : processDisplayCondition(element.display, item);
|
|
24115
24139
|
});
|
|
24140
|
+
const dynamicAttributes = computed(() => {
|
|
24141
|
+
return getDynamicAttributes(props.element.dynamicAttributes, enhancedItem.value);
|
|
24142
|
+
});
|
|
24116
24143
|
const handleProductEvent = (item) => {
|
|
24117
24144
|
emit2("productEvent", item);
|
|
24118
24145
|
};
|
|
@@ -24121,16 +24148,16 @@ and ensure you are accounting for this risk.
|
|
|
24121
24148
|
};
|
|
24122
24149
|
return (_ctx, _cache) => {
|
|
24123
24150
|
var _a;
|
|
24124
|
-
return displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), {
|
|
24151
|
+
return displayElement.value ? (openBlock(), createBlock(resolveDynamicComponent(elementComponent.value), mergeProps({
|
|
24125
24152
|
key: 0,
|
|
24126
24153
|
item: enhancedItem.value,
|
|
24127
24154
|
options: _ctx.element,
|
|
24128
24155
|
labels: _ctx.labels,
|
|
24129
24156
|
inStock: _ctx.inStock,
|
|
24130
24157
|
link: _ctx.link,
|
|
24131
|
-
class:
|
|
24132
|
-
|
|
24133
|
-
}, null,
|
|
24158
|
+
class: { "lupa-loading-dynamic-data": isLoadingDynamicData((_a = _ctx.item) == null ? void 0 : _a.id) },
|
|
24159
|
+
"dynamic-attributes": dynamicAttributes.value
|
|
24160
|
+
}, renderDynamicAttributesOnParentElement.value && dynamicAttributes.value, { onProductEvent: handleProductEvent }), null, 16, ["item", "options", "labels", "inStock", "link", "class", "dynamic-attributes"])) : createCommentVNode("", true);
|
|
24134
24161
|
};
|
|
24135
24162
|
}
|
|
24136
24163
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/client",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.6",
|
|
4
4
|
"main": "dist/lupaSearch.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@getlupa/client-sdk": "^1.3.4",
|
|
23
|
-
"@getlupa/vue": "0.15.
|
|
23
|
+
"@getlupa/vue": "0.15.6",
|
|
24
24
|
"@rushstack/eslint-patch": "^1.3.2",
|
|
25
25
|
"@tsconfig/node18": "^2.0.1",
|
|
26
26
|
"@types/jsdom": "^21.1.1",
|