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xB,EAAsB5N,EAAUoP,QAAQ,EAAY,EAAE,EAChEpD,cAAehM,EAASiM,cAAc,CACtCoD,YAAazE,CAAAA,EAAAA,EAAAA,CAAAA,EAAwB5K,EAAUqP,WAAW,EAAY,EAAE,EACxE/C,OAAQtM,EAASsM,MAAM,CACvBgD,wBAAyBtP,EAASuP,yBAAyB,CAC3DC,mBAAoBxP,EAASyP,mBAAmB,CAChDC,uBAAwB1P,EAAS2P,yBAAyB,CAC1DC,cAAe5P,EAAS6P,cAAc,CACtCC,uBAAwB9P,EAAS+P,wBAAwB,CACzD3I,iBAAkBpH,EAASqH,kBAAkB,CAC7CP,UAAW9G,EAAS+G,UAAU,CAC9B6B,UAAW5I,EAAS6I,UAAU,CAC9BvB,WAAYtH,EAASuH,WAAW,CAChCyI,YAAahQ,EAASiQ,YAAY,CAClCC,WAAYlQ,EAASmQ,YAAY,EAjC1B,0ECFJ,IAAM5K,EAAY,CAAC6K,EAA0BnS,EAAqB2F,IAAgC,EACvGyM,MAAO,GACPvN,KAAMsN,EAAYtN,IAAI,CACtB7E,YAAAA,EACAqS,eAAgB,GAChBnJ,GAAIiJ,EAAYG,GAAG,CACnBC,MAAO5P,EAAAA,CAAYA,CAACC,SAAS,CAAC5C,GAC9B2F,aAAAA,EACA+B,OAAQyK,EAAYnL,GAAG,CACzB","sources":["webpack://_N_E/./src/constants/Endpoints.ts","webpack://_N_E/./src/constants/QueryTypes.ts","webpack://_N_E/./src/lib/useUser.ts","webpack://_N_E/./src/services/api.ts","webpack://_N_E/./src/services/auth0.ts","webpack://_N_E/./src/services/jwt.ts","webpack://_N_E/./src/utils/fetchJson.ts","webpack://_N_E/./src/utils/order.ts","webpack://_N_E/./src/utils/restaurant.ts","webpack://_N_E/./src/utils/product.ts","webpack://_N_E/./src/utils/supplier.ts","webpack://_N_E/./src/utils/user.ts"],"sourcesContent":["/* eslint-disable import/no-anonymous-default-export */\nexport default {\n AD_BROADCASTS: '/ad-broadcasts',\n AUTH0_OAUTH_TOKEN: '/oauth/token',\n AUTH0_PASSWORDLESS_START: '/passwordless/start',\n AUTH0_ROLES: 'api/v2/roles',\n AUTH0_UPDATE_USER_METADATA: '/api/v2/users/',\n AUTH0_UPDATE_USERS: '/api/v2/users',\n ADMINISTRATIVE_DIVISIONS: '/app-settings/administrative-divisions',\n BD_USER_PROFILE: '/users/profile',\n FAVORITE_PRODUCTS: '/favorite-products/',\n FILE_UPLOADS: '/file-uploads',\n ORDER_BULK_CONFIRM: '/orders/bulk-confirm',\n ORDER_EXPORT: '/orders/export',\n ORDER_GET: '/orders/',\n ORDER_UPDATE_TOKEN: '/orders/approve_anonymously',\n ORDERS: '/orders',\n PRODUCT_CATEGORIES: '/product-categories',\n PRODUCT_TO_FAVORITES: '/favorite-products/',\n PRODUCT_UNITS: '/products-measurement-units',\n PRODUCTS_BULK: '/products/bulk-update',\n PRODUCTS_DELETE_BULK: '/products/bulk-remove',\n PRODUCTS: '/products/',\n ADD_PRODUCT_CATALOG: '/products/add-catalog/',\n RESTAURANT_FAVORITES: '/products',\n RESTAURANT_GET: '/restaurants/',\n RESTAURANT_GET_SIMILARITIES: '/restaurants/similar',\n RESTAURANT_CREATE: '/restaurants',\n RESTAURANT_REGISTRATION: '/registrations/restaurants',\n RESTAURANT_SEARCH_AUTOCOMPLETE: '/searches/restaurants',\n RESTAURANT_SUPPLIER: '/restaurants-suppliers/',\n RESTAURANT_USER_INVITATIONS_DETAIL: '/supplier-user-invitations/details',\n RESTAURANT_USER_INVITATIONS: '/restaurant-invitations',\n RESTAURANT_USER_INVITATIONS_CREATE: '/restaurant-user-invitations',\n RESTAURANT_USER: '/restaurant-users',\n USER_INVITATIONS_DETAIL: '/restaurant-user-invitations/details',\n SUPPLIER_CATALOG: '/products/',\n SUPPLIER_CATEGORIES: '/supplier-categories',\n SUPPLIER_SCHEDULE: '/suppliers/schedule',\n SUPPLIER_GET: '/suppliers/',\n SUPPLIER_INVITE: '/supplier-invites',\n SUPPLIER_REGISTRATION: '/registrations/suppliers',\n SUPPLIER_REQUEST_ACCESS: '/access-requests/supplier',\n SUPPLIER_RESTAURANTS_BULK: '/restaurants-suppliers/bulk-update',\n SUPPLIER_RESTAURANTS: '/restaurants-suppliers',\n SUPPLIER_SEARCH_AUTOCOMPLETE: '/searches/suppliers',\n SUPPLIER_USER_INVITATION_POST: '/supplier-user-invitations',\n SUPPLIER_USER_INVITATIONS_DETAIL: '/supplier-user-invitations/details',\n SUPPLIER_USER_INVITATIONS: '/supplier-user-invitations',\n SUPPLIER_USER_VALIDATION: '/user-validations/supplier',\n UPLOAD_CSV: '/product-uploads/upload',\n UPLOAD_FILE: '/file-uploads',\n UPLOAD_FILES: '/file-uploads/multiple',\n PRODUCT_THUMBNAIL: '/file-uploads/product',\n USER_UPDATE_DATA: '/users/',\n SUPPLIER_USERS: '/supplier-users',\n};\n","export enum QueryTypes {\n PROFILE = 'profile',\n CATALOG = 'catalog',\n CATEGORY = 'category',\n FAVORITES = 'favorites',\n DBPROFILE = 'dbprofile',\n RESTAURANT_SUPPLIER = 'restaurant-supplier',\n RESTAURANT_USER_INVITATION_DETAILS = 'restaurant-user-invitation-details',\n ORDER = 'order',\n INVITATION = 'invitation',\n ORDERS = 'orders',\n PENDING_ORDERS = 'pending_orders',\n SUPPLIER = 'supplier',\n PRODUCTS = 'products',\n FAVORITE_PRODUCTS = 'favorite_products',\n PRODUCT_CATEGORIES = 'product-categories',\n PRODUCT_UNITS = 'product-units',\n SUPPLIER_CATEGORIES = 'supplier-categories',\n SUPPLIER_SCHEDULE = 'supplier-schedule',\n ORDERS_EXPORT_PDF = 'orders_export_pdf',\n USERS_BY_COMPANY_WITH_DOMAIN = 'users-by-company-with-domain',\n USERS_BY_COMPANY = 'users-by-company',\n SUPPLIER_USERS = 'supplier-users',\n}\n\nexport interface BaseApiRequest {\n data: T[];\n links: {\n current: string;\n };\n meta: {\n currentPage: number;\n itemsPerPage: number;\n sortBy: string[][];\n totalItems: number;\n totalPages: number;\n };\n}\n","'use client';\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { useRouter } from 'next/navigation';\n\nimport { JWTService } from '@/services/jwt';\nimport fetchJson from '@/utils/fetchJson';\n\nexport default function useUser({ redirectTo = '', redirectIfFound = false, isLanding = false } = {}) {\n const router = useRouter();\n const [user, setUser] = useState();\n\n useEffect(() => {\n fetchUser();\n }, []);\n\n useEffect(() => {\n const isValidToken = JWTService.isValidToken();\n if (redirectTo && redirectIfFound && user?.accessToken && isValidToken) {\n router.push(redirectTo);\n return;\n }\n\n if (!isLanding && redirectTo === '' && user?.accessToken === '' && !isValidToken) {\n router.push('/');\n }\n }, [user, redirectTo, redirectIfFound, isLanding]);\n\n const fetchUser = useCallback(async (route: string = '/api/user', method: string = 'GET', body?: object) => {\n const fetchedUser = await fetchJson(route, {\n method,\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body),\n });\n setUser(fetchedUser);\n return fetchedUser;\n }, []);\n\n return { user, fetchUser };\n}\n","import axios, { type AxiosInstance } from 'axios';\nimport { get } from 'lodash';\n\nimport useUser from '@/lib/useUser';\nimport { JWTService } from '@/services/jwt';\n\nconst apiURL = process.env.NEXT_PUBLIC_API_URL;\nconst auth0ApiURL = process.env.NEXT_PUBLIC_AUTH0_ISSUER_BASE_URL;\nconst axiosInstance: AxiosInstance = axios.create({ baseURL: apiURL });\nexport const axiosAuth0Instance: AxiosInstance = axios.create({ baseURL: auth0ApiURL });\n\naxiosInstance.interceptors.request.use(\n async request => {\n const storedUser: string | null = localStorage.getItem('user');\n const anonymous = get(request, 'anonymous', false);\n\n if (request.headers) {\n request.headers['access-control-allow-origin'] = '*';\n request.headers.Tenant = 'supplier';\n }\n if (!anonymous && storedUser && request.headers) {\n const user: User = JSON.parse(storedUser || '');\n request.headers.Authorization = `Bearer ${user.accessToken}`;\n }\n\n return request;\n },\n async err => {\n return await Promise.reject(err);\n },\n);\n\naxiosInstance.interceptors.response.use(\n response => response,\n async error => {\n if (error.response) {\n const isConfirmLocation = window.location.pathname.split('/')[1] === 'confirm';\n if (\n !isConfirmLocation &&\n error.response &&\n (error.response.status === 401 || error.response.status === 403 || !JWTService.isValidToken())\n ) {\n const { fetchUser } = useUser();\n localStorage.clear();\n fetchUser('/api/logout', 'POST');\n }\n }\n\n return await Promise.reject(error.response.data);\n },\n);\n\naxiosAuth0Instance.interceptors.request.use(\n async request => {\n const storedMngmtToken: string | null = localStorage.getItem('mngmtAccessToken');\n if (storedMngmtToken && request.headers) {\n const accessToken: string = JSON.parse(storedMngmtToken || '');\n request.headers.authorization = `Bearer ${accessToken}`;\n request.headers['content-type'] = 'application/json';\n }\n return request;\n },\n async err => {\n return await Promise.reject(err);\n },\n);\n\naxiosAuth0Instance.interceptors.response.use(\n response => response,\n async error => {\n const isConfirmLocation = window.location.pathname.split('/')[1] === 'confirm';\n if (!isConfirmLocation && error.response && error.response.data.statusCode === 401) {\n const { fetchUser } = useUser();\n localStorage.clear();\n fetchUser('/api/logout', 'POST');\n }\n\n return await Promise.reject(error.response.data);\n },\n);\n\nexport default axiosInstance;\n","import {\n useMutation,\n type UseMutationOptions,\n type UseMutationResult,\n useQuery,\n type UseQueryResult,\n type UseQueryOptions,\n} from 'react-query';\n\nimport Endpoints from '@/constants/Endpoints';\nimport { QueryTypes } from '@/constants/QueryTypes';\nimport { axiosAuth0Instance } from '@/services/api';\nimport { JWTService } from '@/services/jwt';\n\ninterface PasswordlessStartFormData {\n client_id: string;\n client_secret?: string; // For Regular Web Applications\n connection: 'email' | 'sms';\n email?: string; // set for connection=email\n phone_number?: string; // set for connection=sms\n send?: 'link' | 'code'; // if left null defaults to link\n authParams?: {\n // any authentication parameters that you would like to add\n scope?: string; // used when asking for a magic link\n state?: string; // used when asking for a magic link, or from the custom login page\n };\n}\n\ninterface PasswordlessStartResponse {\n _id: string;\n phone_number: string;\n phone_verified: boolean;\n request_language: string; // en-US,en;q=0.9\n}\n\ninterface OAuthTokenFormData {\n grant_type: 'http://auth0.com/oauth/grant-type/passwordless/otp' | 'refresh_token';\n client_id: string;\n client_secret?: string; // only for web apps, native apps don’t have a client secret\n username?: string; // or \"\"\n otp?: string;\n realm?: 'email' | 'sms'; // or \"sms\"\n audience?: string; // in case you need an access token for a specific API\n scope?: string; // \"openid\" | \"profile\" | \"email\" whatever scopes you need\n refresh_token?: string;\n}\n\nexport interface OAuthTokenResponse {\n access_token: string;\n refresh_token: string;\n id_token: string; // Too much personal information, maybe this will be not sent\n token_type: string;\n expires_in: number;\n}\n\ninterface UpdateUserFormData {\n blocked?: boolean;\n email_verified?: boolean;\n email?: string;\n phone_number?: string;\n phone_verified?: boolean;\n user_metadata?: object;\n app_metadata?: object;\n given_name?: string;\n family_name?: string;\n name?: string;\n nickname?: string;\n picture?: string;\n verify_email?: boolean;\n verify_phone_number?: boolean;\n password?: string;\n connection?: string;\n client_id?: string;\n username?: string;\n}\n\ninterface UpdateUserResponse {\n user_id: string;\n email: string;\n email_verified: boolean;\n username: string;\n phone_number: string;\n phone_verified: boolean;\n created_at: string;\n updated_at: string;\n identities: Array<{\n connection: string;\n user_id: string;\n provider: string;\n isSocial: boolean;\n }>;\n app_metadata: object;\n user_metadata: object;\n picture: string;\n name: string;\n nickname: string;\n multifactor: string[];\n last_ip: string;\n last_login: string;\n logins_count: number;\n blocked: boolean;\n given_name: string;\n family_name: string;\n}\n\ninterface OAuthMngmtTokenFormData {\n grant_type: string;\n client_id: string;\n client_secret: string; // only for web apps, native apps don’t have a client secret\n audience: string; // in case you need an access token for a specific API\n}\n\ninterface OAuthMngmtTokenResponse {\n access_token: string;\n expires_in: number;\n scope: string;\n token_type: string;\n}\n\ninterface RoleItem {\n description: string;\n id: string;\n name: string;\n}\n\nexport interface OAuthUserRolesResponse extends Array {}\n\ninterface setUserRolesFormData {\n roles: string[];\n userId?: string;\n}\n\nexport class Auth0Service {\n /**\n * @description Sends sms OTP\n * @param username\n */\n static _passwordlessStart = async (username: string): Promise => {\n const formData: PasswordlessStartFormData = {\n connection: 'sms',\n client_id: process.env.NEXT_PUBLIC_AUTH0_CLIENT_ID || '',\n phone_number: username,\n send: 'code',\n };\n\n try {\n const response: any = (await axiosAuth0Instance.post(`${Endpoints.AUTH0_PASSWORDLESS_START}`, formData)).data;\n return response || null;\n } catch (error) {\n throw new Error(`Unknown error: ${JSON.stringify(error)}`);\n }\n };\n\n /**\n * @description Used to log-in based on OTP received from sms.\n * *WARNING: You cannot use this endpoint from Single Page Applications.*\n * @param phone\n * @param code\n */\n static _oauthToken = async (phone: string, code: string): Promise => {\n const formData: OAuthTokenFormData = {\n grant_type: 'http://auth0.com/oauth/grant-type/passwordless/otp',\n client_id: process.env.NEXT_PUBLIC_AUTH0_CLIENT_ID || '',\n client_secret: process.env.NEXT_PUBLIC_AUTH0_CLIENT_SECRET || '',\n username: phone,\n otp: code,\n realm: 'sms', // or \"sms\"\n scope: 'offline_access', // whatever scopes you need\n audience: process.env.NEXT_PUBLIC_AUTH0_AUDIENCE, // THIS MUST BE SET OTHERWISE WE WILL RECEIVE AN OPAQUE TOKEN (CAN'T BE DECODED)\n };\n\n try {\n const response: OAuthTokenResponse = (await axiosAuth0Instance.post(`${Endpoints.AUTH0_OAUTH_TOKEN}`, formData))\n .data;\n return response || null;\n } catch (error: any) {\n throw new Error(error.error_description);\n }\n };\n\n /**\n * @description Get user metadata using auth0 user id\n * @param userId\n */\n private static readonly _getUserProfile = async (userId: string): Promise => {\n try {\n const response: Auth0Profile = (await axiosAuth0Instance.get(`${Endpoints.AUTH0_UPDATE_USER_METADATA}${userId}`))\n .data;\n return response || null;\n } catch (error: any) {\n throw new Error(error.error_description);\n }\n };\n\n public static useUserProfile = (\n userId: string,\n { ...opts }: UseQueryOptions,\n ): UseQueryResult => {\n return useQuery(QueryTypes.PROFILE, async () => await this._getUserProfile(userId), {\n refetchOnWindowFocus: false,\n cacheTime: 0,\n ...opts,\n });\n };\n\n /**\n * @description Patch user metadata using auth0 user id\n * @param userId\n * @param data\n */\n static _patchUserMetaData = async (userId: string, data: object, extraData?: any): Promise => {\n const formData: UpdateUserFormData = {\n user_metadata: data,\n // client_id: Constants.manifest && Constants.manifest.extra ? Constants.manifest.extra.auth0ClientID || '' : '',\n };\n\n if (extraData) {\n formData.name = extraData.name;\n formData.given_name = extraData.given_name;\n formData.family_name = extraData.family_name;\n formData.picture = extraData?.picture;\n }\n\n try {\n const response: UpdateUserResponse = (\n await axiosAuth0Instance.patch(`${Endpoints.AUTH0_UPDATE_USER_METADATA}${userId}`, formData)\n ).data;\n return response || null;\n } catch (error: any) {\n throw new Error(error.error_description);\n }\n };\n\n /**\n * @description Used to log-in based on OTP received from sms.\n * *WARNING: You cannot use this endpoint from Single Page Applications.*\n */\n static _oauthMngmtToken = async (): Promise => {\n const formData: OAuthMngmtTokenFormData = {\n grant_type: 'client_credentials',\n client_id: process.env.NEXT_PUBLIC_AUTH0_MNGMNT_CLIENT_ID || '',\n client_secret: process.env.NEXT_PUBLIC_AUTH0_MNGMNT_CLIENT_SECRET || '',\n audience: process.env.NEXT_PUBLIC_AUTH0_MNGMNT_AUDIENCE || '',\n };\n try {\n const response: OAuthMngmtTokenResponse = (\n await axiosAuth0Instance.post(`${Endpoints.AUTH0_OAUTH_TOKEN}`, formData)\n ).data;\n return response || null;\n } catch (error: any) {\n throw new Error(error.error_description);\n }\n };\n\n static UserRoles(accessToken: string): string[] {\n return JWTService.decodeUserRoles(accessToken);\n }\n\n /**\n * @description Get user roles permissions\n */\n private static readonly _getUserRoles = async (): Promise => {\n try {\n const response: OAuthUserRolesResponse = (await axiosAuth0Instance.get(`${Endpoints.AUTH0_ROLES}`)).data;\n return response || null;\n } catch (error: any) {\n throw new Error(error);\n }\n };\n\n public static useMutationGetUserRoles = (\n options?: UseMutationOptions,\n ): UseMutationResult => {\n return useMutation(async () => await Auth0Service._getUserRoles(), options);\n };\n\n /**\n * @description Set user roles\n * @param formData\n */\n static _setUserRoles = async (formData: setUserRolesFormData): Promise => {\n const { userId } = formData;\n delete formData.userId;\n\n try {\n const response: OAuthUserRolesResponse = (\n await axiosAuth0Instance.post(`${Endpoints.AUTH0_UPDATE_USER_METADATA}${userId}/roles`, formData)\n ).data;\n return response || null;\n } catch (error: any) {\n throw new Error(error);\n }\n };\n\n public static useSetUserRoles = (\n options?: UseMutationOptions,\n ): UseMutationResult => {\n return useMutation(\n async inviteSupplierFormData => await Auth0Service._setUserRoles(inviteSupplierFormData),\n options,\n );\n };\n\n /**\n * @description Used to log-in based on OTP received from sms.\n * *WARNING: You cannot use this endpoint from Single Page Applications.*\n * @param refreshToken\n */\n static _refreshToken = async (refreshToken: string): Promise => {\n const formData: OAuthTokenFormData = {\n grant_type: 'refresh_token',\n client_id: process.env.NEXT_PUBLIC_AUTH0_CLIENT_ID || '',\n client_secret: process.env.NEXT_PUBLIC_AUTH0_CLIENT_SECRET || '',\n refresh_token: refreshToken,\n };\n\n try {\n const response: OAuthTokenResponse = (await axiosAuth0Instance.post(`${Endpoints.AUTH0_OAUTH_TOKEN}`, formData))\n .data;\n return response || null;\n } catch (error: any) {\n throw new Error(error.error_description);\n }\n };\n\n /**\n * @description Get users by company id\n * @param companyId\n */\n private static readonly _getUsersByCompanyWithDomain = async (companyId: number): Promise => {\n try {\n const response: Auth0Profile = (\n await axiosAuth0Instance.get(`${Endpoints.AUTH0_UPDATE_USERS}`, {\n params: {\n q: `user_metadata.company_id:${companyId} AND _exists_:user_metadata.restaurants_domain`,\n search_engine: 'v3',\n },\n })\n ).data;\n return response || null;\n } catch (error: any) {\n throw new Error(error.error_description);\n }\n };\n\n public static useGetUsersByCompanyWithDomain = (\n companyId: number,\n { ...opts }: UseQueryOptions,\n ): UseQueryResult => {\n return useQuery(\n QueryTypes.USERS_BY_COMPANY_WITH_DOMAIN,\n async () => await this._getUsersByCompanyWithDomain(companyId),\n {\n refetchOnWindowFocus: false,\n cacheTime: 0,\n ...opts,\n },\n );\n };\n\n private static readonly _getUsersByCompany = async (companyId: number): Promise => {\n try {\n const response: Auth0Profile[] = (\n await axiosAuth0Instance.get(`${Endpoints.AUTH0_UPDATE_USERS}`, {\n params: {\n q: `user_metadata.company_id:${companyId}`,\n search_engine: 'v3',\n },\n })\n ).data;\n return response || null;\n } catch (error: any) {\n throw new Error(error.error_description);\n }\n };\n\n public static useGetUsersByCompany = (\n companyId: number,\n { ...opts }: UseQueryOptions,\n ): UseQueryResult => {\n return useQuery(QueryTypes.USERS_BY_COMPANY, async () => await this._getUsersByCompany(companyId), {\n refetchOnWindowFocus: false,\n cacheTime: 0,\n ...opts,\n });\n };\n}\n","import * as Sentry from '@sentry/nextjs';\nimport jwt_decode, { type JwtPayload } from 'jwt-decode';\n\nimport { Auth0Service, type OAuthTokenResponse } from '@/services/auth0';\nimport fetchJson from '@/utils/fetchJson';\nimport { userParse } from '@/utils/user';\n\nconst oneDay = 86400000;\nexport interface DecodedUser extends JwtPayload {\n nickname: string;\n name: string;\n picture: string;\n updated_at: string;\n iss: string;\n sub: string;\n aud: string;\n iat: number;\n exp: number;\n}\n\ninterface DecodedUserAccessToken extends JwtPayload {\n 'http://dev-suppliers-uselisto.com/roles': string[];\n 'http://dev-suppliers-uselisto.com/user_metadata': {\n name?: string;\n company_id: number;\n };\n iss: 'https://dev-suppliers-uselisto.us.auth0.com/';\n sub: string;\n aud: string[];\n iat: number;\n exp: number;\n azp: string;\n scope: string;\n gty: string;\n}\n\nexport class JWTService {\n static decodeUser = (auth0User: OAuthTokenResponse): DecodedUser => {\n return jwt_decode(auth0User.access_token);\n };\n\n static decodeUserRoles = (accessToken: string): string[] => {\n const decodedAccessToken: any = jwt_decode(accessToken);\n return decodedAccessToken[process.env.NEXT_PUBLIC_AUTH0_ROLES_URL || 'http://dev-suppliers-uselisto.com/roles'];\n };\n\n static isValidToken = (): boolean => {\n const storedUser: string | null = localStorage.getItem('user');\n if (!storedUser) {\n return false;\n }\n const user: User = JSON.parse(storedUser || '');\n const token = user.accessToken;\n const decodedToken: DecodedUser = jwt_decode(token);\n const currentDate = new Date();\n // JWT exp is in seconds\n if (decodedToken.exp * 1000 < currentDate.getTime()) {\n return false;\n } else {\n return true;\n }\n };\n\n static getManagmentToken = async (responseToken: OAuthTokenResponse) => {\n const response = await Auth0Service._oauthMngmtToken();\n if (responseToken && response) {\n localStorage.setItem('mngmtAccessToken', JSON.stringify(response.access_token));\n const decodedUserData = JWTService.decodeUser(responseToken);\n const user = userParse(decodedUserData, responseToken.access_token, responseToken.refresh_token);\n localStorage.setItem('user', JSON.stringify(user));\n await fetchJson('/api/login', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(user),\n });\n }\n };\n\n static refreshToken = async () => {\n try {\n const currentTime = (Date.now() + oneDay) / 1000;\n const storedUser: string | null = localStorage.getItem('user');\n const user: User = JSON.parse(storedUser || '');\n if (user.expire && user.expire < currentTime) {\n const response = await Auth0Service._refreshToken(user.refreshToken);\n await this.getManagmentToken(response);\n }\n } catch (err) {\n Sentry.captureException(err);\n }\n };\n}\n","export default async function fetchJson(input: RequestInfo, init?: RequestInit): Promise {\n const response = await fetch(input, init);\n\n // if the server replies, there's always some data in json\n // if there's a network error, it will throw at the previous line\n const data = await response.json();\n\n // response.ok is true when res.status is 2xx\n // https://developer.mozilla.org/en-US/docs/Web/API/Response/ok\n if (response.ok) {\n return data;\n }\n\n throw new FetchError({\n message: response.statusText,\n response,\n data,\n });\n}\n\nclass FetchError extends Error {\n response: Response;\n data: {\n message: string;\n };\n\n constructor({\n message,\n response,\n data,\n }: {\n message: string;\n response: Response;\n data: {\n message: string;\n };\n }) {\n // Pass remaining arguments (including vendor specific ones) to parent constructor\n super(message);\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, FetchError);\n }\n\n this.name = 'FetchError';\n this.response = response;\n this.data = data ?? { message };\n }\n}\n","/* eslint-disable @typescript-eslint/ban-types */\nimport { restaurantResponseParse } from '@/utils/restaurant';\nimport { supplierResponseParse } from '@/utils/supplier';\n\nconst orderProductParse = (product: {\n allergens: [];\n available?: boolean;\n brand: string;\n code?: string;\n created_at: string;\n created_by_restaurant?: number;\n currency_code: string;\n formatted_price: Product['formatted_price'];\n id: number;\n name: string;\n order_cutoff_times: {};\n picture_url?: string;\n presentation?: string;\n price: string;\n product_category_id: number;\n product_category: any;\n product_thumbnail: {\n original_url: string;\n medium_url: string;\n thumb_url: string;\n };\n replacement_products?: string;\n seasonality_end_date?: string;\n seasonality_start_date?: string;\n sku: string;\n stock?: number;\n supplier_id: number;\n unit_name: string;\n unit: string;\n updated_at: string;\n uploaded_by_csv_at?: string;\n}) => ({\n allergens: [],\n available: product.available,\n brand: product.brand,\n code: product.code,\n created_by_restaurant: product.created_by_restaurant,\n createdAt: product.created_at,\n currencyCode: product.currency_code,\n formatted_price: product.formatted_price,\n id: product.id,\n name: product.name,\n orderCutoffTimes: product.order_cutoff_times,\n pictureUrl: product.picture_url,\n presentation: product.presentation,\n price: product.price,\n product_category: product.product_category,\n product_thumbnail: product.product_thumbnail,\n productCategoryId: product.product_category_id,\n productCategoryName: product.product_category?.name,\n replacementProducts: product.replacement_products,\n seasonalityEndDate: product.seasonality_end_date,\n seasonalityStartDate: product.seasonality_start_date,\n sku: product.sku,\n stock: product.stock,\n supplierId: product.supplier_id,\n unit: product.unit,\n unitName: product.unit_name,\n updatedAt: product.updated_at,\n uploadedByCsvAt: product.uploaded_by_csv_at,\n});\n\nexport const orderLinesParse = (\n orderLines: Array<{\n created_at: string;\n id: number;\n order_id: number;\n product?: Product;\n product_id: number;\n quantity: number;\n updated_at: string;\n }>,\n) => {\n return (orderLines || []).map(line => ({\n createdAt: line.created_at,\n id: line.id,\n orderId: line.order_id,\n product: line.product ? orderProductParse(line.product) : undefined,\n productId: line.product_id,\n quantity: line.quantity,\n updatedAt: line.updated_at,\n }));\n};\n\nexport const getOrdersResponseParse = (response: BDGetOrder[]): Order[] => {\n // @ts-ignore\n return (response || []).map(order => ({\n createdAt: order.created_at,\n createdBy: order.created_by,\n deliveryDate: order.delivery_date,\n deliveryInstructions: order.delivery_instructions,\n id: order.id,\n isModified: order.isModified,\n newDeliveryAddress: order.new_delivery_address,\n orderEvents: order.order_events,\n orderLines: orderLinesParse(order.order_lines),\n reference: order.reference,\n restaurantId: order.restaurant_id,\n restaurant: restaurantResponseParse([order.__restaurant__])[0],\n supplier: supplierResponseParse(order.__supplier__),\n restaurantUserId: order.restaurant_user_id,\n status: order.status,\n supplierId: order.supplier_id,\n updatedAt: order.updated_at,\n }));\n};\n\nexport const dbOrderLinesParse = (orderLines: OrderLines): DBOrderLines => {\n return (orderLines || []).map(ol => ({\n created_at: ol.createdAt,\n id: ol.id,\n order_id: ol.orderId,\n product_id: ol.productId,\n quantity: ol.quantity,\n updated_at: ol.updatedAt,\n }));\n};\n","import { compact } from 'lodash';\n\nimport { getOrdersResponseParse } from '@/utils/order';\n\nexport const restaurantResponseParse = (response: DBRestaurant[]): Restaurant[] => {\n return (compact(response) || []).map(restaurant => ({\n id: restaurant.id,\n name: restaurant.name,\n address: restaurant.address,\n legalName: restaurant.legal_name,\n preciseAddress: restaurant.precise_address,\n registrationChannel: restaurant.registration_channel,\n isAvailableForChat: restaurant.is_available_for_chat,\n suppliers: restaurant.suppliers,\n supplierUsers: restaurant.supplier_users,\n favoriteProductCount: restaurant.favorite_product_count,\n favoriteProducts: restaurant.favorite_products,\n orders: getOrdersResponseParse(restaurant.__orders__),\n restaurantUserInvitations: restaurant.restaurant_user_invitations,\n restaurantChain: restaurant.restaurant_chain,\n createdAt: restaurant.created_at,\n updatedAt: restaurant.updated_at,\n hasOrders: restaurant.__has_orders__,\n salesTotal: restaurant.sales_total,\n ordersTotal: restaurant.orders_total,\n governmentId: restaurant.government_id,\n productsTotal: restaurant.products_total,\n supplierRestaurant: restaurant.suppliers_restaurants,\n lastOrderDate: restaurant.last_order_date,\n restaurantUsers: restaurant.__restaurant_users__,\n pictureUrl: restaurant.picture_url,\n }));\n};\n","export const productsResponseParse = (response: DBProduct[]): Product[] => {\n return response.map(product => ({\n id: product.id,\n name: product.name,\n code: product.code,\n unit: product.unit,\n unitName: product.unit_name,\n price: product.price,\n currencyCode: product.currency_code,\n sku: product.sku,\n stock: product.stock,\n stock_alert_quantity: product.stock_alert_quantity,\n cost: product.cost,\n brand: product.brand,\n available: product.available,\n pictureUrl: product.picture_url,\n supplier: product.supplier,\n supplierId: product.supplier_id,\n productCategory: product.product_category,\n productCategoryId: product.product_category_id,\n allergens: product.allergens,\n favoriteProducts: product.favorite_products,\n replacementProducts: product.replacement_products,\n seasonalityStartDate: product.seasonality_start_date,\n seasonalityEndDate: product.seasonality_end_date,\n orderLines: product.order_lines,\n uploadedByCsvAt: product.uploaded_by_csv_at,\n createdAt: product.created_at,\n updatedAt: product.updated_at,\n }));\n};\n","import { productsResponseParse } from '@/utils/product';\nimport { restaurantResponseParse } from '@/utils/restaurant';\n\nexport const supplierResponseParse = (response: DBSupplier): Supplier | null => {\n if (!response) {\n return null;\n }\n return {\n id: response.id,\n name: response.name,\n address: response.address,\n referredBy: response.referred_by,\n registrationChannel: response.registration_channel,\n businessLocationType: response.business_location_type,\n referralMedium: response.referral_medium,\n hasOfficialCatalog: response.has_official_catalog,\n contactPhone: response.contact_phone,\n contactEmail: response.contact_email,\n currency: response.currency,\n verified: response.verified,\n isAvailableForChat: response.is_available_for_chat,\n showsInPublicListings: response.shows_in_public_listings,\n minimumOrderAmount: response.minimum_order_amount,\n supplierChainId: response.supplier_chain_id,\n products: productsResponseParse((response.products as any) || []),\n supplierUsers: response.supplier_users,\n restaurants: restaurantResponseParse((response.restaurants as any) || []),\n orders: response.orders,\n supplierUserInvitations: response.supplier_user_invitations,\n supplierCategories: response.supplier_categories,\n mainSupplierCategoryId: response.main_supplier_category_id,\n supplierChain: response.supplier_chain,\n initialCatalogPictures: response.initial_catalog_pictures,\n orderCutoffTimes: response.order_cutoff_times,\n createdAt: response.created_at,\n updatedAt: response.updated_at,\n pictureUrl: response.picture_url,\n advanceDays: response.advance_days,\n forceToPay: response.force_to_pay,\n };\n};\n","import { Auth0Service } from '@/services/auth0';\nimport { type DecodedUser } from '@/services/jwt';\n\nexport const userParse = (decodedUser: DecodedUser, accessToken: string, refreshToken: string): User => ({\n email: '',\n name: decodedUser.name,\n accessToken,\n showOnboarding: false,\n id: decodedUser.sub,\n roles: Auth0Service.UserRoles(accessToken),\n refreshToken,\n expire: decodedUser.exp,\n});\n"],"names":["__webpack_exports__","Z","AD_BROADCASTS","AUTH0_OAUTH_TOKEN","AUTH0_PASSWORDLESS_START","AUTH0_ROLES","AUTH0_UPDATE_USER_METADATA","AUTH0_UPDATE_USERS","ADMINISTRATIVE_DIVISIONS","BD_USER_PROFILE","FAVORITE_PRODUCTS","FILE_UPLOADS","ORDER_BULK_CONFIRM","ORDER_EXPORT","ORDER_GET","ORDER_UPDATE_TOKEN","ORDERS","PRODUCT_CATEGORIES","PRODUCT_TO_FAVORITES","PRODUCT_UNITS","PRODUCTS_BULK","PRODUCTS_DELETE_BULK","PRODUCTS","ADD_PRODUCT_CATALOG","RESTAURANT_FAVORITES","RESTAURANT_GET","RESTAURANT_GET_SIMILARITIES","RESTAURANT_CREATE","RESTAURANT_REGISTRATION","RESTAURANT_SEARCH_AUTOCOMPLETE","RESTAURANT_SUPPLIER","RESTAURANT_USER_INVITATIONS_DETAIL","RESTAURANT_USER_INVITATIONS","RESTAURANT_USER_INVITATIONS_CREATE","RESTAURANT_USER","USER_INVITATIONS_DETAIL","SUPPLIER_CATALOG","SUPPLIER_CATEGORIES","SUPPLIER_SCHEDULE","SUPPLIER_GET","SUPPLIER_INVITE","SUPPLIER_REGISTRATION","SUPPLIER_REQUEST_ACCESS","SUPPLIER_RESTAURANTS_BULK","SUPPLIER_RESTAURANTS","SUPPLIER_SEARCH_AUTOCOMPLETE","SUPPLIER_USER_INVITATION_POST","SUPPLIER_USER_INVITATIONS_DETAIL","SUPPLIER_USER_INVITATIONS","SUPPLIER_USER_VALIDATION","UPLOAD_CSV","UPLOAD_FILE","UPLOAD_FILES","PRODUCT_THUMBNAIL","USER_UPDATE_DATA","SUPPLIER_USERS","QueryTypes","useUser","redirectTo","redirectIfFound","isLanding","arguments","length","router","useRouter","user","setUser","useState","useEffect","fetchUser","isValidToken","JWTService","accessToken","push","useCallback","route","method","body","fetchedUser","fetchJson","headers","JSON","stringify","axiosInstance","axios","baseURL","process","axiosAuth0Instance","interceptors","request","use","storedUser","localStorage","getItem","anonymous","get","Tenant","parse","Authorization","concat","err","Promise","reject","response","error","window","location","pathname","split","status","clear","data","storedMngmtToken","authorization","statusCode","Auth0Service","UserRoles","decodeUserRoles","_passwordlessStart","username","post","Endpoints","connection","client_id","phone_number","send","formData","_oauthToken","phone","code","grant_type","client_secret","otp","realm","scope","audience","error_description","_getUserProfile","userId","useUserProfile","opts","param","useQuery","PROFILE","refetchOnWindowFocus","cacheTime","_patchUserMetaData","extraData","user_metadata","name","given_name","family_name","picture","patch","_oauthMngmtToken","_getUserRoles","useMutationGetUserRoles","useMutation","options","_setUserRoles","useSetUserRoles","inviteSupplierFormData","_refreshToken","refreshToken","refresh_token","_getUsersByCompanyWithDomain","companyId","params","q","search_engine","useGetUsersByCompanyWithDomain","USERS_BY_COMPANY_WITH_DOMAIN","_getUsersByCompany","useGetUsersByCompany","USERS_BY_COMPANY","decodeUser","jwt_decode","auth0User","access_token","decodedAccessToken","token","decodedToken","currentDate","Date","exp","getTime","getManagmentToken","responseToken","setItem","decodedUserData","userParse","currentTime","now","oneDay","expire","Sentry","input","init","fetch","json","ok","FetchError","message","statusText","Error","constructor","captureStackTrace","orderProductParse","product","allergens","available","brand","created_by_restaurant","createdAt","created_at","currencyCode","currency_code","formatted_price","id","orderCutoffTimes","order_cutoff_times","pictureUrl","picture_url","presentation","price","product_category","product_thumbnail","productCategoryId","product_category_id","productCategoryName","replacementProducts","replacement_products","seasonalityEndDate","seasonality_end_date","seasonalityStartDate","seasonality_start_date","sku","stock","supplierId","supplier_id","unit","unitName","unit_name","updatedAt","updated_at","uploadedByCsvAt","uploaded_by_csv_at","orderLinesParse","orderLines","map","line","orderId","order_id","undefined","productId","product_id","quantity","getOrdersResponseParse","order","createdBy","created_by","deliveryDate","delivery_date","deliveryInstructions","delivery_instructions","isModified","newDeliveryAddress","new_delivery_address","orderEvents","order_events","order_lines","reference","restaurantId","restaurant_id","restaurant","restaurantResponseParse","__restaurant__","supplier","supplierResponseParse","__supplier__","restaurantUserId","restaurant_user_id","dbOrderLinesParse","ol","compact","address","legalName","legal_name","preciseAddress","precise_address","registrationChannel","registration_channel","isAvailableForChat","is_available_for_chat","suppliers","supplierUsers","supplier_users","favoriteProductCount","favorite_product_count","favoriteProducts","favorite_products","orders","__orders__","restaurantUserInvitations","restaurant_user_invitations","restaurantChain","restaurant_chain","hasOrders","__has_orders__","salesTotal","sales_total","ordersTotal","orders_total","governmentId","government_id","productsTotal","products_total","supplierRestaurant","suppliers_restaurants","lastOrderDate","last_order_date","restaurantUsers","__restaurant_users__","productsResponseParse","stock_alert_quantity","cost","productCategory","referredBy","referred_by","businessLocationType","business_location_type","referralMedium","referral_medium","hasOfficialCatalog","has_official_catalog","contactPhone","contact_phone","contactEmail","contact_email","currency","verified","showsInPublicListings","shows_in_public_listings","minimumOrderAmount","minimum_order_amount","supplierChainId","supplier_chain_id","products","restaurants","supplierUserInvitations","supplier_user_invitations","supplierCategories","supplier_categories","mainSupplierCategoryId","main_supplier_category_id","supplierChain","supplier_chain","initialCatalogPictures","initial_catalog_pictures","advanceDays","advance_days","forceToPay","force_to_pay","decodedUser","email","showOnboarding","sub","roles"],"sourceRoot":""}