Publish Container / docker (push) Failing after 10m40s
- Remove unused prop-types dep, deprecated useOutboundLinkTracking export - Fix missing linkClicks key in analyticsEvents initial state (B-01) - Export ADMIN_SESSION_COOKIE from auth.js; remove local copy in admin-auth.js (D-02) - Remove cookieFlags() wrapper in auth.js and study-helpers.js; use cookieSecureFlag() directly (U-04) - Remove ADMIN_SESSION_TTL_MS duplicate from config.js (D-01) - Remove DEFAULT_SEO/DEFAULT_LEGAL/DEFAULT_REDIRECT_RULES/DEFAULT_PODCAST_FEATURED_LINKS/DEFAULT_PUBLISH_STATE duplicates from config.js; re-export from helpers.js (D-04, fixes sitemapPaths divergence) - Fix email.js hardcoded fallback strings to use DEFAULT_RESEND_TO/DEFAULT_RESEND_REPLY_TO (M-02) - Remove duplicate normalizeIp, isPrivateOrLocalIp, normalizeRedirectPath, sanitizeUrl, sanitizeRedirectRules bodies from study-helpers.js; re-export from helpers.js (D-03) - Fix pruneStatsByDays to import VISITOR_RETENTION_DAYS_DEFAULT from config.js (B-02) - Fix createTitusDownloadToken to use DOWNLOAD_TOKEN_TTL_MS constant (B-03) - Remove normalizeMessageType duplicate from study-helpers.js (U-03/D-08) - Remove dead wantsWelcome variable in contact.js; use shouldSendWelcome (B-04) - Replace dynamic imports in contact.js with static imports (B-07) - Remove dead wantsWelcome=true in study-auth.js (B-05) - Merge duplicate import blocks in analytics.js and public.js (D-05, D-06) - Replace dynamic readFile re-import in nuggets-host-upload.js (B-06) - Replace hardcoded SITE_URL fallbacks with getCanonicalBaseUrl() (M-06) - Replace raw resend.emails.send in study-account.js with sendResendEmailWithRetry (M-01) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
124 lines
3.7 KiB
JavaScript
124 lines
3.7 KiB
JavaScript
import {
|
|
EMPTY_HIT_STATS,
|
|
EMPTY_VISITOR_STATS,
|
|
DEFAULT_PUBLISH_STATE,
|
|
DEFAULT_REPLY_TEMPLATES,
|
|
buildDefaultPodcastChecklist,
|
|
} from './config.js'
|
|
|
|
export const state = {
|
|
cachedSiteContent: null,
|
|
cachedDraftSiteContent: null,
|
|
publishState: { ...DEFAULT_PUBLISH_STATE },
|
|
|
|
hitStats: { ...EMPTY_HIT_STATS },
|
|
hitStatsWritePromise: Promise.resolve(),
|
|
lastHitStatsWrite: { ok: true, at: null, error: null },
|
|
|
|
visitorStats: { ...EMPTY_VISITOR_STATS },
|
|
visitorStatsWritePromise: Promise.resolve(),
|
|
lastVisitorStatsWrite: { ok: true, at: null, error: null },
|
|
|
|
contactSubmissions: [],
|
|
contactSubmissionsWritePromise: Promise.resolve(),
|
|
|
|
questions: [],
|
|
questionsWritePromise: Promise.resolve(),
|
|
|
|
draftQuestions: null,
|
|
draftQuestionsWritePromise: Promise.resolve(),
|
|
|
|
replyTemplates: [...DEFAULT_REPLY_TEMPLATES],
|
|
replyTemplatesWritePromise: Promise.resolve(),
|
|
|
|
replyHistory: [],
|
|
replyHistoryWritePromise: Promise.resolve(),
|
|
|
|
podcastChecklist: buildDefaultPodcastChecklist(),
|
|
podcastChecklistWritePromise: Promise.resolve(),
|
|
|
|
studyUsers: [],
|
|
studyUsersWritePromise: Promise.resolve(),
|
|
|
|
studyCommunityPosts: [],
|
|
studyCommunityWritePromise: Promise.resolve(),
|
|
|
|
studyReminders: { users: {}, updatedAt: new Date().toISOString() },
|
|
studyRemindersWritePromise: Promise.resolve(),
|
|
|
|
studyComments: [],
|
|
studyCommentsWritePromise: Promise.resolve(),
|
|
|
|
studyCertificates: [],
|
|
studyCertificatesWritePromise: Promise.resolve(),
|
|
|
|
// episodeScripts: { [episodeNumber]: { text, title, filename, uploadedAt } }
|
|
episodeScripts: {},
|
|
episodeScriptsWritePromise: Promise.resolve(),
|
|
|
|
downloadCounts: {},
|
|
downloadCountsWritePromise: Promise.resolve(),
|
|
|
|
// episodePlays: { [title]: { total: number, byDay: { [YYYY-MM-DD]: number } } }
|
|
episodePlays: {},
|
|
episodePlaysWritePromise: Promise.resolve(),
|
|
|
|
// analyticsEvents: aggregated engagement data from frontend events
|
|
// {
|
|
// scrollDepth: { [path]: { 25: n, 50: n, 75: n, 90: n } }
|
|
// timeOnPage: { [path]: { totalSeconds: n, count: n } }
|
|
// outboundClicks: { [url]: n }
|
|
// utmSources: { [utm_source]: n }
|
|
// searchQueries: { [query]: n }
|
|
// notFound: { [path]: n }
|
|
// audioEvents: { [title]: { pauses: n, completions: n, totalListenSeconds: n } }
|
|
// }
|
|
analyticsEvents: {
|
|
scrollDepth: {},
|
|
timeOnPage: {},
|
|
outboundClicks: {},
|
|
utmSources: {},
|
|
searchQueries: {},
|
|
notFound: {},
|
|
audioEvents: {},
|
|
linkClicks: {},
|
|
},
|
|
analyticsEventsWritePromise: Promise.resolve(),
|
|
|
|
// qrCodes: Array<{ id, slug, label, destination, createdAt }>
|
|
// qrScans: Array<{ id, qrId, slug, scannedAt, ip, userAgent }>
|
|
qrCodes: [],
|
|
qrScans: [],
|
|
qrCodesWritePromise: Promise.resolve(),
|
|
|
|
emailSettings: { signature: 'Grace and peace,\nVerse by Verse with Nate' },
|
|
emailSettingsWritePromise: Promise.resolve(),
|
|
|
|
calendarEvents: [],
|
|
calendarEventsWritePromise: Promise.resolve(),
|
|
|
|
auditLog: [],
|
|
auditLogWritePromise: Promise.resolve(),
|
|
|
|
webhooks: [],
|
|
webhooksWritePromise: Promise.resolve(),
|
|
|
|
lastBackupStatus: { ok: true, at: null, error: null, file: null },
|
|
lastCachePurgeStatus: { ok: true, at: null, error: null },
|
|
lastDeployHookStatus: { ok: true, at: null, error: null },
|
|
|
|
// In-memory caches (not persisted between restarts)
|
|
studyNotesCache: new Map(), // userId -> { [sectionId]: string }
|
|
studyNotesWriteQueues: new Map(), // userId -> Promise
|
|
studyProgressCache: new Map(), // userId -> { byStudy: ... }
|
|
studyProgressWriteQueues: new Map(), // userId -> Promise
|
|
|
|
studySessions: new Map(),
|
|
studyTotpPendingTokens: new Map(),
|
|
emailOtpStore: new Map(),
|
|
|
|
titusDownloadTokens: new Map(),
|
|
contactSubmitCooldownByEmail: new Map(),
|
|
resendEmailSubmissionIndex: new Map(),
|
|
}
|