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

New onboarding flow #1578

Merged
merged 10 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions backend/src/api/tenant/tenantCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export default async (req, res) => {
{
id: payload.id,
name: payload.name,
integrationsRequired: payload.integrationsRequired.map((i) => i.toLowerCase()),
communitySize: payload.communitySize,
onboard: !!payload.onboard,
},
{ ...req },
)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions frontend/src/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,6 @@ export default {
this.handleResize();
},

mounted() {
this.$router.isReady().then(() => {
const { ref } = this.$route.query;
if (ref && ref === 'eagle-eye') {
localStorage.setItem('onboardType', 'eagle-eye');
}
});
},

unmounted() {
window.removeEventListener('resize', this.handleResize);
},
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/integrations/devto/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export default {
borderColor: '#E5E7EB',
description:
'Connect DEV to sync profile information and comments on articles.',
onboard: {
description: 'Sync profile information and comments on articles.',
},
image:
'https://cdn-icons-png.flaticon.com/512/5969/5969051.png',
connectComponent: DevtoConnect,
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/integrations/discord/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export default {
borderColor: '#dee0fc',
description:
'Connect Discord to sync messages, threads, forum channels, and new joiners.',
onboard: {
description: 'Sync messages, threads, forum channels, and new joiners.',
},
image:
'https://cdn-icons-png.flaticon.com/512/5968/5968756.png',
connectComponent: DiscordConnect,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ const rules = {

const $externalResults = ref({});

const $v = useVuelidate(rules, form, { $externalResults });
const $v = useVuelidate(rules, form, { $externalResults, $stopPropagation: true });

// validate method
async function validate() {
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/integrations/discourse/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export default {
chartColor: '#FFDE92',
description:
'Connect Discourse to sync topics, posts, and replies from your account forums.',
onboard: {
description: 'Sync topics, posts, and replies from your account forums.',
},
image: '/images/integrations/discourse.png',
connectComponent: DiscourseConnect,
activityDisplay: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const form = reactive({
});

const { hasFormChanged, formSnapshot } = formChangeDetector(form);
const $v = useVuelidate({}, form);
const $v = useVuelidate({}, form, { $stopPropagation: true });

const { doGitConnect } = mapActions('integration');
const isVisible = computed({
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/integrations/git/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export default {
borderColor: '#FFFFFF',
description:
'Connect Git to sync commit activities from your repos.',
onboard: {
description: 'Sync commit activities from your repos.',
},
image:
'/images/integrations/git.png',
connectComponent: GitConnect,
Expand Down
14 changes: 10 additions & 4 deletions frontend/src/integrations/github/components/github-connect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
import { computed } from 'vue';
import config from '@/config';
import ConfirmDialog from '@/shared/dialog/confirm-dialog';
import { useRouter } from 'vue-router';
import { useRoute, useRouter } from 'vue-router';

const emit = defineEmits(['inviteColleagues']);
defineProps({
integration: {
type: Object,
default: () => {},
},
});

const route = useRoute();
const router = useRouter();

// We have 3 GitHub apps: test, test-local and prod
Expand Down Expand Up @@ -42,9 +44,13 @@ const connect = () => {
window.open(githubConnectUrl.value, '_self');
}).catch((action) => {
if (action === 'cancel') {
router.push({
name: 'settings',
});
if (route.name === 'onboard') {
emit('inviteColleagues');
} else {
router.push({
name: 'settings',
});
}
}
});
};
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/integrations/github/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ export default {
borderColor: '#E5E7EB',
description:
'Connect GitHub to sync profile information, stars, forks, pull requests, issues, and discussions.',
onboard: {
description: `GitHub is one of the richest places for developer activity and information.
Connect GitHub to track all relevant activities with no historical import limitations like repo stars, discussions, comments, and more.`,
image: '/images/integrations/onboard/onboard-github-preview.png',
highlight: true,
},
image:
'https://cdn-icons-png.flaticon.com/512/25/25231.png',
connectComponent: GithubConnect,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const removeGroup = (index) => {
form.groups.splice(index, 1);
};

const $v = useVuelidate(rules, form);
const $v = useVuelidate(rules, form, { $stopPropagation: true });

const validateAccount = async () => {
isVerifyingAccount.value = true;
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/integrations/hackernews/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export default {
borderColor: '#ffdecf',
description:
'Connect Hacker News to get posts as well as their comments mentioning your community.',
onboard: {
description: 'Get posts as well as their comments mentioning your community.',
},
image: '/images/integrations/hackernews.svg',
connectComponent: HackerNewsConnect,
url: ({ username }) => (username ? `https://news.ycombinator.com/user?id=${username}` : null),
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/integrations/n8n/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export default {
backgroundColor: '#FFFFFF',
borderColor: '#FFFFFF',
description: 'Use n8n to connect crowd.dev with 250+ apps and services.',
onboard: {
description: 'Connect crowd.dev with 250+ apps and services.',
},
image:
'https://asset.brandfetch.io/idO6_6uqJ9/id9y5Acqtx.svg',
connectComponent: N8nConnect,
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/integrations/reddit/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export default {
borderColor: '#ffd8ca',
description:
'Connect Reddit to sync posts and comments from selected subreddits.',
onboard: {
description: 'Sync posts and comments from selected subreddits.',
},
image: '/images/integrations/reddit.svg',
connectComponent: RedditConnect,
url: ({ username }) => (username ? `https://reddit.com/user/${username}` : null),
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/integrations/slack/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export default {
borderColor: '#E5E7EB',
description:
'Connect Slack to sync messages, threads, and new joiners.',
onboard: {
description: 'Sync messages, threads, and new joiners.',
},
image:
'https://cdn-icons-png.flaticon.com/512/3800/3800024.png',
connectComponent: SlackConnect,
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/integrations/stackoverflow/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export default {
borderColor: '#FFFFFF',
description:
'Connect Stack Overflow to sync questions and answers based on selected tags.',
onboard: {
description: 'Sync questions and answers based on selected tags.',
},
image:
'https://cdn-icons-png.flaticon.com/512/2111/2111628.png',
connectComponent: StackOverflowConnect,
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/integrations/zapier/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export default {
backgroundColor: '#FFFFFF',
borderColor: '#FFFFFF',
description: 'Use Zapier to connect crowd.dev with 5,000+ apps.',
onboard: {
description: 'Connect crowd.dev with 5,000+ apps.',
},
image:
'https://www.seekpng.com/png/full/67-672759_zapiers-new-cli-tool-for-creating-apps-zapier.png',
connectComponent: ZapierConnect,
Expand Down
102 changes: 0 additions & 102 deletions frontend/src/jsons/onboard-platforms.json

This file was deleted.

22 changes: 0 additions & 22 deletions frontend/src/jsons/tenant-community-size.json

This file was deleted.

19 changes: 14 additions & 5 deletions frontend/src/middleware/auth/auth-guard.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ function isGoingToIntegrationsPage(to) {
* @param router
* @returns {Promise<*>}
*/
export default async function ({ to, store, router }) {
export default async function ({
to, from, store, router,
}) {
if (!to.meta || !to.meta.auth) {
return;
}
Expand Down Expand Up @@ -71,6 +73,16 @@ export default async function ({ to, store, router }) {
)
&& !tenantSubdomain.isSubdomain
) {
// Protect onboard routes if user is already onboarded
if ((to.path === '/onboard' || (from.path !== '/onboard' && to.path === '/onboard/demo'))
&& (!permissionChecker.isEmptyTenant && store.getters['auth/currentTenant'].onboardedAt)) {
router.push('/');
}

if (to.path === '/onboard/demo' && (permissionChecker.isEmptyTenant || !store.getters['auth/currentTenant'].onboardedAt)) {
router.push('/onboard');
}

if (
to.path !== '/onboard'
&& permissionChecker.isEmailVerified
Expand All @@ -80,10 +92,7 @@ export default async function ({ to, store, router }) {
router.push({
path: '/onboard',
query: isGoingToIntegrationsPage(to)
? {
selectedDataType: 'real',
...to.query,
}
? to.query
: undefined,
});
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/modules/auth/pages/invitation-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default {
token,
forceAcceptOtherEmail,
)
.then((tenant) => this.doSelectTenant(tenant))
.then((tenant) => this.doSelectTenant({ tenant }))
.then(() => {
this.warningMessage = null;
this.loading = false;
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/modules/auth/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export default {
});
},

async doSelectTenant({ dispatch }, tenant) {
async doSelectTenant({ dispatch }, { tenant, redirect = true }) {
if (tenantSubdomain.isEnabled) {
tenantSubdomain.redirectAuthenticatedTo(tenant.url);
return;
Expand All @@ -261,7 +261,9 @@ export default {

store.replaceState(initialState);

router.push('/');
if (redirect) {
router.push('/');
}
},

clearTenant({ commit }) {
Expand Down
Loading
Loading