new(security.gbapp): User profile dialog added.
This commit is contained in:
parent
b781ccc577
commit
73b711663d
2 changed files with 31 additions and 45 deletions
|
@ -55,8 +55,9 @@ export class ProfileDialog extends IGBDialog {
|
|||
static getNameDialog(min: GBMinInstance) {
|
||||
|
||||
return {
|
||||
id: '/welcome_saas_name', waterfall: [
|
||||
id: '/profile_name', waterfall: [
|
||||
async step => {
|
||||
step.activeDialog.state.options = step.options;
|
||||
const locale = step.context.activity.locale;
|
||||
await step.prompt("textPrompt", Messages[locale].whats_name);
|
||||
},
|
||||
|
@ -71,12 +72,12 @@ export class ProfileDialog extends IGBDialog {
|
|||
|
||||
if (value === null) {
|
||||
await step.context.sendActivity(Messages[locale].validation_enter_name);
|
||||
await step.replaceDialog('/welcome_saas_name', step.activeDialog.state.options);
|
||||
await step.replaceDialog('/profile_name', step.activeDialog.state.options);
|
||||
}
|
||||
else {
|
||||
step.activeDialog.state.options.name = value[0];
|
||||
|
||||
return await step.replaceDialog('/welcome_saas_mobile', step.activeDialog.state.options);
|
||||
return await step.replaceDialog('/profile_mobile', step.activeDialog.state.options);
|
||||
|
||||
}
|
||||
}]
|
||||
|
@ -87,10 +88,9 @@ export class ProfileDialog extends IGBDialog {
|
|||
static getMobileDialog(min: GBMinInstance) {
|
||||
|
||||
return {
|
||||
id: '/store_mobile', waterfall: [
|
||||
id: '/profile_mobile', waterfall: [
|
||||
async step => {
|
||||
|
||||
|
||||
step.activeDialog.state.options = step.options;
|
||||
const locale = step.context.activity.locale;
|
||||
await step.prompt("textPrompt", Messages[locale].whats_mobile);
|
||||
},
|
||||
|
@ -103,18 +103,18 @@ export class ProfileDialog extends IGBDialog {
|
|||
} catch (error) {
|
||||
await step.context.sendActivity(Messages[locale].validation_enter_valid_mobile);
|
||||
|
||||
return await step.replaceDialog('/store_mobile', step.activeDialog.state.options);
|
||||
return await step.replaceDialog('/profile_mobile', step.activeDialog.state.options);
|
||||
}
|
||||
if (!phoneUtil.isPossibleNumber(phoneNumber)) {
|
||||
await step.context.sendActivity(Messages[locale].validation_enter_valid_mobile);
|
||||
|
||||
return await step.replaceDialog('/store_mobile', step.activeDialog.state.options);
|
||||
return await step.replaceDialog('/profile_mobile', step.activeDialog.state.options);
|
||||
}
|
||||
else {
|
||||
step.activeDialog.state.options.mobile = `${phoneNumber.values_['1']}${phoneNumber.values_['2']}`;
|
||||
step.activeDialog.state.options.mobileCode = GBAdminService.getMobileCode();
|
||||
|
||||
return await step.replaceDialog('/store_mobile_confirm', step.activeDialog.state.options);
|
||||
return await step.replaceDialog('/profile_mobile_confirm', step.activeDialog.state.options);
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
@ -123,8 +123,9 @@ export class ProfileDialog extends IGBDialog {
|
|||
static getMobileConfirmDialog(min: GBMinInstance) {
|
||||
|
||||
return {
|
||||
id: '/store_mobile_confirm', waterfall: [
|
||||
id: '/profile_mobile_confirm', waterfall: [
|
||||
async step => {
|
||||
step.activeDialog.state.options = step.options;
|
||||
const locale = step.context.activity.locale;
|
||||
let from = step.activeDialog.state.options.mobile;
|
||||
if (min.whatsAppDirectLine) {
|
||||
|
@ -142,10 +143,10 @@ export class ProfileDialog extends IGBDialog {
|
|||
if (step.result !== step.activeDialog.state.options.mobileCode) {
|
||||
await step.context.sendActivity(Messages[locale].confirm_mobile_again);
|
||||
|
||||
return await step.replaceDialog('/store_mobile_confirm', step.activeDialog.state.options);
|
||||
return await step.replaceDialog('/profile_mobile_confirm', step.activeDialog.state.options);
|
||||
}
|
||||
else {
|
||||
await step.replaceDialog('/store_botxxxxxxxxxxxxxxxxxxxxxxxxxx', step.activeDialog.state.options);
|
||||
await step.replaceDialog('/profile_email', step.activeDialog.state.options);
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
@ -154,7 +155,7 @@ export class ProfileDialog extends IGBDialog {
|
|||
|
||||
static getEmailDialog(min: GBMinInstance) {
|
||||
return {
|
||||
id: '/store_email', waterfall: [
|
||||
id: '/profile_email', waterfall: [
|
||||
async step => {
|
||||
const locale = step.context.activity.locale;
|
||||
await step.prompt("textPrompt", Messages[locale].whats_email);
|
||||
|
@ -170,12 +171,11 @@ export class ProfileDialog extends IGBDialog {
|
|||
|
||||
if (value === null) {
|
||||
await step.context.sendActivity(Messages[locale].validation_enter_valid_email);
|
||||
await step.replaceDialog('/store_email', step.activeDialog.state.options);
|
||||
await step.replaceDialog('/profile_email', step.activeDialog.state.options);
|
||||
}
|
||||
else {
|
||||
step.activeDialog.state.options.email = value[0];
|
||||
|
||||
|
||||
await step.replaceDialog(`/${step.activeDialog.state.options.nextDialog}`, step.activeDialog.state.options);
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
|
|
@ -1,35 +1,21 @@
|
|||
export const Messages = {
|
||||
'en-US': {
|
||||
did_not_find: 'I\'m sorry I didn\'t find anything.',
|
||||
going_answer: 'Great choice, now looking for your answer...',
|
||||
wider_answer: subjectText =>
|
||||
`Answering to you in a broader way... Not just about ${subjectText}.`,
|
||||
which_question: 'What\'s your question?',
|
||||
anything_else: 'So, may I help with anything else?',
|
||||
here_is_subjects: 'Here are some subjects to choose from...',
|
||||
menu_select: 'Select',
|
||||
lets_search: query =>
|
||||
`Lets search for ${query}... What do you want to know?`,
|
||||
see_faq: 'Please take a look at the FAQ I\'ve prepared for you. You can click on them to get the answer.',
|
||||
will_answer_projector:
|
||||
'I\'ll answer on the projector to a better experience...',
|
||||
ask_first_time: 'What are you looking for?'
|
||||
whats_name: "What's your name?",
|
||||
whats_mobile: "What's your mobile number including country code (e.g. +1 222 9998888)?",
|
||||
confirm_mobile: "Please type the code just sent to your mobile.",
|
||||
whats_email: "What's your E-mail address?",
|
||||
validation_enter_name: "Please enter your full name.",
|
||||
validation_enter_valid_mobile: "Please enter a valid mobile number.",
|
||||
validation_enter_valid_email: "Please enter a valid e-mail.",
|
||||
},
|
||||
'pt-BR': {
|
||||
did_not_find: 'Desculpe-me, não encontrei nada a respeito.',
|
||||
going_answer: 'Ótima escolha, procurando resposta para sua questão...',
|
||||
wider_answer: subjectText =>
|
||||
`Vou te responder de modo mais abrangente... Não apenas sobre ${subjectText}`,
|
||||
which_question: 'Qual a pergunta?',
|
||||
anything_else: 'Então, posso ajudar em algo mais?',
|
||||
here_is_subjects: 'Aqui estão algumas categorias de assuntos...',
|
||||
menu_select: 'Selecionar',
|
||||
lets_search: query =>
|
||||
`Let's search about ${query}... What do you want to know?`,
|
||||
see_faq:
|
||||
'Veja algumas perguntas mais frequentes logo na tela. Clique numa delas para eu responder.',
|
||||
will_answer_projector:
|
||||
'Vou te responder na tela para melhor visualização...',
|
||||
ask_first_time: 'Como eu posso ajudar?'
|
||||
whats_name: "Qual o seu nome?",
|
||||
whats_email: "Qual o seu e-mail?",
|
||||
whats_mobile: "Qual o seu celular?",
|
||||
confirm_mobile: "Por favor, digite o código enviado para seu celular.",
|
||||
confirm_mobile_again: "Esse não me parece ser um código numérico válido. Por favor, digite novamente o código enviado para seu celular.",
|
||||
validation_enter_valid_email: "Por favor, digite um e-mail válido no formato nome@domínio.com.br.",
|
||||
validation_enter_name: "Por favor, digite seu nome completo",
|
||||
validation_enter_valid_mobile: "Por favor, insira um número de celular válido (ex.: +55 21 98888-7766).",
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue