/** * External dependencies */ import { DispatchFromMap } from '@automattic/data-stores'; /** * Internal dependencies */ import { CrudActions, CrudSelectors } from '../crud/types'; import { Product, ProductQuery, ReadOnlyProperties } from '../products/types'; import { CustomActions } from './actions'; import { CustomSelectors } from './selectors'; export type ProductVariationAttribute = { id: number; name: string; slug: string; option: string; }; /** * Product variation - Image properties */ export interface ProductVariationImage { /** * Image ID. */ id: number; /** * The date the image was created, in the site's timezone. */ readonly date_created?: string; /** * The date the image was created, as GMT. */ readonly date_created_gmt?: string; /** * The date the image was last modified, in the site's timezone. */ readonly date_modified?: string; /** * The date the image was last modified, as GMT. */ readonly date_modified_gmt?: string; /** * Image URL. */ src: string; /** * Image name. */ name: string; /** * Image alternative text. */ alt: string; } export type ProductVariation = Omit & Pick & { attributes: ProductVariationAttribute[]; /** * Variation image data. */ image?: ProductVariationImage; /** * Stock management at variation level. It can have a * 'parent' value if the parent product is managing * the stock at the time the variation was created. * * @default false */ manage_stock: boolean | 'parent'; /** * The product id this variation belongs to */ parent_id: number; }; export type PartialProductVariation = Partial & Pick; type Query = Omit & { product_id: number; has_price?: boolean; attributes?: { attribute: string; terms: string[]; }[]; }; type MutableProperties = Partial>; export type ProductVariationActions = CrudActions<'ProductVariation', ProductVariation, MutableProperties> & CustomActions; export type ProductVariationSelectors = CrudSelectors<'ProductVariation', 'ProductVariations', ProductVariation, Query, MutableProperties> & CustomSelectors; export type ActionDispatchers = DispatchFromMap; export type GenerateRequest = { delete?: boolean; default_values?: Partial; }; export type BatchUpdateRequest = { create?: Partial>[]; update?: (Pick & Partial>)[]; delete?: ProductVariation['id'][]; }; export type BatchUpdateResponse = { create?: ProductVariation[]; update?: ProductVariation[]; delete?: ProductVariation[]; }; export {}; //# sourceMappingURL=types.d.ts.map