Skip to content

Commit

Permalink
Add short version of the onboarding (#1409)
Browse files Browse the repository at this point in the history
  • Loading branch information
smalluban authored Dec 11, 2023
1 parent a69220a commit 956bfe8
Show file tree
Hide file tree
Showing 9 changed files with 260 additions and 23 deletions.
12 changes: 12 additions & 0 deletions extension-manifest-v2/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,9 @@
"ghostery_is_disabled": {
"message": "Ghostery is disabled"
},
"ghostery_is_installed_with_limited_functionality": {
"message": "Ghostery is installed with limited functionality"
},
"ghostery_is_ready": {
"message": "Ghostery is Ready!"
},
Expand All @@ -821,6 +824,9 @@
"ghostery_stops_trackers_in_their_tracks_and_prevents_you_from_being_profiled_by_data_brokers_": {
"message": "Ghostery stops trackers in their tracks and prevents you from being profiled by data brokers."
},
"ghostery_tracker___ad_blocker_is_naming_the_trackers_present_on_websites_you_visit__you_are_browsing_the_web_unprotected_": {
"message": "Ghostery Tracker & Ad Blocker is naming the trackers present on websites you visit. You are browsing the web unprotected."
},
"ghostery_will_show_how_many_trackers_were_blocked_on_a_page__clicking_on_the_ghostery_icon_reveals_more_detailed_information_": {
"message": "Ghostery will show how many trackers were blocked on a page. Clicking on the Ghostery icon reveals more detailed information."
},
Expand Down Expand Up @@ -858,6 +864,9 @@
"information_about_web_trackers_will_be_shared_in_accordance_with_our__a_href__@_0___privacy_policy__a_": {
"message": "Information about web trackers will be shared in accordance with our <a href=\"$${0}\">Privacy Policy</a>"
},
"information_about_web_trackers_will_be_shared_in_accordance_with_our__a_href__@_0___privacy_policy__a___advancing_privacy_protection_for_the_ghostery_community_": {
"message": "Information about web trackers will be shared in accordance with our <a href=\"$${0}\">Privacy Policy</a>, advancing privacy protection for the Ghostery community."
},
"invalid_email_forgot": {
"message": "Sorry, you have to enter a real email address."
},
Expand Down Expand Up @@ -1971,6 +1980,9 @@
"whotracks_me_statistical_report": {
"message": "WhoTracks.Me Statistical Report"
},
"without_privacy_features_enabled__only_basic_functionality_of_naming_trackers_is_available_": {
"message": "Without privacy features enabled, only basic functionality of naming trackers is available."
},
"yes": {
"message": "Yes"
},
Expand Down
45 changes: 25 additions & 20 deletions extension-manifest-v2/app/onboarding/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { mount, html, store } from 'hybrids';
import { mount, html } from 'hybrids';
import { getBrowserInfo } from '@ghostery/libs';

import '@ghostery/ui/onboarding';
import '@ghostery/ui/onboarding/short';
import './styles.scss';

const renew = new URLSearchParams(window.location.search).get('renew') === '1';
Expand All @@ -22,23 +23,27 @@ function skip() {
});
}

const BrowserInfo = {
name: '',
[store.connect]: getBrowserInfo,
};

