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) {
|
static getNameDialog(min: GBMinInstance) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: '/welcome_saas_name', waterfall: [
|
id: '/profile_name', waterfall: [
|
||||||
async step => {
|
async step => {
|
||||||
|
step.activeDialog.state.options = step.options;
|
||||||
const locale = step.context.activity.locale;
|
const locale = step.context.activity.locale;
|
||||||
await step.prompt("textPrompt", Messages[locale].whats_name);
|
await step.prompt("textPrompt", Messages[locale].whats_name);
|
||||||
},
|
},
|
||||||
|
@ -71,12 +72,12 @@ export class ProfileDialog extends IGBDialog {
|
||||||
|
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
await step.context.sendActivity(Messages[locale].validation_enter_name);
|
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 {
|
else {
|
||||||
step.activeDialog.state.options.name = value[0];
|
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) {
|
static getMobileDialog(min: GBMinInstance) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: '/store_mobile', waterfall: [
|
id: '/profile_mobile', waterfall: [
|
||||||
async step => {
|
async step => {
|
||||||
|
step.activeDialog.state.options = step.options;
|
||||||
|
|
||||||
const locale = step.context.activity.locale;
|
const locale = step.context.activity.locale;
|
||||||
await step.prompt("textPrompt", Messages[locale].whats_mobile);
|
await step.prompt("textPrompt", Messages[locale].whats_mobile);
|
||||||
},
|
},
|
||||||
|
@ -103,18 +103,18 @@ export class ProfileDialog extends IGBDialog {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await step.context.sendActivity(Messages[locale].validation_enter_valid_mobile);
|
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)) {
|
if (!phoneUtil.isPossibleNumber(phoneNumber)) {
|
||||||
await step.context.sendActivity(Messages[locale].validation_enter_valid_mobile);
|
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 {
|
else {
|
||||||
step.activeDialog.state.options.mobile = `${phoneNumber.values_['1']}${phoneNumber.values_['2']}`;
|
step.activeDialog.state.options.mobile = `${phoneNumber.values_['1']}${phoneNumber.values_['2']}`;
|
||||||
step.activeDialog.state.options.mobileCode = GBAdminService.getMobileCode();
|
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) {
|
static getMobileConfirmDialog(min: GBMinInstance) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: '/store_mobile_confirm', waterfall: [
|
id: '/profile_mobile_confirm', waterfall: [
|
||||||
async step => {
|
async step => {
|
||||||
|
step.activeDialog.state.options = step.options;
|
||||||
const locale = step.context.activity.locale;
|
const locale = step.context.activity.locale;
|
||||||
let from = step.activeDialog.state.options.mobile;
|
let from = step.activeDialog.state.options.mobile;
|
||||||
if (min.whatsAppDirectLine) {
|
if (min.whatsAppDirectLine) {
|
||||||
|
@ -142,10 +143,10 @@ export class ProfileDialog extends IGBDialog {
|
||||||
if (step.result !== step.activeDialog.state.options.mobileCode) {
|
if (step.result !== step.activeDialog.state.options.mobileCode) {
|
||||||
await step.context.sendActivity(Messages[locale].confirm_mobile_again);
|
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 {
|
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) {
|
static getEmailDialog(min: GBMinInstance) {
|
||||||
return {
|
return {
|
||||||
id: '/store_email', waterfall: [
|
id: '/profile_email', waterfall: [
|
||||||
async step => {
|
async step => {
|
||||||
const locale = step.context.activity.locale;
|
const locale = step.context.activity.locale;
|
||||||
await step.prompt("textPrompt", Messages[locale].whats_email);
|
await step.prompt("textPrompt", Messages[locale].whats_email);
|
||||||
|
@ -170,12 +171,11 @@ export class ProfileDialog extends IGBDialog {
|
||||||
|
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
await step.context.sendActivity(Messages[locale].validation_enter_valid_email);
|
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 {
|
else {
|
||||||
step.activeDialog.state.options.email = value[0];
|
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 = {
|
export const Messages = {
|
||||||
'en-US': {
|
'en-US': {
|
||||||
did_not_find: 'I\'m sorry I didn\'t find anything.',
|
whats_name: "What's your name?",
|
||||||
going_answer: 'Great choice, now looking for your answer...',
|
whats_mobile: "What's your mobile number including country code (e.g. +1 222 9998888)?",
|
||||||
wider_answer: subjectText =>
|
confirm_mobile: "Please type the code just sent to your mobile.",
|
||||||
`Answering to you in a broader way... Not just about ${subjectText}.`,
|
whats_email: "What's your E-mail address?",
|
||||||
which_question: 'What\'s your question?',
|
validation_enter_name: "Please enter your full name.",
|
||||||
anything_else: 'So, may I help with anything else?',
|
validation_enter_valid_mobile: "Please enter a valid mobile number.",
|
||||||
here_is_subjects: 'Here are some subjects to choose from...',
|
validation_enter_valid_email: "Please enter a valid e-mail.",
|
||||||
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?'
|
|
||||||
},
|
},
|
||||||
'pt-BR': {
|
'pt-BR': {
|
||||||
did_not_find: 'Desculpe-me, não encontrei nada a respeito.',
|
whats_name: "Qual o seu nome?",
|
||||||
going_answer: 'Ótima escolha, procurando resposta para sua questão...',
|
whats_email: "Qual o seu e-mail?",
|
||||||
wider_answer: subjectText =>
|
whats_mobile: "Qual o seu celular?",
|
||||||
`Vou te responder de modo mais abrangente... Não apenas sobre ${subjectText}`,
|
confirm_mobile: "Por favor, digite o código enviado para seu celular.",
|
||||||
which_question: 'Qual a pergunta?',
|
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.",
|
||||||
anything_else: 'Então, posso ajudar em algo mais?',
|
validation_enter_valid_email: "Por favor, digite um e-mail válido no formato nome@domínio.com.br.",
|
||||||
here_is_subjects: 'Aqui estão algumas categorias de assuntos...',
|
validation_enter_name: "Por favor, digite seu nome completo",
|
||||||
menu_select: 'Selecionar',
|
validation_enter_valid_mobile: "Por favor, insira um número de celular válido (ex.: +55 21 98888-7766).",
|
||||||
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?'
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue