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,0B,EAInD,EAAe,SAACF,G,IAeDA,EAfyC,idAOtDA,EAAKG,SACU,wDAEe,OAAdH,EAAKG,SAAS,uBAE1B,GACL,wDAGyCH,OADlB,QAATA,EAAAA,EAAKE,YAALF,IAAAA,OAAAA,EAAAA,EAAW1I,QAAQ,OAAQ,IAAI,gDAEC0I,OADLA,EAAKC,QAAQ,wDAK/CD,OAJuCA,EAAKE,KAAOF,EAAKE,KAAO,GAAG,sEAWlEF,OAPAA,EAAKI,WACU,sBAC4CJ,OAAhDA,EAAKK,KAAK,wCAAsD,OAAhBL,EAAKI,WAAW,gBAEvE,GACL,YAOA,OALCJ,EAAKM,iBACU,sBACiDN,OAArDA,EAAKO,WAAW,uCAA2D,OAAtBP,EAAKM,iBAAiB,gBAElF,GACL,uB","sources":["webpack://webstaurantstore/./common/StarIcon/index.tsx","webpack://webstaurantstore/./common/Stars.tsx","webpack://webstaurantstore/./analytics/AddToCart/addToCartAnalytics.ts","webpack://webstaurantstore/./analytics/AddToCart/addToCartApiHelpers.ts","webpack://webstaurantstore/./analytics/MarketingEvents/Pinterest/PinterestApiCommerceEvent.ts","webpack://webstaurantstore/./analytics/TrackingPixels/TagEvents/PinterestTagAddToCartEvent.ts","webpack://webstaurantstore/./common/Notification/index.ts","webpack://webstaurantstore/./common/Notification/notification.html.ts"],"sourcesContent":["import React from \"react\";\nimport spritePath from \"./standard.sprite.svg\";\nexport type StarLevel = \"fullstar\" | \"halfstar\" | \"emptystar\";\nexport interface IconProps {\n className?: string;\n level: StarLevel;\n}\nexport default (properties: IconProps) => {\n const {\n level,\n ...rest\n } = properties;\n switch (level) {\n case \"fullstar\":\n return \n \n ;\n case \"halfstar\":\n return \n \n \n ;\n default:\n return \n \n ;\n }\n};","import React from \"react\";\nimport { range } from \"range\";\nimport ct from \"class-types.macro\";\nimport StarIcon from \"./StarIcon\";\nconst sizes = {\n small: ct(\"h-3\", \"w-3\"),\n base: ct(\"h-4\", \"w-4\"),\n large: ct(\"h-5\", \"w-5\"),\n extraLarge: ct(\"h-6\", \"w-6\")\n};\ninterface Props {\n rating: number;\n size?: keyof typeof sizes;\n containerClasses?: ClassTypes;\n}\nconst starLevel = (rating: number, i: number) => {\n if (rating >= i - 0.25) {\n return \"fullstar\";\n }\n if (rating >= i - 0.75) {\n return \"halfstar\";\n }\n return \"emptystar\";\n};\nconst Stars = ({\n rating,\n size = \"base\",\n containerClasses = \"\"\n}: Props) => <>\n {!!rating && rating > 0 ?
\n {`Rated ${rating.toFixed(1).replace(/\\.0$/, \"\")} out of 5 stars`}\n {range(1, 6).map(i => )}\n
: null}\n ;\nexport default Stars;","import {\n createProducts,\n Item,\n updateUserWithNewCartTotal,\n} from \"~/userAnalytics\";\nimport { sendGtmEvent, clearEcommerceInDataLayer } from \"../definitions\";\nimport {\n sendFacebookPixelAddToCartEvents,\n sendPinterestAddToCartEvents,\n} from \"./addToCartApiHelpers\";\nimport { EcommerceData, formatEcommerceData } from \"./addToCartHelpers\";\n\nexport type AtcAnalyticsProps = {\n source: string;\n carouselProps?: {\n carouselName: string;\n carouselModel: string;\n position: number;\n };\n};\n\nexport const addToCartAnalytics = async (\n atcProps: AtcAnalyticsProps,\n ...items: Item[]\n) => {\n let total = 0;\n const feedIdentifiers: string[] = [];\n\n const products = await createProducts(items);\n if (products.length === 0) {\n return;\n }\n for (const product of products) {\n total += Number(product?.price ?? 0) * Number(product?.quantity ?? 0);\n if (product.feedIdentifier) {\n feedIdentifiers.push(product.feedIdentifier);\n }\n }\n // Done to avoid any floating point errors\n total = parseFloat(total.toFixed(2));\n // Note that prices here are only using P1, as the actual price can vary depending on user to user, so may vary slightly from the actual value.\n const newCartTotal = await updateUserWithNewCartTotal(true, total);\n if (newCartTotal.isError) {\n return;\n }\n sendPinterestAddToCartEvents(products);\n sendFacebookPixelAddToCartEvents(feedIdentifiers, total.toString());\n const formattedEcommerceProducts = formatEcommerceData(products, {\n total,\n position: atcProps.carouselProps?.position ?? 0,\n });\n\n sendGtmAddToCartEvents(\n formattedEcommerceProducts,\n newCartTotal.value,\n atcProps\n );\n};\n\nexport const productRemoveFromCart = async (items: Item[]) => {\n const itemTotalCosts = items.map(\n (item) => (item?.price ?? 0) * (item?.quantity ?? 0)\n );\n const totalCost = itemTotalCosts.reduce((acc, curr) => acc + curr, 0);\n const newCartTotal = await updateUserWithNewCartTotal(false, totalCost);\n if (newCartTotal.isError) {\n return;\n }\n const products = await createProducts(items);\n if (products.length === 0) {\n return;\n }\n const formattedEcommerceProduct = formatEcommerceData(products, {\n total: totalCost,\n });\n clearEcommerceInDataLayer();\n sendGtmEvent({\n event: \"productRemoveFromCart\",\n cart_total: newCartTotal.value,\n ecommerce: formattedEcommerceProduct,\n });\n};\n\nconst sendGtmAddToCartEvents = (\n ecommerce: EcommerceData,\n cartTotal: number,\n atcProps: AtcAnalyticsProps\n) => {\n clearEcommerceInDataLayer();\n sendGtmEvent({\n event: \"addToCart\",\n atc_source: atcProps.carouselProps?.carouselName\n ? \"carousel\"\n : atcProps.source,\n cart_total: cartTotal,\n ecommerce: { ...ecommerce },\n // Reset carousel props to empty string if not present otherwise variables will be previous values\n carouselName: atcProps.carouselProps?.carouselName ?? \"\",\n carouselModel: atcProps.carouselProps?.carouselModel ?? \"\",\n });\n};\n","import { getRandomNumberString, Product } from \"~/userAnalytics\";\nimport {\n getFacebookPixelId,\n getFacebookPixelUserData,\n sendFacebookPixelServerEvent,\n} from \"../apiHelpers\";\nimport PinterestApiCommerceEvent from \"../MarketingEvents/Pinterest/PinterestApiCommerceEvent\";\nimport PinterestTagAddToCartEvent from \"../TrackingPixels/TagEvents/PinterestTagAddToCartEvent\";\nimport MarketingEventHelpers from \"../MarketingHelpers/MarketingEventHelpers\";\n\nexport const sendPinterestAddToCartEvents = (products: Product[]) => {\n new PinterestApiCommerceEvent(\n \"add_to_cart\",\n new PinterestTagAddToCartEvent(products),\n products\n ).sendEvent();\n};\n\nexport const sendFacebookPixelAddToCartEvents = async (\n feedIdentifiers: string[],\n price: string\n) => {\n const eventId = getRandomNumberString();\n const priceOfItemAddedToCart = MarketingEventHelpers.createItemPriceWithTrailingZero(\n parseFloat(price)\n );\n if (typeof fbq !== \"function\") return;\n\n fbq(\"trackSingle\", getFacebookPixelId(), \"AddToCart\", {\n content_ids: feedIdentifiers,\n value: priceOfItemAddedToCart,\n currency: \"USD\",\n content_type: \"product\",\n eventID: eventId,\n });\n\n sendFacebookPixelServerEvent(\n \"AddToCart\",\n eventId,\n getFacebookPixelUserData(),\n {\n content_ids: feedIdentifiers,\n value: priceOfItemAddedToCart,\n currency: \"USD\",\n content_type: \"product\",\n }\n );\n};\n","import type { Product } from \"../../../userAnalytics\";\nimport type { Tag, Order } from \"../MarketingDataDefinitions\";\nimport PinterestApiEvent from \"./PinterestApiEvent\";\n\nexport default class PinterestApiCommerceEvent extends PinterestApiEvent {\n products: Product[];\n\n order?: Order;\n\n constructor(\n eventName: string,\n associatedTagEvent: Tag,\n products: Product[],\n order?: Order\n ) {\n super(eventName, associatedTagEvent);\n this.products = products;\n this.order = order;\n }\n\n private getProductCostAndOrderNumber() {\n return {\n OrderId: this.order?.orderNumber,\n Value: this.order?.orderTotal?.toString(),\n };\n }\n\n private formatProductsForApiRequest() {\n const contentIds: string[] = [];\n const contents: Array> = [];\n\n const productsForEvent = {\n customData: {\n Contents: contents,\n ContentIds: contentIds,\n ...this.getProductCostAndOrderNumber(),\n ...{ numItems: this.products.length },\n },\n };\n\n this.products.forEach((product) => {\n productsForEvent.customData.ContentIds.push(product.id);\n productsForEvent.customData.Contents.push({\n id: product.id,\n itemPrice: product.price,\n quantity: product.quantity ?? \"1\",\n });\n });\n\n return productsForEvent;\n }\n\n protected formatDataForStashApiRequest() {\n const userAndEventData = super.formatDataForStashApiRequest();\n return { ...userAndEventData, ...this.formatProductsForApiRequest() };\n }\n}\n","import type { Product } from \"../../../userAnalytics\";\nimport type { Tag } from \"../../MarketingEvents/MarketingDataDefinitions\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ndeclare const pintrk: any;\nexport default class PinterestTagAddToCartEvent implements Tag {\n eventName = \"addtocart\";\n\n private currency = \"USD\";\n\n eventId = \"\";\n\n private productAddedToCart?: Product;\n\n constructor(productsAddedToCart: Product[]) {\n [this.productAddedToCart] = productsAddedToCart;\n }\n\n sendEvent(): void {\n if (typeof pintrk === \"function\") {\n pintrk(\"track\", this.eventName, {\n event_id: this.eventId,\n value: this.productAddedToCart?.price,\n order_quantity: this.productAddedToCart?.quantity,\n currency: this.currency,\n product_id: [this.productAddedToCart?.id],\n });\n }\n }\n}\n","import React from \"react\";\nimport Notif from \"watnotif/dist/js/watnotif\";\nimport notificationTemplate, {\n NotificationObject,\n errorTemplate,\n} from \"./notification.html\";\n\nimport(\n /* webpackChunkName: \"notifications-standalone\" */ \"~/less/notifications-standalone.less\"\n);\n\n/** Wrapper for watnotif. Adds a custom notification template and a fader. */\nexport default class Notification {\n private static get notificationFader() {\n const element = document.querySelector(\".notification-fader\");\n if (!element)\n throw new Error(\n \"An element with the class name .notification-fader is required!\"\n );\n return element;\n }\n\n private static getBase = Notif.prototype.getBase;\n\n private static getWrapper = Notif.prototype.getWrapper;\n\n private static setup = false;\n\n /**\n * Create a notification.\n * @param options Object properties are interpolated into the error template.\n * @param options.heading Text for the header.\n * @param options.href Where the primary button links to. The image will also be linked\n * to this href if an image is included.\n * @param options.imageUrl Optional image url.\n * @param options.body Optional text for the body.\n * @param options.buttonText Text of the primary button.\n * @param options.secondButtonText Text of the secondary button.\n * @param options.secondHref Href of secondary button.\n * @param type Add error styling by passing 'Error' for this parameter.\n */\n public constructor(\n options: NotificationObject,\n type = \"default\",\n eventInfo?: React.SyntheticEvent,\n display = 10000\n ) {\n if (!Notification.setup) {\n Notification.setupNotif(eventInfo);\n Notification.setup = true;\n }\n\n return Notification.create(options, type, display);\n }\n\n public static create(\n options: NotificationObject,\n type: string,\n display: number\n ) {\n if (type === \"error\") {\n const errorHtml = errorTemplate(options);\n return new Notif(errorHtml, type).display(display);\n }\n const html = notificationTemplate(options);\n return new Notif(html, type).display(display);\n }\n\n public static setupNotif(eventInfo?: React.SyntheticEvent) {\n Notification.notificationFader.addEventListener(\"click\", () =>\n Notification.closeAll(eventInfo)\n );\n\n document.addEventListener(\"keydown\", (evt) => {\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n const notificationItems = [\n ...Notification.getWrapper().children,\n ] as HTMLElement[];\n if (notificationItems.length !== 0) {\n const firstNotification = notificationItems[0];\n if (evt.key === \"Escape\") {\n firstNotification?.remove();\n // remove the darkened background provided for notifications, if none are left\n if (notificationItems.length - 1 === 0) {\n Notification.closeFader(eventInfo);\n }\n }\n }\n });\n\n const { insertBefore, removeChild } = Object.getPrototypeOf(\n Notification.getWrapper()\n );\n\n Notif.prototype.getBase = function getBasePatched(\n classes: string,\n msg: string\n ) {\n const notificationElement = Notification.getBase(\n `notification notification--${classes}`,\n msg\n );\n\n const close = notificationElement.querySelector(\".close-notif\");\n if (close) close.remove();\n\n return notificationElement;\n };\n\n Notification.getWrapper().insertBefore = (...insertBeforeArgs) => {\n Notification.activateFade();\n return insertBefore.apply(Notification.getWrapper(), insertBeforeArgs);\n };\n\n Notification.getWrapper().removeChild = (...removeChildArgs) => {\n if (Notification.getWrapper().children.length < 2)\n Notification.closeFader(eventInfo);\n return removeChild.apply(Notification.getWrapper(), removeChildArgs);\n };\n }\n\n private static activateFade() {\n Notification.notificationFader.classList.add(\"open\");\n }\n\n private static closeFader(eventInfo?: React.SyntheticEvent) {\n Notification.notificationFader.classList.remove(\"open\");\n if (eventInfo) {\n const lastFocusedElement = eventInfo.target;\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n (lastFocusedElement as HTMLElement).focus();\n }\n }\n\n public static closeAll(eventInfo?: React.SyntheticEvent) {\n Notification.closeFader(eventInfo);\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n ([\n ...Notification.getWrapper().children,\n ] as HTMLElement[]).forEach((element) => element.click());\n }\n}\n","export interface NotificationObject {\n imageUrl?: string;\n href?: string;\n heading: string;\n body: string;\n buttonText?: string;\n secondButtonText?: string;\n secondHref?: string;\n eventInfo?: React.SyntheticEvent;\n}\n\nexport const errorTemplate = (data: NotificationObject) => /* html */ `\n\n\n
\n \n \n \n
\n

