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,EAAAA,EAAAA,KAAC0I,EAAAA,cAAa,CAACC,SAAU,GAAG1C,EAAAA,cAAoB9D,UAC9CnC,EAAAA,EAAAA,KAAC4I,EAAAA,EAAa,CACZC,qBAAmB,EACnBC,SAAUC,EAAAA,GAAkB5G,UAE5BnC,EAAAA,EAAAA,KAACkG,EAAG,IAAKgC,UAKnB,C","sources":["webpack://orierrornotification/./src/models/TranslationKey.ts","webpack://orierrornotification/./src/components/FormattedMessage.tsx","webpack://orierrornotification/./src/components/styles.ts","webpack://orierrornotification/./src/components/ErrorNotification.tsx","webpack://orierrornotification/./src/constants/defaultTranslations.ts","webpack://orierrornotification/../../../src/utils/log.ts","webpack://orierrornotification/../../../src/utils/isSSR.ts","webpack://orierrornotification/./src/logger.ts","webpack://orierrornotification/./src/App.tsx","webpack://orierrornotification/./src/utils/getTranslationsProps.ts","webpack://orierrornotification/./src/appRender.tsx"],"sourcesContent":["/* istanbul ignore file */\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 */\n\nexport enum TranslationKey {\n genericError = 'genericError',\n offerIsNotAvailable = 'offerIsNotAvailable',\n selectedQuantityIsNotAvailable = 'selectedQuantityIsNotAvailable',\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 { FormattedMessage as NotTypedFormattedMessage, type FormattedMessageProps } from '@ori/i18n';\n\nimport type { DefaultTranslations } from '../constants/defaultTranslations';\n\n/**\n * Renders a formatted internationalized message using the provided translation data.\n *\n * @returns The FormattedMessage typed with keys within the specified namespace.\n */\nexport const FormattedMessage = (props: FormattedMessageProps) => (\n {...props} />\n);\n","import { Snackbar, styled } from '@ori-ui/mui';\n\nconst topNavHeightStyle = 'var(--top-nav-height, 0)';\n\nexport const SnackbarError = styled(Snackbar)(({ theme }) => ({\n transform: `translate(0, ${topNavHeightStyle})`,\n transition: `transform var(--top-nav-height-animation), 0.3s ease-in-out`,\n\n [theme.breakpoints.up('sm')]: {\n top: '8px',\n },\n}));\n","import type { Data as NotificationEventData } from '@ori-events/show-error-notification';\nimport { Name as NotificationEventName } from '@ori-events/show-error-notification';\nimport { Alert } from '@ori-ui/mui';\nimport type { FC } from 'react';\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { TranslationKey } from '../models/TranslationKey';\nimport { FormattedMessage } from './FormattedMessage';\nimport { SnackbarError } from './styles';\n\nconst DEFAULT_TIMEOUT_DELAY = 3000;\n\nexport const ErrorNotification: FC = () => {\n const [isOpen, setIsOpen] = useState(false);\n const [messageId, setMessageId] = useState(TranslationKey.genericError);\n\n const handleClose = useCallback(() => {\n setIsOpen(false);\n }, []);\n\n const handleShowErrorNotification = ((event: CustomEvent) => {\n const { message } = event.detail;\n setMessageId((message as TranslationKey | undefined) ?? TranslationKey.genericError);\n setIsOpen(true);\n }) as EventListener;\n\n useEffect(() => {\n window.addEventListener(NotificationEventName, handleShowErrorNotification);\n\n return () => window.removeEventListener(NotificationEventName, handleShowErrorNotification);\n });\n\n return (\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 genericError: 'Sorry, something went wrong!',\n offerIsNotAvailable: 'Offer is not available at the moment.',\n selectedQuantityIsNotAvailable: 'Selected quantity is not available due to stock limitations.',\n};\n\nexport const translationsNamespace = 'error-notification';\n","/* eslint-disable no-console -- simple logger */\nimport { isSSR } from './isSSR';\n\n/**\n * Log messages verbosity level which can be dynamically set also on production environment.\n *\n * Please, consider using Info level for rather important checks in the app workflow\n * (like data load success, user action logs, etc.).\n *\n * Use Debug level for other less important messages. This is for the possibility\n * to have the generic app flow still checked in log without necessarily overcrowding\n * it with all the debug message logs.\n */\nexport enum LogLevel {\n None,\n Error,\n Warning,\n Info,\n Debug,\n}\n\nexport type LogMethod = (...args: unknown[]) => void;\nexport type LogMethodsMap = Map;\n\n/**\n * The default log level is set to warnings, which means errors & warnings\n * are logged automatically without any need to change the settings.\n *\n * For info & debug messages to be logged, the settings have to be changed manually.\n * It can be done either in the local testing page UI, or in JS console via:\n * localStorage.setItem(`${appName} debug`, 3); // LogLevel.Info for example\n */\nexport const DEFAULT_LOG_LEVEL = LogLevel.Warning;\n\n/**\n * Default color of application name in the log message. It is possible\n * to override this in the getLogger methods. A different color assigned\n * to logs from different apps can make basic orientation in console logs\n * easier, considering usage of multiple app logs in parallel.\n */\nconst DEFAULT_APP_LABEL_COLOR = 'c90';\n\n/**\n * Current log methods map. So far, the console methods are used,\n * but the methods are replaceable, so for example AppInsights logger\n * might be implemented additionally to the existing functionality.\n */\nexport const logMethodsMap: LogMethodsMap = new Map([\n [LogLevel.None, (...args: unknown[]) => {}],\n [LogLevel.Error, console.error],\n [LogLevel.Warning, console.warn],\n [LogLevel.Info, console.info],\n [LogLevel.Debug, console.log],\n]);\n\nfunction getTime() {\n const date = new Date();\n const minutes = `0${date.getMinutes()}`;\n const seconds = `0${date.getSeconds()}`;\n const milliseconds = `00${date.getMilliseconds()}`;\n const LAST_TWO_DIGITS = -2;\n const LAST_THREE_DIGITS = -3;\n\n return `${date.getHours()}:${minutes.slice(LAST_TWO_DIGITS)}:${seconds.slice(LAST_TWO_DIGITS)}.${milliseconds.slice(\n LAST_THREE_DIGITS,\n )}`;\n}\n\n/**\n * @param appName Application name & logging key, also part of the log level setting storage key.\n * @returns Current logging level for the specified application.\n */\nexport function getLogLevel(appName: string) {\n let result =\n !isSSR() &&\n Boolean(window.localStorage) &&\n Number(JSON.parse(localStorage.getItem(`${appName} debug`) ?? String(DEFAULT_LOG_LEVEL)));\n if (typeof result !== 'number' || Number.isNaN(result) || result < LogLevel.None || result > LogLevel.Debug) {\n result = DEFAULT_LOG_LEVEL;\n }\n\n return result;\n}\n\n/**\n * Generic log method wrapper. Formats the logged output a bit.\n * Skips calling the specific log method when current application log level\n * is lower than the requested log level in this call.\n * @param appName Application name / logging key.\n * @param level Requested log level for this call.\n * @param color Application name color in the log message.\n * @param args Log message / data.\n */\n// eslint-disable-next-line max-params -- low level function not expected to be referenced outside of this module\nexport function log(appName: string, level: LogLevel, color: string, ...args: unknown[]) {\n const currentLevel = getLogLevel(appName);\n if (currentLevel < level) {\n return;\n }\n const time = getTime();\n const usedColor = `color: #${color};`;\n const method = logMethodsMap.get(level);\n method?.(`%c${time} %c${appName}:`, 'color: #09c;', usedColor, ...args);\n}\n\n/**\n * @param appName Application name / logger key.\n * @param logLevel Log messages verbosity level.\n * @param color Application name color in the log message.\n * @returns Logger function for the specified log level.\n */\nexport function getLogger(appName: string, logLevel: LogLevel, color = DEFAULT_APP_LABEL_COLOR): LogMethod {\n return (...args: unknown[]) => log(appName, logLevel, color, ...args);\n}\n\n/**\n * @param appName Application name / logger key.\n * @param color Application name color in the log message.\n * @returns Error logger function.\n */\nexport function getErrorLogger(appName: string, color = DEFAULT_APP_LABEL_COLOR) {\n return getLogger(appName, LogLevel.Error, color);\n}\n\n/**\n * @param appName Application name / logger key.\n * @param color Application name color in the log message.\n * @returns Warning logger function.\n */\nexport function getWarningLogger(appName: string, color = DEFAULT_APP_LABEL_COLOR) {\n return getLogger(appName, LogLevel.Warning, color);\n}\n\n/**\n * @param appName Application name / logger key.\n * @param color Application name color in the log message.\n * @returns Info logger function.\n */\nexport function getInfoLogger(appName: string, color = DEFAULT_APP_LABEL_COLOR) {\n return getLogger(appName, LogLevel.Info, color);\n}\n\n/**\n * @param appName Application name / logger key.\n * @param color Application name color in the log message.\n * @returns Debug logger function.\n */\nexport function getDebugLogger(appName: string, color = DEFAULT_APP_LABEL_COLOR) {\n return getLogger(appName, LogLevel.Debug, color);\n}\n\n/**\n * @param appName Application name / logger key.\n * @param color Application name color in the log message.\n * @returns All log levels' loggers when needed.\n */\nexport function getLoggers(appName: string, color = DEFAULT_APP_LABEL_COLOR) {\n return {\n logDebug: getDebugLogger(appName, color),\n logError: getErrorLogger(appName, color),\n logInfo: getInfoLogger(appName, color),\n logWarning: getWarningLogger(appName, color),\n };\n}\n","export const isSSR = () => typeof window === 'undefined';\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 { TranslationsNamespaceProvider, TranslationsProvider } from '@ori/i18n';\nimport { Team, TestIdProvider } from '@ori/testid-generator';\nimport { StrictMode, Suspense, type FC } from 'react';\n\nimport { ErrorNotification } from './components';\nimport { APP_NAME, translationsNamespace } from './constants';\nimport type { ClientAppConfig } from './types/ClientAppConfig';\nimport { getTranslationsProps } from './utils/getTranslationsProps';\n\nexport type AppProps = ClientAppConfig;\n\nexport const App: FC = (props) => {\n const translationProps = getTranslationsProps(props);\n\n return (\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/ClientAppConfig';\n\nexport const getTranslationsProps = ({ currentLanguage, staticApiUrl, tenant }: 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 };\n\n return result;\n};\n","/* istanbul ignore file */\nimport { ThemeProvider } from '@ori-ui/mui';\nimport { parseClientAppConfig } from '@ori/client-app-config';\nimport { ErrorBoundary, LoggerProvider, ApplicationInsights, getClientApplicationInsightsConfig } from '@ori/logger';\nimport { createRoot } from 'react-dom/client';\n\nimport { App } from './App';\nimport { APP_NAME, EMOTION_CACHE_KEY } from './constants';\nimport { mainLogger, logDebug } from './logger';\nimport type { ClientAppConfig } from './types/ClientAppConfig';\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 // in case things are done the old way :)\n const separatedValues = {\n ...rootElement.dataset,\n };\n // fix for selected language\n if (!separatedValues.currentLanguage) {\n logDebug('adding currentLanguage from document.documentElement.lang');\n separatedValues.currentLanguage = document.documentElement.lang;\n }\n // fix for static api url\n if (!separatedValues.staticApiUrl) {\n logDebug('adding default staticApiUrl');\n separatedValues.staticApiUrl = 'https://api-static.oriflame.com/';\n }\n const { config = JSON.stringify(separatedValues) } = rootElement.dataset;\n logDebug('config:', config);\n\n const clientAppConfig = parseClientAppConfig(config, ['currentLanguage', 'staticApiUrl', 'tenant']);\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":["TranslationKey","FormattedMessage","props","_jsx","NotTypedFormattedMessage","SnackbarError","styled","Snackbar","theme","transform","transition","breakpoints","up","top","ErrorNotification","isOpen","setIsOpen","useState","messageId","setMessageId","genericError","handleClose","useCallback","handleShowErrorNotification","event","message","detail","useEffect","window","addEventListener","NotificationEventName","removeEventListener","open","autoHideDuration","anchorOrigin","vertical","horizontal","onClose","children","Alert","severity","variant","id","defaultTranslations","offerIsNotAvailable","selectedQuantityIsNotAvailable","translationsNamespace","LogLevel","DEFAULT_LOG_LEVEL","Warning","DEFAULT_APP_LABEL_COLOR","logMethodsMap","Map","None","args","Error","console","error","warn","Info","info","Debug","log","getLogLevel","appName","result","Boolean","localStorage","Number","JSON","parse","getItem","String","isNaN","level","color","time","date","Date","minutes","getMinutes","seconds","getSeconds","milliseconds","getMilliseconds","getHours","slice","getTime","usedColor","method","get","getLogger","logLevel","getDebugLogger","mainLogger","Logger","PACKAGE_NAME","teamName","TEAM_NAME","logDebug","APP_NAME","App","translationProps","getTranslationsProps","currentLanguage","staticApiUrl","tenant","clientFetchConfiguration","baseUrl","onError","action","defaultTranslationsWithNamespaces","StrictMode","Suspense","fallback","TestIdProvider","project","team","Team","Checkout","TranslationsProvider","TranslationsNamespaceProvider","namespace","async","render","rootElement","separatedValues","dataset","document","documentElement","lang","config","stringify","clientAppConfig","parseClientAppConfig","ApplicationInsights","initialize","getClientApplicationInsightsConfig","createRoot","LoggerProvider","logger","ErrorBoundary","areaName","ThemeProvider","enableCacheProvider","cacheKey","EMOTION_CACHE_KEY"],"sourceRoot":""}