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,QAC9BC,GAAYC,EAAAA,EAAAA,GAAsCH,EAAQ,CAAC,kBAAmB,eAAgB,WAQlGI,EAAAA,EAAoBC,YAAWC,EAAAA,EAAAA,OAGjCC,EAAAA,EAAAA,GAAWR,GAAaD,QACtBhJ,EAAAA,EAAAA,KAAC0H,EAAAA,EAAc,CAACC,OAAQlC,GAAW3F,UACjCE,EAAAA,EAAAA,KAAC4H,EAAAA,EAAa,CAACC,SAAU,GAAG3C,GAAAA,cAAoBpF,UAC9CE,EAAAA,EAAAA,KAAC0J,EAAAA,EAAa,CACZC,qBAAmB,EACnBC,SAAUC,GAAAA,GAAkB/J,UAE5BE,EAAAA,EAAAA,KAACyI,GAAG,IAAKW,UAKnB,C","sources":["webpack://oriloyaltydialogapp/../../../src/contexts/loyaltyDialogContext.ts","webpack://oriloyaltydialogapp/../../../src/components/BuyForPointsButton.tsx","webpack://oriloyaltydialogapp/../../../src/hooks/useTranslations.ts","webpack://oriloyaltydialogapp/../../../src/components/FormattedMessage.tsx","webpack://oriloyaltydialogapp/../../../src/components/DialogContent.tsx","webpack://oriloyaltydialogapp/../../../src/components/DialogHeader.tsx","webpack://oriloyaltydialogapp/../../../src/components/LoyaltyDialog.tsx","webpack://oriloyaltydialogapp/../../../src/hooks/useLoyaltyDialog.ts","webpack://oriloyaltydialogapp/../../../src/constants/index.ts","webpack://oriloyaltydialogapp/../../../src/constants/defaultTranslations.ts","webpack://oriloyaltydialogapp/../../src/constants-generated.ts","webpack://oriloyaltydialogapp/../../src/logger.ts","webpack://oriloyaltydialogapp/../../../src/containers/ApiProvider.tsx","webpack://oriloyaltydialogapp/../../../src/containers/LoyaltyDialogController.tsx","webpack://oriloyaltydialogapp/../../../src/utils/getTranslationsProps.ts","webpack://oriloyaltydialogapp/./src/App.tsx","webpack://oriloyaltydialogapp/./src/logger.ts","webpack://oriloyaltydialogapp/./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 loyaltyDialogContext = createContext(DEFAULT_CONTEXT_DATA);\n\nexport const LoyaltyDialogProvider = loyaltyDialogContext.Provider;\n\nexport const useLoyaltyDialog = () => useContext(loyaltyDialogContext);\n","/* eslint-disable no-negated-condition -- needed */\nimport type { ButtonProps } from '@ori-ui/mui';\nimport { Button } from '@ori-ui/mui';\nimport { useFormatCurrency } from '@ori/culture';\nimport { forwardRef } from 'react';\n\nimport { useLoyaltyDialog } from '../contexts';\nimport { useTranslations } from '../hooks/useTranslations';\n\nexport const BuyForPointsButton = forwardRef((props, ref) => {\n const { loyaltyPrice, loyaltyPoints } = useLoyaltyDialog();\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/**\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/**\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 { styled, Typography } from '@ori-ui/mui';\nimport useTestId from '@ori/testid-generator';\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\nexport const 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.common.white,\n fontSize: '3rem',\n marginTop: theme.spacing(1),\n}));\n\nconst Points = styled(Typography)(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: theme.typography.pxToRem(74),\n height: theme.typography.pxToRem(74),\n borderRadius: '50%',\n backgroundColor: theme.palette.primary.main,\n color: theme.palette.text.primary,\n lineHeight: theme.typography.pxToRem(74),\n}));\n\nexport const DialogHeader: FC = ({ points }) => (\n
\n \n {points}\n \n
\n);\n\nexport default DialogHeader;\n","import { Dialog } from '@ori-ui/components';\nimport { Button, Grid } from '@ori-ui/mui';\nimport { FormatCurrency } from '@ori/culture';\nimport { type FC } from 'react';\n\nimport { LoyaltyDialogProvider } from '../contexts';\nimport { useLoyaltyDialog } from '../hooks';\nimport { BuyForPointsButton } from './BuyForPointsButton';\nimport { DialogContent } from './DialogContent';\nimport { DialogHeader } from './DialogHeader';\n\nexport const LoyaltyDialog: FC = () => {\n const { data, handleBuyForMoney, handleBuyForPoints, handleClose } = useLoyaltyDialog();\n\n if (!data) {\n return null;\n }\n\n return (\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","import * 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 { useCallback, useEffect, useState } from 'react';\n\nexport const useLoyaltyDialog = () => {\n const [data, setData] = useState();\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 return {\n data,\n handleBuyForMoney,\n handleBuyForPoints,\n handleClose,\n };\n};\n","export * from './defaultTranslations';\nexport { TEAM_NAME } from '../constants-generated';\n\nexport const APP_NAME = 'loyalty-dialog';\nexport const PACKAGE_NAME = '@ori/loyalty-dialog';\n\nexport const EMOTION_CACHE_KEY = `${APP_NAME}-emotion-cache-key`;\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 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","/* 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 = 'loyalty-dialog';\nexport const PACKAGE_NAME = '@ori/loyalty-dialog';\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 { basicSwrOptions } from '@ori/checkout-utils';\nimport { useServiceUrls } from '@ori/configuration-manager';\nimport { useEnvironment } from '@ori/environment';\nimport { SWRConfig } from '@ori/fetching';\nimport { useLanguage } from '@ori/i18n';\nimport { ApiClientProvider as StaticApiClientProvider } from '@ori/static-api-client-react';\nimport type { FC, PropsWithChildren } from 'react';\n\n// TO-DO: Maybe move these into @ori/checkout-utils?\nconst timeout = 10000;\nconst swrConfig = {\n focusThrottleInterval: 300000,\n suspense: false,\n ...basicSwrOptions,\n};\n\nexport const ApiProvider: FC = ({ children }) => {\n const { language } = useLanguage();\n const { tenant } = useEnvironment();\n const { staticApiUrl } = useServiceUrls(['staticApi']);\n\n const staticClientProps = { baseUrl: staticApiUrl, language, tenant, timeout };\n\n return (\n \n {children}\n \n );\n};\n","import { useServiceUrls } from '@ori/configuration-manager';\nimport { ClientCultureProvider } from '@ori/culture';\nimport { useEnvironment } from '@ori/environment';\nimport { TranslationsNamespaceProvider, TranslationsProvider, useLanguage } 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 { LoyaltyDialog } from '../components';\nimport { APP_NAME, translationsNamespace } from '../constants';\nimport { mainLogger } from '../logger';\nimport type { LoyaltyDialogControllerProps } from '../types';\nimport { getTranslationsProps } from '../utils';\nimport { ApiProvider } from './ApiProvider';\n\nexport const LoyaltyDialogController: FC = ({ translations }) => {\n const { staticApiUrl } = useServiceUrls(['staticApi']);\n const { tenant } = useEnvironment();\n const { language } = useLanguage();\n const translationProps = getTranslationsProps({ currentLanguage: language, staticApiUrl, tenant, translations });\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n};\n","import type { PickClientAppDataConfigProps } from '@ori/client-app-config';\nimport { type TranslationsContext } from '@ori/i18n';\n\nimport { defaultTranslations, translationsNamespace } from '../constants';\nimport { mainLogger } from '../logger';\nimport type { LoyaltyDialogControllerProps } from '../types';\n\ntype GetTranslationsProps = PickClientAppDataConfigProps<'currentLanguage' | 'staticApiUrl' | 'tenant'> &\n LoyaltyDialogControllerProps;\n\nexport const getTranslationsProps = ({ currentLanguage, staticApiUrl, tenant, translations }: GetTranslationsProps) => {\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 { PickClientAppDataConfigProps } from '@ori/client-app-config';\nimport { ServiceUrlsProvider } from '@ori/configuration-manager';\nimport { EnvironmentProvider } from '@ori/environment';\nimport { TranslationsProvider } from '@ori/i18n';\nimport { LoyaltyDialogController } from '@ori/loyalty-dialog';\nimport { type FC } from 'react';\n\nexport type ClientAppConfig = PickClientAppDataConfigProps<'currentLanguage' | 'staticApiUrl' | 'tenant'>;\n\nexport const App: FC = ({ currentLanguage, staticApiUrl, tenant }) => (\n \n \n \n \n \n \n \n);\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 { parseClientAppConfig } from '@ori/client-app-config';\nimport { ApplicationInsights, ErrorBoundary, getClientApplicationInsightsConfig, LoggerProvider } from '@ori/logger';\nimport { createRoot } from 'react-dom/client';\n\nimport { App } from './App';\nimport type { ClientAppConfig } 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 = parseClientAppConfig(config, ['currentLanguage', 'staticApiUrl', 'tenant']);\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":["DEFAULT_CONTEXT_DATA","catalogueItemId","choiceId","consultantPrice","itemCode","loyaltyPoints","loyaltyPrice","productName","quantity","loyaltyDialogContext","createContext","LoyaltyDialogProvider","Provider","BuyForPointsButton","forwardRef","props","ref","useContext","formatMessage","useTranslationsFromNamespace","plusLoyaltyPrice","useFormatCurrency","_jsxs","Button","fullWidth","variant","color","children","FormattedMessage","_jsx","NotTypedFormattedMessage","Content","styled","theme","boxSizing","padding","spacing","background","palette","paper","Text","Typography","Actions","display","flexDirection","textAlign","DialogContent","actions","getTestId","useTestId","align","id","Boolean","Header","alignItems","justifyContent","height","backgroundColor","common","white","fontSize","marginTop","Points","width","typography","pxToRem","borderRadius","primary","main","text","lineHeight","DialogHeader","points","LoyaltyDialog","data","handleBuyForMoney","handleBuyForPoints","handleClose","useLoyaltyDialog","setData","useState","handleLoyaltyDialogResult","useCallback","result","event","CustomEvent","LoyaltyDialogResult","detail","window","dispatchEvent","undefined","CLOSE","AddToBasket","BUY_FOR_POINTS","BUY_FOR_MONEY","useEffect","showLoyaltyDialogCallback","addEventListener","ShowLoyaltyDialog","removeEventListener","value","Dialog","open","onClose","_Fragment","Grid","container","direction","item","onClick","FormatCurrency","APP_NAME","defaultTranslations","chooseHowYouWantToPayForIt","congratulations","pointsCount","youHaveLoyaltyPointsThatYouCanUseOnThisProduct","translationsNamespace","mainLogger","Logger","teamName","getDebugLogger","getInfoLogger","swrConfig","focusThrottleInterval","suspense","basicSwrOptions","ApiProvider","language","useLanguage","tenant","useEnvironment","staticApiUrl","useServiceUrls","staticClientProps","baseUrl","timeout","SWRConfig","StaticApiClientProvider","LoyaltyDialogController","translations","translationProps","getTranslationsProps","currentLanguage","clientFetchConfiguration","onError","error","action","defaultTranslationsWithNamespaces","translationsWithNamespaces","StrictMode","LoggerProvider","logger","ErrorBoundary","areaName","Suspense","fallback","TestIdProvider","project","team","Team","Checkout","TranslationsProvider","TranslationsNamespaceProvider","namespace","ClientCultureProvider","App","ServiceUrlsProvider","serviceUrls","EnvironmentProvider","PACKAGE_NAME","TEAM_NAME","async","render","rootElement","config","dataset","appConfig","parseClientAppConfig","ApplicationInsights","initialize","getClientApplicationInsightsConfig","createRoot","ThemeProvider","enableCacheProvider","cacheKey","EMOTION_CACHE_KEY"],"sourceRoot":""}