Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
add sms and whatsapp to bst init (#678)
Browse files Browse the repository at this point in the history
  • Loading branch information
Edgar Cruzado authored Aug 26, 2021
1 parent 60f28d0 commit acff8b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
12 changes: 10 additions & 2 deletions bin/bst-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const questions = [
{
type: "list",
name: "platform",
message: "Are you developing for Alexa, Google, or an automated Phone system?",
message: "Select the platform you are developing for",
choices: [
{
name: "Alexa",
Expand All @@ -45,13 +45,21 @@ const questions = [
name: "Phone",
value: "phone",
},
{
name: "Sms",
value: "sms",
},
{
name: "Whatsapp",
value: "whatsapp",
},
],
},
{
type: "input",
name: "phoneNumber",
message: "Please provide a valid phone number in the E.164 format to call to (e.g.: +14155552671):",
when: (answers: any) => answers["platform"].includes("phone"),
when: (answers: any) => ["phone", "sms", "whatsapp"].indexOf(answers["platform"]) > -1,
validate: (input: any) => {
if (!input) return false;
return /^\+?[1-9]\d{1,14}$/.test(input);
Expand Down
20 changes: 3 additions & 17 deletions lib/init/init-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ export class InitUtil {

private getHelpInteraction(type: string, platform: string): object {
let expectedPrompt = "helpPrompt";
let expectedCardContent = "helpPrompt";
let expectedCardTitle = "cardTitle";
let input = "";

if (this.isMultilocale) {
Expand All @@ -194,9 +192,7 @@ export class InitUtil {
} else if (type === "e2e") {
input = "help";
}
expectedPrompt = "What can I help you with?";
expectedCardContent = "What can I help you with?";
expectedCardTitle = this.projectName;
expectedPrompt = "What can I help you with";
}
return {
"expected": [
Expand All @@ -205,16 +201,6 @@ export class InitUtil {
"operator": ":",
"value": expectedPrompt,
},
{
"action": "cardContent",
"operator": ":",
"value": expectedCardContent,
},
{
"action": "cardTitle",
"operator": ":",
"value": expectedCardTitle,
},
],
input,
};
Expand All @@ -236,8 +222,8 @@ export class InitUtil {
if (this.platform === "google") {
testingJsonForUnit["platform"] = "google";
testingJsonForUnit["dialogFlow"] = this.dialogFlow;
} else if (this.platform === "phone") {
testingJsonForE2e["platform"] = "phone";
} else if (["phone", "sms", "whatsapp"].indexOf(this.platform) > -1) {
testingJsonForE2e["platform"] = this.platform;
testingJsonForE2e["phoneNumber"] = this.phoneNumber;
}
return this.type === "unit" ? testingJsonForUnit : testingJsonForE2e;
Expand Down

0 comments on commit acff8b9

Please sign in to comment.