Skip to content

Commit

Permalink
[sc-8028] new onboarding form in hubspot (#1179)
Browse files Browse the repository at this point in the history
* [sc-8028]: onboarding form updates

  - rewording and new options on use case question
  - new learn about us question
  - no more hosting question

* Remove join button from magic component

This magic component is used for both account creation and invitations. Having a `join` button was not a problem for invitation, but it was not an option for regular account creation.
So we improved the error management flow of this step, and we put it back automatic.
  • Loading branch information
mpellerin42 authored Dec 8, 2023
1 parent d92aee6 commit 080ff6a
Show file tree
Hide file tree
Showing 13 changed files with 385 additions and 178 deletions.
18 changes: 12 additions & 6 deletions libs/user/src/assets/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"login.title": "Benvinguts a Nuclia",
"login.token_expired": "El testimoni ha caducat",
"login.try_again": "Torna-ho a intentar o recupera la contrasenya.",
"onboarding.failed": "S'ha produït un error, poseu-vos en contacte amb el vostre administrador.",
"onboarding.loading": "S'està carregant…",
"onboarding.next-button": "Pròxim",
"onboarding.setting-up.account_creation": "Creació del compte...",
"onboarding.setting-up.import_dataset": "S'està important el vostre conjunt de dades...",
Expand All @@ -48,20 +50,24 @@
"onboarding.setting-up-upload.subtitle": "Carregueu les vostres dades al següent pas i, un cop processades, estaràs preparat per a la teva primera cerca.",
"onboarding.setting-up-upload.title": "Preparem-nos per importar les vostres dades",
"onboarding.step1.company": "Nom de la companyia",
"onboarding.step1.host_db.help": "Camp necessari. Això no afecta la vostra experiència d'usuari.",
"onboarding.step1.host_db.label": "Voleu allotjar la base de dades a la vostra infraestructura?",
"onboarding.step1.host_db.no": "No, prefereixo utilitzar el núvol de Nuclia",
"onboarding.step1.host_db.yes": "Sí, allotjaré NucliaDB a la meva infraestructura",
"onboarding.step1.invalid_phone_code": "Codi invàlid",
"onboarding.step1.invalid_phone_number": "Número de telèfon no vàlid",
"onboarding.step1.learn-about-us.article": "Article / publicació",
"onboarding.step1.learn-about-us.event": "Esdeveniment",
"onboarding.step1.learn-about-us.github": "GitHub",
"onboarding.step1.learn-about-us.label": "Com vas conèixer per primera vegada de nosaltres?",
"onboarding.step1.learn-about-us.other": "Altre",
"onboarding.step1.learn-about-us.web": "Cerca web",
"onboarding.step1.org_size": "Quina és la mida de la teva empresa?",
"onboarding.step1.phone": "Número de telèfon",
"onboarding.step1.subtitle": "Un parell de preguntes ràpides i us posarem en marxa.",
"onboarding.step1.title": "Benvinguts a Nuclia! 👋​ ",
"onboarding.step1.updates": "Obteniu actualitzacions ocasionals sobre Nuclia",
"onboarding.step1.use_case.ai_training": "Entrenament del model d'IA",
"onboarding.step1.use_case.ai_classification": "Classificació automàtica",
"onboarding.step1.use_case.ai_training": "Ajustar el meu propi model d'IA",
"onboarding.step1.use_case.document_summarization": "Resum de documents",
"onboarding.step1.use_case.global_search": "Cerca global de llocs",
"onboarding.step1.use_case.label": "Quin és el vostre cas d'ús principal?",
"onboarding.step1.use_case.label": "Quin és el teu objectiu amb la IA generativa?",
"onboarding.step1.use_case.other": "Un altre",
"onboarding.step1.use_case.research_analysis": "Recerca i anàlisi",
"onboarding.step1.use_case.support": "Suport al client/empleat",
Expand Down
17 changes: 11 additions & 6 deletions libs/user/src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"login.title": "Willkommen in Nuclia",
"login.token_expired": "Token ist abgelaufen",
"login.try_again": "Bitte versuchen Sie es erneut oder setzen Sie Ihr Passwort unten zurück.",
"onboarding.loading": "Wird geladen…",
"onboarding.next-button": "Nächster",
"onboarding.setting-up.account_creation": "Konto-Erstellung…",
"onboarding.setting-up.import_dataset": "Importieren Ihres Datensatzes...",
Expand All @@ -48,20 +49,24 @@
"onboarding.setting-up-upload.subtitle": "Laden Sie im nächsten Schritt Ihre Daten hoch und nach der Verarbeitung sind Sie für Ihre erste Suche bereit.",
"onboarding.setting-up-upload.title": "Machen wir uns bereit für den Import Ihrer Daten",
"onboarding.step1.company": "Name der Firma",
"onboarding.step1.host_db.help": "Pflichtfeld. Dies hat keinen Einfluss auf das Benutzererlebnis.",
"onboarding.step1.host_db.label": "Möchten Sie die Datenbank in Ihrer Infrastruktur hosten?",
"onboarding.step1.host_db.no": "Nein, ich nutze lieber die Cloud von Nuclia",
"onboarding.step1.host_db.yes": "Ja, ich werde NucliaDB in meiner Infrastruktur hosten",
"onboarding.step1.invalid_phone_code": "Ungültiger Code",
"onboarding.step1.invalid_phone_number": "Ungültige Telefonnummer",
"onboarding.step1.learn-about-us.article": "Artikel / Veröffentlichung",
"onboarding.step1.learn-about-us.event": "Veranstaltung",
"onboarding.step1.learn-about-us.github": "GitHub",
"onboarding.step1.learn-about-us.label": "Wie haben Sie zum ersten Mal von uns erfahren?",
"onboarding.step1.learn-about-us.other": "Andere",
"onboarding.step1.learn-about-us.web": "Web-Suche",
"onboarding.step1.org_size": "Wie groß ist Ihr Unternehmen?",
"onboarding.step1.phone": "Telefonnummer",
"onboarding.step1.subtitle": "Ein paar kurze Fragen und schon können Sie loslegen.",
"onboarding.step1.title": "Willkommen in Nuclia! 👋​ ",
"onboarding.step1.updates": "Erhalten Sie gelegentlich Updates über Nuclia",
"onboarding.step1.use_case.ai_training": "KI-Modelltraining",
"onboarding.step1.use_case.ai_classification": "Automatische Klassifizierung",
"onboarding.step1.use_case.ai_training": "Feinabstimmung meines eigenen KI-Modells",
"onboarding.step1.use_case.document_summarization": "Zusammenfassung des Dokuments",
"onboarding.step1.use_case.global_search": "Globale Site-Suche",
"onboarding.step1.use_case.label": "Was ist Ihr Hauptanwendungsfall?",
"onboarding.step1.use_case.label": "Was ist Ihr Ziel mit generativer KI?",
"onboarding.step1.use_case.other": "Andere",
"onboarding.step1.use_case.research_analysis": "Forschung und Analyse",
"onboarding.step1.use_case.support": "Kunden-/Mitarbeiterbetreuung",
Expand Down
18 changes: 12 additions & 6 deletions libs/user/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"login.title": "Welcome to Nuclia",
"login.token_expired": "Token has expired",
"login.try_again": "Please try again or reset your password below.",
"onboarding.failed": "Something went wrong, please contact your administrator.",
"onboarding.loading": "Loading…",
"onboarding.next-button": "Next",
"onboarding.setting-up.account_creation": "Account creation…",
"onboarding.setting-up.import_dataset": "Importing your sample dataset...",
Expand All @@ -48,20 +50,24 @@
"onboarding.setting-up-upload.subtitle": "Upload your data in the next step, and once processed, you'll be ready for your first search.",
"onboarding.setting-up-upload.title": "Let's get ready to import your data",
"onboarding.step1.company": "Company name",
"onboarding.step1.host_db.help": "Required field. This does not affect your users experience.",
"onboarding.step1.host_db.label": "Will you want to host the database in your infrastructure?",
"onboarding.step1.host_db.no": "No, I prefer to use Nuclia’s cloud",
"onboarding.step1.host_db.yes": "Yes, I will host NucliaDB in my infrastructure",
"onboarding.step1.invalid_phone_code": "Invalid code",
"onboarding.step1.invalid_phone_number": "Invalid phone number",
"onboarding.step1.learn-about-us.article": "Article / publication",
"onboarding.step1.learn-about-us.event": "Event",
"onboarding.step1.learn-about-us.github": "GitHub",
"onboarding.step1.learn-about-us.label": "How did you first learn about us?",
"onboarding.step1.learn-about-us.other": "Other",
"onboarding.step1.learn-about-us.web": "Web search",
"onboarding.step1.org_size": "What is your company size?",
"onboarding.step1.phone": "Phone number",
"onboarding.step1.subtitle": "A couple of quick questions, and we'll get you started.",
"onboarding.step1.title": "Welcome to Nuclia! 👋​",
"onboarding.step1.updates": "Get occasional updates about Nuclia",
"onboarding.step1.use_case.ai_training": "AI model training",
"onboarding.step1.use_case.ai_classification": "Automatic classification",
"onboarding.step1.use_case.ai_training": "Fine-tune my own AI model",
"onboarding.step1.use_case.document_summarization": "Document summarization",
"onboarding.step1.use_case.global_search": "Global site search",
"onboarding.step1.use_case.label": "What is your main use case?",
"onboarding.step1.use_case.label": "What is your goal with Generative AI?",
"onboarding.step1.use_case.other": "Other",
"onboarding.step1.use_case.research_analysis": "Research & Analysis",
"onboarding.step1.use_case.support": "Customer / employee support",
Expand Down
18 changes: 12 additions & 6 deletions libs/user/src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"login.title": "Bienvenidos a Nuclia",
"login.token_expired": "El token ha caducado",
"login.try_again": "Vuelva a intentarlo o recupera la contraseña.",
"onboarding.failed": "Algo salió mal, comuníquese con su administrador.",
"onboarding.loading": "Cargando…",
"onboarding.next-button": "Siguiente",
"onboarding.setting-up.account_creation": "Creación de cuenta…",
"onboarding.setting-up.import_dataset": "Importando su conjunto de datos...",
Expand All @@ -48,20 +50,24 @@
"onboarding.setting-up-upload.subtitle": "Cargue sus datos en el siguiente paso y, una vez procesados, estará listo para su primera búsqueda.",
"onboarding.setting-up-upload.title": "Preparémonos para importar tus datos.",
"onboarding.step1.company": "Nombre de empresa",
"onboarding.step1.host_db.help": "Campo requerido. Esto no afecta la experiencia de sus usuarios.",
"onboarding.step1.host_db.label": "¿Querrá alojar la base de datos en su infraestructura?",
"onboarding.step1.host_db.no": "No, prefiero usar la nube de Nuclia",
"onboarding.step1.host_db.yes": "Sí, alojaré NucliaDB en mi infraestructura",
"onboarding.step1.invalid_phone_code": "Codigo invalido",
"onboarding.step1.invalid_phone_number": "Numero de telefono invalido",
"onboarding.step1.learn-about-us.article": "Artículo / publicación",
"onboarding.step1.learn-about-us.event": "Evento",
"onboarding.step1.learn-about-us.github": "GitHub",
"onboarding.step1.learn-about-us.label": "¿Cómo supiste de nosotros por primera vez?",
"onboarding.step1.learn-about-us.other": "Otro",
"onboarding.step1.learn-about-us.web": "Búsqueda Web",
"onboarding.step1.org_size": "¿Cuál es el tamaño de su empresa?",
"onboarding.step1.phone": "Número de teléfono",
"onboarding.step1.subtitle": "Un par de preguntas rápidas y lo ayudaremos a comenzar.",
"onboarding.step1.title": "¡Bienvenidos a Nuclia! 👋​ ",
"onboarding.step1.updates": "Recibe actualizaciones ocasionales sobre Nuclia",
"onboarding.step1.use_case.ai_training": "Entrenamiento del modelo de IA",
"onboarding.step1.use_case.ai_classification": "Clasificación automática",
"onboarding.step1.use_case.ai_training": "Ajustar mi propio modelo de IA",
"onboarding.step1.use_case.document_summarization": "Resumen de documentos",
"onboarding.step1.use_case.global_search": "Búsqueda global del sitio",
"onboarding.step1.use_case.label": "¿Cuál es su principal caso de uso?",
"onboarding.step1.use_case.label": "¿Cuál es su objetivo con la IA generativa?",
"onboarding.step1.use_case.other": "Otros",
"onboarding.step1.use_case.research_analysis": "Investigación y análisis",
"onboarding.step1.use_case.support": "Asistencia a clientes y empleados",
Expand Down
18 changes: 12 additions & 6 deletions libs/user/src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"login.title": "Bienvenue à Nuclia",
"login.token_expired": "Le jeton a expiré",
"login.try_again": "Veuillez réessayer ou réinitialiser votre mot de passe ci-dessous.",
"onboarding.failed": "Quelque chose s'est mal passé, veuillez contacter votre administrateur.",
"onboarding.loading": "Chargement…",
"onboarding.next-button": "Suivant",
"onboarding.setting-up.account_creation": "Création du compte...",
"onboarding.setting-up.import_dataset": "Import de votre jeu de données...",
Expand All @@ -48,20 +50,24 @@
"onboarding.setting-up-upload.subtitle": "Téléchargez vos données à l'étape suivante et une fois traitées, vous serez prêt pour votre première recherche.",
"onboarding.setting-up-upload.title": "Nous nous préparons à importer vos données",
"onboarding.step1.company": "Nom de l'entreprise",
"onboarding.step1.host_db.help": "Champs requis. Cela n'affecte pas l'expérience de vos utilisateurs.",
"onboarding.step1.host_db.label": "Souhaitez-vous héberger la base de données dans votre infrastructure ?",
"onboarding.step1.host_db.no": "Non, je préfère utiliser le cloud de Nuclia",
"onboarding.step1.host_db.yes": "Oui, j'hébergerai NucliaDB dans mon infrastructure",
"onboarding.step1.invalid_phone_code": "Code invalide",
"onboarding.step1.invalid_phone_number": "Numéro de téléphone invalide",
"onboarding.step1.learn-about-us.article": "Article / publication",
"onboarding.step1.learn-about-us.event": "Événement",
"onboarding.step1.learn-about-us.github": "GitHub",
"onboarding.step1.learn-about-us.label": "Comment avez-vous entendu parler de nous ?",
"onboarding.step1.learn-about-us.other": "Autre",
"onboarding.step1.learn-about-us.web": "Recherche Internet",
"onboarding.step1.org_size": "Quelle est la taille de votre entreprise ?",
"onboarding.step1.phone": "Numéro de téléphone",
"onboarding.step1.subtitle": "Quelques questions rapides, et nous allons commencer.",
"onboarding.step1.title": "Bienvenue sur Nuclia ! 👋​ ",
"onboarding.step1.updates": "Recevoir des mises à jour occasionnelles sur Nuclia",
"onboarding.step1.use_case.ai_training": "Formation de modèles d'IA",
"onboarding.step1.use_case.ai_classification": "Classification automatique",
"onboarding.step1.use_case.ai_training": "Affiner mon propre modèle d'IA",
"onboarding.step1.use_case.document_summarization": "Résumé de documents",
"onboarding.step1.use_case.global_search": "Recherche globale de sites",
"onboarding.step1.use_case.label": "Quel est votre cas d'utilisation principal ?",
"onboarding.step1.use_case.label": "Quel est votre objectif avec l’IA Générative ?",
"onboarding.step1.use_case.other": "Autres",
"onboarding.step1.use_case.research_analysis": "Recherche et analyse",
"onboarding.step1.use_case.support": "Soutien aux clients / employés",
Expand Down
17 changes: 11 additions & 6 deletions libs/user/src/assets/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"login.title": "Bem-vindo à Nuclia",
"login.token_expired": "O token expirou",
"login.try_again": "Tente novamente ou redefina sua senha abaixo.",
"onboarding.loading": "Carregando…",
"onboarding.next-button": "Próximo",
"onboarding.setting-up.account_creation": "Criação de conta…",
"onboarding.setting-up.import_dataset": "Importando seu conjunto de dados...",
Expand All @@ -48,20 +49,24 @@
"onboarding.setting-up-upload.subtitle": "Carregue seus dados na próxima etapa e, uma vez processados, você estará pronto para sua primeira pesquisa.",
"onboarding.setting-up-upload.title": "Vamos nos preparar para importar seus dados",
"onboarding.step1.company": "Nome da empresa",
"onboarding.step1.host_db.help": "Campo obrigatório. Isso não afeta a experiência do usuário.",
"onboarding.step1.host_db.label": "Você deseja hospedar o banco de dados em sua infraestrutura?",
"onboarding.step1.host_db.no": "Não, prefiro usar a nuvem da Nuclia",
"onboarding.step1.host_db.yes": "Sim, hospedarei o NucliaDB em minha infraestrutura",
"onboarding.step1.invalid_phone_code": "Código inválido",
"onboarding.step1.invalid_phone_number": "Número de telefone inválido",
"onboarding.step1.learn-about-us.article": "Artigo/publicação",
"onboarding.step1.learn-about-us.event": "Evento",
"onboarding.step1.learn-about-us.github": "GitHub",
"onboarding.step1.learn-about-us.label": "Como você aprendeu sobre nós pela primeira vez?",
"onboarding.step1.learn-about-us.other": "Outros",
"onboarding.step1.learn-about-us.web": "Pesquisa na internet",
"onboarding.step1.org_size": "Qual é o tamanho da sua empresa?",
"onboarding.step1.phone": "Número de telefone",
"onboarding.step1.subtitle": "Algumas perguntas rápidas e começaremos.",
"onboarding.step1.title": "Bem-vindo à Nuclia! 👋​ ",
"onboarding.step1.updates": "Receba atualizações ocasionais sobre Nuclia",
"onboarding.step1.use_case.ai_training": "Treinamento de modelo de IA",
"onboarding.step1.use_case.ai_classification": "Classificação automática",
"onboarding.step1.use_case.ai_training": "Ajustar meu próprio modelo de IA",
"onboarding.step1.use_case.document_summarization": "Resumo do documento",
"onboarding.step1.use_case.global_search": "Pesquisa global de sites",
"onboarding.step1.use_case.label": "Qual é o seu principal caso de uso?",
"onboarding.step1.use_case.label": "Qual é o seu objetivo com IA generativa?",
"onboarding.step1.use_case.other": "De outros",
"onboarding.step1.use_case.research_analysis": "Pesquisa e Análise",
"onboarding.step1.use_case.support": "Suporte ao cliente/funcionário",
Expand Down
12 changes: 1 addition & 11 deletions libs/user/src/lib/magic/magic.component.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
<stf-user-container>
<div class="join-container">
<h2>
{{ 'invite.title' | translate }}
</h2>
<pa-button
kind="primary"
[disabled]="!token"
(click)="join()">
{{ 'invite.join-button' | translate }}
</pa-button>
</div>
<p>{{ (error ? error : 'onboarding.loading') | translate }}</p>
</stf-user-container>
8 changes: 0 additions & 8 deletions libs/user/src/lib/magic/magic.component.scss

This file was deleted.

68 changes: 32 additions & 36 deletions libs/user/src/lib/magic/magic.component.ts
Original file line number Diff line number Diff line change
@@ -1,65 +1,61 @@
import { MagicActionError, TokenService } from '@flaps/core';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
import { MagicService } from './magic.service';
import { catchError, map, of, Subject, takeUntil, tap } from 'rxjs';
import { SisToastService } from '@nuclia/sistema';
import { catchError, filter, map, of, Subject, switchMap, takeUntil, tap } from 'rxjs';

@Component({
selector: 'stf-magic',
templateUrl: './magic.component.html',
styleUrls: ['./magic.component.scss'],
})
export class MagicComponent implements OnInit, OnDestroy {
private unsubscribeAll = new Subject<void>();

token = '';
error = '';
constructor(
private tokenService: TokenService,
private magicService: MagicService,
private route: ActivatedRoute,
private router: Router,
private toaster: SisToastService,
private cdr: ChangeDetectorRef,
) {}

ngOnInit() {
this.route.queryParamMap
.pipe(
takeUntil(this.unsubscribeAll),
map((params: ParamMap) => params.get('token')),
map((params: ParamMap) => {
const token = params.get('token');
if (!token) {
this.error = 'Missing token in the URL';
this.cdr.markForCheck();
}
return token;
}),
filter((token) => !!token),
switchMap((token) => this.tokenService.validate(token as string)),
tap((data) => this.magicService.execute(data)),
catchError((error) => {
const cause = error.detail as MagicActionError;
if (cause === 'local_user_already_exists' || cause === 'user_registered_as_external_user') {
this.error = `login.${cause}`;
} else {
this.error = 'login.token_expired';
}
this.router.navigate(['/user/login'], {
queryParams: { message: this.error },
});
return of(null);
}),
)
.subscribe((token) => {
if (!token) {
this.toaster.error('Missing token in the URL');
}
this.token = token || '';
.subscribe({
error: () => {
this.error = 'onboarding.failed';
this.cdr.markForCheck();
},
});
}

join() {
if (this.token) {
this.tokenService
.validate(this.token)
.pipe(
tap((data) => this.magicService.execute(data)),
catchError((error) => {
let message: string;
const cause = error.detail as MagicActionError;
if (cause === 'local_user_already_exists' || cause === 'user_registered_as_external_user') {
message = `login.${cause}`;
} else {
message = 'login.token_expired';
}
this.router.navigate(['/user/login'], {
queryParams: { message: message },
});
return of(null);
}),
)
.subscribe();
}
}

ngOnDestroy() {
this.unsubscribeAll.next();
this.unsubscribeAll.complete();
Expand Down
Loading

0 comments on commit 080ff6a

Please sign in to comment.