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C,IAAMrE,EAb2B,SAAwCqE,GAOzE,OANuBxJ,GAAAA,GAAA,GAClBwJ,GAAY,IACfE,aAAaC,EAAAA,GAAAA,GAAoBH,EAAaE,aAAa,GAAO,GAClE5F,cAAc6F,EAAAA,GAAAA,GAAoBH,EAAa1F,cAAc,GAAO,IAIxE,CAKiB8F,CAAoBJ,GAGnC,OAFAL,GAAQ,2BAA4BhE,GAE7BA,CACT,E,0kBC9BiB0E,EAAAA,EAAAA,IAAUnG,EAAAA,GAAUoG,EAAAA,GAASC,OAKvCC,eAAeC,GAAOC,GAC3B,IAAAC,EAAwBD,EAAYE,QAA5Bb,OACFc,EAAYf,QADJ,IAAAa,EAAG,GAAEA,GAEXG,EAAoCD,EAApCC,WAAYZ,EAAwBW,EAAxBX,YAAwBW,EAAXtG,OAEjC,IAAK2F,EACH,MAAM,IAAIa,MAAM,0BAalBC,EAAAA,EAAAA,GAAWN,GAAaD,QACtB3J,EAAAA,EAAAA,KAACsH,GAAa,CAAAxH,UACZE,EAAAA,EAAAA,KAACmK,EAAAA,EAAuB,CAACH,WAAYA,EAAWlK,UAC9CE,EAAAA,EAAAA,KAACoK,EAAAA,EAAa,CACZC,qBAAmB,EACnBC,SAAUC,EAAAA,GAAkBzK,UAE5BE,EAAAA,EAAAA,KAACqD,EAAG3D,GAAA,GAAKqK,UAKnB,C","sources":["webpack://oriloyaltydialog/./src/context/appContext.ts","webpack://oriloyaltydialog/./src/components/BuyForPointsButton.tsx","webpack://oriloyaltydialog/./src/hooks/useTranslations.ts","webpack://oriloyaltydialog/./src/components/FormattedMessage.tsx","webpack://oriloyaltydialog/./src/components/DialogContent.tsx","webpack://oriloyaltydialog/./src/components/DialogHeader.tsx","webpack://oriloyaltydialog/./src/constants/defaultTranslations.ts","webpack://oriloyaltydialog/./src/utils/getTranslationsProps.ts","webpack://oriloyaltydialog/./src/App.tsx","webpack://oriloyaltydialog/./src/containers/ErrorBoundary.ts","webpack://oriloyaltydialog/./src/utils/getConfiguration.ts","webpack://oriloyaltydialog/./src/appRender.tsx"],"sourcesContent":["import type * as ShowLoyaltyDialog from '@ori-events/show-loyalty-dialog';\nimport { useContext, createContext } from 'react';\n\nconst DEFAULT_CONTEXT_DATA = {\n catalogueItemId: '0',\n choiceId: 0,\n consultantPrice: 0,\n itemCode: '0',\n loyaltyPoints: 0,\n loyaltyPrice: 0,\n productName: 'none',\n quantity: 0,\n};\n\nexport const appContext = createContext(DEFAULT_CONTEXT_DATA);\n\nexport const AppContextProvider = appContext.Provider;\n\nexport const useAppContext = () => useContext(appContext);\n","/* eslint-disable no-negated-condition -- needed */\nimport { useFormatCurrency } from '@ori/culture-provider';\nimport type { ButtonProps } from '@ori-ui/mui';\nimport { Button } from '@ori-ui/mui';\nimport { forwardRef } from 'react';\n\nimport { useAppContext } from '../context';\nimport { useTranslations } from '../hooks/useTranslations';\n\nexport const BuyForPointsButton = forwardRef((props, ref) => {\n const { loyaltyPrice, loyaltyPoints } = useAppContext();\n const { formatMessage } = useTranslations();\n const plusLoyaltyPrice = ` + ${useFormatCurrency(loyaltyPrice ?? 0)}`;\n\n return (\n \n {formatMessage('pointsCount', { 0: loyaltyPoints ?? 0 })}\n {loyaltyPrice !== 0 ? plusLoyaltyPrice : null}\n \n );\n});\n","/* 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 */\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","/* 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 */\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 useTestId from '@ori/testid-generator';\nimport { styled, Typography } from '@ori-ui/mui';\nimport type { FC, ReactNode } from 'react';\n\nimport { FormattedMessage } from './FormattedMessage';\n\ninterface DialogContentProps {\n actions: ReactNode;\n}\n\nconst Content = styled('div')(({ theme }) => ({\n boxSizing: 'border-box',\n padding: theme.spacing(6, 3),\n background: theme.palette.background.paper,\n}));\n\nconst Text = styled(Typography)(({ theme }) => ({\n padding: theme.spacing(6, 0),\n}));\n\nconst Actions = styled('div')({\n display: 'flex',\n flexDirection: 'column',\n textAlign: 'center',\n});\n\nconst DialogContent: FC = ({ actions }) => {\n const { getTestId } = useTestId();\n\n return (\n \n \n \n \n \n \n
\n \n \n {Boolean(actions) && {actions}}\n
\n );\n};\n\nexport default DialogContent;\n","import { styled, Typography } from '@ori-ui/mui';\nimport type { FC } from 'react';\n\ninterface DialogHeaderProps {\n points: number | null;\n}\n\nconst Header = styled('div')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n height: '120px',\n backgroundColor: theme.palette.purple[100],\n fontSize: '30px',\n marginTop: theme.spacing(1),\n}));\n\nconst Points = styled(Typography)(({ theme }) => ({\n width: theme.typography.pxToRem(74),\n height: theme.typography.pxToRem(74),\n borderRadius: '50%',\n backgroundColor: theme.palette.offer.dark,\n color: theme.palette.offer.contrastText,\n lineHeight: theme.typography.pxToRem(74),\n}));\n\nconst DialogHeader: FC = ({ points }) => (\n
\n \n {points}\n \n
\n);\n\nexport default DialogHeader;\n","/* 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\nimport type { TranslationKey } from '../models/TranslationKey';\n\nexport type DefaultTranslations = Record;\n\nexport const defaultTranslations: DefaultTranslations = {\n chooseHowYouWantToPayForIt: 'Choose how you want to pay for it:',\n congratulations: 'Congratulations!',\n pointsCount: '{0} P',\n youHaveLoyaltyPointsThatYouCanUseOnThisProduct: 'You have loyalty points that you can use on this product.',\n};\n\nexport const translationsNamespace = 'loyalty-dialog';\n","import { getErrorLogger } from '@ori/checkout-utils';\nimport { type TranslationsContext } from '@ori/i18n';\n\nimport { defaultTranslations, translationsNamespace, APP_NAME } from '../constants';\n\ninterface GetTranslationsOptions {\n currentLanguage: string;\n staticApiUrl: string;\n tenant: string;\n token: string;\n}\n\nconst logError = getErrorLogger(APP_NAME);\n\nexport const getTranslationsProps = ({ currentLanguage, staticApiUrl, tenant, token }: GetTranslationsOptions) => {\n const result: TranslationsContext = {\n clientFetchConfiguration: {\n baseUrl: staticApiUrl,\n onError: (error) => {\n logError('Error occured while loading translations.', String(error));\n },\n tenant,\n token,\n },\n currentLanguage,\n defaultTranslationsWithNamespaces: {\n [translationsNamespace]: defaultTranslations,\n },\n };\n\n return result;\n};\n","import { isTokenValid, useToken } from '@ori/auth';\nimport { ClientCultureContextProvider, FormatCurrency } from '@ori/culture-provider';\nimport { TranslationsNamespaceProvider, TranslationsProvider } from '@ori/i18n';\nimport { type Team, TestIdProvider } from '@ori/testid-generator';\nimport * as AddToBasket from '@ori-events/add-to-basket';\nimport * as LoyaltyDialogResult from '@ori-events/loyalty-dialog-result';\nimport * as ShowLoyaltyDialog from '@ori-events/show-loyalty-dialog';\nimport { Dialog } from '@ori-ui/components';\nimport { Button, Grid } from '@ori-ui/mui';\nimport { type FC, useCallback, useEffect, useState } from 'react';\n\nimport { BuyForPointsButton } from './components/BuyForPointsButton';\nimport DialogContent from './components/DialogContent';\nimport DialogHeader from './components/DialogHeader';\nimport { APP_NAME, translationsNamespace } from './constants';\nimport { AppContextProvider } from './context';\nimport type { AppConfig } from './types';\nimport { getTranslationsProps } from './utils';\n\nexport const App: FC = ({ currentLanguage, staticApiUrl, tenant }) => {\n const [data, setData] = useState();\n const { token } = useToken();\n const translationProps = getTranslationsProps({ currentLanguage, staticApiUrl, tenant, token });\n\n const handleLoyaltyDialogResult = useCallback(\n (result: LoyaltyDialogResult.Result) => {\n if (data) {\n const event = new CustomEvent(LoyaltyDialogResult.Name, {\n detail: {\n ...data,\n result,\n },\n });\n window.dispatchEvent(event);\n // unmountDialog\n setData(undefined);\n }\n },\n [data],\n );\n\n const handleClose = useCallback(\n () => handleLoyaltyDialogResult(LoyaltyDialogResult.LoyaltyDialogResults.CLOSE),\n [handleLoyaltyDialogResult],\n );\n\n const handleBuyForPoints = useCallback(\n () => handleLoyaltyDialogResult(AddToBasket.Method.BUY_FOR_POINTS),\n [handleLoyaltyDialogResult],\n );\n\n const handleBuyForMoney = useCallback(\n () => handleLoyaltyDialogResult(AddToBasket.Method.BUY_FOR_MONEY),\n [handleLoyaltyDialogResult],\n );\n\n useEffect(() => {\n const showLoyaltyDialogCallback = ((event: ShowLoyaltyDialog.Event) => {\n setData(event.detail);\n }) as EventListener;\n\n window.addEventListener(ShowLoyaltyDialog.Name, showLoyaltyDialogCallback);\n\n return () => window.removeEventListener(ShowLoyaltyDialog.Name, showLoyaltyDialogCallback);\n }, []);\n\n if (!isTokenValid(token) || !data) {\n return null;\n }\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n {data.consultantPrice ?? 0}\n \n \n \n }\n />\n \n \n \n \n \n \n );\n};\n","import { getErrorLogger } from '@ori/checkout-utils';\nimport { Component, type ReactNode } from 'react';\n\nimport { APP_NAME } from '../constants';\n\ninterface ErrorBoundaryProps {\n children: JSX.Element;\n}\n\ninterface ErrorBoundaryState {\n error?: Error;\n}\n\nconst logError = getErrorLogger(APP_NAME);\n\nexport class ErrorBoundary extends Component {\n override readonly state: ErrorBoundaryState = {};\n\n static getDerivedStateFromError(error: Error): ErrorBoundaryState {\n return { error };\n }\n\n override render(): ReactNode {\n const { error }: ErrorBoundaryState = this.state;\n\n if (error) {\n logError(error);\n\n return null;\n }\n\n const { children }: ErrorBoundaryProps = this.props;\n\n return children;\n }\n}\n","import { getDebugLogger, getInfoLogger, normalizeSlashChars } from '@ori/checkout-utils';\nimport { parseSpaConfig } from '@ori-appshell/config';\n\nimport { APP_NAME } from '../constants';\nimport type { AppConfig, ParsedConfigData, RequiredConfigProps, ToIndexed } from '../types';\n\nconst logDebug = getDebugLogger(APP_NAME);\nconst logInfo = getInfoLogger(APP_NAME);\n\n// Required props for parseSpaConfig method.\nconst requiredProps: RequiredConfigProps = [\n 'currentLanguage',\n 'customerId',\n 'identityUrl',\n 'staticApiUrl',\n 'tenant',\n];\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 = >(parsedConfig: T) => {\n const result: AppConfig = {\n ...parsedConfig,\n identityUrl: normalizeSlashChars(parsedConfig.identityUrl, false, false),\n staticApiUrl: normalizeSlashChars(parsedConfig.staticApiUrl, false, false),\n };\n\n return result;\n};\n\nexport const getConfiguration = (config: string) => {\n const parsedConfig = parseSpaConfig>(config, requiredProps);\n logDebug('parsed configuration', parsedConfig);\n const result = normalizeConfigData(parsedConfig);\n logInfo('normalized configuration', result);\n\n return result;\n};\n","import { StandaloneTokenProvider, doDevelopmentLogin } from '@ori/auth';\nimport { LogLevel, getLogger } from '@ori/checkout-utils';\nimport { ThemeProvider } from '@ori-ui/mui';\nimport { createRoot } from 'react-dom/client';\n\nimport { App } from './App';\nimport { APP_NAME, EMOTION_CACHE_KEY } from './constants';\nimport { ErrorBoundary } from './containers/ErrorBoundary';\nimport { getConfiguration } from './utils';\n\nconst logDebug = getLogger(APP_NAME, LogLevel.Debug);\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 const { customerId, identityUrl, tenant } = appConfig;\n\n if (!identityUrl) {\n throw new Error('Missing Identity URL!');\n }\n\n // Get token for local development\n if (process.env.NODE_ENV !== 'production') {\n // when using Requestly we do not want to load token\n if (process.env.REACT_APP_USE_REQUESTLY === '1') {\n logDebug('USING REQUESTLY');\n } else {\n await doDevelopmentLogin({ identityUrl, tenant });\n }\n }\n\n createRoot(rootElement).render(\n \n \n \n \n \n \n ,\n );\n}\n"],"names":["DEFAULT_CONTEXT_DATA","catalogueItemId","choiceId","consultantPrice","itemCode","loyaltyPoints","loyaltyPrice","productName","quantity","appContext","createContext","AppContextProvider","Provider","BuyForPointsButton","forwardRef","props","ref","_useAppContext","useContext","formatMessage","useTranslationsFromNamespace","plusLoyaltyPrice","concat","useFormatCurrency","_jsxs","Button","_objectSpread","fullWidth","variant","color","children","FormattedMessage","_jsx","NotTypedFormattedMessage","Content","styled","_ref","theme","boxSizing","padding","spacing","background","palette","paper","Text","Typography","_ref2","Actions","display","flexDirection","textAlign","_ref3","actions","getTestId","useTestId","align","id","Boolean","Header","alignItems","justifyContent","height","backgroundColor","purple","fontSize","marginTop","Points","width","typography","pxToRem","borderRadius","offer","dark","contrastText","lineHeight","points","defaultTranslations","chooseHowYouWantToPayForIt","congratulations","pointsCount","youHaveLoyaltyPointsThatYouCanUseOnThisProduct","translationsNamespace","logError","getErrorLogger","APP_NAME","App","_data$consultantPrice","currentLanguage","staticApiUrl","tenant","_useState","useState","_useState2","_slicedToArray","data","setData","token","useToken","translationProps","clientFetchConfiguration","baseUrl","onError","error","String","defaultTranslationsWithNamespaces","_defineProperty","getTranslationsProps","handleLoyaltyDialogResult","useCallback","result","event","CustomEvent","LoyaltyDialogResult","detail","window","dispatchEvent","undefined","handleClose","CLOSE","handleBuyForPoints","AddToBasket","BUY_FOR_POINTS","handleBuyForMoney","BUY_FOR_MONEY","useEffect","showLoyaltyDialogCallback","addEventListener","ShowLoyaltyDialog","removeEventListener","isTokenValid","ClientCultureContextProvider","host","TestIdProvider","team","project","TranslationsProvider","TranslationsNamespaceProvider","namespace","value","Dialog","open","onClose","DialogHeader","DialogContent","Grid","container","direction","item","onClick","FormatCurrency","ErrorBoundary","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","_assertThisInitialized","_createClass","key","this","state","Component","logDebug","getDebugLogger","logInfo","getInfoLogger","requiredProps","getConfiguration","config","parsedConfig","parseSpaConfig","identityUrl","normalizeSlashChars","normalizeConfigData","getLogger","LogLevel","Debug","async","render","rootElement","_rootElement$dataset$","dataset","appConfig","customerId","Error","createRoot","StandaloneTokenProvider","ThemeProvider","enableCacheProvider","cacheKey","EMOTION_CACHE_KEY"],"sourceRoot":""}