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A,EAAM8C,aACnBrN,WAAYuK,OAAAA,QAAAA,IAAAA,OAAAA,EAAAA,EAAMsC,MAClB1M,SAAUoK,OAAAA,QAAAA,IAAAA,OAAAA,EAAAA,EAAM+C,SAChBvN,aAAeyJ,GAxGN,CAACA,IACpBc,EAAQd,IAuGuB+D,CAAa/D,MAGpC,SAACrD,MAAAA,CAAI/D,UAAU,YAGjB,KAEH2I,IACC,SAAC5E,MAAAA,CACC/D,UAAW,GAEV,OADkB,IAAjB0B,EAAM9C,OAAe,QAAU,GAChC,4C,UAED,SAACwM,EAAAA,EAAUA,CAAC7K,KAAM0H,EAAY,GAAK,GAAIoD,QAAS1C,OAIpD,SAAC5E,MAAAA,CAAI/D,UAAW,sB","sources":["webpack://_N_E/?09f0","webpack://_N_E/./src/components/Pagination/Paginate.tsx","webpack://_N_E/./src/lib/object.ts","webpack://_N_E/./src/components/Card/CardCourseInstitutions.tsx","webpack://_N_E/./src/pages/explore/index.tsx"],"sourcesContent":["\n (window.__NEXT_P = window.__NEXT_P || []).push([\n \"/explore\",\n function () {\n return require(\"private-next-pages/explore/index.tsx\");\n }\n ]);\n if(module.hot) {\n module.hot.dispose(function () {\n window.__NEXT_P.push([\"/explore\"])\n });\n }\n ","import React, { useEffect, useMemo, useState } from \"react\";\nimport { IconArrow } from \"components/Icon/IconArrow\";\nimport { useIsDesktop } from \"lib/device\";\n\nexport type Props = {\n onPageChange?: (e: any) => void;\n totalCount?: number;\n siblingCount?: number;\n currentPage?: number;\n pageSize?: number;\n classes?: string;\n maxShow?: number;\n trackId?: any;\n};\n\nconst usePagination = ({\n totalCount,\n pageSize,\n siblingCount = 1,\n currentPage = 1,\n maxShow = 4,\n}) => {\n const range = (start: number, end: number) => {\n let length = end - start + 1;\n /*\n Create an array of certain length and set the elements within it from\n start value to end value.\n */\n\n return Array.from({ length }, (_, idx) => idx + start);\n };\n\n const paginationRange = useMemo(() => {\n const totalPageCount = Math.ceil(totalCount / pageSize);\n\n // Pages count is determined as siblingCount + firstPage + lastPage + currentPage + 2*DOTS\n const totalPageNumbers = siblingCount + 4;\n\n /*\n Case 1:\n If the number of pages is less than the page numbers we want to show in our\n paginationComponent, we return the range [1..totalPageCount]\n */\n if (totalPageNumbers >= totalPageCount) {\n return range(1, totalPageCount);\n }\n\n /*\n Calculate left and right sibling index and make sure they are within range 1 and totalPageCount\n */\n const leftSiblingIndex = Math.max(currentPage - siblingCount, 1);\n const rightSiblingIndex = Math.min(\n currentPage + siblingCount,\n totalPageCount\n );\n\n /*\n We do not show dots just when there is just one page number to be inserted between the extremes of sibling and the page limits i.e 1 and totalPageCount. Hence we are using leftSiblingIndex > 2 and rightSiblingIndex < totalPageCount - 2\n */\n const shouldShowLeftDots = leftSiblingIndex > 2;\n const shouldShowRightDots = rightSiblingIndex < totalPageCount - 2;\n\n const firstPageIndex = 1;\n const lastPageIndex = totalPageCount;\n\n if (!shouldShowLeftDots && shouldShowRightDots) {\n let leftItemCount = 3 + 2 * siblingCount;\n let leftRange = range(1, leftItemCount);\n\n return [...leftRange, \"DOTS\", totalPageCount];\n } else if (shouldShowLeftDots && !shouldShowRightDots) {\n let rightItemCount = 3 + 2 * siblingCount;\n let rightRange = range(\n totalPageCount - rightItemCount + 1,\n totalPageCount\n );\n return [firstPageIndex, \"DOTS\", ...rightRange];\n } else if (shouldShowLeftDots && shouldShowRightDots) {\n let middleRange = range(leftSiblingIndex, rightSiblingIndex);\n return [firstPageIndex, \"DOTS\", ...middleRange, \"DOTS\", lastPageIndex];\n } else {\n let middleRange = range(leftSiblingIndex, rightSiblingIndex + 1);\n return [firstPageIndex, ...middleRange, lastPageIndex];\n }\n }, [totalCount, pageSize, siblingCount, currentPage]);\n\n return paginationRange;\n};\n\nexport const Paginate: React.FC = ({\n onPageChange,\n totalCount,\n siblingCount = 1,\n currentPage,\n pageSize,\n classes,\n maxShow = 4,\n trackId = '',\n ...props\n}) => {\n const isDesktop = useIsDesktop();\n const [currPage, setCurrPage] = useState(0);\n const paginationRange = usePagination({\n currentPage: currPage,\n totalCount,\n siblingCount,\n pageSize,\n maxShow,\n });\n\n const onNext = () => {\n onPageChange(currPage + 1);\n };\n\n const onPrevious = () => {\n onPageChange(currPage - 1);\n };\n\n useEffect(() => {\n if (currentPage) {\n setCurrPage(currentPage);\n }\n }, [currentPage]);\n\n let lastPage = paginationRange[paginationRange.length - 1];\n\n return (\n \n );\n};\n","// Merge a `source` object to a `target` recursively\nexport const ObjectDeepMerge = (\n target: Record,\n source: Record\n) => {\n // Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties\n for (const key of Object.keys(source)) {\n if (source[key] instanceof Object)\n Object.assign(source[key], ObjectDeepMerge(target[key], source[key]));\n }\n\n // Join `target` and modified `source`\n Object.assign(target || {}, source);\n return target;\n};\n\n// omit keys from object\nexport const ObjectOmit = (obj: Record, keys: string[]) => {\n const result = { ...obj };\n keys.forEach(function (prop) {\n delete result[prop];\n });\n return result;\n};\n\n// sort array of object by key\nexport const ArrayObjectSortBy = >(\n array: Value[],\n key: string,\n isDesc?: boolean\n) => {\n if (array) {\n return array.sort(function (a: Value, b: Value) {\n if (isDesc) {\n if (key == \"created_date\") {\n //@ts-ignore\n return new Date(b[key]) - new Date(a[key]);\n } else {\n return b[key] - a[key];\n }\n } else {\n return a[key] - b[key];\n }\n });\n } else {\n return array;\n }\n};\n\n\n// reduce array with same objects\nexport const ReduceArrayFromDuplicate = (items: any[]) => {\n const filteredOption2 = Object.values(items.reduce((acc,cur)=>Object.assign(acc,{[cur.id]:cur}),{}));\n return filteredOption2\n}\n\n// generate object when not null\nexport const parseDataParams = (params) => {\n let newParams = {};\n for (let [k, v] of Object.entries(params)) {\n if (v) {\n newParams[k] = v;\n }\n }\n\n return newParams;\n};\n\n\n// suffle an array\nexport const ShuffleArray = (array: any) => {\n let currentIndex = array.length, randomIndex: number;\n\n // While there remain elements to shuffle.\n while (currentIndex > 0) {\n\n // Pick a remaining element.\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex--;\n\n // And swap it with the current element.\n [array[currentIndex], array[randomIndex]] = [\n array[randomIndex], array[currentIndex]];\n }\n\n return array;\n}\n\n\n// example raw: [\"a\",\"b\"], obj: {\"a\" : \"aaa\", \"b\" : \"bbb\", \"c\": \"ccc\"}\nexport const FilteredKeys = (raw: string[], obj: object) => {\n const filtered = Object.keys(obj)\n .filter(key => raw.includes(key))\n .reduce((obj, key) => {\n obj[key] = raw[key];\n return obj;\n }, {});\n return filtered\n}","import React, { ReactNode } from 'react'\nimport { Image } from \"components/Image/Image\";\nimport { CourseInstitutions } from './interfaces';\nimport { CardCourse } from './CardCourse.legacy';\nimport { formatThousandsInK } from 'lib/helper';\nimport { useRouter } from \"next/router\";\nimport { trackEvent } from \"lib/amplitude\";\nimport Link from 'next/link';\nimport { useAuthStore } from 'modules/Auth/authStore';\n\ninterface Props {\n children: ReactNode;\n}\n\nconst CardCourseInstitutions: React.FC = React.forwardRef(\n (\n { \n slug,\n name = '', \n image_url = '', \n courses = [], \n total_courses = 0, \n total_learners = 0, \n idx = 0,\n is_business\n },\n ref:React.LegacyRef\n) => {\n const router = useRouter();\n const currentUrlPath = router.pathname === \"/explore\" ? \"explore\" : \"home\";\n const loginState = useAuthStore((state) => state.loginState);\n\n const SeeAllCourses: React.FC = ({ children }) => (\n {\n //@ts-ignore\n trackEvent({\n event: \"explore_institution_course_more_a\",\n property: {\n institution_name: name,\n section: idx,\n },\n });\n }}\n href={\n // loginState == \"LOGIN\"\n // ? \n {\n pathname: \"/explore/institution/[institutionKey]\",\n query: {\n institutionName: `${name}||${image_url}`,\n institutionKey: `${slug}`,\n url: currentUrlPath,\n hasBusinessCourse: is_business,\n },\n }\n // : {\n // pathname: \"/register\",\n // query: {\n // url: encodeURIComponent(`/explore/institution/${name}||${encodeURIComponent(image_url)}`),\n // },\n // }\n }\n >\n {children}\n \n )\n\n return (\n
\n \n
\n
\n
\n \n
\n\n
\n

