From e69fdca513fd34046dc41510fd4575ccd38ccf37 Mon Sep 17 00:00:00 2001 From: Dawid Tarasiuk Date: Fri, 9 Jul 2021 12:23:02 +0200 Subject: [PATCH 1/3] Update queries with new channel API --- gqlTypes/globalTypes.ts | 2 +- package-lock.json | 5 ++--- package.json | 2 +- src/@next/graphql/queries.ts | 2 +- src/core/utils.ts | 7 ++----- src/views/Category/queries.ts | 1 - 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/gqlTypes/globalTypes.ts b/gqlTypes/globalTypes.ts index c65e43039b..25dc6dbf94 100644 --- a/gqlTypes/globalTypes.ts +++ b/gqlTypes/globalTypes.ts @@ -285,6 +285,7 @@ export interface AttributeInput { slug: string; values?: (string | null)[] | null; valuesRange?: IntRangeInput | null; + boolean?: boolean | null; } export interface IntRangeInput { @@ -294,7 +295,6 @@ export interface IntRangeInput { export interface ProductOrder { direction: OrderDirection; - channel?: string | null; attributeId?: string | null; field?: ProductOrderField | null; } diff --git a/package-lock.json b/package-lock.json index 185cd5a806..975e353d91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7329,9 +7329,8 @@ } }, "@saleor/sdk": { - "version": "0.3.0-9", - "resolved": "https://registry.npmjs.org/@saleor/sdk/-/sdk-0.3.0-9.tgz", - "integrity": "sha512-H6RxbLoQijbhtLvC5W1vSwxdBXZi7bD0K5fFDsDFT7o2rDIman2xyCDrRM8nqY62mDvcilxrrhABvPG24Si+ig==", + "version": "github:mirumee/saleor-sdk#466cefa79b62d062d435abe8d235bac5a868fef7", + "from": "github:mirumee/saleor-sdk#466cefa", "requires": { "apollo-cache": "^1.3.5", "apollo-cache-inmemory": "^1.6.6", diff --git a/package.json b/package.json index 253edb62fd..db2c653e55 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "browserslist": "last 2 versions", "dependencies": { "@lhci/cli": "^0.7.0", - "@saleor/sdk": "^0.3.0-9", + "@saleor/sdk": "github:mirumee/saleor-sdk#466cefa", "@sentry/apm": "^5.15.5", "@sentry/browser": "^5.15.5", "@stripe/react-stripe-js": "^1.1.2", diff --git a/src/@next/graphql/queries.ts b/src/@next/graphql/queries.ts index 05a70814d2..299f0ab43d 100644 --- a/src/@next/graphql/queries.ts +++ b/src/@next/graphql/queries.ts @@ -52,8 +52,8 @@ export const shopAttributesQuery = gql` $categoryId: ID ) { attributes( + channel: $channel filter: { - channel: $channel inCollection: $collectionId inCategory: $categoryId filterableInStorefront: true diff --git a/src/core/utils.ts b/src/core/utils.ts index d99bd35b89..ec38e7f693 100644 --- a/src/core/utils.ts +++ b/src/core/utils.ts @@ -1,8 +1,6 @@ import { ProductOrder } from "@saleor/sdk"; import { FetchResult } from "apollo-link"; -import { channelSlug } from "@temp/constants"; - import { AttributeInput, OrderDirection, @@ -64,8 +62,7 @@ export const getValueOrEmpty = (value: T): T | string => value === undefined || value === null ? "" : value; export const convertSortByFromString = ( - sortBy: string, - channel = channelSlug + sortBy: string ): ProductOrder | null => { if (!sortBy) { return null; @@ -93,7 +90,7 @@ export const convertSortByFromString = ( default: return null; } - return { field, direction, channel }; + return { field, direction }; }; export const maybe = (exp: () => T, d?: T) => { diff --git a/src/views/Category/queries.ts b/src/views/Category/queries.ts index 7b5278d7af..752d3e8f06 100644 --- a/src/views/Category/queries.ts +++ b/src/views/Category/queries.ts @@ -31,7 +31,6 @@ export const useProductsQuery = ( }, collections: collectionId ? [collectionId] : [], categories: categoryId ? [categoryId] : [], - channel: channelSlug, attributes: filters.attributes ? convertToAttributeScalar(filters.attributes) : [], From 1b51d223a22bf50bfcbdb8dde4ce0623689d186c Mon Sep 17 00:00:00 2001 From: Dawid Tarasiuk Date: Fri, 9 Jul 2021 12:39:29 +0200 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8695b674af..2d8b0e912e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ All notable, unreleased changes to this project will be documented in this file. - Enable incremental server-side regeneration for store pages - #988 by @pitorgrundas - Update account mutations with channel slug - #1039 by @orzechdev - Update register mutation with channel slug - #1045 by @orzechdev +- Update queries with new channel API - #1072 by @orzechdev ## 2.11.0 From 5b8e1ef6828d20fbb4ae35edd07a18efecc9d0e7 Mon Sep 17 00:00:00 2001 From: Dawid Tarasiuk Date: Fri, 9 Jul 2021 17:06:49 +0200 Subject: [PATCH 3/3] Update sdk version --- package-lock.json | 5 +++-- package.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 975e353d91..4184d001e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7329,8 +7329,9 @@ } }, "@saleor/sdk": { - "version": "github:mirumee/saleor-sdk#466cefa79b62d062d435abe8d235bac5a868fef7", - "from": "github:mirumee/saleor-sdk#466cefa", + "version": "0.3.0-10", + "resolved": "https://registry.npmjs.org/@saleor/sdk/-/sdk-0.3.0-10.tgz", + "integrity": "sha512-vw1kfuZmbWsFBStisB+zJZ+sfKsqwq6Z6HKQ5iSHT9ZYM0e6Tk6a+6/ZBzddhBcwRAkz8nZ9vL11dP8UDWbqJQ==", "requires": { "apollo-cache": "^1.3.5", "apollo-cache-inmemory": "^1.6.6", diff --git a/package.json b/package.json index db2c653e55..b0e03cce6c 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "browserslist": "last 2 versions", "dependencies": { "@lhci/cli": "^0.7.0", - "@saleor/sdk": "github:mirumee/saleor-sdk#466cefa", + "@saleor/sdk": "^0.3.0-10", "@sentry/apm": "^5.15.5", "@sentry/browser": "^5.15.5", "@stripe/react-stripe-js": "^1.1.2",