Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 4x 1x 3x 1x 2x 2x 1x 2x | import { PERSISTENT_MENU_TOP_LEVEL_CTA_LIMIT } from '../constants';
class PersistentMenu {
constructor({ locale = 'default', call_to_actions, composer_input_disabled }) {
if (!Array.isArray(call_to_actions)) {
throw new Error('You must pass an array of menu item objects.');
}
if (call_to_actions.length > PERSISTENT_MENU_TOP_LEVEL_CTA_LIMIT) {
throw new Error(`You cannot have more than ${PERSISTENT_MENU_TOP_LEVEL_CTA_LIMIT} menu items.`);
}
const res = {
locale,
call_to_actions,
};
if (composer_input_disabled) {
res.composer_input_disabled = composer_input_disabled;
}
return res;
}
}
export default PersistentMenu;
|