{"version":3,"sources":["webpack:///./Scripts/Jicon/Components/BuyButton.js","webpack:///./Scripts/Jicon/Components/withReactiveStyleBuyButton.js","webpack:///./Scripts/Jicon/Services/Cart.service.js"],"names":["BuyButton","label","articleNumber","quantityFieldId","href","cssClass","onClick","Fragment","className","e","preventDefault","rel","props","dispatch","useDispatch","Button","withReactiveStyleBuyButton","async","quantity","document","getElementById","value","cart","addToCartService","receive","ex","catchError","error","loadError","StateStyles","WrappedComponent","stylePrefix","stateClass","setStateClass","useState","startTime","useRef","useEffect","changeState","complete","autoReset","setTimeout","current","resetTimeout","onButtonClick","params","Date","now","loadingDuration","minimumLoadingTime","onComplete","add","isNaN","parseFloat","post","json","reorder","orderId"],"mappings":"gLAOA,MAAMA,EAAY,EACdC,QACAC,gBACAC,kBACAC,OACAC,WACAC,aAGI,gBAAC,EAAAC,SAAQ,KACJL,EACG,qBACIM,UAAWH,EACXC,QAAUG,IACNA,EAAEC,iBACFJ,EAAQ,CAAEJ,gBAAeC,mBAAkB,EAE/CC,KAAMA,GAAQ,IACdO,IAAI,YAEHV,GAGL,qBAAGO,UAAWH,EAAUD,KAAMA,GAAQ,IAAKO,IAAI,YAC1CV,IA0BrB,EAnBsBW,IAClB,MAAMC,GAAWC,UAcXC,GAASC,OAA2BhB,GAb1BiB,OAASf,gBAAeC,sBACpC,IACI,MAAMe,EAAWf,EACXgB,SAASC,eAAejB,GAAiBkB,MACzC,EACAC,QAAaC,OAAiB,CAAErB,gBAAegB,aAErD,OADAL,GAASW,QAAQF,KACV,CAIX,CAHE,MAAOG,GAEL,OADAZ,GAASa,OAAWD,GAAKE,IAAUC,QAAUD,OACtC,CACX,IAE0D,cAC9D,OAAO,gBAACZ,EAAWH,EAAS,C,iSCpDhC,MAAMiB,EACO,YADPA,EAEO,YAFPA,EAGK,UAgBI,SAASb,EACpBc,EACAxB,EACAyB,GAEA,OAAQnB,IACJ,MAAOoB,EAAYC,IAAiBC,cAAS,IACvCC,GAAYC,YAAO,IAEzBC,gBAAU,IACC,KACHJ,EAAc,GAAG,GAEtB,IAYH,MAAMK,EAAeC,IACjBN,EACK,GAAEF,IACCQ,EAAWV,EAAsBA,MAMrB,IAApBjB,EAAM4B,WACFC,YAAW,KAnBfR,EAAc,IACdE,EAAUO,QAAU,CAmBI,GACjB9B,EAAM+B,cAAgB,IAAK,EAiBtC1B,eAAe2B,EAAcC,GAjCzBZ,EAAe,GAAEF,IAAcF,KAC/BM,EAAUO,QAAUI,KAAKC,OAkB7B,SAAoBR,GAChB,MAAMS,EAAkBF,KAAKC,MAAQZ,EAAUO,QACzCO,EAAqBrC,EAAMqC,oBAAsB,IAGnDD,GAAmBC,EACnBX,EAAYC,GAEZE,YAAW,KACPH,EAAYC,EAAS,GACtBU,EAAqBD,EAEhC,CAKIE,OADmB5C,EAAQuC,GAE/B,CAEA,OACI,wBAAMrC,UAAWwB,GACb,gBAACF,EAAgB,GACbxB,QAAUuC,GAAWD,EAAcC,IAC/BjC,IAEL,CAGnB,C,qECxFO,MAAMuC,EAAMlC,OAASf,gBAAegB,WAAW,MAClD,IAAKA,GAAYkC,MAAMlC,IAAamC,WAAWnC,IAAa,EACxD,KAAM,mBAOV,aAJuBoC,QAAK,gBAAiB,CACzCpD,gBACAgB,SAAUmC,WAAWnC,MAETqC,MAAM,EAGbC,EAAUvC,gBACIqC,QAAK,oBAAqB,CAAEG,aACnCF,M","file":"492.99ed8465c5df2acf4d0c.js","sourcesContent":["import React, { Fragment } from 'react';\r\nimport { add as addToCartService } from '../Services/Cart.service';\r\nimport withReactiveStyleBuyButton from './withReactiveStyleBuyButton';\r\nimport { receive, loadError } from '../Actions/Cart.action';\r\nimport { catchError } from '../Actions/Error.action';\r\nimport { useDispatch } from 'react-redux';\r\n\r\nconst BuyButton = ({\r\n label,\r\n articleNumber,\r\n quantityFieldId,\r\n href,\r\n cssClass,\r\n onClick,\r\n}) => {\r\n return (\r\n \r\n {articleNumber ? (\r\n {\r\n e.preventDefault();\r\n onClick({ articleNumber, quantityFieldId });\r\n }}\r\n href={href || '#'}\r\n rel=\"nofollow\"\r\n >\r\n {label}\r\n \r\n ) : (\r\n \r\n {label}\r\n \r\n )}\r\n \r\n );\r\n};\r\n\r\nconst StyledButton = (props) => {\r\n const dispatch = useDispatch();\r\n const onClick = async ({ articleNumber, quantityFieldId }) => {\r\n try {\r\n const quantity = quantityFieldId\r\n ? document.getElementById(quantityFieldId).value\r\n : 1;\r\n const cart = await addToCartService({ articleNumber, quantity });\r\n dispatch(receive(cart));\r\n return true;\r\n } catch (ex) {\r\n dispatch(catchError(ex, (error) => loadError(error)));\r\n return false;\r\n }\r\n };\r\n const Button = withReactiveStyleBuyButton(BuyButton, onClick, 'buy-button');\r\n return