/** * notion-enhancer * (c) 2023 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ // telemetry endpoint not ready, disabled for current release import { collectTelemetryData } from "../../sendTelemetry.mjs"; import { Option } from "./Options.mjs"; const privacyPolicy = "https://notion-enhancer.github.io/about/privacy-policy/"; function Telemetry() { const { html, setState, useState, initDatabase } = globalThis.__enhancerApi, _get = async () => { // defaults to true, must be explicitly set to false to disable return (await initDatabase().get("telemetryEnabled")) ?? true; }, _set = async (value) => { await initDatabase().set("telemetryEnabled", value); setState({ rerender: true }); }; const $ = { platform: html``, version: html``, timezone: html``, enabled_mods: html``, }; useState(["rerender"], async () => { const telemetryData = await collectTelemetryData(); for (const key in telemetryData) { $[key].innerText = JSON.stringify(telemetryData[key]); } }); return html`<${Option} type="toggle" label="Telemetry" description=${html`If telemetry is enabled, usage data will be collected at a regular interval from your device in order to better understand how and where the notion-enhancer is used. This data is anonymous and includes only your platform (${$.platform}), notion-enhancer version (${$.version}), timezone (${$.timezone}), and enabled mods (${$.enabled_mods}). You can opt in or out of telemetry at any time. This setting syncs across configuration profiles. For more information, read the notion-enhancer's privacy policy.`} ...${{ _get, _set }} />`; } export { Telemetry };