const CONSENT_KEY = 'tkmind_legal_consent'; const CONSENT_VERSION = '1.0'; function getStoredConsent() { try { const stored = wx.getStorageSync(CONSENT_KEY); if (stored && typeof stored === 'object') { return stored; } } catch { // Ignore storage read errors. } return null; } function hasAcceptedLegalConsent() { const stored = getStoredConsent(); return stored?.accepted === true && stored?.version === CONSENT_VERSION; } function saveLegalConsent() { wx.setStorageSync(CONSENT_KEY, { accepted: true, version: CONSENT_VERSION, acceptedAt: new Date().toISOString(), }); } function clearLegalConsent() { wx.removeStorageSync(CONSENT_KEY); } function shouldSkipLoginConsent() { return hasAcceptedLegalConsent(); } module.exports = { CONSENT_VERSION, getStoredConsent, hasAcceptedLegalConsent, saveLegalConsent, clearLegalConsent, shouldSkipLoginConsent, };