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AGA,GACI7I,IAAmB4B,EAAAA,GAA0BgD,uBAC7CtE,EACF,CACE,MAAMgE,GAAe7C,EAAAA,EAAAA,IAAad,GAC5BO,GAAa2D,EAAAA,EAAAA,GACflE,EACAL,GAEEQ,EAAWS,MAAQqH,QAAQrH,IAAM+C,IAEvC,MAAO,CAAEA,eAAcpD,aAAYF,WADhBO,MAAQqH,QAAQrH,IAAML,IACMJ,WAAU+H,uBAAuB,EACpF,CAEA,MAAO,CAAE/H,UAAU,EAAME,YAAY,EAAO6H,uBAAuB,EACvE,CAEO,MAAMrG,EAAoB,CAC7BQ,SAAU,WACVP,kBAAmB,oBACnBQ,QAAS,U,8EC7DE,SAAS0B,EAA2BmE,EAAeC,GAC9D,MAAMC,GAAevH,EAAAA,EAAAA,IAAaqH,GAQlC,OAPmBvH,IAAMyH,GACpBC,IAAIF,EAAY,OAChBG,KAAK,IACLC,OAAO,IACPC,OAAO,IACPC,YAAY,KACZC,SAET,CAEO,SAASzE,EAAgCiE,EAAeS,GAE3D,MAAMP,GAAevH,EAAAA,EAAAA,IAAaqH,GASlC,OARmBvH,IAAMyH,GACpBC,IAAIM,EAAc,SAClBL,KAAK,IACLC,OAAO,IACPC,OAAO,IACPC,YAAY,KACZG,MAAM,SACNF,SAET,C","sources":["client/components/Result/prizeList/sortPrizeList.js","client/components/Result/prizeList/PrizeRedeemStatusLabel.js","client/components/Result/prizeList/PrizeRedeemDeadline.js","client/components/Result/prizeList/PrizeListItem.js","client/components/Result/prizeList/PrizeList.js","client/components/Result/prizeList/ScrollerFixedHeader.js","client/components/Result/prizeList/getPrizeRedeemStatus.js","client/utils/getPrizeRedeemWithinEndUtc.js"],"sourcesContent":["import dayjs from 'dayjs';\n\nimport { utcDTStr2UTC } from 'utils/dateTime';\nimport { prizeRedeemDateLimitTypes } from 'config/promoPrizeTypes';\nimport {\n getPrizeRedeemExpiredInfo,\n prizeStatusLabels\n} from 'client/components/Result/prizeList/getPrizeRedeemStatus';\n\nexport default function sortPrizes(items = []) {\n const categories = categorizePrize(items);\n return sortAllCategoriesAndMerge(categories);\n}\n\nfunction categorizePrize(items) {\n const categories = items.reduce(\n (obj, item) => {\n const {\n prizeSettings: {\n redeemTimeType,\n fillFormEndDate,\n redeemStartDate,\n redeemEndDate,\n redeemWithinDays,\n redeemWithinDateTime,\n redeemWithinMonthsLastDay,\n formId\n } = {},\n winnerStatus: { formAwardee, redeemed } = {},\n winnerCreatedAt\n } = item;\n const hasNotFillForm = Boolean(formId) && !formAwardee;\n const {\n hasStart: hasRedeemStart,\n hasExpired: hasRedeemExpired,\n endDateUtc: redeemEndDateUTC\n } = getPrizeRedeemExpiredInfo({\n redeemTimeType,\n redeemStartDate,\n redeemEndDate,\n redeemWithinDays,\n redeemWithinDateTime,\n redeemWithinMonthsLastDay,\n winnerCreatedAt\n });\n\n if (redeemed) {\n obj.redeemed.push(item);\n } else if (hasRedeemExpired) {\n obj.expired.push(item);\n } else if (hasNotFillForm) {\n if (!fillFormEndDate) {\n obj.notFillForm.push(item);\n } else {\n const hasFillFormDateAvailable = dayjs().isBefore(\n dayjs(utcDTStr2UTC(fillFormEndDate))\n );\n if (hasFillFormDateAvailable) {\n obj.notFillFormWithDateLimit.push(item);\n } else {\n obj.expired.push(item);\n }\n }\n } else if (redeemTimeType === prizeRedeemDateLimitTypes.NO_LIMIT) {\n obj.general.push(item);\n } else {\n const newItem = {\n ...item,\n redeemEndDateUTC\n };\n if (!hasRedeemStart) {\n obj.redeemableWithDateLimitHasNotStart.push(newItem);\n } else {\n obj.redeemableWithDateLimit.push(newItem);\n }\n }\n return obj;\n },\n {\n notFillFormWithDateLimit: [],\n notFillForm: [],\n redeemableWithDateLimit: [],\n redeemableWithDateLimitHasNotStart: [],\n general: [],\n redeemed: [],\n expired: []\n }\n );\n return categories;\n}\nfunction sortAllCategoriesAndMerge({\n notFillFormWithDateLimit = [],\n notFillForm = [],\n redeemableWithDateLimit = [],\n redeemableWithDateLimitHasNotStart = [],\n general = [],\n redeemed = [],\n expired = []\n} = {}) {\n notFillFormWithDateLimit = notFillFormWithDateLimit.map(item => ({\n ...item,\n statusLabel: prizeStatusLabels.HAS_NOT_FILL_FORM\n }));\n notFillFormWithDateLimit.sort((a, b) => {\n const aEndDate = a.prizeSettings.fillFormEndDate;\n const bEndDate = b.prizeSettings.fillFormEndDate;\n if (aEndDate === bEndDate) {\n return b.entryId - a.entryId;\n } else {\n return aEndDate < bEndDate ? -1 : 1;\n }\n });\n notFillForm = notFillForm.map(item => ({\n ...item,\n statusLabel: prizeStatusLabels.HAS_NOT_FILL_FORM\n }));\n notFillForm.sort((a, b) => b.entryId - a.entryId);\n redeemableWithDateLimit.sort((a, b) => a.redeemEndDateUTC - b.redeemEndDateUTC);\n redeemableWithDateLimitHasNotStart.sort((a, b) => a.redeemEndDateUTC - b.redeemEndDateUTC);\n general.sort((a, b) => b.entryId - a.entryId);\n redeemed = redeemed.map(item => ({\n ...item,\n statusLabel: prizeStatusLabels.REDEEMED\n }));\n redeemed.sort((a, b) => b.entryId - a.entryId);\n expired = expired.map(item => ({\n ...item,\n statusLabel: prizeStatusLabels.EXPIRED\n }));\n expired.sort((a, b) => b.entryId - a.entryId);\n\n return [\n ...notFillFormWithDateLimit,\n ...notFillForm,\n ...redeemableWithDateLimit,\n ...redeemableWithDateLimitHasNotStart,\n ...general,\n ...redeemed,\n ...expired\n ];\n}\n","import React from 'react';\nimport i18n from 'i18next';\nimport { css } from '@emotion/core';\n\nimport { error, system400 } from 'Mui/styles/color';\nimport { prizeStatusLabels } from 'client/components/Result/prizeList/getPrizeRedeemStatus';\n\nfunction PrizeRedeemStatusLabel({ status }) {\n switch (status) {\n case prizeStatusLabels.EXPIRED:\n return {i18n.t('label.redeem_expired')};\n case prizeStatusLabels.HAS_NOT_FILL_FORM:\n return {i18n.t('label.not_fill_form')};\n case prizeStatusLabels.REDEEMED:\n return {i18n.t('label.prize_redeemed')};\n default:\n return null;\n }\n}\n\nexport default PrizeRedeemStatusLabel;\n\nconst labelStyle = css`\n font-size: 12px;\n font-weight: 500;\n background-color: ${system400.color};\n color: #fff;\n border-radius: 4px;\n z-index: 2;\n position: absolute;\n right: 8px;\n bottom: 6px;\n padding: 4px 6px;\n`;\n\nconst alertColorStyle = css`\n background-color: ${error.color};\n`;\n","import React from 'react';\nimport i18n from 'i18next';\nimport dayjs from 'dayjs';\nimport { css } from '@emotion/core';\nimport Typography from '@material-ui/core/Typography';\n\nimport { utcDTStr2UTC, utcDTStr2LocalDTStr } from 'utils/dateTime';\nimport { error } from 'Mui/styles/color';\nimport { prizeRedeemDateLimitTypes } from 'config/promoPrizeTypes';\nimport getPrizeRedeemWithinEndUtc, {\n getPrizeRedeemWithinMonthEndUtc\n} from 'client/utils/getPrizeRedeemWithinEndUtc';\n\nfunction PrizeRedeemDeadline({\n style,\n hasEnableRedeemForm,\n hasFillRedeemForm,\n fillFormEndDate,\n redeemTimeType,\n redeemStartDate,\n redeemEndDate,\n redeemWithinDateTime,\n redeemWithinMonthsLastDay,\n winnerCreatedAt,\n redeemWithinDays\n}) {\n if (hasEnableRedeemForm && !hasFillRedeemForm) {\n return !fillFormEndDate ? null : (\n \n {i18n.t('label.fill_date_deadline')}\n {utcDTStr2LocalDTStr(fillFormEndDate, 'YYYY-MM-DD HH:mm')}\n \n );\n }\n if (redeemTimeType === prizeRedeemDateLimitTypes.RANGE && redeemStartDate && redeemEndDate) {\n // 指定時間區段\n const startDateUtc = utcDTStr2UTC(redeemStartDate);\n const endDateUtc = utcDTStr2UTC(redeemEndDate);\n const hasNotStartRedeem = dayjs().isBefore(dayjs(startDateUtc));\n\n return (\n \n {i18n.t('label.redeem_date')}\n {hasNotStartRedeem ? (\n \n {i18n.t('label.redeem_date.has_not_start')}\n \n ) : (\n dayjs(endDateUtc).format('YYYY-MM-DD HH:mm')\n )}\n \n );\n }\n if (redeemTimeType === prizeRedeemDateLimitTypes.WITHIN && redeemWithinDays) {\n // 配獎後幾天到期\n const startDateUtc = utcDTStr2UTC(winnerCreatedAt);\n const endDateUtc = getPrizeRedeemWithinEndUtc(winnerCreatedAt, redeemWithinDays);\n const hasNotStartRedeem = dayjs().isBefore(dayjs(startDateUtc));\n\n return (\n \n {i18n.t('label.redeem_date')}\n {hasNotStartRedeem ? (\n \n {i18n.t('label.redeem_date.has_not_start')}\n \n ) : (\n dayjs(endDateUtc).format('YYYY-MM-DD HH:mm')\n )}\n \n );\n }\n\n if (\n redeemTimeType === prizeRedeemDateLimitTypes.WITHIN_MONTH_LAST_DAY &&\n redeemWithinMonthsLastDay\n ) {\n // 配獎後月底到期\n const startDateUtc = utcDTStr2UTC(winnerCreatedAt);\n const endDateUtc = getPrizeRedeemWithinMonthEndUtc(\n winnerCreatedAt,\n redeemWithinMonthsLastDay\n );\n const hasNotStartRedeem = dayjs().isBefore(dayjs(startDateUtc));\n\n return (\n \n {i18n.t('label.redeem_date')}\n {hasNotStartRedeem ? (\n \n {i18n.t('label.redeem_date.has_not_start')}\n \n ) : (\n dayjs(endDateUtc).format('YYYY-MM-DD HH:mm')\n )}\n \n );\n }\n\n if (redeemTimeType === prizeRedeemDateLimitTypes.FIXED_EXPIRATION && redeemWithinDateTime) {\n // 固定到期日\n const startDateUtc = utcDTStr2UTC(winnerCreatedAt);\n const endDateUtc = utcDTStr2UTC(redeemWithinDateTime);\n const hasNotStartRedeem = dayjs().isBefore(dayjs(startDateUtc));\n\n return (\n \n {i18n.t('label.redeem_date')}\n {hasNotStartRedeem ? (\n \n {i18n.t('label.redeem_date.has_not_start')}\n \n ) : (\n dayjs(endDateUtc).format('YYYY-MM-DD HH:mm')\n )}\n \n );\n }\n return null;\n}\n\nexport default PrizeRedeemDeadline;\n","import React from 'react';\nimport { css } from '@emotion/core';\nimport i18n from 'i18next';\nimport Typography from '@material-ui/core/Typography';\n\nimport { shadowDarkStyle } from 'client/styles/common';\nimport { prizeStatusLabels } from 'client/components/Result/prizeList/getPrizeRedeemStatus';\nimport PrizeRedeemStatusLabel from 'client/components/Result/prizeList/PrizeRedeemStatusLabel';\nimport PrizeRedeemDeadline from 'client/components/Result/prizeList/PrizeRedeemDeadline';\n\nfunction PrizeListItem({\n onClick = () => {},\n statusLabel,\n prize = {},\n prizeSettings = {},\n winnerStatus = {},\n promoInfo = {},\n showPromoInfo = false\n}) {\n const { name: prizeName } = prize;\n const {\n imageUrl,\n redeemTimeType,\n fillFormEndDate,\n redeemStartDate,\n redeemEndDate,\n redeemWithinDays,\n redeemWithinDateTime, // 固定到期日\n redeemWithinMonthsLastDay, //配獎後幾個月底\n formId\n } = prizeSettings;\n const { name: promoName } = promoInfo;\n const { formAwardee, winnerCreatedAt, entryId: serialNo } = winnerStatus;\n const shouldCoverMask =\n Boolean(statusLabel) && statusLabel !== prizeStatusLabels.HAS_NOT_FILL_FORM;\n\n return (\n
\n {Boolean(imageUrl) && (\n
\n {prizeName}\n
\n )}\n
\n
\n \n {prizeName}\n \n \n {showPromoInfo && (\n \n {i18n.t('label.promo_name')}\n {promoName}\n \n )}\n \n {i18n.t('label.serial_number')}\n {serialNo}\n \n
\n \n
\n
\n );\n}\n\nexport default PrizeListItem;\n\nconst wrapperStyle = css`\n height: 120px;\n margin-bottom: 8px;\n cursor: pointer;\n border-radius: 8px;\n display: flex;\n overflow: hidden;\n position: relative;\n ${shadowDarkStyle}\n`;\n\nconst imgStyle = css`\n height: 120px;\n min-width: 120px;\n max-width: 120px;\n overflow: hidden;\n position: relative;\n > img {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n max-width: 100%;\n max-height: 100%;\n }\n`;\n\nconst overflowEllipsis = `\n display: block; /* Fallback for non-webkit */\n display: -webkit-box;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n`;\n\nconst titleStyle = css`\n -webkit-line-clamp: 2;\n line-height: 1.15;\n`;\n\nconst infoWrapperStyle = css`\n flex: 1 1 auto;\n display: flex;\n align-items: center;\n position: relative;\n`;\n\nconst infoStyle = css`\n padding: 6px 8px;\n width: 100%;\n & > [class^='MuiTypography'] {\n margin-bottom: 2px;\n }\n & > [class^='MuiTypography']:last-child {\n margin-bottom: 0;\n }\n`;\n\nconst maskStyle = css`\n &:after {\n content: ' ';\n position: absolute;\n z-index: 1;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border-radius: inherit;\n background-color: rgba(255, 255, 255, 0.8);\n }\n`;\n","import React, { useMemo } from 'react';\n\nimport sortPrizeListAndGetPrizeStatus from 'client/components/Result/prizeList/sortPrizeList';\nimport PrizeListItem from 'client/components/Result/prizeList/PrizeListItem';\n\nexport default function PrizeList({ onClick, items = [], showPromoInfo }) {\n const sortedPrizes = useMemo(() => sortPrizeListAndGetPrizeStatus(items), [items]);\n\n return sortedPrizes.map((item = {}) => {\n const {\n statusLabel,\n prize,\n prizeSettings,\n promotion,\n entryId,\n entryUuid,\n winnerStatus,\n winnerCreatedAt\n } = item;\n return (\n onClick(e, item)}\n statusLabel={statusLabel}\n showPromoInfo={showPromoInfo}\n />\n );\n });\n}\n","import React, { useState, useEffect } from 'react';\nimport { css } from '@emotion/core';\nimport IconButton from '@material-ui/core/IconButton';\nimport CloseIcon from '@material-ui/icons/Close';\nimport Typography from '@material-ui/core/Typography';\n\nimport { shadowLightStyle } from 'client/styles/common';\n\nfunction ScrollerFixedHeader({ onClose, title }) {\n const [active, setActive] = useState(false);\n const [ref, setRef] = useState(null);\n const shouldShowCloseBtn = typeof onClose === 'function';\n\n useEffect(() => {\n if (ref !== null) {\n const options = {\n root: null,\n rootMargin: '0px',\n threshhold: 0\n };\n const handleScroll = entries => {\n for (let entry of entries) {\n const spotIsVisible = entry.isIntersecting;\n if (spotIsVisible) {\n setActive(false);\n } else {\n setActive(true);\n }\n }\n };\n const observer = new window.IntersectionObserver(handleScroll, options);\n observer.observe(ref);\n return () => observer.unobserve(ref);\n }\n }, [ref]);\n\n return (\n <>\n
\n \n {title}\n {shouldShowCloseBtn && (\n \n \n \n )}\n
\n \n );\n}\n\nexport default ScrollerFixedHeader;\n\nconst headerStyle = css`\n padding: 16px;\n margin-bottom: 1px;\n display: flex;\n justify-content: center;\n align-items: center;\n position: sticky;\n top: 0;\n background: #fff;\n z-index: 3;\n`;\n","import dayjs from 'dayjs';\n\nimport { utcDTStr2UTC } from 'utils/dateTime';\nimport { prizeRedeemDateLimitTypes } from 'config/promoPrizeTypes';\nimport getPrizeRedeemWithinEndUtc, {\n getPrizeRedeemWithinMonthEndUtc\n} from 'client/utils/getPrizeRedeemWithinEndUtc';\n\nexport function getPrizeRedeemExpiredInfo({\n redeemTimeType,\n redeemStartDate,\n redeemEndDate,\n redeemWithinDays,\n redeemWithinDateTime,\n redeemWithinMonthsLastDay,\n winnerCreatedAt\n}) {\n // 時間區間\n if (redeemTimeType === prizeRedeemDateLimitTypes.RANGE && redeemStartDate && redeemEndDate) {\n const startDateUtc = utcDTStr2UTC(redeemStartDate);\n const endDateUtc = utcDTStr2UTC(redeemEndDate);\n const hasStart = dayjs().isAfter(dayjs(startDateUtc));\n const hasExpired = dayjs().isAfter(dayjs(endDateUtc));\n return { startDateUtc, endDateUtc, hasExpired, hasStart, hasSetRedeemDateLimit: true };\n }\n\n // 配獎後 N 天內\n if (redeemTimeType === prizeRedeemDateLimitTypes.WITHIN && redeemWithinDays !== undefined) {\n const startDateUtc = utcDTStr2UTC(winnerCreatedAt);\n const endDateUtc = getPrizeRedeemWithinEndUtc(winnerCreatedAt, redeemWithinDays);\n const hasStart = dayjs().isAfter(dayjs(startDateUtc));\n const hasExpired = dayjs().isAfter(dayjs(endDateUtc));\n return { startDateUtc, endDateUtc, hasExpired, hasStart, hasSetRedeemDateLimit: true };\n }\n\n // 固定到期日\n if (redeemTimeType === prizeRedeemDateLimitTypes.FIXED_EXPIRATION && redeemWithinDateTime) {\n const startDateUtc = utcDTStr2UTC(winnerCreatedAt);\n const endDateUtc = utcDTStr2UTC(redeemWithinDateTime);\n const hasStart = dayjs().isAfter(dayjs(startDateUtc));\n const hasExpired = dayjs().isAfter(dayjs(endDateUtc));\n return { startDateUtc, endDateUtc, hasExpired, hasStart, hasSetRedeemDateLimit: true };\n }\n\n // 配獎後 N 月後月底\n if (\n redeemTimeType === prizeRedeemDateLimitTypes.WITHIN_MONTH_LAST_DAY &&\n redeemWithinMonthsLastDay\n ) {\n const startDateUtc = utcDTStr2UTC(winnerCreatedAt);\n const endDateUtc = getPrizeRedeemWithinMonthEndUtc(\n winnerCreatedAt,\n redeemWithinMonthsLastDay\n );\n const hasStart = dayjs().isAfter(dayjs(startDateUtc));\n const hasExpired = dayjs().isAfter(dayjs(endDateUtc));\n return { startDateUtc, endDateUtc, hasExpired, hasStart, hasSetRedeemDateLimit: true };\n }\n\n return { hasStart: true, hasExpired: false, hasSetRedeemDateLimit: false };\n}\n\nexport const prizeStatusLabels = {\n REDEEMED: 'REDEEMED',\n HAS_NOT_FILL_FORM: 'HAS_NOT_FILL_FORM',\n EXPIRED: 'EXPIRED'\n};\n","import dayjs from 'dayjs';\n\nimport { utcDTStr2UTC } from 'utils/dateTime';\n\nexport default function getPrizeRedeemWithinEndUtc(startDateTime, withinDays) {\n const startDateUTC = utcDTStr2UTC(startDateTime);\n const endDateUTC = dayjs(startDateUTC)\n .add(withinDays, 'day')\n .hour(23)\n .minute(59)\n .second(59)\n .millisecond(999)\n .valueOf();\n return endDateUTC;\n}\n\nexport function getPrizeRedeemWithinMonthEndUtc(startDateTime, withinMonths) {\n // 計算幾個月後月底日期\n const startDateUTC = utcDTStr2UTC(startDateTime);\n const endDateUTC = dayjs(startDateUTC)\n .add(withinMonths, 'month')\n .hour(23)\n .minute(59)\n .second(59)\n .millisecond(999)\n .endOf('month')\n .valueOf();\n return endDateUTC;\n}\n"],"names":["sortPrizes","categories","items","reduce","obj","item","prizeSettings","redeemTimeType","fillFormEndDate","redeemStartDate","redeemEndDate","redeemWithinDays","redeemWithinDateTime","redeemWithinMonthsLastDay","formId","winnerStatus","formAwardee","redeemed","winnerCreatedAt","hasNotFillForm","Boolean","hasStart","hasRedeemStart","hasExpired","hasRedeemExpired","endDateUtc","redeemEndDateUTC","getPrizeRedeemExpiredInfo","push","expired","dayjs","isBefore","utcDTStr2UTC","notFillFormWithDateLimit","notFillForm","prizeRedeemDateLimitTypes","NO_LIMIT","general","newItem","redeemableWithDateLimit","redeemableWithDateLimitHasNotStart","categorizePrize","arguments","length","undefined","map","statusLabel","prizeStatusLabels","HAS_NOT_FILL_FORM","sort","a","b","aEndDate","bEndDate","entryId","REDEEMED","EXPIRED","sortAllCategoriesAndMerge","_ref","status","___EmotionJSX","css","labelStyle","i18n","t","_css","alertColorStyle","system400","color","error","style","hasEnableRedeemForm","hasFillRedeemForm","Typography","variant","utcDTStr2LocalDTStr","RANGE","startDateUtc","hasNotStartRedeem","concat","format","WITHIN","getPrizeRedeemWithinEndUtc","WITHIN_MONTH_LAST_DAY","getPrizeRedeemWithinMonthEndUtc","FIXED_EXPIRATION","onClick","prize","promoInfo","showPromoInfo","name","prizeName","imageUrl","promoName","serialNo","shouldCoverMask","wrapperStyle","maskStyle","imgStyle","src","alt","infoWrapperStyle","infoStyle","overflowEllipsis","titleStyle","PrizeRedeemDeadline","PrizeRedeemStatusLabel","shadowDarkStyle","styles","PrizeList","useMemo","sortPrizeListAndGetPrizeStatus","promotion","entryUuid","PrizeListItem","key","uuid","e","onClose","title","active","setActive","useState","ref","setRef","shouldShowCloseBtn","useEffect","options","root","rootMargin","threshhold","handleScroll","entries","entry","spotIsVisible","isIntersecting","observer","window","IntersectionObserver","observe","unobserve","React","headerStyle","shadowLightStyle","IconButton","size","CloseIcon","isAfter","hasSetRedeemDateLimit","startDateTime","withinDays","startDateUTC","add","hour","minute","second","millisecond","valueOf","withinMonths","endOf"],"sourceRoot":""}