${data.heading}

\n

${data.body}

\n
\n
`;\n\nexport default (data: NotificationObject) => /* html */ `\n\n${\n data.imageUrl\n ? /* html */ `\n
\n \"\"\n
`\n : \"\"\n}\n
\n
\n

${data.heading}

\n
${data.body ? data.body : \"\"}
\n
\n
\n ${\n data.buttonText\n ? /* html */ `\n ${data.buttonText}\n `\n : \"\"\n }\n ${\n data.secondButtonText\n ? /* html */ `\n ${data.secondButtonText}\n `\n : \"\"\n }\n
\n
`;\n"],"names":["properties","level","rest","svg","fill","aria-hidden","className","data-testid","use","xlinkHref","spritePath","sizes","small","ct","base","large","extraLarge","starLevel","rating","i","size","containerClasses","div","filter","Boolean","join","span","toFixed","replace","range","map","StarIcon","addToCartAnalytics","productRemoveFromCart","atcProps","items","total","feedIdentifiers","products","product","newCartTotal","formattedEcommerceProducts","createProducts","length","Number","price","quantity","feedIdentifier","push","parseFloat","updateUserWithNewCartTotal","isError","sendPinterestAddToCartEvents","sendFacebookPixelAddToCartEvents","toString","formatEcommerceData","position","carouselProps","sendGtmAddToCartEvents","value","item","itemTotalCosts","totalCost","formattedEcommerceProduct","reduce","acc","curr","clearEcommerceInDataLayer","sendGtmEvent","event","cart_total","ecommerce","cartTotal","atc_source","carouselName","source","carouselModel","PinterestApiCommerceEvent","PinterestTagAddToCartEvent","sendEvent","eventId","priceOfItemAddedToCart","getRandomNumberString","MarketingEventHelpers","createItemPriceWithTrailingZero","fbq","getFacebookPixelId","content_ids","currency","content_type","eventID","sendFacebookPixelServerEvent","getFacebookPixelUserData","eventName","associatedTagEvent","order","getProductCostAndOrderNumber","OrderId","this","orderNumber","Value","orderTotal","formatProductsForApiRequest","productsForEvent","customData","Contents","ContentIds","numItems","forEach","id","itemPrice","formatDataForStashApiRequest","PinterestApiEvent","productsAddedToCart","productAddedToCart","pintrk","event_id","order_quantity","product_id","Notification","options","type","eventInfo","display","setup","setupNotif","create","errorHtml","errorTemplate","Notif","html","notificationTemplate","notificationFader","addEventListener","closeAll","document","evt","notificationItems","getWrapper","children","firstNotification","key","remove","closeFader","Object","getPrototypeOf","insertBefore","removeChild","prototype","getBase","classes","msg","notificationElement","close","querySelector","insertBeforeArgs","activateFade","apply","removeChildArgs","classList","add","target","focus","element","click","Error","data","heading","body","imageUrl","buttonText","href","secondButtonText","secondHref"],"sourceRoot":""}