{name}

\n
\n
\n

{total_courses}

\n

Kursus

\n
\n
\n

\n {formatThousandsInK(total_learners || 0)}\n

\n

Pelajar

\n
\n\n
\n
\n
\n\n \n
\n
\n\n {/* cards */}\n\n
\n {\n courses && courses.map((course, index) => (\n {\n trackEvent({\n event: \"explore_institution_course_a\",\n property: {\n institution_name: name,\n section: idx,\n course_name: course.name,\n course_slug: course.slug,\n index\n },\n });\n }}\n >\n \n \n ))\n }\n
\n\n
\n \n

Lihat Semua Kursus

\n
\n
\n
\n )\n})\n\nexport default CardCourseInstitutions","import { IconSearch } from \"components/Icon/IconSearch\";\nimport {\n useExploreCourseCategories,\n useExploreCourseInstitutions,\n} from \"modules/Explore/exploreApi\";\nimport Link from \"next/link\";\nimport { useRouter } from \"next/router\";\nimport { useState, useEffect, useRef, useCallback } from \"react\";\nimport { useTrackScreen, trackEvent, trackEventGTM, trackEventGA } from \"lib/amplitude\";\nimport { useIsDesktop } from \"lib/device\";\nimport { PageHeaderDesktop } from \"components/PageHeader/PageHeaderDesktop\";\nimport { ContainerDesktop } from \"components/Container\";\nimport CardCourseInstitutions from \"components/Card/CardCourseInstitutions\";\nimport { MoonLoader } from \"react-spinners\";\nimport { ModalSearchBox } from \"components/InstantSearchBox/ModalSearchBox\";\nimport { BottomNav } from \"modules/Nav/BottomNav\";\nimport { SkeletonRect, SkeletonWrapper } from \"components/Skeleton/Skeleton\";\nimport { Paginate } from \"components/Pagination/Paginate\";\n\nconst ExplorePage: React.FC = () => {\n const router = useRouter();\n const [sizeScreen, setSizeScreen] = useState({ w: 0, h: 0 });\n const [modal, setModal] = useState({\n isShow: false,\n title: \"\",\n });\n\n const [searchText, setSearchText] = useState(\"\");\n\n useTrackScreen({\n event: \"explore_s\",\n });\n trackEventGTM({\n event: \"explore_s\",\n });\n trackEventGA({\n event: \"explore_s\",\n });\n\n useEffect(() => {\n const win = typeof window !== \"undefined\" && window;\n const doc = document;\n const docElem = doc.documentElement;\n const body = doc.getElementsByTagName(\"body\")[0];\n // const x = win.innerWidth || docElem.clientWidth || body.clientWidth\n const x = docElem.offsetWidth;\n const y = win.innerHeight || docElem.clientHeight || body.clientHeight;\n\n const w = typeof window !== \"undefined\" && window.innerWidth;\n const h = Math.round(w / 2);\n setSizeScreen({\n w,\n h,\n });\n }, []);\n\n const isDesktop = useIsDesktop();\n\n const propsModal = {\n ...modal,\n onClose: () => setModal({ title: \"\", isShow: false }),\n };\n\n // if (isDesktop) {\n // return (\n //
\n // \n\n // \n // \n // \n\n //
\n //
\n // );\n // } else {\n return (\n
\n
\n \n
\n\n \n \n );\n // }\n};\n\nexport default ExplorePage;\n\nconst ContentCard = () => {\n const exploreCourseCategories = useExploreCourseCategories();\n const exploreCourseInstitutions = useExploreCourseInstitutions();\n const router = useRouter();\n const currentUrlPath =\n (router.pathname as string) === \"/explore\" ? \"explore\" : \"home\";\n const isDesktop = useIsDesktop();\n\n const LIMIT_PER_PAGE = 6;\n const [page, setPage] = useState(1);\n const [meta, setMeta] = useState({});\n const [categories, setCategories] = useState([]);\n const [institutions, setInstitutions] = useState([]);\n const [hasNextPage, setHasNextPage] = useState(true);\n const [isLoading, setIsLoading] = useState(false);\n const intObserver = useRef();\n const [items, setItems] = useState([]);\n // data for pagination\n const itemsPerPage: number = 6;\n const startIndex: number = (page - 1) * itemsPerPage;\n const endIndex: number = startIndex + itemsPerPage;\n\n const fetchData = (currentItems) => {\n setTimeout(() => {\n setItems((prevItems) => [...prevItems, ...currentItems]);\n setHasNextPage(Boolean(currentItems.length));\n setIsLoading(false);\n }, 400);\n };\n\n useEffect(() => {\n if (!hasNextPage) return;\n setIsLoading(true);\n let currItems = institutions.slice(startIndex, endIndex);\n\n fetchData(currItems);\n }, [page]);\n\n useEffect(() => {\n exploreCourseCategories.doFetch(\n {},\n {\n onSuccess(data: any) {\n setCategories(data?.data);\n },\n }\n );\n }, []);\n\n useEffect(() => {\n exploreCourseInstitutions.doFetch(\n {\n limit: LIMIT_PER_PAGE,\n page,\n includes: \"publishedCourses\",\n },\n {\n onSuccess(data: any) {\n setMeta(data?.meta);\n setItems(data?.data);\n setInstitutions(data?.data);\n },\n }\n );\n }, [page]);\n\n const lastCard = useCallback(\n (card) => {\n if (isLoading) return;\n\n if (intObserver.current) intObserver.current.disconnect();\n\n intObserver.current = new IntersectionObserver((cards) => {\n if (cards[0].isIntersecting && hasNextPage) {\n trackEvent({\n event: \"explore_institution_scroll_a\",\n property: {\n scroll: page,\n },\n });\n setPage((prev) => prev + 1);\n }\n });\n\n if (card) intObserver.current.observe(card);\n },\n [isLoading, hasNextPage]\n );\n\n const institutionContent = items.map((course, idx) => {\n if (items.length === idx + 1) {\n return (\n \n );\n }\n return ;\n });\n\n const totalPageCount = Math.ceil(meta?.total / LIMIT_PER_PAGE);\n const handleChange = (e: number) => {\n setPage(e);\n };\n\n return (\n
\n
\n

Kategori

\n
\n\n {exploreCourseCategories.isLoading ? (\n \n {[1, 2, 3, 4].map((a) => (\n \n ))}\n \n ) : (\n \n {categories.length\n ? categories.map((category) => (\n {\n trackEvent({\n event: \"explore_category_a\",\n property: {\n category_name: category.name,\n },\n });\n }}\n href={{\n pathname: \"/explore/category/[categoryName]\",\n query: {\n categoryName: category.name,\n url: currentUrlPath,\n },\n }}\n key={category.slug}\n >\n \n {/* */}\n\n
\n {category.image_url ? (\n <>\n \n\n
\n \n ) : (\n
\n )}\n
\n\n
\n {category.name}\n
\n
\n \n ))\n : null}\n
\n )}\n\n
\n \n

Institusi

\n \n
\n\n {exploreCourseInstitutions.isLoading ? (\n \n {[1, 2, 3, 4].map((a) => (\n \n ))}\n \n ) : items.length ? (\n
\n
\n {/* {institutionContent} */}\n\n {items.map((course, idx) => (\n \n ))}\n
\n\n {totalPageCount > 1 ? (\n handleChange(e)}\n />\n ) : (\n
\n )}\n
\n ) : null}\n\n {isLoading && (\n \n \n \n )}\n\n
\n \n );\n};\n"],"names":["window","__NEXT_P","push","Paginate","onPageChange","totalCount","siblingCount","currentPage","pageSize","classes","maxShow","trackId","props","useIsDesktop","currPage","setCurrPage","useState","paginationRange","range","start","end","length","Array","from","_","idx","useMemo","totalPageCount","Math","ceil","leftSiblingIndex","max","rightSiblingIndex","min","shouldShowLeftDots","shouldShowRightDots","lastPageIndex","usePagination","useEffect","lastPage","ul","className","li","onClick","undefined","IconArrow","isCircle","color","size","map","pageNumber","direction","ObjectOmit","obj","keys","result","forEach","prop","ArrayObjectSortBy","array","key","isDesc","sort","a","b","Date","ReduceArrayFromDuplicate","items","Object","values","reduce","acc","cur","assign","id","React","ref","slug","name","image_url","courses","total_courses","total_learners","is_business","currentUrlPath","useRouter","pathname","loginState","useAuthStore","state","SeeAllCourses","children","Link","trackEvent","event","property","institution_name","section","href","query","institutionName","institutionKey","url","hasBusinessCourse","div","Image","width","height","src","alt","p","formatThousandsInK","course","index","courseSlug","encodeURIComponent","course_name","course_slug","CardCourse","isLayoutNew","isHorizontal","router","sizeScreen","setSizeScreen","w","h","modal","setModal","isShow","title","searchText","setSearchText","useTrackScreen","trackEventGTM","trackEventGA","win","doc","document","docElem","documentElement","body","getElementsByTagName","offsetWidth","innerHeight","clientHeight","innerWidth","round","propsModal","onClose","PageHeaderDesktop","ContainerDesktop","h3","IconSearch","form","input","value","onChange","e","target","placeholder","onFocus","page","type","ContentCard","ModalSearchBox","BottomNav","exploreCourseCategories","useExploreCourseCategories","exploreCourseInstitutions","useExploreCourseInstitutions","isDesktop","setPage","meta","setMeta","categories","setCategories","institutions","setInstitutions","hasNextPage","setHasNextPage","isLoading","setIsLoading","intObserver","useRef","setItems","startIndex","endIndex","currItems","slice","currentItems","setTimeout","prevItems","Boolean","doFetch","onSuccess","data","limit","includes","lastCard","useCallback","card","current","disconnect","IntersectionObserver","cards","isIntersecting","scroll","prev","observe","CardCourseInstitutions","total","h4","SkeletonWrapper","SkeletonRect","category","category_name","categoryName","img","current_page","per_page","handleChange","MoonLoader","loading"],"sourceRoot":""}