Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove description mandatory and custom main button on sendRadioButtons #32

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ class WhatsappCloud {
headerText,
bodyText,
footerText,
buttonText,
listOfSections,
}) {
this._mustHaverecipientPhone(recipientPhone);
Expand All @@ -394,6 +395,8 @@ class WhatsappCloud {
throw new Error('"headerText" is required in making a request');
if (!footerText)
throw new Error('"footerText" is required in making a request');
if (!buttonText)
throw new Error('"buttonText" is required in making a request');

let totalNumberOfItems = 0;
let validSections = listOfSections
Expand All @@ -420,15 +423,12 @@ class WhatsappCloud {
'The row title must be between 1 and 24 characters long.'
);
}
if (!row.description) {
throw new Error(
'"row.description" of an item is required in list of radio buttons.'
);
}
if (row.description.length > 72) {
throw new Error(
'The row description must be between 1 and 72 characters long.'
);
if (row.description) {
if (row.description.length > 72) {
throw new Error(
'The row description must be between 1 and 72 characters long.'
);
}
}

totalNumberOfItems += 1;
Expand Down Expand Up @@ -475,7 +475,7 @@ class WhatsappCloud {
text: footerText,
},
action: {
button: 'Select a product',
button: buttonText,
sections: validSections,
},
},
Expand Down