@q2devel/q2-core 1.0.108 → 1.0.110
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/api/cart/Cart.service.d.ts.map +1 -1
- package/dist/api/cart/Cart.service.js +42 -6
- package/dist/api/products/getProducts.d.ts +4 -2
- package/dist/api/products/getProducts.d.ts.map +1 -1
- package/dist/api/products/getProducts.js +14 -2
- package/dist/context/cart/BasketContext.d.ts +5 -1
- package/dist/context/cart/BasketContext.d.ts.map +1 -1
- package/dist/context/cart/BasketContext.js +8 -2
- package/dist/hooks/cart/api/useDeleteCartItem.d.ts.map +1 -1
- package/dist/hooks/cart/api/useDeleteCartItem.js +8 -4
- package/dist/hooks/cart/api/useGetCartToken.d.ts.map +1 -1
- package/dist/hooks/cart/api/useGetCartToken.js +9 -2
- package/dist/hooks/cart/api/useGetCurrentCart.d.ts.map +1 -1
- package/dist/hooks/cart/api/useGetCurrentCart.js +6 -0
- package/dist/hooks/cart/api/useGetUserCart.d.ts.map +1 -1
- package/dist/hooks/cart/api/useGetUserCart.js +6 -0
- package/dist/hooks/products/useGetProducts.d.ts +1 -0
- package/dist/hooks/products/useGetProducts.d.ts.map +1 -1
- package/dist/hooks/products/useGetProducts.js +3 -1
- package/dist/hooks/products/useGetProductsCount.d.ts +2 -0
- package/dist/hooks/products/useGetProductsCount.d.ts.map +1 -1
- package/dist/hooks/products/useGetProductsCount.js +4 -1
- package/dist/utils/clearUserScopedQueries.d.ts +1 -1
- package/dist/utils/clearUserScopedQueries.d.ts.map +1 -1
- package/dist/utils/clearUserScopedQueries.js +1 -0
- package/package.json +1 -1
- package/dist/api/user/resetPassword/resetPasswordSevice.types.d.ts +0 -8
- package/dist/api/user/resetPassword/resetPasswordSevice.types.d.ts.map +0 -1
- package/dist/api/user/resetPassword/resetPasswordSevice.types.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cart.service.d.ts","sourceRoot":"","sources":["../../../api/cart/Cart.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EACjB,IAAI,EACJ,QAAQ,EACR,qBAAqB,EAErB,oBAAoB,EACpB,qBAAqB,EACxB,MAAM,qBAAqB,CAAA;AAS5B,KAAK,MAAM,GAAG;IACV,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,CAAC,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAA;QAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACL,CAAA;
|
|
1
|
+
{"version":3,"file":"Cart.service.d.ts","sourceRoot":"","sources":["../../../api/cart/Cart.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EACjB,IAAI,EACJ,QAAQ,EACR,qBAAqB,EAErB,oBAAoB,EACpB,qBAAqB,EACxB,MAAM,qBAAqB,CAAA;AAS5B,KAAK,MAAM,GAAG;IACV,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,CAAC,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAA;QAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACL,CAAA;AA4BD,eAAO,MAAM,WAAW,GACpB,KAAK,WAAW,EAChB,uBASG,MAAM,EACT,SAAQ,kBAAuB,KAChC,OAAO,CAAC,IAAI,CAmFd,CAAA;AAED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Headers = {}) => ({
|
|
|
6
6
|
...(ctx.accessToken && { Authorization: `Bearer ${ctx.accessToken}` }),
|
|
7
7
|
...customHeaders,
|
|
8
8
|
});
|
|
9
|
+
/**
|
|
10
|
+
* Picks the order that actually represents the current cart.
|
|
11
|
+
*
|
|
12
|
+
* /jsonapi/carts (and the user cart endpoint) can return several orders for the
|
|
13
|
+
* same token/user - Drupal keeps an emptied draft order around after its last
|
|
14
|
+
* item is removed, and that stale order can be listed before the current one.
|
|
15
|
+
* Blindly taking the first entry then renders an empty cart even though the
|
|
16
|
+
* item was added successfully.
|
|
17
|
+
*/
|
|
18
|
+
const pickActiveOrder = (orders) => {
|
|
19
|
+
if (orders.length <= 1)
|
|
20
|
+
return orders[0];
|
|
21
|
+
const newestFirst = (a, b) => (b?.drupal_internal__order_id || 0) - (a?.drupal_internal__order_id || 0);
|
|
22
|
+
// Only draft orders are carts; keep everything if the endpoint omits state.
|
|
23
|
+
const drafts = orders.filter((o) => !o?.state || o.state === 'draft');
|
|
24
|
+
const candidates = drafts.length ? drafts : orders;
|
|
25
|
+
// Prefer a cart that still has items over a leftover emptied one.
|
|
26
|
+
const withItems = candidates.filter((o) => (o?.order_items?.length || 0) > 0);
|
|
27
|
+
return [...(withItems.length ? withItems : candidates)].sort(newestFirst)[0];
|
|
28
|
+
};
|
|
9
29
|
export const getUserCart = async (ctx, { include = [
|
|
10
30
|
'order_items',
|
|
11
31
|
'order_items.purchased_entity',
|
|
@@ -36,9 +56,17 @@ export const getUserCart = async (ctx, { include = [
|
|
|
36
56
|
};
|
|
37
57
|
}
|
|
38
58
|
const resolvedOrders = mapIncludedResources(data, 6);
|
|
39
|
-
const orderData =
|
|
40
|
-
|
|
41
|
-
|
|
59
|
+
const orderData = pickActiveOrder(resolvedOrders);
|
|
60
|
+
if (!orderData) {
|
|
61
|
+
return {
|
|
62
|
+
data: {
|
|
63
|
+
id: '',
|
|
64
|
+
drupalOrderId: 0,
|
|
65
|
+
cartItems: [],
|
|
66
|
+
total: { number: '0', currency_code: 'CZK', formatted: '0 Kč' },
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
42
70
|
const cartItems = (orderData.order_items || [])
|
|
43
71
|
.map((item) => {
|
|
44
72
|
const defaultProduct = item.purchased_entity?.product_id;
|
|
@@ -100,9 +128,17 @@ export const getCurrentCart = async (ctx, activeToken, { include = [
|
|
|
100
128
|
};
|
|
101
129
|
}
|
|
102
130
|
const resolvedOrders = mapIncludedResources(data, 6);
|
|
103
|
-
const orderData =
|
|
104
|
-
|
|
105
|
-
|
|
131
|
+
const orderData = pickActiveOrder(resolvedOrders);
|
|
132
|
+
if (!orderData) {
|
|
133
|
+
return {
|
|
134
|
+
data: {
|
|
135
|
+
id: '',
|
|
136
|
+
drupalOrderId: 0,
|
|
137
|
+
cartItems: [],
|
|
138
|
+
total: { number: '0', currency_code: 'CZK', formatted: '0 Kč' },
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
106
142
|
const cartItems = (orderData.order_items || [])
|
|
107
143
|
.map((item) => {
|
|
108
144
|
const defaultProduct = item.purchased_entity?.product_id;
|
|
@@ -19,9 +19,10 @@ type GetProductsParams = {
|
|
|
19
19
|
sort?: string;
|
|
20
20
|
tag?: string;
|
|
21
21
|
include?: string[];
|
|
22
|
+
fields?: Record<string, string[]>;
|
|
22
23
|
cache?: boolean;
|
|
23
24
|
};
|
|
24
|
-
export declare const getProducts: (ctx: CoreContext, { locale, categoryId, productId, searchTerm, limit, offset, filters, sort, sortArray, tag, include, cache, }: GetProductsParams) => Promise<Product[]>;
|
|
25
|
+
export declare const getProducts: (ctx: CoreContext, { locale, categoryId, productId, searchTerm, limit, offset, filters, sort, sortArray, tag, include, fields, cache, }: GetProductsParams) => Promise<Product[]>;
|
|
25
26
|
type GetProductCountParams = {
|
|
26
27
|
categoryId?: string[];
|
|
27
28
|
tag?: string;
|
|
@@ -30,8 +31,9 @@ type GetProductCountParams = {
|
|
|
30
31
|
value: string | string[] | null;
|
|
31
32
|
operator?: string;
|
|
32
33
|
}>;
|
|
34
|
+
fields?: Record<string, string[]>;
|
|
33
35
|
cache?: boolean;
|
|
34
36
|
};
|
|
35
|
-
export declare const getProductCount: (ctx: CoreContext, { categoryId, tag, cache, filters, }: GetProductCountParams) => Promise<number>;
|
|
37
|
+
export declare const getProductCount: (ctx: CoreContext, { categoryId, tag, cache, filters, fields, }: GetProductCountParams) => Promise<number>;
|
|
36
38
|
export {};
|
|
37
39
|
//# sourceMappingURL=getProducts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProducts.d.ts","sourceRoot":"","sources":["../../../api/products/getProducts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAKtD,KAAK,iBAAiB,GAAG;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAA;QAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;IACF,SAAS,CAAC,EAAE,KAAK,CAAC;QACd,KAAK,EAAE,MAAM,CAAA;QACb,SAAS,EAAE,KAAK,GAAG,MAAM,CAAA;KAC5B,CAAC,CAAA;IACF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAA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AAM,CAAA;IACZ,OAAO,CAAC,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAA;QAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;IACF,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IACjC,KAAK,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,eAAe,GACxB,KAAK,WAAW,EAChB,8CAMG,qBAAqB,KACzB,OAAO,CAAC,MAAM,CAuDhB,CAAA"}
|
|
@@ -8,7 +8,7 @@ export const getProducts = async (ctx, { locale, categoryId, productId, searchTe
|
|
|
8
8
|
'product_id.field_image',
|
|
9
9
|
'product_id.field_image.field_media_image',
|
|
10
10
|
'field_image.field_media_image',
|
|
11
|
-
], cache = true, }) => {
|
|
11
|
+
], fields, cache = true, }) => {
|
|
12
12
|
const currentLocale = locale || ctx.locale;
|
|
13
13
|
const cacheKey = [
|
|
14
14
|
'products',
|
|
@@ -22,6 +22,7 @@ export const getProducts = async (ctx, { locale, categoryId, productId, searchTe
|
|
|
22
22
|
filters.length ? `filters:${JSON.stringify(filters)}` : '',
|
|
23
23
|
sort ? `sort:${sort}` : '',
|
|
24
24
|
tag ? `tag:${tag}` : '',
|
|
25
|
+
fields ? `fields:${JSON.stringify(fields)}` : '',
|
|
25
26
|
]
|
|
26
27
|
.filter(Boolean)
|
|
27
28
|
.join(':');
|
|
@@ -46,6 +47,11 @@ export const getProducts = async (ctx, { locale, categoryId, productId, searchTe
|
|
|
46
47
|
params.addFilter(filter.path, filter.value, filter.operator);
|
|
47
48
|
});
|
|
48
49
|
}
|
|
50
|
+
if (fields) {
|
|
51
|
+
Object.entries(fields).forEach(([type, typeFields]) => {
|
|
52
|
+
params.addFields(type, typeFields);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
49
55
|
if (sort) {
|
|
50
56
|
const sortData = handleSortChange(sort);
|
|
51
57
|
if (sortData) {
|
|
@@ -82,13 +88,14 @@ export const getProducts = async (ctx, { locale, categoryId, productId, searchTe
|
|
|
82
88
|
}
|
|
83
89
|
return mappedProducts;
|
|
84
90
|
};
|
|
85
|
-
export const getProductCount = async (ctx, { categoryId = [], tag = '', cache = true, filters = [], }) => {
|
|
91
|
+
export const getProductCount = async (ctx, { categoryId = [], tag = '', cache = true, filters = [], fields, }) => {
|
|
86
92
|
const cacheKey = [
|
|
87
93
|
'productCount',
|
|
88
94
|
ctx.userId ? `user:${ctx.userId}` : 'anon',
|
|
89
95
|
ctx.locale,
|
|
90
96
|
categoryId?.length ? `cat:${categoryId.join(',')}` : '',
|
|
91
97
|
tag ? `tag:${tag}` : '',
|
|
98
|
+
fields ? `fields:${JSON.stringify(fields)}` : '',
|
|
92
99
|
]
|
|
93
100
|
.filter(Boolean)
|
|
94
101
|
.join(':');
|
|
@@ -108,6 +115,11 @@ export const getProductCount = async (ctx, { categoryId = [], tag = '', cache =
|
|
|
108
115
|
params.addFilter(filter.path, filter.value, filter.operator);
|
|
109
116
|
});
|
|
110
117
|
}
|
|
118
|
+
if (fields) {
|
|
119
|
+
Object.entries(fields).forEach(([type, typeFields]) => {
|
|
120
|
+
params.addFields(type, typeFields);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
111
123
|
params.addFilter('langcode', ctx.locale).addPageLimit(1);
|
|
112
124
|
const queryString = params.getQueryString();
|
|
113
125
|
const url = ctx.locale === ctx.defaultLocale
|
|
@@ -21,7 +21,7 @@ type BasketContextType = {
|
|
|
21
21
|
updateQuantity: (productId: string, quantity: number) => Promise<void>;
|
|
22
22
|
clearBasket: () => Promise<void>;
|
|
23
23
|
isBasketOpen: boolean;
|
|
24
|
-
openBasket: () => void;
|
|
24
|
+
openBasket: (options?: OpenBasketOptions) => void;
|
|
25
25
|
closeBasket: () => void;
|
|
26
26
|
isLoading: boolean;
|
|
27
27
|
getProductQuantityInBasket: (productId: string) => number;
|
|
@@ -33,6 +33,10 @@ type BasketContextType = {
|
|
|
33
33
|
refetchCart: () => Promise<any>;
|
|
34
34
|
onCartTokenCreated?: () => void;
|
|
35
35
|
};
|
|
36
|
+
type OpenBasketOptions = {
|
|
37
|
+
/** When false, the basket is only opened without refetching. Defaults to true. */
|
|
38
|
+
refetch?: boolean;
|
|
39
|
+
};
|
|
36
40
|
type CheckoutCallbacks = {
|
|
37
41
|
onSuccess?: () => void;
|
|
38
42
|
onError?: (error: AxiosError<any>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasketContext.d.ts","sourceRoot":"","sources":["../../../context/cart/BasketContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAahE,OAAO,EACH,eAAe,EACf,mBAAmB,EACtB,MAAM,0CAA0C,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAEH,SAAS,EAKZ,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAM3C,KAAK,WAAW,GAAG;IACf,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,KAAK,iBAAiB,GAAG;IACrB,cAAc,EAAE,aAAa,EAAE,CAAA;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,WAAW,GAAG,IAAI,CAAA;IACzB,eAAe,EAAE,WAAW,GAAG,IAAI,CAAA;IACnC,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACnE,mBAAmB,EAAE,CACjB,QAAQ,EA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K,IAAI,CAAA;CAC7C,CAAA;AAID,KAAK,mBAAmB,GAAG;IACvB,QAAQ,EAAE,SAAS,CAAA;IACnB,GAAG,EAAE,WAAW,CAAA;IAChB,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAA;CAClC,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,wCAI5B,mBAAmB,4CA8drB,CAAA;AAED,eAAO,MAAM,SAAS,QAAO,iBAM5B,CAAA"}
|
|
@@ -325,8 +325,14 @@ export const BasketProvider = ({ children, ctx, onCartTokenCreated, }) => {
|
|
|
325
325
|
await refetchCart();
|
|
326
326
|
}
|
|
327
327
|
};
|
|
328
|
-
const openBasket = () => {
|
|
329
|
-
|
|
328
|
+
const openBasket = (options) => {
|
|
329
|
+
// Refetching is on by default (backwards compatible). Callers can
|
|
330
|
+
// turn it off when they know the cart is already being refreshed
|
|
331
|
+
// (e.g. after a mutation that invalidates ['cart']) - otherwise this
|
|
332
|
+
// refetch would abort the in-flight request and issue it again.
|
|
333
|
+
if (options?.refetch !== false) {
|
|
334
|
+
refetchCart();
|
|
335
|
+
}
|
|
330
336
|
setIsBasketOpen(true);
|
|
331
337
|
};
|
|
332
338
|
const closeBasket = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeleteCartItem.d.ts","sourceRoot":"","sources":["../../../../hooks/cart/api/useDeleteCartItem.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"useDeleteCartItem.d.ts","sourceRoot":"","sources":["../../../../hooks/cart/api/useDeleteCartItem.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,eAAO,MAAM,iBAAiB,GAAI,KAAK,WAAW;aAM/B,qBAAqB;aAAW,MAAM;WAgCxD,CAAA"}
|
|
@@ -6,16 +6,20 @@ export const useDeleteCartItem = (ctx) => {
|
|
|
6
6
|
return useMutation({
|
|
7
7
|
mutationFn: ({ request, orderId }) => deleteCartItem(ctx, orderId, request),
|
|
8
8
|
onSuccess: (_, variables) => {
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
const itemIdToRemove = variables.request.data[0].id;
|
|
10
|
+
// setQueriesData with a prefix filter: the real keys are
|
|
11
|
+
// ['cart', cartToken] and ['userCart', userId], so writing to the
|
|
12
|
+
// exact key ['cart'] never updated anything.
|
|
13
|
+
queryClient.setQueriesData({ queryKey: ctx.userId ? ['userCart'] : ['cart'] }, (oldData) => {
|
|
11
14
|
if (!oldData?.data?.cartItems)
|
|
12
15
|
return oldData;
|
|
13
|
-
const itemIdToRemove = variables.request.data[0].id;
|
|
14
16
|
return {
|
|
15
17
|
...oldData,
|
|
16
18
|
data: {
|
|
17
19
|
...oldData.data,
|
|
18
|
-
|
|
20
|
+
// The request sends order_item_id; CartItem has
|
|
21
|
+
// no `id` field at all.
|
|
22
|
+
cartItems: oldData.data.cartItems.filter((item) => item.order_item_id !== itemIdToRemove),
|
|
19
23
|
},
|
|
20
24
|
};
|
|
21
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetCartToken.d.ts","sourceRoot":"","sources":["../../../../hooks/cart/api/useGetCartToken.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,eAAO,MAAM,eAAe,GAAI,KAAK,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useGetCartToken.d.ts","sourceRoot":"","sources":["../../../../hooks/cart/api/useGetCartToken.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,eAAO,MAAM,eAAe,GAAI,KAAK,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+C/C,CAAA"}
|
|
@@ -24,12 +24,19 @@ export const useGetCartToken = (ctx) => {
|
|
|
24
24
|
}
|
|
25
25
|
return token;
|
|
26
26
|
}, []);
|
|
27
|
+
// NOTE: this key must differ from ['cart', token] used by
|
|
28
|
+
// useGetCurrentCart. Both queries previously shared the same key even
|
|
29
|
+
// though they return completely different shapes (string vs. Cart) - on a
|
|
30
|
+
// new device, where both are enabled at once, they overwrote each other's
|
|
31
|
+
// cache entry and the cart contents never loaded.
|
|
27
32
|
const cartQuery = useQuery({
|
|
28
|
-
queryKey: ['
|
|
33
|
+
queryKey: ['cartToken', cartToken],
|
|
29
34
|
queryFn: ({ signal }) => {
|
|
30
35
|
if (!cartToken)
|
|
31
36
|
throw new Error('Cart token is not available');
|
|
32
|
-
|
|
37
|
+
// ctx.cartToken may be unset (BasketProvider does not receive it);
|
|
38
|
+
// this hook holds the token in state, so inject it into ctx.
|
|
39
|
+
return getCartToken({ ...ctx, cartToken }, { signal });
|
|
33
40
|
},
|
|
34
41
|
enabled: !!cartToken && shouldFetchToken,
|
|
35
42
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetCurrentCart.d.ts","sourceRoot":"","sources":["../../../../hooks/cart/api/useGetCurrentCart.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,KAAK,eAAe,GAAG;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,GAAG,EAAE,WAAW,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,sBAAsB,eAAe,
|
|
1
|
+
{"version":3,"file":"useGetCurrentCart.d.ts","sourceRoot":"","sources":["../../../../hooks/cart/api/useGetCurrentCart.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,KAAK,eAAe,GAAG;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,GAAG,EAAE,WAAW,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,sBAAsB,eAAe,gEAetE,CAAA"}
|
|
@@ -9,5 +9,11 @@ export const useGetCurrentCart = ({ activeToken, ctx }) => {
|
|
|
9
9
|
return getCurrentCart(ctx, activeToken, {}, { signal });
|
|
10
10
|
},
|
|
11
11
|
enabled: !!activeToken && !ctx.userId,
|
|
12
|
+
// The cart must always be up to date - it must not inherit the
|
|
13
|
+
// global staleTime/refetchOnWindowFocus set by the application.
|
|
14
|
+
staleTime: 0,
|
|
15
|
+
refetchOnMount: 'always',
|
|
16
|
+
refetchOnWindowFocus: true,
|
|
17
|
+
refetchOnReconnect: true,
|
|
12
18
|
});
|
|
13
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetUserCart.d.ts","sourceRoot":"","sources":["../../../../hooks/cart/api/useGetUserCart.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAA;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,eAAO,MAAM,cAAc,GAAI,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"useGetUserCart.d.ts","sourceRoot":"","sources":["../../../../hooks/cart/api/useGetUserCart.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAA;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,eAAO,MAAM,cAAc,GAAI,KAAK,WAAW,gEAkB9C,CAAA"}
|
|
@@ -10,5 +10,11 @@ export const useGetUserCart = (ctx) => {
|
|
|
10
10
|
return getUserCart(ctx, {}, { signal });
|
|
11
11
|
},
|
|
12
12
|
enabled: !!ctx.userId,
|
|
13
|
+
// The cart must always be up to date - it must not inherit the
|
|
14
|
+
// global staleTime/refetchOnWindowFocus set by the application.
|
|
15
|
+
staleTime: 0,
|
|
16
|
+
refetchOnMount: 'always',
|
|
17
|
+
refetchOnWindowFocus: true,
|
|
18
|
+
refetchOnReconnect: true,
|
|
13
19
|
});
|
|
14
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetProducts.d.ts","sourceRoot":"","sources":["../../../hooks/products/useGetProducts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,KAAK,qBAAqB,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAA;QAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;IACF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,KAAK,CAAC;QACd,KAAK,EAAE,MAAM,CAAA;QACb,SAAS,EAAE,KAAK,GAAG,MAAM,CAAA;KAC5B,CAAC,CAAA;IACF,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,O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,7 +1,7 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import { getProducts } from '../../api/products/getProducts';
|
|
3
3
|
export const useGetProducts = (ctx, locale, options) => {
|
|
4
|
-
const { categoryId, productId, searchTerm, limit, offset, filters, sort, sortArray, tag, include, cache, enabled = true, } = options || {};
|
|
4
|
+
const { categoryId, productId, searchTerm, limit, offset, filters, sort, sortArray, tag, include, fields, cache, enabled = true, } = options || {};
|
|
5
5
|
return useQuery({
|
|
6
6
|
queryKey: [
|
|
7
7
|
'products',
|
|
@@ -17,6 +17,7 @@ export const useGetProducts = (ctx, locale, options) => {
|
|
|
17
17
|
sortArray,
|
|
18
18
|
tag,
|
|
19
19
|
include,
|
|
20
|
+
fields,
|
|
20
21
|
],
|
|
21
22
|
queryFn: () => getProducts(ctx, {
|
|
22
23
|
locale,
|
|
@@ -30,6 +31,7 @@ export const useGetProducts = (ctx, locale, options) => {
|
|
|
30
31
|
sortArray,
|
|
31
32
|
tag,
|
|
32
33
|
include,
|
|
34
|
+
fields,
|
|
33
35
|
cache,
|
|
34
36
|
}),
|
|
35
37
|
enabled,
|
|
@@ -7,7 +7,9 @@ type UseGetProductsCountOptions = {
|
|
|
7
7
|
value: string | string[] | null;
|
|
8
8
|
operator?: string;
|
|
9
9
|
}>;
|
|
10
|
+
fields?: Record<string, string[]>;
|
|
10
11
|
cache?: boolean;
|
|
12
|
+
enabled?: boolean;
|
|
11
13
|
};
|
|
12
14
|
export declare const useGetProductsCount: (ctx: CoreContext, options?: UseGetProductsCountOptions) => import("@tanstack/react-query").UseQueryResult<number, Error>;
|
|
13
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetProductsCount.d.ts","sourceRoot":"","sources":["../../../hooks/products/useGetProductsCount.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,KAAK,0BAA0B,GAAG;IAC9B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAA;QAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;IACF,KAAK,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"useGetProductsCount.d.ts","sourceRoot":"","sources":["../../../hooks/products/useGetProductsCount.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,KAAK,0BAA0B,GAAG;IAC9B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAA;QAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;IACF,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IACjC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC5B,KAAK,WAAW,EAChB,UAAU,0BAA0B,kEA8BvC,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import { getProductCount } from '../../api/products/getProducts';
|
|
3
3
|
export const useGetProductsCount = (ctx, options) => {
|
|
4
|
-
const { categoryId, tag, filters, cache, } = options || {};
|
|
4
|
+
const { categoryId, tag, filters, fields, cache, enabled = true, } = options || {};
|
|
5
5
|
return useQuery({
|
|
6
6
|
queryKey: [
|
|
7
7
|
'products',
|
|
@@ -9,12 +9,15 @@ export const useGetProductsCount = (ctx, options) => {
|
|
|
9
9
|
categoryId,
|
|
10
10
|
tag,
|
|
11
11
|
filters,
|
|
12
|
+
fields,
|
|
12
13
|
],
|
|
13
14
|
queryFn: () => getProductCount(ctx, {
|
|
14
15
|
categoryId,
|
|
15
16
|
tag,
|
|
16
17
|
filters,
|
|
18
|
+
fields,
|
|
17
19
|
cache,
|
|
18
20
|
}),
|
|
21
|
+
enabled,
|
|
19
22
|
});
|
|
20
23
|
};
|
|
@@ -4,7 +4,7 @@ import { QueryClient } from '@tanstack/react-query';
|
|
|
4
4
|
* (prices, cart, wishlist, orders, profile). On logout these must be dropped
|
|
5
5
|
* so the data is not shown to the next (anonymous / different) user.
|
|
6
6
|
*/
|
|
7
|
-
export declare const USER_SCOPED_QUERY_KEYS: readonly ["products", "user", "userCart", "cart", "wishlist", "orderHistory", "order"];
|
|
7
|
+
export declare const USER_SCOPED_QUERY_KEYS: readonly ["products", "user", "userCart", "cart", "cartToken", "wishlist", "orderHistory", "order"];
|
|
8
8
|
/**
|
|
9
9
|
* Removes all user-scoped queries defined in core from the cache.
|
|
10
10
|
* Call on logout (after clearing the token) or when switching users.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearUserScopedQueries.d.ts","sourceRoot":"","sources":["../../utils/clearUserScopedQueries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"clearUserScopedQueries.d.ts","sourceRoot":"","sources":["../../utils/clearUserScopedQueries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,qGASzB,CAAA;AAEV;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,GAAI,aAAa,WAAW,KAAG,IAIjE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resetPasswordSevice.types.d.ts","sourceRoot":"","sources":["../../../../api/user/resetPassword/resetPasswordSevice.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,EAAE,MAAM,CAAC;CAChB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|