@propeller-commerce/propeller-v2-vue-ui 0.3.36 → 0.3.38
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/CHANGELOG.md +36 -0
- package/dist/components/SearchBar.vue.d.ts +39 -1
- package/dist/index.cjs +44 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +44 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2190,10 +2190,24 @@ function useProductSearch(options) {
|
|
|
2190
2190
|
if (!graphqlClient) return;
|
|
2191
2191
|
searchLoading.value = true;
|
|
2192
2192
|
try {
|
|
2193
|
-
const service = createServices(graphqlClient).product;
|
|
2194
2193
|
const lang = languageRef.value || "NL";
|
|
2195
|
-
const
|
|
2196
|
-
|
|
2194
|
+
const service = createServices(graphqlClient).category;
|
|
2195
|
+
const catId = configuration?.baseCategoryId ?? 0;
|
|
2196
|
+
if (!catId) {
|
|
2197
|
+
searchResults.value = [];
|
|
2198
|
+
searchItemsFound.value = 0;
|
|
2199
|
+
return;
|
|
2200
|
+
}
|
|
2201
|
+
const searchOrderlistIds = options.orderlistIds?.value;
|
|
2202
|
+
const orderlistScope = searchOrderlistIds && searchOrderlistIds.length > 0 ? {
|
|
2203
|
+
applyOrderlists: options.applyOrderlists?.value !== false,
|
|
2204
|
+
orderlistIds: searchOrderlistIds
|
|
2205
|
+
} : { applyOrderlists: false };
|
|
2206
|
+
const user = userRef.value;
|
|
2207
|
+
const userId = user && "contactId" in user ? user.contactId : user && "customerId" in user ? user.customerId : void 0;
|
|
2208
|
+
const contactId = user && "contactId" in user ? user.contactId : void 0;
|
|
2209
|
+
const customerId = user && "customerId" in user ? user.customerId : void 0;
|
|
2210
|
+
const categoryProductSearchInput = {
|
|
2197
2211
|
language: lang,
|
|
2198
2212
|
page: 1,
|
|
2199
2213
|
offset: 10,
|
|
@@ -2203,7 +2217,8 @@ function useProductSearch(options) {
|
|
|
2203
2217
|
ProductStatus.T,
|
|
2204
2218
|
ProductStatus.S
|
|
2205
2219
|
],
|
|
2206
|
-
|
|
2220
|
+
hidden: false,
|
|
2221
|
+
term,
|
|
2207
2222
|
searchFields: [
|
|
2208
2223
|
{
|
|
2209
2224
|
fieldNames: [
|
|
@@ -2230,16 +2245,30 @@ function useProductSearch(options) {
|
|
|
2230
2245
|
],
|
|
2231
2246
|
boost: 1
|
|
2232
2247
|
}
|
|
2233
|
-
]
|
|
2248
|
+
],
|
|
2249
|
+
sortInputs: [{ field: ProductSortField.RELEVANCE, order: SortOrder.DESC }],
|
|
2250
|
+
...companyIdRef.value && { companyId: companyIdRef.value },
|
|
2251
|
+
...userId !== void 0 && { userId },
|
|
2252
|
+
...orderlistScope
|
|
2253
|
+
};
|
|
2254
|
+
const priceCalculateProductInput = {
|
|
2255
|
+
taxZone,
|
|
2256
|
+
...companyIdRef.value && { companyId: companyIdRef.value },
|
|
2257
|
+
...contactId !== void 0 && { contactId },
|
|
2258
|
+
...customerId !== void 0 && { customerId }
|
|
2234
2259
|
};
|
|
2235
2260
|
const variables = {
|
|
2236
|
-
|
|
2261
|
+
categoryId: catId,
|
|
2237
2262
|
language: lang,
|
|
2263
|
+
categoryProductSearchInput,
|
|
2264
|
+
priceCalculateProductInput,
|
|
2265
|
+
imageSearchFilters: configuration?.imageSearchFiltersGrid,
|
|
2238
2266
|
imageVariantFilters: configuration?.imageVariantFiltersMedium
|
|
2239
2267
|
};
|
|
2240
|
-
const
|
|
2241
|
-
|
|
2242
|
-
|
|
2268
|
+
const response = await service.getCategory(variables);
|
|
2269
|
+
const productsResponse = response?.products;
|
|
2270
|
+
searchResults.value = productsResponse?.items ?? [];
|
|
2271
|
+
searchItemsFound.value = productsResponse?.itemsFound ?? searchResults.value.length;
|
|
2243
2272
|
} catch {
|
|
2244
2273
|
searchResults.value = [];
|
|
2245
2274
|
searchItemsFound.value = 0;
|
|
@@ -19937,7 +19966,7 @@ const _hoisted_11$1 = {
|
|
|
19937
19966
|
class: "propeller-search-bar__result-sku text-sm text-muted-foreground"
|
|
19938
19967
|
};
|
|
19939
19968
|
const _hoisted_12$1 = {
|
|
19940
|
-
key:
|
|
19969
|
+
key: 2,
|
|
19941
19970
|
class: "propeller-search-bar__result-price text-sm font-semibold text-foreground flex-shrink-0 text-right"
|
|
19942
19971
|
};
|
|
19943
19972
|
const _hoisted_13$1 = { class: "propeller-search-bar__result-price-value" };
|
|
@@ -19964,6 +19993,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
19964
19993
|
onViewAllClick: { type: Function },
|
|
19965
19994
|
getResultHref: { type: Function },
|
|
19966
19995
|
getViewAllHref: { type: Function },
|
|
19996
|
+
showPrice: { type: Boolean },
|
|
19967
19997
|
formatPrice: { type: Function },
|
|
19968
19998
|
labels: {},
|
|
19969
19999
|
includeTax: { type: Boolean },
|
|
@@ -20196,7 +20226,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
20196
20226
|
createElementVNode("div", _hoisted_10$1, toDisplayString(result.name), 1),
|
|
20197
20227
|
result.sku ? (openBlock(), createElementBlock("div", _hoisted_11$1, "SKU: " + toDisplayString(result.sku), 1)) : createCommentVNode("", true)
|
|
20198
20228
|
]),
|
|
20199
|
-
|
|
20229
|
+
_ctx.$slots.price ? renderSlot(_ctx.$slots, "price", {
|
|
20230
|
+
key: 1,
|
|
20231
|
+
result
|
|
20232
|
+
}) : __props.showPrice !== false && result.price !== void 0 && result.price !== null ? (openBlock(), createElementBlock("div", _hoisted_12$1, [
|
|
20200
20233
|
createElementVNode("span", _hoisted_13$1, toDisplayString(formatItemPrice(leadingPrice(result))), 1),
|
|
20201
20234
|
createElementVNode("span", _hoisted_14$1, toDisplayString(priceTaxLabel()), 1)
|
|
20202
20235
|
])) : createCommentVNode("", true)
|