diff --git a/framework/spree/types/index.ts b/framework/spree/types/index.ts index 6b5e98b05..1f3eb53a2 100644 --- a/framework/spree/types/index.ts +++ b/framework/spree/types/index.ts @@ -33,3 +33,14 @@ export interface SpreeProductImage extends JsonApiDocument { styles: ImageStyle[] } } + +export interface OptionTypeAttr extends JsonApiDocument { + attributes: { + name: string + presentation: string + position: number + created_at: string + updated_at: string + filterable: boolean + } +} diff --git a/framework/spree/utils/normalize-cart.ts b/framework/spree/utils/normalize-cart.ts index 676ddfbd8..c8e4ea69e 100644 --- a/framework/spree/utils/normalize-cart.ts +++ b/framework/spree/utils/normalize-cart.ts @@ -12,14 +12,14 @@ import type { JsonApiSingleResponse, } from '@spree/storefront-api-v2-sdk/types/interfaces/JsonApi' import type { OrderAttr } from '@spree/storefront-api-v2-sdk/types/interfaces/Order' -import { ProductAttr } from '@spree/storefront-api-v2-sdk/types/interfaces/Product' +import type { ProductAttr } from '@spree/storefront-api-v2-sdk/types/interfaces/Product' import type { RelationType } from '@spree/storefront-api-v2-sdk/types/interfaces/Relationships' import createGetAbsoluteImageUrl from './create-get-absolute-image-url' import getMediaGallery from './get-media-gallery' import { findIncluded, findIncludedOfType } from './find-json-api-documents' +import type { OptionTypeAttr } from '@framework/types' -const isColorProductOption = (productOptionType: any) => { - // TODO: Fix type and merge with isColorProductOption in framework/spree/utils/expandOptions.ts +const isColorProductOption = (productOptionType: OptionTypeAttr) => { return productOptionType.attributes.presentation === 'Color' }