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webpack://_N_E/./src/lib/analytics/handlers/klaviyoEventHandler.ts","webpack://_N_E/./src/lib/analytics/commonEmitter.ts","webpack://_N_E/./src/lib/analytics/eventEmitter.ts","webpack://_N_E/./src/lib/analytics/handlers/abstractAnalyticsHandler.ts","webpack://_N_E/./src/lib/analytics/handlers/googleTagManagerHandler.ts","webpack://_N_E/./src/lib/dataSource/lostApi/common.ts","webpack://_N_E/./src/lib/utils/helpers/photoHelpers/photoObjectKeysAreEqual.ts","webpack://_N_E/./src/lib/storageClasses/petStorage.ts","webpack://_N_E/./src/lib/hooks/storePets/useStorePets.ts","webpack://_N_E/./src/lib/utils/helpers/dateHelpers/dates.ts","webpack://_N_E/./src/lib/utils/storage/local-storage.ts","webpack://_N_E/./src/lib/utils/helpers/ObjectsHelpers/getExpirationDate.ts","webpack://_N_E/./src/lib/utils/helpers/stringHelpers/parseToJSONSafe.ts","webpack://_N_E/./src/lib/utils/storage/session-storage.ts","webpack://_N_E/<anon>"],"sourcesContent":["import AbstractAnalyticsHandler, { IEvent } from './abstractAnalyticsHandler';\n/**\n * EventLogHandler\n *\n * This will console log all the event data\n *\n * YOU WILL NEED TO UPDATE THE next.config.js TO ALLOW CONSOLE LOGS\n *\n * @augments AbstractAnalyticsHandler\n * @class\n */\nexport default class EventLogHandler extends AbstractAnalyticsHandler {\n /**\n * @memberof EventLogHandler\n * @param {IEvent} data - The data to be sent with the event\n */\n send(data: IEvent) {\n const analyticFeature = this.getAnalyticsFeature();\n\n /**\n * The data object to be sent to the console\n *\n * @memberof EventLogHandler\n * @member {object} dataObject\n */\n const dataObject: {\n /** The data associated with the event */\n data: object;\n /** The feature flags that are enabled */\n feature: string;\n } = {\n data: data.data,\n feature: analyticFeature,\n };\n\n console.log('EventLogHandler:', dataObject);\n }\n}\n","import getBasePath from '@/lib/utils/getBasePath/getBasePath';\nimport axios from 'axios';\nimport AbstractAnalyticsHandler, { IEvent } from './abstractAnalyticsHandler';\n\n/**\n * KlaviyoEventHandler\n *\n * @augments AbstractAnalyticsHandler\n */\nexport default class KlaviyoEventHandler extends AbstractAnalyticsHandler {\n /** @param {IEvent} data - The data to be sent with the event */\n async send(data: IEvent) {\n const eventData = {\n data: {\n type: 'event',\n attributes: {\n properties: data.data.attributes,\n time: new Date(),\n metric: {\n data: {\n type: 'metric',\n attributes: {\n name: data.name,\n },\n },\n },\n profile: {\n data: {\n type: 'profile',\n attributes: data.data.profile,\n },\n },\n },\n },\n };\n axios.post(`${getBasePath()}/api/klaviyo/events`, eventData);\n }\n}\n","import { googleTagManagerBrand } from '../constants/constants/analytics';\nimport EventEmitter from './eventEmitter';\nimport EventLogHandler from './handlers/eventLogHandler';\nimport GoogleTagManagerHandler from './handlers/googleTagManagerHandler';\nimport KlaviyoEventHandler from './handlers/klaviyoEventHandler';\n\n/** Instances of each handler class */\nconst logEventHandler = new EventLogHandler(googleTagManagerBrand);\nconst gtmEventHandler = new GoogleTagManagerHandler(googleTagManagerBrand);\nconst klaviyoEventHandler = new KlaviyoEventHandler(googleTagManagerBrand);\n\n/** Instances of each emitter */\nexport const logEventEmitter = new EventEmitter([logEventHandler]);\nexport const gtmEventEmitter = new EventEmitter([gtmEventHandler]);\n\n/** DefaultEventEmitter to contain all handlers */\nexport const defaultEventEmitter = new EventEmitter([\n logEventHandler,\n gtmEventHandler,\n]);\n\n/** KlaviyoEventEmitter to contain Klaviyo related handlers */\nexport const klaviyoEventEmitter = new EventEmitter([\n logEventHandler,\n klaviyoEventHandler,\n]);\n","import AbstractAnalyticsHandler, {\n IEvent,\n} from './handlers/abstractAnalyticsHandler';\n\n/**\n * EventEmitter\n *\n * This will be used to dispatch each event to the appropriate handler\n *\n * @class\n */\nexport default class EventEmitter {\n /**\n * The handlers to be used for each event\n *\n * @memberof EventEmitter\n * @member {AbstractAnalyticsHandler[]} handlers\n */\n private handlers: AbstractAnalyticsHandler[];\n\n /** @param {AbstractAnalyticsHandler[]} handlers - Instances of handlerClasses */\n constructor(handlers: AbstractAnalyticsHandler[]) {\n this.handlers = handlers;\n }\n\n /**\n * The event handler\n *\n * @param {IEvent} data - Information about the event\n */\n handleEvent(data: IEvent) {\n this.handlers.forEach((handler) => {\n handler.send(data);\n });\n }\n}\n","import { notApplicableString } from '@/lib/constants/constants/analytics';\nimport { analyticsFeatureKey } from '@/lib/utils/featureFlags/optimizely/featureFlagOverride';\nimport CookieStorage from '@/lib/utils/storage/cookie-storage';\n\n/** @typedef validTypes - Valid types for event data */\ntype ValidTypes = string | number | boolean | object | null | undefined;\n\n/** @typedef eventData - How to pass the data within the event */\ntype EventData = { [key: string]: ValidTypes };\n\n/**\n * Describes the base event structure\n *\n * @interface IEvent\n */\nexport interface IEvent {\n /**\n * The name of the event\n *\n * @memberof IEvent\n * @member {string} name\n */\n name: string;\n /**\n * The data associated with the event\n *\n * @memberof IEvent\n * @member {EventData} data - The data associated with the event\n */\n data: EventData;\n}\n\n/**\n * Provides an abstract class for analytics handlers\n *\n * @abstract\n * @class\n * @name analyticsHandler\n */\nexport default abstract class AbstractAnalyticsHandler {\n /**\n * The source platform of the event data\n *\n * @memberof AbstractAnalyticsHandler\n * @member {string} brand\n */\n brand: string;\n\n /**\n * @memberof AbstractAnalyticsHandler\n * @param {string} brand - The source platform of the event data\n */\n constructor(brand: string) {\n this.brand = brand;\n }\n\n /**\n * @memberof AbstractAnalyticsHandler\n * @returns {string} - The analytic feature that is enabled\n * @protected\n */\n protected getAnalyticsFeature(): string {\n const cookies = new CookieStorage();\n const optimizelyDecision = cookies.get(analyticsFeatureKey) as {\n /** The analytic feature that is enabled */\n analytic: string;\n };\n let feature: string = notApplicableString;\n if (optimizelyDecision && optimizelyDecision.analytic) {\n // Split the string into an array\n feature = optimizelyDecision.analytic;\n }\n return feature;\n }\n\n /**\n * @memberof AbstractAnalyticsHandler\n * @abstract\n * @param {IEvent} data - The data to be sent with the event\n */\n abstract send(data: IEvent): void;\n}\n","import AbstractAnalyticsHandler, { IEvent } from './abstractAnalyticsHandler';\n\n/**\n * GoogleTagManagerHandler\n *\n * @augments AbstractAnalyticsHandler\n */\nexport default class GoogleTagManagerHandler extends AbstractAnalyticsHandler {\n /** @param {IEvent} data - The data to be sent with the event */\n send(data: IEvent) {\n const feature = this.getAnalyticsFeature();\n /** The data object to be sent to Google Tag Manager */\n const dataObject: { [key: string]: string | string[] } = {\n brand: this.brand,\n ...data.data,\n feature,\n };\n gtag('event', data.name, dataObject);\n }\n}\n","import { PetcoLoveSDK } from '@petcolove/lost--client--api-sdk';\n\n/**\n * Initialize the SDK\n *\n * @returns {PetcoLoveSDK} The SDK instance\n */\nexport function initSDK(): PetcoLoveSDK {\n /**\n * The PLL API base URL\n *\n * @constant {string | undefined} pllApiBaseUrl\n */\n const pllApiBaseUrl =\n process.env.NEXT_PUBLIC_PLL_API_BASE_URL ??\n process.env.STORYBOOK_PLL_API_BASE_URL;\n /**\n * The PLL Websocket base URL\n *\n * @constant {string | undefined} pllWebsocketBaseUrl\n */\n const pllWebsocketBaseUrl =\n process.env.NEXT_PUBLIC_PLL_WEBSOCKET_BASE_URL ??\n process.env.STORYBOOK_PLL_WEBSOCKET_BASE_URL;\n\n if (!pllApiBaseUrl) {\n throw new Error('NEXT_PUBLIC_PLL_API_BASE_URL is not defined');\n }\n\n if (!pllWebsocketBaseUrl) {\n throw new Error('NEXT_PUBLIC_PLL_WEBSOCKET_BASE_URL is not defined');\n }\n\n const sdk = new PetcoLoveSDK(pllApiBaseUrl, pllWebsocketBaseUrl);\n\n return sdk;\n}\n\nexport const sdk: PetcoLoveSDK = initSDK();\n","/**\n * Compare two photo object keys\n *\n * @param {string} photoA - The first photo object key. Example: `pet-1`\n * @param {string} photoB - The second photo object key. Example: `pet-1`\n * @returns {boolean} - Whether or not the photo object keys are equal\n */\nfunction photoObjectKeysAreEqual(photoA: string, photoB: string): boolean {\n return photoA.split('/').pop() === photoB.split('/').pop();\n}\n\nexport default photoObjectKeysAreEqual;\n","import { IPetRow } from '@/components/molecules/PetRow/PetRow';\nimport { IShelterPetCard } from '@/components/molecules/ShelterPetCard/ShelterPetCard';\nimport { IAllUpdatePet, IUpdatedPet } from '@/lib/hooks/storePets/useStorePets';\nimport SessionStorage from '@/lib/utils/storage/session-storage';\nimport photoObjectKeysAreEqual from '../utils/helpers/photoHelpers/photoObjectKeysAreEqual';\n\n/**\n * The session storage instance\n *\n * @constant {SessionStorage} storage\n */\nexport const storage = new SessionStorage();\n\n/**\n * The key for the updatePet object in session storage\n *\n * @constant {string} updatePetStorageKey\n */\nexport const updatedPetsStorageKey = 'updatedPets';\n\n/**\n * The key for the updatePet object in session storage\n *\n * @constant {string} updatePetStorageKey\n */\nexport const newPetsStorageKey = 'newPets';\n\n/**\n * UpdatePetStorage class. This is used to deal with the side effects of our\n * event system, as updating a pet will not be reflected immediately This will\n * store the updatePet object in session storage, and then the pet page will\n * check for this object and use it\n *\n * @class UpdatePetStorage\n */\nexport class PetsStorage {\n /**\n * The updatePetStorage instance\n *\n * @private\n * @constant {SessionStorage} updatePetStorage\n * @readonly\n */\n private readonly updatePetStorage = storage;\n\n /**\n * The key for the updatePet object in session storage\n *\n * @private\n * @constant {string} updatePetStorageKey\n * @readonly\n */\n private readonly updatedPetsStorageKey = updatedPetsStorageKey;\n\n /**\n * The key for the updatePet object in session storage\n *\n * @private\n * @constant {string} updatePetStorageKey\n * @readonly\n */\n private readonly newPetsStorageKey = newPetsStorageKey;\n\n /**\n * Set an updated pet object in session storage\n *\n * @param {IPetRow | IShelterPetCard} pet - The pet object to store\n */\n public storeNewPet = (pet: IPetRow | IShelterPetCard) => {\n const allCreatedPets = this.getStoredNewPets();\n const updatedStoredNewPets = [];\n\n if (allCreatedPets !== null) {\n updatedStoredNewPets.push(...allCreatedPets);\n }\n\n updatedStoredNewPets.push(pet);\n this.updatePetStorage.set(this.newPetsStorageKey, updatedStoredNewPets);\n };\n\n /**\n * Set the updatePet object in session storage\n *\n * @param {IUpdatedPet} updatePet - The updatePet object to store\n */\n public storeUpdatedPet = (updatePet: IUpdatedPet) => {\n this.updatePetStorage.set(this.updatedPetsStorageKey, updatePet);\n };\n\n /**\n * Get all of the created pet objects from session storage\n *\n * @returns {IPetRow[]} The stored new pets\n */\n public getStoredNewPets = (): IPetRow[] | null => {\n return this.updatePetStorage.get(this.newPetsStorageKey) as\n | IPetRow[]\n | null;\n };\n\n /**\n * Get all of the created org pet objects from session storage\n *\n * @returns {IShelterPetCard[]} The stored new pets\n */\n public getStoredNewOrgPets = (): IShelterPetCard[] | null => {\n return this.updatePetStorage.get(this.newPetsStorageKey) as\n | IShelterPetCard[]\n | null;\n };\n\n /**\n * Get all of the updatePet objects from session storage\n *\n * @returns {IAllUpdatePet | null} The updatePet object\n */\n public getStoredUpdatedPets = (): IAllUpdatePet | null => {\n return this.updatePetStorage.get(\n this.updatedPetsStorageKey\n ) as IAllUpdatePet;\n };\n\n /**\n * Get a specific pet Id from the updatePet object from session storage\n *\n * @param {string} id - The id of the pet to get\n * @returns {IUpdatedPet | null} The updatePet object\n */\n public getStoredUpdatedPet = (id: string): IUpdatedPet | null => {\n const response = this.updatePetStorage.get(\n this.updatedPetsStorageKey\n ) as IAllUpdatePet;\n if (response && response[id]) {\n return response[id];\n }\n return null;\n };\n\n /**\n * Get the updatePet object from session storage\n *\n * @param {string} id - The id of the pet to delete\n */\n public deleteUpdatedPetId = (id: string) => {\n const response = this.getStoredUpdatedPet(id);\n if (response) {\n this.updatePetStorage.delete(this.updatedPetsStorageKey);\n }\n };\n\n /**\n * Get the new org pet object from session storage\n *\n * @param {number} index - The index of the pet to delete\n */\n public deleteNewOrgPetObject = (index: number) => {\n const allNewPets = this.getStoredNewOrgPets();\n if (allNewPets === null) return;\n allNewPets.splice(index, 1);\n this.updatePetStorage.set(this.newPetsStorageKey, allNewPets);\n };\n\n /**\n * Deletes a pet object from the createPet object in session storage\n *\n * @param {IPetRow} pet - The pet object to delete\n */\n public deleteNewPetObject = (pet: IPetRow) => {\n /**\n * The list of all the stored new pets\n *\n * @constant {IPetRow[]} allStoredNewPets\n */\n const allCreatedPets = this.getStoredNewPets();\n\n if (allCreatedPets === null) return;\n\n const { photo } = pet;\n\n this.updatePetStorage.set(this.newPetsStorageKey, [\n ...allCreatedPets.filter((pet: IPetRow) => {\n return !photoObjectKeysAreEqual(pet.photo.photo_1, photo.photo_1);\n }),\n ]);\n\n if (this.getStoredNewPets()?.length === 0) {\n this.updatePetStorage.delete(this.newPetsStorageKey);\n }\n };\n}\n","import { IPetRow, ValidPetTypes } from '@/components/molecules/PetRow/PetRow';\nimport { IShelterPetCard } from '@/components/molecules/ShelterPetCard/ShelterPetCard';\nimport { PetsStorage } from '@/lib/storageClasses/petStorage';\nimport photoObjectKeysAreEqual from '@/lib/utils/helpers/photoHelpers/photoObjectKeysAreEqual';\nimport { IPetPhotoRank } from '@petcolove/lost--client--api-sdk/dist/concrete/sdks/services/users/pets/dto';\nimport { useCallback } from 'react';\n\n/**\n * The updatePetStorage instance\n *\n * @constant {PetsStorage} updatePetStorage\n */\nconst updatePetStorage = new PetsStorage();\n\n/**\n * IUpdatedPet\n *\n * @interface IUpdatedPet\n */\nexport interface IUpdatedPet {\n /** The updated Image for the shelter pet */\n photo?: string | IPetPhotoRank;\n /** The updated description for the pet */\n description?: string;\n /** The updated Name for the pet */\n name?: string;\n /** The updated Intake date for a shelter pet */\n intakeDate?: string;\n /** The listing type of pet */\n listingType?: ValidPetTypes;\n /** The updating status state of the pet */\n updatingStatus?: boolean;\n /** A date ISO string of time the pet information was saved to the storage */\n expiresAt?: string;\n}\n\n/**\n * IAllUpdatePet\n *\n * @interface IAllUpdatePet\n */\nexport interface IAllUpdatePet {\n [key: string]: IUpdatedPet;\n}\n\n/**\n * Describes the return object of the useUpdatePet hook\n *\n * @interface IUseUpdatePetReturn\n */\nexport interface IUseUpdatePetReturn {\n /** The updatePet function */\n storeUpdatedPet: (id: string, petInfo: IUpdatedPet) => void;\n /** The readPet function */\n readStoredUpdatedPet: (id: string, pet: IUpdatedPet) => IUpdatedPet | null;\n /** Read All stored pets */\n readStoredUpdatedPets: () => IAllUpdatePet | null;\n /** Read all created pets that have been stored */\n readStoredNewPets: () => IPetRow[] | null;\n /** Read all created org pets that have been stored */\n readStoredNewOrgPets: () => IShelterPetCard[] | null;\n /** The store created pet function */\n storeNewPet: (petInfo: IPetRow) => void;\n /** The store create Org pet function */\n storeNewOrgPet: (petInfo: IShelterPetCard) => void;\n /** Validate the created Org pets Function */\n validateCreatedOrgPets: (image: string) => boolean;\n /** Delete Updated Pet */\n deleteStoredUpdatedPet: (id: string) => void;\n}\n\n/**\n * The props for the useStorePets hook\n *\n * @interface IUseStorePetsProps\n */\ninterface IUseStorePetsProps {\n /** The already processed pets */\n processedPets?: IPetRow[];\n /** The already processed Org Pets */\n processedOrgPets?: IShelterPetCard[];\n}\n\n/**\n * Hook store new pets and update pets to deal delays on pet processing\n *\n * @param {IUseStorePetsProps} [props={}] - The props for the hook. Default is\n * `{}`. Default is `{}`\n * @returns {IUseUpdatePetReturn} The updatePet return interface\n */\nconst useStorePets = ({\n processedPets,\n}: IUseStorePetsProps = {}): IUseUpdatePetReturn => {\n /**\n * Save the created pet to session storage\n *\n * @param {IPetRow} petInfo - The pet data to save\n */\n const storeNewPet = (petInfo: IPetRow) => {\n updatePetStorage.storeNewPet({ ...petInfo, processing: true });\n };\n\n /**\n * Save the created org pet to session storage\n *\n * @param {IShelterPetCard} petInfo - The pet data to save\n */\n const storeNewOrgPet = (petInfo: IShelterPetCard) => {\n updatePetStorage.storeNewPet({ ...petInfo, processing: true });\n };\n\n /**\n * Read all create pets that have been stored in session storage\n *\n * @returns {IPetRow[]} - The created pets\n */\n const readStoredNewPets = (): IPetRow[] | null => {\n clearProcessedNewPets();\n const allCreatedPets = updatePetStorage.getStoredNewPets();\n return allCreatedPets;\n };\n\n /**\n * Read all create org pets that have been stored in session storage\n *\n * @returns {IShelterPetCard[]} - The created org pets\n */\n const readStoredNewOrgPets = (): IShelterPetCard[] | null => {\n const allCreatedPets = updatePetStorage.getStoredNewPets();\n return allCreatedPets;\n };\n\n /**\n * If the pet was created by the org, and is now returned with the get all awo\n * pets call we need to delete it from session storage\n *\n * @param {string} image - The image to validate\n * @returns {boolean} - Whether or not the pet was deleted\n */\n const validateCreatedOrgPets = (image: string): boolean => {\n const allCreatedPets = updatePetStorage.getStoredNewOrgPets();\n if (allCreatedPets && allCreatedPets.length > 0) {\n const pet = allCreatedPets.findIndex((pet) => {\n if (!pet.image) return false;\n return photoObjectKeysAreEqual(pet.image, image);\n });\n if (pet !== -1) {\n updatePetStorage.deleteNewOrgPetObject(pet);\n return true;\n }\n return false;\n }\n return false;\n };\n\n /**\n * Set the updatePet object in session storage\n *\n * @param {string} id - The id of the pet to update\n * @param {IUpdatedPet} petInfo - The updatePet Data\n * @returns {void}\n */\n const storeUpdatedPet = (id: string, petInfo: IUpdatedPet): void => {\n const allPets = updatePetStorage.getStoredUpdatedPets();\n if (allPets) {\n updatePetStorage.storeUpdatedPet({ ...allPets, [id]: petInfo });\n return;\n }\n updatePetStorage.storeUpdatedPet({ [id]: petInfo });\n };\n\n /**\n * Read the updatePet object from session storage then determine if the pet\n * should be deleted or if the pet from session storage should be used\n *\n * @param {string} id - The id of the pet to get\n * @param {IUpdatedPet} pet - The pet data from the API\n * @returns {IUpdatedPet | null} The updatePet object\n */\n const readStoredUpdatedPet = (\n id: string,\n pet: IUpdatedPet\n ): IUpdatedPet | null => {\n const allPets = readStoredUpdatedPets();\n if (allPets) {\n const idExists = doesIdExist(id, allPets);\n if (!idExists) {\n return null;\n }\n const sessionPet = allPets[id];\n const shouldDelete = shouldDeleteStoredPet(pet, sessionPet);\n if (shouldDelete) {\n deleteStoredUpdatedPet(id);\n return null;\n }\n return sessionPet;\n }\n return null;\n };\n\n /**\n * Get all the pets from session storage\n *\n * @returns {IAllUpdatePet | null} All of the pets from session storage\n */\n const readStoredUpdatedPets = (): IAllUpdatePet | null => {\n const updatePetStorage = new PetsStorage();\n return updatePetStorage.getStoredUpdatedPets();\n };\n\n /**\n * Check if the id exists within the updatePet object\n *\n * @param {string} id - The id of the pet to use\n * @param {IAllUpdatePet} pets - The pets from session storage\n * @returns {boolean} - Whether or not the id exists\n */\n const doesIdExist = (id: string, pets: IAllUpdatePet): boolean => {\n return id in pets;\n };\n\n /**\n * Delete the pet from session storage\n *\n * @param {string} id - The id of the pet to delete\n */\n const deleteStoredUpdatedPet = (id: string): void => {\n updatePetStorage.deleteUpdatedPetId(id);\n };\n\n /**\n * Determine if the pet from session storage should be deleted\n *\n * @param {IUpdatedPet} pet - The pet data from the API\n * @param {IUpdatedPet} sessionPet - The pet data from session storage\n * @returns {boolean} - Whether or not the pet was deleted\n */\n const shouldDeleteStoredPet = (\n pet: IUpdatedPet,\n sessionPet: IUpdatedPet\n ): boolean => {\n const deleteName = deleteForName(pet, sessionPet);\n const deletePhoto = deleteForPhoto(pet, sessionPet);\n const deleteIntakeDate = deleteForIntakeDate(pet, sessionPet);\n const deleteListingType = deleteForListingType(pet, sessionPet);\n const deleteDescription = deleteForDescription(pet, sessionPet);\n const hasExpired = checkIfEntryExpired(sessionPet);\n\n if (\n (deleteName &&\n deletePhoto &&\n deleteIntakeDate &&\n deleteListingType &&\n deleteDescription) ||\n hasExpired\n ) {\n return true;\n }\n\n return false;\n };\n\n /**\n * Delete the pet from session storage if the pet from session storage matches\n * the data from the API\n *\n * @param {IUpdatedPet} pet - The pet data from the API\n * @param {IUpdatedPet} sessionPet - The pet data from session storage\n * @returns {boolean} - Whether or not the pet was deleted\n */\n const deleteForName = (\n pet: IUpdatedPet,\n sessionPet: IUpdatedPet\n ): boolean => {\n let willDelete = false;\n if ((sessionPet.name && pet.name === sessionPet.name) || !sessionPet.name) {\n willDelete = true;\n }\n return willDelete;\n };\n\n /**\n * Delete the pet from session storage if the pet from session storage matches\n * the data from the API\n *\n * @param {IUpdatedPet} pet - The pet data from the API\n * @param {IUpdatedPet} sessionPet - The pet data from session storage\n * @returns {boolean} - Whether or not the pet was deleted\n */\n const deleteForDescription = (\n pet: IUpdatedPet,\n sessionPet: IUpdatedPet\n ): boolean => {\n let willDelete = false;\n if (\n (sessionPet.description && pet.description === sessionPet.description) ||\n !sessionPet.description\n ) {\n willDelete = true;\n }\n return willDelete;\n };\n\n /**\n * Delete the pet from session storage if the pet from session storage matches\n * the data from the API\n *\n * @param {IUpdatedPet} pet - The pet data from the API\n * @param {IUpdatedPet} sessionPet - The pet data from session storage\n * @returns {boolean} - Whether or not the pet was deleted\n */\n const deleteForListingType = (\n pet: IUpdatedPet,\n sessionPet: IUpdatedPet\n ): boolean => {\n let willDelete = false;\n if (\n (sessionPet.listingType && pet.listingType === sessionPet.listingType) ||\n !sessionPet.listingType\n ) {\n willDelete = true;\n }\n return willDelete;\n };\n\n /**\n * Delete the pet from session storage if the entry date has expired.\n *\n * @param {IUpdatedPet} sessionPet - The pet data from session storage\n * @returns {boolean} - Whether or not the date has expired\n */\n const checkIfEntryExpired = (sessionPet: IUpdatedPet) => {\n /*\n * This returns `false` to keep backwards compatibility with entries that don't\n * make use of expiresAt\n */\n if (!sessionPet.expiresAt) {\n return false;\n }\n\n const now = new Date();\n const expiresAt = new Date(sessionPet.expiresAt);\n if (now > expiresAt) {\n return true;\n }\n\n return false;\n };\n\n /**\n * Mark the pet for deletion if the photo object from the session storage\n * matches the photo object from the API\n *\n * @param {IPetPhotoRank} pet - The pet data from the API\n * @param {IPetPhotoRank} sessionPet - The pet data from session storage\n * @returns {boolean} - Whether or not the pet was deleted\n */\n const deleteForPhotos = (\n pet?: IPetPhotoRank,\n sessionPet?: IPetPhotoRank\n ): boolean => {\n if (!sessionPet) {\n return true;\n }\n\n let sessionPhotoPaths = [];\n if (sessionPet) {\n sessionPhotoPaths = Object.values(sessionPet);\n }\n sessionPhotoPaths = sessionPhotoPaths.map((path) =>\n removeCharactersBeforeLastSlash(path)\n );\n\n sessionPhotoPaths.sort();\n\n let petPhotoPaths = [];\n if (pet) {\n petPhotoPaths = Object.values(pet);\n }\n petPhotoPaths = petPhotoPaths.map((path) =>\n removeCharactersBeforeLastSlash(path)\n );\n\n petPhotoPaths.sort();\n\n let willDelete = true;\n\n const length =\n sessionPhotoPaths.length > petPhotoPaths.length\n ? sessionPhotoPaths.length\n : petPhotoPaths.length;\n for (let i = 0; i < length; i++) {\n if (sessionPhotoPaths[i] !== petPhotoPaths[i]) {\n willDelete = false;\n break;\n }\n }\n\n return willDelete;\n };\n\n /**\n * Remove the characters before the last slash in the string\n *\n * @param {string} path - The string to remove characters from\n * @returns {string} - The string after the last slash\n */\n const removeCharactersBeforeLastSlash = (path: string) => {\n return path.substring(path.lastIndexOf('/') + 1);\n };\n\n /**\n * Delete the pet from session storage if the pet from session storage matches\n * the data from the API\n *\n * @param {IUpdatedPet} pet - The pet data from the API\n * @param {IUpdatedPet} sessionPet - The pet data from session storage\n * @returns {boolean} - Whether or not the pet was deleted\n */\n const deleteForPhoto = (\n pet: IUpdatedPet,\n sessionPet: IUpdatedPet\n ): boolean => {\n let willDelete = false;\n if (typeof pet.photo === 'string' && typeof sessionPet.photo === 'string') {\n const sessionPhotoPath = sessionPet.photo?.split('/').pop();\n const petPhotoPath = pet.photo?.split('/').pop();\n\n if (sessionPhotoPath === petPhotoPath || !sessionPet.photo) {\n willDelete = true;\n }\n return willDelete;\n }\n return deleteForPhotos(\n pet.photo as IPetPhotoRank,\n sessionPet.photo as IPetPhotoRank\n );\n };\n\n /**\n * Delete the pet from session storage if the pet from session storage matches\n * the data from the API\n *\n * @param {IUpdatedPet} pet - The pet data from the API\n * @param {IUpdatedPet} sessionPet - The pet data from session storage\n * @returns {boolean} - Whether or not the pet was deleted\n */\n const deleteForIntakeDate = (\n pet: IUpdatedPet,\n sessionPet: IUpdatedPet\n ): boolean => {\n const sessionDate = new Date(\n sessionPet.intakeDate as string\n ).toLocaleDateString('en-us', {\n timeZone: 'UTC',\n });\n\n let willDelete = false;\n if (\n (sessionDate && pet.intakeDate === sessionDate) ||\n !sessionPet.intakeDate\n ) {\n willDelete = true;\n }\n return willDelete;\n };\n\n /**\n * Function to clear the processed pets from session storage. Once a pet is\n * processed it is returned from the API. We match store pets with processed\n * pets by comparing the photo object Key since only the path changes.\n *\n * If we get back a pet from the API that has the same photo object key as a\n * stored pet, we should delete the stored pet.\n *\n * @example\n * const notProcessedPhotoObjectKey = 'pending/12345.jpg';\n * const processedPhotoObjectKey = 'photos/pet/12345.jpg';\n */\n const clearProcessedNewPets = useCallback(() => {\n /**\n * The list of all the stored new pets\n *\n * @constant {IPetRow[]} allStoredNewPets\n */\n const allStoredNewPets = updatePetStorage.getStoredNewPets();\n\n if (processedPets?.length === 0 || !processedPets) {\n return {};\n }\n\n if ('photo' in processedPets[0]) {\n processedPets?.forEach((pet: IPetRow) => {\n const { photo, id } = pet;\n\n /**\n * A stored pet with the same id as the processed pet\n *\n * @constant {IPetRow | undefined} storedPetWithSameId\n */\n const storedPetWithSameId = allStoredNewPets?.find(\n (createdPet: IPetRow) => id !== undefined && id === createdPet.id\n );\n\n if (storedPetWithSameId) {\n return updatePetStorage.deleteNewPetObject(storedPetWithSameId);\n }\n\n /**\n * A stored pet with the photo object key as the processed pet\n *\n * @constant {IPetRow | undefined} storedPetWithSamePhotoObjectKey\n */\n const storedPetWithSamePhotoObjectKey = allStoredNewPets?.find(\n (createdPet: IPetRow) => {\n return (\n removeCharactersBeforeLastSlash(createdPet.photo.photo_1) ===\n removeCharactersBeforeLastSlash(photo.photo_1)\n );\n }\n );\n if (storedPetWithSamePhotoObjectKey) {\n return updatePetStorage.deleteNewPetObject(\n storedPetWithSamePhotoObjectKey\n );\n }\n });\n }\n }, [processedPets]);\n\n return {\n storeUpdatedPet,\n readStoredUpdatedPet,\n readStoredUpdatedPets,\n readStoredNewPets,\n readStoredNewOrgPets,\n storeNewPet,\n storeNewOrgPet,\n validateCreatedOrgPets,\n deleteStoredUpdatedPet,\n };\n};\n\nexport default useStorePets;\n","// Today's date\nexport const today = new Date();\n// Tomorrow's Date\nexport const tomorrow = new Date(today.getTime() + 86400000);\n\n/**\n * Get a date object that is X minutes from now\n *\n * @param {number} minutes - Time in minutes\n * @returns {Date} A date object that is X minutes from now\n */\nexport const getDateXMinutesFromNow = (minutes: number) => {\n return new Date(new Date().getTime() + minutes * 60 * 1000);\n};\n\n/**\n * Check if a date is valid\n *\n * @param {string} date - The date to check\n * @returns {boolean} - True if the date is valid, false otherwise\n */\nexport const isDateValid = (date: string) => {\n return !isNaN(new Date(date).getTime());\n};\n","import AbstractStorage, { IStorageConfig } from './abstract-storage';\n\n/**\n * LocalStorage Local Storage is available across all browser tabs. It is not\n * cleared when the tab is closed.\n *\n * @augments AbstractStorage\n * @class\n */\nexport default class LocalStorage extends AbstractStorage {\n /**\n * Get Get the data from the local storage.\n *\n * @param {string} id - The id of the data to get.\n * @returns {object | null} - The data or null if not found.\n */\n get(id: string): object | string | null {\n if (typeof window === 'undefined') {\n return null;\n }\n const data = localStorage.getItem(id);\n\n if (!data) return null;\n // Parse the data and check if the expiration date is passed\n let parsedData = null;\n\n parsedData = JSON.parse(data);\n if (parsedData.expiration && new Date(parsedData.expiration) < new Date()) {\n this.delete(id);\n return null;\n }\n return parsedData;\n }\n\n /**\n * Set Set the data in the local storage.\n *\n * @param {string} id - The id of the data to set.\n * @param {object | string} data - The data to set.\n * @param {IStorageConfig} [config] - The configuration for the local storage.\n */\n set(id: string, data: object | string, config?: IStorageConfig): void {\n if (config?.expires) {\n if (typeof data === 'string') {\n data = { data, expiration: config.expires };\n } else {\n data = { ...data, expiration: config.expires };\n }\n }\n localStorage.setItem(id, JSON.stringify(data));\n }\n\n /**\n * Delete Delete the data from the local storage.\n *\n * @param {string} id - The id of the data to delete.\n */\n delete(id: string): void {\n localStorage.removeItem(id);\n }\n}\n","/**\n * Get the expiration date from the data.\n *\n * @param {object | null} data - The data.\n * @returns {Date | null} - The expiration date or null if not found.\n */\nfunction getExpirationDate(\n data: { [key: string]: unknown } | null\n): Date | null {\n if (\n data !== null &&\n 'expiration' in data &&\n data?.expiration &&\n typeof data.expiration === 'string'\n ) {\n /**\n * The expiration date from the data.\n *\n * @constant {Date} expirationDate\n */\n const expirationDate = new Date(data.expiration);\n\n if (!isNaN(expirationDate.getTime())) {\n return expirationDate;\n }\n console.error('Invalid expiration date: ', data.expiration);\n }\n\n return null;\n}\n\nexport default getExpirationDate;\n","/**\n * A helper function to parse a JSON string safely\n *\n * @param {string} str - The string to parse\n * @returns {string | object} - The parsed JSON object or the string\n */\nfunction parseToJSONSafe(str: string): string | { [key: string]: unknown } {\n try {\n return JSON.parse(str);\n } catch (error) {\n console.error('Unable to parse string to JSON: ', str);\n }\n return str;\n}\n\nexport default parseToJSONSafe;\n","import getExpirationDate from '../helpers/ObjectsHelpers/getExpirationDate';\nimport parseToJSONSafe from '../helpers/stringHelpers/parseToJSONSafe';\nimport AbstractStorage, { IStorageConfig } from './abstract-storage';\n\n/**\n * SessionStorage Session Storage is a storage that is available only in the\n * current browser tab. It is cleared when the tab is closed. It is not shared\n * between tabs.\n *\n * @augments AbstractStorage\n * @class\n */\nexport default class SessionStorage extends AbstractStorage {\n /**\n * Whether the session storage is available.\n *\n * @returns {boolean} - Whether the session storage is available.\n */\n private isAvailable(): boolean {\n return typeof window !== 'undefined';\n }\n\n /**\n * Get Get the data from the session storage.\n *\n * @param {string} id - The id of the data to get.\n * @returns {object | null} - The data or null if not found.\n */\n get(id: string): object | string | null {\n if (!this.isAvailable()) {\n return null;\n }\n const data = sessionStorage.getItem(id);\n\n if (!data) {\n return null;\n }\n\n // Parse the data and check if the expiration date is passed\n const parsedData = parseToJSONSafe(data);\n\n if (typeof parsedData === 'string') {\n return parsedData;\n }\n /**\n * The data expiration date.\n *\n * @constant {Date | null} expirationDate\n */\n const expirationDate = getExpirationDate(parsedData);\n\n if (expirationDate && expirationDate < new Date()) {\n this.delete(id);\n return null;\n }\n return parsedData;\n }\n\n /**\n * Set Set the data in the session storage.\n *\n * @param {string} id - The id of the data to set.\n * @param {object | string} data - The data to set.\n * @param {IStorageConfig} [config] - The session configuration.\n */\n set(id: string, data: object | string, config?: IStorageConfig): void {\n if (!this.isAvailable()) {\n return;\n }\n if (config?.expires) {\n if (typeof data === 'string') {\n data = { data, expiration: config.expires };\n } else {\n data = { ...data, expiration: config.expires };\n }\n }\n sessionStorage.setItem(id, JSON.stringify(data));\n }\n\n /**\n * Delete Delete the data from the session storage.\n *\n * @param {string} id - The id of the data to delete.\n */\n delete(id: string): void {\n sessionStorage.removeItem(id);\n }\n}\n"],"names":["EventLogHandler","AbstractAnalyticsHandler","send","data","getAnalyticsFeature","KlaviyoEventHandler","eventData","type","attributes","properties","time","Date","metric","name","profile","axios","concat","getBasePath","logEventHandler","googleTagManagerBrand","gtmEventHandler","GoogleTagManagerHandler","klaviyoEventHandler","EventEmitter","defaultEventEmitter","handleEvent","handlers","forEach","handler","constructor","cookies","CookieStorage","optimizelyDecision","get","analyticsFeatureKey","feature","notApplicableString","analytic","brand","dataObject","gtag","sdk","initSDK","pllApiBaseUrl","process","pllWebsocketBaseUrl","PetcoLoveSDK","photoHelpers_photoObjectKeysAreEqual","photoA","photoB","split","pop","storage","SessionStorage","PetsStorage","updatePetStorage","updatedPetsStorageKey","newPetsStorageKey","storeNewPet","allCreatedPets","getStoredNewPets","updatedStoredNewPets","push","pet","set","storeUpdatedPet","updatePet","getStoredNewOrgPets","getStoredUpdatedPets","getStoredUpdatedPet","response","id","deleteUpdatedPetId","delete","deleteNewOrgPetObject","allNewPets","splice","index","deleteNewPetObject","_this_getStoredNewPets","photo","filter","photoObjectKeysAreEqual","photo_1","length","storePets_useStorePets","processedPets","arguments","readStoredUpdatedPets","doesIdExist","pets","deleteStoredUpdatedPet","shouldDeleteStoredPet","sessionPet","deleteName","deleteForName","deletePhoto","deleteForPhoto","deleteIntakeDate","deleteForIntakeDate","deleteListingType","deleteForListingType","deleteDescription","deleteForDescription","hasExpired","checkIfEntryExpired","willDelete","description","listingType","expiresAt","now","deleteForPhotos","sessionPhotoPaths","Object","values","map","removeCharactersBeforeLastSlash","path","sort","petPhotoPaths","i","substring","lastIndexOf","sessionPhotoPath","petPhotoPath","sessionDate","intakeDate","toLocaleDateString","timeZone","clearProcessedNewPets","useCallback","allStoredNewPets","storedPetWithSameId","find","undefined","createdPet","storedPetWithSamePhotoObjectKey","petInfo","allPets","readStoredUpdatedPet","idExists","shouldDelete","readStoredNewPets","readStoredNewOrgPets","processing","storeNewOrgPet","validateCreatedOrgPets","findIndex","image","today","tomorrow","getTime","getDateXMinutesFromNow","minutes","isDateValid","isNaN","date","LocalStorage","AbstractStorage","localStorage","getItem","parsedData","JSON","parse","expiration","config","expires","setItem","stringify","removeItem","ObjectsHelpers_getExpirationDate","expirationDate","stringHelpers_parseToJSONSafe","str","error","isAvailable","sessionStorage","parseToJSONSafe","getExpirationDate"],"sourceRoot":""}