mount(document.body, {
browserInfo: store(BrowserInfo),
content: ({ browserInfo }) => (
store.pending(browserInfo)
? html``
: html`
<ui-onboarding
platform="${store.ready(browserInfo) ? browserInfo.name : ''}"
renew=${renew}
onsuccess="${complete}"
onskip="${skip}"
></ui-onboarding>
`
),
getBrowserInfo().then(({ name }) => {
if (name.toLowerCase() === 'firefox') {
mount(document.body, {
content: () => html`
<ui-onboarding-short
platform="${name}"
onsuccess="${complete}"
onskip="${skip}"
></ui-onboarding-short>
`,
});
} else {
mount(document.body, {
content: () => html`
<ui-onboarding
platform="${name}"
renew=${renew}
onsuccess="${complete}"
onskip="${skip}"
></ui-onboarding>
`,
});
}
});
12 changes: 12 additions & 0 deletions extension-manifest-v3/src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@
"ghostery_is_disabled": {
"message": "Ghostery is disabled"
},
"ghostery_is_installed_with_limited_functionality": {
"message": "Ghostery is installed with limited functionality"
},
"ghostery_is_paused_on_this_site_": {
"message": "Ghostery is paused on this site."
},
Expand All @@ -222,6 +225,9 @@
"ghostery_stops_trackers_in_their_tracks_and_prevents_you_from_being_profiled_by_data_brokers_": {
"message": "Ghostery stops trackers in their tracks and prevents you from being profiled by data brokers."
},
"ghostery_tracker___ad_blocker_is_naming_the_trackers_present_on_websites_you_visit__you_are_browsing_the_web_unprotected_": {
"message": "Ghostery Tracker & Ad Blocker is naming the trackers present on websites you visit. You are browsing the web unprotected."
},
"ghostery_will_be_paused_on_this_site__you_can_change_this_at_any_time_in_ghostery_settings_to_stop_trackers_and_ads_from_tracking_you_around_the_web": {
"message": "Ghostery will be paused on this site. You can change this at any time in Ghostery settings to stop trackers and ads from tracking you around the web"
},
Expand Down Expand Up @@ -256,6 +262,9 @@
"information_about_web_trackers_will_be_shared_in_accordance_with_our__a_href__@_0___privacy_policy__a_": {
"message": "Information about web trackers will be shared in accordance with our <a href=\"$${0}\">Privacy Policy</a>"
},
"information_about_web_trackers_will_be_shared_in_accordance_with_our__a_href__@_0___privacy_policy__a___advancing_privacy_protection_for_the_ghostery_community_": {
"message": "Information about web trackers will be shared in accordance with our <a href=\"$${0}\">Privacy Policy</a>, advancing privacy protection for the Ghostery community."
},
"it_exists_thanks_to_micro_contributions_of_every_ghostery_user_who_chooses_to_send_non_personal_information_to_whotracks_me__the_input_enables_ghostery_to_provide_real_time_intel_on_trackers_which_in_turn_provides_protection_to_the_entire_ghostery_community_": {
"message": "It exists thanks to micro-contributions of every Ghostery user who chooses to send non-personal information to WhoTracks.Me. The input enables Ghostery to provide real-time intel on trackers which in turn provides protection to the entire Ghostery community."
},
Expand Down Expand Up @@ -523,6 +532,9 @@
"whotracks_me_wheel": {
"message": "WhoTracks.Me Wheel"
},
"without_privacy_features_enabled__only_basic_functionality_of_naming_trackers_is_available_": {
"message": "Without privacy features enabled, only basic functionality of naming trackers is available."
},
"yes": {
"message": "Yes"
},
Expand Down
1 change: 1 addition & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"exports": {
"./autoconsent": "./src/modules/autoconsent/index.js",
"./onboarding": "./src/modules/onboarding/index.js",
"./onboarding/short": "./src/modules/onboarding/short.js",
"./pages": "./src/modules/pages/index.js",
"./panel": "./src/modules/panel/index.js",
"./settings": "./src/modules/settings/index.js",
Expand Down
7 changes: 4 additions & 3 deletions packages/ui/src/modules/global/components/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
type: 'primary',
size: '',
disabled: false,
render: ({ size }) => html`<slot></slot>`.css`
render: () => html`<slot></slot>`.css`
:host {
box-sizing: border-box;
display: grid;
Expand All @@ -24,7 +24,7 @@ export default {
border-radius: 24px;
white-space: nowrap;
transition: opacity 0.2s, color 0.2s, background-color 0.2s, border-color 0.2s;
font: var(--ui-font-button-${size === 'small' ? 's' : 'm'});
font: var(--ui-font-button-m);
text-transform: uppercase;
}
Expand Down Expand Up @@ -65,7 +65,7 @@ export default {
--ui-button-hover-background: var(--ui-color-white);
}
@media (hover: hover) and (pointer: fine) {
@media (hover: hover) and (pointer: fine) {
:host(:hover), :host(:focus-within) {
color: var(--ui-button-hover-color);
border-color: var(--ui-button-hover-border);
Expand All @@ -79,6 +79,7 @@ export default {
:host([size="small"]) {
height: 40px;
font: var(--ui-font-button-s);
}
:host([disabled]) {
Expand Down
25 changes: 25 additions & 0 deletions packages/ui/src/modules/onboarding/components/error-card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Ghostery Browser Extension
* https://www.ghostery.com/
*
* Copyright 2017-present Ghostery GmbH. All rights reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0
*/

import { html } from 'hybrids';

export default {
render: () => html`
<template layout="column padding:1.5 gap:2">
<slot></slot>
</template>
`.css`
:host {
border-radius: 8px;
background: rgba(255, 93, 53, 0.15);
}
`,
};
55 changes: 55 additions & 0 deletions packages/ui/src/modules/onboarding/short.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* Ghostery Browser Extension
* https://www.ghostery.com/
*
* Copyright 2017-present Ghostery GmbH. All rights reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0
*/

import { define, dispatch, html, router } from 'hybrids';

import Main from './views/short/main.js';
import OutroSkip from './views/short/outro-skip.js';
import OutroSuccess from './views/outro-success.js';

define(Main);
define(OutroSkip);

export default define({
tag: 'ui-onboarding-short',
platform: '',
views: router([Main, OutroSuccess], {
params: ['platform'],
}),
state: {
value: '',
connect: (host) => {
function cb(event) {
switch (event.detail.entry.id) {
case OutroSkip.tag:
dispatch(host, 'skip');
break;
case OutroSuccess.tag:
dispatch(host, 'success');
break;
default:
break;
}
}

host.addEventListener('navigate', cb);

return () => host.removeEventListener('navigate', cb);
},
},
content: ({ views }) => html`
<template layout="grid height::100%">
<ui-onboarding-layout>${views}</ui-onboarding-layout>
</template>
`.css`
ui-text a { text-decoration: underline }
`,
});
84 changes: 84 additions & 0 deletions packages/ui/src/modules/onboarding/views/short/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/**
* Ghostery Browser Extension
* https://www.ghostery.com/
*
* Copyright 2017-present Ghostery GmbH. All rights reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0
*/

import { define, html, msg, router } from 'hybrids';

import Privacy from '../privacy.js';
import OutroSkip from './outro-skip.js';
import OutroSuccess from '../outro-success.js';

const TERMS_AND_CONDITIONS_URL =
'https://www.ghostery.com/privacy/ghostery-terms-and-conditions?utm_source=gbe';

export default define({
[router.connect]: { stack: [Privacy, OutroSkip] },
tag: 'ui-onboarding-short-main-view',
content: () => html`
<template layout="grow column gap">
<ui-onboarding-card>
<div layout="column gap:5">
<section layout="block:center column gap">
<ui-text type="body-l" layout="margin:top:2">
Welcome to Ghostery
</ui-text>
<ui-text type="display-m" layout="margin:bottom:5">
Enable Ghostery to get started
</ui-text>
</section>
</div>
<div layout="column gap:3">
<div layout="column gap">
<ui-text type="display-2xs" layout="block:center">
Your Privacy Features:
</ui-text>
<div layout="grid:3 gap">
<ui-onboarding-feature icon="onboarding-adblocking">
Ad-Blocking
</ui-onboarding-feature>
<ui-onboarding-feature icon="onboarding-anti-tracking">
Anti-Tracking
</ui-onboarding-feature>
<ui-onboarding-feature icon="onboarding-never-consent">
Never-Consent
</ui-onboarding-feature>
</div>
</div>
<ui-text underline>
${msg.html`
Information about web trackers will be shared in accordance with our <a href="${router.url(
Privacy,
)}">Privacy Policy</a>, advancing privacy protection for the Ghostery community.
`}
</ui-text>
<div layout="column gap:3">
<ui-button type="success" size="small">
<a href="${router.url(OutroSuccess)}">Enable Ghostery</a>
</ui-button>
<ui-onboarding-error-card>
<ui-text type="label-s" color="error-500" layout="block:center">
Without privacy features enabled, only basic functionality of
naming trackers is available.
</ui-text>
<ui-button type="outline-error" size="small">
<a href="${router.url(OutroSkip)}">Keep disabled</a>
</ui-button>
</ui-onboarding-error-card>
</div>
</div>
</ui-onboarding-card>
<ui-text layout="block:center margin:3:0" underline>
<a href="${TERMS_AND_CONDITIONS_URL}" target="_blank">
Terms & Conditions
</a>
</ui-text>
</template>
`,
});
42 changes: 42 additions & 0 deletions packages/ui/src/modules/onboarding/views/short/outro-skip.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* Ghostery Browser Extension
* https://www.ghostery.com/
*
* Copyright 2017-present Ghostery GmbH. All rights reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0
*/

import { define, html } from 'hybrids';

import disabled from '../../illustrations/disabled.js';

const TERMS_AND_CONDITIONS_URL =
'https://www.ghostery.com/privacy/ghostery-terms-and-conditions?utm_source=gbe';

export default define({
tag: 'ui-onboarding-outro-short-skip-view',
content: () => html`
<template layout="block">
<ui-onboarding-card>
<section layout="block:center column gap:2">
<div layout="row center">${disabled}</div>
<ui-text type="display-s" color="error-500">
Ghostery is installed with limited functionality
</ui-text>
<ui-text type="body-m" color="gray-800">
Ghostery Tracker & Ad Blocker is naming the trackers present on
websites you visit. You are browsing the web unprotected.
</ui-text>
</section>
</ui-onboarding-card>
<ui-text layout="block:center margin:3:0" underline>
<a href="${TERMS_AND_CONDITIONS_URL}" target="_blank">
Terms & Conditions
</a>
</ui-text>
</template>
`,
});

0 comments on commit 956bfe8

Please sign in to comment.