{"version":3,"sources":["pages/partner-ip-auto-login/PartnerIPAutoLogin.js","components/core/StyledButton.js","components/SimpleDialog/SimpleDialog.js","components/IPLoginErrorDialog/IPLoginErrorDialog.js"],"names":["PartnerIPAutoLogin","makeStyles","theme","createStyles","props","history","useHistory","useMatomo","trackEvent","pushInstruction","userDispatch","useUserDispatch","useState","isLoading","setIsLoading","setIPLoginError","useEffect","getPlatformInfo","then","res","loginIPUser","dispatch","catch","err","console","log","Grid","container","spacing","item","xs","IPLoginErrorDialog","isPartnerPage","defaultProps","propsTypes","useStyles","root","typography","h6","marginRight","h40","height","padding","h28","defaultRoot","borderRadius","tagRoot","paddingLeft","paddingRight","textRoot","active","color","backgroundColor","palette","primary","main","dark","outlineActive","border","borderColor","textActive","inactive","common","grey","StyledButton","classes","variant","className","rest","variantClass","activeClass","heightClass","classNames","disabled","dialogPaper","width","dialogTitle","h4","fontWeight","dialogDescription","smallCaption","dialogButton","caption","Transition","React","forwardRef","ref","Slide","direction","SimpleDialog","open","setOpen","title","content","leftButtonText","rightButtonText","leftButtonOnClick","rightButtonOnClick","handleDialogClose","Dialog","paper","TransitionComponent","keepMounted","onClose","aria-labelledby","aria-describedby","DialogTitle","id","DialogContent","DialogContentText","DialogActions","onClick","IPLoginError","useUserState","platform","invalidIP","IPGroups","notFound","errorMsg","getErrorMsg","errorContent","ip","isEmpty","first","getErrorContent","openDialog","setOpenDialog","real_domain","window","location","href"],"mappings":"uRAYMA,GAFYC,aAAW,SAAAC,GAAK,OAAIC,YAAa,OAExB,SAAAC,GACzB,IAAMC,EAAUC,cADkB,EAEMC,cAAhCC,EAF0B,EAE1BA,WAAYC,EAFc,EAEdA,gBACdC,EAAeC,cAHa,EAIAC,oBAAS,GAJT,mBAI3BC,EAJ2B,KAIhBC,EAJgB,OAKMF,oBAAS,GALf,mBAKbG,GALa,WA0BlC,OAnBAC,qBAAU,WACRF,GAAa,GACbG,cACGC,MAAK,SAAAC,GACJC,YAAY,CACVC,SAAUX,EACVI,eACA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C,GAAiD,IAA/CL,EAA8C,EAA9CA,UAAWC,EAAmC,EAAnCA,SAAUvD,EAAyB,EAAzBA,SAAUwD,EAAe,EAAfA,SAClDI,EAAKC,kBAAQN,GAAY,GAAKO,gBAAMP,GAC1C,OAAID,EACI,yBAAN,OAAiBM,EAAjB,yIACS5D,EACF,GACEwD,EACH,OAAN,OAAcI,QADT,EAUYG,CAAgB,CACnCT,YACAC,WACAvD,WACAwD,aAhCoE,EAkClCzG,oBAAS,GAlCyB,mBAkC/DiH,EAlC+D,KAkCnDC,EAlCmD,KAoCtE9G,qBAAU,WAEN8G,IADER,KAKH,CAACA,IAEJ,IAAMvB,EAAkB/D,GAAiB,qBACnCiE,EAAqBjE,GAvBF,WACnBkF,EAASa,cACXC,OAAOC,SAASC,KAAhB,kBAAkChB,EAASa,eAsB/C,OACE,kBAAC,EAAD,CACErC,KAAMmC,EACNlC,QAASmC,EACTlC,MAAO0B,EACPzB,QAAS2B,EACTzB,gBAAiBA,EACjBE,mBAAoBA,MAK1BlE,EAAmBE,aAAe,GAElCF,EAAmBG,WAAa,GAEjBH","file":"static/js/30.fbcef1f2.chunk.js","sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { makeStyles, createStyles } from \"@material-ui/core/styles\";\nimport { useHistory } from \"react-router-dom\";\nimport { Grid } from \"@material-ui/core\";\nimport IPLoginErrorDialog from \"../../components/IPLoginErrorDialog/IPLoginErrorDialog\";\nimport { useMatomo } from \"@datapunt/matomo-tracker-react\";\nimport { useUserDispatch, loginIPUser } from \"../../context/UserContext\";\nimport { getPlatformInfo } from \"../../clientAPI\";\n\nconst useStyles = makeStyles(theme => createStyles({}));\n\nconst PartnerIPAutoLogin = props => {\n const history = useHistory();\n const { trackEvent, pushInstruction } = useMatomo();\n const userDispatch = useUserDispatch();\n const [isLoading, setIsLoading] = useState(true);\n const [IPLoginError, setIPLoginError] = useState(false);\n\n useEffect(() => {\n setIsLoading(true);\n getPlatformInfo()\n .then(res => {\n loginIPUser({\n dispatch: userDispatch,\n setIsLoading,\n trackEvent,\n pushInstruction,\n setIPLoginError,\n history,\n });\n })\n .catch(err => {\n console.log(err);\n setIsLoading(false);\n });\n }, []);\n\n return (\n \n \n {isLoading ? \"驗證中...\" : \"請重新整理再次進行驗證\"}\n \n \n \n );\n};\n\nPartnerIPAutoLogin.defaultProps = {};\n\nPartnerIPAutoLogin.propsTypes = {};\n\nexport default PartnerIPAutoLogin;\n","import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { makeStyles, createStyles } from \"@material-ui/core/styles\";\nimport classNames from \"classnames\";\n\nimport { Button } from \"@material-ui/core\";\n\nconst useStyles = makeStyles(theme =>\n createStyles({\n root: {\n ...theme.typography.h6,\n marginRight: theme.spacing(1),\n },\n h40: {\n height: 40,\n padding: \"8px 16px\",\n },\n h28: {\n height: 28,\n padding: \"6px 16px\",\n },\n defaultRoot: {\n // padding: \"8px 28px\",\n borderRadius: theme.spacing(2.5),\n // [theme.breakpoints.down(\"sm\")]: {\n // padding: \"8px 16px\",\n // },\n },\n tagRoot: {\n paddingLeft: 14,\n paddingRight: 14,\n borderRadius: theme.spacing(2),\n },\n textRoot: {\n // height:\n },\n active: {\n color: \"white\",\n backgroundColor: theme.palette.primary.main,\n \"&:hover\": {\n backgroundColor: theme.palette.primary.dark,\n color: \"white\",\n },\n },\n outlineActive: {\n color: theme.palette.primary.main,\n border: \"solid 1px\",\n borderColor: theme.palette.primary.main,\n backgroundColor: \"white\",\n \"&:hover\": {\n color: theme.palette.primary.dark,\n borderColor: theme.palette.primary.dark,\n backgroundColor: \"white\",\n },\n },\n textActive: {\n color: theme.palette.primary.main,\n backgroundColor: \"transparent\",\n \"&:hover\": {\n color: theme.palette.primary.main,\n backgroundColor: \"transparent\",\n },\n },\n inactive: {\n color: \"white\",\n backgroundColor: theme.palette.common.grey[300],\n \"&:hover\": {\n color: \"white\",\n backgroundColor: theme.palette.common.grey[300],\n },\n \"&:disabled\": {\n color: \"white\",\n backgroundColor: theme.palette.common.grey[300],\n },\n },\n }),\n);\n\nconst StyledButton = props => {\n const classes = useStyles();\n\n const { variant = \"default\", className, height = 40, ...rest } = props;\n\n const getVaraintClass = () => {\n if (variant === \"tag\") {\n return classes.tagRoot;\n }\n if (variant === \"text\") {\n return classes.textRoot;\n }\n\n return classes.defaultRoot;\n };\n\n const getActiveClass = () => {\n if (variant === \"outline\") {\n return classes.outlineActive;\n }\n\n if (variant === \"inactive\") {\n return classes.inactive;\n }\n\n if (variant === \"text\") {\n return classes.textActive;\n }\n\n return classes.active;\n };\n\n const variantClass = getVaraintClass();\n const activeClass = getActiveClass();\n const heightClass = variant === 'text' ? {} : { [classes.h28]: height === 28, [classes.h40]: height === 40 }\n return (\n \n );\n};\n\nStyledButton.defaultProps = {};\n\nStyledButton.propsTypes = {};\n\nexport default StyledButton;\n","import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { makeStyles, createStyles } from \"@material-ui/core/styles\";\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n Slide,\n} from \"@material-ui/core\";\n// import StyledButton from \"../../StyledButton\";\nimport StyledButton from \"../../components/core/StyledButton\";\n\nconst useStyles = makeStyles(theme =>\n createStyles({\n dialogPaper: {\n width: 400,\n padding: theme.spacing(1),\n },\n dialogTitle: {\n ...theme.typography.h4,\n fontWeight: 500,\n color: theme.palette.grey[800],\n },\n dialogDescription: {\n ...theme.typography.smallCaption,\n },\n dialogButton: {\n ...theme.typography.caption,\n fontWeight: 700,\n },\n }),\n);\n\nconst Transition = React.forwardRef(function Transition (props, ref) {\n return ;\n});\n\nconst SimpleDialog = ({\n open,\n setOpen,\n title,\n content,\n leftButtonText,\n rightButtonText,\n leftButtonOnClick,\n rightButtonOnClick,\n}) => {\n const classes = useStyles();\n\n const handleDialogClose = () => {\n if (setOpen) {\n setOpen(false);\n }\n };\n\n return (\n
\n \n \n
{title || \"\"}
\n
\n \n \n {content || \"\"}\n \n \n \n \n {leftButtonText || \"取消\"}\n \n \n {rightButtonText || \"確定\"}\n \n \n \n
\n );\n};\n\nSimpleDialog.defaultProps = {};\n\nSimpleDialog.propsTypes = {};\n\nexport default SimpleDialog;\n","import React, { useEffect, useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { makeStyles, createStyles } from \"@material-ui/core/styles\";\nimport SimpleDialog from \"../../components/SimpleDialog\";\nimport { useUserState } from \"../../context/UserContext\";\n\nimport { isEmpty, first } from \"lodash\";\n\nconst useStyles = makeStyles(theme => createStyles({}));\n\nconst IPLoginErrorDialog = ({ IPLoginError, isPartnerPage = false }) => {\n const { platform, inactive, invalidIP, IPGroups, notFound } = useUserState();\n\n const getErrorMsg = ({ invalidIP, inactive, notFound }) => {\n if (invalidIP) {\n return \"IP 不符合規定,請聯絡客服\";\n } else if (inactive) {\n return \"帳號已凍結,請聯絡客服\";\n } else if (notFound) {\n return \"平台綁定帳號異常或其他錯誤,請聯絡客服\";\n }\n };\n const getErrorContent = ({ invalidIP, IPGroups, inactive, notFound }) => {\n const ip = isEmpty(IPGroups) ? \"\" : first(IPGroups);\n if (invalidIP) {\n return `若您的 IP ${ip} 符合館內設定,不用輸入帳號密碼即可由此登入。`;\n } else if (inactive) {\n return \"\";\n } else if (notFound) {\n return `IP: ${ip}`;\n }\n };\n const backPlatformHome = () => {\n if (platform.real_domain) {\n window.location.href = `https://${platform.real_domain}`;\n }\n };\n const errorMsg = getErrorMsg({ invalidIP, inactive, notFound });\n const errorContent = getErrorContent({\n invalidIP,\n IPGroups,\n inactive,\n notFound,\n });\n const [openDialog, setOpenDialog] = useState(false);\n\n useEffect(() => {\n if (errorMsg) {\n setOpenDialog(true);\n } else {\n setOpenDialog(false);\n }\n }, [errorMsg]);\n\n const rightButtonText = isPartnerPage && \"回首頁\";\n const rightButtonOnClick = isPartnerPage && backPlatformHome;\n return (\n \n );\n};\n\nIPLoginErrorDialog.defaultProps = {};\n\nIPLoginErrorDialog.propsTypes = {};\n\nexport default IPLoginErrorDialog;\n"],"sourceRoot":""}