/* Scordemy v4 — Course landing page (fully CMS-driven from WordPress 11-section Course Editor). Preserves exact Scordemy visual design, spacing, responsive mobile buybar, and graceful fallbacks. */ (() => { const D = window.SC; const { useState, useEffect } = React; const { Ic, rupee, months, offPct, tel, wa, fmtPh, Img, useUI, Crumb, MentorCard, VideoCard } = window; const { examInfo, readiness, verdict, Countdown, OFFER_LABEL, SH, Price, CourseCard4, BonusStack, ExamChip, medium4 } = window; function getIconComp(name) { const map = { live: Ic.live, rewind: Ic.rewind, note: Ic.note, test: Ic.test, chat: Ic.chat, users: Ic.users, target: Ic.target, gift: Ic.gift, check: Ic.check, clock: Ic.clock, bolt: Ic.bolt, shield: Ic.shield, cal: Ic.cal }; return map[String(name || '').toLowerCase()] || Ic.check; } function getOfferTargetMs(pricing) { if (!pricing || !pricing.offer_expiry) return null; const ts = Date.parse(pricing.offer_expiry); return isNaN(ts) ? null : ts; } function isOfferActive(c) { const pr = c.pricing || {}; if (c.free) return false; if (pr.offer_visible === false) return false; if (pr.offer_expired) return true === false; const expMs = getOfferTargetMs(pr); if (expMs !== null && expMs <= Date.now()) return false; return true; } function inclusions(c) { const f = (c.feats || []).join(' ').toLowerCase(); const out = [ [Ic.live, 'Live classes', /live/.test(f) ? 'Daily, in the evening' : 'Scheduled through the batch'], [Ic.rewind, 'Recordings', 'Rewatch any class until ' + months(c.dur) + ' validity ends'], [Ic.note, 'PDF notes', 'In Assamese and English, downloadable'], [Ic.test, 'Mock tests', /100\+/.test(f) ? '100+ tests on the latest pattern' : 'Weekly tests with All-Assam rank'], [Ic.chat, 'Doubt support', /telegram/.test(f) ? 'Telegram group with educators' : 'Live chat and Telegram group'], [Ic.users, 'Mentorship', /mentor/.test(f) ? 'One-to-one and weekly mentorship' : 'Guidance calls with faculty'], [Ic.target, 'Revision', /revision/.test(f) ? 'Live revision classes before the exam' : 'PYQs and revision before the exam'], [Ic.gift, '5 free courses', 'GK, current affairs, SAAT-26 and more'], ]; return c.free ? out.slice(0, 4) : out; } /* ---------- sticky buy card ---------- */ function BuyCard({ c, ask, bonusTotal }) { const pr = c.pricing || {}; const sp = c.specs || {}; const hr = c.hero || {}; const save = (c.mrp && c.mrp > c.price) ? (c.mrp - c.price) : 0; let lang = 0; try { if (window.useLang) lang = window.useLang().lang; } catch (e) {} const title = (lang === 1 && c.name_as) ? c.name_as : c.name; const cardImg = hr.image || c.img; const offerOn = isOfferActive(c); const expMs = getOfferTargetMs(pr); const showCd = offerOn && pr.countdown_enabled !== false; const showPrice = pr.show_price !== false; const enrolUrl = pr.enroll_url || D.APP; const enrolExt = /^https?:\/\//i.test(enrolUrl); const enrolLabel = pr.enroll_label || (c.free ? 'Start free in the app' : 'Enrol now'); const enrolVis = pr.enroll_visible !== false; const enrolOpen = pr.enroll_available !== false && c.course_status !== 'full' && c.course_status !== 'closed'; const counVis = pr.counsel_visible !== false; const counLabel = pr.counsel_label || 'Ask a counsellor first'; const counUrl = pr.counsel_url || ''; const counExt = /^https?:\/\//i.test(counUrl); const valText = sp.access_period || months(c.dur); const fmtText = sp.format_label || 'Live + recorded'; const startText = sp.start_info || 'Instantly on enrolment'; const payNote = pr.payment_note || 'Pay only in the official Scordemy app'; const effBonusTotal = bonusTotal > 0 ? bonusTotal : D.bonusTotal; return (
{title}
{offerOn && (
{pr.offer_heading || 'Offer price + free bonus ends in'} {showCd && }
)} {pr.offer_label && offerOn && (
{pr.offer_label}
)} {showPrice && } {pr.savings_text ? (
{pr.savings_text}
) : (save > 0 && showPrice && (
You save {rupee(save)}{effBonusTotal > 0 ? ' · plus ' + rupee(effBonusTotal) + ' of free courses' : ''}
))} {pr.offer_description && offerOn && (
{pr.offer_description}
)} {enrolVis && (enrolOpen ? ( {enrolLabel} ) : ( {c.course_status === 'full' ? 'Batch full' : 'Enrolment closed'} ))} {counVis && (counUrl ? ( {counLabel} ) : ( ))}
    {pr.show_validity !== false &&
  • Validity{valText}
  • } {pr.show_medium !== false &&
  • Medium{medium4(c)}
  • } {pr.show_format !== false &&
  • Format{fmtText}
  • } {pr.show_starts !== false &&
  • Starts{startText}
  • }
{payNote &&
{payNote}
}
); } /* ---------- dynamic section nav ---------- */ function SecNav({ c, tabs }) { const [on, setOn] = useState(tabs[0] ? tabs[0].key : 'overview'); const pr = c.pricing || {}; const enrolUrl = pr.enroll_url || D.APP; const enrolExt = /^https?:\/\//i.test(enrolUrl); const enrolLabel = pr.enroll_label || (c.free ? 'Start free' : 'Enrol now'); useEffect(() => { const els = tabs.map(t => document.getElementById(t.key)).filter(Boolean); if (!els.length) return; const io = new IntersectionObserver(es => { es.forEach(e => { if (e.isIntersecting) setOn(e.target.id); }); }, { rootMargin: '-140px 0px -60% 0px' }); els.forEach(el => io.observe(el)); return () => io.disconnect(); }, [tabs.map(t => t.key).join(',')]); const jump = (e, id) => { e.preventDefault(); const el = document.getElementById(id); if (el) window.scrollTo({ top: el.getBoundingClientRect().top + window.scrollY - 120, behavior: 'smooth' }); }; if (!tabs.length) return null; return (
{pr.show_price !== false && } {pr.enroll_visible !== false && {enrolLabel}}
); } /* ---------- exam readiness strip (uses linked Exam Guide relationship) ---------- */ function ClockStrip({ c, examRef }) { if (c.show_exam_info === false) return null; const goalId = (examRef && examRef.id) || c.goal; const e = examInfo(goalId); if (!e && !examRef) return null; const shortLabel = (examRef && examRef.short) || (e && e.short) || c.goal; return (
{e ? : (
{examRef.exam} {examRef.line && {examRef.line}}
)} What you get after clearing {shortLabel}: posts & salary
); } /* ---------- curriculum (supports dynamic WP modules + nested lessons, plus static fallback) ---------- */ function Curriculum({ c, g, emptyMsg }) { const [open, setOpen] = useState(0); const hasWpCur = Array.isArray(c.curriculum) && c.curriculum.length > 0; if (hasWpCur) { const mods = c.curriculum; const totalLessons = mods.reduce((acc, m) => acc + ((m.lessons && m.lessons.length) || 0), 0); return (
{mods.length} {mods.length === 1 ? 'module' : 'modules'} · {totalLessons} {totalLessons === 1 ? 'lesson' : 'lessons'} · {g.exam || g.short}
{mods.map((m, i) => { const les = Array.isArray(m.lessons) ? m.lessons : []; return (
{open === i && (
{m.description &&

{m.description}

} {les.length > 0 ? (
    {les.map((l, li) => (
  • {l.title} {l.type && {l.type}} {l.duration && ({l.duration})} {l.resource_url && Resource ↗}
    {l.description && {l.description}} {Array.isArray(l.topic_list) && l.topic_list.length > 0 && (
    Topics: {l.topic_list.join(' · ')}
    )}
  • ))}
) : (

Lessons for this module will be updated soon.

)}
)}
); })}
); } const mods = (D.curriculum && D.curriculum[g.id]) || []; if (!mods.length) { return
{emptyMsg || 'Curriculum details will be updated soon.'}
; } const topics = mods.reduce((a, [, t]) => a + t.length, 0); return (
{mods.length} modules · {topics} topics · {g.exam || g.short}
{mods.map(([m, t], i) => (
{open === i && }
))}
); } /* ---------- compare ---------- */ function Compare({ c }) { const rows = [ ['A fixed plan that finishes the syllabus on time', [0, 0, 1]], ['Assam-specific GK and current affairs', [1, 0, 1]], ['Mock tests with All-Assam rank', [0, 0, 1]], ['Doubts answered by educators', [0, 0, 1]], ['Notes in Assamese and English', [0, 1, 1]], ['Cost', ['₹3,000+ in books', 'Free', c.free ? 'Free' : rupee(c.price)]], ]; const cell = v => typeof v === 'string' ? {v} : v ? : ; return (
Self-studyRandom YouTubeThis batch
{rows.map(([l, v]) =>
{l}{v.map((x, i) => {cell(x)})}
)}
); } function CoursePage4({ slug }) { useLandingPages(); const { openTalk } = useUI(); const [fit, setFit] = useState([]); const [course, setCourse] = useState(() => (D.courses && D.courses[slug]) || null); const [unavailable, setUnavailable] = useState(false); const [loading, setLoading] = useState(true); useEffect(() => { let isMounted = true; setLoading(true); setUnavailable(false); if (window.ScordemyAPI && window.ScordemyAPI.Course) { window.ScordemyAPI.Course.getCourseBySlug(slug) .then(function (data) { if (!isMounted) return; if (data && data.slug) { setCourse(data); setUnavailable(false); } else { setCourse(null); setUnavailable(true); } setLoading(false); }) .catch(function (err) { if (!isMounted) return; console.warn('[CoursePage4] Failed to fetch live course:', err); setLoading(false); }); } else { setLoading(false); } return () => { isMounted = false; }; }, [slug]); const c = course; // Apply SEO Title, Description & OG Image from WordPress useEffect(() => { if (!c) return; window.__scPageSeoActive = true; const prevTitle = document.title; const seo = c.seo || {}; if (seo.title) document.title = seo.title; else if (c.name) document.title = c.name + ' — Scordemy'; let metaDesc = document.querySelector('meta[name="description"]'); const prevDesc = metaDesc ? metaDesc.getAttribute('content') : null; if (seo.description) { if (!metaDesc) { metaDesc = document.createElement('meta'); metaDesc.setAttribute('name', 'description'); document.head.appendChild(metaDesc); } metaDesc.setAttribute('content', seo.description); } let metaOg = document.querySelector('meta[property="og:image"]'); const prevOg = metaOg ? metaOg.getAttribute('content') : null; if (seo.og_image) { if (!metaOg) { metaOg = document.createElement('meta'); metaOg.setAttribute('property', 'og:image'); document.head.appendChild(metaOg); } metaOg.setAttribute('content', seo.og_image); } return () => { window.__scPageSeoActive = false; document.title = prevTitle; if (metaDesc && prevDesc !== null) metaDesc.setAttribute('content', prevDesc); if (metaOg && prevOg !== null) metaOg.setAttribute('content', prevOg); }; }, [c && c.slug, c && c.seo && c.seo.title, c && c.seo && c.seo.description, c && c.seo && c.seo.og_image]); if (!c && loading) { return

Loading course...

; } if (!c || unavailable || c.visible === false) { return (

Course unavailable

This course is currently unpublished or hidden.

Browse all courses
); } const examRef = c.exam_info || null; const g = (D.goals && D.goals[(examRef && examRef.id) || c.goal]) || { short: (examRef && examRef.short) || c.goal || 'Exam', id: (examRef && examRef.id) || c.goal, exam: (examRef && examRef.exam) || c.goal || 'Exam', phone: (examRef && examRef.phone) || (D.goals && D.goals.govt && D.goals.govt.phone) || '9181372998', courses: [slug], mentors: [] }; const e = examInfo(g.id); let lang = 0; try { if (window.useLang) lang = window.useLang().lang; } catch (err) {} const courseTitle = (lang === 1 && c.name_as) ? c.name_as : c.name; const hr = c.hero || {}; const ov = c.overview || {}; const sp = c.specs || {}; const pr = c.pricing || {}; const disp = c.display || {}; const hd = disp.headings || {}; const emp = disp.empty_states || {}; const showSec = disp.show_sections || {}; const counselPhone = pr.counsel_phone || g.phone || D.PHONE.support; const ask = () => openTalk({ phone: counselPhone, goal: g.id, title: 'Ask before you enrol', msg: 'Hi Scordemy, I have a question about "' + courseTitle + '".' }); const related = (g.courses || []).filter(s => s !== slug).map(s => (D.courses && D.courses[s])).filter(Boolean).filter(x => !x.free).slice(0, 3); const vids = (D.videos || []).filter(v => v.goal === g.id || v.goal === null).slice(0, 3); // Faculty resolution: live course-specific Mentor CPT records first, then exam guide mentors fallback const hasWpFaculty = Array.isArray(c.faculty) && c.faculty.length > 0; const fallbackMentors = (g.mentors || []).map(mid => D.mentors && D.mentors[mid]).filter(Boolean); const activeFaculty = hasWpFaculty ? c.faculty : fallbackMentors; // Bonuses total const hasWpBonuses = Array.isArray(c.bonuses) && c.bonuses.length > 0; const activeBonusTotal = hasWpBonuses ? (Number(c.bonus_total) || c.bonuses.reduce((a, b) => a + (Number(b.original_value) || 0), 0)) : D.bonusTotal; // Dynamic Tabs (order, labels, visibility) const defaultTabs = [ { key: 'overview', label: 'Overview', enabled: true }, { key: 'inside', label: "What's inside", enabled: true }, { key: 'curriculum', label: 'Curriculum', enabled: true }, { key: 'week', label: 'Schedule', enabled: true }, { key: 'faculty', label: 'Faculty', enabled: true }, { key: 'bonus', label: 'Free bonus', enabled: true }, { key: 'faq', label: 'FAQs', enabled: true } ]; const rawTabs = (Array.isArray(disp.tabs) && disp.tabs.length) ? disp.tabs : defaultTabs; const visibleTabs = rawTabs.filter(t => { if (!t || t.enabled === false) return false; if (t.key === 'faculty' && c.faculty_enabled === false) return false; if (t.key === 'bonus' && c.free && !hasWpBonuses) return false; return true; }); const tabEnabled = (k) => visibleTabs.some(t => t.key === k); // Hero derived values const heroHeading = hr.heading || courseTitle; const heroDesc = hr.description || c.short_description || (D.promise && D.promise[g.id]) || ''; const heroBgMap = { deep: '#0f172a', royal: '#102a5c', emerald: '#0b2e26' }; const heroStyle = (hr.bg_style && heroBgMap[hr.bg_style]) ? { background: heroBgMap[hr.bg_style] } : undefined; const statusMap = { admissions_open: 'Admissions open', upcoming: 'Upcoming batch', ongoing: 'Ongoing batch', full: 'Batch full', closed: 'Admissions closed' }; const statusTxt = statusMap[c.course_status] || 'Admissions open'; const wpModCount = Array.isArray(c.curriculum) && c.curriculum.length ? c.curriculum.length : ((D.curriculum && D.curriculum[g.id]) || []).length; const modCountDisplay = (sp.modules_count !== null && sp.modules_count !== undefined && sp.modules_count !== '') ? sp.modules_count : wpModCount; const heroPrimaryUrl = hr.cta_primary_url || pr.enroll_url || D.APP; const heroPrimaryExt = /^https?:\/\//i.test(heroPrimaryUrl); const heroPrimaryTxt = hr.cta_primary_text || (c.free ? 'Start free' : ('Enrol now · ' + rupee(c.price))); const heroSecTxt = hr.cta_secondary_text || "See what's inside"; const heroSecUrl = hr.cta_secondary_url || '#inside'; const offerOn = isOfferActive(c); const expMs = getOfferTargetMs(pr); const showCd = offerOn && pr.countdown_enabled !== false; // Render helper for each main section so display.tabs ordering is strictly respected! const renderSection = (key) => { if (key === 'overview') { return (

