@q2devel/q2-core 1.0.107 → 1.0.109

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/README.md CHANGED
@@ -1,103 +1,103 @@
1
- # Q2 Core
2
-
3
- ## Getting started
4
-
5
- To make it easy for you to get started with GitLab, here's a list of recommended next steps.
6
-
7
- Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
8
-
9
- ## Add your files
10
-
11
- - [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
12
- - [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
13
-
14
- ```
15
- cd existing_repo
16
- git remote add origin https://gitlab.pegasus.q2.cz/q2-extensions/q2-core.git
17
- git branch -M main
18
- git push -uf origin main
19
- ```
20
-
21
- ## Integrate with your tools
22
-
23
- - [ ] [Set up project integrations](http://gitlab.q2cz.local/q2-extensions/q2-core/-/settings/integrations)
24
-
25
- ## Collaborate with your team
26
-
27
- - [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
28
- - [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
29
- - [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
30
- - [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
31
- - [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
32
-
33
- ## Test and Deploy
34
-
35
- Use the built-in continuous integration in GitLab.
36
-
37
- - [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
38
- - [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
39
- - [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
40
- - [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
41
- - [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
42
-
43
- ---
44
-
45
- # Editing this README
46
-
47
- When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
48
-
49
- ## Suggestions for a good README
50
-
51
- Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
52
-
53
- ## Name
54
-
55
- Choose a self-explaining name for your project.
56
-
57
- ## Description
58
-
59
- Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
60
-
61
- ## Badges
62
-
63
- On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
64
-
65
- ## Visuals
66
-
67
- Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
68
-
69
- ## Installation
70
-
71
- Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
72
-
73
- ## Usage
74
-
75
- Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
76
-
77
- ## Support
78
-
79
- Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
80
-
81
- ## Roadmap
82
-
83
- If you have ideas for releases in the future, it is a good idea to list them in the README.
84
-
85
- ## Contributing
86
-
87
- State if you are open to contributions and what your requirements are for accepting them.
88
-
89
- For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
90
-
91
- You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
92
-
93
- ## Authors and acknowledgment
94
-
95
- Show your appreciation to those who have contributed to the project.
96
-
97
- ## License
98
-
99
- For open source projects, say how it is licensed.
100
-
101
- ## Project status
102
-
103
- If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
1
+ # Q2 Core
2
+
3
+ ## Getting started
4
+
5
+ To make it easy for you to get started with GitLab, here's a list of recommended next steps.
6
+
7
+ Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
8
+
9
+ ## Add your files
10
+
11
+ - [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
12
+ - [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
13
+
14
+ ```
15
+ cd existing_repo
16
+ git remote add origin https://gitlab.pegasus.q2.cz/q2-extensions/q2-core.git
17
+ git branch -M main
18
+ git push -uf origin main
19
+ ```
20
+
21
+ ## Integrate with your tools
22
+
23
+ - [ ] [Set up project integrations](http://gitlab.q2cz.local/q2-extensions/q2-core/-/settings/integrations)
24
+
25
+ ## Collaborate with your team
26
+
27
+ - [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
28
+ - [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
29
+ - [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
30
+ - [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
31
+ - [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
32
+
33
+ ## Test and Deploy
34
+
35
+ Use the built-in continuous integration in GitLab.
36
+
37
+ - [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
38
+ - [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
39
+ - [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
40
+ - [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
41
+ - [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
42
+
43
+ ---
44
+
45
+ # Editing this README
46
+
47
+ When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
48
+
49
+ ## Suggestions for a good README
50
+
51
+ Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
52
+
53
+ ## Name
54
+
55
+ Choose a self-explaining name for your project.
56
+
57
+ ## Description
58
+
59
+ Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
60
+
61
+ ## Badges
62
+
63
+ On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
64
+
65
+ ## Visuals
66
+
67
+ Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
68
+
69
+ ## Installation
70
+
71
+ Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
72
+
73
+ ## Usage
74
+
75
+ Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
76
+
77
+ ## Support
78
+
79
+ Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
80
+
81
+ ## Roadmap
82
+
83
+ If you have ideas for releases in the future, it is a good idea to list them in the README.
84
+
85
+ ## Contributing
86
+
87
+ State if you are open to contributions and what your requirements are for accepting them.
88
+
89
+ For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
90
+
91
+ You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
92
+
93
+ ## Authors and acknowledgment
94
+
95
+ Show your appreciation to those who have contributed to the project.
96
+
97
+ ## License
98
+
99
+ For open source projects, say how it is licensed.
100
+
101
+ ## Project status
102
+
103
+ If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
@@ -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,MA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(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,EAA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AAK,EAAE,UAAU,CAAC,GAAG,CAAC,KAAK,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
- refetchCart();
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,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,eAAO,MAAM,iBAAiB,GAAI,KAAK,WAAW;aAM/B,qBAAqB;aAAW,MAAM;WAyBxD,CAAA"}
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 queryKey = ctx.userId ? ['userCart', ctx.userId] : ['cart'];
10
- queryClient.setQueryData(queryKey, (oldData) => {
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
- cartItems: oldData.data.cartItems.filter((item) => item.id !== itemIdToRemove),
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwC/C,CAAA"}
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: ['cart', cartToken],
33
+ queryKey: ['cartToken', cartToken],
29
34
  queryFn: ({ signal }) => {
30
35
  if (!cartToken)
31
36
  throw new Error('Cart token is not available');
32
- return getCartToken(ctx, { signal }); // signal vložen do configu
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,gEAStE,CAAA"}
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,gEAY9C,CAAA"}
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
  };
@@ -11,8 +11,13 @@ type UseGetProductsOptions = {
11
11
  operator?: string;
12
12
  }>;
13
13
  sort?: string;
14
+ sortArray?: Array<{
15
+ title: string;
16
+ direction: 'ASC' | 'DESC';
17
+ }>;
14
18
  tag?: string;
15
19
  include?: string[];
20
+ fields?: Record<string, string[]>;
16
21
  cache?: boolean;
17
22
  enabled?: boolean;
18
23
  };
@@ -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,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,cAAc,GACvB,KAAK,WAAW,EAChB,QAAQ,MAAM,EACd,UAAU,qBAAqB,qFA+ClC,CAAA"}
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,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,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,cAAc,GACvB,KAAK,WAAW,EAChB,QAAQ,MAAM,EACd,UAAU,qBAAqB,qFAqDlC,CAAA"}
@@ -1,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, 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',
@@ -14,8 +14,10 @@ export const useGetProducts = (ctx, locale, options) => {
14
14
  offset,
15
15
  filters,
16
16
  sort,
17
+ sortArray,
17
18
  tag,
18
19
  include,
20
+ fields,
19
21
  ],
20
22
  queryFn: () => getProducts(ctx, {
21
23
  locale,
@@ -26,8 +28,10 @@ export const useGetProducts = (ctx, locale, options) => {
26
28
  offset,
27
29
  filters,
28
30
  sort,
31
+ sortArray,
29
32
  tag,
30
33
  include,
34
+ fields,
31
35
  cache,
32
36
  }),
33
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;CAClB,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC5B,KAAK,WAAW,EAChB,UAAU,0BAA0B,kEAyBvC,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,wFAQzB,CAAA;AAEV;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,GAAI,aAAa,WAAW,KAAG,IAIjE,CAAA"}
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"}
@@ -8,6 +8,7 @@ export const USER_SCOPED_QUERY_KEYS = [
8
8
  'user',
9
9
  'userCart',
10
10
  'cart',
11
+ 'cartToken',
11
12
  'wishlist',
12
13
  'orderHistory',
13
14
  'order',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@q2devel/q2-core",
3
- "version": "1.0.107",
3
+ "version": "1.0.109",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {