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GAAyBP,EAAAA,EAAAA,IAAH,iUAa/BM,GAGSE,EAAyB,SACpCC,GAEA,IAAMC,GAASC,EAAAA,EAAAA,aACf,GAA2CtC,EAAAA,EAAAA,IAAS,CAClDoC,UAAAA,EACAG,QAAS,WACPF,EAAOG,KAAK,WAHRtC,EAAR,EAAQA,KAYR,MAAO,CAAEA,KAAAA,EAAMuC,UAZf,EAAcA,UAYYC,cAZ1B,EAAyBA,cAYgBC,QAJvCzC,IACI,OAAJA,QAAI,IAAJA,OAAA,EAAAA,EAAM0C,oBAAoBC,aAA1B,OACE3C,QADF,IACEA,OADF,EACEA,EAAM0C,oBAAoBE,KAAKC","sources":["webpack://_N_E/./src/components/commons/popup/ChapterPurchasePopup.tsx","webpack://_N_E/./src/operations/queries/novelChapter/__generated__/useWebNovelChapterList.generated.ts","webpack://_N_E/./src/operations/queries/novelChapter/useWebNovelChapterList.ts"],"sourcesContent":["import React, { useEffect } from 'react';\nimport useTranslation from 'next-translate/useTranslation';\nimport { useQuery } from '@apollo/client';\nimport { css } from '@emotion/react';\nimport theme from '@styles/theme';\nimport { GetUser } from '@customTypes/user';\nimport { GET_USER } from '@api/user';\nimport { useAppSelector } from '@store/hooks';\nimport { AdultLabelIcon, Coin1Icon } from 'public/assets';\n\nimport InfoPopupContainer from './container/InfoPopupContainer';\nimport StoryDetailButton from '@components/storyDetail/button/Button';\nimport { SPLoading, SPImage } from '@components/commons';\nimport { viewEachChapterPurchasePopup } from '@/lib/eventManager';\nimport useCheckAdultCertification from '@/hooks/useCheckAdultCertification';\n\ninterface IChapterPurchasePopup {\n storyName?: string;\n chapterName?: string;\n chapterId?: number;\n storyId?: number;\n chapterIndex?: number;\n lastPreviewChapterIndex?: number;\n price: number;\n isShow: boolean;\n onClose: () => void;\n chapterImage?: string;\n isWebNovel?: boolean;\n showAdultChapterIcon: boolean;\n}\n\nconst ChapterPurchasePopup = ({\n storyName,\n chapterName,\n chapterId,\n storyId,\n chapterIndex,\n chapterImage,\n price,\n isShow,\n onClose,\n isWebNovel = false,\n showAdultChapterIcon,\n}: IChapterPurchasePopup) => {\n const { t } = useTranslation();\n const { previousScreen } = useAppSelector((state) => state.event);\n const { data: userData } = useQuery(GET_USER);\n\n const { goToAdultChapter } = useCheckAdultCertification({\n storyId,\n chapterId,\n });\n\n useEffect(() => {\n isShow &&\n viewEachChapterPurchasePopup({\n storyName,\n storyId: String(storyId),\n chapterId: String(chapterId),\n chapterIndex,\n fullCoin: price,\n coin: price,\n from: previousScreen,\n chapterCoin: price,\n contentType: isWebNovel ? 'novel' : 'interactive',\n });\n }, [isShow]);\n\n if (!isShow) {\n return null;\n }\n\n if (!userData) {\n return ;\n }\n\n const handlePurchaseChapterButtonClick = () => {\n if (isWebNovel) {\n storyId &&\n chapterId &&\n goToAdultChapter({\n storyId,\n chapterId,\n price,\n });\n\n onClose();\n return;\n }\n\n storyId &&\n chapterId &&\n goToAdultChapter({\n storyId,\n chapterId,\n price,\n query: {\n prevScreen: 'story_detail',\n },\n });\n\n onClose();\n };\n\n return (\n \n
\n
\n
\n
\n \n
\n
\n

{storyName}

\n

\n {showAdultChapterIcon && (\n \n )}\n

{chapterName}

\n

\n

\n \n {price}\n

\n
\n
\n
\n

\n {t('webnovel_toast_title_chapter_use_coin', { value: price })}\n

\n
\n \n {t('common_screen_button_purchase')}\n \n
\n
\n \n );\n};\n\nconst popupContainer = css`\n max-width: 19.5rem;\n\n .popup-wrapper {\n .title {\n font-weight: 700;\n font-size: 18px;\n line-height: 22px;\n letter-spacing: -0.3px;\n color: ${theme.colors.gray900};\n }\n }\n`;\n\nconst container = css`\n margin-top: 1em;\n\n .content {\n display: flex;\n\n .summary {\n display: flex;\n\n .image-wrapper {\n img {\n object-fit: cover;\n border-radius: 0.125rem;\n }\n }\n\n .title-wrapper {\n display: flex;\n flex-direction: column;\n margin-top: 0.1875rem;\n margin-left: 1em;\n\n .story-title {\n font: ${theme.font.body3Normal};\n color: ${theme.colors.primary500};\n line-height: 1em;\n margin-bottom: 0.125em;\n }\n\n .chapter-name {\n font: ${theme.font.body1Bold};\n color: ${theme.colors.gray900};\n line-height: 1.5em;\n margin-bottom: 0.5em;\n display: flex;\n align-items: flex-start;\n gap: 0.25rem;\n\n .adult-icon {\n margin-top: 0.1875rem;\n flex-shrink: 0;\n }\n }\n\n .coin-wrapper {\n display: flex;\n align-items: center;\n gap: 4px;\n color: ${theme.colors.gray900};\n font: ${theme.font.header.subhead3};\n\n .price {\n padding-top: 3px;\n }\n\n svg {\n width: 1.5rem;\n height: 1.5rem;\n }\n }\n\n .ad-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 0.5625rem;\n font-weight: 800;\n color: ${theme.colors.gray500};\n border: 0.125rem solid ${theme.colors.gray400};\n border-radius: 0.125rem;\n padding: 0.1563rem 0.25rem 0.0625rem;\n width: 1.5rem;\n height: 1.125rem;\n }\n }\n }\n }\n\n .description {\n font: ${theme.font.body2Normal};\n color: ${theme.colors.gray600};\n line-height: 1.25em;\n margin: 1em 0;\n }\n\n .button-wrapper {\n display: flex;\n padding-top: 1em;\n }\n`;\n\nexport default ChapterPurchasePopup;\n","import * as Types from '../../../../baseType';\n\nimport { gql } from '@apollo/client';\nimport * as Apollo from '@apollo/client';\nconst defaultOptions = {} as const;\nexport type WebNovelChapterDtoFragment = { __typename?: 'Chapter', storyId: number, chapterId: number, chapterIndex: number, name: string, adsOn: boolean, freedAt?: any | null, price: number, currentPlayingStatus: Types.Chapter_Current_Playing_Status, isAdult: boolean, userPurchasedChapter?: { __typename?: 'UserPurchasedChapter', usedAmount: number } | null };\n\nexport type ListChapterByClientQueryVariables = Types.Exact<{\n storyId: Types.Scalars['Int'];\n page?: Types.InputMaybe;\n pageSize?: Types.InputMaybe;\n}>;\n\n\nexport type ListChapterByClientQuery = { __typename?: 'Query', listChapterByClient: { __typename?: 'ListableChapter', totalCount: number, page: number, pageSize: number, list: Array<{ __typename?: 'Chapter', storyId: number, chapterId: number, chapterIndex: number, name: string, adsOn: boolean, freedAt?: any | null, price: number, currentPlayingStatus: Types.Chapter_Current_Playing_Status, isAdult: boolean, userPurchasedChapter?: { __typename?: 'UserPurchasedChapter', usedAmount: number } | null }> } };\n\nexport const WebNovelChapterDtoFragmentDoc = gql`\n fragment WebNovelChapterDto on Chapter {\n storyId\n chapterId\n chapterIndex\n name\n adsOn\n freedAt\n price\n currentPlayingStatus\n isAdult\n userPurchasedChapter {\n usedAmount\n }\n}\n `;\nexport const ListChapterByClientDocument = gql`\n query ListChapterByClient($storyId: Int!, $page: Int, $pageSize: Int) {\n listChapterByClient(data: {storyId: $storyId, page: $page, pageSize: $pageSize}) {\n list {\n ...WebNovelChapterDto\n }\n totalCount\n page\n pageSize\n }\n}\n ${WebNovelChapterDtoFragmentDoc}`;\n\n/**\n * __useListChapterByClientQuery__\n *\n * To run a query within a React component, call `useListChapterByClientQuery` and pass it any options that fit your needs.\n * When your component renders, `useListChapterByClientQuery` returns an object from Apollo Client that contains loading, error, and data properties\n * you can use to render your UI.\n *\n * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;\n *\n * @example\n * const { data, loading, error } = useListChapterByClientQuery({\n * variables: {\n * storyId: // value for 'storyId'\n * page: // value for 'page'\n * pageSize: // value for 'pageSize'\n * },\n * });\n */\nexport function useListChapterByClientQuery(baseOptions: Apollo.QueryHookOptions) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useQuery(ListChapterByClientDocument, options);\n }\nexport function useListChapterByClientLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useLazyQuery(ListChapterByClientDocument, options);\n }\nexport type ListChapterByClientQueryHookResult = ReturnType;\nexport type ListChapterByClientLazyQueryHookResult = ReturnType;\nexport type ListChapterByClientQueryResult = Apollo.QueryResult;","import { gql } from '@apollo/client';\nimport {\n ListChapterByClientQueryVariables,\n useListChapterByClientQuery as useQuery,\n} from '@/operations/queries/novelChapter/__generated__/useWebNovelChapterList.generated';\n\nimport { useRouter } from 'next/router';\n\nexport const WEB_NOVEL_CHAPTER_ITEM = gql`\n fragment WebNovelChapterDto on Chapter {\n storyId\n chapterId\n chapterIndex\n name\n adsOn\n freedAt\n price\n currentPlayingStatus\n isAdult\n userPurchasedChapter {\n usedAmount\n }\n }\n`;\n\nexport const WEB_NOVEL_CHAPTER_LIST = gql`\n query ListChapterByClient($storyId: Int!, $page: Int, $pageSize: Int) {\n listChapterByClient(\n data: { storyId: $storyId, page: $page, pageSize: $pageSize }\n ) {\n list {\n ...WebNovelChapterDto\n }\n totalCount\n page\n pageSize\n }\n }\n ${WEB_NOVEL_CHAPTER_ITEM}\n`;\n\nexport const useWebNovelChapterList = (\n variables: ListChapterByClientQueryVariables,\n) => {\n const router = useRouter();\n const { data, fetchMore, networkStatus } = useQuery({\n variables,\n onError: () => {\n router.push('/404');\n },\n });\n\n const hasNext =\n data &&\n data?.listChapterByClient.totalCount >\n data?.listChapterByClient.list.length;\n\n return { data, fetchMore, networkStatus, hasNext };\n};\n"],"names":["popupContainer","css","theme","container","storyName","chapterName","chapterId","storyId","chapterIndex","chapterImage","price","isShow","onClose","isWebNovel","showAdultChapterIcon","t","useTranslation","previousScreen","useAppSelector","state","event","userData","useQuery","GET_USER","data","goToAdultChapter","useCheckAdultCertification","useEffect","viewEachChapterPurchasePopup","String","fullCoin","coin","from","chapterCoin","contentType","customCSS","title","className","src","width","height","value","isFill","position","onClick","query","prevScreen","defaultOptions","WebNovelChapterDtoFragmentDoc","gql","ListChapterByClientDocument","useListChapterByClientQuery","baseOptions","options","Apollo","WEB_NOVEL_CHAPTER_ITEM","WEB_NOVEL_CHAPTER_LIST","useWebNovelChapterList","variables","router","useRouter","onError","push","fetchMore","networkStatus","hasNext","listChapterByClient","totalCount","list","length"],"sourceRoot":""}