Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
description: 'This is a description of a carousel item.',
image: new Image({
url: IMG_URL_AOG,
alt: 'Image alternate text',
}),
},
// Add the second item to the carousel
[SELECTION_KEY_GOOGLE_HOME]: {
synonyms: [
'Google Home Assistant',
'Assistant on the Google Home',
],
title: 'Google Home',
description: 'Google Home is a voice-activated speaker powered by ' +
'the Google Assistant.',
image: new Image({
url: IMG_URL_GOOGLE_HOME,
alt: 'Google Home',
}),
},
// Add third item to the carousel
[SELECTION_KEY_GOOGLE_PIXEL]: {
synonyms: [
'Google Pixel XL',
'Pixel',
'Pixel XL',
],
title: 'Google Pixel',
description: 'Pixel. Phone by Google.',
image: new Image({
url: IMG_URL_GOOGLE_PIXEL,
alt: 'Google Pixel',
],
title: 'Item #3',
description: 'Description of Item #3',
image: new Image({
url: IMG_URL_GOOGLE_PIXEL,
alt: 'Google Pixel phone',
}),
},
// Add last item of the carousel
[SELECTION_KEY_GOOGLE_HOME]: {
title: 'Item #4',
synonyms: [
'Google Home',
],
description: 'Description of Item #4',
image: new Image({
url: IMG_URL_GOOGLE_HOME,
alt: 'Google Home',
}),
},
},
}));
}
title: 'Google Pixel',
description: 'Pixel. Phone by Google.',
image: new Image({
url: IMG_URL_GOOGLE_PIXEL,
alt: 'Google Pixel',
}),
},
// Add the last item to the list
[SELECTION_KEY_GOOGLE_ALLO]: {
title: 'Google Allo',
synonyms: [
'Allo',
],
description: 'Introducing Google Allo, a smart messaging app that ' +
'helps you say more and do more.',
image: new Image({
url: IMG_URL_GOOGLE_ALLO,
alt: 'Google Allo Logo',
}),
},
},
}));
}
conv.ask(new Suggestions(intentSuggestions));
// Create a basic card
conv.ask(new BasicCard({
text: `This is a basic card. Text in a basic card can include "quotes" and
most other unicode characters including emoji 📱. Basic cards also support
some markdown formatting like *emphasis* or _italics_, **strong** or
__bold__, and ***bold itallic*** or ___strong emphasis___ as well as other
things like line \nbreaks`, // Note the two spaces before '\n' required for
// a line break to be rendered in the card.
subtitle: 'This is a subtitle',
title: 'Title: this is a title',
buttons: new Button({
title: 'This is a button',
url: 'https://assistant.google.com/',
}),
image: new Image({
url: IMG_URL_AOG,
alt: 'Image alternate text',
}),
}));
conv.ask(new SimpleResponse({
speech: 'This is the second simple response.',
text: 'This is the 2nd simple response.',
}));
}
conv.ask('This is the first simple response for a basic card.');
conv.ask(new Suggestions(intentSuggestions));
conv.ask(new BasicCard({
text: `This is a basic card. Text in a basic card can include "quotes" and
most other unicode characters including emoji 📱. Basic cards also support
some markdown formatting like *emphasis* or _italics_, **strong** or
__bold__, and ***bold itallic*** or ___strong emphasis___ as well as other
things like line \nbreaks`, // Note the two spaces before '\n' required for
// a line break to be rendered in the card.
subtitle: 'This is a subtitle',
title: 'Title: this is a title',
buttons: new Button({
title: 'This is a button',
url: 'https://assistant.google.com/',
}),
image: new Image({
url: IMG_URL_AOG,
alt: 'Image alternate text',
}),
}));
conv.ask(new SimpleResponse({
speech: 'This is the second simple response.',
text: 'This is the 2nd simple response.',
}));
}
["House Special One"]: {
synonyms: ["Special One", "Deal One"],
title: "First House Special",
description: "This is a description of a carousel item.",
image: new Image({
url:
"http://www.ingostastyfood.com/wp-content/uploads/2016/06/ingos_burger-6.22.15.jpg",
alt: "Special one"
})
},
// Add the second item to the carousel
["House Special Two"]: {
synonyms: ["Special Two", "Deal Two"],
title: "House Special Two",
description: "The House Special number two.",
image: new Image({
url:
"http://www.sactownmag.com/Whats-Cooking/2017/10-tasty-food-festivals-in-June-and-July/TacoFestival_courtesyofMasaGuiseria5.jpg",
alt: "Special Two"
})
},
// Add third item to the carousel
["House Special Three"]: {
synonyms: ["Special Three", "Deal Three"],
title: "Special Three",
description: "The House Special number three.",
image: new Image({
url:
"https://cdn.vox-cdn.com/thumbor/qtrH6pOAoml-LYysFBb8W8lc680=/0x0:960x776/1200x900/filters:focal(404x312:556x464)/cdn.vox-cdn.com/uploads/chorus_image/image/54422771/Taystee_s.0.0.jpg",
alt: "Special Three"
})
}
}),
columns: [
{
align: "CENTER",
header: "header 1",
},
{
align: "LEADING",
header: "header 2",
},
{
align: "TRAILING",
header: "header 3",
},
],
image: new Image({
alt: "Actions on Google",
url: "https://avatars0.githubusercontent.com/u/23533486",
}),
rows: [
{
cells: ["row 1 item 1", "row 1 item 2", "row 1 item 3"],
dividerAfter: false,
},
{
cells: ["row 2 item 1", "row 2 item 2", "row 2 item 3"],
dividerAfter: true,
},
{
cells: ["row 3 item 1", "row 3 item 2", "row 3 item 3"],
},
],
let earnedTwoYearAgo = formatMoney(investmentTwoYearAgo.earned.toFixed(0));
let priceTwoYearAgo = formatMoney(investmentTwoYearAgo.investPrice.toFixed(2));
let investmentThreeYearAgo = await calculateInvestment(threeYearAgo, sellDate);
let earnedThreeYearAgo = formatMoney(investmentThreeYearAgo.earned.toFixed(0));
let priceThreeYearAgo = formatMoney(investmentThreeYearAgo.investPrice.toFixed(2));
conv.ask(`This is how much you would earn with bitcoin if you invested ${formatMoney(conv.data.bitcoinInvestment)}`);
conv.ask(new BrowseCarousel({
items: [
new BrowseCarouselItem({
title: `Price ${priceStartOfMonth} euro`,
url: `https://bitcoins.now`,
description: `Beginning of this month`,
image: new Image({
url: `https://dummyimage.com/128x232/d90057/fff.png&text=${earnedStartOfMonth}`,
alt: `Earning from beginning of this month ${earnedStartOfMonth} euro`,
}),
footer: `Buy bitcoin`,
}),
new BrowseCarouselItem({
title: `Price ${priceStartOfYear} euro`,
url: `https://bitcoins.now`,
description: `Start of the year`,
image: new Image({
url: `https://dummyimage.com/128x232/d90057/fff.png&text=${earnedStartOfYear}`,
alt: `Earning from beginning of this year ${earnedStartOfYear} euro`,
}),
footer: `Buy bitcoin`,
}),
new BrowseCarouselItem({
const fakeColorCarousel = () => {
const carousel = new Carousel({
items: {
'indigo taco': {
title: 'Indigo Taco',
synonyms: ['indigo', 'taco'],
image: new Image({
url: 'https://storage.googleapis.com/material-design/publish/material_v_12/assets/0BxFyKV4eeNjDN1JRbF9ZMHZsa1k/style-color-uiapplication-palette1.png',
alt: 'Indigo Taco Color',
}),
},
'pink unicorn': {
title: 'Pink Unicorn',
synonyms: ['pink', 'unicorn'],
image: new Image({
url: 'https://storage.googleapis.com/material-design/publish/material_v_12/assets/0BxFyKV4eeNjDbFVfTXpoaEE5Vzg/style-color-uiapplication-palette2.png',
alt: 'Pink Unicorn Color',
}),
},
'blue grey coffee': {
title: 'Blue Grey Coffee',
synonyms: ['blue', 'grey', 'coffee'],
image: new Image({
url: 'https://storage.googleapis.com/material-design/publish/material_v_12/assets/0BxFyKV4eeNjDZUdpeURtaTUwLUk/style-color-colorsystem-gray-secondary-161116.png',
alt: 'Blue Grey Coffee Color',
}),
},
}});
return carousel;
};
function browseCarousel(conv) {
if (!conv.hasWebBrowser) {
conv.ask(`I'm sorry, browse carousel isn't currently supported on smart display`);
const filterChips = intentSuggestions.filter(chip => chip !="Browse Carousel");
conv.ask(new Suggestions(filterChips));
return;
}
conv.ask('This is an example of a "Browse Carousel"');
conv.ask(new BrowseCarousel({
items: [
new BrowseCarouselItem({
title: 'Item #1',
url: 'https://assistant.google.com/',
description: 'Description of Item #1',
image: new Image({
url: 'https://www.gstatic.com/images/branding/product/2x/assistant_64dp.png',
alt: 'Google Assistant logo',
}),
footer: 'Item 1 footer',
}),
new BrowseCarouselItem({
title: 'Item #2',
url: 'https://developers.google.com/actions/transactions/physical/dev-guide-physical-gpay',
description: 'Description of Item #2',
image: new Image({
url: 'https://www.gstatic.com/images/branding/product/2x/pay_64dp.png',
alt: 'Google Pay logo',
}),
footer: 'Item 2 footer',
}),
],