{ov.heading || 'Batch highlights'}

{(ov.intro || c.full_description) &&

{ov.intro || c.full_description}

} {(ov.study_hours || ov.completion_estimate || sp.completion_estimate || sp.subjects_count) && (
{ov.study_hours && Study hours: {ov.study_hours}} {(ov.completion_estimate || sp.completion_estimate) && Completion: {ov.completion_estimate || sp.completion_estimate}} {sp.subjects_count > 0 && {sp.subjects_count} Subjects}
)} {Array.isArray(ov.stats) && ov.stats.length > 0 && (
{ov.stats.map((st, i) => (
{st.value} {st.label}
))}
)} {Array.isArray(ov.benefits) && ov.benefits.length > 0 && (

Course benefits

    {ov.benefits.map((b, i) =>
  • {b}
  • )}
)} {Array.isArray(ov.outcomes) && ov.outcomes.length > 0 && (

Learning outcomes

    {ov.outcomes.map((o, i) =>
  • {o}
  • )}
)} {Array.isArray(ov.notices) && ov.notices.length > 0 && (
{ov.notices.map((n, i) =>
Note: {n}
)}
)} {Array.isArray(c.gallery) && c.gallery.length > 0 && (
{c.gallery.map((u, i) => {courseTitle)}
)}
); } if (key === 'inside') { const hasWpIn = Array.isArray(c.whats_inside) && c.whats_inside.length > 0; return (

{hd.inside || "What's inside the batch"}

Everything below unlocks in the Scordemy app the day you enrol.

{hasWpIn ? (
{c.whats_inside.map((sec, si) => (

{sec.title}

{sec.badge && {sec.badge}}
{sec.description &&

{sec.description}

} {Array.isArray(sec.bullets) && sec.bullets.length > 0 && (
    {sec.bullets.map((b, bi) =>
  • {b}
  • )}
)} {Array.isArray(sec.blocks) && sec.blocks.length > 0 && (
{sec.blocks.map((blk, bi) => { const Ico = getIconComp(blk.icon); const isImg = blk.icon && (/^https?:\/\/|^assets\//i.test(blk.icon)); return (
{isImg ? : } {blk.link ? {blk.heading} : blk.heading} {blk.description}
); })}
)}
))}
) : (
{inclusions(c).map(([I, h, p]) =>
{h}{p}
)}
)}
); } if (key === 'curriculum') { return (

{hd.curriculum || 'Curriculum'}

The complete {g.short} syllabus, split into modules you finish one at a time.

); } if (key === 'week') { const hasWpSch = Array.isArray(c.schedule) && c.schedule.length > 0; const hasNotice = !!(c.schedule_notice && c.schedule_notice.trim()); const defaultWeek = (D.week && D.week[g.id]) || []; return (

{hd.week || 'A typical week'}

One live class a day fits around college or a job. Missed one? The recording is in the app.

{hasNotice && (
{c.schedule_notice}
)} {hasWpSch ? (
{c.schedule.map((s, i) => (
{s.class_days || s.status || ('#' + (i + 1))} {s.title} {[s.class_timing, s.duration, s.instructor].filter(Boolean).join(' · ')} {(s.start_date || s.end_date) && {[s.start_date, s.end_date].filter(Boolean).join(' → ')}} {s.description && {s.description}}
))}
) : (!hasNotice && defaultWeek.length > 0) ? (
{defaultWeek.map(([d, s, t]) =>
{d}{s}{t}
)}
) : (!hasNotice && (
{emp.week || 'Schedule will be announced soon.'}
))} {vids.length > 0 && <>

Watch a free class first

{vids.map(v => )}
}
); } if (key === 'faculty') { return (

{hd.faculty || 'Your faculty'}

Mentors who have sat these exams and teach in Assamese and English.

{activeFaculty.length > 0 ? (
{activeFaculty.map((m, idx) => (
{m.name} {m.featured && Featured}

{m.name}

{m.subj}
{m.cred}
))}
) : (
{emp.faculty || 'Faculty roster will be announced soon.'}
)}
); } if (key === 'bonus') { return (

{hd.bonus || 'Your free bonus'}

{pr.offer_description || ('Included at no extra cost when you enrol before ' + OFFER_LABEL + '.')}

); } if (key === 'faq') { const hasWpFaq = Array.isArray(c.faqs) && c.faqs.length > 0; const faqRows = hasWpFaq ? c.faqs.map(f => [lang === 1 && f.question_as ? f.question_as : f.question, lang === 1 && f.answer_as ? f.answer_as : f.answer]) : (D.courseFaq || []); return (

{hd.faq || 'Frequently asked questions'}

{faqRows.map(([q, a], i) =>
{q}

{a}

)}
); } return null; }; return (
{c.tag && c.badge_visible !== false && {c.tag}} {!c.free && {statusTxt}} {c.show_exam_info !== false && } {c.category && {c.category}} {(hr.badges || []).map((b, i) => {b})}

{heroHeading}

{heroDesc &&

{heroDesc}

}
  • {sp.access_period || months(c.dur)}{hr.validity_label || 'access'}
  • {sp.format_label || 'Live + rec.'}{hr.format_label || 'classes'}
  • {c.medium === 'English & Assamese' ? 'অসমীয়া + EN' : c.medium}{hr.medium_label || 'medium'}
  • {modCountDisplay} modules{hr.modules_label || 'full syllabus'}
{hr.show_instructor_preview !== false && activeFaculty.length > 0 && (
{activeFaculty.slice(0, 4).map((m, idx) => )} {hr.instructor_label || 'Taught by'} {activeFaculty.slice(0, 2).map(m => m.name).join(', ')}{activeFaculty.length > 2 ? ' and team' : ''}
)}
{/* Render all enabled main sections in exact WordPress display.tabs order */} {visibleTabs.map(t => renderSection(t.key))} {/* Supporting Sections (controlled by Display & SEO toggles) */} {(showSec.fit !== false || showSec.compare !== false) && (
{showSec.fit !== false && (c.rightFor || []).length > 0 && <>

Is this batch right for you?

Tick what applies. You'll get an honest read.

{(c.rightFor || []).map((r, i) => )}
{fit.length > 0 &&
{fit.length}/{(c.rightFor || []).length} {fit.length === (c.rightFor || []).length ? 'A strong fit. This batch was built for you.' : 'A partial fit. One free call will settle it.'} {fit.length < (c.rightFor || []).length && }
} } {showSec.compare !== false && <>

Why a batch beats preparing alone

}
)} {showSec.howto !== false && (

How to enrol

  1. 1
    Tap Enrol nowThe Scordemy app opens on Google Play. It's free to install.
  2. 2
    Open "{(courseTitle || c.name).split('·')[0].trim()}"Pay securely inside the app with UPI, card or net banking.
  3. 3
    Start the same dayClasses, notes, the Telegram group and your free bonus items unlock instantly.
)}
{(showSec.bottom_cta !== false || (showSec.related !== false && related.length > 0)) && (
{showSec.bottom_cta !== false && (

{e ? (e.days != null ? `${e.days} days to ${e.tag}.` : `${e.tag} could be notified any week.`) : `Prepare for ${g.short} with structure.`} Start today.

{c.free ? 'Free to start. No payment needed.' : `Enrol at ${rupee(c.price)} and unlock free bonuses worth ${rupee(activeBonusTotal)}.`}

{showCd && }
{pr.enroll_visible !== false && {pr.enroll_label || (c.free ? 'Start free' : 'Enrol now')}} {pr.counsel_visible !== false && }
)} {showSec.related !== false && related.length > 0 &&
{g.short} guide } />
{related.map(r => )}
}
)}
{pr.show_price !== false && }{!c.free && activeBonusTotal > 0 && +free bonus}
{pr.counsel_visible !== false && } {pr.enroll_visible !== false && {pr.enroll_label || (c.free ? 'Start free' : 'Enrol now')}}
); } Object.assign(window, { CoursePage4 }); })();