diff --git a/api/shopware-6-client.api.md b/api/shopware-6-client.api.md index 9e6255a47..0e69b570c 100644 --- a/api/shopware-6-client.api.md +++ b/api/shopware-6-client.api.md @@ -14,26 +14,18 @@ import { Currency } from '@shopware-pwa/commons/interfaces/models/system/currenc import { Customer } from '@shopware-pwa/commons/interfaces/models/checkout/customer/Customer'; import { CustomerAddress } from '@shopware-pwa/commons/interfaces/models/checkout/customer/CustomerAddress'; import { CustomerRegistrationParams } from '@shopware-pwa/commons/interfaces/request/CustomerRegistrationParams'; -import { EqualsAnyFilter } from '@shopware-pwa/commons/interfaces/search/SearchFilter'; -import { EqualsFilter } from '@shopware-pwa/commons/interfaces/search/SearchFilter'; -import { Grouping } from '@shopware-pwa/commons/interfaces/search/Grouping'; import { GuestOrderParams } from '@shopware-pwa/commons/interfaces/request/GuestOrderParams'; -import { Includes } from '@shopware-pwa/commons/interfaces/search/SearchCriteria'; import { Language } from '@shopware-pwa/commons/interfaces/models/framework/language/Language'; -import { MultiFilter } from '@shopware-pwa/commons/interfaces/search/SearchFilter'; import { NavigationResponse } from '@shopware-pwa/commons/interfaces/models/content/navigation/Navigation'; -import { NotFilter } from '@shopware-pwa/commons/interfaces/search/SearchFilter'; import { Order } from '@shopware-pwa/commons/interfaces/models/checkout/order/Order'; import { PaymentMethod } from '@shopware-pwa/commons/interfaces/models/checkout/payment/PaymentMethod'; import { Product } from '@shopware-pwa/commons/interfaces/models/content/product/Product'; import { ProductListingResult } from '@shopware-pwa/commons/interfaces/response/ProductListingResult'; -import { RangeFilter } from '@shopware-pwa/commons/interfaces/search/SearchFilter'; import { Salutation } from '@shopware-pwa/commons/interfaces/models/system/salutation/Salutation'; import { SearchCriteria } from '@shopware-pwa/commons/interfaces/search/SearchCriteria'; import { SearchResult } from '@shopware-pwa/commons/interfaces/response/SearchResult'; import { SessionContext } from '@shopware-pwa/commons/interfaces/response/SessionContext'; import { ShippingMethod } from '@shopware-pwa/commons/interfaces/models/checkout/shipping/ShippingMethod'; -import { ShopwareAssociation } from '@shopware-pwa/commons/interfaces/search/Association'; import { StoreNavigationElement } from '@shopware-pwa/commons/interfaces/models/content/navigation/Navigation'; // @alpha @@ -375,32 +367,6 @@ export interface ShopwareApiInstance { update: (config?: ClientSettings) => void; } -// @alpha @deprecated (undocumented) -export interface ShopwareParams { - // (undocumented) - associations?: ShopwareAssociation; - // (undocumented) - filter?: (NotFilter | MultiFilter | EqualsFilter | EqualsAnyFilter | RangeFilter)[]; - // (undocumented) - grouping?: Grouping; - // (undocumented) - includes?: Includes; - // (undocumented) - limit?: number; - // (undocumented) - manufacturer?: string; - // (undocumented) - p?: number; - // (undocumented) - page?: number; - // (undocumented) - properties?: string; - // (undocumented) - sort?: string; - // (undocumented) - term?: string; -} - // @beta export const update: (config?: ClientSettings) => void; diff --git a/packages/shopware-6-client/__tests__/helpers/convertSearchCriteria.spec.ts b/packages/shopware-6-client/__tests__/helpers/convertSearchCriteria.spec.ts index 1b50b9131..c3fa9c9de 100644 --- a/packages/shopware-6-client/__tests__/helpers/convertSearchCriteria.spec.ts +++ b/packages/shopware-6-client/__tests__/helpers/convertSearchCriteria.spec.ts @@ -222,7 +222,7 @@ describe("SearchConverter - convertSearchCriteria", () => { }); expect(paramsObject?.p).toEqual(1); expect(paramsObject?.limit).toEqual(config.defaultPaginationLimit); - expect(paramsObject?.sort).toEqual("name-desc"); + expect(paramsObject?.order).toEqual("name-desc"); }); it("should have sorting param in specific format if apiType is set to 'store' - default ascending", () => { const paramsObject = convertSearchCriteria({ @@ -235,7 +235,7 @@ describe("SearchConverter - convertSearchCriteria", () => { apiType: ApiType.store, config, }); - expect(paramsObject?.sort).toEqual("name-asc"); + expect(paramsObject?.order).toEqual("name-asc"); }); it("should have pagination and sort params", () => { const paramsObject = convertSearchCriteria({ diff --git a/packages/shopware-6-client/__tests__/services/ProductService/getListingProducts.spec.ts b/packages/shopware-6-client/__tests__/services/ProductService/getListingProducts.spec.ts index d13629f05..a04b6bcbf 100644 --- a/packages/shopware-6-client/__tests__/services/ProductService/getListingProducts.spec.ts +++ b/packages/shopware-6-client/__tests__/services/ProductService/getListingProducts.spec.ts @@ -42,7 +42,7 @@ describe("ProductService - getCategoryProductsListing", () => { mockedPost ).toBeCalledWith( "/store-api/v3/product-listing/044a190a54ab4f06803909c3ee8063ef", - { sort: "name-asc", limit: 10 } + { order: "name-asc", limit: 10 } ); expect(result).toHaveProperty("elements"); }); diff --git a/packages/shopware-6-client/src/helpers/searchConverter.ts b/packages/shopware-6-client/src/helpers/searchConverter.ts index a0542f4cf..9001e5985 100644 --- a/packages/shopware-6-client/src/helpers/searchConverter.ts +++ b/packages/shopware-6-client/src/helpers/searchConverter.ts @@ -27,12 +27,12 @@ export enum ApiType { /** * @deprecated - that interface will be replaced with the new one from ShopwareSearchParams to follow the product-listing filters interface. - * @alpha */ export interface ShopwareParams { p?: number; // p for page in store-api page?: number; limit?: number; + order?: string; sort?: string; term?: string; filter?: ( @@ -131,7 +131,7 @@ export const convertSearchCriteria = ({ } else { let order = sort.desc ? "desc" : "asc"; // TODO: https://github.com/DivanteLtd/shopware-pwa/issues/834 - params.sort = sort.name || `${sort.field}-${order}`; + params.order = sort.name || `${sort.field}-${order}`; } } } diff --git a/packages/shopware-6-client/src/index.ts b/packages/shopware-6-client/src/index.ts index 559828ddb..fd20b613f 100644 --- a/packages/shopware-6-client/src/index.ts +++ b/packages/shopware-6-client/src/index.ts @@ -19,8 +19,6 @@ export * from "./services/pluginService"; export * from "./services/searchService"; export * from "./services/formsService"; -export { ShopwareParams } from "./helpers/searchConverter"; - /** * @beta */