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AAA,EAAMwB,YAAAA,CAAY,EAClC,CAI8C,WAEzC7G,GAGP,CAOO,IAAMuF,2BAA6B,IACxCxB,CAAAA,EAAAA,EAAAA,UAAAA,EAAW4C,kGCzTN,IAAMpF,2BAA6B,OAAC,CACzCC,UAAAA,CAAS,CACTE,KAAAA,CAAI,CACJD,UAAAA,CAAS,CACY,CAAAxB,EASrBkH,EAAAA,EAAmBA,CAACC,WAAW,CARL,CACxBpG,KA3Bc,mBA4BdwC,KAAM,CACJ6D,WAAY7F,EACZ8F,UAAW5F,EACXD,UAAAA,CACF,CACF,EAEF","sources":["webpack://_N_E/./src/components/layouts/PrimaryLayout/PrimaryLayout.tsx","webpack://_N_E/./src/components/organisms/Footer/FooterLinks.tsx","webpack://_N_E/./src/components/organisms/Footer/Footer.mocks.ts","webpack://_N_E/./src/lib/dataSource/auth/getIdToken.ts","webpack://_N_E/./src/lib/dataSource/lostApi/auth/me.ts","webpack://_N_E/./src/lib/hooks/useStorybookAuth/StorybookAuth.tsx","webpack://_N_E/./src/lib/hooks/me/useMe.ts","webpack://_N_E/./src/lib/hooks/persistentBanner/PersistentBanner.tsx","webpack://_N_E/./src/lib/utils/analytics/startPetSearch.ts","webpack://_N_E/<anon>"],"sourcesContent":["import dynamic from 'next/dynamic';\n\nconst Footer = dynamic(() => import('@/components/organisms/Footer/Footer'));\nconst Navbar = dynamic(() => import('@/components/organisms/Navbar/Navbar'));\nconst ToastHandler = dynamic(\n () => import('@/components/organisms/ToastHandler/ToastHandler')\n);\n\nimport { mockFooterProps } from '@/components/organisms/Footer/Footer.mocks';\nimport { useUserContext } from '@/lib/hooks/userContext/UserContext';\n\n/**\n * IPrimaryLayout\n *\n * @augments React.ComponentPropsWithoutRef<'div'>\n * @interface IPrimaryLayout\n */\nexport interface IPrimaryLayout extends React.ComponentPropsWithoutRef<'div'> {\n /**\n * The children of the component\n *\n * @memberof IPrimaryLayout\n * @member {React.ReactNode} children\n */\n children: React.ReactNode;\n}\n\n/**\n * Primary Layout Used to display the primary layout of the application.\n *\n * @param {IPrimaryLayout} props - The props for the PrimaryLayout component.\n * @returns {React.FC<IPrimaryLayout>} PrimaryLayout Component\n */\nconst PrimaryLayout: React.FC<IPrimaryLayout> = ({\n children,\n}: IPrimaryLayout) => {\n const { hasMessage, isFetchingUser, isLoggedIn, isShelter } =\n useUserContext();\n\n return (\n <>\n <Navbar\n isFetchingUser={isFetchingUser}\n loggedIn={isLoggedIn}\n isShelter={isShelter}\n hasMessage={hasMessage}\n />\n <main data-testid=\"primaryLayout\">\n {children}\n <ToastHandler />\n </main>\n <Footer {...mockFooterProps.base} />\n </>\n );\n};\n\nexport default PrimaryLayout;\n","import { startPetSearchEventHandler } from '@/lib/utils/analytics/startPetSearch';\n\n/**\n * MenuLink\n *\n * @type {object} MenuLink\n */\nexport type MenuLink = {\n /** The name of the link. */\n name: string;\n /** The url of the link. */\n url: string;\n /** The link target */\n target?: string;\n /**\n * The optional on click function\n *\n * @returns {void}\n */\n onClick?: () => void;\n};\n\n/**\n * IMenuItem\n *\n * @interface IMenuItem\n */\nexport interface IMenuItem {\n /**\n * The name of the menu item.\n *\n * @memberof IMenuItem\n * @member {string} name\n */\n name: string;\n /**\n * The links to display in the menu item.\n *\n * @memberof IMenuItem\n * @member {MenuLink[]} links\n */\n links: MenuLink[];\n}\n\nexport const footerColumnOneLinks: IMenuItem = {\n name: 'Who We Are',\n links: [\n {\n name: 'About',\n url: '/about',\n },\n {\n name: 'Get in Touch',\n url: 'https://support.lost.petcolove.org/hc/en-us',\n target: '_blank',\n },\n ],\n};\n\nexport const footerColumnTwoLinks: IMenuItem = {\n name: 'Our Family',\n links: [\n {\n name: 'Petco Love',\n url: 'https://petcolove.org',\n target: '_blank',\n },\n {\n name: 'Petco Love Adopt',\n url: 'https://petcolove.org/adopt/',\n target: '_blank',\n },\n {\n name: 'Petco Love Care',\n url: 'https://petcolove.org/care/',\n target: '_blank',\n },\n {\n name: 'Petco.com',\n url: 'https://www.petco.com/shop/en/petcostore',\n target: '_blank',\n },\n ],\n};\nexport const footerColumnThreeLinks: IMenuItem = {\n name: 'Partners',\n links: [\n {\n name: 'Supporters',\n url: '/partners',\n },\n {\n name: 'Petco Love Partner Portal',\n url: 'https://petcolove.fluxx.io/user_sessions/new',\n target: '_blank',\n },\n ],\n};\n\n/**\n * The menu item for the I Lost a Pet link\n *\n * @constant {MenuLink}\n */\nconst footerColumnFourILostAPetLinks: MenuLink = {\n name: 'I Lost a Pet',\n url: '/i-lost-a-pet/',\n};\n\n/**\n * The menu item for the I Found a Pet link\n *\n * @constant {MenuLink}\n */\nconst footerColumnFourIFoundAPetLinks: MenuLink = {\n name: 'I Found a Pet',\n url: '/i-found-a-pet/',\n};\n\nexport const footerColumnFourLinks: IMenuItem = {\n name: 'Pet Search',\n links: [\n {\n ...footerColumnFourILostAPetLinks,\n onClick:\n /**\n * The on click function\n *\n * @returns {void}\n */\n (): void => {\n const { name: iLostAPetClickText } = footerColumnFourILostAPetLinks;\n startPetSearchEventHandler({\n clickText: iLostAPetClickText,\n component: 'I Lost A Pet Footer Link / All Pages',\n flow: 'Found',\n });\n },\n },\n {\n ...footerColumnFourIFoundAPetLinks,\n onClick:\n /**\n * The on click function\n *\n * @returns {void}\n */\n (): void => {\n const { name: iFoundAPetClickText } = footerColumnFourIFoundAPetLinks;\n startPetSearchEventHandler({\n clickText: iFoundAPetClickText,\n component: 'I Found A Pet Footer Link / All Pages',\n flow: 'Lost',\n });\n },\n },\n ],\n};\n\nexport const footerColumnFourLoggedInLinks: IMenuItem = {\n name: 'Pet Search',\n links: [\n {\n name: 'Manage Pets',\n url: '/dash/',\n },\n ],\n};\n\nexport const bottomLinks: MenuLink[] = [\n {\n name: 'Privacy Policy',\n url: '/privacy-policy/',\n },\n {\n name: 'Terms of Service',\n url: '/terms-of-service/',\n },\n];\n","import { IFooter } from './Footer';\nimport {\n bottomLinks,\n footerColumnFourLinks,\n footerColumnOneLinks,\n footerColumnThreeLinks,\n footerColumnTwoLinks,\n footerColumnFourLoggedInLinks,\n} from './FooterLinks';\n\nconst currentYear = new Date().getFullYear();\n\nconst base: IFooter = {\n columnOne: footerColumnOneLinks,\n columnTwo: footerColumnTwoLinks,\n columnThree: footerColumnThreeLinks,\n columnFour: footerColumnFourLinks,\n columnFourLoggedIn: footerColumnFourLoggedInLinks,\n disclosure: `Use of this service, website, or application constitutes acceptance of all terms listed above. Petco Love Lost and its associated logos are trademarks of Petco Animal Supplies, Inc.â„¢ ${currentYear}, Petco Love | Petco Animal Supplies, Inc. All rights reserved.`,\n bottomLinks: bottomLinks,\n};\n\nexport const mockFooterProps = {\n base,\n};\n","import getBasePath from '@/lib/utils/getBasePath/getBasePath';\nimport { getSession } from '@auth0/nextjs-auth0';\nimport { NextApiRequest, NextApiResponse } from 'next';\n\n/**\n * Get the idToken from the session for the current user. This can be used to\n * authenticate api calls. This should be used in the client side code.\n *\n * @returns {Promise<string>} - The idToken for the current user.\n */\nexport const getIdTokenClient = async (): Promise<string> => {\n try {\n /** Fetch the session from the api. */\n const response = await fetch(`${getBasePath()}/api/auth/session/`);\n /** Get the JSON from the response. */\n const jsonResponse = await response.json();\n return Promise.resolve(jsonResponse.session.idToken);\n } catch (error) {\n return Promise.reject(error);\n }\n};\n\n/**\n * Get the idToken from the session for the current user. This can be used to\n * authenticate backend api calls. This should be used in the server side code.\n *\n * @param {NextApiRequest} req - The request object.\n * @param {NextApiResponse} res - The response object.\n * @returns {string | null} The idToken for the current user.\n */\nexport const getIdTokenSSR = async (\n req: NextApiRequest,\n res: NextApiResponse\n): Promise<string | null> => {\n try {\n /** Fetch the session from the api. */\n const session = await getSession(req, res);\n if (session && session.idToken) {\n return session.idToken;\n }\n return null;\n } catch (error) {\n return null;\n }\n};\n","import { sdk } from '@/lib/dataSource/lostApi/common';\nimport { IServiceMethodResponse } from '@petcolove/lost--client--api-sdk/dist/abstract/service/interfaces';\nimport { IMeDto } from '@petcolove/lost--client--api-sdk/dist/concrete/sdks/services/auth/dto';\n\n/**\n * @param {string} authToken - This is the auth token for the current user\n * @returns {Promise<IMeDto>} The details of the current user\n */\nexport default async function getMe(authToken: string): Promise<IMeDto> {\n try {\n const me: IServiceMethodResponse = await sdk\n .me({ authToken: authToken })\n .read();\n const data = me.data as IMeDto;\n return data;\n } catch (error) {\n console.error(error);\n throw error;\n }\n}\n","import AbstractStorage from '@/lib/utils/storage/abstract-storage';\nimport SessionStorage from '@/lib/utils/storage/session-storage';\nimport React, { createContext, useContext, useEffect, useState } from 'react';\n\n/**\n * Describe the storybook user context\n *\n * @interface IStorybookAuthContext\n */\ninterface IStorybookAuthContext {\n /**\n * A flag to determine if is storybook\n *\n * @memberof IStorybookAuthContext\n * @member {boolean} isStorybook\n */\n isStorybook: boolean;\n /**\n * The id token\n *\n * @memberof IStorybookAuthContext\n * @member {string | null} [idToken]\n */\n idToken?: string | null;\n /**\n * Set the id token\n *\n * @memberof IStorybookAuthContext\n * @member {(idToken: string) => void} [setIdToken]\n */\n setIdToken?: (idToken: string) => void;\n}\n\n/**\n * The storybook context\n *\n * @constant {React.Context<IStorybookAuthContext>} StorybookContext\n */\nconst StorybookContext = createContext<IStorybookAuthContext>({\n isStorybook: false,\n});\n\n/**\n * The storybook user context provider props\n *\n * @interface IStorybookAuthContextProviderProps\n */\ninterface IStorybookAuthContextProviderProps {\n /**\n * The provider children\n *\n * @memberof IStorybookAuthContextProviderProps\n * @member {React.ReactNode} children\n */\n children: React.ReactNode;\n /**\n * The id token storage\n *\n * @memberof IStorybookAuthContextProviderProps\n * @member {AbstractStorage} [idTokenStorage]\n */\n idTokenStorage?: AbstractStorage;\n}\n\nconst defaultStorage = new SessionStorage();\n\n/**\n * The hook to use the stored id token\n *\n * @interface IUseStoredIdToken\n */\ninterface IUseStoredIdToken {\n /**\n * The id token\n *\n * @memberof IUseStoredIdToken\n * @member {string | null} idToken\n */\n idToken: string | null;\n /**\n * The setter function for the id token that also stores it in the storage\n *\n * @memberof IUseStoredIdToken\n * @member {(idToken: string) => void} setIdToken\n * @param idToken\n * @returns {void}\n */\n setIdToken: (idToken: string | null) => void;\n /**\n * The storage key for the id token\n *\n * @memberof IUseStoredIdToken\n * @member {string} storageKey\n */\n storageKey: string;\n}\n\n/**\n * The hook to use the stored id token\n *\n * @param {AbstractStorage} storage - The storage\n * @returns {IUseStoredIdToken} - The stored id token\n */\nexport const useStoredIdToken = (\n storage: AbstractStorage = defaultStorage\n): IUseStoredIdToken => {\n /**\n * The storage key for the id token\n *\n * @constant {string} storageKey\n */\n const storageKey = 'idToken';\n\n const [idToken, _setIdToken] = useState<string | null>(null);\n\n /** Hook retrieve the stored id token from storage */\n useEffect(() => {\n /**\n * The store id token\n *\n * @constant {string} storedIdToken\n */\n const storedIdToken = storage.get(storageKey);\n\n if (storedIdToken && typeof storedIdToken === 'string') {\n _setIdToken(storedIdToken);\n }\n }, [_setIdToken, storage]);\n\n /**\n * The setter function for the id token that also stores it in the storage\n *\n * @param {string} idToken - The id token\n */\n const setIdToken = (idToken: string | null) => {\n idToken === null\n ? storage.delete(storageKey)\n : storage.set(storageKey, idToken);\n\n _setIdToken(idToken);\n };\n\n return {\n idToken,\n setIdToken,\n storageKey,\n };\n};\n\n/**\n * The storybook provider\n *\n * @param {IStorybookAuthContextProviderProps} props - The props\n * @returns {React.ReactElement} - The storybook provider\n */\nexport const StorybookProvider = ({\n children,\n idTokenStorage,\n}: IStorybookAuthContextProviderProps) => {\n /**\n * The flag to determine if is storybook\n *\n * @constant {boolean} isStorybook\n */\n const isStorybook = process.env.STORYBOOK_BASE_URL !== undefined;\n const { idToken, setIdToken } = useStoredIdToken(idTokenStorage);\n\n return (\n <StorybookContext.Provider\n value={{\n setIdToken,\n idToken,\n isStorybook,\n }}\n >\n {children}\n </StorybookContext.Provider>\n );\n};\n\n/**\n * Use the storybook user context\n *\n * @returns {IStorybookAuthContext} - The storybook user context\n */\nexport const useStorybookAuthContext = (): IStorybookAuthContext => {\n const storybookContext = useContext(StorybookContext);\n const { isStorybook } = storybookContext;\n\n return isStorybook ? storybookContext : { isStorybook };\n};\n","import { getIdTokenClient } from '@/lib/dataSource/auth/getIdToken';\nimport getMe from '@/lib/dataSource/lostApi/auth/me';\nimport { usePersistentBannerContext } from '@/lib/hooks/persistentBanner/PersistentBanner';\nimport { useStorybookAuthContext } from '@/lib/hooks/useStorybookAuth/StorybookAuth';\nimport { tomorrow } from '@/lib/utils/helpers/dateHelpers/dates';\nimport SessionStorage from '@/lib/utils/storage/session-storage';\nimport { useUser } from '@auth0/nextjs-auth0/client';\nimport { IMeDto } from '@petcolove/lost--client--api-sdk/dist/concrete/sdks/services/auth/dto';\nimport { useRouter } from 'next/router';\nimport { useEffect, useState } from 'react';\n\ndeclare global {\n // eslint-disable-next-line jsdoc/require-jsdoc\n interface Window {\n // eslint-disable-next-line jsdoc/require-jsdoc\n dataLayer: Array<{ user_id: number } | object>;\n }\n}\n\n/**\n * Store Me This is used to deal with the session storage for me object\n *\n * @class MeStorage\n */\nexport class MeStorage {\n /** The session storage used in the class */\n readonly meStorage = new SessionStorage();\n\n /** The key to use for the storage */\n readonly meStorageKey = 'me';\n\n /**\n * A method used to store the me data in session storage\n *\n * @param {IMeDto} me - The me data to store\n */\n public set = (me: IMeDto) => {\n this.meStorage.set(this.meStorageKey, me, { expires: tomorrow });\n };\n\n /** A method used to remove the me data from session storage */\n public delete = () => {\n this.meStorage.delete(this.meStorageKey);\n };\n\n /**\n * A method used to get the me data from session storage\n *\n * @returns {IMeDto | null} The me data\n */\n public get = (): IMeDto | null => {\n return this.meStorage.get(this.meStorageKey) as IMeDto;\n };\n}\n\n/**\n * IUseMe\n *\n * @interface IUseMe\n */\nexport interface IUseMe {\n /**\n * The me object\n *\n * @memberof IUseMe\n * @member {IMeDto | null} [me]\n */\n me?: IMeDto | null;\n /**\n * The idToken\n *\n * @memberof IUseMe\n * @member {string} [idToken]\n */\n idToken?: string;\n /**\n * Indicates if the user is being fetched\n *\n * @memberof IUseMe\n * @member {boolean} [isFetchingUser]\n */\n isFetchingUser: boolean;\n /**\n * Is in error state\n *\n * @memberof IUseMe\n * @member {boolean} [isError]\n */\n isError?: boolean;\n /**\n * The error message\n *\n * @memberof IUseMe\n * @member {string} [errorMessage]\n */\n errorMessage?: string;\n}\n\n/** The me storage */\nconst meStorage = new MeStorage();\n\n/**\n * Hook to get the me object and the idToken\n *\n * @returns {IUseMe} Me - The me object\n */\nconst useMe = (): IUseMe => {\n const [idToken, setIdToken] = useState<string>();\n const [me, setMe] = useState<IMeDto | null>();\n const [isFetchingUser, setIsFetchingUser] = useState(true);\n const [isError, setIsError] = useState(false);\n const [errorMessage, setErrorMessage] = useState<string>();\n const { user, isLoading } = useUser();\n const router = useRouter();\n const { type, setBannerData } = usePersistentBannerContext();\n /**\n * @property {string | null} idTokenOverride - The id token from the storybook\n * auth context to override the id token\n * @property {boolean} isStorybook - The flag to determine if the hook is\n * being used in storybook\n */\n const { idToken: idTokenOverride, isStorybook } = useStorybookAuthContext();\n\n /**\n * A hook to override the id token\n *\n * This hook is setup to be used only inside storybook\n */\n useEffect(() => {\n if (idTokenOverride && isStorybook) {\n setIdToken(idTokenOverride);\n setIsError(false);\n setErrorMessage('');\n }\n }, [idTokenOverride, isStorybook]);\n\n /** Hook to get the idToken */\n useEffect(() => {\n if (!isLoading && user && !isStorybook) {\n getIdTokenClient()\n .then((idToken) => {\n setIdToken(idToken);\n setIsError(false);\n setErrorMessage('');\n })\n .catch((error) => {\n setIsError(true);\n setErrorMessage(error.message);\n console.error(error);\n });\n } else {\n /** If there is no user, than there should never be a warning banner */\n if (type === 'warning') {\n setBannerData();\n }\n /** Clear the me object in session storage if there is no user */\n meStorage.delete();\n }\n\n if (isStorybook) {\n setIsError(false);\n setErrorMessage('');\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [user, isLoading, isStorybook]);\n\n /** Hook to clear the isFetchingUser flag when there is no logged in user */\n useEffect(() => {\n if ((!isLoading && !user) || isError) {\n setIsFetchingUser(false);\n }\n }, [isLoading, user, router, isError]);\n\n /** Hook to get the me object */\n useEffect(() => {\n if (!idToken || isError) return;\n\n /** Check if we have the me object in session storage */\n let storedMe = meStorage.get();\n\n /**\n * Check the email of the me object in session storage and the email of the\n * useUser hook to check for equality if they are not equal it will clear\n * the data in storage\n */\n if (storedMe?.user?.email !== user?.email) {\n /** Clear the me object in session storage */\n meStorage.delete();\n /**\n * Set stored me to null, since there is no need to try to fetch it from\n * storage if we know it has just been cleared\n */\n storedMe = null;\n }\n\n /**\n * If idToken is available and the me key in session storage is not\n * available it will use getMe call to set the me key in session storage\n */\n if (!storedMe && idToken && !isError) {\n getMe(idToken)\n .then((me) => {\n setMe(me);\n meStorage.set(me);\n })\n .catch((error) => {\n setIsError(true);\n setErrorMessage(error.message);\n setMe(null);\n meStorage.delete();\n })\n .finally(() => {\n setIsFetchingUser(false);\n });\n } else {\n /**\n * If there is not need to re-fetch the me object, clear the\n * isFetchingUser flag\n */\n setMe(storedMe);\n setIsFetchingUser(false);\n setIsError(false);\n setErrorMessage('');\n }\n }, [idToken, user?.email, isError]);\n\n /** Hook to set the user id in the data layer if available */\n useEffect(() => {\n if (isError) return;\n if (me?.user?.id) {\n // Set dataLayer\n window.dataLayer = window.dataLayer || [];\n // Check if user id is already set\n const userAlreadySet = window.dataLayer.some(\n (el) => 'user_id' in el && el.user_id === me.user.id\n );\n\n if (!userAlreadySet) {\n window.dataLayer.push({\n user_id: me.user.id,\n });\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [router, isError]);\n\n return {\n me,\n idToken,\n isFetchingUser,\n isError,\n errorMessage,\n };\n};\n\nexport default useMe;\n","import { PetSpecies } from '@/components/molecules/ShelterPetCard/ShelterPetCard';\nimport { tomorrow } from '@/lib/utils/helpers/dateHelpers/dates';\nimport LocalStorage from '@/lib/utils/storage/local-storage';\nimport {\n createContext,\n ReactNode,\n useContext,\n useEffect,\n useState,\n} from 'react';\n\n/**\n * The banner storage class is used to deal with the storage for the persistent\n * banner\n */\nexport class BannerStorage {\n /** The storage used in the class */\n readonly storage = new LocalStorage();\n\n /** The key used for the storage */\n readonly key = 'banner';\n\n /**\n * A method used to store the banner data in storage\n *\n * @param {IBannerStorage} data - The banner data to store\n */\n public set = (data: IBannerStorage) => {\n this.storage.set(this.key, data, { expires: tomorrow });\n };\n\n /** A method used to remove the banner data from storage */\n public delete = () => {\n this.storage.delete(this.key);\n };\n\n /**\n * A method used to get the banner data from storage\n *\n * @returns {IBannerStorage | null} The banner props data\n */\n public get = (): IBannerStorage | null => {\n return this.storage.get(this.key) as IBannerStorage;\n };\n}\n\n/**\n * The interface for the banner storage\n *\n * @interface IBannerStorage\n */\ninterface IBannerStorage {\n /**\n * The type of banner to display\n *\n * @memberof IBannerStorage\n * @member {PersistentBannerTypes} [type]\n */\n type?: PersistentBannerTypes;\n /**\n * The props for the banner\n *\n * @memberof IBannerStorage\n * @member {BannerProps} [bannerProps]\n */\n bannerProps?: BannerProps;\n}\n\n/**\n * The types of banners that can be returned\n *\n * @typedef {string} PersistentBannerTypes\n */\nexport type PersistentBannerTypes = 'info' | 'warning' | 'partner';\n\n/**\n * The types of searches that can be done\n *\n * @typedef {string} SearchTypes\n */\nexport type SearchTypes = 'distance' | 'photo';\n\n/**\n * The type of pet reports\n *\n * @typedef {string} PetReportTypes\n */\nexport type PetReportTypes = 'lost' | 'found';\n\n/**\n * The type of pet reports\n *\n * @type {CreateAccountBannerProps | PetSearchBannerProps | PartnerBannerProps} BannerProps\n */\nexport type BannerProps =\n | CreateAccountBannerProps\n | PetSearchBannerProps\n | PartnerBannerProps;\n\n/**\n * The interface for the PersistentBannerHandler props used to display the\n * Create Account Banner\n *\n * @interface CreateAccountBannerProps\n */\nexport interface CreateAccountBannerProps {\n /**\n * The type of pet report\n *\n * @memberof CreateAccountBannerProps\n * @member {PetReportTypes} petReportType\n */\n petReportType: PetReportTypes;\n /**\n * The type of search\n *\n * @memberof CreateAccountBannerProps\n * @member {SearchTypes} searchType\n */\n searchType: SearchTypes;\n /**\n * The Pet species\n *\n * @memberof CreateAccountBannerProps\n * @member {PetSpecies} [species]\n */\n species?: PetSpecies;\n}\n\n/**\n * The interface for the PartnerBannerProps props used to display the Partner\n * Banner\n *\n * @interface PartnerBannerProps\n */\nexport interface PartnerBannerProps {\n /**\n * The partner name\n *\n * @memberof PartnerBannerProps\n * @member {string} partner\n */\n partner: string;\n\n /**\n * The type of pet report\n *\n * @memberof PartnerBannerProps\n * @member {PetReportTypes} petReportType\n */\n petReportType: PetReportTypes;\n}\n\n/**\n * The interface for the PersistentBannerHandler props used to display the Pet\n * Search Banner\n *\n * @interface PetSearchBannerProps\n */\nexport interface PetSearchBannerProps {\n /**\n * The Id of the pet, this is used for analytics\n *\n * @memberof PetSearchBannerProps\n * @member {number} [petId]\n */\n petId?: number;\n /**\n * The zip code of the pet, this is used for analytics\n *\n * @memberof PetSearchBannerProps\n * @member {string} [zipCode]\n */\n zipCode?: string;\n /**\n * The name of the pet, this is used for analytics\n *\n * @memberof PetSearchBannerProps\n * @member {string} [petName]\n */\n petName?: string;\n /**\n * The type of pet report\n *\n * @memberof PetSearchBannerProps\n * @member {PetReportTypes} petReportType\n */\n petReportType: PetReportTypes;\n /**\n * The pet data\n *\n * @memberof PetSearchBannerProps\n * @member {object} petData\n */\n petData: {\n /**\n * The Pet photo\n *\n * @memberof PetSearchBannerProps.petData\n * @member {string} photo\n */\n photo: string;\n /**\n * The pet species\n *\n * @memberof PetSearchBannerProps.petData\n * @member {PetSpecies} species\n */\n species: PetSpecies;\n /**\n * The coordinates for the user\n *\n * @memberof PetSearchBannerProps.petData\n * @member {object} coordinates\n */\n coordinates: {\n /**\n * The latitude\n *\n * @memberof PetSearchBannerProps.petData.coordinates\n * @member {number} latitude\n */\n latitude: number;\n /**\n * The longitude\n *\n * @memberof PetSearchBannerProps.petData.coordinates\n * @member {number} longitude\n */\n longitude: number;\n };\n /**\n * The label of the address of the pet\n *\n * @memberof PetSearchBannerProps.petData\n * @member {string} [address]\n */\n address?: string;\n };\n}\n\n/**\n * The interface for the PersistentBannerProvider props\n *\n * @interface IPersistentBannerContext\n */\nexport interface IPersistentBannerContext {\n /**\n * The type of banner\n *\n * @memberof IPersistentBannerContext\n * @member {PersistentBannerTypes} [type]\n */\n type?: PersistentBannerTypes;\n /**\n * The props used to create the banner\n *\n * @memberof IPersistentBannerContext\n * @member {BannerProps} [bannerProps]\n */\n bannerProps?: BannerProps;\n /**\n * The function to set the banner data\n *\n * @memberof IPersistentBannerContext\n * @member {Function} setBannerData\n */\n setBannerData: (\n type?: PersistentBannerTypes,\n bannerProps?: BannerProps\n ) => void;\n}\n\nconst PersistentBannerContext = createContext<IPersistentBannerContext>({\n type: undefined,\n bannerProps: undefined,\n /** The function to set the banner data */\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n setBannerData: () => {},\n});\n\n/**\n * The interface for the PersistentBannerProvider props\n *\n * @interface IPersistentBannerProvider\n */\ninterface IPersistentBannerProvider {\n /**\n * The children wrapped by the provider\n *\n * @memberof IPersistentBannerProvider\n * @member {ReactNode} children\n */\n children: ReactNode;\n}\n\n/**\n * The PersistentBannerProvider component.\n *\n * @param {IPersistentBannerProvider} props - The props for the\n * PersistentBannerProvider.\n * @returns {Element} - The PersistentBannerProvider.\n */\nexport function PersistentBannerProvider({\n children,\n}: IPersistentBannerProvider): JSX.Element {\n const storage = new BannerStorage();\n const [type, setType] = useState<PersistentBannerTypes>();\n const [bannerProps, setBannerProps] = useState<BannerProps>();\n\n useEffect(() => {\n const data = storage.get();\n if (data && !type && !bannerProps) {\n setType(data.type);\n setBannerProps(data.bannerProps);\n }\n // This only needs to run on render once since we do not want to continuously look in the storage.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /**\n * This function is used to set the banner data\n *\n * @param {PersistentBannerTypes} type - The type of banner\n * @param {BannerProps} bannerProps - The props for the banner\n */\n const setBannerData = (\n type?: PersistentBannerTypes,\n bannerProps?: BannerProps\n ): void => {\n setType(type);\n setBannerProps(bannerProps);\n storage.set({ type, bannerProps });\n };\n\n return (\n <PersistentBannerContext.Provider\n value={{ type, bannerProps, setBannerData }}\n >\n {children}\n </PersistentBannerContext.Provider>\n );\n}\n\n/**\n * A hook to access the PersistentBannerContext\n *\n * @returns {IPersistentBannerContext} - The PersistentBannerContext\n */\nexport const usePersistentBannerContext = (): IPersistentBannerContext =>\n useContext(PersistentBannerContext);\n","import { defaultEventEmitter } from '@/lib/analytics/commonEmitter';\nimport { IEvent } from '@/lib/analytics/handlers/abstractAnalyticsHandler';\nimport { AnalyticsInitiatingComponent } from '@/lib/storageClasses/analyticsEventStorage';\n\n/**\n * The flow type\n *\n * @type {Flow}\n */\ntype Flow = 'Lost' | 'Found' | 'All';\n\n/**\n * The event name\n *\n * @constant {string}\n */\nconst eventName = 'start_pet_search';\n\n/**\n * The interface for the user sign up event\n *\n * @interface IUserSignUpEvent\n */\nexport interface IStartPetSearchEvent {\n /** The clicked text */\n clickText: string;\n /** The search flow */\n flow: Flow;\n /** The component used to start event */\n component: AnalyticsInitiatingComponent;\n}\n\n/**\n * Handle the user sign up event\n *\n * @param {IStartPetSearchEvent} params - The event params\n */\nexport const startPetSearchEventHandler = ({\n clickText,\n flow,\n component,\n}: IStartPetSearchEvent) => {\n const eventData: IEvent = {\n name: eventName,\n data: {\n click_text: clickText,\n flow_type: flow,\n component,\n },\n };\n defaultEventEmitter.handleEvent(eventData);\n};\n"],"names":["Footer","dynamic","Promise","all","__webpack_require__","e","then","bind","Navbar","ToastHandler","__webpack_exports__","children","param","hasMessage","isFetchingUser","isLoggedIn","isShelter","useUserContext","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","jsxs","Fragment","jsx","loggedIn","main","mockFooterProps","base","footerColumnFourILostAPetLinks","name","url","footerColumnFourIFoundAPetLinks","footerColumnFourLinks","links","onClick","iLostAPetClickText","startPetSearchEventHandler","clickText","component","flow","iFoundAPetClickText","currentYear","Date","getFullYear","columnOne","target","columnTwo","columnThree","columnFour","columnFourLoggedIn","disclosure","concat","bottomLinks","getIdTokenClient","response","fetch","getBasePath","jsonResponse","json","resolve","session","idToken","error","reject","getMe","authToken","me","sdk","read","data","StorybookContext","createContext","isStorybook","SessionStorage","useStorybookAuthContext","storybookContext","useContext","meStorage","meStorageKey","set","expires","tomorrow","delete","get","me_useMe","setIdToken","useState","setMe","setIsFetchingUser","isError","setIsError","errorMessage","setErrorMessage","user","isLoading","useUser","router","useRouter","type","setBannerData","usePersistentBannerContext","idTokenOverride","useEffect","catch","message","storedMe","email","finally","id","window","dataLayer","userAlreadySet","some","el","user_id","push","BannerStorage","storage","LocalStorage","key","PersistentBannerContext","undefined","bannerProps","PersistentBannerProvider","setType","setBannerProps","Provider","value","defaultEventEmitter","handleEvent","click_text","flow_type"],"sourceRoot":""}