Skip to content

Commit

Permalink
fix: Product and ProductManufacturer types (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdanilowicz authored May 16, 2023
1 parent 81f4533 commit 53f81c3
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 86 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-lizards-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware-pwa/types": patch
---

Fix Product and ProductManufacturer types
201 changes: 120 additions & 81 deletions packages/types/shopware-6-client/models/content/product/Product.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,106 +52,145 @@ export type CrossSelling = {
* @public
*/
export type Product = {
active: boolean;
additionalText?: string | null;
apiAlias: "product";
autoIncrement: number;
available: boolean;
availableStock: number | null;
calculatedCheapestPrice: CalculatedPrice;
calculatedMaxPurchase: number;
calculatedListingPrice: ListingPrice;
calculatedPrices: CalculatedPrice[];
calculatedMaxPurchase: number;
calculatedPrice: CalculatedPrice;
configuratorSettings: PropertyGroup[] | null;
sortedProperties: PropertyGroup[] | null;
cheapestPrice: {
apiAlias: "shopware_core_content_product_data_abstraction_layer_cheapest_price_cheapest_price";
hasRange: boolean;
parentId: null | string;
price: Price[];
purchase: number;
reference: number;
ruleId: null | string;
unitId: null | string;
variantId: null | string;
};
isNew: boolean;
parentId: string | null;
calculatedPrices: CalculatedPrice[];
canonicalProduct: any;
canonicalProductId: string | null;
categories: Category[];
categoriesRo: Category[] | null;
categoryIds: string[];
categoryTree: [] | null;
cheapestPrice: ProductCheapestPrice;
childCount: number;
autoIncrement: number;
taxId: string | null;
manufacturerId: string | null;
unitId: string | null;
active: boolean;
children: Product[];
cmsPage: null | CmsPage;
cmsPageId: string | null;
configuratorSettings: PropertyGroup[] | null;
cover: ProductMedia;
coverId: string | null;
createdAt: Date;
crossSellings: CrossSelling[];
customFields: CustomFields;
deliveryTime: DeliveryTime;
deliveryTimeId: string | null;
description: string | null;
displayGroup: string;
price: Price[] | null;
manufacturerNumber: string | null;
downloads: any;
ean: string | null;
productNumber: string;
stock: number;
availableStock: number | null;
available: boolean;
deliveryTimeId: string | null;
deliveryTime: DeliveryTime;
restockTime: number;
extensions: [];
height: number | null;
id: string;
isCloseout: boolean | null;
purchaseSteps: number | null;
isNew: boolean;
keywords: string | null;
length: number | null;
listingPrices: ListingPrice[] | null;
mainCategories: ProductMainCategories;
manufacturer: ProductManufacturer | null;
manufacturerId: string | null;
manufacturerNumber: string | null;
markAsTopseller: boolean | null;
maxPurchase: number | null;
media: ProductMedia[];
metaDescription: string | null;
metaTitle: string | null;
minPurchase: number | null;
name: string | null;
optionIds?: string[];
options: PropertyGroupOption[];
packUnit: string | null;
packUnitPlural: string | null;
parent: Product;
parentId: string | null;
parentVersionId: string;
price: Price[] | null;
prices: ProductPrice[];
productManufacturerVersionId: string;
productNumber: string;
productReviews: ProductReview[] | null;
properties: PropertyGroupOption[] | null;
propertyIds: [] | null;
purchasePrice: number | null;
purchaseSteps: number | null;
purchaseUnit: number | null;
ratingAverage: number | null;
referenceUnit: number | null;
releaseDate: Date;
restockTime: number;
sales: number;
seoCategory: Category;
seoUrls: SeoUrl[] | null;
shippingFree: boolean | null;
purchasePrice: number | null;
markAsTopseller: boolean | null;
sortedProperties: PropertyGroup[] | null;
states: string[];
stock: number;
streamIds: string[] | null;
streams: ProductStreams;
tagIds: [] | null;
tags: Tag[];
tax: Tax;
taxId: string | null;
translated: ProductTranslated;
translations: ProductTranslation[];
unit: Unit | null;
unitId: string | null;
updatedAt: Date;
versionId: string;
weight: number | null;
width: number | null;
height: number | null;
length: number | null;
releaseDate: Date;
categoryTree: [] | null;
optionIds?: string[];
propertyIds: [] | null;
additionalText?: string | null;
};

export type CartProductItem = Product & {
options: PropertyGroupOptionCart[];
};

export type ProductCheapestPrice = {
apiAlias: "shopware_core_content_product_data_abstraction_layer_cheapest_price_cheapest_price";
hasRange: boolean;
parentId: null | string;
price: Price[];
purchase: number;
reference: number;
ruleId: null | string;
unitId: null | string;
variantId: null | string;
};

export type ProductTranslated = {
name: string | null;
description: string;
metaDescription: string | null;
keywords: string | null;
description: string | null;
metaTitle: string | null;
packUnit: string | null;
tax: Tax;
manufacturer: ProductManufacturer | null;
unit: Unit | null;
prices: ProductPrice[];
listingPrices: ListingPrice[] | null;
cover: ProductMedia;
parent: Product;
children: Product[];
media: ProductMedia[];
translations: ProductTranslation[];
categories: Category[];
tags: Tag[];
properties: PropertyGroupOption[] | null;
options: PropertyGroupOption[];
categoriesRo: Category[] | null;
coverId: string | null;
customFields: CustomFields;
tagIds: [] | null;
productReviews: ProductReview[] | null;
ratingAverage: number | null;
extensions: [];
};

export type ProductMainCategories = {
id: string;
parentVersionId: string;
productManufacturerVersionId: string;
seoUrls: SeoUrl[] | null;
translated: {
name: string | null;
description: string;
metaDescription: string | null;
keywords: string | null;
metaTitle: string | null;
customFields: CustomFields;
};
metaDescription: string | null;
crossSellings: CrossSelling[];
cmsPage: null | CmsPage;
seoCategory: Category;
apiAlias: "product";
productId: string;
productVersionId: string | null;
categoryId: string;
categoryVersionId: string | null;
salesChannelId: string;
createdAt: Date;
updatedAt: Date;
};

export type CartProductItem = Product & {
options: PropertyGroupOptionCart[];
export type ProductStreams = {
id: string;
name: string;
description: string | null;
customFields: CustomFields;
createdAt: Date;
updatedAt: Date;
translated: unknown;
};
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import { Product } from "./Product";
import { ProductManufacturerTranslation } from "./ProductManufacturerTranslation";
import { CustomFields } from "../../common/CustomField";

import { Media } from "../../content/media/Media";
/**
* @public
*/
export type ProductManufacturer = {
createdAt: Date;
customFields: CustomFields;
description: string | null;
id: string;
link: string | null;
media: Media;
mediaId: string | null;
name: string | null;
link: string | null;
description: string | null;
translations: ProductManufacturerTranslation | null;
products: Product[];
customFields: CustomFields;
translations: ProductManufacturerTranslation | null;
translated: ProductManufacturerTranslation | null;
updatedAt: Date;
versionId: string;
};

2 comments on commit 53f81c3

@vercel
Copy link

@vercel vercel bot commented on 53f81c3 May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 53f81c3 May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

frontends-demo – ./templates/vue-demo-store

frontends-demo-shopware-frontends.vercel.app
frontends-demo.vercel.app
frontends-demo-git-main-shopware-frontends.vercel.app

Please sign in to comment.