From 50c9f4c85a65f52430c5a32537e9aefe3a2089b1 Mon Sep 17 00:00:00 2001 From: Wilfred Asomani Date: Tue, 7 Nov 2023 11:23:33 +0000 Subject: [PATCH] web/satellite/vuetify-poc: add account setup dialog This change copies the account setup dialog from the static v2 repo and adds functionality to it Issue: #6481 Change-Id: I0cacec3edf054c1945df7593b73e3c0f0f96677c --- web/satellite/src/api/auth.ts | 21 ++ web/satellite/src/types/users.ts | 22 +++ .../utils/constants/analyticsEventNames.ts | 1 + .../components/dialogs/AccountSetupDialog.vue | 62 ++++++ .../accountSetupSteps/BusinessStep.vue | 183 ++++++++++++++++++ .../dialogs/accountSetupSteps/ChoiceStep.vue | 76 ++++++++ .../accountSetupSteps/PersonalStep.vue | 115 +++++++++++ .../dialogs/accountSetupSteps/SuccessStep.vue | 54 ++++++ .../src/components/icons/IconBusiness.vue | 22 +++ .../src/components/icons/IconPersonal.vue | 18 ++ .../src/components/icons/IconStorjLogo.vue | 17 ++ .../vuetify-poc/src/views/Projects.vue | 2 + 12 files changed, 593 insertions(+) create mode 100644 web/satellite/vuetify-poc/src/components/dialogs/AccountSetupDialog.vue create mode 100644 web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/BusinessStep.vue create mode 100644 web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/ChoiceStep.vue create mode 100644 web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/PersonalStep.vue create mode 100644 web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/SuccessStep.vue create mode 100644 web/satellite/vuetify-poc/src/components/icons/IconBusiness.vue create mode 100644 web/satellite/vuetify-poc/src/components/icons/IconPersonal.vue create mode 100644 web/satellite/vuetify-poc/src/components/icons/IconStorjLogo.vue diff --git a/web/satellite/src/api/auth.ts b/web/satellite/src/api/auth.ts index 4f1db0901..e16883ca5 100644 --- a/web/satellite/src/api/auth.ts +++ b/web/satellite/src/api/auth.ts @@ -5,6 +5,7 @@ import { ErrorBadRequest } from '@/api/errors/ErrorBadRequest'; import { ErrorMFARequired } from '@/api/errors/ErrorMFARequired'; import { ErrorTooManyRequests } from '@/api/errors/ErrorTooManyRequests'; import { + AccountSetupData, FreezeStatus, SetUserSettingsData, TokenInfo, @@ -210,6 +211,26 @@ export class AuthHttpApi implements UsersApi { }); } + /** + * Used to update user details after signup. + * + * @param userInfo - the information to be added to account. + * @throws Error + */ + public async setupAccount(userInfo: AccountSetupData): Promise { + const path = `${this.ROOT_PATH}/account/setup`; + const response = await this.http.patch(path, JSON.stringify(userInfo)); + if (response.ok) { + return; + } + + throw new APIError({ + status: response.status, + message: 'Can not setup account', + requestID: response.headers.get('x-request-id'), + }); + } + /** * Used to get user data. * diff --git a/web/satellite/src/types/users.ts b/web/satellite/src/types/users.ts index 6ab4588ba..d298e7218 100644 --- a/web/satellite/src/types/users.ts +++ b/web/satellite/src/types/users.ts @@ -150,6 +150,18 @@ export class UpdatedUser { } } +/** + * Describes data used to set up user account. + */ +export interface AccountSetupData { + fullName: string + isProfessional: boolean + position?: string + companyName?: string + employeeCount?: string + storageNeeds?: string +} + /** * DisableMFARequest represents a request to disable multi-factor authentication. */ @@ -207,3 +219,13 @@ export class FreezeStatus { public warned = false, ) { } } + +/** + * AccountSetupStep are the steps in the account setup dialog. + */ +export enum AccountSetupStep { + Choice, + Personal, + Business, + Success, +} \ No newline at end of file diff --git a/web/satellite/src/utils/constants/analyticsEventNames.ts b/web/satellite/src/utils/constants/analyticsEventNames.ts index 7cfd389e8..13f64db77 100644 --- a/web/satellite/src/utils/constants/analyticsEventNames.ts +++ b/web/satellite/src/utils/constants/analyticsEventNames.ts @@ -64,6 +64,7 @@ export enum AnalyticsErrorEventSource { ACCESS_GRANTS_PAGE = 'Access grants page', ACCOUNT_PAGE = 'Account page', ACCOUNT_SETTINGS_AREA = 'Account settings area', + ACCOUNT_SETUP_DIALOG = 'Account setup dialog', BILLING_HISTORY_TAB = 'Billing history tab', BILLING_COUPONS_TAB = 'Billing coupons tab', BILLING_OVERVIEW_TAB = 'Billing overview tab', diff --git a/web/satellite/vuetify-poc/src/components/dialogs/AccountSetupDialog.vue b/web/satellite/vuetify-poc/src/components/dialogs/AccountSetupDialog.vue new file mode 100644 index 000000000..d1ba0ed6f --- /dev/null +++ b/web/satellite/vuetify-poc/src/components/dialogs/AccountSetupDialog.vue @@ -0,0 +1,62 @@ +// Copyright (C) 2023 Storj Labs, Inc. +// See LICENSE for copying information. + + + + diff --git a/web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/BusinessStep.vue b/web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/BusinessStep.vue new file mode 100644 index 000000000..ea720dfc1 --- /dev/null +++ b/web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/BusinessStep.vue @@ -0,0 +1,183 @@ +// Copyright (C) 2023 Storj Labs, Inc. +// See LICENSE for copying information. + + + + \ No newline at end of file diff --git a/web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/ChoiceStep.vue b/web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/ChoiceStep.vue new file mode 100644 index 000000000..e302ecd59 --- /dev/null +++ b/web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/ChoiceStep.vue @@ -0,0 +1,76 @@ +// Copyright (C) 2023 Storj Labs, Inc. +// See LICENSE for copying information. + + + + \ No newline at end of file diff --git a/web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/PersonalStep.vue b/web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/PersonalStep.vue new file mode 100644 index 000000000..87235ea00 --- /dev/null +++ b/web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/PersonalStep.vue @@ -0,0 +1,115 @@ +// Copyright (C) 2023 Storj Labs, Inc. +// See LICENSE for copying information. + + + + \ No newline at end of file diff --git a/web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/SuccessStep.vue b/web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/SuccessStep.vue new file mode 100644 index 000000000..90c7df33a --- /dev/null +++ b/web/satellite/vuetify-poc/src/components/dialogs/accountSetupSteps/SuccessStep.vue @@ -0,0 +1,54 @@ +// Copyright (C) 2023 Storj Labs, Inc. +// See LICENSE for copying information. + + + + \ No newline at end of file diff --git a/web/satellite/vuetify-poc/src/components/icons/IconBusiness.vue b/web/satellite/vuetify-poc/src/components/icons/IconBusiness.vue new file mode 100644 index 000000000..3fc1ea7fd --- /dev/null +++ b/web/satellite/vuetify-poc/src/components/icons/IconBusiness.vue @@ -0,0 +1,22 @@ +// Copyright (C) 2023 Storj Labs, Inc. +// See LICENSE for copying information. + + + + diff --git a/web/satellite/vuetify-poc/src/components/icons/IconPersonal.vue b/web/satellite/vuetify-poc/src/components/icons/IconPersonal.vue new file mode 100644 index 000000000..052087db3 --- /dev/null +++ b/web/satellite/vuetify-poc/src/components/icons/IconPersonal.vue @@ -0,0 +1,18 @@ +// Copyright (C) 2023 Storj Labs, Inc. +// See LICENSE for copying information. + + + + diff --git a/web/satellite/vuetify-poc/src/components/icons/IconStorjLogo.vue b/web/satellite/vuetify-poc/src/components/icons/IconStorjLogo.vue new file mode 100644 index 000000000..5f0c3ba67 --- /dev/null +++ b/web/satellite/vuetify-poc/src/components/icons/IconStorjLogo.vue @@ -0,0 +1,17 @@ +// Copyright (C) 2023 Storj Labs, Inc. +// See LICENSE for copying information. + + + + diff --git a/web/satellite/vuetify-poc/src/views/Projects.vue b/web/satellite/vuetify-poc/src/views/Projects.vue index 018bd6fe8..593598a3e 100644 --- a/web/satellite/vuetify-poc/src/views/Projects.vue +++ b/web/satellite/vuetify-poc/src/views/Projects.vue @@ -97,6 +97,7 @@ /> +