{"version":3,"sources":["webpack:///./src/components/DialogHeader.tsx","webpack:///./src/components/DialogContent.tsx","webpack:///./src/Dialog.tsx","webpack:///./src/AppRender.tsx"],"names":["StyledHeader","div","StyledPoints","points","createElement","StyledDialogContent","StyledDialogContentTitle","StyledDialogContentText","StyledDialogContentActions","actions","id","data","oriContext","useContext","OriContext","formatter","oriCurrency","handleLoyaltyDialogResult","result","event","CustomEvent","detail","Object","assign","window","dispatchEvent","onClose","CLOSE","maxWidth","fullWidth","open","loyaltyPoints","container","direction","spacing","item","variant","color","onClick","BUY_FOR_POINTS","values","0","loyaltyPrice","formatCurrency","BUY_FOR_MONEY","consultantPrice","DEFAULT_ORI_CURRENCY","pattern","decimals","groupSize","symbol","createContext","render","translations","dataset","JSON","parse","decodeURIComponent","_0P","congratulations","youHaveLoyaltyPointsThatYouCanUseOnThisProduct","chooseHowYouWantToPayForIt","culture","innerHTML","name","numberFormat","Provider","value","locale","messages","Dialog"],"mappings":";;;;;;;;;;;;;;oSAEA,MAAMA,EAAe,IAAOC,GAAI;;;;;;;EAQ1BC,EAAe,IAAOD,GAAI;;;;;;;;;;EAajB,MAFM,EAAGE,YAAe,IAAMC,cAAcJ,EAAc,KACrE,IAAMI,cAAcF,EAAc,KAAMC,ICnB5C,MAAME,EAAsB,IAAOJ,GAAI;;;;EAKjCK,EAA2B,IAAOL,GAAI;;;;;EAMtCM,EAA0B,IAAON,GAAI;;;EAIrCO,EAA6B,IAAOP,GAAI;;;;EAc/B,MATO,EAAGQ,aAAgB,IAAML,cAAcC,EAAqB,KAC9E,IAAMD,cAAcE,EAA0B,KAC1C,IAAMF,cAAc,IAAkB,CAAEM,GAAI,qBAChD,IAAMN,cAAcG,EAAyB,KACzC,IAAMH,cAAc,IAAkB,CAAEM,GAAI,mDAC5C,IACA,IAAMN,cAAc,KAAM,MAC1B,IAAMA,cAAc,IAAkB,CAAEM,GAAI,gCAChDD,GAAY,IAAML,cAAcI,EAA4B,KAAMC,I,kBCMvD,MA3BFE,I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nC,YAAa8B,IAEJM,EAAUzC,IACnB,GAAI,SAAQ,CACR,MAAM0C,EAAe,SAAOC,QAAQD,aAC9BE,KAAKC,MAAMC,mBAAmB,SAAOH,QAAQD,eAC7C,CACEK,IAAK,GACLC,gBAAiB,GACjBC,+CAAgD,GAChDC,2BAA4B,IAE9BC,EAAU,cACVP,KAAKC,MAAM,cAAYO,WACvB,CACEC,KAAM,QACNC,aAAc,CACVjD,YAAa8B,KAGnB,YAAE9B,GAAgB8C,EAAQG,aAChC,YAAa,IAAM7D,cAAc,IAAqB,KAClD,IAAMA,cAAcU,EAAWoD,SAAU,CAAEC,MAAO,CAC1CnD,gBAEJ,IAAMZ,cAAc,IAAc,CAAEgE,OAAQN,EAAQE,KAAMK,SAAU/C,OAAOC,OAAO,CAAEmB,aAAc,UAAYW,IAC1G,IAAMjD,cAAckE,EAAQhD,OAAOC,OAAO,GAAIZ,OAAW","file":"js/app.69e53c099b56d84b5614.js","sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nconst StyledHeader = styled.div `\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\theight: 120px;\n\tbackground: rgba(236, 216, 152, 0.7);\n\tfont-size: 30px;\n`;\nconst StyledPoints = styled.div `\n\tdisplay: inline-block;\n\twidth: 2.46em;\n\theight: 2.46em;\n\tborder-radius: 50%;\n\tbackground-color: #ecd898;\n\tcolor: #fff;\n\tfont-weight: bold;\n\tline-height: 2.46em;\n\ttext-align: center;\n`;\nconst DialogHeader = ({ points, }) => (React.createElement(StyledHeader, null,\n React.createElement(StyledPoints, null, points)));\nexport default DialogHeader;\n","import React from 'react';\nimport styled from 'styled-components';\nimport FormattedMessage from 'react-intl/lib/components/message';\nconst StyledDialogContent = styled.div `\n\tbox-sizing: border-box;\n\tpadding: 30px 15px;\n\tbackground: #fff;\n`;\nconst StyledDialogContentTitle = styled.div `\n\tcolor: #555;\n\tfont-size: 25px;\n\tfont-weight: bold;\n\ttext-align: center;\n`;\nconst StyledDialogContentText = styled.div `\n\tpadding: 30px 0;\n\ttext-align: center;\n`;\nconst StyledDialogContentActions = styled.div `\n\tdisplay: flex;\n\tflex-direction: column;\n\ttext-align: center;\n`;\nconst DialogContent = ({ actions, }) => (React.createElement(StyledDialogContent, null,\n React.createElement(StyledDialogContentTitle, null,\n React.createElement(FormattedMessage, { id: \"congratulations\" })),\n React.createElement(StyledDialogContentText, null,\n React.createElement(FormattedMessage, { id: \"youHaveLoyaltyPointsThatYouCanUseOnThisProduct\" }),\n \" \",\n React.createElement(\"br\", null),\n React.createElement(FormattedMessage, { id: \"chooseHowYouWantToPayForIt\" })),\n actions && (React.createElement(StyledDialogContentActions, null, actions))));\nexport default DialogContent;\n","import React, { useCallback } from 'react';\nimport FormattedMessage from 'react-intl/lib/components/message';\nimport { render } from 'preact';\nimport { Button, Grid, Dialog } from '@ori-ui/material-ui';\nimport * as LoyaltyDialogResult from '@ori-events/loyalty-dialog-result';\nimport { rootEl } from './app_loader';\nimport DialogHeader from './components/DialogHeader';\nimport DialogContent from './components/DialogContent';\nimport { OriContext } from './AppRender';\nimport Formatter from '@ori/formatter';\nconst App = (data) => {\n const oriContext = React.useContext(OriContext);\n const formatter = new Formatter(oriContext.oriCurrency);\n const handleLoyaltyDialogResult = useCallback((result) => {\n const event = new CustomEvent(LoyaltyDialogResult.Name, {\n detail: Object.assign(Object.assign({}, data), { result }),\n });\n window.dispatchEvent(event);\n // unmountDialog\n if (rootEl) {\n render(null, rootEl);\n }\n }, [data]);\n return (React.createElement(Dialog, { onClose: () => handleLoyaltyDialogResult(LoyaltyDialogResult.Result.CLOSE), maxWidth: \"xs\", fullWidth: true, open: true },\n React.createElement(DialogHeader, { points: data.loyaltyPoints }),\n React.createElement(DialogContent, { actions: React.createElement(Grid, { container: true, direction: \"column\", spacing: 3 },\n React.createElement(Grid, { item: true },\n React.createElement(Button, { variant: \"contained\", color: \"primary\", fullWidth: true, onClick: () => handleLoyaltyDialogResult(LoyaltyDialogResult.Result.BUY_FOR_POINTS) },\n React.createElement(FormattedMessage, { id: \"_0P\", values: {\n 0: data.loyaltyPoints,\n } }),\n (data === null || data === void 0 ? void 0 : data.loyaltyPrice) !== 0 && (React.createElement(FormattedMessage, { id: \"loyaltyPrice\", values: {\n 0: formatter.formatCurrency(data.loyaltyPrice || 0),\n } })))),\n React.createElement(Grid, { item: true },\n React.createElement(Button, { variant: \"outlined\", color: \"primary\", fullWidth: true, onClick: () => handleLoyaltyDialogResult(LoyaltyDialogResult.Result.BUY_FOR_MONEY) }, formatter.formatCurrency(data.consultantPrice || 0)))) })));\n};\nexport default App;\n","import React from 'react';\nimport { render as preactRender } from 'preact';\nimport { cultureInfo, rootEl } from './app_loader';\nimport IntlProvider from 'react-intl/lib/components/provider';\nimport { OriMuiThemeProvider } from '@ori-ui/material-ui';\nimport Dialog from './Dialog';\nconst DEFAULT_ORI_CURRENCY = {\n pattern: ['$-n', '$n'],\n decimals: 2,\n ',': ',',\n '.': '.',\n groupSize: [3],\n symbol: '$',\n};\nexport const OriContext = React.createContext({\n oriCurrency: DEFAULT_ORI_CURRENCY,\n});\nexport const render = (data) => {\n if (rootEl) {\n const translations = rootEl.dataset.translations\n ? JSON.parse(decodeURIComponent(rootEl.dataset.translations))\n : {\n _0P: '',\n congratulations: '',\n youHaveLoyaltyPointsThatYouCanUseOnThisProduct: '',\n chooseHowYouWantToPayForIt: '',\n };\n const culture = cultureInfo\n ? JSON.parse(cultureInfo.innerHTML)\n : {\n name: 'en-EN',\n numberFormat: {\n oriCurrency: DEFAULT_ORI_CURRENCY,\n },\n };\n const { oriCurrency } = culture.numberFormat;\n preactRender(React.createElement(OriMuiThemeProvider, null,\n React.createElement(OriContext.Provider, { value: {\n oriCurrency,\n } },\n React.createElement(IntlProvider, { locale: culture.name, messages: Object.assign({ loyaltyPrice: ' + {0}' }, translations) },\n React.createElement(Dialog, Object.assign({}, data))))), rootEl);\n }\n};\n"],"sourceRoot":""}