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C,KAA0B,0CAC3E,MAAM,MAAEpC,SAAgB,EAAA2B,EAAA,MAExB,aADmB2I,EAAA,EAAUpI,uBAAuBlC,EAAOmC,EAAcC,EAE7E,KAGJ,O","sources":["webpack:///./src/microApps/common/api/recipe/directRecipeAxiosClient.ts","webpack:///./src/microApps/common/api/recipe/recipeApi.ts","webpack:///./src/microApps/common/api/recipe/utils.ts","webpack:///./src/microApps/common/utils/recipeUtils.ts","webpack:///./src/microApps/common/api/clients/directGastrofyAxiosClient.ts","webpack:///./src/microApps/recipe/flow/recipeFlow.ts","webpack:///./src/microApps/common/api/recipe/distributionAdApi.ts","webpack:///./src/microApps/common/api/gastrofy/gastrofyApi.ts"],"sourcesContent":["import { type AxiosInstance, type AxiosRequestConfig, AxiosHeaders } from 'axios';\n\nimport { appConfig } from '../../../../appConfig';\nimport axiosClientFactory from '../clients/clientFactory';\n\nconst getDirectRecipeAxiosClient = (accessToken: string | null): AxiosInstance => {\n const config: AxiosRequestConfig = {\n baseURL: appConfig.coopSettings.recipe.apiUrl,\n params: {\n 'api-version': 'v1',\n },\n };\n\n const headers = new AxiosHeaders();\n if (accessToken) {\n headers.set('Authorization', `Bearer ${accessToken}`);\n }\n\n config.headers = headers;\n\n const client = axiosClientFactory.createDirectApiClient(config);\n return client;\n};\n\nexport default getDirectRecipeAxiosClient;\n","/**\n * Based on https://apitest.coop.se/recipe/swagger/index.html\n * Note: add more functions here if you need them\n */\n\nimport type {\n ApiCategoriesUrlOrder,\n ApiFavouriteRecipe,\n ApiRecipe,\n ApiRecipeComment,\n} from '../../../../models/recipe/recipeModel';\nimport { getAuthToken } from '../auth/getAuthToken';\nimport hybrisAxiosClient from '../clients/hybrisAxiosClient';\nimport getDirectRecipeAxiosClient from './directRecipeAxiosClient';\nimport type {\n ApiFilterRecipes,\n ApiNorthforkSearchRecipesByEanRequest,\n ApiRecipeCategory,\n ApiRecipeList,\n ApiRecipeProductItem,\n ApiResolveProductsRequest,\n NorthforkSearchResult,\n} from './recipeModels';\nimport type { ApiSaveCommentRequest } from './requests/recipeRequests';\nimport recipeApiUtils from './utils';\n\nconst getRecipesById = async (recipeIds: (string | number)[]): Promise<ApiRecipe[]> => {\n if (recipeIds?.length > 0) {\n // API doesn't allow \"?recipeIds[]=\"\"\n const queryWithoutBrackets = recipeApiUtils.createArrayParamWithoutBrackets(\n 'recipeIds',\n recipeIds,\n );\n const response = await getDirectRecipeAxiosClient(null).get(\n `recipes${queryWithoutBrackets}`,\n );\n return response.data;\n }\n return [];\n};\n\nconst getRecipeById = async (recipeId: string | number): Promise<ApiRecipe> => {\n const response = await getDirectRecipeAxiosClient(null).get(`recipes/${recipeId}`);\n\n return response.data;\n};\n\n/** Note: annymous users are also able to rate recipes */\nconst rateRecipe =\n (token: string | null) =>\n async ({\n recipeId,\n rating1to5,\n }: {\n recipeId: string;\n rating1to5: number;\n }): Promise<200 | 400> => {\n const response = await getDirectRecipeAxiosClient(token).post(\n `/recipes/${recipeId}/rating`,\n {\n rating: rating1to5,\n },\n );\n\n return response.data;\n };\n\nconst getRecipeUserRatings =\n (token: string) =>\n async (recipeId: number): Promise<{ recipeId: number; rating: number }> => {\n const response = await getDirectRecipeAxiosClient(token).get(\n `/recipes/${recipeId}/rating/me`,\n );\n\n return response.data;\n };\n\nconst getFavouriteRecipes = (token: string) => async (): Promise<ApiFavouriteRecipe[]> => {\n const response = await getDirectRecipeAxiosClient(token).get('/favorites/me');\n\n return response.data;\n};\n\nconst saveFavouriteRecipe =\n (token: string) =>\n async (recipeId: string): Promise<boolean> => {\n const response = await await getDirectRecipeAxiosClient(token).post<{\n addFavoriteRecipeResult: boolean;\n }>(`/recipes/${recipeId}/favorite`);\n\n return response?.data?.addFavoriteRecipeResult || false;\n };\n\nconst removeFavouriteRecipe =\n (token: string) =>\n async (recipeId: string): Promise<boolean> => {\n const response = await await getDirectRecipeAxiosClient(token).delete<{\n removeFavoriteRecipeResult: boolean;\n }>(`/recipes/${recipeId}/favorite`);\n\n return response?.data?.removeFavoriteRecipeResult || false;\n };\n\nconst getRecipeSingleMetaDataByCategoriesBatch = async (\n data: Record<string, { category1: string; category2?: string }>,\n) => {\n const client = getDirectRecipeAxiosClient(null);\n const response = await client.post('/categories/meta-data/batch', data);\n return response.data;\n};\n\nconst getCategoriesUrlOrderData = async (): Promise<ApiCategoriesUrlOrder> => {\n const client = getDirectRecipeAxiosClient(null);\n const response = await client.get('/categories/url-order');\n\n return response.data;\n};\n\nconst getNorthforkSearchRecipeByEan = async (\n body: ApiNorthforkSearchRecipesByEanRequest,\n): Promise<NorthforkSearchResult> => {\n const { token } = await getAuthToken();\n const client = await getDirectRecipeAxiosClient(token);\n const response = await client.post('/northfork/search/ean', body);\n\n return response.data;\n};\n\nconst resolveRecipes = async (request: ApiResolveProductsRequest, storeId: string) => {\n const response = await hybrisAxiosClient.post<ApiRecipeList>(\n `/recipe/products/resolve`,\n request,\n {\n params: { storeId },\n },\n );\n return response.data;\n};\n\nconst getRecipeSubstitutes = async (storeId: string, substituteIdentifier: string) => {\n const requestQueryParams = {\n storeId,\n substituteIdentifier,\n };\n\n const response = await hybrisAxiosClient.get<ApiRecipeProductItem[]>('/recipe/substitute', {\n params: requestQueryParams,\n });\n return response.data;\n};\n\nconst getRecipeComments = async (recipeExternalId: string): Promise<ApiRecipeComment[]> => {\n const response = await getDirectRecipeAxiosClient(null).get(\n `/recipes/${recipeExternalId}/comments`,\n );\n return response.data;\n};\n\nconst saveRecipeComment =\n (token: string) =>\n async (request: ApiSaveCommentRequest): Promise<void> => {\n const response = await getDirectRecipeAxiosClient(token).post(\n `/recipes/${request.recipeExternalId}/comment`,\n { name: request.authorName, comment: request.comment },\n );\n return response.data;\n };\n\nconst getRecipeCategoriesById = async (recipeExternalId: string): Promise<ApiRecipeCategory[]> => {\n const response = await getDirectRecipeAxiosClient(null).get(\n `/recipes/${recipeExternalId}/categories`,\n );\n return response.data;\n};\n\nconst getRecipeCategories = async (): Promise<ApiRecipeCategory[]> => {\n const response = await getDirectRecipeAxiosClient(null).get(`/categories`);\n return response.data;\n};\n\nconst filterRecipesAdminTool = async (\n token: string,\n filterString: string,\n excludeList: string[],\n): Promise<ApiFilterRecipes> => {\n const response = await getDirectRecipeAxiosClient(token).post(`/recipes/filter`, {\n filter: filterString,\n exclude: excludeList,\n });\n\n return response.data;\n};\n\nexport default {\n getRecipeById,\n getRecipesById,\n rateRecipe,\n getRecipeUserRatings,\n getRecipeComments,\n saveRecipeComment,\n getFavouriteRecipes,\n saveFavouriteRecipe,\n removeFavouriteRecipe,\n getRecipeSingleMetaDataByCategoriesBatch,\n getCategoriesUrlOrderData,\n getRecipeCategoriesById,\n getRecipeCategories,\n northfork: {\n getRecipesByEans: getNorthforkSearchRecipeByEan,\n },\n resolveRecipes,\n getRecipeSubstitutes,\n filterRecipesAdminTool,\n};\n","const createArrayParamWithoutBrackets = (queryName: string, values: (string | number)[]) => {\n if (values?.length > 0) {\n return `?${queryName}=${values.join(`&${queryName}=`)}`;\n }\n\n return '';\n};\n\nexport default {\n createArrayParamWithoutBrackets,\n};\n","import { appConfig } from '../../../appConfig';\nimport type {\n ApiRecipe,\n ApiRecipeComment,\n ApiRecipeIngredient,\n ApiRecipePart,\n} from '../../../models/recipe/recipeModel';\nimport { Helpers } from '../../../utility/helpers';\nimport type {\n CookingInstructions,\n ImageSticker,\n Ingredient,\n RecipeCategory,\n RecipeComment,\n RecipePart,\n RecipeProps,\n} from '../../recipe/models';\nimport type { ApiGastrofyRecipe } from '../api/gastrofy/responses/gastrofyResponses';\n\nexport const isNortforkRecipeFoodBox = (recipe: ApiGastrofyRecipe) => {\n if (!recipe.tags) {\n return false;\n }\n\n const foodBagTagId = appConfig.coopSettings.recipe.foodBoxTagId;\n\n if (!foodBagTagId) {\n return false;\n }\n\n return recipe.tags.some((gt) => gt.id === foodBagTagId);\n};\n\nconst getStickerUrl = (keyword?: string, imageStickers?: ImageSticker[]) => {\n if (!keyword) return undefined;\n if (!imageStickers) return undefined;\n\n const sticker = imageStickers\n .filter((_sticker) => !!_sticker.keyword)\n .find(\n (_sticker) => _sticker.keyword.trim().toLowerCase() === keyword.trim().toLowerCase(),\n )?.imageUrl;\n\n return sticker;\n};\n\nexport const mapToIngredientProps = (ingredients: ApiRecipeIngredient[]) => {\n const ingredientProps = ingredients.map<Ingredient>((ingredient) => {\n const displayName = ingredient.usePlural\n ? ingredient.ingredient.pluralName\n : ingredient.ingredient.singularName;\n const { sequenceNumber } = ingredient;\n let friendlyText = `${ingredient.prePreparation || ''} ${displayName} ${\n ingredient.postPreparation || ''\n }`.trim();\n\n friendlyText = friendlyText.replace(/\\s+(?=[,.])/g, '');\n\n let quantityFromattedText: string | null = null;\n const parsedQuantity = parseFloat(ingredient.quantity);\n if (!Number.isNaN(parsedQuantity) && parsedQuantity > 0) {\n quantityFromattedText = Helpers.formatNumber(\n parseFloat(ingredient.quantity).toString(),\n undefined,\n ',',\n );\n }\n\n // if halv of something, show 1/2 instead of 0.5. (0,5 = 1/2, 1,5 = 1 1/2)\n if (parsedQuantity % 1 === 0.5) {\n quantityFromattedText = `${parsedQuantity >= 1 ? `${parsedQuantity - 0.5} ` : ''} 1/2`;\n }\n\n return {\n friendlyText,\n formattedQuantity: quantityFromattedText || '',\n unit: ingredient.unit,\n sequenceNumber,\n };\n });\n\n return ingredientProps;\n};\n\nconst mapToRecipePartProps = (recipeParts: ApiRecipePart[]) => {\n const recipePartProps = recipeParts.map<RecipePart>((recipePart) => ({\n name: recipePart.name,\n ingredients: mapToIngredientProps(recipePart.ingredients),\n }));\n return recipePartProps;\n};\n\nexport const mapToRecipeCookingInstructions = (recipeCookingInstructions: string) => {\n const regexTitleStart = /<h3>/g;\n const regexAllTags = /(<([^>]+)>)/gi;\n const cookingInstructions: CookingInstructions[] = [];\n\n if (recipeCookingInstructions) {\n const instructions = recipeCookingInstructions.split(regexTitleStart);\n let instructionTitle = '';\n let instruction = '';\n\n instructions.forEach((value, index) => {\n const regexTitleEnd = /<\\/h3>/g; // this needs to be inside foreach to work for all items.\n if (regexTitleEnd.test(value)) {\n const titleAndInstruction = value.split(regexTitleEnd);\n instructionTitle = titleAndInstruction[0].replace(regexAllTags, '');\n instruction = titleAndInstruction[1].replace(regexAllTags, '');\n cookingInstructions.push({ title: instructionTitle, instructions: [instruction] });\n } else {\n instruction = value.replace(regexAllTags, '');\n\n // If first is missing title\n if (index === 0) {\n cookingInstructions.push({\n title: instructionTitle,\n instructions: instruction ? [instruction] : [],\n });\n } else {\n cookingInstructions[cookingInstructions.length - 1].instructions.push(\n instruction,\n );\n }\n }\n });\n }\n\n return cookingInstructions;\n};\n\ntype RecipeMainCategoryNames =\n | 'Typ av rätt'\n | 'Måltid'\n | 'Ingrediens'\n | 'Tillagningssätt'\n | 'Tillfälle'\n | 'Världens mat'\n | 'Specialkost';\n\nexport const getRecipeSubCategories = (\n categoryName: RecipeMainCategoryNames,\n recipeCategories: RecipeCategory[],\n) => {\n const categories =\n recipeCategories?.filter(\n (recipeCategory) =>\n !!recipeCategory.categories?.length &&\n recipeCategory.categories[0] === categoryName,\n ) || [];\n\n return categories;\n};\n\nexport const getRecipeSubCategoryNames = (\n categoryName: RecipeMainCategoryNames,\n categories: RecipeCategory[],\n) => {\n const recipeSubCategories = getRecipeSubCategories(categoryName, categories);\n const subCategoryNames = recipeSubCategories.map((x) => x.categories[x.categories.length - 1]);\n\n return subCategoryNames;\n};\n\nconst getMinutesFromTimeParts = (timeDigit?: string, timeUnit?: string) => {\n const digit = timeDigit ? parseFloat(timeDigit.replace(',', '.')) : NaN;\n let timeInMinutes = 0;\n\n if (!Number.isNaN(digit) && timeUnit) {\n const unit = timeUnit.toLowerCase();\n\n if (unit.startsWith('min')) {\n timeInMinutes = digit;\n }\n\n if (unit.startsWith('tim')) {\n timeInMinutes = digit * 60; // timeDigit is an hour.\n }\n\n if (unit.startsWith('dag') || unit.startsWith('dygn')) {\n timeInMinutes = digit * 60 * 24; // timeDigit is an day.\n }\n\n if (unit.startsWith('veck')) {\n timeInMinutes = digit * 60 * 24 * 7; // timeDigit is an week.\n }\n }\n\n return timeInMinutes;\n};\n\nexport const getCookingTimeInMinutes = (cookingTime: string) => {\n const cookingOneTimeRegex =\n /^(?<time>[\\d.,]+)\\s?(?<unit>veckor|vecka|dagar|dag|dygn|timmar|timme|tim|minuter|minut|min)(\\s?\\+.*)?$/;\n\n const cookingTwoTimeRegExp =\n /^(?<time>[\\d.,]+)\\s?(?<unit>veckor|vecka|dagar|dag|dygn|timmar|timme|tim|minuter|minut|min)([\\s+]|och)*(?<time2>[\\d.,]+)\\s?(?<unit2>veckor|vecka|dagar|dag|dygn|timmar|timme|tim|minuter|minut|min)(\\s?\\+.*)?$/;\n\n const cookingThreeTimeRegExp =\n /^(?<time>[\\d.,]+)\\s?(?<unit>veckor|vecka|dagar|dag|dygn|timmar|timme|tim|minuter|minut|min)([\\s+]|och)*(?<time2>[\\d.,]+)\\s?(?<unit2>veckor|vecka|dagar|dag|dygn|timmar|timme|tim|minuter|minut|min)([\\s+]|och)*(?<time3>[\\d.,]+)\\s?(?<unit3>veckor|vecka|dagar|dag|dygn|timmar|timme|tim|minuter|minut|min)(\\s?\\+.*)?$/;\n\n if (!cookingTime) {\n return 0;\n }\n\n let timeMatch = cookingThreeTimeRegExp.exec(cookingTime.trim());\n\n if (!timeMatch) {\n timeMatch = cookingTwoTimeRegExp.exec(cookingTime.trim());\n\n if (!timeMatch) {\n timeMatch = cookingOneTimeRegex.exec(cookingTime.trim());\n }\n }\n if (!timeMatch || !timeMatch.groups) {\n return 0;\n }\n\n const totalTimeInMinutes =\n getMinutesFromTimeParts(timeMatch.groups.time, timeMatch.groups.unit) +\n getMinutesFromTimeParts(timeMatch.groups.time2, timeMatch.groups.unit2) +\n getMinutesFromTimeParts(timeMatch.groups.time3, timeMatch.groups.unit3);\n return totalTimeInMinutes;\n};\n\nexport const mapToComments = (comments: ApiRecipeComment[]) => {\n const domainComments =\n comments?.map<RecipeComment>((comment) => ({\n id: comment.id,\n recipeId: comment.recipeId,\n name: comment.name,\n comment: comment.comment,\n isAdmin: comment.isAdmin,\n date: new Date(comment.date),\n })) || [];\n\n return domainComments;\n};\n\nexport const mapToRecipeProps = (recipe: ApiRecipe, stickers?: ImageSticker[]) => {\n if (!recipe) return undefined;\n\n const numberOfAllIngredients = recipe.recipePart.reduce((prev, next) => {\n return prev + next.ingredients.length;\n }, 0);\n\n const recipeProps: RecipeProps = {\n id: recipe.id,\n externalId: recipe.externalId.toString(),\n name: recipe.name,\n imageUrl: recipe.imageUrl,\n portions: recipe.yieldValue,\n portionsUnit: recipe.yieldUnit,\n parts: mapToRecipePartProps(recipe.recipePart),\n stickerUrl: recipe.keywords && stickers && getStickerUrl(recipe.keywords, stickers),\n averageRating: recipe.avgRating,\n ratingPercent: recipe.avgRating > 0 ? Math.ceil(recipe.avgRating * 2 * 10) : 0,\n ratingCount: recipe.numberOfVotes,\n preamble: recipe.preamble,\n climateImpactKg: recipe.climateImpactKg,\n ovenTemperature: recipe.ovenTemperature,\n cookingTime: recipe.totalTime ? recipe.totalTime : recipe.cookingTime,\n prepTime: recipe.preparationTime,\n totalTime: recipe.totalTime,\n cookingInstructions: mapToRecipeCookingInstructions(recipe.cookingInstructions),\n servingTips: recipe.servingTips,\n tips: recipe.tips,\n numberOfIngredients: numberOfAllIngredients,\n recipeCreator: recipe.recipeCreator,\n categories: recipe.categories,\n comments: mapToComments(recipe.comments),\n isFoodBox: recipe.isFoodBox,\n };\n\n return recipeProps;\n};\n","import type { AxiosInstance } from 'axios';\n\nimport { appConfig } from '../../../../appConfig';\nimport axiosClientFactory from './clientFactory';\n\nconst getDirectGastrofyAxiosClient = (): AxiosInstance => {\n const client = axiosClientFactory.createDirectApiClient({\n baseURL: appConfig.coopSettings.ecommerce.gastrofyApiUrl,\n headers: {\n 'X-Custom-Auth': appConfig.coopSettings.ecommerce.gastrofyApiKey,\n 'X-Custom-User': appConfig.coopUserSettings.isAuthenticated\n ? appConfig.coopUserSettings.shoppingUserId\n : undefined,\n },\n });\n\n return client;\n};\n\nexport default getDirectGastrofyAxiosClient;\n","import { appConfig } from '../../../appConfig';\nimport { getAuthToken } from '../../common/api/auth/getAuthToken';\nimport getLocalApiAxiosClient from '../../common/api/clients/localApiAxiosClient';\nimport gastrofyApi from '../../common/api/gastrofy/gastrofyApi';\nimport type {\n ApiGastrofyDiscoveryRequest,\n ApiGastrofyResolveRequest,\n} from '../../common/api/gastrofy/requests/gastrofyRequests';\nimport type { ApiGastrofyRecipe } from '../../common/api/gastrofy/responses/gastrofyResponses';\nimport distributionAdApi from '../../common/api/recipe/distributionAdApi';\nimport recipeApi from '../../common/api/recipe/recipeApi';\nimport { createDefaultException } from '../../common/exceptions/exceptionUtils';\nimport persistance from '../../common/persistance/persistance';\nimport { isNortforkRecipeFoodBox, mapToComments } from '../../common/utils/recipeUtils';\nimport type {\n RecipeComment,\n RecipeDiscoveryRequest,\n RecipeResolveRequest,\n ResolveRecipesRequest,\n SaveRecipeCommentRequest,\n} from '../models';\n\nconst recipeFlow = {\n getFavouriteRecipes: async () => {\n const { token } = await getAuthToken();\n const response = await recipeApi.getFavouriteRecipes(token)();\n return response;\n },\n getRecipesById: async (recipeIds: (string | number)[]) => {\n const response = await recipeApi.getRecipesById(recipeIds);\n return response;\n },\n getRecipeById: async (recipeId: string | number) => {\n const response = await recipeApi.getRecipeById(recipeId);\n return response;\n },\n getDistributionAd: async (recipeExternalId: string) => {\n const response = await distributionAdApi.getDistributionAd(recipeExternalId);\n return response;\n },\n discoverNorthforkRecipes: async (request: RecipeDiscoveryRequest) => {\n const gastrofyDiscoveryRequest: ApiGastrofyDiscoveryRequest = {\n store_identifier: request.storeId,\n offset: request.offset,\n limit: request.limit,\n data_fields: request.dataFields?.join(','),\n extra_data: request.extraData?.join(','),\n tags: request.tags?.join(','),\n exclude: request.exclude?.join(','),\n allergies: request.allergies?.join(','),\n diets: request.diets?.join(','),\n randomize: request.randomize,\n exclude_external_recipe_ids: request.excludeRecipeIds?.join(','),\n must_have_image: request.mustHaveImage,\n is_published: request.isPublished,\n match_all_products: request.matchAllProducts,\n external_product_ids: request.productIds?.join(','),\n order_by: request.orderBy?.join(','),\n external_recipe_ids: request.externalRecipeIds?.join(','),\n };\n\n const discoveryResponse = await gastrofyApi.discovery(gastrofyDiscoveryRequest);\n let gastrofyRecipes = discoveryResponse.data;\n\n gastrofyRecipes = gastrofyRecipes.map<ApiGastrofyRecipe>((gr) => ({\n ...gr,\n isFoodBox: isNortforkRecipeFoodBox(gr),\n }));\n\n return gastrofyRecipes;\n },\n getRecipesByProduct: async (productIds: string[], storeId: string, limit: number) => {\n const northforkRecipes = await recipeFlow.discoverNorthforkRecipes({\n limit,\n storeId,\n mustHaveImage: true,\n isPublished: true,\n matchAllProducts: false,\n dataFields: ['external_id', 'tags'],\n productIds,\n orderBy: ['product-score'],\n extraData: ['product_score'],\n });\n\n const sortedRecipeIds = northforkRecipes.map((gr) => gr.external_id);\n const recipes = await recipeFlow.getRecipesById(sortedRecipeIds);\n\n recipes.sort(\n (a, b) =>\n sortedRecipeIds.indexOf(a.externalId.toString()) -\n sortedRecipeIds.indexOf(b.externalId.toString()),\n );\n\n return recipes;\n },\n getRecipesByCategories: async (tagIds: string[], storeId: string, limit: number) => {\n const northforkRecipes = await recipeFlow.discoverNorthforkRecipes({\n limit,\n storeId,\n mustHaveImage: true,\n isPublished: true,\n dataFields: ['external_id', 'tags'],\n tags: tagIds,\n });\n\n const sortedRecipeIds = northforkRecipes.map((gr) => gr.external_id);\n const recipes = await recipeFlow.getRecipesById(sortedRecipeIds);\n\n recipes.sort(\n (a, b) =>\n sortedRecipeIds.indexOf(a.externalId.toString()) -\n sortedRecipeIds.indexOf(b.externalId.toString()),\n );\n\n return recipes;\n },\n rateRecipe: async (recipeId: string, rating1to5: number) => {\n let token: string | null = null;\n if (appConfig.coopUserSettings.isAuthenticated) {\n const { token: authenticatedToken } = await getAuthToken();\n token = authenticatedToken;\n }\n\n const resp = await recipeApi.rateRecipe(token)({ recipeId, rating1to5 });\n return resp;\n },\n saveFavouriteRecipe: async (recipeId: string) => {\n const { token } = await getAuthToken();\n const resp = await recipeApi.saveFavouriteRecipe(token)(recipeId);\n return resp;\n },\n removeFavouriteRecipe: async (recipeId: string) => {\n const { token } = await getAuthToken();\n const resp = await recipeApi.removeFavouriteRecipe(token)(recipeId);\n return resp;\n },\n getRecipeUserRating: async (recipeId: number) => {\n if (appConfig.coopUserSettings.isAuthenticated) {\n const { token } = await getAuthToken();\n const response = await recipeApi.getRecipeUserRatings(token)(recipeId);\n return response.rating;\n }\n\n const anonymousRating = persistance.recipeRatings.get(recipeId.toString());\n return anonymousRating;\n },\n getRecipeComments: async (recipeExternalId: string): Promise<RecipeComment[]> => {\n const response = await recipeApi.getRecipeComments(recipeExternalId);\n const domainComments = mapToComments(response);\n\n return domainComments;\n },\n saveRecipeComment: async (\n request: SaveRecipeCommentRequest,\n forbiddenNames: string[],\n isAdmin: boolean,\n ) => {\n if (\n !isAdmin &&\n forbiddenNames.some((forbiddenName) =>\n request.authorName\n .toLowerCase()\n .trim()\n .includes(forbiddenName.toLowerCase().trim()),\n )\n ) {\n return Promise.reject(createDefaultException('Vänligen ange ett annat namn'));\n }\n\n const { token } = await getAuthToken();\n const resp = await recipeApi.saveRecipeComment(token)(request);\n return resp;\n },\n resolveRecipes: async (request: ResolveRecipesRequest, storeId: string) => {\n const resp = await recipeApi.resolveRecipes(request, storeId);\n return resp;\n },\n getRecipeSubstitutes: async (storeId: string, substituteIdentifier: string) => {\n const resp = await recipeApi.getRecipeSubstitutes(storeId, substituteIdentifier);\n return resp;\n },\n\n resolveGastrofyRecipes: async (request: RecipeResolveRequest) => {\n const gastrofyResolveRequest: ApiGastrofyResolveRequest = {\n store: { identifier: request.storeId },\n options: request.options,\n recipes: request.recipes.map((recipe) => ({\n external_id: recipe.externalId,\n portions: recipe.portions,\n })),\n };\n\n const resolveResponse = await gastrofyApi.resolve(gastrofyResolveRequest);\n return resolveResponse;\n },\n\n getRecipeCommentsAdmin: async (query: string, page: number, pageSize: number) => {\n const client = getLocalApiAxiosClient();\n const res = await client.get<{\n comments: {\n id: number;\n recipeId: number;\n recipeExternalId: number | null;\n recipeName: string | null;\n created: string;\n author: string;\n message: string;\n }[];\n currentPageNumber: number;\n totalCount: number;\n }>('/episerver/recipeCommentAdmin', {\n params: {\n query,\n page,\n pageSize,\n },\n });\n\n return res.data;\n },\n\n deleteRecipeCommentAdmin: async (recipeId: number, commentId: number) => {\n const client = getLocalApiAxiosClient();\n await client.delete(`/episerver/recipeCommentAdmin`, {\n params: {\n recipeId,\n commentId,\n },\n });\n\n return true;\n },\n\n filterRecipesAdminTool: async (filterString: string, excludeList: string[]) => {\n const { token } = await getAuthToken();\n const resp = await recipeApi.filterRecipesAdminTool(token, filterString, excludeList);\n return resp;\n },\n};\n\nexport default recipeFlow;\n","import getLocalApiAxiosClient from '../clients/localApiAxiosClient';\n\nconst getDistributionAd = async (recipeExternalId: string) => {\n const response = await getLocalApiAxiosClient().get<ContentReference>(\n `/recipe/distributionad/${recipeExternalId}`,\n );\n return response.data;\n};\n\nexport default {\n getDistributionAd,\n};\n","import getDirectGastrofyAxiosClient from '../clients/directGastrofyAxiosClient';\nimport type {\n ApiGastrofyDiscoveryRequest,\n ApiGastrofyResolveRequest,\n} from './requests/gastrofyRequests';\nimport type {\n ApiGastrofyDiscoveryResponse,\n ApiGastrofyResolveResponse,\n} from './responses/gastrofyResponses';\n\nconst discovery = async (\n request: ApiGastrofyDiscoveryRequest,\n): Promise<ApiGastrofyDiscoveryResponse> => {\n const client = await getDirectGastrofyAxiosClient();\n\n const response = await client.get<ApiGastrofyDiscoveryResponse>(`api/discovery/recipes`, {\n params: request,\n });\n return response.data;\n};\n\nconst resolve = async (request: ApiGastrofyResolveRequest): Promise<ApiGastrofyResolveResponse> => {\n const client = await getDirectGastrofyAxiosClient();\n\n const response = await client.post<ApiGastrofyResolveResponse>(\n `api/smart-cart/recipes/resolve`,\n request,\n );\n\n return response.data;\n};\n\nexport default {\n discovery,\n resolve,\n};\n"],"names":["accessToken","config","baseURL","appConfig","coopSettings","recipe","apiUrl","params","headers","set","createDirectApiClient","getRecipeById","recipeId","get","data","getRecipesById","recipeIds","length","queryWithoutBrackets","queryName","values","join","rateRecipe","token","rating1to5","post","rating","getRecipeUserRatings","getRecipeComments","recipeExternalId","saveRecipeComment","request","name","authorName","comment","getFavouriteRecipes","saveFavouriteRecipe","response","addFavoriteRecipeResult","removeFavouriteRecipe","delete","removeFavoriteRecipeResult","getRecipeSingleMetaDataByCategoriesBatch","client","getCategoriesUrlOrderData","getRecipeCategoriesById","getRecipeCategories","northfork","getRecipesByEans","body","getAuthToken","resolveRecipes","storeId","hybrisAxiosClient","getRecipeSubstitutes","substituteIdentifier","requestQueryParams","filterRecipesAdminTool","filterString","excludeList","filter","exclude","isNortforkRecipeFoodBox","tags","foodBagTagId","foodBoxTagId","some","gt","id","getStickerUrl","keyword","imageStickers","_sticker","find","trim","toLowerCase","imageUrl","mapToIngredientProps","ingredients","map","ingredient","displayName","usePlural","pluralName","singularName","sequenceNumber","friendlyText","prePreparation","postPreparation","replace","quantityFromattedText","parsedQuantity","parseFloat","quantity","Number","isNaN","formatNumber","toString","undefined","formattedQuantity","unit","mapToRecipeCookingInstructions","recipeCookingInstructions","regexTitleStart","regexAllTags","cookingInstructions","instructions","split","instructionTitle","instruction","forEach","value","index","regexTitleEnd","test","titleAndInstruction","push","title","getRecipeSubCategoryNames","categoryName","categories","recipeSubCategories","recipeCategories","recipeCategory","getRecipeSubCategories","x","getMinutesFromTimeParts","timeDigit","timeUnit","digit","NaN","timeInMinutes","startsWith","getCookingTimeInMinutes","cookingTime","timeMatch","exec","groups","time","time2","unit2","time3","unit3","mapToComments","comments","isAdmin","date","Date","mapToRecipeProps","stickers","numberOfAllIngredients","recipePart","reduce","prev","next","recipeParts","externalId","portions","yieldValue","portionsUnit","yieldUnit","parts","stickerUrl","keywords","averageRating","avgRating","ratingPercent","Math","ceil","ratingCount","numberOfVotes","preamble","climateImpactKg","ovenTemperature","totalTime","prepTime","preparationTime","servingTips","tips","numberOfIngredients","recipeCreator","isFoodBox","ecommerce","gastrofyApiUrl","gastrofyApiKey","coopUserSettings","isAuthenticated","shoppingUserId","recipeFlow","recipeApi","getDistributionAd","distributionAdApi","discoverNorthforkRecipes","gastrofyDiscoveryRequest","store_identifier","offset","limit","data_fields","dataFields","extra_data","extraData","allergies","diets","randomize","exclude_external_recipe_ids","excludeRecipeIds","must_have_image","mustHaveImage","is_published","isPublished","match_all_products","matchAllProducts","external_product_ids","productIds","order_by","orderBy","external_recipe_ids","externalRecipeIds","gastrofyRecipes","gastrofyApi","gr","getRecipesByProduct","sortedRecipeIds","external_id","recipes","sort","a","b","indexOf","getRecipesByCategories","tagIds","authenticatedToken","getRecipeUserRating","persistance","recipeRatings","forbiddenNames","forbiddenName","includes","Promise","reject","resolveGastrofyRecipes","gastrofyResolveRequest","store","identifier","options","getRecipeCommentsAdmin","query","page","pageSize","deleteRecipeCommentAdmin","commentId"],"sourceRoot":""}