Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added checkbox #2013

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Button, ButtonGroup, Divider, LegacyCard, Text, VerticalStack, HorizontalGrid, HorizontalStack, Scrollable, TextField, Tag, Form, Tooltip } from '@shopify/polaris'
import { Box, Button, ButtonGroup, Divider, LegacyCard, Text, VerticalStack, HorizontalGrid, HorizontalStack, Scrollable, TextField, Tag, Form, Tooltip, Checkbox } from '@shopify/polaris'
import React, { useEffect, useState } from 'react'
import settingFunctions from '../module'
import Dropdown from '../../../components/layouts/Dropdown'
Expand Down Expand Up @@ -40,6 +40,9 @@ function About() {
const [accountName, setAccountName] = useState('')
const [currentTimeZone, setCurrentTimeZone] = useState('')
const [toggleCaseSensitiveApis, setToggleCaseSensitiveApis] = useState(false)
const [isSubscribed, setIsSubscribed] = useState(() => {
return localStorage.getItem('isSubscribed') === 'true'
})

const initialUrlsList = settingFunctions.getRedundantUrlOptions()
const [selectedUrlList, setSelectedUrlsList] = useState([])
Expand Down Expand Up @@ -169,6 +172,28 @@ function About() {
</VerticalStack>
</Box>
))}
<Checkbox
label="Subscribe to updates"
checked={isSubscribed}
onChange={() => {
const userProps = {}
let subsKey = window.DASHBOARD_MODE === 'ON_PREM' ? "mono_subscribed" : "akto_subscribed"
userProps[subsKey] = "yes"
if (window.Intercom) {
window.Intercom("update", userProps)
window.Intercom("trackEvent", subsKey)
}

if (window.mixpanel) {
window.mixpanel.people.set(userProps);
}
setIsSubscribed(!isSubscribed)
localStorage.setItem('isSubscribed', (!isSubscribed).toString())
if (!isSubscribed) {
func.setToast(true, false, "Successfully subscribed to updates")
}
}}
/>
</VerticalStack>
)

Expand Down
Loading