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AoB,EACA,CACE,qBAAsB,8BAIf,GAGjB,CAEO,SAAS+D,IACd,MAAMzF,GAAcC,EAAAA,EAAAA,kBACdH,GAAUC,EAAAA,EAAAA,cAChB,OAAOK,EAAAA,EAAAA,aAAY,CACjBC,WAAaC,IACX,MAAMoF,EAAuBpF,EAAKqF,SAElC,OAAO7F,EACL,mJACA,CACE8F,aAAc,GACdzB,KAAMuB,GAET,EAEHjF,QAASoB,UACP7B,EAAYa,kBAAkB,CAC5BC,SAAU,CACR,oJAEF,EAEJF,UAAWiB,UACT7B,EAAYa,kBAAkB,CAC5BC,SAAU,CACR,oJAEF,GAGR,CAaO,SAAS+E,IACd,MAAM/F,GAAUC,EAAAA,EAAAA,cACV+F,GAAeC,EAAAA,EAAAA,mBACfC,EAAaF,GAAcE,YAAc,GACzCC,EAAwB,KAAfD,EAAoBA,EAAWE,MAAM,EAAG,GAAK,GAE5D,OAAO9F,EAAAA,EAAAA,aAAY,CACjBC,WAAa8F,IACX,MAAM7F,EAAkB,IACnB6F,EAAeC,cAClBH,SACAI,SAAUF,EAAeE,SACzBC,eAAgBH,EAAeG,eAC/BC,oBAAoB,EACpBC,gBAAiBL,EAAeK,gBAChCC,MAAON,EAAeO,iBACtBC,UAAWR,EAAeQ,UAC1BC,YAAaT,EAAeS,aAY9B,OATa9G,EACX,yCACAQ,EACA6F,EAAe/E,OACf,CACE,qBAAsB,0BAIf,GAGjB,C","sources":["webpack:///./src/hooks/use-add-to-favorite.ts","webpack:///./src/hooks/use-favorites.ts","webpack:///./src/utils/delay.util.ts","webpack:///./src/hooks/use-add-to-cart.ts","webpack:///./src/hooks/use-extendedsummary.ts","webpack:///./src/hooks/use-pna-pricing.ts"],"sourcesContent":["import { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { useApiPost, useApiDelete } from 'mf_core/query';\nimport { useUserInfo } from 'mf_core/auth';\n\nexport function useAddToFavoriteMutation() {\n const apiPost = useApiPost<boolean>();\n const queryClient = useQueryClient();\n const userInfo = useUserInfo();\n\n return useMutation({\n mutationFn: (body: { sku: string }) => {\n const requestAddToFavorite: AddToFavoriteRequestTO = {\n sku: body.sku,\n };\n const data = apiPost(\n '/product/v1/users/favorite-product',\n requestAddToFavorite\n );\n return data;\n },\n onError: (error) => {\n console.error(error);\n },\n onSuccess: () => {\n queryClient.invalidateQueries({\n queryKey: [\n `/product/v1/users/${\n userInfo && userInfo.preferred_username\n }/favoriteproductids`,\n ],\n });\n queryClient.invalidateQueries({\n queryKey: [\n `/product/v1/users/${\n userInfo && userInfo.preferred_username\n }/favoriteproducts`,\n ],\n });\n },\n });\n}\n\nexport function useDeleteFavoriteMutation() {\n const apiDelete = useApiDelete<boolean>();\n const queryClient = useQueryClient();\n const userInfo = useUserInfo();\n\n return useMutation({\n mutationFn: (body: { sku: string }) => {\n const requestAddToFavorite: AddToFavoriteRequestTO = {\n sku: body.sku,\n };\n const data = apiDelete(\n '/product/v1/users/favorite-product',\n requestAddToFavorite\n );\n return data;\n },\n onError: (error) => {\n console.error(error);\n },\n onSuccess: () => {\n queryClient.invalidateQueries({\n queryKey: [\n `/product/v1/users/${\n userInfo && userInfo.preferred_username\n }/favoriteproducts`,\n ],\n });\n queryClient.invalidateQueries({\n queryKey: [\n `/product/v1/users/${\n userInfo && userInfo.preferred_username\n }/favoriteproductids`,\n ],\n });\n },\n });\n}\n\nexport type AddToFavoriteRequestTO = {\n sku: string;\n};\n","import { useApiQuery } from 'mf_core/query';\nimport { useUserInfo } from 'mf_core/auth';\nimport { Products } from '../types/productsearchresponse.types';\nimport { ProductSearchRequestTO } from '../types/productsearchrequest.types';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { delay } from '../utils/delay.util';\n\nexport function useFavorites(params: ProductSearchRequestTO) {\n const userInfo = useUserInfo();\n return useApiQuery<Products>(\n `/product/v1/users/${\n userInfo && userInfo.preferred_username\n }/favoriteproducts`,\n params,\n { enabled: Boolean(userInfo), refetchOnMount: 'always' }\n );\n}\n\nexport function useFavoriteProductIds() {\n const userInfo = useUserInfo();\n return useApiQuery<ProductIdsTO>(\n `/product/v1/users/${\n userInfo && userInfo.preferred_username\n }/favoriteproductids`,\n undefined,\n { enabled: Boolean(userInfo), refetchOnMount: 'always' }\n );\n}\n\nexport function useModifyFavoritesMutation(_sku: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (variables: any) => {\n const previousFavoritesData = queryClient.getQueryData<any>([\n 'favorites',\n ]);\n const newFavoritesData = {\n ...previousFavoritesData,\n properties: { ...variables },\n };\n await saveFavorite();\n return { newFavoritesData, previousFavoritesData };\n },\n onError: (_data, _variables, context: any) => {\n queryClient.setQueryData(['favorites'], context.previousFavoritesData);\n },\n onSuccess: (_data, _variables, context: any) => {\n queryClient.setQueryData(['favorites'], context.newFavoritesData);\n },\n });\n}\n\nasync function saveFavorite() {\n //TO DO: Make call to favorite CRUD api here\n await delay(1000);\n return Promise.resolve(true);\n}\n\nexport type ProductIdsTO = {\n productIds: string[];\n};\n","export function delay(time: number) {\n return new Promise((resolve) => setTimeout(resolve, time));\n}\n","import { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { useApiPost } from 'mf_core/query';\n\nexport function useAddToCartMutation() {\n const apiPost = useApiPost<boolean>();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: (body: {\n engineId?: string;\n placementLocation?: string | undefined;\n qty: number;\n recommendationId?: string;\n sku: string;\n }) => {\n const requestAddToCart: AddToCartRequestTO = {\n engineId: body.engineId || '',\n quantity: body.qty,\n recommendationId: body.recommendationId || '',\n sku: body.sku,\n };\n const data = apiPost(\n '/cart/v1/cart-operations/default/add-product-lines-lite',\n requestAddToCart\n );\n return data;\n },\n onError: (error) => {\n console.error(error);\n },\n onSuccess: (data, body) => {\n queryClient.invalidateQueries({\n queryKey: ['/cart/v1/cart-list/default/header-data'],\n });\n if (body.placementLocation === 'CartPageZone') {\n queryClient.invalidateQueries({\n queryKey: ['/cart/v1/cart-data/default', null, null],\n });\n }\n },\n });\n}\n\nexport function useAddToCartMultipleMutation() {\n const apiPost = useApiPost<boolean>();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: (listOfProducts: any[]) => {\n const data = apiPost(\n '/cart/v1/cart-operations/default/add-multiple-product-lines-lite',\n listOfProducts\n );\n return data;\n },\n onError: (error) => {\n console.error(error);\n },\n onSuccess: (data, body) => {\n queryClient.invalidateQueries({\n queryKey: ['/cart/v1/cart-list/default/header-data'],\n });\n },\n });\n}\n\nexport type AddToCartRequestTO = {\n engineId?: string;\n quantity: number;\n recommendationId?: string;\n sku: string;\n};\n","/* eslint-disable max-lines */\nimport { useApiGet, useApiQuery } from 'mf_core/query';\nimport { useMutation } from '@tanstack/react-query';\nimport { MediaTO } from './use-productmedia';\n\n/*\nThis function returns extended summary.\nparam: It expects sku as input parameter.\n*/\n\nexport function useExtendedSummaryQuery(sku: string, inculture: string) {\n return useApiQuery<AttributesResultTO>(\n `/product-details/v1/product-summaries/${sku}/attributes?q=all`,\n {\n culture: inculture,\n },\n {\n enabled: Boolean(sku && sku !== ''),\n },\n undefined,\n { isLogoutApi: true }\n );\n}\n\nexport function useExtendedSummaryQueryMutation() {\n const apiGet = useApiGet<AttributesResultTO>();\n return useMutation({\n mutationFn: (params: any) => {\n let url = `/product-details/v1/product-summaries/${\n params.sku\n }/attributes?q=all&enableClientSidePNA=${\n params.enableClientSidePNA ?? false\n }`;\n\n if (params?.culture) {\n url += `&culture=${params?.culture}`;\n }\n const data = apiGet(url, {\n 'IM-MicroFrontendID': 'cep_app_pdp_recommendation',\n });\n\n return data;\n },\n });\n}\n\n/*\nThis function returns extended summary.\nparam: It expects sku list as input parameter.\n*/\nexport function useExtendedSummaryLightQueryMutation() {\n const apiGet = useApiGet<LightSummaryResultTO>();\n\n return useMutation({\n mutationFn: (skulist: string) => {\n const data = apiGet(\n `/product/v1/productsummaries?q={'productIdentifiers':${skulist}, 'webonly': true,'vendorAuthorization': true}`\n );\n\n return data;\n },\n });\n}\n\nexport function useExtendedSummaryLightQuery(skulist: string) {\n return useApiQuery<LightSummaryResultTO>(\n `/product/v1/productsummaries?q={'productIdentifiers':[${skulist}]}`\n );\n}\n\nexport type LightSummaryResultTO = {\n productSummaries: ProductSummaryTO[];\n};\n\nexport type ProductSummaryTO = {\n addToCart: AddToCartTO;\n flags: FlagDefTO[];\n globalpartnumber: string;\n imageUrl: string;\n inventoryInformation: InventoryInformationTO;\n isAuthorizedToBuy: boolean;\n isdirectship: boolean;\n isdirectshiporderable: boolean;\n isdownloadable: boolean;\n islicenseproduct: boolean;\n iswarranty: boolean;\n languagecode: string;\n manufacturePartNumber: string;\n partNumber: string;\n pricingInformation: LightPricingInformationTO;\n shortdescription: string;\n skutype: string;\n upcean: string;\n vendorSubRange: string;\n vendorcode: string;\n vendorname: string;\n};\ntype LightPricingInformationTO = {\n currency: string;\n customerPrice: number;\n customerPriceString: string;\n dealerPrice: number;\n discountAmount: number;\n msrpPrice: number;\n msrpPriceString: string;\n taxTotal: number;\n};\ntype LightWareHouseListTO = {\n estimatedLeadTime: string;\n id: string;\n name: string;\n onOrderQuantity: number;\n quantityAvailable: number;\n warehouseLocation: string;\n};\ntype InventoryInformationTO = {\n message: string;\n totalAvailableQuantity: number;\n warehouseDetails: LightWareHouseListTO[];\n};\n\nexport type SpecificationTO = {\n attributedisplay: string;\n attributename: string;\n attributevalue: string;\n headername: string;\n};\ntype FutureBulletPointsTO = {\n sequence: number;\n value: string;\n};\nexport type IndicatorsTO = {\n hasacopquantitybreak: boolean;\n hasacopspecialprice: boolean;\n hasacopwebdiscount: boolean;\n hasbundle: boolean;\n hascrosssell: boolean;\n hasreturnlimits: boolean;\n hasspecialbid: boolean;\n hasstdquantitybreak: boolean;\n hasstdspecialprice: boolean;\n hasstgwebdiscount: boolean;\n hasstock: boolean;\n hasstockororder: boolean;\n haswarranty: boolean;\n isblowout: boolean;\n isclearanceproduct: boolean;\n iscustownproduct: boolean;\n isdigitaltype: boolean;\n isdirectship: boolean;\n isdirectshiporderable: boolean;\n isdiscontinued: boolean;\n isdownloadable: boolean;\n isenduserrequired: boolean;\n isexportabletocountry: boolean;\n isheavyweight: boolean;\n ishptopconfigproduct: boolean;\n islicenseproduct: boolean;\n islremodel: boolean;\n isltl: boolean;\n isoversizeproduct: boolean;\n ispreorderproduct: boolean;\n ispurchasable: boolean;\n isrefurbished: boolean;\n isreplacementproduct: boolean;\n iswarranty: boolean;\n newproduct: boolean;\n replacementtype: null;\n skutype?: string;\n};\ntype ProductWeightTO = {\n plantId: string;\n weight: number;\n weightUnit: string;\n};\ntype ProductMeasurementTO = {\n dimensionunit: null;\n height: string;\n isBulkFreight: boolean;\n length: string;\n netWeight: string;\n productWeight: ProductWeightTO[];\n width: string;\n};\nexport type PnaResponseTO = {\n hasReserveStocks: boolean;\n message: string;\n pricing: PricingTO;\n sku: string;\n totalAvailableQuantity: number;\n upc: string;\n warehouseList: WarehouseListTO[];\n};\n\nexport type PricingTO = {\n averageCost: number;\n costIngram: number;\n costIngram1: number;\n currencyCode: string;\n customerPrice: number;\n customerPriceString: string;\n dealerPrice: number;\n dealerPrice1: number;\n exchangeRate: number;\n extendedNetAmount: number;\n hardPriceFloor: number;\n hardPriceFloorEligible: string;\n mapPrice: number;\n msrpPriceString: string;\n panRetailPrice: number;\n priceDerived: string;\n purchaseCurrency: string;\n replacementCost: number;\n retailPrice: number;\n salesCurrency: string;\n specialBidPrice: true;\n taxAmount: number;\n totalAcopApplicablePrice: number;\n totalAcopDelta: number;\n totalEnvironmentFee: number;\n totalFeeAmount: number;\n totalPromotionAmount: number;\n};\n\nexport type QuantityOnOrderTO = {\n date: string;\n leadDays: string;\n quantity: number;\n uom: string;\n};\n\nexport type PricingInformation = {\n availablequantity: number;\n currency: string;\n customerPrice: number;\n dealerPrice: number;\n discountAmount: number;\n msrpPrice: number;\n taxTotal: number;\n};\n\nexport type WarehouseListTO = {\n averageCost: number;\n committedQuantity: number;\n etaDate: string;\n leadTimeETA: string;\n numberransitQuantity: number;\n onOrderQuantity: number;\n onholdQuantity: number;\n quantityOnOrder: QuantityOnOrderTO;\n totalAvailableQuantity: number;\n warehouseAvailableQuantity: number;\n warehouseDescription: string;\n warehouseLocation: string;\n warehousseId: string;\n};\n\nexport interface AttributesTO {\n aPlusProvider: string;\n campaign: CampaignTO[];\n energyEfficiencyClass: string[];\n featureBulletPoints: FutureBulletPointsTO[];\n globalpartnumber: string;\n indicators: IndicatorsTO;\n isAuthorised: boolean;\n language: string;\n longDescription: string;\n marketingText: string;\n pna: PricingInformation;\n productMeasurement: ProductMeasurementTO;\n prop65Warning: string;\n shortDescription: string;\n sku: string;\n specifications: SpecificationTO[];\n upc: string;\n vendorAuthMessage: string;\n vendorCode: string;\n vendorName: string;\n vendorPartNumber: string;\n vendorSubRange: string;\n}\n\nexport type MsrpPriceConfigTo = {\n showExcl_Label: string;\n showIncl_Label: string;\n showMSRPInLoggedIn: boolean;\n showMSRPInLoggedOut: boolean;\n};\n\nexport type ConfigbackofficeTO = {\n msrpPriceConfig: MsrpPriceConfigTo;\n productDetailsLoginMode: PriceConfigTO;\n warrantyUrl: string;\n};\n\nexport type PriceConfigTO = {\n msrpExclTax: boolean;\n priceExclTax: boolean;\n priceInclTax: boolean;\n};\n\nexport type FlagDefTO = {\n displayName: string;\n displayPosition: number;\n toolTipText?: string;\n};\nexport type AddToCartTO = {\n isDisableAddToCart: boolean;\n sku: string;\n tooltip: string;\n};\n\nexport type AttributesResultTO = {\n addToCart: AddToCartTO[];\n additionalAttributes: AttributesTO[];\n configbackOffice: ConfigbackofficeTO;\n flags: FlagDefTO[];\n pnaResponse: PnaResponseTO[];\n};\nexport type PDFFilter = {\n branding: boolean;\n brandnone: boolean;\n isallsections: boolean;\n isbrandingrammicro: boolean;\n isownprice: boolean;\n isproductimage: boolean;\n isrrpexceltax: boolean;\n isstockstatus: boolean;\n isvpnsku: boolean;\n selectedsection: boolean;\n};\nexport type PrintPriceConfigTO = {\n branding: string;\n priceProperty: {\n OwnPrice: boolean;\n OwnPriceText: string;\n VPNSKU: boolean;\n extendedSpecification: boolean;\n msrpexclTax: boolean;\n priceExclTax: boolean;\n productImage: boolean;\n stock: boolean;\n };\n selectAll: boolean;\n};\n\nexport type EmailRequestTO = {\n additionalAttributes: AttributesTO[];\n galleryImages: MediaTO;\n translatedValues: TranslationTO;\n};\n\nexport type TranslationTO = {\n customerPriceText: string;\n descriptionText: string;\n extrafees: string;\n headerText: string;\n msrpText: string;\n specificationText: string;\n};\nexport type CampaignTO = {\n promotioncode: string;\n promotionpoints: string;\n promotiontype: string;\n};\n","import { ObjectMap, useApiPost } from 'mf_core/query';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { useDecodedToken } from 'mf_core/auth';\n\nexport function usePNAPricing() {\n const apiPost = useApiPost();\n\n return useMutation({\n mutationFn: (skusList: Array<ObjectMap>) => {\n const body: ObjectMap = {\n item: skusList.map((skuData: ObjectMap) => {\n if (skuData.isCmp) {\n return {\n planId: skuData.planId,\n pricingSource:\n Number(\n skuData?.subscriptionOption?.parentSubscriptionPlan\n ?.pricingSource\n ) ?? null,\n resources: skuData.resources,\n subscriptionPeriods: skuData.subscriptionPeriods,\n };\n } else if (skuData.isNonTransactional) {\n return {\n ingramPartNumber: skuData.partNumber,\n productExtendedSpecs: skuData.productExtendedSpecs,\n vendorPartNumber: skuData.manufacturePartNumber,\n };\n } else {\n return {\n ingramPartNumber: skuData.partNumber,\n licenseSelectorVendorSubrange: skuData.vendorSubRange,\n skuType: skuData.skuType,\n vendorCode: skuData.vendorCode ?? skuData.vendorcode,\n };\n }\n }),\n };\n\n const data = apiPost(\n '/pricing-and-availability/v1/pnas?pnaFilters=includeAvailability=true&includePricing=true&includeProductAttributes=true&includeDiscounts=false&enablePnaLite=true',\n body,\n undefined,\n {\n 'IM-MicroFrontendID': 'cep_app_pdp_recommendation',\n }\n );\n\n return data;\n },\n });\n}\n\nexport function useUpdateCMPPricing() {\n const queryClient = useQueryClient();\n const apiPost = useApiPost();\n return useMutation({\n mutationFn: (body: { pnaitems: ObjectMap }) => {\n const pnaParams: ObjectMap = body.pnaitems;\n\n return apiPost(\n '/pricing-and-availability/v1/pnas?pnaFilters=includeAvailability=true&includePricing=false&includeProductAttributes=false&includeDiscounts=false',\n {\n cmpEndUserId: '',\n item: pnaParams,\n }\n );\n },\n onError: async (error) => {\n queryClient.invalidateQueries({\n queryKey: [\n `pricing-and-availability/v1/pnas?pnaFilters=includeAvailability=true&includePricing=false&includeProductAttributes=false&includeDiscounts=false`,\n ],\n });\n },\n onSuccess: async (data) => {\n queryClient.invalidateQueries({\n queryKey: [\n `pricing-and-availability/v1/pnas?pnaFilters=includeAvailability=true&includePricing=false&includeProductAttributes=false&includeDiscounts=false`,\n ],\n });\n },\n });\n}\n\nexport type DiscountParams = {\n discountTypes: ObjectMap;\n forLabel: boolean;\n isCartPageCall?: boolean;\n isQuotePageCall?: boolean;\n params?: ObjectMap;\n productLineItems: ObjectMap[];\n quoteGuid?: string;\n quoteNumber?: string;\n};\n\nexport function useDiscountMutation() {\n const apiPost = useApiPost();\n const decodedToken = useDecodedToken();\n const resellerId = decodedToken?.resellerId || '';\n const branch = resellerId !== '' ? resellerId.slice(0, 2) : '';\n\n return useMutation({\n mutationFn: (discountParams: DiscountParams) => {\n const body: ObjectMap = {\n ...discountParams.discountTypes,\n branch,\n forLabel: discountParams.forLabel,\n isCartPageCall: discountParams.isCartPageCall,\n isGlobalSkuEnabled: false,\n isQuotePageCall: discountParams.isQuotePageCall,\n items: discountParams.productLineItems,\n quoteGuid: discountParams.quoteGuid,\n quoteNumber: discountParams.quoteNumber,\n };\n\n const data = apiPost(\n '/pricing-and-availability/v1/discounts',\n body,\n discountParams.params,\n {\n 'IM-MicroFrontendID': 'cep_app_recommendation',\n }\n );\n\n return data;\n },\n });\n}\n"],"names":["useAddToFavoriteMutation","apiPost","useApiPost","queryClient","useQueryClient","userInfo","useUserInfo","useMutation","mutationFn","body","requestAddToFavorite","sku","onError","error","console","onSuccess","invalidateQueries","queryKey","preferred_username","useDeleteFavoriteMutation","apiDelete","useApiDelete","useFavorites","params","useApiQuery","enabled","Boolean","refetchOnMount","useFavoriteProductIds","undefined","useModifyFavoritesMutation","_sku","async","previousFavoritesData","getQueryData","newFavoritesData","properties","variables","Promise","resolve","setTimeout","saveFavorite","_data","_variables","context","setQueryData","useAddToCartMutation","requestAddToCart","engineId","quantity","qty","recommendationId","data","placementLocation","useAddToCartMultipleMutation","listOfProducts","useExtendedSummaryQuery","inculture","culture","isLogoutApi","useExtendedSummaryQueryMutation","apiGet","useApiGet","url","enableClientSidePNA","useExtendedSummaryLightQueryMutation","skulist","useExtendedSummaryLightQuery","usePNAPricing","skusList","item","map","skuData","isCmp","planId","pricingSource","Number","subscriptionOption","parentSubscriptionPlan","resources","subscriptionPeriods","isNonTransactional","ingramPartNumber","partNumber","productExtendedSpecs","vendorPartNumber","manufacturePartNumber","licenseSelectorVendorSubrange","vendorSubRange","skuType","vendorCode","vendorcode","useUpdateCMPPricing","pnaParams","pnaitems","cmpEndUserId","useDiscountMutation","decodedToken","useDecodedToken","resellerId","branch","slice","discountParams","discountTypes","forLabel","isCartPageCall","isGlobalSkuEnabled","isQuotePageCall","items","productLineItems","quoteGuid","quoteNumber"],"sourceRoot":""}