← Files LucebraARCHIVED FILE
widgets/course-player.html
86.8 KB · Nov 21, 2026 · 12:29 UTC
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Lucebra - ChatGPT Interactive Course Player Widget</title>
<style>
:root {
--lucebra-primary: #137fec;
--lucebra-primary-hover: #0e62b8;
--lucebra-primary-light: #38bdf8;
--lucebra-primary-glow: rgba(19, 127, 236, 0.35);
--lucebra-bg-dark: #101922;
--lucebra-surface: #16222f;
--lucebra-surface-card: #1c2a3a;
--lucebra-surface-hover: #223448;
--lucebra-border: #233549;
--lucebra-border-active: #137fec;
--lucebra-text: #f8fafc;
--lucebra-text-muted: #94a3b8;
--lucebra-star: #f59e0b;
--lucebra-price: #34d399;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
body {
background: #0b1118;
color: var(--lucebra-text);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
padding: 16px;
}
.chat-bubble-container {
width: 100%;
max-width: 860px;
background: var(--lucebra-bg-dark);
border-radius: 20px;
padding: 16px;
border: 1px solid var(--lucebra-border);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.widget-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
padding-bottom: 10px;
border-bottom: 1px solid var(--lucebra-border);
gap: 10px;
flex-wrap: wrap;
}
.brand-left {
display: flex;
align-items: center;
gap: 10px;
}
.brand-logo-link {
display: inline-flex;
align-items: center;
text-decoration: none;
}
.brand-logo {
height: 24px;
width: auto;
max-width: 115px;
object-fit: contain;
display: block;
}
.brand-tag {
background: rgba(19, 127, 236, 0.15);
border: 1px solid rgba(19, 127, 236, 0.3);
color: #38bdf8;
font-size: 11px;
font-weight: 600;
padding: 2px 9px;
border-radius: 20px;
white-space: nowrap;
}
.header-right {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.header-info {
font-size: 12px;
font-weight: 600;
color: #cbd5e1;
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.08);
padding: 3px 10px;
border-radius: 20px;
}
.btn-connect-account {
background: rgba(19, 127, 236, 0.14);
border: 1px solid rgba(56, 189, 248, 0.38);
color: #38bdf8;
font-size: 11.5px;
font-weight: 600;
padding: 5px 11px;
border-radius: 20px;
display: inline-flex;
align-items: center;
gap: 6px;
cursor: pointer;
transition: all 0.2s ease;
}
.btn-connect-account:hover {
background: rgba(19, 127, 236, 0.28);
border-color: #38bdf8;
color: #fff;
transform: translateY(-1px);
}
.user-profile-badge {
display: none;
align-items: center;
gap: 7px;
background: #162332;
border: 1px solid rgba(52, 211, 153, 0.35);
padding: 3px 8px 3px 4px;
border-radius: 24px;
}
.user-profile-badge.visible {
display: inline-flex;
}
.user-badge-avatar-wrap {
position: relative;
width: 24px;
height: 24px;
flex-shrink: 0;
}
.user-badge-avatar {
width: 24px;
height: 24px;
border-radius: 50%;
object-fit: cover;
border: 1.5px solid #38bdf8;
display: block;
}
.user-badge-dot {
position: absolute;
right: -1px;
bottom: -1px;
width: 8px;
height: 8px;
border-radius: 50%;
background: #34d399;
border: 1.5px solid #101922;
}
.user-badge-name {
font-size: 11.5px;
font-weight: 600;
color: #f1f5f9;
max-width: 130px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.user-badge-plan {
font-size: 9.5px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.3px;
padding: 1.5px 6px;
border-radius: 10px;
background: rgba(56, 189, 248, 0.16);
color: #38bdf8;
border: 1px solid rgba(56, 189, 248, 0.3);
display: none;
}
.user-badge-plan.visible {
display: inline-block;
}
.btn-disconnect-account {
background: transparent;
border: none;
color: #94a3b8;
font-size: 14px;
line-height: 1;
cursor: pointer;
padding: 0 2px;
display: inline-flex;
align-items: center;
justify-content: center;
transition: color 0.15s;
}
.btn-disconnect-account:hover {
color: #f87171;
}
.lucebra-modal-backdrop {
position: fixed;
inset: 0;
z-index: 50;
background: rgba(5, 8, 12, 0.8);
backdrop-filter: blur(5px);
display: none;
align-items: center;
justify-content: center;
padding: 16px;
}
.lucebra-modal-backdrop.visible {
display: flex;
}
.lucebra-modal-card {
width: 100%;
max-width: 390px;
background: #131e2b;
border: 1px solid #263a52;
border-radius: 16px;
padding: 18px 20px;
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
position: relative;
max-height: 92vh;
overflow-y: auto;
}
.lucebra-modal-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
}
.lucebra-modal-title {
font-size: 15px;
font-weight: 700;
color: #f8fafc;
display: flex;
align-items: center;
gap: 8px;
}
.lucebra-modal-close {
background: transparent;
border: none;
color: #94a3b8;
font-size: 18px;
cursor: pointer;
padding: 2px 6px;
border-radius: 6px;
}
.lucebra-modal-close:hover {
background: rgba(255, 255, 255, 0.06);
color: #fff;
}
.login-mode-tabs {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 6px;
background: #0b1118;
padding: 4px;
border-radius: 10px;
border: 1px solid #233549;
margin-bottom: 10px;
}
.login-mode-tab {
background: transparent;
border: none;
color: #94a3b8;
font-size: 11.5px;
font-weight: 600;
padding: 6px 8px;
border-radius: 7px;
cursor: pointer;
transition: all 0.15s ease;
}
.login-mode-tab.active {
background: var(--lucebra-primary);
color: #fff;
box-shadow: 0 2px 8px rgba(19, 127, 236, 0.35);
}
.lucebra-modal-sub {
font-size: 11.5px;
color: #94a3b8;
line-height: 1.45;
margin-bottom: 12px;
}
.lucebra-modal-sub a {
color: #38bdf8;
text-decoration: none;
font-weight: 600;
}
.lucebra-form-group {
margin-bottom: 10px;
}
.lucebra-form-label {
display: block;
font-size: 11.5px;
font-weight: 600;
color: #cbd5e1;
margin-bottom: 4px;
}
.lucebra-form-input {
width: 100%;
padding: 8px 11px;
border-radius: 9px;
border: 1px solid #2a3f58;
background: #0b1118;
color: #f8fafc;
font-size: 12.5px;
outline: none;
}
.lucebra-form-input:focus {
border-color: var(--lucebra-primary);
}
.lucebra-login-error {
display: none;
background: rgba(239, 68, 68, 0.14);
border: 1px solid rgba(239, 68, 68, 0.35);
color: #fca5a5;
padding: 8px 10px;
border-radius: 8px;
font-size: 11.5px;
margin-bottom: 10px;
}
.lucebra-login-error.visible {
display: block;
}
.btn-modal-submit {
width: 100%;
padding: 9px 14px;
border-radius: 9px;
border: none;
background: linear-gradient(135deg, var(--lucebra-primary) 0%, #0284c7 100%);
color: #fff;
font-size: 12.5px;
font-weight: 700;
cursor: pointer;
transition: opacity 0.2s;
}
.btn-modal-submit:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.qr-shortcut-wrap {
margin-top: 10px;
border-top: 1px solid rgba(255, 255, 255, 0.08);
padding-top: 10px;
}
.btn-qr-toggle {
width: 100%;
padding: 7px 10px;
border-radius: 8px;
border: 1px dashed rgba(56, 189, 248, 0.4);
background: rgba(19, 127, 236, 0.08);
color: #38bdf8;
font-size: 11.5px;
font-weight: 600;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
transition: all 0.2s;
}
.btn-qr-toggle:hover {
background: rgba(19, 127, 236, 0.18);
color: #fff;
}
.qr-panel {
display: none;
margin-top: 8px;
padding: 10px;
border-radius: 10px;
background: #0b1118;
border: 1px solid #233549;
text-align: center;
}
.qr-panel.visible {
display: block;
}
.qr-code-box {
width: 136px;
height: 136px;
margin: 0 auto 8px auto;
padding: 6px;
background: #fff;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
}
.qr-code-box img {
width: 124px;
height: 124px;
display: block;
}
.qr-status-text {
font-size: 11px;
color: #cbd5e1;
line-height: 1.4;
}
.qr-status-text a {
color: #38bdf8;
text-decoration: none;
font-weight: 600;
}
.lucebra-modal-footer {
margin-top: 10px;
text-align: center;
font-size: 11px;
color: #94a3b8;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
flex-wrap: wrap;
}
.lucebra-modal-footer a {
color: #38bdf8;
text-decoration: none;
font-weight: 600;
}
.widget-container {
display: flex;
height: 410px;
border-radius: 14px;
overflow: hidden;
border: 1px solid var(--lucebra-border);
background: var(--lucebra-surface);
}
.playlist {
width: 44%;
background: #131c26;
overflow-y: auto;
border-right: 1px solid var(--lucebra-border);
padding: 10px;
display: flex;
flex-direction: column;
gap: 8px;
}
.playlist::-webkit-scrollbar {
width: 5px;
}
.playlist::-webkit-scrollbar-thumb {
background: #233549;
border-radius: 4px;
}
.course-card {
display: flex;
gap: 10px;
padding: 10px;
border-radius: 10px;
background: var(--lucebra-surface-card);
border: 1.5px solid transparent;
cursor: pointer;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
align-items: center;
position: relative;
}
.course-card:hover {
background: var(--lucebra-surface-hover);
transform: translateY(-1px);
}
.course-card.active {
background: #18283a;
border-color: var(--lucebra-primary);
box-shadow: 0 4px 14px var(--lucebra-primary-glow);
}
.course-card.active::before {
content: "";
position: absolute;
left: 0;
top: 8px;
bottom: 8px;
width: 3px;
background: var(--lucebra-primary);
border-radius: 0 4px 4px 0;
}
.thumb-wrapper {
position: relative;
width: 58px;
height: 58px;
border-radius: 8px;
overflow: hidden;
flex-shrink: 0;
background: #0f172a;
}
.thumb-wrapper img {
width: 100%;
height: 100%;
object-fit: cover;
}
.thumb-play-icon {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.4);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
transition: opacity 0.2s;
}
.course-card:hover .thumb-play-icon,
.course-card.active .thumb-play-icon {
opacity: 1;
}
.course-info {
overflow: hidden;
display: flex;
flex-direction: column;
gap: 3px;
flex: 1;
}
.course-title {
font-size: 12.5px;
font-weight: 600;
color: #f1f5f9;
line-height: 1.35;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.course-meta {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 5px;
font-size: 11px;
color: var(--lucebra-text-muted);
}
.course-rating {
display: flex;
align-items: center;
gap: 3px;
color: var(--lucebra-star);
font-weight: 600;
}
.course-price-old {
color: #64748b;
text-decoration: line-through;
font-size: 10.5px;
}
.course-price-current {
color: var(--lucebra-price);
font-weight: 700;
font-size: 11px;
}
.course-discount-badge {
background: rgba(52, 211, 153, 0.16);
border: 1px solid rgba(52, 211, 153, 0.35);
color: #34d399;
font-size: 9px;
font-weight: 700;
padding: 1px 4px;
border-radius: 4px;
text-transform: uppercase;
}
.card-wishlist-btn {
background: rgba(15, 23, 42, 0.65);
border: 1px solid rgba(255, 255, 255, 0.12);
color: #94a3b8;
width: 28px;
height: 28px;
border-radius: 50%;
display: inline-flex;
align-items: center;
justify-content: center;
cursor: pointer;
flex-shrink: 0;
transition: all 0.18s ease;
}
.card-wishlist-btn:hover {
background: rgba(244, 63, 94, 0.18);
border-color: rgba(244, 63, 94, 0.45);
color: #fb7185;
transform: scale(1.08);
}
.card-wishlist-btn.saved {
background: rgba(244, 63, 94, 0.2);
border-color: rgba(244, 63, 94, 0.55);
color: #f43f5e;
}
.player-area {
width: 56%;
display: flex;
flex-direction: column;
background: var(--lucebra-surface);
padding: 14px;
justify-content: space-between;
}
.video-container {
position: relative;
width: 100%;
height: 255px;
border-radius: 10px;
overflow: hidden;
background: #05080c;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
border: 1px solid rgba(255, 255, 255, 0.06);
}
.video-watermark {
position: absolute;
top: 10px;
right: 12px;
width: 26px;
height: 26px;
pointer-events: none;
z-index: 3;
opacity: 0.85;
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.7));
}
.video-unavailable-overlay {
position: absolute;
inset: 0;
z-index: 2;
display: none;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8px;
padding: 20px;
text-align: center;
background: rgba(11, 17, 24, 0.82);
backdrop-filter: blur(4px);
}
.video-unavailable-overlay.visible {
display: flex;
}
.video-unavailable-badge {
background: rgba(19, 127, 236, 0.18);
border: 1px solid rgba(56, 189, 248, 0.35);
color: #e2e8f0;
font-size: 12.5px;
font-weight: 600;
padding: 6px 12px;
border-radius: 8px;
}
.video-unavailable-sub {
color: var(--lucebra-text-muted);
font-size: 11.5px;
max-width: 280px;
line-height: 1.4;
}
video {
width: 100%;
height: 100%;
object-fit: cover;
}
.player-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: 12px;
padding-top: 8px;
}
.instructor-box {
display: flex;
align-items: center;
gap: 10px;
overflow: hidden;
flex: 1;
}
.instructor-avatar {
width: 42px;
height: 42px;
border-radius: 50%;
object-fit: cover;
border: 2px solid var(--lucebra-border);
flex-shrink: 0;
}
.instructor-texts {
overflow: hidden;
flex: 1;
}
.active-course-title {
font-size: 13.5px;
font-weight: 700;
color: #fff;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 2px;
}
.active-author-row {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 5px;
font-size: 11.5px;
color: var(--lucebra-text-muted);
}
.verified-icon {
color: var(--lucebra-primary-light);
display: inline-flex;
}
.btn-learn-more {
background: linear-gradient(135deg, var(--lucebra-primary) 0%, #0284c7 100%);
color: #ffffff;
padding: 10px 20px;
border-radius: 9px;
text-decoration: none;
font-size: 13px;
font-weight: 700;
white-space: nowrap;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
gap: 6px;
box-shadow: 0 4px 12px var(--lucebra-primary-glow);
flex-shrink: 0;
}
.btn-learn-more:hover {
background: linear-gradient(135deg, var(--lucebra-primary-hover) 0%, #0369a1 100%);
transform: translateY(-1px);
box-shadow: 0 6px 16px var(--lucebra-primary-glow);
}
.chat-prompt-summary {
margin-top: 14px;
font-size: 13px;
color: #cbd5e1;
line-height: 1.5;
}
.chat-prompt-summary b {
color: #fff;
}
.widget-actions-bar {
display: flex;
align-items: center;
gap: 7px;
flex-wrap: wrap;
margin-top: 14px;
padding-top: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.action-chip {
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.12);
color: #e2e8f0;
padding: 6.5px 12px;
border-radius: 8px;
font-size: 11.5px;
font-weight: 500;
display: inline-flex;
align-items: center;
gap: 6px;
cursor: pointer;
transition: all 0.2s ease;
user-select: none;
}
.action-chip:hover:not(:disabled) {
background: rgba(19, 127, 236, 0.15);
border-color: var(--lucebra-primary);
color: #fff;
transform: translateY(-1px);
}
.action-chip.saved-chip {
background: rgba(244, 63, 94, 0.16);
border-color: rgba(244, 63, 94, 0.45);
color: #fda4af;
}
.action-chip:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.confirm-modal-actions {
display: flex;
gap: 8px;
margin-top: 14px;
}
.btn-modal-secondary {
flex: 1;
padding: 8px 12px;
border-radius: 8px;
border: 1px solid #2a3f58;
background: #182636;
color: #e2e8f0;
font-size: 12px;
font-weight: 600;
cursor: pointer;
text-align: center;
text-decoration: none;
}
.btn-modal-secondary:hover {
background: #223448;
color: #fff;
}
.btn-modal-primary {
flex: 1;
padding: 8px 12px;
border-radius: 8px;
border: none;
background: linear-gradient(135deg, var(--lucebra-primary) 0%, #0284c7 100%);
color: #fff;
font-size: 12px;
font-weight: 700;
cursor: pointer;
text-align: center;
text-decoration: none;
}
.widget-container {
display: flex;
flex-direction: row;
height: 410px;
border-radius: 14px;
overflow: hidden;
border: 1px solid var(--lucebra-border);
background: var(--lucebra-surface);
}
.playlist {
width: 44%;
min-width: 0;
background: #131c26;
overflow-y: auto;
border-right: 1px solid var(--lucebra-border);
padding: 10px;
display: flex;
flex-direction: column;
gap: 8px;
}
.player-area {
width: 56%;
min-width: 0;
display: flex;
flex-direction: column;
background: var(--lucebra-surface);
padding: 14px;
justify-content: space-between;
}
.course-info {
min-width: 0;
overflow: hidden;
display: flex;
flex-direction: column;
gap: 3px;
flex: 1;
}
/* Keep side-by-side layout intact across all screen widths (split-view 974px, iPad, Mac) */
@media (max-width: 990px) {
.chat-bubble-container {
padding: 12px;
}
.widget-container {
height: 390px;
}
.playlist {
width: 45%;
padding: 8px;
gap: 6px;
}
.player-area {
width: 55%;
padding: 10px;
}
.course-card {
padding: 7px 8px;
gap: 8px;
}
.thumb-wrapper {
width: 48px;
height: 48px;
}
.course-title {
font-size: 11.5px;
line-height: 1.3;
}
.course-meta {
font-size: 10px;
gap: 3px;
}
.instructor-avatar {
width: 36px;
height: 36px;
}
.active-course-title {
font-size: 12.5px;
}
.btn-learn-more {
padding: 8px 14px;
font-size: 11.5px;
}
}
@media (max-width: 640px) {
body {
padding: 6px;
}
.chat-bubble-container {
padding: 10px;
border-radius: 14px;
}
.widget-container {
height: 360px;
}
.playlist {
width: 46%;
padding: 6px;
gap: 5px;
}
.player-area {
width: 54%;
padding: 8px;
}
.video-container {
height: 200px;
}
.course-card {
padding: 6px 7px;
gap: 6px;
}
.thumb-wrapper {
width: 42px;
height: 42px;
}
.course-title {
font-size: 11px;
}
.btn-learn-more {
padding: 7px 10px;
font-size: 11px;
}
.action-chip {
padding: 5px 8px;
font-size: 10.5px;
}
}
</style>
</head>
<body>
<div class="chat-bubble-container">
<div class="widget-header">
<div class="brand-left">
<a href="https://www.lucebra.com" target="_blank" rel="noopener noreferrer" class="brand-logo-link"
title="Lucebra">
<img src="https://api.lucebra.com/mcp/assets/logo.png" alt="Lucebra" class="brand-logo" />
</a>
<span class="brand-tag">Course Player</span>
</div>
<div class="header-right">
<div class="header-info" id="header-course-count">2K+ Courses, Resources & More</div>
<button type="button" class="btn-connect-account" id="btn-connect-account"
title="Connect your Lucebra account to access Wishlist, Learning Progress, Certificates & Business Plan">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2">
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />
<circle cx="12" cy="7" r="4" />
</svg>
<span>Connect Account</span>
</button>
<div class="user-profile-badge" id="user-profile-badge" title="Connected Lucebra Account">
<div class="user-badge-avatar-wrap">
<img id="user-profile-avatar" class="user-badge-avatar"
src="https://api.lucebra.com/mcp/assets/placeholder-avatar.svg" alt="User" />
<span class="user-badge-dot"></span>
</div>
<span id="user-profile-name" class="user-badge-name">Lucebra Student</span>
<span id="user-profile-plan" class="user-badge-plan"></span>
<button type="button" class="btn-disconnect-account" id="btn-disconnect-account"
title="Disconnect Lucebra account">×</button>
</div>
</div>
</div>
<!-- Login Modal (Personal + Organization + Mobile QR Shortcut) -->
<div class="lucebra-modal-backdrop" id="lucebra-login-modal">
<div class="lucebra-modal-card">
<div class="lucebra-modal-header">
<div class="lucebra-modal-title">
<img src="https://api.lucebra.com/mcp/assets/logo.png" alt="Lucebra" style="height: 18px; width: auto;" />
<span>Connect Account</span>
</div>
<button type="button" class="lucebra-modal-close" id="btn-close-login-modal" title="Close">×</button>
</div>
<div class="login-mode-tabs">
<button type="button" class="login-mode-tab active" id="tab-login-personal">Personal Login</button>
<button type="button" class="login-mode-tab" id="tab-login-org">Organization Login</button>
</div>
<div class="lucebra-modal-sub" id="login-modal-subtitle">
Sign in with your Lucebra account to unlock instant Wishlist saving, Learning Progress, Certificates, and
Personal/Team Plan enrollment.
</div>
<div class="lucebra-login-error" id="login-error-banner"></div>
<form id="lucebra-login-form">
<div class="lucebra-form-group">
<label class="lucebra-form-label" id="login-email-label" for="login-email-input">Email or Username</label>
<input class="lucebra-form-input" id="login-email-input" type="text" placeholder="you@example.com" required
autocomplete="username" />
</div>
<div class="lucebra-form-group">
<label class="lucebra-form-label" for="login-password-input">Password</label>
<input class="lucebra-form-input" id="login-password-input" type="password" placeholder="••••••••" required
autocomplete="current-password" />
</div>
<button type="submit" class="btn-modal-submit" id="btn-login-submit">Sign In & Connect</button>
</form>
<div class="qr-shortcut-wrap">
<button type="button" class="btn-qr-toggle" id="btn-qr-toggle">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="7" height="7" />
<rect x="14" y="3" width="7" height="7" />
<rect x="14" y="14" width="7" height="7" />
<rect x="3" y="14" width="7" height="7" />
</svg>
<span id="txt-qr-toggle">Login with QR Code (Lucebra Mobile App)</span>
</button>
<div class="qr-panel" id="qr-panel">
<div class="qr-code-box">
<img id="qr-code-img" src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='124' height='124'></svg>" alt="Lucebra QR Code" />
</div>
<div class="qr-status-text" id="qr-status-text">
Open the <a href="https://www.lucebra.com/mobile-app" target="_blank" rel="noopener noreferrer">Lucebra
Mobile App</a> and scan this barcode to sign in instantly.
</div>
</div>
</div>
<div class="lucebra-modal-footer">
<a id="link-web-personal-login" href="https://www.lucebra.com/login?returnUrl=https%3A%2F%2Fchatgpt.com&source=mcp_widget" target="_blank" rel="noopener noreferrer">Personal Web Login →</a>
<span>•</span>
<a id="link-web-org-login" href="https://www.lucebra.com/organizational-login?returnUrl=https%3A%2F%2Fchatgpt.com&source=mcp_widget" target="_blank" rel="noopener noreferrer">Organization Login →</a>
</div>
</div>
</div>
<!-- In-Widget Wishlist / Plan Confirmation Modal (No Chat Scroll Needed) -->
<div class="lucebra-modal-backdrop" id="lucebra-wishlist-modal">
<div class="lucebra-modal-card">
<div class="lucebra-modal-header">
<div class="lucebra-modal-title" id="wishlist-modal-title">✓ Saved to Your Lucebra Wishlist</div>
<button type="button" class="lucebra-modal-close" id="btn-close-wishlist-modal" title="Close">×</button>
</div>
<div class="lucebra-modal-sub" id="wishlist-modal-desc" style="margin-bottom: 6px; color: #e2e8f0;">
This course has been updated in your personal Lucebra Wishlist. You can continue browsing and adding other
courses right here.
</div>
<div class="confirm-modal-actions">
<button type="button" class="btn-modal-secondary" id="btn-wishlist-continue">Continue Browsing</button>
<a id="btn-wishlist-action-link" class="btn-modal-primary" href="https://www.lucebra.com/explore"
target="_blank" rel="noopener noreferrer">Open Course →</a>
</div>
</div>
</div>
<div class="widget-container">
<div class="playlist" id="course-list"></div>
<div class="player-area">
<div class="video-container">
<video id="video-player" preload="none" controls playsinline></video>
<div id="video-unavailable-overlay" class="video-unavailable-overlay">
<div class="video-unavailable-badge" id="video-unavailable-title">Preview not available</div>
<div class="video-unavailable-sub" id="video-unavailable-desc">Video preview is not available for this
course. Click "Learn More" below to inspect the full syllabus.</div>
</div>
<div class="video-watermark" title="Course Preview">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
<rect width="24" height="24" rx="6" fill="#137fec" fill-opacity="0.85" />
<path d="M9.5 7.5v9l7-4.5-7-4.5z" fill="#fff" />
</svg>
</div>
</div>
<div class="player-footer">
<div class="instructor-box">
<img id="instructor-img" class="instructor-avatar"
src="https://api.lucebra.com/mcp/assets/placeholder-avatar.svg" alt="Instructor" />
<div class="instructor-texts">
<div id="active-title" class="active-course-title">Select a course</div>
<div class="active-author-row">
<span id="active-author">Lucebra Instructor</span>
<span class="verified-icon">
<svg width="13" height="13" viewBox="0 0 24 24" fill="currentColor">
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" />
</svg>
</span>
<span id="active-students-dot" style="display: none;">•</span>
<span id="active-students" style="color: #94a3b8; display: none;"></span>
</div>
</div>
</div>
<a id="learn-btn" class="btn-learn-more" href="https://www.lucebra.com/explore" target="_blank"
rel="noopener noreferrer">
<span>Learn More</span>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
<path d="M5 12h14M12 5l7 7-7 7" />
</svg>
</a>
</div>
</div>
</div>
<div class="widget-actions-bar" id="widget-actions-bar">
<button type="button" class="action-chip" id="btn-show-curriculum" title="View curriculum of the selected course">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M4 6h16M4 12h16M4 18h7" />
</svg>
<span>View Curriculum</span>
</button>
<button type="button" class="action-chip" id="btn-compare-courses" title="Compare courses">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M16 3h5v5M4 20L21 3M21 16v5h-5M15 15l6 6M4 4l5 5" />
</svg>
<span>Compare Courses</span>
</button>
<button type="button" class="action-chip" id="btn-course-price" title="Check course price and active discounts">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="12" y1="1" x2="12" y2="23" />
<path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" />
</svg>
<span>Course Price</span>
</button>
<button type="button" class="action-chip" id="btn-instructor-info"
title="View instructor profile, photo, and published courses">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />
<circle cx="12" cy="7" r="4" />
</svg>
<span>Instructor Info</span>
</button>
<button type="button" class="action-chip" id="btn-save-wishlist"
title="Instantly add or toggle this course in your Lucebra Wishlist right inside the widget">
<svg id="svg-wishlist-heart" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path
d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" />
</svg>
<span id="txt-wishlist">Add to Wishlist</span>
</button>
<button type="button" class="action-chip" id="btn-my-wishlist" title="View your saved Lucebra wishlist">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z" />
</svg>
<span>My Wishlist</span>
</button>
<button type="button" class="action-chip" id="btn-my-progress"
title="Check your enrolled learning progress & Play Now links">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 20V10M18 20V4M6 20v-4" />
</svg>
<span>My Progress</span>
</button>
<button type="button" class="action-chip" id="btn-my-certificates" title="View your earned certificates">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="8" r="7" />
<polyline points="8.21 13.89 7 23 12 20 17 23 15.79 13.88" />
</svg>
<span>My Certificates</span>
</button>
<button type="button" class="action-chip" id="btn-business-access"
title="Check Personal Plan, Team Plan, or Enterprise LMS status, assigned courses & deadlines">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="2" y="7" width="20" height="14" rx="2" ry="2" />
<path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16" />
</svg>
<span>Business / Plan</span>
</button>
<button type="button" class="action-chip" id="btn-enroll-plan"
title="Immediately enroll in this course for $0.00 under your Personal Plan, Team Plan, or Enterprise LMS">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2" />
</svg>
<span>Enroll with Plan</span>
</button>
<button type="button" class="action-chip" id="btn-practice-exams"
title="Explore Lucebra Exam Center certification exams">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M9 11l3 3L22 4" />
<path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11" />
</svg>
<span>Practice Exams</span>
</button>
<button type="button" class="action-chip" id="btn-digital-products"
title="Browse Digital Products (eBooks, audio, kits)">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20" />
<path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z" />
</svg>
<span>Digital Products</span>
</button>
<button type="button" class="action-chip" id="btn-live-sessions" title="View upcoming live webinars and sessions">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polygon points="23 7 16 12 23 17 23 7" />
<rect x="1" y="5" width="15" height="14" rx="2" ry="2" />
</svg>
<span>Live Sessions</span>
</button>
<button type="button" class="action-chip" id="btn-plans-pricing"
title="Explain Lucebra Personal, Team and Enterprise plans, differences, and current pricing">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="2" y="5" width="20" height="14" rx="2" />
<line x1="2" y1="10" x2="22" y2="10" />
</svg>
<span>Plans & Pricing</span>
</button>
<button type="button" class="action-chip" id="btn-get-app"
title="Download the Lucebra Mobile App for iOS and Android">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="5" y="2" width="14" height="20" rx="2" ry="2" />
<line x1="12" y1="18" x2="12.01" y2="18" />
</svg>
<span>Get the App</span>
</button>
<button type="button" class="action-chip" id="btn-spotlight-daily"
title="Discover instructors and short course videos on Lucebra Spotlight Daily">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10" />
<polygon points="10 8 16 12 10 16 10 8" />
</svg>
<span>Spotlight Daily</span>
</button>
<button type="button" class="action-chip" id="btn-write-articles"
title="Write and publish technical articles and guides on Lucebra">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 20h9" />
<path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" />
</svg>
<span>Write Articles</span>
</button>
</div>
<div class="chat-prompt-summary" id="chat-summary-text">
Preview video lessons above, click the heart (♡) icon on any course to save it directly to your Wishlist, or tap
the quick actions below.
</div>
</div>
<script>
(() => {
const placeholderThumb = "https://api.lucebra.com/mcp/assets/placeholder-thumb.svg";
const placeholderAvatar = "https://api.lucebra.com/mcp/assets/placeholder-avatar.svg";
function sanitizeMediaUrl(rawUrl, fallback = "") {
if (!rawUrl || typeof rawUrl !== "string") return fallback;
const trimmed = rawUrl.trim();
try {
const base = (window.location.origin && window.location.origin !== "null" && window.location.origin.startsWith("http"))
? window.location.origin
: "https://api.lucebra.com";
const parsed = new URL(trimmed, base);
if (parsed.protocol === "https:") {
return parsed.href;
}
} catch (e) { }
return fallback;
}
function sanitizeWebUrl(rawUrl, fallback = "https://www.lucebra.com/explore") {
if (!rawUrl || typeof rawUrl !== "string") return fallback;
try {
const parsed = new URL(rawUrl.trim());
if (parsed.protocol === "https:") {
return parsed.href;
}
} catch (e) { }
return fallback;
}
function setVideoUnavailableState(isUnavailable, messageTitle, messageDesc) {
const overlay = document.getElementById("video-unavailable-overlay");
const titleEl = document.getElementById("video-unavailable-title");
const descEl = document.getElementById("video-unavailable-desc");
if (!overlay) return;
if (isUnavailable) {
if (titleEl) titleEl.textContent = messageTitle || "Preview not available";
if (descEl) descEl.textContent = messageDesc || "Video preview is not available for this course. Click \"Learn More\" below to inspect the full syllabus.";
overlay.classList.add("visible");
} else {
overlay.classList.remove("visible");
}
}
let currentCourses = [];
let currentActiveIndex = 0;
let currentAuthUser = null;
let pendingWishlistCourse = null;
const wishlistSavedCourseIds = new Set();
function clearVideoAndMetadata() {
const player = document.getElementById("video-player");
if (player) {
try { player.pause(); } catch (e) { }
player.removeAttribute("src");
player.removeAttribute("poster");
player.load();
}
setVideoUnavailableState(true, "No course selected", "Select or search for a course to watch its lesson preview.");
const activeTitle = document.getElementById("active-title");
if (activeTitle) activeTitle.textContent = "Discover Courses on Lucebra";
const activeAuthor = document.getElementById("active-author");
if (activeAuthor) activeAuthor.textContent = "Lucebra Instructor";
const instructorImg = document.getElementById("instructor-img");
if (instructorImg) instructorImg.src = placeholderAvatar;
const emptyStudents = document.getElementById("active-students");
if (emptyStudents) {
emptyStudents.textContent = "";
emptyStudents.style.display = "none";
}
const emptyDot = document.getElementById("active-students-dot");
if (emptyDot) emptyDot.style.display = "none";
const learnBtn = document.getElementById("learn-btn");
if (learnBtn) learnBtn.href = "https://www.lucebra.com/explore";
updateWishlistButtonState(null);
}
function showInWidgetNotificationModal(title, desc, actionLabel, actionHref) {
const modal = document.getElementById("lucebra-wishlist-modal");
const titleEl = document.getElementById("wishlist-modal-title");
const descEl = document.getElementById("wishlist-modal-desc");
const linkEl = document.getElementById("btn-wishlist-action-link");
if (!modal) return;
if (titleEl) titleEl.textContent = title || "✓ Updated";
if (descEl) descEl.textContent = desc || "";
if (linkEl) {
linkEl.textContent = actionLabel || "Open on Lucebra →";
linkEl.href = sanitizeWebUrl(actionHref, "https://www.lucebra.com/explore");
}
modal.classList.add("visible");
}
function updateWishlistButtonState(courseId) {
const btnWishlist = document.getElementById("btn-save-wishlist");
const txtWishlist = document.getElementById("txt-wishlist");
const svgWishlist = document.getElementById("svg-wishlist-heart");
if (btnWishlist && txtWishlist) {
if (!courseId) {
btnWishlist.disabled = true;
btnWishlist.classList.remove("saved-chip");
txtWishlist.textContent = "Add to Wishlist";
if (svgWishlist) svgWishlist.setAttribute("fill", "none");
} else if (wishlistSavedCourseIds.has(String(courseId))) {
btnWishlist.disabled = false;
btnWishlist.classList.add("saved-chip");
txtWishlist.textContent = "Saved in Wishlist";
if (svgWishlist) svgWishlist.setAttribute("fill", "currentColor");
} else {
btnWishlist.disabled = false;
btnWishlist.classList.remove("saved-chip");
txtWishlist.textContent = "Add to Wishlist";
if (svgWishlist) svgWishlist.setAttribute("fill", "none");
}
}
document.querySelectorAll(".card-wishlist-btn").forEach((btn) => {
const cid = btn.getAttribute("data-course-id");
const isSaved = cid && wishlistSavedCourseIds.has(String(cid));
btn.classList.toggle("saved", Boolean(isSaved));
btn.title = isSaved ? "Saved in your Lucebra Wishlist (Click to remove)" : "Add to your Lucebra Wishlist";
btn.innerHTML = isSaved
? '<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>'
: '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>';
});
}
async function fetchSavedWishlistIds() {
if (!currentAuthUser) return;
try {
const res = await fetch("https://api.lucebra.com/mcp/widget-wishlist/ids", {
method: "GET",
headers: { "Accept": "application/json" }
});
if (!res.ok) return;
const data = await res.json();
const idList = data ? (Array.isArray(data.courseIds) ? data.courseIds : (Array.isArray(data.ids) ? data.ids : null)) : null;
if (idList) {
wishlistSavedCourseIds.clear();
idList.forEach((id) => wishlistSavedCourseIds.add(String(id)));
const active = currentCourses[currentActiveIndex] || currentCourses[0];
updateWishlistButtonState(active ? active.id : null);
}
} catch (e) { }
}
async function toggleCourseWishlistInstant(course) {
if (!course || !course.id) return;
if (!currentAuthUser) {
pendingWishlistCourse = course;
const loginModal = document.getElementById("lucebra-login-modal");
if (loginModal) loginModal.classList.add("visible");
return;
}
const summaryEl = document.getElementById("chat-summary-text");
try {
const res = await fetch("https://api.lucebra.com/mcp/widget-wishlist/toggle", {
method: "POST",
headers: { "Content-Type": "application/json", "Accept": "application/json" },
body: JSON.stringify({ courseId: String(course.id) })
});
const data = await res.json();
if (res.status === 401 || (data && data.requiresLogin)) {
pendingWishlistCourse = course;
const loginModal = document.getElementById("lucebra-login-modal");
if (loginModal) loginModal.classList.add("visible");
return;
}
if (res.ok && data && data.success) {
const cid = String(data.courseId || course.id);
if (data.saved) {
wishlistSavedCourseIds.add(cid);
showInWidgetNotificationModal(
"♥ Added to Your Lucebra Wishlist",
`"${data.courseTitle || course.title}" (${data.discountPrice || data.price || course.discountPrice || course.price || ""}) has been saved to your Wishlist. You can continue adding more courses right here without leaving the player.`,
"View Course Page →",
data.courseUrl || course.url
);
if (summaryEl) {
summaryEl.textContent = `✓ Saved "${data.courseTitle || course.title}" to your Lucebra Wishlist.`;
}
} else {
wishlistSavedCourseIds.delete(cid);
if (summaryEl) {
summaryEl.textContent = `Removed "${data.courseTitle || course.title}" from your Lucebra Wishlist.`;
}
}
const active = currentCourses[currentActiveIndex] || currentCourses[0];
updateWishlistButtonState(active ? active.id : null);
}
} catch (e) {
if (summaryEl) {
summaryEl.textContent = "Could not update wishlist right now. Please try again.";
}
}
}
async function enrollInCourseWithPlanInstant(course) {
if (!course || !course.id) return;
if (!currentAuthUser) {
const loginModal = document.getElementById("lucebra-login-modal");
if (loginModal) loginModal.classList.add("visible");
return;
}
const summaryEl = document.getElementById("chat-summary-text");
try {
const res = await fetch("https://api.lucebra.com/mcp/widget-business/enroll", {
method: "POST",
headers: { "Content-Type": "application/json", "Accept": "application/json" },
body: JSON.stringify({ courseId: String(course.id) })
});
const data = await res.json();
if (res.status === 401 || (data && data.requiresLogin)) {
const loginModal = document.getElementById("lucebra-login-modal");
if (loginModal) loginModal.classList.add("visible");
return;
}
if (res.ok && data && data.enrolled) {
const modalTitle = data.alreadyAssignedByOrganization
? "✓ Assigned to Your Enterprise LMS Account"
: "⚡ Enrolled via Your Lucebra Plan ($0.00)";
const actionLabel = data.actionLabel || (data.alreadyAssignedByOrganization ? "Continue on Enterprise LMS →" : "▶ Play Now →");
const actionHref = data.playNowUrl || "https://www.student.lucebra.com/";
showInWidgetNotificationModal(
modalTitle,
data.message || `You can start or continue "${data.courseTitle || course.title}" right away.`,
actionLabel,
actionHref
);
if (summaryEl) {
summaryEl.textContent = data.alreadyAssignedByOrganization
? `✓ "${data.courseTitle || course.title}" is assigned to your Enterprise LMS account.`
: `✓ Enrolled in "${data.courseTitle || course.title}" under your plan.`;
}
} else if (data && data.isUnassignedEnterpriseCourse) {
showInWidgetNotificationModal(
"Enterprise LMS — Course Not Assigned by Company",
data.message || `You are an Enterprise LMS member, and "${data.courseTitle || course.title}" is not currently assigned by your organization. To get this course for your own personal account, open its course page below.`,
data.actionLabel || "Open Course Page →",
data.courseUrl || course.url || "https://www.lucebra.com/explore"
);
if (summaryEl) {
summaryEl.textContent = `"${data.courseTitle || course.title}" is not assigned by your organization. Open the course page to get it for your own account.`;
}
} else {
showInWidgetNotificationModal(
"No Active Business Membership Found",
(data && data.message) ? data.message : "Your account does not currently have an active Business or subscription plan (Personal, Team, or Enterprise LMS). Switch to a Lucebra Business plan to unlock included access.",
"Explore Lucebra Business →",
(data && data.businessUrl) ? data.businessUrl : "https://www.lucebra.com/lucebra-business"
);
}
} catch (e) { }
}
function renderPlaylist(courses) {
if (!courses || !Array.isArray(courses)) return;
currentCourses = courses;
const container = document.getElementById("course-list");
if (!container) return;
container.replaceChildren();
const countHeader = document.getElementById("header-course-count");
if (countHeader) {
countHeader.textContent = "2K+ Courses, Resources & More";
}
if (courses.length === 0) {
const emptyBox = document.createElement("div");
emptyBox.style.cssText = "padding: 32px 16px; text-align: center; color: var(--lucebra-text-muted); font-size: 13px;";
const p = document.createElement("p");
p.style.cssText = "margin: 0 0 10px 0;";
p.textContent = "No matching courses found for this query.";
const link = document.createElement("a");
link.href = "https://www.lucebra.com/explore";
link.target = "_blank";
link.rel = "noopener noreferrer";
link.style.cssText = "color: var(--lucebra-primary-light); text-decoration: underline; font-weight: 500;";
link.textContent = "Explore All Courses on Lucebra →";
emptyBox.appendChild(p);
emptyBox.appendChild(link);
container.appendChild(emptyBox);
clearVideoAndMetadata();
return;
}
courses.forEach((item, index) => {
const card = document.createElement("div");
card.className = "course-card" + (index === 0 ? " active" : "");
const thumbWrapper = document.createElement("div");
thumbWrapper.className = "thumb-wrapper";
const thumbImg = document.createElement("img");
thumbImg.alt = "Course Thumbnail";
thumbImg.src = sanitizeMediaUrl(item.thumbnail, placeholderThumb);
thumbImg.onerror = function () {
this.onerror = null;
this.src = placeholderThumb;
};
const playIcon = document.createElement("div");
playIcon.className = "thumb-play-icon";
const svgEl = document.createElementNS("http://www.w3.org/2000/svg", "svg");
svgEl.setAttribute("width", "16");
svgEl.setAttribute("height", "16");
svgEl.setAttribute("viewBox", "0 0 24 24");
svgEl.setAttribute("fill", "#fff");
const pathEl = document.createElementNS("http://www.w3.org/2000/svg", "path");
pathEl.setAttribute("d", "M8 5v14l11-7z");
svgEl.appendChild(pathEl);
playIcon.appendChild(svgEl);
thumbWrapper.appendChild(thumbImg);
thumbWrapper.appendChild(playIcon);
const infoDiv = document.createElement("div");
infoDiv.className = "course-info";
const titleDiv = document.createElement("div");
titleDiv.className = "course-title";
titleDiv.textContent = item.title || "Course";
const metaDiv = document.createElement("div");
metaDiv.className = "course-meta";
const authorSpan = document.createElement("span");
authorSpan.textContent = item.author || "Lucebra Instructor";
const dotSpan = document.createElement("span");
dotSpan.textContent = "•";
const ratingSpan = document.createElement("span");
ratingSpan.className = "course-rating";
ratingSpan.textContent = `★ ${item.rating || "5.0"}`;
metaDiv.appendChild(authorSpan);
metaDiv.appendChild(dotSpan);
metaDiv.appendChild(ratingSpan);
let rawPrice = "";
if (typeof item.price === "number") {
rawPrice = item.price <= 0 ? "Free" : `$${item.price.toFixed(2)}`;
} else if (typeof item.price === "string") {
rawPrice = item.price.trim();
}
let rawDisc = "";
if (typeof item.discountPrice === "number" && item.discountPrice > 0) {
rawDisc = `$${item.discountPrice.toFixed(2)}`;
} else if (typeof item.discountPrice === "string" && item.discountPrice.trim() !== "") {
rawDisc = item.discountPrice.trim();
}
const hasDisc = Boolean((item.hasDiscount || rawDisc) && rawDisc && rawDisc !== rawPrice);
if (rawPrice) {
const priceDot = document.createElement("span");
priceDot.textContent = "•";
metaDiv.appendChild(priceDot);
if (hasDisc) {
const oldPriceSpan = document.createElement("span");
oldPriceSpan.className = "course-price-old";
oldPriceSpan.textContent = rawPrice;
metaDiv.appendChild(oldPriceSpan);
const curPriceSpan = document.createElement("span");
curPriceSpan.className = "course-price-current";
curPriceSpan.textContent = rawDisc;
metaDiv.appendChild(curPriceSpan);
const discBadge = document.createElement("span");
discBadge.className = "course-discount-badge";
discBadge.textContent = "SALE";
metaDiv.appendChild(discBadge);
} else {
const curPriceSpan = document.createElement("span");
curPriceSpan.className = "course-price-current";
curPriceSpan.textContent = rawPrice;
metaDiv.appendChild(curPriceSpan);
}
}
infoDiv.appendChild(titleDiv);
infoDiv.appendChild(metaDiv);
const heartBtn = document.createElement("button");
heartBtn.type = "button";
heartBtn.className = "card-wishlist-btn";
heartBtn.setAttribute("data-course-id", String(item.id || ""));
heartBtn.onclick = (ev) => {
ev.stopPropagation();
toggleCourseWishlistInstant(item);
};
card.appendChild(thumbWrapper);
card.appendChild(infoDiv);
card.appendChild(heartBtn);
card.onclick = () => selectCourse(index, courses, true);
container.appendChild(card);
});
selectCourse(0, courses, false);
}
function selectCourse(index, courses, shouldPlay = false) {
const course = courses[index];
if (!course) return;
currentActiveIndex = index;
updateWishlistButtonState(course.id);
document.querySelectorAll(".course-card").forEach((card, idx) => {
card.classList.toggle("active", idx === index);
});
const player = document.getElementById("video-player");
const safeThumb = sanitizeMediaUrl(course.thumbnail, placeholderThumb);
const safePreviewUrl = sanitizeMediaUrl(course.previewVideoUrl, "");
if (player) {
player.onerror = () => {
setVideoUnavailableState(
true,
"Preview not available",
"Video preview is not available for this course. Click \"Learn More\" below to inspect the full syllabus."
);
return true;
};
if (safeThumb) {
player.poster = safeThumb;
} else {
player.removeAttribute("poster");
}
if (safePreviewUrl) {
setVideoUnavailableState(false);
player.src = safePreviewUrl;
player.preload = "metadata";
if (shouldPlay) {
try {
player.play().catch(() => { });
} catch (e) { }
}
} else {
try { player.pause(); } catch (e) { }
player.removeAttribute("src");
player.load();
setVideoUnavailableState(
true,
"Preview not available",
"Video preview is not available for this course. Click \"Learn More\" below to inspect the full syllabus."
);
}
}
const activeTitle = document.getElementById("active-title");
if (activeTitle) activeTitle.textContent = course.title || "Course";
const activeAuthor = document.getElementById("active-author");
if (activeAuthor) activeAuthor.textContent = course.author || "Lucebra Instructor";
const studentsEl = document.getElementById("active-students");
const studentsDot = document.getElementById("active-students-dot");
if (studentsEl) {
if (course.students && typeof course.students === "string" && course.students.trim() !== "") {
studentsEl.textContent = course.students.trim();
studentsEl.style.display = "inline";
if (studentsDot) studentsDot.style.display = "inline";
} else {
studentsEl.textContent = "";
studentsEl.style.display = "none";
if (studentsDot) studentsDot.style.display = "none";
}
}
const instructorImg = document.getElementById("instructor-img");
if (instructorImg) {
const safeAvatar = sanitizeMediaUrl(course.instructorPhoto, placeholderAvatar);
instructorImg.onerror = function () {
this.onerror = null;
this.src = placeholderAvatar;
};
instructorImg.src = safeAvatar;
}
const learnBtn = document.getElementById("learn-btn");
if (learnBtn) {
learnBtn.href = sanitizeWebUrl(course.url, `https://www.lucebra.com/courses/${encodeURIComponent(course.id || "")}`);
}
}
let qrCheckTimer = null;
let qrCheckAttempts = 0;
function stopQrCheckTimer() {
if (qrCheckTimer) {
clearInterval(qrCheckTimer);
qrCheckTimer = null;
}
qrCheckAttempts = 0;
}
function renderUserAuthState(userObj) {
currentAuthUser = userObj || null;
const btnConnect = document.getElementById("btn-connect-account");
const badge = document.getElementById("user-profile-badge");
const avatarImg = document.getElementById("user-profile-avatar");
const nameSpan = document.getElementById("user-profile-name");
const planSpan = document.getElementById("user-profile-plan");
const loginModal = document.getElementById("lucebra-login-modal");
if (userObj && (userObj.fullName || userObj.email || userObj.userId)) {
if (btnConnect) btnConnect.style.display = "none";
if (badge) badge.classList.add("visible");
if (nameSpan) nameSpan.textContent = userObj.fullName || userObj.email || "Lucebra Student";
if (planSpan) {
const acctType = userObj.accountType || "";
if (acctType && acctType !== "Personal") {
planSpan.textContent = acctType;
planSpan.classList.add("visible");
} else {
planSpan.textContent = "";
planSpan.classList.remove("visible");
}
}
if (avatarImg) {
const safePhoto = sanitizeMediaUrl(userObj.profilePhoto, placeholderAvatar);
avatarImg.onerror = function () {
this.onerror = null;
this.src = placeholderAvatar;
};
avatarImg.src = safePhoto;
}
// Immediately auto-close the login modal & stop QR timer whenever authenticated
if (loginModal && loginModal.classList.contains("visible")) {
loginModal.classList.remove("visible");
}
stopQrCheckTimer();
fetchSavedWishlistIds();
if (pendingWishlistCourse) {
const targetCourse = pendingWishlistCourse;
pendingWishlistCourse = null;
toggleCourseWishlistInstant(targetCourse);
}
} else {
if (btnConnect) btnConnect.style.display = "inline-flex";
if (badge) badge.classList.remove("visible");
if (planSpan) {
planSpan.textContent = "";
planSpan.classList.remove("visible");
}
wishlistSavedCourseIds.clear();
const active = currentCourses[currentActiveIndex] || currentCourses[0];
updateWishlistButtonState(active ? active.id : null);
}
}
async function checkWidgetAuthStatus() {
try {
const res = await fetch("https://api.lucebra.com/mcp/widget-auth/status", {
method: "GET",
headers: { "Accept": "application/json" }
});
if (!res.ok) return;
const data = await res.json();
if (data && data.authenticated) {
renderUserAuthState(data.user || {
userId: data.userId,
fullName: data.fullName,
email: data.email,
profilePhoto: data.profilePhoto,
accountType: data.accountType
});
} else {
renderUserAuthState(null);
}
} catch (e) { }
}
function setupModals() {
const btnConnect = document.getElementById("btn-connect-account");
const modal = document.getElementById("lucebra-login-modal");
const btnClose = document.getElementById("btn-close-login-modal");
const form = document.getElementById("lucebra-login-form");
const emailInput = document.getElementById("login-email-input");
const emailLabel = document.getElementById("login-email-label");
const passInput = document.getElementById("login-password-input");
const errorBanner = document.getElementById("login-error-banner");
const btnSubmit = document.getElementById("btn-login-submit");
const btnDisconnect = document.getElementById("btn-disconnect-account");
const summaryEl = document.getElementById("chat-summary-text");
const tabPersonal = document.getElementById("tab-login-personal");
const tabOrg = document.getElementById("tab-login-org");
const subtitleEl = document.getElementById("login-modal-subtitle");
const btnQrToggle = document.getElementById("btn-qr-toggle");
const qrPanel = document.getElementById("qr-panel");
const qrImg = document.getElementById("qr-code-img");
const qrStatusText = document.getElementById("qr-status-text");
let selectedLoginType = "personal";
const setLoginTab = (mode) => {
selectedLoginType = mode;
if (tabPersonal) tabPersonal.classList.toggle("active", mode === "personal");
if (tabOrg) tabOrg.classList.toggle("active", mode === "organization");
if (mode === "organization") {
if (emailLabel) emailLabel.textContent = "Work / Organization Email";
if (emailInput) emailInput.placeholder = "name@company.com";
if (subtitleEl) {
subtitleEl.innerHTML = 'Sign in with your corporate credentials to access <b>Enterprise LMS</b> (<a href="https://www.enterprise.lucebra.com/" target="_blank" rel="noopener noreferrer">enterprise.lucebra.com</a>) or <a href="https://www.lucebra.com/organizational-login" target="_blank" rel="noopener noreferrer">Organization SSO</a>.';
}
} else {
if (emailLabel) emailLabel.textContent = "Email or Username";
if (emailInput) emailInput.placeholder = "you@example.com";
if (subtitleEl) {
subtitleEl.textContent = "Sign in with your Lucebra account to unlock instant Wishlist saving, Learning Progress, Certificates, and Personal/Team Plan enrollment.";
}
}
};
if (tabPersonal) tabPersonal.onclick = () => setLoginTab("personal");
if (tabOrg) tabOrg.onclick = () => setLoginTab("organization");
const closeModal = () => {
if (modal) modal.classList.remove("visible");
if (qrPanel) qrPanel.classList.remove("visible");
stopQrCheckTimer();
if (errorBanner) {
errorBanner.textContent = "";
errorBanner.classList.remove("visible");
}
};
if (btnConnect && modal) {
btnConnect.onclick = () => {
modal.classList.add("visible");
if (emailInput) setTimeout(() => emailInput.focus(), 50);
};
}
if (btnClose) btnClose.onclick = closeModal;
if (modal) {
modal.onclick = (ev) => {
if (ev.target === modal) closeModal();
};
}
// Bounded, lightweight QR Code login shortcut (Uses backend base64 / api.lucebra.com PNG, max 36 checks at 3.5s intervals while QR is open)
if (btnQrToggle && qrPanel) {
btnQrToggle.onclick = async () => {
const isNowVisible = !qrPanel.classList.contains("visible");
qrPanel.classList.toggle("visible", isNowVisible);
stopQrCheckTimer();
if (!isNowVisible) return;
if (qrStatusText) {
qrStatusText.innerHTML = "Generating secure QR code...";
}
try {
const res = await fetch("https://api.lucebra.com/mcp/widget-auth/qr", {
method: "GET",
headers: { "Accept": "application/json" }
});
const data = await res.json();
if (res.ok && data && data.deviceId) {
const fallbackApiPng = data.qrImageUrl || `https://api.lucebra.com/mcp/widget-auth/qr-image/${encodeURIComponent(data.deviceId)}.png`;
if (qrImg) {
qrImg.onerror = function() {
this.onerror = null;
if (data.qrCode && String(data.qrCode).startsWith("data:image/")) {
this.src = data.qrCode;
}
};
qrImg.src = fallbackApiPng;
}
if (qrStatusText) {
qrStatusText.innerHTML = 'Scan with the <a href="https://www.lucebra.com/mobile-app" target="_blank" rel="noopener noreferrer">Lucebra Mobile App</a> (iOS & Android) to sign in immediately.';
}
qrCheckAttempts = 0;
qrCheckTimer = setInterval(async () => {
if (!modal || !modal.classList.contains("visible") || !qrPanel.classList.contains("visible")) {
stopQrCheckTimer();
return;
}
qrCheckAttempts++;
if (qrCheckAttempts > 36) {
stopQrCheckTimer();
if (qrStatusText) {
qrStatusText.innerHTML = 'QR session expired. Click <b>Login with QR Code</b> above to refresh.';
}
return;
}
try {
const stRes = await fetch(`https://api.lucebra.com/mcp/widget-auth/qr-status/${encodeURIComponent(data.deviceId)}`, {
method: "GET",
headers: { "Accept": "application/json" }
});
if (!stRes.ok) return;
const stData = await stRes.json();
if (stData && stData.authenticated) {
stopQrCheckTimer();
renderUserAuthState(stData.user || stData);
closeModal();
}
} catch (e) { }
}, 3500);
}
} catch (e) {
if (qrStatusText) {
qrStatusText.textContent = "Could not load QR code right now.";
}
}
};
}
// Auto-sync when the user clicks "Personal Web Login →" or "Organization Login →" and signs in on www.lucebra.com
const startWebLoginSyncWatcher = () => {
stopQrCheckTimer();
qrCheckAttempts = 0;
qrCheckTimer = setInterval(async () => {
qrCheckAttempts++;
if (qrCheckAttempts > 30 || currentAuthUser) {
stopQrCheckTimer();
return;
}
try {
const stRes = await fetch("https://api.lucebra.com/mcp/widget-auth/status", {
method: "GET",
headers: { "Accept": "application/json" }
});
if (!stRes.ok) return;
const stData = await stRes.json();
if (stData && stData.authenticated) {
stopQrCheckTimer();
renderUserAuthState(stData.user || stData);
closeModal();
}
} catch (e) { }
}, 3000);
};
const linkWebPersonal = document.getElementById("link-web-personal-login");
const linkWebOrg = document.getElementById("link-web-org-login");
if (linkWebPersonal) linkWebPersonal.addEventListener("click", startWebLoginSyncWatcher);
if (linkWebOrg) linkWebOrg.addEventListener("click", startWebLoginSyncWatcher);
window.addEventListener("focus", () => {
if (!currentAuthUser && modal && modal.classList.contains("visible")) {
checkWidgetAuthStatusOnce();
}
});
if (form) {
form.onsubmit = async (ev) => {
ev.preventDefault();
const email = emailInput ? emailInput.value.trim() : "";
const password = passInput ? passInput.value : "";
if (!email || !password) return;
if (errorBanner) {
errorBanner.textContent = "";
errorBanner.classList.remove("visible");
}
if (btnSubmit) {
btnSubmit.disabled = true;
btnSubmit.textContent = "Signing in...";
}
try {
const res = await fetch("https://api.lucebra.com/mcp/widget-auth/login", {
method: "POST",
headers: { "Content-Type": "application/json", "Accept": "application/json" },
body: JSON.stringify({ email, password, loginType: selectedLoginType })
});
const data = await res.json();
if (res.ok && data && data.authenticated) {
renderUserAuthState(data.user || {
userId: data.userId,
fullName: data.fullName,
email: data.email,
profilePhoto: data.profilePhoto,
accountType: data.accountType
});
if (passInput) passInput.value = "";
closeModal();
if (summaryEl) {
summaryEl.textContent = `Connected as ${data.fullName || data.email} (${data.accountType || "Personal"}). You can now save courses to your Wishlist with 1 click or check your Progress & Business Plan.`;
}
} else {
if (errorBanner) {
errorBanner.textContent = (data && data.message) ? data.message : "Invalid email or password. Please try again.";
errorBanner.classList.add("visible");
}
}
} catch (err) {
if (errorBanner) {
errorBanner.textContent = "Could not reach Lucebra authentication service. You can also sign in via the browser link below.";
errorBanner.classList.add("visible");
}
} finally {
if (btnSubmit) {
btnSubmit.disabled = false;
btnSubmit.textContent = "Sign In & Connect";
}
}
};
}
if (btnDisconnect) {
btnDisconnect.onclick = async () => {
try {
await fetch("https://api.lucebra.com/mcp/widget-auth/logout", { method: "POST" });
} catch (e) { }
renderUserAuthState(null);
if (summaryEl) {
summaryEl.textContent = "Lucebra account disconnected. Click 'Connect Account' anytime to sign back in.";
}
};
}
// Wishlist Confirmation Modal close handlers
const wishModal = document.getElementById("lucebra-wishlist-modal");
const btnCloseWish = document.getElementById("btn-close-wishlist-modal");
const btnContWish = document.getElementById("btn-wishlist-continue");
const closeWishModal = () => {
if (wishModal) wishModal.classList.remove("visible");
};
if (btnCloseWish) btnCloseWish.onclick = closeWishModal;
if (btnContWish) btnContWish.onclick = closeWishModal;
if (wishModal) {
wishModal.onclick = (ev) => {
if (ev.target === wishModal) closeWishModal();
};
}
// Event-driven auth sync (Zero request storm: triggers only on postMessage from popup, window focus, or tab visibility)
window.addEventListener("message", (ev) => {
if (ev.data && ev.data.type === "lucebra-auth-connected") {
checkWidgetAuthStatus();
}
});
window.addEventListener("focus", () => {
checkWidgetAuthStatus();
});
document.addEventListener("visibilitychange", () => {
if (document.visibilityState === "visible") {
checkWidgetAuthStatus();
}
});
}
const updateFromResponse = (response) => {
const sc = response?.structuredContent || response;
if (sc && "currentUser" in sc) {
renderUserAuthState(sc.currentUser);
}
const list = sc?.courses || sc?.courseList || (Array.isArray(sc) ? sc : null);
if (Array.isArray(list)) {
renderPlaylist(list);
}
};
let rpcId = 0;
const pendingRequests = new Map();
let isBridgeInitialized = false;
let bridgeInitPromise = null;
const rpcNotify = (method, params) => {
if (!window.parent || window.parent === window) return;
window.parent.postMessage({ jsonrpc: "2.0", method, params }, "*");
};
const rpcRequest = (method, params, timeoutMs = 4000) =>
new Promise((resolve, reject) => {
if (!window.parent || window.parent === window) {
reject(new Error("No parent host window available for MCP bridge."));
return;
}
const id = ++rpcId;
const timer = setTimeout(() => {
if (pendingRequests.has(id)) {
pendingRequests.delete(id);
reject(new Error(`RPC request "${method}" timed out after ${timeoutMs}ms.`));
}
}, timeoutMs);
pendingRequests.set(id, { resolve, reject, timer });
window.parent.postMessage(
{ jsonrpc: "2.0", id, method, params },
"*"
);
});
window.addEventListener(
"message",
(event) => {
if (event.source !== window.parent) return;
const message = event.data;
if (!message || message.jsonrpc !== "2.0") return;
if (typeof message.id === "number" || typeof message.id === "string") {
const pending = pendingRequests.get(message.id);
if (pending) {
clearTimeout(pending.timer);
pendingRequests.delete(message.id);
if (message.error) {
pending.reject(message.error);
return;
}
pending.resolve(message.result);
return;
}
if (typeof message.method === "string") {
window.parent.postMessage({ jsonrpc: "2.0", id: message.id, result: {} }, "*");
return;
}
}
if (typeof message.method !== "string") return;
if (message.method === "ui/notifications/tool-result") {
updateFromResponse(message.params);
}
},
{ passive: true }
);
const initializeBridge = async () => {
if (isBridgeInitialized) return true;
if (!window.parent || window.parent === window) return false;
if (bridgeInitPromise) return bridgeInitPromise;
const protocolVersion = "2026-01-26";
bridgeInitPromise = (async () => {
try {
await rpcRequest("ui/initialize", {
appInfo: {
name: "lucebra-course-player",
version: "1.0.6"
},
appCapabilities: {},
protocolVersion
});
rpcNotify("ui/notifications/initialized", {});
isBridgeInitialized = true;
return true;
} catch (error) {
bridgeInitPromise = null;
return false;
}
})();
return bridgeInitPromise;
};
initializeBridge();
async function sendPromptToChat(promptText) {
const summaryEl = document.getElementById("chat-summary-text");
try {
const ready = await initializeBridge();
if (ready) {
await rpcRequest("ui/message", {
role: "user",
content: [{ type: "text", text: promptText }],
});
return true;
}
} catch (err) {
console.warn("ui/message failed:", err);
}
if (window.openai?.sendFollowUpMessage) {
try {
await window.openai.sendFollowUpMessage({ prompt: promptText });
return true;
} catch (e) {
console.warn("sendFollowUpMessage failed:", e);
}
}
if (summaryEl) {
summaryEl.textContent = "Chat host connection is not active in standalone view. Open this widget inside ChatGPT to send quick prompts.";
}
return false;
}
function setupActionChips() {
const btnCurriculum = document.getElementById("btn-show-curriculum");
const btnCompare = document.getElementById("btn-compare-courses");
const btnPrice = document.getElementById("btn-course-price");
const btnInstructor = document.getElementById("btn-instructor-info");
const btnExams = document.getElementById("btn-practice-exams");
const btnDigital = document.getElementById("btn-digital-products");
const btnLive = document.getElementById("btn-live-sessions");
const btnWishlist = document.getElementById("btn-save-wishlist");
const btnMyWishlist = document.getElementById("btn-my-wishlist");
const btnProgress = document.getElementById("btn-my-progress");
const btnCerts = document.getElementById("btn-my-certificates");
const btnBusiness = document.getElementById("btn-business-access");
const btnEnrollPlan = document.getElementById("btn-enroll-plan");
if (btnCurriculum) {
btnCurriculum.onclick = async () => {
const active = currentCourses[currentActiveIndex] || currentCourses[0];
if (active) {
await sendPromptToChat(`Show the curriculum, sections, and lessons for "${active.title}" on Lucebra.`);
}
};
}
if (btnCompare) {
btnCompare.onclick = async () => {
if (currentCourses.length >= 2) {
const c1 = currentCourses[currentActiveIndex] || currentCourses[0];
const c2 = currentActiveIndex === 0 ? currentCourses[1] : currentCourses[0];
await sendPromptToChat(`Compare these courses on Lucebra side-by-side in a table including instructor, level, content/duration, price (with regular and discount price if any), key topics, learning outcomes, and prerequisites:\n1. "${c1.title}"\n2. "${c2.title}"`);
} else if (currentCourses.length === 1) {
const c1 = currentCourses[0];
await sendPromptToChat(`Compare the course "${c1.title}" with relevant learning alternatives on Lucebra including price, discounts, duration, and outcomes.`);
}
};
}
if (btnPrice) {
btnPrice.onclick = async () => {
const active = currentCourses[currentActiveIndex] || currentCourses[0];
if (active) {
await sendPromptToChat(`Show the current price, regular price, and any active discounts for "${active.title}" on Lucebra.`);
}
};
}
if (btnInstructor) {
btnInstructor.onclick = async () => {
const active = currentCourses[currentActiveIndex] || currentCourses[0];
const instName = active?.author || active?.title || "Lucebra Instructor";
await sendPromptToChat(`Show the instructor profile, profile photo, biography, and published courses with prices for "${instName}" on Lucebra.`);
};
}
if (btnWishlist) {
btnWishlist.onclick = async () => {
const active = currentCourses[currentActiveIndex] || currentCourses[0];
if (!active) return;
await toggleCourseWishlistInstant(active);
};
}
if (btnMyWishlist) {
btnMyWishlist.onclick = async () => {
await sendPromptToChat("Show the saved courses in my Lucebra wishlist.");
};
}
if (btnProgress) {
btnProgress.onclick = async () => {
await sendPromptToChat("Show my enrolled courses and learning progress on Lucebra with Play Now links.");
};
}
if (btnCerts) {
btnCerts.onclick = async () => {
await sendPromptToChat("Show my verified course certificates and credentials on Lucebra.");
};
}
if (btnBusiness) {
btnBusiness.onclick = async () => {
await sendPromptToChat("Check my Lucebra Business / Enterprise LMS plan access, assigned courses, and remaining deadlines.");
};
}
if (btnEnrollPlan) {
btnEnrollPlan.onclick = async () => {
const active = currentCourses[currentActiveIndex] || currentCourses[0];
if (!active) return;
await enrollInCourseWithPlanInstant(active);
};
}
if (btnExams) {
btnExams.onclick = async () => {
await sendPromptToChat("Show Lucebra Exam Center certification categories and available standalone certification exams.");
};
}
if (btnDigital) {
btnDigital.onclick = async () => {
const active = currentCourses[currentActiveIndex] || currentCourses[0];
const topic = active?.category || active?.title || "";
await sendPromptToChat(topic
? `Show Digital Products (eBooks, audio guides, and study kits) on Lucebra related to "${topic}".`
: "Show Digital Products (eBooks, audio guides, and study kits) on Lucebra.");
};
}
if (btnLive) {
btnLive.onclick = async () => {
await sendPromptToChat("Check if there are any active or upcoming live sessions and webinars on Lucebra right now.");
};
}
const btnPlansPricing = document.getElementById("btn-plans-pricing");
const btnGetApp = document.getElementById("btn-get-app");
const btnSpotlightDaily = document.getElementById("btn-spotlight-daily");
const btnWriteArticles = document.getElementById("btn-write-articles");
if (btnPlansPricing) {
btnPlansPricing.onclick = async () => {
await sendPromptToChat(
"Explain Lucebra Personal, Team and Enterprise plans, their key differences, and current pricing with billing periods. Share the official plans page."
);
};
}
if (btnGetApp) {
btnGetApp.onclick = async () => {
await sendPromptToChat(
"Tell me about the Lucebra mobile app and share the official iOS and Android download links."
);
};
}
if (btnSpotlightDaily) {
btnSpotlightDaily.onclick = async () => {
await sendPromptToChat(
"What is Lucebra Spotlight Daily, and how can I watch it on the website and in the mobile app?"
);
};
}
if (btnWriteArticles) {
btnWriteArticles.onclick = async () => {
await sendPromptToChat(
"How can I write and publish articles on Lucebra? Explain the available features and share the official page."
);
};
}
}
setupModals();
setupActionChips();
checkWidgetAuthStatus();
const initialInstructorImg = document.getElementById("instructor-img");
if (initialInstructorImg) {
initialInstructorImg.onerror = function () {
this.onerror = null;
this.src = placeholderAvatar;
};
}
if (currentCourses.length > 0) {
renderPlaylist(currentCourses);
} else {
setVideoUnavailableState(true, "Select a course", "Choose a course to watch its lesson preview.");
updateWishlistButtonState(null);
}
})();
</script>
</body>
</html>
SHA-256: d18f532956933466071f4b4311ca0583cc8b31603c2d2ef7d3bc3a797d6fcbf1