{"version":3,"file":"static/chunks/4876-493495e79aa3a09b.js","mappings":"AACA","sources":["webpack://_N_E/./src/components/Coupons/AdditionalCouponContents.tsx","webpack://_N_E/./src/components/Coupons/Coupon.tsx","webpack://_N_E/./src/components/Coupons/SimpleDialog.tsx","webpack://_N_E/./src/utils/formatting.ts","webpack://_N_E/"],"sourcesContent":["import { _ as _tagged_template_literal } from \"@swc/helpers/_/_tagged_template_literal\";\nfunction _templateObject() {\n const data = _tagged_template_literal([\n \"\\n font-size: 16px;\\n font-style: normal;\\n font-weight: 400;\\n line-height: 24px; /* 150% */\\n letter-spacing: -0.16px;\\n color: \",\n \";\\n\"\n ]);\n _templateObject = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject1() {\n const data = _tagged_template_literal([\n \"\\n font-size: 16px;\\n font-style: normal;\\n font-weight: 600;\\n line-height: 24px; /* 150% */\\n letter-spacing: -0.16px;\\n\\n span {\\n color: \",\n \";\\n }\\n\"\n ]);\n _templateObject1 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject2() {\n const data = _tagged_template_literal([\n \"\"\n ]);\n _templateObject2 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject3() {\n const data = _tagged_template_literal([\n \"\\n display: flex;\\n height: 100%;\\n flex-direction: column;\\n gap: 12px;\\n\\n overflow-y: auto;\\n\"\n ]);\n _templateObject3 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject4() {\n const data = _tagged_template_literal([\n \"\\n display: flex;\\n\\n flex-direction: column;\\n gap: 12px;\\n\"\n ]);\n _templateObject4 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject5() {\n const data = _tagged_template_literal([\n \"\\n display: flex;\\n justify-content: flex-end;\\n padding-top: 16px;\\n\\n padding: 16px 28px 28px 28px;\\n background-color: \",\n \";\\n\\n @media (max-width: 768px) {\\n padding: 16px;\\n\\n button {\\n width: 100%;\\n }\\n }\\n\\n button {\\n font-size: 16px;\\n font-style: normal;\\n font-weight: 600;\\n line-height: 24px; /* 150% */\\n letter-spacing: -0.16px;\\n padding: 12px 20px;\\n }\\n\"\n ]);\n _templateObject5 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject6() {\n const data = _tagged_template_literal([\n \"\\n height: 100%;\\n max-height: calc(100vh - 224px);\\n overflow-y: auto;\\n\\n @media (max-width: 768px) {\\n margin-top: 28px;\\n }\\n\"\n ]);\n _templateObject6 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject7() {\n const data = _tagged_template_literal([\n \"\\n display: flex;\\n justify-content: end;\\n align-items: center;\\n margin-top: 28px;\\n\\n @media (max-width: 768px) {\\n button {\\n width: 100%;\\n }\\n }\\n\"\n ]);\n _templateObject7 = function() {\n return data;\n };\n return data;\n}\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { mixpanelEvent } from \"@/lib/mixpanels/mixpanel\";\nimport { numberFormatter } from \"@/lib/utils\";\nimport { Button, ConfirmDialog } from \"@bookips/solvook-ui-library\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { useCallback, useState } from \"react\";\nimport { postUserCoupon } from \"src/api/coupon\";\nimport { formatDateToDot } from \"src/utils/formatting\";\nimport styled from \"styled-components\";\nimport FilledButton from \"../common/Button/FilledButton\";\nimport AnchorDrawer from \"../modal/AnchorDrawer\";\nimport Coupon from \"./Coupon\";\nimport SimpleDialog from \"./SimpleDialog\";\nconst CouponContents = (param)=>{\n let { handoutCoupons } = param;\n //자 여기에서 실행하면 안될것 같지만 일단 기능부터\n const queryClient = useQueryClient();\n const postGetCouponMutation = useMutation(postUserCoupon);\n const [dialogOpen, setDialogOpen] = useState(false);\n const [errorMessage, setErrorMessage] = useState(\"\");\n const onGetCouponClick = useCallback(async (id, name)=>{\n try {\n const response = await postGetCouponMutation.mutateAsync(id);\n queryClient.invalidateQueries([\n \"myCoupons\"\n ]);\n //mx\n mixpanelEvent(\"Coupon Issued\", {\n \"Coupon ID\": id,\n \"Coupon Name\": name\n });\n if (response.status === 404) {\n // Coupon not found\n setDialogOpen(true);\n setErrorMessage(\"쿠폰 정보가 존재하지 않아요.\");\n }\n if (response.status === 409) {\n // Already received\n setDialogOpen(true);\n setErrorMessage(\"이미 발급된 쿠폰이예요.\");\n }\n } catch (error) {\n const { status } = error.response;\n if (status === 404) {\n // Coupon not found\n setDialogOpen(true);\n setErrorMessage(\"쿠폰 정보가 존재하지 않아요.\");\n }\n if (status === 409) {\n // Already received\n setDialogOpen(true);\n setErrorMessage(\"이미 발급된 쿠폰이예요.\");\n }\n }\n }, [\n postGetCouponMutation\n ]);\n return /*#__PURE__*/ _jsxs(CouponContainer, {\n children: [\n errorMessage && /*#__PURE__*/ _jsx(ConfirmDialog, {\n open: dialogOpen,\n severity: \"caution\",\n onClose: ()=>setDialogOpen(false),\n title: errorMessage,\n footer: /*#__PURE__*/ _jsx(ButtonOneBox, {\n children: /*#__PURE__*/ _jsx(Button, {\n label: \"확인\",\n variant: \"solid\",\n onClick: ()=>setDialogOpen(false)\n })\n })\n }),\n /*#__PURE__*/ _jsxs(CouponCount, {\n children: [\n \"상품쿠폰 \",\n /*#__PURE__*/ _jsxs(\"span\", {\n children: [\n handoutCoupons.length,\n \"장\"\n ]\n })\n ]\n }),\n /*#__PURE__*/ _jsx(CouponList, {\n children: handoutCoupons.map((coupon, index)=>{\n /*#__PURE__*/ return _jsxs(Coupon, {\n children: [\n /*#__PURE__*/ _jsxs(Coupon.Content, {\n children: [\n /*#__PURE__*/ _jsxs(\"div\", {\n children: [\n /*#__PURE__*/ _jsx(Coupon.Title, {\n children: coupon.name\n }),\n /*#__PURE__*/ _jsx(Coupon.MaxDiscount, {\n children: \"최대 \".concat(numberFormatter(coupon.discountMaximumPrice), \"원 할인\")\n }),\n (coupon === null || coupon === void 0 ? void 0 : coupon.minimumPrice) && /*#__PURE__*/ _jsxs(Coupon.Condition, {\n children: [\n numberFormatter(coupon.minimumPrice),\n \"원 이상 자료에 사용가능\"\n ]\n })\n ]\n }),\n /*#__PURE__*/ _jsx(Coupon.ExpireDate, {\n children: coupon.expiredAfterDay ? \"받기 후 \".concat(coupon.expiredAfterDay, \"일간 사용 가능\") : coupon.expiredAt && formatDateToDot(coupon.expiredAt) + \"까지\"\n })\n ]\n }),\n /*#__PURE__*/ _jsx(Coupon.Possession, {\n status: coupon.hasBeenReceived,\n onHandleClick: ()=>{\n if (coupon.hasBeenReceived === false) onGetCouponClick(coupon.id, coupon.name);\n }\n })\n ]\n }, index);\n })\n })\n ]\n });\n};\nexport const AdditionalCouponDialog = (param)=>{\n let { open , handleClose , handoutCoupons } = param;\n return /*#__PURE__*/ _jsx(SimpleDialog, {\n open: open,\n onClose: ()=>handleClose(),\n title: \"할인쿠폰 받기\",\n subParagraph: \"해당 상품에 적용가능한 쿠폰만 표시돼요.\",\n scroll: \"paper\",\n footer: /*#__PURE__*/ _jsx(ButtonBox, {\n children: /*#__PURE__*/ _jsx(FilledButton, {\n type: \"text\",\n variant: \"solid\",\n onClick: ()=>handleClose(),\n children: \"확인\"\n })\n }),\n children: /*#__PURE__*/ _jsx(DialogContents, {\n children: /*#__PURE__*/ _jsx(CouponContents, {\n handoutCoupons: handoutCoupons\n })\n })\n });\n};\nexport const AdditionalCouponDrawer = (param)=>{\n let { open , anchor , handleClose , handoutCoupons } = param;\n return /*#__PURE__*/ _jsxs(AnchorDrawer, {\n anchor: anchor !== null && anchor !== void 0 ? anchor : \"bottom\",\n open: open,\n onClose: ()=>handleClose(),\n title: \"할인쿠폰 받기\",\n children: [\n /*#__PURE__*/ _jsxs(AnchorDrawer.Contents, {\n children: [\n /*#__PURE__*/ _jsx(AnchorDrawer.Title, {\n children: \"할인쿠폰 받기\"\n }),\n /*#__PURE__*/ _jsx(ExplainText, {\n children: \"해당 상품에 적용가능한 쿠폰만 표시돼요.\"\n }),\n /*#__PURE__*/ _jsx(ScrollBody, {\n children: /*#__PURE__*/ _jsx(CouponContents, {\n handoutCoupons: handoutCoupons\n })\n })\n ]\n }),\n /*#__PURE__*/ _jsx(ButtonBox, {\n children: /*#__PURE__*/ _jsx(FilledButton, {\n type: \"text\",\n variant: \"solid\",\n onClick: ()=>handleClose(),\n children: \"확인\"\n })\n })\n ]\n });\n};\nexport const ExplainText = styled.p.withConfig({\n componentId: \"sc-45151d37-0\"\n})(_templateObject(), (props)=>props.theme.new.colors.sol_gray_700);\nconst CouponCount = styled.p.withConfig({\n componentId: \"sc-45151d37-1\"\n})(_templateObject1(), (props)=>props.theme.new.colors.sol_blue_500);\nconst DialogContents = styled.div.withConfig({\n componentId: \"sc-45151d37-2\"\n})(_templateObject2());\nconst CouponContainer = styled.div.withConfig({\n componentId: \"sc-45151d37-3\"\n})(_templateObject3());\nconst CouponList = styled.ul.withConfig({\n componentId: \"sc-45151d37-4\"\n})(_templateObject4());\nconst ButtonBox = styled.div.withConfig({\n componentId: \"sc-45151d37-5\"\n})(_templateObject5(), (props)=>props.theme.new.colors.sol_dim_white_90);\nexport const ScrollBody = styled.div.withConfig({\n componentId: \"sc-45151d37-6\"\n})(_templateObject6());\nconst ButtonOneBox = styled.div.withConfig({\n componentId: \"sc-45151d37-7\"\n})(_templateObject7());\n","import { _ as _tagged_template_literal } from \"@swc/helpers/_/_tagged_template_literal\";\nfunction _templateObject() {\n const data = _tagged_template_literal([\n \"\\n display: flex;\\n height: 142px;\\n gap: 8px;\\n justify-content: space-between;\\n\"\n ]);\n _templateObject = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject1() {\n const data = _tagged_template_literal([\n \"\\n width: 100%;\\n display: flex;\\n flex-direction: column;\\n justify-content: space-between;\\n flex: 1;\\n padding: 16px;\\n border-radius: 6px;\\n border: 1px solid \",\n \";\\n background-color: \",\n \";\\n\"\n ]);\n _templateObject1 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject2() {\n const data = _tagged_template_literal([\n \"\\n font-size: 16px;\\n font-style: normal;\\n font-weight: 600;\\n line-height: 24px;\\n letter-spacing: -0.16px;\\n margin-bottom: 4px;\\n color: \",\n \";\\n text-overflow: ellipsis;\\n overflow: hidden;\\n display: -webkit-box;\\n -webkit-line-clamp: 1;\\n -webkit-box-orient: vertical;\\n word-break: break-all;\\n\"\n ]);\n _templateObject2 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject3() {\n const data = _tagged_template_literal([\n \"\\n font-size: 14px;\\n font-style: normal;\\n font-weight: 400;\\n line-height: 22px; /* 157.143% */\\n letter-spacing: -0.14px;\\n color: \",\n \";\\n\"\n ]);\n _templateObject3 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject4() {\n const data = _tagged_template_literal([\n \"\\n font-size: 14px;\\n font-style: normal;\\n font-weight: 400;\\n line-height: 22px; /* 157.143% */\\n letter-spacing: -0.14px;\\n color: \",\n \";\\n\"\n ]);\n _templateObject4 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject5() {\n const data = _tagged_template_literal([\n \"\\n font-size: 14px;\\n font-style: normal;\\n font-weight: 400;\\n line-height: 22px; /* 157.143% */\\n letter-spacing: -0.14px;\\n color: \",\n \";\\n\"\n ]);\n _templateObject5 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject6() {\n const data = _tagged_template_literal([\n \"\\n display: flex;\\n width: 64px;\\n align-items: center;\\n\\n /* flex-shrink: 0; */\\n /* padding: 0 11px; */\\n justify-content: center;\\n border-radius: 6px;\\n background-color: \",\n \";\\n\\n :hover {\\n cursor: pointer;\\n background-color: \",\n \";\\n }\\n\\n &.status-isMine {\\n background-color: \",\n \";\\n\\n p {\\n color: \",\n \";\\n }\\n\\n :hover {\\n cursor: default;\\n }\\n }\\n\"\n ]);\n _templateObject6 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject7() {\n const data = _tagged_template_literal([\n \"\\n display: flex;\\n flex-direction: column;\\n align-items: center;\\n\"\n ]);\n _templateObject7 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject8() {\n const data = _tagged_template_literal([\n \"\\n font-size: 16px;\\n font-style: normal;\\n font-weight: 600;\\n line-height: 24px; /* 150% */\\n letter-spacing: -0.16px;\\n\\n color: \",\n \";\\n\"\n ]);\n _templateObject8 = function() {\n return data;\n };\n return data;\n}\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport styled from \"styled-components\";\nimport Icon from \"../icon/Icon\";\nimport { Check_Thin, CouponDownload } from \"../icon/IconList\";\nconst Coupon = (param)=>{\n let { children } = param;\n return /*#__PURE__*/ _jsx(CouponBox, {\n role: \"listitem\",\n children: children\n });\n};\nconst Content = (param)=>{\n let { children } = param;\n return /*#__PURE__*/ _jsx(CouponContents, {\n children: children\n });\n};\nconst CouponTitle = (param)=>{\n let { children } = param;\n return /*#__PURE__*/ _jsx(CouponTitleText, {\n children: children\n });\n};\nconst CouponMaxDiscount = (param)=>{\n let { children } = param;\n return /*#__PURE__*/ _jsx(MaxDiscountText, {\n children: children\n });\n};\nconst CouponCondition = (param)=>{\n let { children } = param;\n return /*#__PURE__*/ _jsx(ConditionText, {\n children: children\n });\n};\nconst ExpireDate = (param)=>{\n let { children } = param;\n return /*#__PURE__*/ _jsx(ExpireDateText, {\n children: children\n });\n};\nconst Possession = (param)=>{\n let { status , onHandleClick } = param;\n return /*#__PURE__*/ _jsx(IsOwnedStateArea, {\n role: \"button\",\n className: status ? \"status-isMine\" : \"\",\n onClick: onHandleClick,\n children: status ? /*#__PURE__*/ _jsxs(StateIcon, {\n children: [\n /*#__PURE__*/ _jsx(Icon, {\n icon: Check_Thin,\n color: \"#A9AFC7\"\n }),\n /*#__PURE__*/ _jsx(IconWithText, {\n children: \"보유중\"\n })\n ]\n }) : /*#__PURE__*/ _jsxs(StateIcon, {\n children: [\n /*#__PURE__*/ _jsx(Icon, {\n icon: CouponDownload,\n color: \"#513CBA\"\n }),\n /*#__PURE__*/ _jsx(IconWithText, {\n children: \"받기\"\n })\n ]\n })\n });\n};\nCoupon.Content = Content;\nCoupon.Title = CouponTitle;\nCoupon.MaxDiscount = CouponMaxDiscount;\nCoupon.Condition = CouponCondition;\nCoupon.ExpireDate = ExpireDate;\nCoupon.Possession = Possession;\nconst CouponBox = styled.div.withConfig({\n componentId: \"sc-b21a8b79-0\"\n})(_templateObject());\nconst CouponContents = styled.div.withConfig({\n componentId: \"sc-b21a8b79-1\"\n})(_templateObject1(), (props)=>props.theme.new.colors.sol_gray_100, (props)=>props.theme.new.colors.white);\nconst CouponTitleText = styled.p.withConfig({\n componentId: \"sc-b21a8b79-2\"\n})(_templateObject2(), (props)=>props.theme.new.colors.sol_gray_900);\nconst MaxDiscountText = styled.p.withConfig({\n componentId: \"sc-b21a8b79-3\"\n})(_templateObject3(), (props)=>props.theme.new.colors.sol_red_400);\nconst ConditionText = styled.p.withConfig({\n componentId: \"sc-b21a8b79-4\"\n})(_templateObject4(), (props)=>props.theme.new.colors.sol_gray_500);\nconst ExpireDateText = styled.p.withConfig({\n componentId: \"sc-b21a8b79-5\"\n})(_templateObject5(), (props)=>props.theme.new.colors.sol_gray_300);\nconst IsOwnedStateArea = styled.div.withConfig({\n componentId: \"sc-b21a8b79-6\"\n})(_templateObject6(), (props)=>props.theme.new.colors.sol_indigo_100, (props)=>props.theme.new.colors.sol_indigo_200, (props)=>props.theme.new.colors.sol_gray_50, (props)=>props.theme.new.colors.sol_gray_300);\nconst StateIcon = styled.div.withConfig({\n componentId: \"sc-b21a8b79-7\"\n})(_templateObject7());\nconst IconWithText = styled.p.withConfig({\n componentId: \"sc-b21a8b79-8\"\n})(_templateObject8(), (props)=>props.theme.new.colors.sol_indigo_600);\nexport default Coupon;\n","import { _ as _tagged_template_literal } from \"@swc/helpers/_/_tagged_template_literal\";\nfunction _templateObject() {\n const data = _tagged_template_literal([\n \"\\n .MuiDialogContent-root {\\n padding: 0 28px;\\n }\\n\\n .MuiPaper-root {\\n width: 520px;\\n\\n max-height: calc(100vh - 144px);\\n margin: 72px 0;\\n border-radius: 12px;\\n @media (max-width: 768px) {\\n padding: 20px !important;\\n }\\n }\\n\\n .MuiDialogActions-root {\\n padding: 0;\\n background-color: \",\n \";\\n }\\n\"\n ]);\n _templateObject = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject1() {\n const data = _tagged_template_literal([\n \"\\n height: 100%;\\n\"\n ]);\n _templateObject1 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject2() {\n const data = _tagged_template_literal([\n \"\\n font-size: 16px;\\n font-style: normal;\\n font-weight: 400;\\n line-height: 24px; /* 150% */\\n letter-spacing: -0.16px;\\n color: \",\n \";\\n\"\n ]);\n _templateObject2 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject3() {\n const data = _tagged_template_literal([\n \"\\n display: flex;\\n justify-content: space-between;\\n font-size: 20px;\\n font-style: normal;\\n font-weight: 700;\\n line-height: 30px; /* 150% */\\n color: \",\n \";\\n\\n margin-bottom: 8px;\\n\"\n ]);\n _templateObject3 = function() {\n return data;\n };\n return data;\n}\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Dialog, DialogActions, DialogContent, DialogTitle, IconButton } from \"@mui/material\";\nimport React from \"react\";\nimport styled from \"styled-components\";\nimport Icon from \"../icon/Icon\";\nimport { Close, Sizes } from \"../icon/IconList\";\nconst SimpleDialog = (param)=>{\n let { open , onClose , children , footer , scroll , subParagraph , title , ...props } = param;\n return /*#__PURE__*/ _jsxs(DialogContainer, {\n open: open,\n onClose: onClose,\n scroll: scroll,\n ...props,\n sx: {\n h2: {\n padding: \"28px\"\n }\n },\n children: [\n /*#__PURE__*/ _jsxs(DialogTitle, {\n id: \"scroll-dialog-title\",\n children: [\n /*#__PURE__*/ _jsxs(DialogHeader, {\n children: [\n title,\n /*#__PURE__*/ _jsx(IconButton, {\n \"aria-label\": \"close\",\n onClick: (e)=>onClose(e, \"backdropClick\"),\n sx: (theme)=>({\n height: \"fit-contents\",\n padding: \"4px\",\n \":hover\": {\n background: \"none\"\n }\n }),\n children: /*#__PURE__*/ _jsx(Icon, {\n icon: Close,\n size: Sizes.medium\n })\n })\n ]\n }),\n // subParagraph이 string일 경우에만 ExplainText로 감싸줌\n // subParagraph이 ReactNode일 경우에는 그대로 렌더링\n typeof subParagraph === \"string\" ? /*#__PURE__*/ _jsx(ExplainText, {\n children: subParagraph\n }) : subParagraph\n ]\n }),\n /*#__PURE__*/ _jsx(DialogContent, {\n children: /*#__PURE__*/ _jsx(ContentBox, {\n children: children\n })\n }),\n /*#__PURE__*/ _jsx(DialogActions, {\n children: footer\n })\n ]\n });\n};\nconst Title = (param)=>{\n let { children } = param;\n return /*#__PURE__*/ _jsx(DialogHeader, {\n children: children\n });\n};\nSimpleDialog.Title = Title;\nconst DialogContainer = styled(Dialog).withConfig({\n componentId: \"sc-6eacd2c1-0\"\n})(_templateObject(), (props)=>props.theme.new.colors.sol_dim_white_90);\nconst ContentBox = styled.section.withConfig({\n componentId: \"sc-6eacd2c1-1\"\n})(_templateObject1());\nconst ExplainText = styled.p.withConfig({\n componentId: \"sc-6eacd2c1-2\"\n})(_templateObject2(), (props)=>props.theme.new.colors.sol_gray_700);\nconst DialogHeader = styled.div.withConfig({\n componentId: \"sc-6eacd2c1-3\"\n})(_templateObject3(), (props)=>props.theme.new.colors.sol_gray_900);\nexport default SimpleDialog;\n","export function formatDateToDashed(d) {\n return d.split(\"T\")[0];\n}\nexport function formatDateToDot(d) {\n return d.split(\"T\")[0].split(\"-\").join(\".\");\n}\nexport function formatDateToDashedYYYYMMDDHHMM(d) {\n return d.split(\"T\")[0] + \" \" + d.split(\"T\")[1].split(\".\")[0].slice(0, 5);\n}\n"],"names":[],"sourceRoot":""}