/* Copyright 2021 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import BaseDialog from "./BaseDialog"; import { _t } from "../../../languageHandler"; import DialogButtons from "../elements/DialogButtons"; import React from "react"; import Modal from "../../../Modal"; import SdkConfig from "../../../SdkConfig"; export enum ButtonClicked { Primary, Cancel, } interface IProps { onFinished?(buttonClicked?: ButtonClicked): void; analyticsOwner: string; privacyPolicyUrl?: string; primaryButton?: string; cancelButton?: string; hasCancel?: boolean; } const AnalyticsLearnMoreDialog: React.FC = ({ onFinished, analyticsOwner, privacyPolicyUrl, primaryButton, cancelButton, hasCancel, }) => { const onPrimaryButtonClick = () => onFinished && onFinished(ButtonClicked.Primary); const onCancelButtonClick = () => onFinished && onFinished(ButtonClicked.Cancel); const privacyPolicyLink = privacyPolicyUrl ? { _t("You can read all our terms here", {}, { "PrivacyPolicyUrl": (sub) => { return { sub } ; }, }) } : ""; return
{ _t("Help us identify issues and improve Element by sharing anonymous usage data. " + "To understand how people use multiple devices, we'll generate a random identifier, " + "shared by your devices.", ) }
  • { _t("We don't record or profile any account data", {}, { "Bold": (sub) => { sub } }) }
  • { _t("We don't share information with third parties", {}, { "Bold": (sub) => { sub } }) }
  • { _t("You can turn this off anytime in settings") }
{ privacyPolicyLink }
; }; export const showDialog = (props: Omit): void => { const privacyPolicyUrl = SdkConfig.get().piwik?.policyUrl; const analyticsOwner = SdkConfig.get().analyticsOwner ?? SdkConfig.get().brand; Modal.createTrackedDialog( "Analytics Learn More", "", AnalyticsLearnMoreDialog, { privacyPolicyUrl, analyticsOwner, ...props }, "mx_AnalyticsLearnMoreDialog_wrapper", ); }; export default AnalyticsLearnMoreDialog;