import { EventBusService, Product, ProductStatus, ProductVariantService, ShippingProfileService, TransactionBaseService } from "@medusajs/medusa"; import { Logger } from "@medusajs/medusa/dist/types/global"; import { CreateProductProductOption, CreateProductProductTagInput } from "@medusajs/medusa/dist/types/product"; import { ClientOptions } from "interfaces/shopify-interfaces"; import { EntityManager } from "typeorm"; import { MultiStoreProductService } from "./modified-core-services/multistore-product"; import ShopifyClientService from "./shopify-client"; import ShopifyRedisService from "./shopify-redis"; import { AwilixContainer } from "awilix"; export interface ShopifyProductServiceParams { manager: EntityManager; productService: MultiStoreProductService; productVariantService: ProductVariantService; shippingProfileService: ShippingProfileService; shopifyClientService: ShopifyClientService; shopifyRedisService: ShopifyRedisService; eventBusService: EventBusService; logger: Logger; } export type NormalisedProduct = { title: string; handle: string; description: string; profile_id: string; type: { value: string; }; is_giftcard: boolean; options?: CreateProductProductOption[]; variants?: any[]; tags?: CreateProductProductTagInput[]; images?: string[]; thumbnail?: string; external_id: string; status: ProductStatus; metadata?: { vendor?: string; }; store_id?: string; }; export type ShopifyProduct = { id: string; title?: string; handle?: string; type?: string; product_type?: string; body_html?: string; tags?: string; }; export type ShopifyVariant = { option3?: any; option2?: any; option1?: any; presentment_prices?: string; sku?: string; barcode?: string; inventory_quantity?: string; position?: string; inventory_policy?: string; inventory_management?: string; id: string; price?: number; grams?: number; inventory_police?: string; title?: string; }; export type UpdateProductAction = { product: ShopifyProduct; }; export type UpdateVariantAction = { variant: ShopifyVariant; }; declare class ShopifyProductService extends TransactionBaseService { static LIFE_TIME: import("awilix").LifetimeType; options: ClientOptions; productService_: MultiStoreProductService; productVariantService_: ProductVariantService; shippingProfileService_: ShippingProfileService; shopify_: ShopifyClientService; redis_: ShopifyRedisService; logger: Logger; eventBusService: EventBusService; container: AwilixContainer; constructor(container: ShopifyProductServiceParams, options: any); withTransaction(transactionManager: any): this; /** * Creates a product based on an event in Shopify. * Also adds the product to a collection if a collection id is provided * @param {object} data * @param {string} collectionId optional * @return {Product} the created product */ create(data: any, store_id?: string): Promise; update(existing: any, shopifyUpdate: any): Promise; /** * Deletes a product based on an event in Shopify * @param {string} id * @return {Promise} */ delete(id: any): Promise; shopifyProductUpdate(id: any, fields: any): Promise; shopifyVariantUpdate(id: any, fields: any): Promise; shopifyVariantDelete(productId: any, metadata: any): Promise; updateCollectionId(productId: any, collectionId: any): Promise; updateVariants_(product: NormalisedProduct & { id: string; }, updateVariants: any): Promise; deleteVariants_(product: any, updateVariants: any): Promise; addVariantOptions_(variant: any, productOptions: any): Promise; addProductOptions_(product: any, updateOptions: any): Promise; getShippingProfile_(isGiftCard: any): Promise; /** * Normalizes a product, with a possible optional collection id * @param {object} product * @param {string} collectionId optional * @return {object} normalized object */ normalizeProduct_(product: any, store_id?: string): NormalisedProduct; /** * Normalizes a product option * @param {object} option * @return {object} normalized ProductOption */ normalizeProductOption_(option: any): any; /** * Normalizes a product variant * @param {object} variant * @return {object} normalized variant */ normalizeVariant_(variant: ShopifyVariant): any; /** * Normalizes an array of presentment prices * @param {array} presentmentPrices * @return {Object[]} array of normalized prices */ normalizePrices_(presentmentPrices: any): any; /** * Normalizes the three possble variant options * @param {string} option1 * @param {string} option2 * @param {string} option3 * @return {Object[]} normalized variant options */ normalizeVariantOptions_(option1: any, option2: any, option3: any): any; /** * Normalizes a tag * @param {string} tag * @return {Object} normalized Tag */ normalizeTag_(tag: any): any; handleDuplicateConstraint_(uniqueVal: any): string; testUnique_(uniqueVal: any, type: any): Promise; ensureVariantUnique_(variant: any): Promise; removeUniqueConstraint_(update: any): any; handleError(e: any): Promise; handleWarn(e: any): Promise; } export default ShopifyProductService;