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AAQjM,EAAWmG,UACjCC,EAAAA,EAAAA,KAAC8F,EAAAA,EAAa,CAACC,SAAU,GAAGpM,aAAoBoG,UAC9CC,EAAAA,EAAAA,KAACgG,EAAAA,SAAQ,CAACC,SAAU,KAAKlG,UACvBC,EAAAA,EAAAA,KAACkG,EAAAA,EAAc,CACbC,QAASxM,EACTyM,KAAMC,EAAAA,EAAKC,SAASvG,UAEpBC,EAAAA,EAAAA,KAACuG,EAAAA,EAAoB,IAAK7B,EAAgB3E,UACxCC,EAAAA,EAAAA,KAACwG,EAAAA,EAA6B,CAACC,UAAWlC,EAAsBxE,UAC9DC,EAAAA,EAAAA,KAACiB,EAAW,iBAOb,EE9BJyF,GAA4BjC,IAAkBzE,EAAAA,EAAAA,KAACwE,GAAsB,IAAKC,I,eCEhF,MAAM7K,GAAa,IAAIC,EAAAA,EAAO8M,GAAAA,GAAc,CAAE7M,SAAU8M,GAAAA,MAEvC5M,EAAAA,EAAAA,IAAeL,GAAAA,ICKhCkN,eAAeC,GAAOC,GAC3B,MAAM,OAAE3M,EAAS,IAAO2M,EAAYC,QAC9BC,EAAY9M,EAAiBC,GAQjC8M,EAAAA,EAAoBC,YAAWC,EAAAA,EAAAA,OAGjCC,EAAAA,EAAAA,GAAWN,GAAaD,QACtB9G,EAAAA,EAAAA,KAAC4F,EAAAA,EAAc,CAACC,OAAQjM,GAAWmG,UACjCC,EAAAA,EAAAA,KAAC8F,EAAAA,EAAa,CAACC,SAAU,GAAGpM,GAAAA,cAAoBoG,UAC9CC,EAAAA,EAAAA,KAACsH,EAAAA,EAAa,CACZC,qBAAmB,EACnBC,SAAUC,GAAAA,GAAkB1H,UAE5BC,EAAAA,EAAAA,KAAC0G,GAAG,IAAKO,UAKnB,C","sources":["webpack://oribasketbubble/../../src/constants-generated.ts","webpack://oribasketbubble/../../src/logger.ts","webpack://oribasketbubble/../../../src/utils/getConfiguration.ts","webpack://oribasketbubble/../../../src/constants/index.ts","webpack://oribasketbubble/../../../src/utils/isMinibagVisibile.ts","webpack://oribasketbubble/../../../src/types/TestId.ts","webpack://oribasketbubble/../../../../src/components/Bubble/styles.ts","webpack://oribasketbubble/../../../../src/components/Bubble/Bubble.tsx","webpack://oribasketbubble/../../../src/hooks/useTranslations.ts","webpack://oribasketbubble/../../../../src/components/BubbleGroup/styles.ts","webpack://oribasketbubble/../../../../src/components/BubbleGroup/BubbleGroup.tsx","webpack://oribasketbubble/../../../src/constants/defaultTranslations.ts","webpack://oribasketbubble/../../../src/containers/BasketBubbleController.tsx","webpack://oribasketbubble/../../../src/utils/getTranslationsProps.ts","webpack://oribasketbubble/./src/App.tsx","webpack://oribasketbubble/./src/logger.ts","webpack://oribasketbubble/./src/appRender.tsx"],"sourcesContent":["/* istanbul ignore file */\n//\n// DO NOT EDIT!\n// This file was autogenerated by Eddie.\n// Changes may cause incorrect behavior and will be lost when the file is regenerated.\n//\n// Run `npx eddie update workspace` to regenerate.\n//\n\nexport const APP_NAME = 'basket-bubble-lib';\nexport const PACKAGE_NAME = '@ori/basket-bubble-lib';\nexport const TEAM_NAME = 'Checkout';\n\nexport const EMOTION_CACHE_KEY = `${APP_NAME}-emotion-cache-key`;\n\nexport const APP_ROOT_ELEMENT_ID = `${APP_NAME}-root`;\n","import { getDebugLogger, getInfoLogger } from '@ori/checkout-utils';\nimport { Logger } from '@ori/logger';\n\nimport { APP_NAME, PACKAGE_NAME, TEAM_NAME } from './constants';\n\nexport const mainLogger = new Logger(PACKAGE_NAME, { teamName: TEAM_NAME });\n\nexport const logDebug = getDebugLogger(APP_NAME);\nexport const logInfo = getInfoLogger(APP_NAME);\n","import { normalizeSlashChars } from '@ori/checkout-utils';\nimport { parseClientAppConfig } from '@ori/client-app-config';\n\nimport { logDebug, logInfo } from '../logger';\nimport type { ClientAppConfig, NormalizeConfigurationMethod } from '../types';\n\n/**\n * Normalizes some values in the raw parsed config.\n * @param parsedConfig Original config data returned by the parseSpaConfig method.\n * @returns Final normalized configuration.\n */\nexport const normalizeConfigData: NormalizeConfigurationMethod = (parsedConfig) => {\n const result: ClientAppConfig = {\n ...parsedConfig,\n staticApiUrl: normalizeSlashChars(parsedConfig.staticApiUrl, false, false),\n };\n logInfo('normalized configuration', result);\n\n return result;\n};\n\n/**\n * Parses the configuration.\n * @param config Config data serialized in a string in JSON format.\n * Usually taken from data-config HTML attribute of the component's root element.\n * @returns Normalized component configuration.\n */\nexport const getConfiguration = (config: string) => {\n const parsedConfig = parseClientAppConfig(config, ['currentLanguage', 'staticApiUrl', 'tenant']);\n logDebug('parsed configuration', parsedConfig);\n\n return parsedConfig;\n};\n","export * from './defaultTranslations';\nexport * from '../constants-generated';\n\nexport const IDENTITY_CLIENT_ID = 'SPADev';\n\n// Bubble settings\nexport const bubbleDuration = 2000;\nexport const bubbleHeight = 94;\n","// This might be outdated after recent changes - TODO\nexport const isMinibagVisible = () => {\n const element = document.querySelector('[data-testid=Checkout-shopping-mini-bag-fading-wrapper]');\n if (!element) {\n return false;\n }\n\n return window.getComputedStyle(element).visibility === 'visible';\n};\n","export enum TestId {\n // One particular add-to-basket notification bubble popup (multiple can be displayed at a time)\n Popup = 'popup',\n}\n","import { SHADOW_LEVEL3, styled } from '@ori-ui/mui';\n\nimport { bubbleHeight } from '../../constants';\n\nexport const BubbleWrapper = styled('div')(({ theme }) => ({\n background: theme.palette.common.white,\n border: `2px solid ${theme.palette.grey[100]}`,\n borderRadius: theme.spacing(2),\n boxShadow: SHADOW_LEVEL3,\n display: 'flex',\n height: bubbleHeight,\n marginBottom: theme.spacing(2),\n padding: theme.spacing(1),\n pointerEvents: 'auto',\n position: 'relative',\n width: theme.spacing(64),\n userSelect: 'none',\n}));\n\nexport const ImageWrapper = styled('div')(({ theme }) => ({\n borderRadius: theme.spacing(1, 0, 0, 1),\n flex: theme.spacing(0, 0, 16),\n marginRight: theme.spacing(2),\n overflow: 'hidden',\n position: 'relative',\n}));\n\nexport const Details = styled('div')({\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'flexStart',\n width: 216,\n});\n\nexport const Name = styled('div')(({ theme }) => ({\n color: theme.palette.text.primary,\n fontSize: theme.typography.body1.fontSize,\n fontWeight: 700,\n overflow: 'hidden',\n paddingTop: theme.spacing(2),\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n width: '100%',\n}));\n\nexport const Shade = styled('div')(({ theme }) => ({\n color: theme.palette.grey.A400,\n fontSize: theme.typography.caption.fontSize,\n}));\n\nexport const Shopping = styled('div')({\n alignItems: 'center',\n display: 'flex',\n marginTop: 'auto',\n});\n\nexport const Quantity = styled('div')(({ theme }) => ({\n color: theme.palette.text.secondary,\n flexGrow: 1,\n fontSize: theme.typography.caption.fontSize,\n}));\n\nexport const Price = styled('div')(({ theme }) => ({\n color: theme.palette.text.primary,\n fontSize: theme.typography.body1.fontSize,\n fontWeight: 700,\n marginLeft: 'auto',\n}));\n\nexport const Points = styled('div')(({ theme }) => ({\n background: theme.palette.offer.dark,\n borderRadius: '50%',\n bottom: theme.spacing(2),\n color: theme.palette.common.white,\n fontSize: theme.typography.body1.fontSize,\n fontWeight: 'bold',\n height: theme.spacing(7),\n lineHeight: theme.spacing(7),\n position: 'absolute',\n right: theme.spacing(2),\n textAlign: 'center',\n width: theme.spacing(7),\n}));\n","import { LastAddedItemMethod } from '@ori-events/basket-updated';\nimport { useTheme } from '@ori-ui/mui';\nimport { CheckoutImage } from '@ori/checkout-ui';\nimport useTestId from '@ori/testid-generator';\nimport type { MouseEvent, FC } from 'react';\n\nimport { useTranslations } from '../../hooks/useTranslations';\nimport { TestId } from '../../types';\nimport { BubbleWrapper, Details, ImageWrapper, Name, Points, Price, Quantity, Shade, Shopping } from './styles';\nimport { type BubbleProps } from './types';\n\nfunction ignoreClickEvent(event: MouseEvent) {\n event.preventDefault();\n event.stopPropagation();\n}\n\nexport const Bubble: FC = ({ code, image, methodType, name, points, price, quantity }) => {\n const { getTestId } = useTestId();\n const theme = useTheme();\n const { formatMessage } = useTranslations();\n const { BUY_FOR_MONEY, BUY_FOR_POINTS } = LastAddedItemMethod;\n\n return (\n \n \n
\n {name}\n {code}\n \n \n {formatMessage('quantity')}: {quantity}\n \n {methodType === BUY_FOR_MONEY && {price}}\n {methodType === BUY_FOR_POINTS && {points}}\n \n
\n \n );\n};\n","/* istanbul ignore file */\n\n/**\n * DO NOT EDIT!\n * This file was autogenerated by npm script `localizations-codegen`.\n * Changes may cause incorrect behavior and will be lost when the file is regenerated.\n *\n * Run `npx localizations-codegen` to regenerate.\n */\nimport { useTranslationsFromNamespace, type UseTranslationsFromNamespaceResult } from '@ori/i18n';\n\nimport type { DefaultTranslations } from '../constants/defaultTranslations';\n\n/**\n * A hook for accessing translations within a specific namespace along with a formatting function.\n *\n * @returns The translations within the specified namespace and a formatting function.\n */\nexport const useTranslations: () => UseTranslationsFromNamespaceResult = () =>\n useTranslationsFromNamespace();\n","import { styled } from '@ori-ui/mui';\n\nimport { bubbleHeight } from '../../constants';\n\nconst topNavHeightStyle = 'var(--top-nav-height, 0)';\n\nexport const BasketBubbleWrapper = styled('div')(({ theme }) => ({\n boxSizing: 'border-box',\n width: theme.spacing(64),\n marginTop: 10,\n pointerEvents: 'none',\n position: 'fixed',\n top: 0,\n right: 15,\n transform: `translate(0, ${topNavHeightStyle})`,\n transition: `transform var(--top-nav-height-animation), 0.3s ease-in-out`,\n zIndex: 10000,\n\n [theme.breakpoints.up('sm')]: {\n right: 30,\n },\n\n '& *': {\n boxSizing: 'border-box',\n },\n}));\n\nexport const AnimationWrapper = styled('div')<{\n ownerState: { state: string };\n}>(({ ownerState }) => ({\n transition: 'opacity 750ms',\n opacity: 0,\n\n ...(ownerState.state === 'entered' && {\n opacity: 1,\n }),\n\n ...(ownerState.state === 'exiting' && {\n opacity: 0,\n transition: 'margin-top 300ms 950ms, opacity 1250ms',\n marginTop: -(bubbleHeight + 10),\n }),\n}));\n","import type { LastAddedItemMethod } from '@ori-events/basket-updated';\nimport * as BasketUpdatedEvent from '@ori-events/basket-updated';\nimport * as ToggleMenuFlyoutEvent from '@ori-events/toggle-menu-flyout';\nimport { type FC } from 'react';\nimport { createRef, useEffect, useState } from 'react';\nimport { Transition, TransitionGroup } from 'react-transition-group';\nimport { v4 } from 'uuid';\n\nimport { bubbleDuration } from '../../constants';\nimport { isMinibagVisible } from '../../utils';\nimport { Bubble, type BubbleInstanceProps } from '../Bubble';\nimport { AnimationWrapper, BasketBubbleWrapper } from './styles';\n\nexport const BubbleGroup: FC = () => {\n const [bubbles, setBubbles] = useState([]);\n\n const removeBasketBubble = (bubbleId: string) => {\n setBubbles((currentBubbles) => currentBubbles.filter((currentBubble) => currentBubble.id !== bubbleId));\n };\n\n const onToggleMenuFlyout = ((event: ToggleMenuFlyoutEvent.Event) => {\n const { menuType } = event.detail;\n if (menuType === ToggleMenuFlyoutEvent.MenuTypes.Minibag && isMinibagVisible()) {\n // hide all bubbles when minibag is being opened\n setBubbles([]);\n }\n }) as EventListener;\n\n const onBasketUpdate = ((event: BasketUpdatedEvent.Event) => {\n // don't show bubble if not add-to-basket update or if minibag is visible\n if (!event.detail.lastAddedItem || isMinibagVisible()) {\n return;\n }\n\n const { itemCode, method } = event.detail.lastAddedItem;\n const { shoppingBagItems, offers } = event.detail.shoppingBag;\n const offersItems = offers.reduce(\n (acc: BasketUpdatedEvent.ShoppingBagItem[], offer: BasketUpdatedEvent.ShoppingBagOffer) => [\n ...acc,\n ...offer.items,\n ],\n [],\n );\n\n // proper typing for method -- TODO\n const methodType = method as unknown as LastAddedItemMethod;\n\n const item =\n methodType === BasketUpdatedEvent.LastAddedItemMethod.BUY_FOR_MONEY\n ? shoppingBagItems.find((product) => product.itemCode === itemCode)\n : offersItems.find((product) => product.itemCode === itemCode);\n\n if (!item) {\n return;\n }\n\n const bubble: BubbleInstanceProps = {\n id: v4(),\n code: item.itemCode,\n name: item.itemDescription,\n price: item.totalPrice,\n quantity: item.requestedQuantity,\n image: item.itemImageSrc,\n points: item.totalRedeemedPoints,\n methodType,\n nodeRef: createRef(),\n };\n setBubbles((currentBubbles) => [...currentBubbles, bubble]);\n setTimeout(() => removeBasketBubble(bubble.id), bubbleDuration);\n }) as EventListener;\n\n useEffect(() => {\n window.addEventListener(BasketUpdatedEvent.Name, onBasketUpdate);\n window.addEventListener(ToggleMenuFlyoutEvent.Name, onToggleMenuFlyout);\n\n return () => {\n window.removeEventListener(BasketUpdatedEvent.Name, onBasketUpdate);\n window.removeEventListener(ToggleMenuFlyoutEvent.Name, onToggleMenuFlyout);\n };\n });\n\n const timeoutSettings = {\n appear: 0,\n enter: 0,\n exit: 1250,\n };\n\n return (\n \n \n {bubbles.map(({ id, nodeRef, ...bubble }) => (\n \n {(state) => {\n const bubbleOwnerState = { state };\n\n return (\n \n \n \n );\n }}\n \n ))}\n \n \n );\n};\n","/* istanbul ignore file */\n\n/**\n * DO NOT EDIT!\n * This file was autogenerated by npm script `localizations-codegen`.\n * Changes may cause incorrect behavior and will be lost when the file is regenerated.\n *\n * Run `npx localizations-codegen` to regenerate.\n */\nimport type { TranslationKey } from '../models/TranslationKey';\n\nexport type DefaultTranslations = Record;\n\nexport const defaultTranslations: DefaultTranslations = {\n quantity: 'Quantity',\n};\n\nexport const translationsNamespace = 'basket-bubble';\n","import { TranslationsNamespaceProvider, TranslationsProvider } from '@ori/i18n';\nimport { ErrorBoundary, LoggerProvider } from '@ori/logger';\nimport { Team, TestIdProvider } from '@ori/testid-generator';\nimport { StrictMode, Suspense, type FC } from 'react';\n\nimport { BubbleGroup } from '../components';\nimport { APP_NAME, translationsNamespace } from '../constants';\nimport { mainLogger } from '../logger';\nimport type { ClientAppConfig } from '../types';\nimport { getTranslationsProps, normalizeConfigData } from '../utils';\n\nexport const BasketBubbleController: FC = (configuration) => {\n const usedConfiguration = normalizeConfigData(configuration);\n const translationProps = getTranslationsProps(usedConfiguration);\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n};\n","import { type TranslationsContext } from '@ori/i18n';\n\nimport { defaultTranslations, translationsNamespace } from '../constants';\nimport { mainLogger } from '../logger';\nimport type { ClientAppConfig } from '../types';\n\nexport const getTranslationsProps = ({ currentLanguage, staticApiUrl, tenant, translations }: ClientAppConfig) => {\n const result: TranslationsContext = {\n clientFetchConfiguration: {\n baseUrl: staticApiUrl,\n onError: (error) => {\n mainLogger.error(error as Error, { action: 'Loading translations.' });\n },\n tenant,\n },\n currentLanguage,\n defaultTranslationsWithNamespaces: {\n [translationsNamespace]: defaultTranslations,\n },\n translationsWithNamespaces: translations ? { [translationsNamespace]: translations } : undefined,\n };\n\n return result;\n};\n","import { type ClientAppConfig, BasketBubbleController } from '@ori/basket-bubble-lib';\nimport { type FC } from 'react';\n\nexport const App: FC = (configuration) => ;\n","import { getDebugLogger } from '@ori/checkout-utils';\nimport { Logger } from '@ori/logger';\n\nimport { APP_NAME, PACKAGE_NAME, TEAM_NAME } from './constants';\n\nexport const mainLogger = new Logger(PACKAGE_NAME, { teamName: TEAM_NAME });\n\nexport const logDebug = getDebugLogger(APP_NAME);\n","import { ThemeProvider } from '@ori-ui/mui';\nimport { getConfiguration } from '@ori/basket-bubble-lib';\nimport { ApplicationInsights, ErrorBoundary, getClientApplicationInsightsConfig, LoggerProvider } from '@ori/logger';\nimport { createRoot } from 'react-dom/client';\n\nimport { App } from './App';\nimport { APP_NAME, EMOTION_CACHE_KEY } from './constants';\nimport { logDebug, mainLogger } from './logger';\n\n/**\n * React app renderer that is used when app is used as a standalone app\n */\nexport async function render(rootElement: HTMLElement) {\n const { config = '' } = rootElement.dataset;\n const appConfig = getConfiguration(config);\n\n if (process.env.NODE_ENV !== 'production' && process.env.REACT_APP_USE_REQUESTLY === '1') {\n logDebug('USING REQUESTLY');\n }\n\n // Initialize Application Insights in production\n if (process.env.NODE_ENV === 'production') {\n ApplicationInsights.initialize(getClientApplicationInsightsConfig());\n }\n\n createRoot(rootElement).render(\n \n \n \n \n \n \n ,\n );\n}\n"],"names":["APP_NAME","mainLogger","Logger","teamName","logDebug","getDebugLogger","logInfo","getInfoLogger","getConfiguration","config","parsedConfig","parseClientAppConfig","isMinibagVisible","element","document","querySelector","window","getComputedStyle","visibility","TestId","BubbleWrapper","styled","theme","background","palette","common","white","border","grey","borderRadius","spacing","boxShadow","SHADOW_LEVEL3","display","height","marginBottom","padding","pointerEvents","position","width","userSelect","ImageWrapper","flex","marginRight","overflow","Details","flexDirection","justifyContent","Name","color","text","primary","fontSize","typography","body1","fontWeight","paddingTop","textOverflow","whiteSpace","Shade","A400","caption","Shopping","alignItems","marginTop","Quantity","secondary","flexGrow","Price","marginLeft","Points","offer","dark","bottom","lineHeight","right","textAlign","ignoreClickEvent","event","preventDefault","stopPropagation","Bubble","code","image","methodType","name","points","price","quantity","getTestId","useTestId","useTheme","formatMessage","useTranslationsFromNamespace","BUY_FOR_MONEY","BUY_FOR_POINTS","LastAddedItemMethod","_jsxs","Popup","onClick","children","_jsx","CheckoutImage","component","src","alt","BasketBubbleWrapper","boxSizing","top","transform","transition","zIndex","breakpoints","up","AnimationWrapper","ownerState","opacity","state","BubbleGroup","bubbles","setBubbles","useState","onToggleMenuFlyout","menuType","detail","ToggleMenuFlyoutEvent","Minibag","onBasketUpdate","lastAddedItem","itemCode","method","shoppingBagItems","offers","shoppingBag","offersItems","reduce","acc","items","item","BasketUpdatedEvent","find","product","bubble","id","v4","itemDescription","totalPrice","requestedQuantity","itemImageSrc","totalRedeemedPoints","nodeRef","createRef","currentBubbles","setTimeout","removeBasketBubble","bubbleId","filter","currentBubble","useEffect","addEventListener","removeEventListener","timeoutSettings","appear","enter","exit","TransitionGroup","map","Transition","timeout","bubbleOwnerState","ref","defaultTranslations","translationsNamespace","BasketBubbleController","configuration","translationProps","getTranslationsProps","currentLanguage","staticApiUrl","tenant","translations","clientFetchConfiguration","baseUrl","onError","error","action","defaultTranslationsWithNamespaces","translationsWithNamespaces","undefined","result","normalizeSlashChars","normalizeConfigData","StrictMode","LoggerProvider","logger","ErrorBoundary","areaName","Suspense","fallback","TestIdProvider","project","team","Team","Checkout","TranslationsProvider","TranslationsNamespaceProvider","namespace","App","PACKAGE_NAME","TEAM_NAME","async","render","rootElement","dataset","appConfig","ApplicationInsights","initialize","getClientApplicationInsightsConfig","createRoot","ThemeProvider","enableCacheProvider","cacheKey","EMOTION_CACHE_KEY"],"sourceRoot":""}