{"version":3,"sources":["Lib/client.js","Components/Spinner/spinner.svg","Components/Spinner/index.jsx","Components/Button/index.jsx","Lib/formatNumber.js","Components/Error/index.jsx","Components/IntegerInput/index.jsx","Product/App.jsx"],"names":["client","endpoint","body","customConfig","headers","config","method","credentials","Error","JSON","stringify","rejectDebug","window","Promise","reject","fetch","then","response","a","json","data","ok","_style","_g","_excluded","_extends","Object","assign","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","this","_objectWithoutProperties","excluded","sourceKeys","keys","indexOf","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","propertyIsEnumerable","SvgSpinner","_ref","svgRef","title","titleId","props","width","height","stroke","viewBox","xmlns","ref","id","className","cx","cy","r","fill","strokeWidth","ForwardRef","Spinner","VARIANTS","Button","children","variant","as","href","type","onClick","fullWidth","style","loading","disabled","classes","Component","undefined","PrimaryButton","SecondaryButton","culture","switzerland","langLocaleCode","cultureCode","delimiters","thousands","decimal","currency","symbol","position","abbreviations","thousand","million","billion","trillion","austria","numbro","loadCulturesInNode","egumaReact","formatCurrency","value","message","name","marginTop","marginBottom","role","IntegerInput","onChange","min","max","display","maxWidth","paddingTop","paddingBottom","e","polyglot","Polyglot","phrases","translations","App","onChangeVariant","variants","find","v","shortId","parseInt","currentTarget","setState","price","selectedVariantShortId","maxQuantity","pushChangeEvent","CustomEvent","detail","document","dispatchEvent","history","replaceState","onContinue","preventDefault","payload","productShortId","quantity","state","variantShortId","mandantId","lang","success","location","redirect","error","scroller","scrollTo","duration","smooth","offset","vatRate","Fragment","onSubmit","flexDirection","gap","htmlFor","variantTitle","t","map","React"],"mappings":"gKAyCeA,IApCA,SAACC,GAA4C,IAAD,yDAAP,GAAzBC,EAAgC,EAAhCA,KAASC,EAAuB,iBACnDC,EAAU,CAAC,eAAgB,oBAC3BC,EAAM,yBACVC,OAAQJ,EAAO,OAAS,MACxBK,YAAa,eACVJ,GAHO,IAIVC,QAAQ,2BACHA,GACAD,EAAaC,WAIpB,G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qD,IAAWgD,OADfhF,EAAQ0D,iBAQ7B,gCACE,qBAAKrE,UAAU,qBAAf,SACG4C,YAAenE,KAAK+G,MAAMf,SAE7B,+BACGb,EAASgD,EACe,IAAvBnI,KAAK+G,MAAMa,QACP,kBACA,2BAKT5H,KAAK+G,MAAMb,YAAc,GACxB,gCACE,uBAAO+B,QAAQ,WAAW1G,UAAU,UAApC,SACG4D,EAASgD,EAAE,qBAEd,cAAC,EAAD,CACE7G,GAAG,WACH8C,MAAOpE,KAAK+G,MAAMD,SAClBlC,IAAK,EACLC,IAAK7E,KAAK+G,MAAMb,YAChBvB,SAAU,SAAAmC,GAAQ,OAAI,EAAKf,SAAS,CAAEe,mBAK5C,cAAC,IAAD,CACEvE,WAAS,EACTC,MAAO,CAAE+B,UAAW,IACpBlC,KAAK,SACLK,SAAqC,IAA3B1C,KAAK+G,MAAMb,YAJvB,SAMGlG,KAAK+G,MAAMb,YAAc,EACtBf,EAASgD,EAAE,0BACXhD,EAASgD,EAAE,iC,GA/IbE,IAAMzF,WAyJT2C","file":"static/js/18.2d39a1e7.chunk.js","sourcesContent":["/*\r\n* Use this implementation to fetch data from the server\r\n* You can set rejectDebug = true in the console to test your error handling\r\n*/\r\n\r\nconst client = (endpoint, {body, ...customConfig} = {}) => {\r\n const headers = {'Content-Type': 'application/json'}\r\n const config = {\r\n method: body ? 'POST' : 'GET',\r\n credentials: \"same-origin\", // has to be set in order to use cookies: https://github.com/github/fetch#sending-cookies\r\n ...customConfig,\r\n headers: {\r\n ...headers,\r\n ...customConfig.headers,\r\n },\r\n }\r\n\r\n if (body) {\r\n if (typeof body !== \"object\") throw new Error(\"Body muss ein Objekt sein\");\r\n\r\n config.body = JSON.stringify(body)\r\n }\r\n\r\n const rejectDebug = window.rejectDebug || false;\r\n\r\n if (rejectDebug) {\r\n return Promise.reject(\"Rejecting for debugging\");\r\n }\r\n\r\n return window\r\n .fetch(endpoint, config)\r\n .then(async response => {\r\n const data = await response.json()\r\n if (response.ok) {\r\n return data\r\n } else {\r\n return Promise.reject(data)\r\n }\r\n })\r\n}\r\n\r\nexport default client;\r\n","var _style, _g;\n\nvar _excluded = [\"title\", \"titleId\"];\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport * as React from \"react\";\n\nfunction SvgSpinner(_ref, svgRef) {\n var title = _ref.title,\n titleId = _ref.titleId,\n props = _objectWithoutProperties(_ref, _excluded);\n\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n width: 24,\n height: 24,\n stroke: \"#fff\",\n viewBox: \"0 0 24 24\",\n xmlns: \"http://www.w3.org/2000/svg\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, _style || (_style = /*#__PURE__*/React.createElement(\"style\", null, \".spinner_V8m1{transform-origin:center;animation:spinner_zKoa 2s linear infinite}.spinner_V8m1 circle{stroke-linecap:round;animation:spinner_YpZS 1.5s ease-in-out infinite}@keyframes spinner_zKoa{100%{transform:rotate(360deg)}}@keyframes spinner_YpZS{0%{stroke-dasharray:0 150;stroke-dashoffset:0}47.5%{stroke-dasharray:42 150;stroke-dashoffset:-16}95%,100%{stroke-dasharray:42 150;stroke-dashoffset:-59}}\")), _g || (_g = /*#__PURE__*/React.createElement(\"g\", {\n className: \"spinner_V8m1\"\n }, /*#__PURE__*/React.createElement(\"circle\", {\n cx: 12,\n cy: 12,\n r: 9.5,\n fill: \"none\",\n strokeWidth: 3\n }))));\n}\n\nvar ForwardRef = /*#__PURE__*/React.forwardRef(SvgSpinner);\nexport default __webpack_public_path__ + \"static/media/spinner.71395300.svg\";\nexport { ForwardRef as ReactComponent };","import { ReactComponent as ReactSpinner } from './spinner.svg';\r\n\r\nconst Spinner = () => {\r\n return \r\n}\r\n\r\nexport default Spinner;","import React from \"react\";\r\nimport cx from \"classnames\";\r\nimport Spinner from \"../../Components/Spinner\";\r\nimport \"./styles.css\";\r\n\r\nconst VARIANTS = {\r\n PRIMARY: \"primary\",\r\n SECONDARY: \"secondary\"\r\n};\r\n\r\nconst Button = ({\r\n children,\r\n variant,\r\n as = \"button\",\r\n href = null,\r\n type = \"button\",\r\n onClick,\r\n fullWidth = false,\r\n style,\r\n loading,\r\n disabled = false\r\n}) => {\r\n const classes = cx(\"button-default\", {\r\n \"button-primary\": variant === VARIANTS.PRIMARY,\r\n \"button-secondary\": variant === VARIANTS.SECONDARY,\r\n \"button-fullwidth\": fullWidth\r\n });\r\n\r\n const Component = as;\r\n\r\n return (\r\n \r\n {loading && (\r\n \r\n \r\n \r\n )}\r\n \r\n {children}\r\n \r\n \r\n );\r\n};\r\n\r\nconst PrimaryButton = ({ children, ...props }) => (\r\n \r\n);\r\n\r\nconst SecondaryButton = ({ children, ...props }) => (\r\n \r\n);\r\n\r\nconst PrimaryLinkButton = ({ children, ...props }) => (\r\n \r\n);\r\n\r\nconst SecondaryLinkButton = ({ children, ...props }) => (\r\n \r\n);\r\n\r\nexport {\r\n PrimaryButton,\r\n SecondaryButton,\r\n PrimaryLinkButton,\r\n SecondaryLinkButton\r\n};\r\n","import numbro from \"numbro\"; // somehow it is not working with the newest version (2.x.x) of numbro\r\nimport egumaReact from \"egumaReact\"; // added in externals in webpack\r\n\r\nconst switzerland = {\r\n langLocaleCode: \"CH\",\r\n cultureCode: \"CH\",\r\n delimiters: {\r\n thousands: \"'\",\r\n decimal: \".\"\r\n },\r\n currency: {\r\n symbol: \"CHF \",\r\n position: \"prefix\"\r\n },\r\n // we don't need it, but we need to provide abbreviations because it is used in 'unformat'\r\n abbreviations: {\r\n thousand: \"k\",\r\n million: \"m\",\r\n billion: \"b\",\r\n trillion: \"t\"\r\n }\r\n};\r\n\r\nconst austria = {\r\n langLocaleCode: \"de-AT\",\r\n cultureCode: \"de-AT\",\r\n delimiters: {\r\n thousands: \".\",\r\n decimal: \",\"\r\n },\r\n currency: {\r\n symbol: \"€ \",\r\n position: \"prefix\"\r\n },\r\n // we don't need it, but we need to provide abbreviations because it is used in 'unformat'\r\n abbreviations: {\r\n thousand: \"k\",\r\n million: \"m\",\r\n billion: \"b\",\r\n trillion: \"t\"\r\n }\r\n};\r\n\r\nconst loadCultures = () => {\r\n numbro.loadCulturesInNode();\r\n\r\n numbro.culture(\"CH\", switzerland);\r\n numbro.culture(\"de-AT\", austria);\r\n};\r\n\r\nconst setCulture = culture => {\r\n if (culture === \"de-CH\" || culture === \"it-CH\" || culture === \"fr-CH\") {\r\n culture = \"CH\";\r\n } else if (culture === \"fr-FR\") {\r\n // the thousand delimiter is setup as space in the lib. we want to display a '.'\r\n // using de-DE (has the same format)\r\n culture = \"de-DE\";\r\n }\r\n\r\n numbro.culture(culture);\r\n};\r\n\r\nloadCultures();\r\nsetCulture(egumaReact.culture);\r\n\r\n//// END OF SETUP\r\n\r\nexport const formatCurrency = value => {\r\n return numbro(value).formatCurrency(\"0,0.00\");\r\n};\r\n","import React from \"react\";\r\nimport { Element } from \"react-scroll\";\r\n\r\nconst Error = ({ message }) => {\r\n return (\r\n \r\n \r\n {message}\r\n \r\n \r\n );\r\n}\r\n\r\nexport default Error;\r\n","import React from \"react\";\r\nimport \"./styles.css\";\r\n\r\nconst IntegerInput = ({ id, value, onChange, min, max }) => {\r\n const increase = () => {\r\n if (max && value + 1 > max) {\r\n return;\r\n }\r\n onChange(++value);\r\n };\r\n const decrease = () => {\r\n if (min && value - 1 < min) {\r\n return;\r\n }\r\n onChange(--value);\r\n };\r\n\r\n if (value < min) {\r\n onChange(min);\r\n }\r\n\r\n if (value > max) {\r\n onChange(max);\r\n }\r\n\r\n return (\r\n \r\n \r\n onChange(e.target.value)}\r\n />\r\n \r\n \r\n );\r\n};\r\n\r\nexport default IntegerInput;\r\n","import egumaReact from \"egumaReact\"; // added in externals in webpack\r\nimport React from \"react\";\r\nimport Error from \"../Components/Error\";\r\nimport { scroller } from \"react-scroll\";\r\n\r\nimport Polyglot from \"node-polyglot\";\r\nimport { PrimaryButton } from \"../Components/Button\";\r\nimport client from \"../Lib/client\";\r\nimport IntegerInput from \"../Components/IntegerInput\";\r\nimport { formatCurrency } from \"../Lib/formatNumber\";\r\nconst polyglot = new Polyglot({ phrases: egumaReact.translations });\r\n\r\nclass App extends React.Component {\r\n constructor(props) {\r\n super(props);\r\n\r\n const variant = egumaReact.variants.find(\r\n v => v.shortId === egumaReact.selectedVariantShortId\r\n );\r\n\r\n this.state = {\r\n price: egumaReact.price,\r\n vatRate: egumaReact.vatRate,\r\n quantity: 1,\r\n maxQuantity: variant ? variant.maxQuantity : egumaReact.maxQuantity,\r\n selectedVariantShortId: egumaReact.selectedVariantShortId,\r\n error: false\r\n };\r\n }\r\n\r\n onChangeVariant = e => {\r\n const variant = egumaReact.variants.find(\r\n v => v.shortId === parseInt(e.currentTarget.value)\r\n );\r\n this.setState({\r\n price: variant.price,\r\n selectedVariantShortId: variant.shortId,\r\n maxQuantity: variant.maxQuantity\r\n });\r\n\r\n const pushChangeEvent = new CustomEvent(\"eguma.product.onChangeVariant\", {\r\n detail: {\r\n variant\r\n }\r\n });\r\n document.dispatchEvent(pushChangeEvent);\r\n\r\n window.history.replaceState({}, \"\", `?variant=${variant.shortId}`);\r\n };\r\n\r\n onContinue = async e => {\r\n e.preventDefault();\r\n\r\n const payload = {\r\n productShortId: egumaReact.shortId,\r\n quantity: this.state.quantity,\r\n ...(egumaReact.variants.length > 0 && {\r\n variantShortId: this.state.selectedVariantShortId\r\n })\r\n };\r\n\r\n const data = await client(\r\n `/api/${egumaReact.mandantId}/${egumaReact.lang}/add_product`,\r\n { body: payload }\r\n );\r\n\r\n if (data.success) {\r\n window.location.href = data.redirect;\r\n } else {\r\n this.setState({ error: data.message }, () => {\r\n scroller.scrollTo(\"error\", {\r\n duration: 300,\r\n smooth: true,\r\n offset: -20\r\n });\r\n });\r\n }\r\n };\r\n\r\n render() {\r\n return (\r\n \r\n
\r\n
\r\n \r\n {this.state.error && }\r\n\r\n {egumaReact.variants.length > 0 && (\r\n
\r\n \r\n {egumaReact.variantTitle\r\n ? egumaReact.variantTitle\r\n : polyglot.t(\"Common.Variant\")}\r\n \r\n \r\n {egumaReact.variants.map(variant => (\r\n \r\n ))}\r\n \r\n
\r\n )}\r\n\r\n
\r\n
\r\n {formatCurrency(this.state.price)}\r\n
\r\n \r\n {polyglot.t(\r\n this.state.vatRate === 0\r\n ? \"Common.Vat.Free\"\r\n : \"Common.VatIncluded\"\r\n )}\r\n \r\n
\r\n\r\n {this.state.maxQuantity > 0 && (\r\n
\r\n \r\n this.setState({ quantity })}\r\n />\r\n
\r\n )}\r\n\r\n \r\n {this.state.maxQuantity > 0\r\n ? polyglot.t(\"Shop.Action.AddProduct\")\r\n : polyglot.t(\"Common.SoldOut\")}\r\n \r\n \r\n
\r\n
\r\n
\r\n );\r\n }\r\n}\r\n\r\nexport default App;\r\n"],"sourceRoot":""}