@zenky/storefront-vue 0.9.33 → 0.9.37
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/cjs/index.js +88 -12
- package/dist/esm/index.js +88 -14
- package/dist/zenky.d.ts +26 -7
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -50,6 +50,16 @@ exports.ZenkyInjection = void 0;
|
|
|
50
50
|
ZenkyInjection["CategoryNotFound"] = "zenky:category:notFound";
|
|
51
51
|
ZenkyInjection["Collection"] = "zenky:collection";
|
|
52
52
|
ZenkyInjection["CollectionNotFound"] = "zenky:collection:notFound";
|
|
53
|
+
ZenkyInjection["Offer"] = "zenky:offer";
|
|
54
|
+
ZenkyInjection["OfferNotFound"] = "zenky:offer:notFound";
|
|
55
|
+
ZenkyInjection["CategoryContext"] = "zenky:context:category";
|
|
56
|
+
ZenkyInjection["CategoryContextNotFound"] = "zenky:context:category:notFound";
|
|
57
|
+
ZenkyInjection["GroupContext"] = "zenky:context:category";
|
|
58
|
+
ZenkyInjection["GroupContextNotFound"] = "zenky:context:category:notFound";
|
|
59
|
+
ZenkyInjection["VariantOptionContext"] = "zenky:context:variant_option";
|
|
60
|
+
ZenkyInjection["VariantOptionContextNotFound"] = "zenky:context:variant_option:notFound";
|
|
61
|
+
ZenkyInjection["VariantOptionValueContext"] = "zenky:context:variant_option_value";
|
|
62
|
+
ZenkyInjection["VariantOptionValueContextNotFound"] = "zenky:context:variant_option_value:notFound";
|
|
53
63
|
})(exports.ZenkyInjection || (exports.ZenkyInjection = {}));
|
|
54
64
|
|
|
55
65
|
async function useStateDataLoader(state, loader) {
|
|
@@ -569,7 +579,7 @@ const useCategoriesStore = pinia.defineStore({
|
|
|
569
579
|
}
|
|
570
580
|
this.loading = true;
|
|
571
581
|
try {
|
|
572
|
-
this.tree = await api.getCategoriesTree({ visibility:
|
|
582
|
+
this.tree = await api.getCategoriesTree({ visibility: api.Visibility.Visible, with: 'media' });
|
|
573
583
|
this.loaded = true;
|
|
574
584
|
}
|
|
575
585
|
catch (e) {
|
|
@@ -744,7 +754,7 @@ const useCollectionsStore = pinia.defineStore({
|
|
|
744
754
|
this.loading = true;
|
|
745
755
|
try {
|
|
746
756
|
this.collections = (await api.getProductsCollections({
|
|
747
|
-
visibility:
|
|
757
|
+
visibility: api.Visibility.Visible,
|
|
748
758
|
order_by: 'name',
|
|
749
759
|
with: 'media',
|
|
750
760
|
count: 100,
|
|
@@ -1535,6 +1545,17 @@ function getFirstMedium(media, sizes = ['large', 'medium'], preferWebp = true) {
|
|
|
1535
1545
|
return images.length > 0 ? images[0] : null;
|
|
1536
1546
|
}
|
|
1537
1547
|
|
|
1548
|
+
function useOffersList(errorHandler) {
|
|
1549
|
+
return usePaginatedLoader(api.getOffers, getApiErrorHandler(errorHandler, function (e) {
|
|
1550
|
+
ui.useNotification('error', 'Ошибка', api.getApiErrorMessage(e, 'Не удалось загрузить список акций.'));
|
|
1551
|
+
}));
|
|
1552
|
+
}
|
|
1553
|
+
function useOfferItem(errorHandler) {
|
|
1554
|
+
return useItemLoader(api.getOffer, getApiErrorHandler(errorHandler, function (e) {
|
|
1555
|
+
ui.useNotification('error', 'Ошибка', api.getApiErrorMessage(e, 'Не удалось загрузить акцию.'));
|
|
1556
|
+
}));
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1538
1559
|
function useProductsPricesRange(categoryId, errorHandler) {
|
|
1539
1560
|
return useDataLoader(async () => api.getProductsPricesRange(categoryId), getApiErrorHandler(errorHandler, function (e) {
|
|
1540
1561
|
ui.useNotification('error', 'Ошибка', api.getApiErrorMessage(e, 'Не удалось загрузить диапазон цен.'));
|
|
@@ -1609,10 +1630,13 @@ var ProductsFiltersType;
|
|
|
1609
1630
|
ProductsFiltersType["FeaturesGroups"] = "featuresGroups";
|
|
1610
1631
|
})(ProductsFiltersType || (ProductsFiltersType = {}));
|
|
1611
1632
|
|
|
1612
|
-
function getSourceParams(source) {
|
|
1633
|
+
function getSourceParams(source, promotion) {
|
|
1613
1634
|
if (source === null || !source.id || !source.type) {
|
|
1614
1635
|
return {};
|
|
1615
1636
|
}
|
|
1637
|
+
else if (promotion !== null) {
|
|
1638
|
+
return {};
|
|
1639
|
+
}
|
|
1616
1640
|
switch (source.type) {
|
|
1617
1641
|
case ProductsSourceType.Category:
|
|
1618
1642
|
return { category_id: source.id };
|
|
@@ -1699,9 +1723,15 @@ function getLoaderParams(page, loader) {
|
|
|
1699
1723
|
if (loader.search) {
|
|
1700
1724
|
params.search = loader.search;
|
|
1701
1725
|
}
|
|
1702
|
-
if (typeof loader.
|
|
1703
|
-
params
|
|
1726
|
+
if (typeof loader.promotion === 'undefined' || loader.promotion === null) {
|
|
1727
|
+
return params;
|
|
1728
|
+
}
|
|
1729
|
+
params.promotion_reward = 'all';
|
|
1730
|
+
if (!loader.promotion.context_type || !loader.promotion.context_id) {
|
|
1731
|
+
return params;
|
|
1704
1732
|
}
|
|
1733
|
+
params.context_type = loader.promotion.context_type;
|
|
1734
|
+
params.context_id = loader.promotion.context_id;
|
|
1705
1735
|
return params;
|
|
1706
1736
|
}
|
|
1707
1737
|
function getProductsPaginationRequest(page, loader) {
|
|
@@ -1709,7 +1739,7 @@ function getProductsPaginationRequest(page, loader) {
|
|
|
1709
1739
|
return null;
|
|
1710
1740
|
}
|
|
1711
1741
|
return {
|
|
1712
|
-
...getSourceParams(loader.source),
|
|
1742
|
+
...getSourceParams(loader.source, loader.promotion),
|
|
1713
1743
|
...getSortingParams(loader.sorting),
|
|
1714
1744
|
...getFiltersParams(loader.filters),
|
|
1715
1745
|
...getPricesFiltersParams(loader.pricesFilters),
|
|
@@ -1750,7 +1780,7 @@ function useProductsList(config, errorHandler) {
|
|
|
1750
1780
|
count: config.value.count,
|
|
1751
1781
|
},
|
|
1752
1782
|
with: config.value.with || '',
|
|
1753
|
-
|
|
1783
|
+
promotion: config.value.promotion || null,
|
|
1754
1784
|
}));
|
|
1755
1785
|
const load = async (page, reset = false, callback) => {
|
|
1756
1786
|
const request = getProductsPaginationRequest(page, loader.value);
|
|
@@ -1811,9 +1841,26 @@ function getFiltersFromUrl(param) {
|
|
|
1811
1841
|
});
|
|
1812
1842
|
return filters;
|
|
1813
1843
|
}
|
|
1844
|
+
function getProductsListQueryParamsWithPromotion(params, promotion) {
|
|
1845
|
+
if (!promotion) {
|
|
1846
|
+
return params;
|
|
1847
|
+
}
|
|
1848
|
+
const clone = {
|
|
1849
|
+
...params,
|
|
1850
|
+
promotion_id: promotion.id,
|
|
1851
|
+
reward_id: promotion.reward_id,
|
|
1852
|
+
};
|
|
1853
|
+
if (promotion.context_type) {
|
|
1854
|
+
clone.context_type = promotion.context_type;
|
|
1855
|
+
}
|
|
1856
|
+
if (promotion.context_id) {
|
|
1857
|
+
clone.context_id = promotion.context_id;
|
|
1858
|
+
}
|
|
1859
|
+
return clone;
|
|
1860
|
+
}
|
|
1814
1861
|
function getProductsListQueryParams(config, request) {
|
|
1815
1862
|
if (request === null) {
|
|
1816
|
-
return {};
|
|
1863
|
+
return getProductsListQueryParamsWithPromotion({}, config.promotion);
|
|
1817
1864
|
}
|
|
1818
1865
|
const query = {};
|
|
1819
1866
|
if (request.order_by && request.order_by !== config.sorting) {
|
|
@@ -1831,7 +1878,25 @@ function getProductsListQueryParams(config, request) {
|
|
|
1831
1878
|
if (request.search) {
|
|
1832
1879
|
query.search = request.search;
|
|
1833
1880
|
}
|
|
1834
|
-
return query;
|
|
1881
|
+
return getProductsListQueryParamsWithPromotion(query, config.promotion);
|
|
1882
|
+
}
|
|
1883
|
+
function getQueryParam(query, param) {
|
|
1884
|
+
return typeof query[param] !== 'undefined' && query[param] ? query[param] : null;
|
|
1885
|
+
}
|
|
1886
|
+
function getPromotionFromQuery(query) {
|
|
1887
|
+
const promotionId = getQueryParam(query, 'promotion_id');
|
|
1888
|
+
const rewardId = getQueryParam(query, 'reward_id');
|
|
1889
|
+
if (!promotionId || !rewardId) {
|
|
1890
|
+
return null;
|
|
1891
|
+
}
|
|
1892
|
+
const contextType = getQueryParam(query, 'context_type');
|
|
1893
|
+
const contextId = getQueryParam(query, 'context_id');
|
|
1894
|
+
return {
|
|
1895
|
+
id: promotionId,
|
|
1896
|
+
reward_id: rewardId,
|
|
1897
|
+
context_type: contextType,
|
|
1898
|
+
context_id: contextId,
|
|
1899
|
+
};
|
|
1835
1900
|
}
|
|
1836
1901
|
function getProductsListParamsFromQuery(query) {
|
|
1837
1902
|
if (!query) {
|
|
@@ -1840,9 +1905,10 @@ function getProductsListParamsFromQuery(query) {
|
|
|
1840
1905
|
return {
|
|
1841
1906
|
sorting: typeof query.order_by !== 'undefined' ? query.order_by : null,
|
|
1842
1907
|
f: typeof query.f === 'string' ? getFiltersFromUrl(query.f) : null,
|
|
1843
|
-
min_price:
|
|
1844
|
-
max_price:
|
|
1845
|
-
search:
|
|
1908
|
+
min_price: getQueryParam(query, 'min_price'),
|
|
1909
|
+
max_price: getQueryParam(query, 'max_price'),
|
|
1910
|
+
search: getQueryParam(query, 'search'),
|
|
1911
|
+
promotion: getPromotionFromQuery(query),
|
|
1846
1912
|
};
|
|
1847
1913
|
}
|
|
1848
1914
|
|
|
@@ -1878,6 +1944,14 @@ function getProductsSource(source) {
|
|
|
1878
1944
|
return getInjectedSource(exports.ZenkyInjection.Category, exports.ZenkyInjection.CategoryNotFound, injected);
|
|
1879
1945
|
case ProductsSourceType.Collection:
|
|
1880
1946
|
return getInjectedSource(exports.ZenkyInjection.Collection, exports.ZenkyInjection.CollectionNotFound, injected);
|
|
1947
|
+
case ProductsSourceType.CategoryContext:
|
|
1948
|
+
return getInjectedSource(exports.ZenkyInjection.CategoryContext, exports.ZenkyInjection.CategoryContextNotFound, injected);
|
|
1949
|
+
case ProductsSourceType.GroupContext:
|
|
1950
|
+
return getInjectedSource(exports.ZenkyInjection.GroupContext, exports.ZenkyInjection.GroupContextNotFound, injected);
|
|
1951
|
+
case ProductsSourceType.VariantOptionContext:
|
|
1952
|
+
return getInjectedSource(exports.ZenkyInjection.VariantOptionContext, exports.ZenkyInjection.VariantOptionContextNotFound, injected);
|
|
1953
|
+
case ProductsSourceType.VariantOptionValueContext:
|
|
1954
|
+
return getInjectedSource(exports.ZenkyInjection.VariantOptionValueContext, exports.ZenkyInjection.VariantOptionValueContextNotFound, injected);
|
|
1881
1955
|
default:
|
|
1882
1956
|
return null;
|
|
1883
1957
|
}
|
|
@@ -1996,6 +2070,8 @@ exports.useItemLoader = useItemLoader;
|
|
|
1996
2070
|
exports.useListLoader = useListLoader;
|
|
1997
2071
|
exports.useLogin = useLogin;
|
|
1998
2072
|
exports.useLogout = useLogout;
|
|
2073
|
+
exports.useOfferItem = useOfferItem;
|
|
2074
|
+
exports.useOffersList = useOffersList;
|
|
1999
2075
|
exports.useOrderItem = useOrderItem;
|
|
2000
2076
|
exports.useOrdersList = useOrdersList;
|
|
2001
2077
|
exports.usePaginatedLoader = usePaginatedLoader;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref, computed, watch, unref, inject } from 'vue';
|
|
2
2
|
import { debounce, isBoolean } from 'lodash-es';
|
|
3
|
-
import { getStore, getAddressSuggestions, getCategoriesTree, getProductsCollections, getApiErrorMessage, getCategoryFeatures, getCategoryFeaturesGroups, getArticles, getArticleCategories, getArticle, getAuthenticationStatus, setAxiosToken, getCustomerProfile, login, requestPasswordResetCode, resetPassword, register, resendConfirmationCode, confirm, getApiErrorCode, getCustomerAddresses, deleteAddress, updateAddress, getCustomerOrders, getOrder, getCustomerPaymentMethods, deleteCustomerPaymentMethod, ImageType, getProductsPricesRange, getProducts } from '@zenky/api';
|
|
3
|
+
import { getStore, getAddressSuggestions, getCategoriesTree, Visibility, getProductsCollections, getApiErrorMessage, getCategoryFeatures, getCategoryFeaturesGroups, getArticles, getArticleCategories, getArticle, getAuthenticationStatus, setAxiosToken, getCustomerProfile, login, requestPasswordResetCode, resetPassword, register, resendConfirmationCode, confirm, getApiErrorCode, getCustomerAddresses, deleteAddress, updateAddress, getCustomerOrders, getOrder, getCustomerPaymentMethods, deleteCustomerPaymentMethod, ImageType, getOffers, getOffer, getProductsPricesRange, getProducts } from '@zenky/api';
|
|
4
4
|
import { defineStore } from 'pinia';
|
|
5
5
|
import { useNotification } from '@zenky/ui';
|
|
6
6
|
import { useCustomerLoaded, useCustomerAuthenticated, useCustomerLoggedOut, useOrderPriceRecalculated, useOrderShouldBeReloaded, useOrderPromotionRewardsShouldBeReloaded, useDisplayOrderPromotionRewardSelection, usePromotionsCheckerCompleted, useOrderPromotionsNotFound, useOrderSubmitted } from '@zenky/events';
|
|
@@ -42,6 +42,16 @@ var ZenkyInjection;
|
|
|
42
42
|
ZenkyInjection["CategoryNotFound"] = "zenky:category:notFound";
|
|
43
43
|
ZenkyInjection["Collection"] = "zenky:collection";
|
|
44
44
|
ZenkyInjection["CollectionNotFound"] = "zenky:collection:notFound";
|
|
45
|
+
ZenkyInjection["Offer"] = "zenky:offer";
|
|
46
|
+
ZenkyInjection["OfferNotFound"] = "zenky:offer:notFound";
|
|
47
|
+
ZenkyInjection["CategoryContext"] = "zenky:context:category";
|
|
48
|
+
ZenkyInjection["CategoryContextNotFound"] = "zenky:context:category:notFound";
|
|
49
|
+
ZenkyInjection["GroupContext"] = "zenky:context:category";
|
|
50
|
+
ZenkyInjection["GroupContextNotFound"] = "zenky:context:category:notFound";
|
|
51
|
+
ZenkyInjection["VariantOptionContext"] = "zenky:context:variant_option";
|
|
52
|
+
ZenkyInjection["VariantOptionContextNotFound"] = "zenky:context:variant_option:notFound";
|
|
53
|
+
ZenkyInjection["VariantOptionValueContext"] = "zenky:context:variant_option_value";
|
|
54
|
+
ZenkyInjection["VariantOptionValueContextNotFound"] = "zenky:context:variant_option_value:notFound";
|
|
45
55
|
})(ZenkyInjection || (ZenkyInjection = {}));
|
|
46
56
|
|
|
47
57
|
async function useStateDataLoader(state, loader) {
|
|
@@ -561,7 +571,7 @@ const useCategoriesStore = defineStore({
|
|
|
561
571
|
}
|
|
562
572
|
this.loading = true;
|
|
563
573
|
try {
|
|
564
|
-
this.tree = await getCategoriesTree({ visibility:
|
|
574
|
+
this.tree = await getCategoriesTree({ visibility: Visibility.Visible, with: 'media' });
|
|
565
575
|
this.loaded = true;
|
|
566
576
|
}
|
|
567
577
|
catch (e) {
|
|
@@ -736,7 +746,7 @@ const useCollectionsStore = defineStore({
|
|
|
736
746
|
this.loading = true;
|
|
737
747
|
try {
|
|
738
748
|
this.collections = (await getProductsCollections({
|
|
739
|
-
visibility:
|
|
749
|
+
visibility: Visibility.Visible,
|
|
740
750
|
order_by: 'name',
|
|
741
751
|
with: 'media',
|
|
742
752
|
count: 100,
|
|
@@ -1527,6 +1537,17 @@ function getFirstMedium(media, sizes = ['large', 'medium'], preferWebp = true) {
|
|
|
1527
1537
|
return images.length > 0 ? images[0] : null;
|
|
1528
1538
|
}
|
|
1529
1539
|
|
|
1540
|
+
function useOffersList(errorHandler) {
|
|
1541
|
+
return usePaginatedLoader(getOffers, getApiErrorHandler(errorHandler, function (e) {
|
|
1542
|
+
useNotification('error', 'Ошибка', getApiErrorMessage(e, 'Не удалось загрузить список акций.'));
|
|
1543
|
+
}));
|
|
1544
|
+
}
|
|
1545
|
+
function useOfferItem(errorHandler) {
|
|
1546
|
+
return useItemLoader(getOffer, getApiErrorHandler(errorHandler, function (e) {
|
|
1547
|
+
useNotification('error', 'Ошибка', getApiErrorMessage(e, 'Не удалось загрузить акцию.'));
|
|
1548
|
+
}));
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1530
1551
|
function useProductsPricesRange(categoryId, errorHandler) {
|
|
1531
1552
|
return useDataLoader(async () => getProductsPricesRange(categoryId), getApiErrorHandler(errorHandler, function (e) {
|
|
1532
1553
|
useNotification('error', 'Ошибка', getApiErrorMessage(e, 'Не удалось загрузить диапазон цен.'));
|
|
@@ -1601,10 +1622,13 @@ var ProductsFiltersType;
|
|
|
1601
1622
|
ProductsFiltersType["FeaturesGroups"] = "featuresGroups";
|
|
1602
1623
|
})(ProductsFiltersType || (ProductsFiltersType = {}));
|
|
1603
1624
|
|
|
1604
|
-
function getSourceParams(source) {
|
|
1625
|
+
function getSourceParams(source, promotion) {
|
|
1605
1626
|
if (source === null || !source.id || !source.type) {
|
|
1606
1627
|
return {};
|
|
1607
1628
|
}
|
|
1629
|
+
else if (promotion !== null) {
|
|
1630
|
+
return {};
|
|
1631
|
+
}
|
|
1608
1632
|
switch (source.type) {
|
|
1609
1633
|
case ProductsSourceType.Category:
|
|
1610
1634
|
return { category_id: source.id };
|
|
@@ -1691,9 +1715,15 @@ function getLoaderParams(page, loader) {
|
|
|
1691
1715
|
if (loader.search) {
|
|
1692
1716
|
params.search = loader.search;
|
|
1693
1717
|
}
|
|
1694
|
-
if (typeof loader.
|
|
1695
|
-
params
|
|
1718
|
+
if (typeof loader.promotion === 'undefined' || loader.promotion === null) {
|
|
1719
|
+
return params;
|
|
1720
|
+
}
|
|
1721
|
+
params.promotion_reward = 'all';
|
|
1722
|
+
if (!loader.promotion.context_type || !loader.promotion.context_id) {
|
|
1723
|
+
return params;
|
|
1696
1724
|
}
|
|
1725
|
+
params.context_type = loader.promotion.context_type;
|
|
1726
|
+
params.context_id = loader.promotion.context_id;
|
|
1697
1727
|
return params;
|
|
1698
1728
|
}
|
|
1699
1729
|
function getProductsPaginationRequest(page, loader) {
|
|
@@ -1701,7 +1731,7 @@ function getProductsPaginationRequest(page, loader) {
|
|
|
1701
1731
|
return null;
|
|
1702
1732
|
}
|
|
1703
1733
|
return {
|
|
1704
|
-
...getSourceParams(loader.source),
|
|
1734
|
+
...getSourceParams(loader.source, loader.promotion),
|
|
1705
1735
|
...getSortingParams(loader.sorting),
|
|
1706
1736
|
...getFiltersParams(loader.filters),
|
|
1707
1737
|
...getPricesFiltersParams(loader.pricesFilters),
|
|
@@ -1742,7 +1772,7 @@ function useProductsList(config, errorHandler) {
|
|
|
1742
1772
|
count: config.value.count,
|
|
1743
1773
|
},
|
|
1744
1774
|
with: config.value.with || '',
|
|
1745
|
-
|
|
1775
|
+
promotion: config.value.promotion || null,
|
|
1746
1776
|
}));
|
|
1747
1777
|
const load = async (page, reset = false, callback) => {
|
|
1748
1778
|
const request = getProductsPaginationRequest(page, loader.value);
|
|
@@ -1803,9 +1833,26 @@ function getFiltersFromUrl(param) {
|
|
|
1803
1833
|
});
|
|
1804
1834
|
return filters;
|
|
1805
1835
|
}
|
|
1836
|
+
function getProductsListQueryParamsWithPromotion(params, promotion) {
|
|
1837
|
+
if (!promotion) {
|
|
1838
|
+
return params;
|
|
1839
|
+
}
|
|
1840
|
+
const clone = {
|
|
1841
|
+
...params,
|
|
1842
|
+
promotion_id: promotion.id,
|
|
1843
|
+
reward_id: promotion.reward_id,
|
|
1844
|
+
};
|
|
1845
|
+
if (promotion.context_type) {
|
|
1846
|
+
clone.context_type = promotion.context_type;
|
|
1847
|
+
}
|
|
1848
|
+
if (promotion.context_id) {
|
|
1849
|
+
clone.context_id = promotion.context_id;
|
|
1850
|
+
}
|
|
1851
|
+
return clone;
|
|
1852
|
+
}
|
|
1806
1853
|
function getProductsListQueryParams(config, request) {
|
|
1807
1854
|
if (request === null) {
|
|
1808
|
-
return {};
|
|
1855
|
+
return getProductsListQueryParamsWithPromotion({}, config.promotion);
|
|
1809
1856
|
}
|
|
1810
1857
|
const query = {};
|
|
1811
1858
|
if (request.order_by && request.order_by !== config.sorting) {
|
|
@@ -1823,7 +1870,25 @@ function getProductsListQueryParams(config, request) {
|
|
|
1823
1870
|
if (request.search) {
|
|
1824
1871
|
query.search = request.search;
|
|
1825
1872
|
}
|
|
1826
|
-
return query;
|
|
1873
|
+
return getProductsListQueryParamsWithPromotion(query, config.promotion);
|
|
1874
|
+
}
|
|
1875
|
+
function getQueryParam(query, param) {
|
|
1876
|
+
return typeof query[param] !== 'undefined' && query[param] ? query[param] : null;
|
|
1877
|
+
}
|
|
1878
|
+
function getPromotionFromQuery(query) {
|
|
1879
|
+
const promotionId = getQueryParam(query, 'promotion_id');
|
|
1880
|
+
const rewardId = getQueryParam(query, 'reward_id');
|
|
1881
|
+
if (!promotionId || !rewardId) {
|
|
1882
|
+
return null;
|
|
1883
|
+
}
|
|
1884
|
+
const contextType = getQueryParam(query, 'context_type');
|
|
1885
|
+
const contextId = getQueryParam(query, 'context_id');
|
|
1886
|
+
return {
|
|
1887
|
+
id: promotionId,
|
|
1888
|
+
reward_id: rewardId,
|
|
1889
|
+
context_type: contextType,
|
|
1890
|
+
context_id: contextId,
|
|
1891
|
+
};
|
|
1827
1892
|
}
|
|
1828
1893
|
function getProductsListParamsFromQuery(query) {
|
|
1829
1894
|
if (!query) {
|
|
@@ -1832,9 +1897,10 @@ function getProductsListParamsFromQuery(query) {
|
|
|
1832
1897
|
return {
|
|
1833
1898
|
sorting: typeof query.order_by !== 'undefined' ? query.order_by : null,
|
|
1834
1899
|
f: typeof query.f === 'string' ? getFiltersFromUrl(query.f) : null,
|
|
1835
|
-
min_price:
|
|
1836
|
-
max_price:
|
|
1837
|
-
search:
|
|
1900
|
+
min_price: getQueryParam(query, 'min_price'),
|
|
1901
|
+
max_price: getQueryParam(query, 'max_price'),
|
|
1902
|
+
search: getQueryParam(query, 'search'),
|
|
1903
|
+
promotion: getPromotionFromQuery(query),
|
|
1838
1904
|
};
|
|
1839
1905
|
}
|
|
1840
1906
|
|
|
@@ -1870,6 +1936,14 @@ function getProductsSource(source) {
|
|
|
1870
1936
|
return getInjectedSource(ZenkyInjection.Category, ZenkyInjection.CategoryNotFound, injected);
|
|
1871
1937
|
case ProductsSourceType.Collection:
|
|
1872
1938
|
return getInjectedSource(ZenkyInjection.Collection, ZenkyInjection.CollectionNotFound, injected);
|
|
1939
|
+
case ProductsSourceType.CategoryContext:
|
|
1940
|
+
return getInjectedSource(ZenkyInjection.CategoryContext, ZenkyInjection.CategoryContextNotFound, injected);
|
|
1941
|
+
case ProductsSourceType.GroupContext:
|
|
1942
|
+
return getInjectedSource(ZenkyInjection.GroupContext, ZenkyInjection.GroupContextNotFound, injected);
|
|
1943
|
+
case ProductsSourceType.VariantOptionContext:
|
|
1944
|
+
return getInjectedSource(ZenkyInjection.VariantOptionContext, ZenkyInjection.VariantOptionContextNotFound, injected);
|
|
1945
|
+
case ProductsSourceType.VariantOptionValueContext:
|
|
1946
|
+
return getInjectedSource(ZenkyInjection.VariantOptionValueContext, ZenkyInjection.VariantOptionValueContextNotFound, injected);
|
|
1873
1947
|
default:
|
|
1874
1948
|
return null;
|
|
1875
1949
|
}
|
|
@@ -1940,4 +2014,4 @@ function subscribeToOrderEvents(order) {
|
|
|
1940
2014
|
});
|
|
1941
2015
|
}
|
|
1942
2016
|
|
|
1943
|
-
export { AuthenticationEvent, AuthenticationResultType, AuthenticationStage, ZenkyInjection, ZenkyWebsocketEvent, createStorage, createWebsocketsConnection, getAddressForm, getApiErrorHandler, getExistedAddress, getExistedAddressDisplayValue, getFirstMedium, getProductsListParamsFromQuery, getProductsListQueryParams, getProductsPaginationRequest, getProductsSource, getSelectedAddress, getSelectedAddressDisplayValue, getStockAddress, getStockSchedule, getStorage, getWebsocketsConnection, subscribeToOrderEvents, useAddressFormValue, useArticleCategoriesList, useArticleItem, useArticlesList, useAuthenticationForm, useAuthenticationStatusChecker, useCategories, useCategoriesStore, useCategoriesTree, useCategory, useCategoryFeaturesGroupsList, useCategoryFeaturesList, useCollection, useCollections, useCollectionsStore, useCustomer, useCustomerStore, useDadata, useDataDestroyer, useDataLoader, useDeliveryAddressDestroyer, useDeliveryAddressesList, useEditAddressForm, useFeaturesFilters, useFeaturesGroupsFilters, useFlatCategoriesTree, useItemLoader, useListLoader, useLogin, useLogout, useOrderItem, useOrdersList, usePaginatedLoader, usePasswordReset, usePaymentMethodDestroyer, usePaymentMethodsList, usePhoneConfirmation, useProductsList, useProductsPricesRange, useProductsPricesRangeFilters, useRegistration, useReversedTree, useSplittedCategoriesTree, useStateDataLoader, useStoreStore, useSuggestionsRestrictedToCity };
|
|
2017
|
+
export { AuthenticationEvent, AuthenticationResultType, AuthenticationStage, ZenkyInjection, ZenkyWebsocketEvent, createStorage, createWebsocketsConnection, getAddressForm, getApiErrorHandler, getExistedAddress, getExistedAddressDisplayValue, getFirstMedium, getProductsListParamsFromQuery, getProductsListQueryParams, getProductsPaginationRequest, getProductsSource, getSelectedAddress, getSelectedAddressDisplayValue, getStockAddress, getStockSchedule, getStorage, getWebsocketsConnection, subscribeToOrderEvents, useAddressFormValue, useArticleCategoriesList, useArticleItem, useArticlesList, useAuthenticationForm, useAuthenticationStatusChecker, useCategories, useCategoriesStore, useCategoriesTree, useCategory, useCategoryFeaturesGroupsList, useCategoryFeaturesList, useCollection, useCollections, useCollectionsStore, useCustomer, useCustomerStore, useDadata, useDataDestroyer, useDataLoader, useDeliveryAddressDestroyer, useDeliveryAddressesList, useEditAddressForm, useFeaturesFilters, useFeaturesGroupsFilters, useFlatCategoriesTree, useItemLoader, useListLoader, useLogin, useLogout, useOfferItem, useOffersList, useOrderItem, useOrdersList, usePaginatedLoader, usePasswordReset, usePaymentMethodDestroyer, usePaymentMethodsList, usePhoneConfirmation, useProductsList, useProductsPricesRange, useProductsPricesRangeFilters, useRegistration, useReversedTree, useSplittedCategoriesTree, useStateDataLoader, useStoreStore, useSuggestionsRestrictedToCity };
|
package/dist/zenky.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ref, ComputedRef } from 'vue';
|
|
2
2
|
import * as _zenky_api from '@zenky/api';
|
|
3
|
-
import { PaginationRequest, Pagination, PaginatedResponse, ResourceRequest, Address, City, NestedCategory, ProductsCollection, Feature, FeaturesGroupContainer, Article, ArticleCategory, Customer, AuthenticationPhone, Order, OrderCredentials, CustomerPaymentMethod, Medium, Image, Product, ProductsPricesRange, ProductsPaginationRequest, Schedule, Stock, Store, StoreSettings } from '@zenky/api';
|
|
3
|
+
import { PaginationRequest, Pagination, PaginatedResponse, ResourceRequest, Address, City, NestedCategory, ProductsCollection, Feature, FeaturesGroupContainer, Article, ArticlesPaginationRequest, ArticleCategory, ArticleCategoriesPaginationRequest, Customer, AuthenticationPhone, Order, OrderCredentials, CustomerPaymentMethod, Medium, Image, Offer, OffersPaginationRequest, Product, ProductsPricesRange, ProductsPaginationRequest, Schedule, Stock, Store, StoreSettings } from '@zenky/api';
|
|
4
4
|
import * as pinia from 'pinia';
|
|
5
5
|
import Pusher from 'pusher-js';
|
|
6
6
|
|
|
@@ -23,7 +23,17 @@ declare enum ZenkyInjection {
|
|
|
23
23
|
Category = "zenky:category",
|
|
24
24
|
CategoryNotFound = "zenky:category:notFound",
|
|
25
25
|
Collection = "zenky:collection",
|
|
26
|
-
CollectionNotFound = "zenky:collection:notFound"
|
|
26
|
+
CollectionNotFound = "zenky:collection:notFound",
|
|
27
|
+
Offer = "zenky:offer",
|
|
28
|
+
OfferNotFound = "zenky:offer:notFound",
|
|
29
|
+
CategoryContext = "zenky:context:category",
|
|
30
|
+
CategoryContextNotFound = "zenky:context:category:notFound",
|
|
31
|
+
GroupContext = "zenky:context:category",
|
|
32
|
+
GroupContextNotFound = "zenky:context:category:notFound",
|
|
33
|
+
VariantOptionContext = "zenky:context:variant_option",
|
|
34
|
+
VariantOptionContextNotFound = "zenky:context:variant_option:notFound",
|
|
35
|
+
VariantOptionValueContext = "zenky:context:variant_option_value",
|
|
36
|
+
VariantOptionValueContextNotFound = "zenky:context:variant_option_value:notFound"
|
|
27
37
|
}
|
|
28
38
|
|
|
29
39
|
interface LoaderState {
|
|
@@ -200,8 +210,8 @@ declare const useCollectionsStore: pinia.StoreDefinition<"zenky:storefront:colle
|
|
|
200
210
|
declare function useCategoryFeaturesList(categoryId: string | null, errorHandler?: OptionalApiErrorHandler): ListLoader<Feature>;
|
|
201
211
|
declare function useCategoryFeaturesGroupsList(categoryId: string | null, errorHandler?: OptionalApiErrorHandler): ListLoader<FeaturesGroupContainer>;
|
|
202
212
|
|
|
203
|
-
declare function useArticlesList(errorHandler?: OptionalApiErrorHandler): PaginatedLoader<Article>;
|
|
204
|
-
declare function useArticleCategoriesList(errorHandler?: OptionalApiErrorHandler): PaginatedLoader<ArticleCategory>;
|
|
213
|
+
declare function useArticlesList(errorHandler?: OptionalApiErrorHandler): PaginatedLoader<Article, ArticlesPaginationRequest>;
|
|
214
|
+
declare function useArticleCategoriesList(errorHandler?: OptionalApiErrorHandler): PaginatedLoader<ArticleCategory, ArticleCategoriesPaginationRequest>;
|
|
205
215
|
declare function useArticleItem(errorHandler?: OptionalApiErrorHandler): ItemLoader<Article>;
|
|
206
216
|
|
|
207
217
|
declare enum AuthenticationStage {
|
|
@@ -1050,6 +1060,9 @@ declare const useCustomerStore: pinia.StoreDefinition<"zenky:storefront:customer
|
|
|
1050
1060
|
|
|
1051
1061
|
declare function getFirstMedium(media: Medium | Medium[], sizes?: string[], preferWebp?: boolean): Image | null;
|
|
1052
1062
|
|
|
1063
|
+
declare function useOffersList(errorHandler?: OptionalApiErrorHandler): PaginatedLoader<Offer, OffersPaginationRequest>;
|
|
1064
|
+
declare function useOfferItem(errorHandler?: OptionalApiErrorHandler): ItemLoader<Offer>;
|
|
1065
|
+
|
|
1053
1066
|
declare enum ProductsSourceType {
|
|
1054
1067
|
Category = "category",
|
|
1055
1068
|
Collection = "collection",
|
|
@@ -1089,7 +1102,7 @@ interface ProductsLoader {
|
|
|
1089
1102
|
count: number;
|
|
1090
1103
|
};
|
|
1091
1104
|
with?: string;
|
|
1092
|
-
|
|
1105
|
+
promotion?: ProductsPromotion | null;
|
|
1093
1106
|
}
|
|
1094
1107
|
declare type ProductsRequestCallback = (request: ProductsPaginationRequest | null) => void;
|
|
1095
1108
|
interface ProductsListProvider {
|
|
@@ -1110,6 +1123,12 @@ declare enum ProductsFiltersType {
|
|
|
1110
1123
|
Features = "features",
|
|
1111
1124
|
FeaturesGroups = "featuresGroups"
|
|
1112
1125
|
}
|
|
1126
|
+
interface ProductsPromotion {
|
|
1127
|
+
id: string;
|
|
1128
|
+
reward_id: string;
|
|
1129
|
+
context_type: string | null;
|
|
1130
|
+
context_id: string | null;
|
|
1131
|
+
}
|
|
1113
1132
|
interface ProductsListConfig {
|
|
1114
1133
|
source: ProductsSource | null;
|
|
1115
1134
|
search?: string | null;
|
|
@@ -1119,7 +1138,7 @@ interface ProductsListConfig {
|
|
|
1119
1138
|
count: number;
|
|
1120
1139
|
filtersType: ProductsFiltersType | null;
|
|
1121
1140
|
with?: string;
|
|
1122
|
-
|
|
1141
|
+
promotion?: ProductsPromotion | null;
|
|
1123
1142
|
}
|
|
1124
1143
|
|
|
1125
1144
|
declare function useFeaturesFilters(categoryId: string | null, values: ProductsFilters | null): {
|
|
@@ -1183,4 +1202,4 @@ declare function createWebsocketsConnection(store: Store): Pusher;
|
|
|
1183
1202
|
declare function getWebsocketsConnection(): Pusher;
|
|
1184
1203
|
declare function subscribeToOrderEvents(order: Order): void;
|
|
1185
1204
|
|
|
1186
|
-
export { AddressForm, AddressFormValue, AddressFormValueProvider, ApiErrorHandler, AuthenticationEvent, AuthenticationForm, AuthenticationFormProvider, AuthenticationResult, AuthenticationResultType, AuthenticationStage, AuthenticationStatusCheckerProvider, CategoriesProvider, CategoriesState, CategoriesTreeProvider, CategoryProvider, CollectionsState, ConfirmableDataDestroyer, ConfirmationProvider, CustomerStore, DadataProvider, DataDestroyer, DataDestroyerHandler, DataLoader, DataProvider, EditAddressFormProvider, EmitAuthenticationEvent, FlatCategoriesTreeProvider, FlattenNestedCategory, ItemLoader, ItemProvider, ListLoader, ListProvider, LoaderState, LoginProvider, LogoutProvider, OptionalApiErrorHandler, PaginatedItemsProvider, PaginatedLoader, PaginatedLoaderState, PasswordResetProvider, ProductsCollectionProvider, ProductsCollectionsProvider, RegistrationProvider, ReversedTreeProvider, SplittedCategoriesTreeProvider, StateDataLoader, StateDataLoaderState, StoreState, ZenkyInjection, ZenkyStorage, ZenkyWebsocketEvent, createStorage, createWebsocketsConnection, getAddressForm, getApiErrorHandler, getExistedAddress, getExistedAddressDisplayValue, getFirstMedium, getProductsListParamsFromQuery, getProductsListQueryParams, getProductsPaginationRequest, getProductsSource, getSelectedAddress, getSelectedAddressDisplayValue, getStockAddress, getStockSchedule, getStorage, getWebsocketsConnection, subscribeToOrderEvents, useAddressFormValue, useArticleCategoriesList, useArticleItem, useArticlesList, useAuthenticationForm, useAuthenticationStatusChecker, useCategories, useCategoriesStore, useCategoriesTree, useCategory, useCategoryFeaturesGroupsList, useCategoryFeaturesList, useCollection, useCollections, useCollectionsStore, useCustomer, useCustomerStore, useDadata, useDataDestroyer, useDataLoader, useDeliveryAddressDestroyer, useDeliveryAddressesList, useEditAddressForm, useFeaturesFilters, useFeaturesGroupsFilters, useFlatCategoriesTree, useItemLoader, useListLoader, useLogin, useLogout, useOrderItem, useOrdersList, usePaginatedLoader, usePasswordReset, usePaymentMethodDestroyer, usePaymentMethodsList, usePhoneConfirmation, useProductsList, useProductsPricesRange, useProductsPricesRangeFilters, useRegistration, useReversedTree, useSplittedCategoriesTree, useStateDataLoader, useStoreStore, useSuggestionsRestrictedToCity };
|
|
1205
|
+
export { AddressForm, AddressFormValue, AddressFormValueProvider, ApiErrorHandler, AuthenticationEvent, AuthenticationForm, AuthenticationFormProvider, AuthenticationResult, AuthenticationResultType, AuthenticationStage, AuthenticationStatusCheckerProvider, CategoriesProvider, CategoriesState, CategoriesTreeProvider, CategoryProvider, CollectionsState, ConfirmableDataDestroyer, ConfirmationProvider, CustomerStore, DadataProvider, DataDestroyer, DataDestroyerHandler, DataLoader, DataProvider, EditAddressFormProvider, EmitAuthenticationEvent, FlatCategoriesTreeProvider, FlattenNestedCategory, ItemLoader, ItemProvider, ListLoader, ListProvider, LoaderState, LoginProvider, LogoutProvider, OptionalApiErrorHandler, PaginatedItemsProvider, PaginatedLoader, PaginatedLoaderState, PasswordResetProvider, ProductsCollectionProvider, ProductsCollectionsProvider, RegistrationProvider, ReversedTreeProvider, SplittedCategoriesTreeProvider, StateDataLoader, StateDataLoaderState, StoreState, ZenkyInjection, ZenkyStorage, ZenkyWebsocketEvent, createStorage, createWebsocketsConnection, getAddressForm, getApiErrorHandler, getExistedAddress, getExistedAddressDisplayValue, getFirstMedium, getProductsListParamsFromQuery, getProductsListQueryParams, getProductsPaginationRequest, getProductsSource, getSelectedAddress, getSelectedAddressDisplayValue, getStockAddress, getStockSchedule, getStorage, getWebsocketsConnection, subscribeToOrderEvents, useAddressFormValue, useArticleCategoriesList, useArticleItem, useArticlesList, useAuthenticationForm, useAuthenticationStatusChecker, useCategories, useCategoriesStore, useCategoriesTree, useCategory, useCategoryFeaturesGroupsList, useCategoryFeaturesList, useCollection, useCollections, useCollectionsStore, useCustomer, useCustomerStore, useDadata, useDataDestroyer, useDataLoader, useDeliveryAddressDestroyer, useDeliveryAddressesList, useEditAddressForm, useFeaturesFilters, useFeaturesGroupsFilters, useFlatCategoriesTree, useItemLoader, useListLoader, useLogin, useLogout, useOfferItem, useOffersList, useOrderItem, useOrdersList, usePaginatedLoader, usePasswordReset, usePaymentMethodDestroyer, usePaymentMethodsList, usePhoneConfirmation, useProductsList, useProductsPricesRange, useProductsPricesRangeFilters, useRegistration, useReversedTree, useSplittedCategoriesTree, useStateDataLoader, useStoreStore, useSuggestionsRestrictedToCity };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenky/storefront-vue",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.37",
|
|
4
4
|
"description": "Zenky Storefront library for Vue 3.",
|
|
5
5
|
"author": "Timur Zurbaev <hello@zurbaev.ru>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"Zenky"
|
|
20
20
|
],
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@zenky/api": "^0.9.
|
|
22
|
+
"@zenky/api": "^0.9.44",
|
|
23
23
|
"@zenky/events": "^1.0.2",
|
|
24
24
|
"@zenky/ui": "^0.9.63",
|
|
25
25
|
"lodash-es": "^4.17.21",
|