Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add product image details

dominik-zeglena70acf555ed0
diff --git a/saleor/static/dashboard-next/gql-types.ts b/saleor/static/dashboard-next/gql-types.ts
index fda87f48f1..1b49b452b3 100644
--- a/saleor/static/dashboard-next/gql-types.ts
+++ b/saleor/static/dashboard-next/gql-types.ts
@@ -3,10 +3,10 @@
export interface AttributeValueInput {
// Slug of an attribute.
- slug: string,
+ slug: string;
// Value of an attribute.
- value: string,
-};
+ value: string;
+}
export interface TokenAuthMutationVariables {
email: string,
@@ -64,1532 +64,1546 @@ export interface VerifyTokenMutation {
};
export interface CategoryDeleteMutationVariables {
- id: string,
-};
+ id: string;
+}
export interface CategoryDeleteMutation {
- categoryDelete: {
+ categoryDelete: {
// List of errors that occurred executing the mutation.
- errors: Array< {
+ errors: Array<{
// Name of a field that caused the error. A value of
// `null` indicates that the error isn't associated with a particular
// field.
- field: string | null,
+ field: string | null;
// The error message.
- message: string | null,
- } | null > | null,
- } | null,
-};
+ message: string | null;
+ } | null> | null;
+ } | null;
+}
export interface CategoryCreateMutationVariables {
- name?: string | null,
- description?: string | null,
- parent?: string | null,
-};
+ name?: string | null;
+ description?: string | null;
+ parent?: string | null;
+}
export interface CategoryCreateMutation {
- categoryCreate: {
+ categoryCreate: {
// List of errors that occurred executing the mutation.
- errors: Array< {
+ errors: Array<{
// Name of a field that caused the error. A value of
// `null` indicates that the error isn't associated with a particular
// field.
- field: string | null,
+ field: string | null;
// The error message.
- message: string | null,
- } | null > | null,
- category: {
+ message: string | null;
+ } | null> | null;
+ category: {
// The ID of the object.
- id: string,
- name: string,
- description: string,
- parent: {
+ id: string;
+ name: string;
+ description: string;
+ parent: {
// The ID of the object.
- id: string,
- } | null,
- } | null,
- } | null,
-};
+ id: string;
+ } | null;
+ } | null;
+ } | null;
+}
export interface CategoryUpdateMutationVariables {
- id: string,
- name?: string | null,
- description?: string | null,
-};
+ id: string;
+ name?: string | null;
+ description?: string | null;
+}
export interface CategoryUpdateMutation {
- categoryUpdate: {
+ categoryUpdate: {
// List of errors that occurred executing the mutation.
- errors: Array< {
+ errors: Array<{
// Name of a field that caused the error. A value of
// `null` indicates that the error isn't associated with a particular
// field.
- field: string | null,
+ field: string | null;
// The error message.
- message: string | null,
- } | null > | null,
- category: {
+ message: string | null;
+ } | null> | null;
+ category: {
// The ID of the object.
- id: string,
- name: string,
- description: string,
- parent: {
+ id: string;
+ name: string;
+ description: string;
+ parent: {
// The ID of the object.
- id: string,
- } | null,
- } | null,
- } | null,
-};
+ id: string;
+ } | null;
+ } | null;
+ } | null;
+}
export interface CategoryDetailsQueryVariables {
- id: string,
-};
+ id: string;
+}
export interface CategoryDetailsQuery {
// Lookup a category by ID.
- category: {
+ category: {
// The ID of the object.
- id: string,
- name: string,
- description: string,
- parent: {
+ id: string;
+ name: string;
+ description: string;
+ parent: {
// The ID of the object.
- id: string,
- } | null,
- } | null,
-};
+ id: string;
+ } | null;
+ } | null;
+}
export interface RootCategoryChildrenQuery {
// List of the shop's categories.
- categories: {
- edges: Array< {
+ categories: {
+ edges: Array<{
// A cursor for use in pagination
- cursor: string,
+ cursor: string;
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- },
- } >,
- } | null,
-};
+ id: string;
+ name: string;
+ };
+ }>;
+ } | null;
+}
export interface CategoryPropertiesQueryVariables {
- id: string,
- first?: number | null,
- after?: string | null,
- last?: number | null,
- before?: string | null,
-};
+ id: string;
+ first?: number | null;
+ after?: string | null;
+ last?: number | null;
+ before?: string | null;
+}
export interface CategoryPropertiesQuery {
// Lookup a category by ID.
- category: {
+ category: {
// The ID of the object.
- id: string,
- name: string,
- description: string,
- parent: {
+ id: string;
+ name: string;
+ description: string;
+ parent: {
// The ID of the object.
- id: string,
- } | null,
+ id: string;
+ } | null;
// List of children of the category.
- children: {
- edges: Array< {
+ children: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- },
- } >,
- } | null,
+ id: string;
+ name: string;
+ };
+ }>;
+ } | null;
// List of products in the category.
- products: {
+ products: {
// A total count of items in the collection
- totalCount: number | null,
- pageInfo: {
+ totalCount: number | null;
+ pageInfo: {
// When paginating forwards, the cursor to continue.
- endCursor: string | null,
+ endCursor: string | null;
// When paginating forwards, are there more items?
- hasNextPage: boolean,
+ hasNextPage: boolean;
// When paginating backwards, are there more items?
- hasPreviousPage: boolean,
+ hasPreviousPage: boolean;
// When paginating backwards, the cursor to continue.
- startCursor: string | null,
- },
- edges: Array< {
+ startCursor: string | null;
+ };
+ edges: Array<{
// A cursor for use in pagination
- cursor: string,
+ cursor: string;
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
+ id: string;
+ name: string;
// The URL of a main thumbnail for a product.
- thumbnailUrl: string | null,
- productType: {
+ thumbnailUrl: string | null;
+ productType: {
// The ID of the object.
- id: string,
- name: string,
- },
- },
- } >,
- } | null,
- } | null,
-};
+ id: string;
+ name: string;
+ };
+ };
+ }>;
+ } | null;
+ } | null;
+}
export interface PageDeleteMutationVariables {
- id: string,
-};
+ id: string;
+}
export interface PageDeleteMutation {
- pageDelete: {
+ pageDelete: {
// List of errors that occurred executing the mutation.
- errors: Array< {
+ errors: Array<{
// Name of a field that caused the error. A value of
// `null` indicates that the error isn't associated with a particular
// field.
- field: string | null,
+ field: string | null;
// The error message.
- message: string | null,
- } | null > | null,
- } | null,
-};
+ message: string | null;
+ } | null> | null;
+ } | null;
+}
export interface PageUpdateMutationVariables {
- id: string,
- title: string,
- content: string,
- slug: string,
- isVisible: boolean,
- availableOn?: string | null,
-};
+ id: string;
+ title: string;
+ content: string;
+ slug: string;
+ isVisible: boolean;
+ availableOn?: string | null;
+}
export interface PageUpdateMutation {
- pageUpdate: {
- page: {
+ pageUpdate: {
+ page: {
// The ID of the object.
- id: string,
- slug: string,
- title: string,
- content: string,
- isVisible: boolean,
- availableOn: string | null,
- } | null,
+ id: string;
+ slug: string;
+ title: string;
+ content: string;
+ isVisible: boolean;
+ availableOn: string | null;
+ } | null;
// List of errors that occurred executing the mutation.
- errors: Array< {
+ errors: Array<{
// Name of a field that caused the error. A value of
// `null` indicates that the error isn't associated with a particular
// field.
- field: string | null,
+ field: string | null;
// The error message.
- message: string | null,
- } | null > | null,
- } | null,
-};
+ message: string | null;
+ } | null> | null;
+ } | null;
+}
export interface PageCreateMutationVariables {
- title: string,
- content: string,
- slug: string,
- isVisible: boolean,
- availableOn?: string | null,
-};
+ title: string;
+ content: string;
+ slug: string;
+ isVisible: boolean;
+ availableOn?: string | null;
+}
export interface PageCreateMutation {
- pageCreate: {
- page: {
+ pageCreate: {
+ page: {
// The ID of the object.
- id: string,
- slug: string,
- title: string,
- content: string,
- isVisible: boolean,
- availableOn: string | null,
- created: string,
- } | null,
+ id: string;
+ slug: string;
+ title: string;
+ content: string;
+ isVisible: boolean;
+ availableOn: string | null;
+ created: string;
+ } | null;
// List of errors that occurred executing the mutation.
- errors: Array< {
+ errors: Array<{
// Name of a field that caused the error. A value of
// `null` indicates that the error isn't associated with a particular
// field.
- field: string | null,
+ field: string | null;
// The error message.
- message: string | null,
- } | null > | null,
- } | null,
-};
+ message: string | null;
+ } | null> | null;
+ } | null;
+}
export interface PageListQueryVariables {
- first?: number | null,
- after?: string | null,
- last?: number | null,
- before?: string | null,
-};
+ first?: number | null;
+ after?: string | null;
+ last?: number | null;
+ before?: string | null;
+}
export interface PageListQuery {
// List of the shop's pages.
- pages: {
- edges: Array< {
+ pages: {
+ edges: Array<{
// A cursor for use in pagination
- cursor: string,
+ cursor: string;
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- slug: string,
- title: string,
- isVisible: boolean,
- },
- } >,
- pageInfo: {
+ id: string;
+ slug: string;
+ title: string;
+ isVisible: boolean;
+ };
+ }>;
+ pageInfo: {
// When paginating backwards, are there more items?
- hasPreviousPage: boolean,
+ hasPreviousPage: boolean;
// When paginating forwards, are there more items?
- hasNextPage: boolean,
+ hasNextPage: boolean;
// When paginating backwards, the cursor to continue.
- startCursor: string | null,
+ startCursor: string | null;
// When paginating forwards, the cursor to continue.
- endCursor: string | null,
- },
- } | null,
-};
+ endCursor: string | null;
+ };
+ } | null;
+}
export interface PageDetailsQueryVariables {
- id: string,
-};
+ id: string;
+}
export interface PageDetailsQuery {
// Lookup a page by ID or by slug.
- page: {
+ page: {
// The ID of the object.
- id: string,
- slug: string,
- title: string,
- content: string,
- created: string,
- isVisible: boolean,
- availableOn: string | null,
- } | null,
-};
+ id: string;
+ slug: string;
+ title: string;
+ content: string;
+ created: string;
+ isVisible: boolean;
+ availableOn: string | null;
+ } | null;
+}
export interface ProductImageCreateMutationVariables {
- product: string,
- image: string,
- alt?: string | null,
-};
+ product: string;
+ image: string;
+ alt?: string | null;
+}
export interface ProductImageCreateMutation {
- productImageCreate: {
+ productImageCreate: {
// List of errors that occurred executing the mutation.
- errors: Array< {
+ errors: Array<{
// Name of a field that caused the error. A value of
// `null` indicates that the error isn't associated with a particular
// field.
- field: string | null,
+ field: string | null;
// The error message.
- message: string | null,
- } | null > | null,
- productImage: {
+ message: string | null;
+ } | null> | null;
+ productImage: {
// The ID of the object.
- id: string,
- sortOrder: number,
- image: string,
- alt: string,
- url: string,
- } | null,
- } | null,
-};
+ id: string;
+ sortOrder: number;
+ image: string;
+ alt: string;
+ url: string;
+ } | null;
+ } | null;
+}
export interface ProductDeleteMutationVariables {
- id: string,
-};
+ id: string;
+}
export interface ProductDeleteMutation {
- productDelete: {
+ productDelete: {
// List of errors that occurred executing the mutation.
- errors: Array< {
+ errors: Array<{
// Name of a field that caused the error. A value of
// `null` indicates that the error isn't associated with a particular
// field.
- field: string | null,
+ field: string | null;
// The error message.
- message: string | null,
- } | null > | null,
- product: {
+ message: string | null;
+ } | null> | null;
+ product: {
// The ID of the object.
- id: string,
- } | null,
- } | null,
-};
+ id: string;
+ } | null;
+ } | null;
+}
export interface ProductImageReorderMutationVariables {
- productId: string,
- imagesIds: Array< string | null >,
-};
+ productId: string;
+ imagesIds: Array<string | null>;
+}
export interface ProductImageReorderMutation {
- productImageReorder: {
+ productImageReorder: {
// List of errors that occurred executing the mutation.
- errors: Array< {
+ errors: Array<{
// Name of a field that caused the error. A value of
// `null` indicates that the error isn't associated with a particular
// field.
- field: string | null,
+ field: string | null;
// The error message.
- message: string | null,
- } | null > | null,
+ message: string | null;
+ } | null> | null;
// Product image which sort order will be altered.
- productImages: Array< {
+ productImages: Array<{
// The ID of the object.
- id: string,
- alt: string,
- sortOrder: number,
- url: string,
- } | null > | null,
- } | null,
-};
+ id: string;
+ alt: string;
+ sortOrder: number;
+ url: string;
+ } | null> | null;
+ } | null;
+}
export interface ProductUpdateMutationVariables {
- id: string,
- attributes?: Array< AttributeValueInput | null > | null,
- availableOn?: string | null,
- category?: string | null,
- chargeTaxes: boolean,
- collections?: Array< string | null > | null,
- description?: string | null,
- isPublished: boolean,
- isFeatured: boolean,
- name?: string | null,
- price?: string | null,
-};
+ id: string;
+ attributes?: Array<AttributeValueInput | null> | null;
+ availableOn?: string | null;
+ category?: string | null;
+ chargeTaxes: boolean;
+ collections?: Array<string | null> | null;
+ description?: string | null;
+ isPublished: boolean;
+ isFeatured: boolean;
+ name?: string | null;
+ price?: string | null;
+}
export interface ProductUpdateMutation {
- productUpdate: {
+ productUpdate: {
// List of errors that occurred executing the mutation.
- errors: Array< {
+ errors: Array<{
// Name of a field that caused the error. A value of
// `null` indicates that the error isn't associated with a particular
// field.
- field: string | null,
+ field: string | null;
// The error message.
- message: string | null,
- } | null > | null,
- product: {
+ message: string | null;
+ } | null> | null;
+ product: {
// The ID of the object.
- id: string,
- name: string,
- description: string,
- seoTitle: string | null,
- seoDescription: string | null,
- category: {
+ id: string;
+ name: string;
+ description: string;
+ seoTitle: string | null;
+ seoDescription: string | null;
+ category: {
// The ID of the object.
- id: string,
- name: string,
- },
- collections: {
- edges: Array< {
+ id: string;
+ name: string;
+ };
+ collections: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- },
- } >,
- } | null,
+ id: string;
+ name: string;
+ };
+ }>;
+ } | null;
// The product's base price (without any discounts
// applied).
- price: {
+ price: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- margin: {
- start: number | null,
- stop: number | null,
- } | null,
- purchaseCost: {
+ currency: string;
+ } | null;
+ margin: {
+ start: number | null;
+ stop: number | null;
+ } | null;
+ purchaseCost: {
// Lower bound of a price range.
- start: {
+ start: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
+ currency: string;
+ } | null;
// Upper bound of a price range.
- stop: {
+ stop: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- } | null,
- isPublished: boolean,
- isFeatured: boolean,
- chargeTaxes: boolean,
- availableOn: string | null,
+ currency: string;
+ } | null;
+ } | null;
+ isPublished: boolean;
+ isFeatured: boolean;
+ chargeTaxes: boolean;
+ availableOn: string | null;
// List of product attributes assigned to this product.
- attributes: Array< {
+ attributes: Array<{
// Name of an attribute
- attribute: {
+ attribute: {
// The ID of the object.
- id: string,
+ id: string;
// Internal representation of an attribute name.
- slug: string | null,
+ slug: string | null;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// List of attribute's values.
- values: Array< {
+ values: Array<{
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null > | null,
- } | null,
+ slug: string | null;
+ } | null> | null;
+ } | null;
// Value of an attribute.
- value: {
+ value: {
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null,
- } | null > | null,
+ slug: string | null;
+ } | null;
+ } | null> | null;
// Informs about product's availability in the storefront,
// current price and discounts.
- availability: {
- available: boolean | null,
- priceRange: {
+ availability: {
+ available: boolean | null;
+ priceRange: {
// Lower bound of a price range.
- start: {
+ start: {
// Amount of money without taxes.
- net: {
+ net: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- },
- } | null,
+ currency: string;
+ };
+ } | null;
// Upper bound of a price range.
- stop: {
+ stop: {
// Amount of money without taxes.
- net: {
+ net: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- },
- } | null,
- } | null,
- } | null,
- images: {
- edges: Array< {
+ currency: string;
+ };
+ } | null;
+ } | null;
+ } | null;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- alt: string,
- sortOrder: number,
- url: string,
- },
- } >,
- } | null,
- variants: {
- edges: Array< {
+ id: string;
+ alt: string;
+ sortOrder: number;
+ url: string;
+ };
+ }>;
+ } | null;
+ variants: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- sku: string,
- name: string,
+ id: string;
+ sku: string;
+ name: string;
// Override the base price of a product if necessary.
// A value of `null` indicates that the default product price is used.
- priceOverride: {
+ priceOverride: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
+ currency: string;
+ } | null;
// Quantity of a product available for sale.
- stockQuantity: number,
+ stockQuantity: number;
// Gross margin percentage value.
- margin: number | null,
- },
- } >,
- } | null,
- productType: {
+ margin: number | null;
+ };
+ }>;
+ } | null;
+ productType: {
// The ID of the object.
- id: string,
- name: string,
- hasVariants: boolean,
- },
+ id: string;
+ name: string;
+ hasVariants: boolean;
+ };
// The storefront URL for the product.
- url: string,
- } | null,
- } | null,
-};
+ url: string;
+ } | null;
+ } | null;
+}
export interface ProductCreateMutationVariables {
- attributes?: Array< AttributeValueInput | null > | null,
- availableOn?: string | null,
- category: string,
- chargeTaxes: boolean,
- collections?: Array< string | null > | null,
- description?: string | null,
- isPublished: boolean,
- isFeatured: boolean,
- name: string,
- price?: string | null,
- productType: string,
-};
+ attributes?: Array<AttributeValueInput | null> | null;
+ availableOn?: string | null;
+ category: string;
+ chargeTaxes: boolean;
+ collections?: Array<string | null> | null;
+ description?: string | null;
+ isPublished: boolean;
+ isFeatured: boolean;
+ name: string;
+ price?: string | null;
+ productType: string;
+}
export interface ProductCreateMutation {
- productCreate: {
+ productCreate: {
// List of errors that occurred executing the mutation.
- errors: Array< {
+ errors: Array<{
// Name of a field that caused the error. A value of
// `null` indicates that the error isn't associated with a particular
// field.
- field: string | null,
+ field: string | null;
// The error message.
- message: string | null,
- } | null > | null,
- product: {
+ message: string | null;
+ } | null> | null;
+ product: {
// The ID of the object.
- id: string,
- name: string,
- description: string,
- seoTitle: string | null,
- seoDescription: string | null,
- category: {
+ id: string;
+ name: string;
+ description: string;
+ seoTitle: string | null;
+ seoDescription: string | null;
+ category: {
// The ID of the object.
- id: string,
- name: string,
- },
- collections: {
- edges: Array< {
+ id: string;
+ name: string;
+ };
+ collections: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- },
- } >,
- } | null,
+ id: string;
+ name: string;
+ };
+ }>;
+ } | null;
// The product's base price (without any discounts
// applied).
- price: {
+ price: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- margin: {
- start: number | null,
- stop: number | null,
- } | null,
- purchaseCost: {
+ currency: string;
+ } | null;
+ margin: {
+ start: number | null;
+ stop: number | null;
+ } | null;
+ purchaseCost: {
// Lower bound of a price range.
- start: {
+ start: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
+ currency: string;
+ } | null;
// Upper bound of a price range.
- stop: {
+ stop: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- } | null,
- isPublished: boolean,
- isFeatured: boolean,
- chargeTaxes: boolean,
- availableOn: string | null,
+ currency: string;
+ } | null;
+ } | null;
+ isPublished: boolean;
+ isFeatured: boolean;
+ chargeTaxes: boolean;
+ availableOn: string | null;
// List of product attributes assigned to this product.
- attributes: Array< {
+ attributes: Array<{
// Name of an attribute
- attribute: {
+ attribute: {
// The ID of the object.
- id: string,
+ id: string;
// Internal representation of an attribute name.
- slug: string | null,
+ slug: string | null;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// List of attribute's values.
- values: Array< {
+ values: Array<{
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null > | null,
- } | null,
+ slug: string | null;
+ } | null> | null;
+ } | null;
// Value of an attribute.
- value: {
+ value: {
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null,
- } | null > | null,
+ slug: string | null;
+ } | null;
+ } | null> | null;
// Informs about product's availability in the storefront,
// current price and discounts.
- availability: {
- available: boolean | null,
- priceRange: {
+ availability: {
+ available: boolean | null;
+ priceRange: {
// Lower bound of a price range.
- start: {
+ start: {
// Amount of money without taxes.
- net: {
+ net: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- },
- } | null,
+ currency: string;
+ };
+ } | null;
// Upper bound of a price range.
- stop: {
+ stop: {
// Amount of money without taxes.
- net: {
+ net: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- },
- } | null,
- } | null,
- } | null,
- images: {
- edges: Array< {
+ currency: string;
+ };
+ } | null;
+ } | null;
+ } | null;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- alt: string,
- sortOrder: number,
- url: string,
- },
- } >,
- } | null,
- variants: {
- edges: Array< {
+ id: string;
+ alt: string;
+ sortOrder: number;
+ url: string;
+ };
+ }>;
+ } | null;
+ variants: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- sku: string,
- name: string,
+ id: string;
+ sku: string;
+ name: string;
// Override the base price of a product if necessary.
// A value of `null` indicates that the default product price is used.
- priceOverride: {
+ priceOverride: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
+ currency: string;
+ } | null;
// Quantity of a product available for sale.
- stockQuantity: number,
+ stockQuantity: number;
// Gross margin percentage value.
- margin: number | null,
- },
- } >,
- } | null,
- productType: {
+ margin: number | null;
+ };
+ }>;
+ } | null;
+ productType: {
// The ID of the object.
- id: string,
- name: string,
- hasVariants: boolean,
- },
+ id: string;
+ name: string;
+ hasVariants: boolean;
+ };
// The storefront URL for the product.
- url: string,
- } | null,
- } | null,
-};
+ url: string;
+ } | null;
+ } | null;
+}
export interface VariantDeleteMutationVariables {
- id: string,
-};
+ id: string;
+}
export interface VariantDeleteMutation {
- productVariantDelete: {
+ productVariantDelete: {
// List of errors that occurred executing the mutation.
- errors: Array< {
+ errors: Array<{
// Name of a field that caused the error. A value of
// `null` indicates that the error isn't associated with a particular
// field.
- field: string | null,
+ field: string | null;
// The error message.
- message: string | null,
- } | null > | null,
- productVariant: {
+ message: string | null;
+ } | null> | null;
+ productVariant: {
// The ID of the object.
- id: string,
- } | null,
- } | null,
-};
+ id: string;
+ } | null;
+ } | null;
+}
export interface VariantUpdateMutationVariables {
- id: string,
- attributes?: Array< AttributeValueInput | null > | null,
- costPrice?: string | null,
- priceOverride?: string | null,
- product?: string | null,
- sku?: string | null,
- quantity?: number | null,
- trackInventory: boolean,
-};
+ id: string;
+ attributes?: Array<AttributeValueInput | null> | null;
+ costPrice?: string | null;
+ priceOverride?: string | null;
+ product?: string | null;
+ sku?: string | null;
+ quantity?: number | null;
+ trackInventory: boolean;
+}
export interface VariantUpdateMutation {
- productVariantUpdate: {
+ productVariantUpdate: {
// List of errors that occurred executing the mutation.
- errors: Array< {
+ errors: Array<{
// Name of a field that caused the error. A value of
// `null` indicates that the error isn't associated with a particular
// field.
- field: string | null,
+ field: string | null;
// The error message.
- message: string | null,
- } | null > | null,
- productVariant: {
+ message: string | null;
+ } | null> | null;
+ productVariant: {
// The ID of the object.
- id: string,
+ id: string;
// List of attributes assigned to this variant.
- attributes: Array< {
+ attributes: Array<{
// Name of an attribute
- attribute: {
+ attribute: {
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
+ slug: string | null;
// List of attribute's values.
- values: Array< {
+ values: Array<{
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null > | null,
- } | null,
+ slug: string | null;
+ } | null> | null;
+ } | null;
// Value of an attribute.
- value: {
+ value: {
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null,
- } | null > | null,
+ slug: string | null;
+ } | null;
+ } | null> | null;
// Cost price of the variant.
- costPrice: {
+ costPrice: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- images: {
- edges: Array< {
+ currency: string;
+ } | null;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- },
- } >,
- } | null,
- name: string,
+ id: string;
+ };
+ }>;
+ } | null;
+ name: string;
// Override the base price of a product if necessary.
// A value of `null` indicates that the default product price is used.
- priceOverride: {
+ priceOverride: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- product: {
+ currency: string;
+ } | null;
+ product: {
// The ID of the object.
- id: string,
- images: {
- edges: Array< {
+ id: string;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- alt: string,
- sortOrder: number,
- url: string,
- },
- } >,
- } | null,
- name: string,
+ id: string;
+ alt: string;
+ sortOrder: number;
+ url: string;
+ };
+ }>;
+ } | null;
+ name: string;
// The URL of a main thumbnail for a product.
- thumbnailUrl: string | null,
- variants: {
+ thumbnailUrl: string | null;
+ variants: {
// A total count of items in the collection
- totalCount: number | null,
- edges: Array< {
+ totalCount: number | null;
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- sku: string,
- images: {
- edges: Array< {
+ id: string;
+ name: string;
+ sku: string;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- url: string,
- },
- } >,
- } | null,
- },
- } >,
- } | null,
- },
- sku: string,
- quantity: number,
- quantityAllocated: number,
- } | null,
- } | null,
-};
+ id: string;
+ url: string;
+ };
+ }>;
+ } | null;
+ };
+ }>;
+ } | null;
+ };
+ sku: string;
+ quantity: number;
+ quantityAllocated: number;
+ } | null;
+ } | null;
+}
export interface VariantCreateMutationVariables {
- attributes?: Array< AttributeValueInput | null > | null,
- costPrice?: string | null,
- priceOverride?: string | null,
- product?: string | null,
- sku?: string | null,
- quantity?: number | null,
- trackInventory: boolean,
-};
+ attributes?: Array<AttributeValueInput | null> | null;
+ costPrice?: string | null;
+ priceOverride?: string | null;
+ product?: string | null;
+ sku?: string | null;
+ quantity?: number | null;
+ trackInventory: boolean;
+}
export interface VariantCreateMutation {
- productVariantCreate: {
+ productVariantCreate: {
// List of errors that occurred executing the mutation.
- errors: Array< {
+ errors: Array<{
// Name of a field that caused the error. A value of
// `null` indicates that the error isn't associated with a particular
// field.
- field: string | null,
+ field: string | null;
// The error message.
- message: string | null,
- } | null > | null,
- productVariant: {
+ message: string | null;
+ } | null> | null;
+ productVariant: {
// The ID of the object.
- id: string,
+ id: string;
// List of attributes assigned to this variant.
- attributes: Array< {
+ attributes: Array<{
// Name of an attribute
- attribute: {
+ attribute: {
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
+ slug: string | null;
// List of attribute's values.
- values: Array< {
+ values: Array<{
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null > | null,
- } | null,
+ slug: string | null;
+ } | null> | null;
+ } | null;
// Value of an attribute.
- value: {
+ value: {
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null,
- } | null > | null,
+ slug: string | null;
+ } | null;
+ } | null> | null;
// Cost price of the variant.
- costPrice: {
+ costPrice: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- images: {
- edges: Array< {
+ currency: string;
+ } | null;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- },
- } >,
- } | null,
- name: string,
+ id: string;
+ };
+ }>;
+ } | null;
+ name: string;
// Override the base price of a product if necessary.
// A value of `null` indicates that the default product price is used.
- priceOverride: {
+ priceOverride: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- product: {
+ currency: string;
+ } | null;
+ product: {
// The ID of the object.
- id: string,
- images: {
- edges: Array< {
+ id: string;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- alt: string,
- sortOrder: number,
- url: string,
- },
- } >,
- } | null,
- name: string,
+ id: string;
+ alt: string;
+ sortOrder: number;
+ url: string;
+ };
+ }>;
+ } | null;
+ name: string;
// The URL of a main thumbnail for a product.
- thumbnailUrl: string | null,
- variants: {
+ thumbnailUrl: string | null;
+ variants: {
// A total count of items in the collection
- totalCount: number | null,
- edges: Array< {
+ totalCount: number | null;
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- sku: string,
- images: {
- edges: Array< {
+ id: string;
+ name: string;
+ sku: string;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- url: string,
- },
- } >,
- } | null,
- },
- } >,
- } | null,
- },
- sku: string,
- quantity: number,
- quantityAllocated: number,
- } | null,
- } | null,
-};
+ id: string;
+ url: string;
+ };
+ }>;
+ } | null;
+ };
+ }>;
+ } | null;
+ };
+ sku: string;
+ quantity: number;
+ quantityAllocated: number;
+ } | null;
+ } | null;
+}
+
+export interface ProductImageDeleteMutationVariables {
+ id: string;
+}
+
+export interface ProductImageDeleteMutation {
+ productImageDelete: {
+ productImage: {
+ // The ID of the object.
+ id: string;
+ } | null;
+ } | null;
+}
export interface ProductListQueryVariables {
- first?: number | null,
- after?: string | null,
- last?: number | null,
- before?: string | null,
-};
+ first?: number | null;
+ after?: string | null;
+ last?: number | null;
+ before?: string | null;
+}
export interface ProductListQuery {
// List of the shop's products.
- products: {
- edges: Array< {
+ products: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
+ id: string;
+ name: string;
// The URL of a main thumbnail for a product.
- thumbnailUrl: string | null,
+ thumbnailUrl: string | null;
// Informs about product's availability in the storefront,
// current price and discounts.
- availability: {
- available: boolean | null,
- } | null,
+ availability: {
+ available: boolean | null;
+ } | null;
// The product's base price (without any discounts
// applied).
- price: {
+ price: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- productType: {
+ currency: string;
+ } | null;
+ productType: {
// The ID of the object.
- id: string,
- name: string,
- },
- },
- } >,
- pageInfo: {
+ id: string;
+ name: string;
+ };
+ };
+ }>;
+ pageInfo: {
// When paginating backwards, are there more items?
- hasPreviousPage: boolean,
+ hasPreviousPage: boolean;
// When paginating forwards, are there more items?
- hasNextPage: boolean,
+ hasNextPage: boolean;
// When paginating backwards, the cursor to continue.
- startCursor: string | null,
+ startCursor: string | null;
// When paginating forwards, the cursor to continue.
- endCursor: string | null,
- },
- } | null,
-};
+ endCursor: string | null;
+ };
+ } | null;
+}
export interface ProductDetailsQueryVariables {
- id: string,
-};
+ id: string;
+}
export interface ProductDetailsQuery {
// Lookup a product by ID.
- product: {
+ product: {
// The ID of the object.
- id: string,
- name: string,
- description: string,
- seoTitle: string | null,
- seoDescription: string | null,
- category: {
+ id: string;
+ name: string;
+ description: string;
+ seoTitle: string | null;
+ seoDescription: string | null;
+ category: {
// The ID of the object.
- id: string,
- name: string,
- },
- collections: {
- edges: Array< {
+ id: string;
+ name: string;
+ };
+ collections: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- },
- } >,
- } | null,
+ id: string;
+ name: string;
+ };
+ }>;
+ } | null;
// The product's base price (without any discounts
// applied).
- price: {
+ price: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- margin: {
- start: number | null,
- stop: number | null,
- } | null,
- purchaseCost: {
+ currency: string;
+ } | null;
+ margin: {
+ start: number | null;
+ stop: number | null;
+ } | null;
+ purchaseCost: {
// Lower bound of a price range.
- start: {
+ start: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
+ currency: string;
+ } | null;
// Upper bound of a price range.
- stop: {
+ stop: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- } | null,
- isPublished: boolean,
- isFeatured: boolean,
- chargeTaxes: boolean,
- availableOn: string | null,
+ currency: string;
+ } | null;
+ } | null;
+ isPublished: boolean;
+ isFeatured: boolean;
+ chargeTaxes: boolean;
+ availableOn: string | null;
// List of product attributes assigned to this product.
- attributes: Array< {
+ attributes: Array<{
// Name of an attribute
- attribute: {
+ attribute: {
// The ID of the object.
- id: string,
+ id: string;
// Internal representation of an attribute name.
- slug: string | null,
+ slug: string | null;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// List of attribute's values.
- values: Array< {
+ values: Array<{
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null > | null,
- } | null,
+ slug: string | null;
+ } | null> | null;
+ } | null;
// Value of an attribute.
- value: {
+ value: {
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null,
- } | null > | null,
+ slug: string | null;
+ } | null;
+ } | null> | null;
// Informs about product's availability in the storefront,
// current price and discounts.
- availability: {
- available: boolean | null,
- priceRange: {
+ availability: {
+ available: boolean | null;
+ priceRange: {
// Lower bound of a price range.
- start: {
+ start: {
// Amount of money without taxes.
- net: {
+ net: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- },
- } | null,
+ currency: string;
+ };
+ } | null;
// Upper bound of a price range.
- stop: {
+ stop: {
// Amount of money without taxes.
- net: {
+ net: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- },
- } | null,
- } | null,
- } | null,
- images: {
- edges: Array< {
+ currency: string;
+ };
+ } | null;
+ } | null;
+ } | null;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- alt: string,
- sortOrder: number,
- url: string,
- },
- } >,
- } | null,
- variants: {
- edges: Array< {
+ id: string;
+ alt: string;
+ sortOrder: number;
+ url: string;
+ };
+ }>;
+ } | null;
+ variants: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- sku: string,
- name: string,
+ id: string;
+ sku: string;
+ name: string;
// Override the base price of a product if necessary.
// A value of `null` indicates that the default product price is used.
- priceOverride: {
+ priceOverride: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
+ currency: string;
+ } | null;
// Quantity of a product available for sale.
- stockQuantity: number,
+ stockQuantity: number;
// Gross margin percentage value.
- margin: number | null,
- },
- } >,
- } | null,
- productType: {
+ margin: number | null;
+ };
+ }>;
+ } | null;
+ productType: {
// The ID of the object.
- id: string,
- name: string,
- hasVariants: boolean,
- },
+ id: string;
+ name: string;
+ hasVariants: boolean;
+ };
// The storefront URL for the product.
- url: string,
- } | null,
+ url: string;
+ } | null;
// List of the shop's collections.
- collections: {
- edges: Array< {
+ collections: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- },
- } >,
- } | null,
+ id: string;
+ name: string;
+ };
+ }>;
+ } | null;
// List of the shop's categories.
- categories: {
- edges: Array< {
+ categories: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- },
- } >,
- } | null,
-};
+ id: string;
+ name: string;
+ };
+ }>;
+ } | null;
+}
export interface ProductVariantDetailsQueryVariables {
- id: string,
-};
+ id: string;
+}
export interface ProductVariantDetailsQuery {
// Lookup a variant by ID.
- productVariant: {
+ productVariant: {
// The ID of the object.
- id: string,
+ id: string;
// List of attributes assigned to this variant.
- attributes: Array< {
+ attributes: Array<{
// Name of an attribute
- attribute: {
+ attribute: {
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
+ slug: string | null;
// List of attribute's values.
- values: Array< {
+ values: Array<{
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null > | null,
- } | null,
+ slug: string | null;
+ } | null> | null;
+ } | null;
// Value of an attribute.
- value: {
+ value: {
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null,
- } | null > | null,
+ slug: string | null;
+ } | null;
+ } | null> | null;
// Cost price of the variant.
- costPrice: {
+ costPrice: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- images: {
- edges: Array< {
+ currency: string;
+ } | null;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- },
- } >,
- } | null,
- name: string,
+ id: string;
+ };
+ }>;
+ } | null;
+ name: string;
// Override the base price of a product if necessary.
// A value of `null` indicates that the default product price is used.
- priceOverride: {
+ priceOverride: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- product: {
+ currency: string;
+ } | null;
+ product: {
// The ID of the object.
- id: string,
- images: {
- edges: Array< {
+ id: string;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- alt: string,
- sortOrder: number,
- url: string,
- },
- } >,
- } | null,
- name: string,
+ id: string;
+ alt: string;
+ sortOrder: number;
+ url: string;
+ };
+ }>;
+ } | null;
+ name: string;
// The URL of a main thumbnail for a product.
- thumbnailUrl: string | null,
- variants: {
+ thumbnailUrl: string | null;
+ variants: {
// A total count of items in the collection
- totalCount: number | null,
- edges: Array< {
+ totalCount: number | null;
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- sku: string,
- images: {
- edges: Array< {
+ id: string;
+ name: string;
+ sku: string;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- url: string,
- },
- } >,
- } | null,
- },
- } >,
- } | null,
- },
- sku: string,
- quantity: number,
- quantityAllocated: number,
- } | null,
-};
+ id: string;
+ url: string;
+ };
+ }>;
+ } | null;
+ };
+ }>;
+ } | null;
+ };
+ sku: string;
+ quantity: number;
+ quantityAllocated: number;
+ } | null;
+}
export interface ProductCreateDataQuery {
// List of the shop's product types.
- productTypes: {
- edges: Array< {
+ productTypes: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- hasVariants: boolean,
- productAttributes: {
- edges: Array< {
+ id: string;
+ name: string;
+ hasVariants: boolean;
+ productAttributes: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
+ id: string;
// Internal representation of an attribute name.
- slug: string | null,
+ slug: string | null;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// List of attribute's values.
- values: Array< {
+ values: Array<{
// The ID of the object.
- id: string,
- sortOrder: number,
+ id: string;
+ sortOrder: number;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null > | null,
- },
- } >,
- } | null,
- },
- } >,
- } | null,
+ slug: string | null;
+ } | null> | null;
+ };
+ }>;
+ } | null;
+ };
+ }>;
+ } | null;
// List of the shop's collections.
- collections: {
- edges: Array< {
+ collections: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- },
- } >,
- } | null,
+ id: string;
+ name: string;
+ };
+ }>;
+ } | null;
// List of the shop's categories.
- categories: {
- edges: Array< {
+ categories: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- },
- } >,
- } | null,
-};
+ id: string;
+ name: string;
+ };
+ }>;
+ } | null;
+}
export interface ProductVariantCreateDataQueryVariables {
- id: string,
-};
+ id: string;
+}
export interface ProductVariantCreateDataQuery {
// Lookup a product by ID.
- product: {
- images: {
- edges: Array< {
+ product: {
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- sortOrder: number,
- url: string,
- },
- } >,
- } | null,
- productType: {
+ id: string;
+ sortOrder: number;
+ url: string;
+ };
+ }>;
+ } | null;
+ productType: {
// The ID of the object.
- id: string,
- variantAttributes: {
- edges: Array< {
+ id: string;
+ variantAttributes: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
+ id: string;
// Internal representation of an attribute name.
- slug: string | null,
+ slug: string | null;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// List of attribute's values.
- values: Array< {
+ values: Array<{
// The ID of the object.
- id: string,
- sortOrder: number,
+ id: string;
+ sortOrder: number;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null > | null,
- },
- } >,
- } | null,
- },
- variants: {
- edges: Array< {
+ slug: string | null;
+ } | null> | null;
+ };
+ }>;
+ } | null;
+ };
+ variants: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- sku: string,
- images: {
- edges: Array< {
+ id: string;
+ name: string;
+ sku: string;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- url: string,
- },
- } >,
- } | null,
- },
- } >,
- } | null,
- } | null,
-};
+ id: string;
+ url: string;
+ };
+ }>;
+ } | null;
+ };
+ }>;
+ } | null;
+ } | null;
+}
export interface ProductImageQueryVariables {
- productId: string,
- imageId: string,
-};
+ productId: string;
+ imageId: string;
+}
export interface ProductImageQuery {
// Lookup a product by ID.
- product: {
- image: {
- edges: Array< {
+ product: {
+ image: {
+ edges: Array<{
// A cursor for use in pagination
- cursor: string,
+ cursor: string;
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- url: string,
- },
- } >,
- } | null,
- } | null,
-};
+ id: string;
+ alt: string;
+ url: string;
+ };
+ }>;
+ } | null;
+ } | null;
+}
export interface UserFragment {
// The ID of the object.
@@ -1607,274 +1621,274 @@ export interface UserFragment {
export interface MoneyFragment {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
-};
+ currency: string;
+}
export interface ProductImageFragment {
// The ID of the object.
- id: string,
- alt: string,
- sortOrder: number,
- url: string,
-};
+ id: string;
+ alt: string;
+ sortOrder: number;
+ url: string;
+}
export interface ProductFragment {
// The ID of the object.
- id: string,
- name: string,
- description: string,
- seoTitle: string | null,
- seoDescription: string | null,
- category: {
+ id: string;
+ name: string;
+ description: string;
+ seoTitle: string | null;
+ seoDescription: string | null;
+ category: {
// The ID of the object.
- id: string,
- name: string,
- },
- collections: {
- edges: Array< {
+ id: string;
+ name: string;
+ };
+ collections: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- },
- } >,
- } | null,
+ id: string;
+ name: string;
+ };
+ }>;
+ } | null;
// The product's base price (without any discounts
// applied).
- price: {
+ price: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- margin: {
- start: number | null,
- stop: number | null,
- } | null,
- purchaseCost: {
+ currency: string;
+ } | null;
+ margin: {
+ start: number | null;
+ stop: number | null;
+ } | null;
+ purchaseCost: {
// Lower bound of a price range.
- start: {
+ start: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
+ currency: string;
+ } | null;
// Upper bound of a price range.
- stop: {
+ stop: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- } | null,
- isPublished: boolean,
- isFeatured: boolean,
- chargeTaxes: boolean,
- availableOn: string | null,
+ currency: string;
+ } | null;
+ } | null;
+ isPublished: boolean;
+ isFeatured: boolean;
+ chargeTaxes: boolean;
+ availableOn: string | null;
// List of product attributes assigned to this product.
- attributes: Array< {
+ attributes: Array<{
// Name of an attribute
- attribute: {
+ attribute: {
// The ID of the object.
- id: string,
+ id: string;
// Internal representation of an attribute name.
- slug: string | null,
+ slug: string | null;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// List of attribute's values.
- values: Array< {
+ values: Array<{
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null > | null,
- } | null,
+ slug: string | null;
+ } | null> | null;
+ } | null;
// Value of an attribute.
- value: {
+ value: {
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null,
- } | null > | null,
+ slug: string | null;
+ } | null;
+ } | null> | null;
// Informs about product's availability in the storefront,
// current price and discounts.
- availability: {
- available: boolean | null,
- priceRange: {
+ availability: {
+ available: boolean | null;
+ priceRange: {
// Lower bound of a price range.
- start: {
+ start: {
// Amount of money without taxes.
- net: {
+ net: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- },
- } | null,
+ currency: string;
+ };
+ } | null;
// Upper bound of a price range.
- stop: {
+ stop: {
// Amount of money without taxes.
- net: {
+ net: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- },
- } | null,
- } | null,
- } | null,
- images: {
- edges: Array< {
+ currency: string;
+ };
+ } | null;
+ } | null;
+ } | null;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- alt: string,
- sortOrder: number,
- url: string,
- },
- } >,
- } | null,
- variants: {
- edges: Array< {
+ id: string;
+ alt: string;
+ sortOrder: number;
+ url: string;
+ };
+ }>;
+ } | null;
+ variants: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- sku: string,
- name: string,
+ id: string;
+ sku: string;
+ name: string;
// Override the base price of a product if necessary.
// A value of `null` indicates that the default product price is used.
- priceOverride: {
+ priceOverride: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
+ currency: string;
+ } | null;
// Quantity of a product available for sale.
- stockQuantity: number,
+ stockQuantity: number;
// Gross margin percentage value.
- margin: number | null,
- },
- } >,
- } | null,
- productType: {
+ margin: number | null;
+ };
+ }>;
+ } | null;
+ productType: {
// The ID of the object.
- id: string,
- name: string,
- hasVariants: boolean,
- },
+ id: string;
+ name: string;
+ hasVariants: boolean;
+ };
// The storefront URL for the product.
- url: string,
-};
+ url: string;
+}
export interface ProductVariantFragment {
// The ID of the object.
- id: string,
+ id: string;
// List of attributes assigned to this variant.
- attributes: Array< {
+ attributes: Array<{
// Name of an attribute
- attribute: {
+ attribute: {
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
+ slug: string | null;
// List of attribute's values.
- values: Array< {
+ values: Array<{
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null > | null,
- } | null,
+ slug: string | null;
+ } | null> | null;
+ } | null;
// Value of an attribute.
- value: {
+ value: {
// The ID of the object.
- id: string,
+ id: string;
// Visible name for display purposes.
- name: string | null,
+ name: string | null;
// Internal representation of an attribute name.
- slug: string | null,
- } | null,
- } | null > | null,
+ slug: string | null;
+ } | null;
+ } | null> | null;
// Cost price of the variant.
- costPrice: {
+ costPrice: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- images: {
- edges: Array< {
+ currency: string;
+ } | null;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- },
- } >,
- } | null,
- name: string,
+ id: string;
+ };
+ }>;
+ } | null;
+ name: string;
// Override the base price of a product if necessary.
// A value of `null` indicates that the default product price is used.
- priceOverride: {
+ priceOverride: {
// Amount of money.
- amount: number,
+ amount: number;
// Currency code.
- currency: string,
- } | null,
- product: {
+ currency: string;
+ } | null;
+ product: {
// The ID of the object.
- id: string,
- images: {
- edges: Array< {
+ id: string;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- alt: string,
- sortOrder: number,
- url: string,
- },
- } >,
- } | null,
- name: string,
+ id: string;
+ alt: string;
+ sortOrder: number;
+ url: string;
+ };
+ }>;
+ } | null;
+ name: string;
// The URL of a main thumbnail for a product.
- thumbnailUrl: string | null,
- variants: {
+ thumbnailUrl: string | null;
+ variants: {
// A total count of items in the collection
- totalCount: number | null,
- edges: Array< {
+ totalCount: number | null;
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- name: string,
- sku: string,
- images: {
- edges: Array< {
+ id: string;
+ name: string;
+ sku: string;
+ images: {
+ edges: Array<{
// The item at the end of the edge
- node: {
+ node: {
// The ID of the object.
- id: string,
- url: string,
- },
- } >,
- } | null,
- },
- } >,
- } | null,
- },
- sku: string,
- quantity: number,
- quantityAllocated: number,
-};
+ id: string;
+ url: string;
+ };
+ }>;
+ } | null;
+ };
+ }>;
+ } | null;
+ };
+ sku: string;
+ quantity: number;
+ quantityAllocated: number;
+}
diff --git a/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx b/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
index e530534a73..4756fe18b4 100644
--- a/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
@@ -17,10 +17,11 @@ import i18n from "../../../i18n";
interface ProductImagePageProps {
image?: string;
description?: string;
- loading?: boolean;
+ disabled?: boolean;
saveButtonBarState?: SaveButtonBarState;
- onSubmit(data: { description: string });
- onBack();
+ onBack: () => void;
+ onDelete: () => void;
+ onSubmit: (data: { description: string }) => void;
}
const decorate = withStyles(theme => ({
@@ -48,19 +49,20 @@ const ProductImagePage = decorate<ProductImagePageProps>(
classes,
image,
description,
- loading,
+ disabled,
saveButtonBarState,
- onSubmit,
- onBack
+ onBack,
+ onDelete,
+ onSubmit
}) => (
- <Container width="md">
- <Form
- initial={{ description: description || "" }}
- onSubmit={onSubmit}
- key={description}
- >
- {({ change, data, hasChanged, submit }) => (
- <>
+ <Form
+ initial={{ description: description || "" }}
+ onSubmit={onSubmit}
+ key={description}
+ >
+ {({ change, data, hasChanged, submit }) => {
+ return (
+ <Container width="md">
<PageHeader title={i18n.t("Edit Photo")} onBack={onBack} />
<div className={classes.root}>
<div>
@@ -71,7 +73,7 @@ const ProductImagePage = decorate<ProductImagePageProps>(
name="description"
label={i18n.t("Description")}
helperText={i18n.t("Optional")}
- disabled={loading}
+ disabled={disabled}
onChange={change}
value={data.description}
multiline
@@ -84,26 +86,27 @@ const ProductImagePage = decorate<ProductImagePageProps>(
<Card>
<CardTitle title={i18n.t("Photo View")} />
<CardContent>
- {loading ? (
- <Skeleton />
- ) : (
+ {!!image ? (
<div className={classes.imageContainer}>
<img src={image} className={classes.image} />
</div>
+ ) : (
+ <Skeleton />
)}
</CardContent>
</Card>
</div>
</div>
<SaveButtonBar
- disabled={loading || !onSubmit || !hasChanged}
+ disabled={disabled || !onSubmit || !hasChanged}
state={saveButtonBarState}
+ onDelete={onDelete}
onSave={submit}
/>
- </>
- )}
- </Form>
- </Container>
+ </Container>
+ );
+ }}
+ </Form>
)
);
export default ProductImagePage;
diff --git a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
index 0a8f41cff7..26adbe8a77 100644
--- a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
@@ -144,7 +144,6 @@ export const ProductUpdate = decorate<ProductUpdateProps>(
onImageEdit,
onImageReorder,
onImageUpload,
- onProductShow,
onSeoClick,
onSubmit,
onVariantAdd,
diff --git a/saleor/static/dashboard-next/products/index.tsx b/saleor/static/dashboard-next/products/index.tsx
index 10a215e739..945f8f8348 100644
--- a/saleor/static/dashboard-next/products/index.tsx
+++ b/saleor/static/dashboard-next/products/index.tsx
@@ -3,6 +3,7 @@ import * as React from "react";
import { Route, RouteComponentProps, Switch } from "react-router-dom";
import ProductCreate from "./views/ProductCreate";
+import ProductImageComponent from "./views/ProductImage";
import ProductListComponent from "./views/ProductList";
import ProductUpdateComponent from "./views/ProductUpdate";
import ProductVariantComponent from "./views/ProductVariant";
@@ -36,6 +37,17 @@ const ProductVariant: React.StatelessComponent<RouteComponentProps<any>> = ({
);
};
+const ProductImage: React.StatelessComponent<RouteComponentProps<any>> = ({
+ match
+}) => {
+ return (
+ <ProductImageComponent
+ imageId={match.params.imageId}
+ productId={match.params.productId}
+ />
+ );
+};
+
const ProductVariantCreate: React.StatelessComponent<
RouteComponentProps<any>
> = ({ match }) => {
@@ -57,6 +69,11 @@ const Component = ({ match }) => (
path={`${match.url}/:productId/variant/:variantId/`}
component={ProductVariant}
/>
+ <Route
+ exact
+ path={`${match.url}/:productId/image/:imageId/`}
+ component={ProductImage}
+ />
</Switch>
);
@@ -64,10 +81,6 @@ export const productUrl = (id: string) => {
return `/products/${id}/`;
};
-export const productImageEditUrl = (id: string) => {
- return `/products/${id}/image/`;
-};
-
export const productVariantAddUrl = (productId: string) => {
return `/products/${productId}/variant/add/`;
};
@@ -76,6 +89,9 @@ export const productVariantEditUrl = (productId: string, variantId: string) => {
return `/products/${productId}/variant/${variantId}/`;
};
+export const productImageUrl = (productId: string, imageId: string) =>
+ `/products/${productId}/image/${imageId}/`;
+
export const productListUrl = "/products/";
export const productAddUrl = "/products/add/";
diff --git a/saleor/static/dashboard-next/products/mutations.ts b/saleor/static/dashboard-next/products/mutations.ts
index 3c471f5328..f983ee0733 100644
--- a/saleor/static/dashboard-next/products/mutations.ts
+++ b/saleor/static/dashboard-next/products/mutations.ts
@@ -8,6 +8,8 @@ import {
ProductDeleteMutationVariables,
ProductImageCreateMutation,
ProductImageCreateMutationVariables,
+ ProductImageDeleteMutation,
+ ProductImageDeleteMutationVariables,
ProductImageReorderMutation,
ProductImageReorderMutationVariables,
ProductUpdateMutation,
@@ -273,7 +275,7 @@ export const variantCreateMutation = gql`
`;
export const TypedProductImageDeleteMutation = Mutation as React.ComponentType<
- MutationProps<ProductImageDeleteMutation, ProductImageMutationDeleteVariables>
+ MutationProps<ProductImageDeleteMutation, ProductImageDeleteMutationVariables>
>;
export const productImageDeleteMutation = gql`
@@ -286,21 +288,21 @@ export const productImageDeleteMutation = gql`
}
`;
-export const TypedProductImageUpdateMutation = Mutation as React.ComponentType<
- MutationProps<ProductImageUpdateMutation, ProductImageMutationUpdateVariables>
->;
+// export const TypedProductImageUpdateMutation = Mutation as React.ComponentType<
+// MutationProps<ProductImageUpdateMutation, ProductImageMutationUpdateVariables>
+// >;
-export const productImageUpdateMutation = gql`
- mutation ProductImageUpdate($id: ID!, $alt: String!) {
- productImageUpdate(id: $id, input: { alt: $alt }) {
- errors {
- field
- message
- }
- productImage {
- id
- alt
- }
- }
- }
-`;
+// export const productImageUpdateMutation = gql`
+// mutation ProductImageUpdate($id: ID!, $alt: String!) {
+// productImageUpdate(id: $id, input: { alt: $alt }) {
+// errors {
+// field
+// message
+// }
+// productImage {
+// id
+// alt
+// }
+// }
+// }
+// `;
diff --git a/saleor/static/dashboard-next/products/queries.ts b/saleor/static/dashboard-next/products/queries.ts
index 539e1301b8..ed15aba335 100644
--- a/saleor/static/dashboard-next/products/queries.ts
+++ b/saleor/static/dashboard-next/products/queries.ts
@@ -5,6 +5,8 @@ import {
ProductCreateDataQuery,
ProductDetailsQuery,
ProductDetailsQueryVariables,
+ ProductImageQuery,
+ ProductImageQueryVariables,
ProductListQuery,
ProductListQueryVariables,
ProductVariantCreateDataQuery,
@@ -383,7 +385,7 @@ export const productVariantCreateQuery = gql`
`;
export const TypedProductImageQuery = Query as React.ComponentType<
- QueryProps<ProductImageQuery, ProductImageVariables>
+ QueryProps<ProductImageQuery, ProductImageQueryVariables>
>;
export const productImageQuery = gql`
query ProductImage($productId: ID!, $imageId: String!) {
@@ -393,6 +395,7 @@ export const productImageQuery = gql`
cursor
node {
id
+ alt
url
}
}
diff --git a/saleor/static/dashboard-next/products/views/ProductImage.tsx b/saleor/static/dashboard-next/products/views/ProductImage.tsx
index e69de29bb2..bbd375f971 100644
--- a/saleor/static/dashboard-next/products/views/ProductImage.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductImage.tsx
@@ -0,0 +1,78 @@
+import * as React from "react";
+
+import { productUrl } from "..";
+import Navigator from "../../components/Navigator";
+import ProductImagePage from "../components/ProductImagePage";
+import {
+ productImageDeleteMutation,
+ TypedProductImageDeleteMutation
+} from "../mutations";
+import { productImageQuery, TypedProductImageQuery } from "../queries";
+
+interface ProductImageProps {
+ imageId: string;
+ productId: string;
+}
+
+export const ProductImage: React.StatelessComponent<ProductImageProps> = ({
+ imageId,
+ productId
+}) => (
+ <Navigator>
+ {navigate => {
+ const handleBack = () => navigate(productUrl(productId));
+ return (
+ <TypedProductImageQuery
+ query={productImageQuery}
+ variables={{ imageId, productId }}
+ >
+ {({ data }) => {
+ return (
+ <TypedProductImageDeleteMutation
+ mutation={productImageDeleteMutation}
+ onCompleted={handleBack}
+ >
+ {mutate => {
+ const handleDelete = () =>
+ mutate({ variables: { id: imageId } });
+ return (
+ <ProductImagePage
+ description={
+ data &&
+ data.product &&
+ data.product.image &&
+ data.product.image.edges &&
+ data.product.image.edges[0] &&
+ data.product.image.edges[0].node &&
+ data.product.image.edges[0].node.alt
+ ? data.product.image.edges[0].node.alt
+ : null
+ }
+ // TODO: unlock editing after API fixes
+ disabled={true}
+ image={
+ data &&
+ data.product &&
+ data.product.image &&
+ data.product.image.edges &&
+ data.product.image.edges[0] &&
+ data.product.image.edges[0].node &&
+ data.product.image.edges[0].node.url
+ ? data.product.image.edges[0].node.url
+ : null
+ }
+ onBack={handleBack}
+ onDelete={handleDelete}
+ onSubmit={() => {}}
+ />
+ );
+ }}
+ </TypedProductImageDeleteMutation>
+ );
+ }}
+ </TypedProductImageQuery>
+ );
+ }}
+ </Navigator>
+);
+export default ProductImage;
diff --git a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
index f4f638c508..68b1b51527 100644
--- a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
@@ -12,6 +12,7 @@ import i18n from "../../i18n";
import ProductUpdatePage from "../components/ProductUpdatePage";
import ProductUpdateOperations from "../containers/ProductUpdateOperations";
import {
+ productImageUrl,
productListUrl,
productVariantAddUrl,
productVariantEditUrl
@@ -86,6 +87,8 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
reorderProductImages,
updateProduct
}) => {
+ const handleImageEdit = (imageId: string) => () =>
+ navigate(productImageUrl(id, imageId));
const handleSubmit = data => {
if (product) {
updateProduct.mutate({
@@ -173,6 +176,7 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
});
}
}}
+ onImageEdit={handleImageEdit}
/>
);
}}
diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductImagePage.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductImagePage.tsx
index 97407f6388..42f1e85a1b 100644
--- a/saleor/static/dashboard-next/storybook/stories/products/ProductImagePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductImagePage.tsx
@@ -15,5 +15,5 @@ storiesOf("Views / Products / Product image details", module)
/>
))
.add("when loading data", () => (
- <ProductImagePage loading={true} onSubmit={() => {}} onBack={() => {}} />
+ <ProductImagePage disabled={true} onSubmit={() => {}} onBack={() => {}} />
));