Why is there no Carousel in #assistant/conversation - actions-on-google

If not, I want to use more than two cards. If not, I want to know how to use List (list code example).
Absolutely not Dialogflow code! I need the ActionsOnGoogle code.
const functions = require('firebase-functions');
const syncRequest = require('sync-request');
const express = require('express');
const {
conversation,
Simple,
Card,
Image,
Button,
List,
Table,
Carousel <-------------------------------(Carousel is not constructor ERROR)
} = require('#assistant/conversation');
const app = conversation({debug:true});
app.handle('callApi', (conv) => {
conv.add(new Card({
title: "hello1",
subtitle: "hi",
text: "blablablablablablablablablablablablablablablablablabla",
image: new Image({
url: "some url",
alt: "Some alternative text",
})
}), new Card({
title: "hello2",
subtitle: "ddddddddd",
text: "testtesttesttesttesttesttesttesttesttesttesttesttesttest",
image: new Image({
url: "some url",
alt: "Some alternative text",
})
}));----------------------------------------------------two Card doesn't it work
});
exports.ActionsOnGoogleFulfillment = functions.https.onRequest(app);
Looking for ActionsOnGoogleFulfillment document and example/sample code link.

The Carousel type has been replaced by the Collection type, which does the same thing on most platforms. The name reflects, however, that it may not display as a carousel everywhere, but will still represent a card-like layout.
For Visual Selection Responses such as Lists and Collections, defining the response is done in two parts:
Creating Runtime Type Overrides for a type, and including visual information about each entry
Creating the List or Collection and referencing items in that type to display
You'll create Type Overrides by adding something to the session. So it might look something like this:
conv.session.typeOverrides = [{
name: 'prompt_option',
mode: 'TYPE_REPLACE',
synonym: {
entries: [
{
name: 'ITEM_1',
synonyms: ['Item 1', 'First item'],
display: {
title: 'Item #1',
description: 'Description of Item #1',
image: ASSISTANT_LOGO_IMAGE,
}
},
{
name: 'ITEM_2',
synonyms: ['Item 2', 'Second item'],
display: {
title: 'Item #2',
description: 'Description of Item #2',
image: ASSISTANT_LOGO_IMAGE,
}
},
{
name: 'ITEM_3',
synonyms: ['Item 3', 'Third item'],
display: {
title: 'Item #3',
description: 'Description of Item #3',
image: ASSISTANT_LOGO_IMAGE,
}
},
{
name: 'ITEM_4',
synonyms: ['Item 4', 'Fourth item'],
display: {
title: 'Item #4',
description: 'Description of Item #4',
image: ASSISTANT_LOGO_IMAGE,
}
},
]
}
}];
You would then create and add the Collection object, referencing the keys from the type you are declaring:
conv.add(new Collection({
title: 'Collection Title',
subtitle: 'Collection subtitle',
items: [
{
key: 'ITEM_1'
},
{
key: 'ITEM_2'
},
{
key: 'ITEM_3'
},
{
key: 'ITEM_4'
}
],
}));
});
doing this for a List instead would be similar. The entity type and visual components would be the same, but you'd define the list slightly differently:
conv.add(new List({
title: 'List title',
subtitle: 'List subtitle',
items: [
{
key: 'ITEM_1'
},
{
key: 'ITEM_2'
},
{
key: 'ITEM_3'
},
{
key: 'ITEM_4'
}
],
}));
});

Related

How to specify next style to use with TinyMCE style_formats?

Given TinyMCE config fragment
style_formats: [
{ title: 'Headings', items: [
{ title: 'Heading 1', format: 'h1' },
{ title: 'Heading 2', format: 'h2' },
{ title: 'Heading 3', format: 'h3' },
{ title: 'Heading 4', format: 'h4' },
{ title: 'Heading 5', format: 'h5' },
{ title: 'Heading 6', format: 'h6' }
]},
{ title: 'Blocks', items: [
{ title: 'Paragraph', format: 'p' },
{ title: 'Blockquote', format: 'blockquote' },
{ title: 'Div', format: 'div' },
{ title: 'Pre', format: 'pre' }
]},
],
Does TinyMCE (version 5 or 6) allow somehow defining that when user is currently using "Heading 2" style and he or she presses Enter key, the next style would be "Blockquote"?
Logically it could be something like
{ title: 'Heading 2', format: 'h2', next_style_after_enter: 'Blockquote' },
but obviously this specific syntax is not the correct one because I don't know the correct syntax. Obviously using the label for linking different styles is not optimal either, so better id would be needed, too.

Actions on google reservations for transaction API

We are building boot using action on builder SDK. In bot we have transaction related feature so we want to implement reservation feature to make appointment reservation. In our Bot we just need reservation. user can't cancel/delete reservation (As our member can contact the user for next 3 4 days, we are just asking user free time so we can contact user). (We did't have reservation feature yet but google team force us to do so). My Question is while implementing reservation we have https://developers.google.com/assistant/transactions/physical/dev-guide-physical-reservations#validate_transaction_requirements_optional this feature optional we are not implementing this, for second step we have to build Order like this https://developers.google.com/assistant/transactions/physical/dev-guide-physical-reservations#build_the_order
const order = {
createTime: '2019-09-24T18:00:00.877Z',
lastUpdateTime: '2019-09-24T18:00:00.877Z',
merchantOrderId: orderId, // A unique ID String for the order
userVisibleOrderId: orderId,
transactionMerchant: {
id: 'http://www.example.com',
name: 'Example Merchant',
},
contents: {
lineItems: [
{
id: 'LINE_ITEM_ID',
name: 'Dinner reservation',
description: 'A world of flavors all in one destination.',
reservation: {
status: 'PENDING',
userVisibleStatusLabel: 'Reservation is pending.',
type: 'RESTAURANT',
reservationTime: {
timeIso8601: '2020-01-16T01:30:15.01Z',
},
userAcceptableTimeRange: {
timeIso8601: '2020-01-15/2020-01-17',
},
partySize: 6,
staffFacilitators: [
{
name: 'John Smith',
},
],
location: {
zipCode: '94086',
city: 'Sunnyvale',
postalAddress: {
regionCode: 'US',
postalCode: '94086',
administrativeArea: 'CA',
locality: 'Sunnyvale',
addressLines: [
'222, Some other Street',
],
},
},
},
},
],
},
buyerInfo: {
email: 'janedoe#gmail.com',
firstName: 'Jane',
lastName: 'Doe',
displayName: 'Jane Doe',
},
followUpActions: [
{
type: 'VIEW_DETAILS',
title: 'View details',
openUrlAction: {
url: 'http://example.com',
},
},
{
type: 'CALL',
title: 'Call us',
openUrlAction: {
url: 'tel:+16501112222',
},
},
{
type: 'EMAIL',
title: 'Email us',
openUrlAction: {
url: 'mailto:person#example.com',
},
},
],
termsOfServiceUrl: 'http://www.example.com'
};
According to doc we have to create order object like above, but we are unable to find any doc what are optional filed in above object and what value to pass for reservationTime and userAcceptableTimeRange.
reservationTime: {
timeIso8601: '2020-01-16T01:30:15.01Z',
},
userAcceptableTimeRange: {
timeIso8601: '2020-01-15/2020-01-17',
}
Further more do we need to implement Set up asynchronous requests to the Orders API (https://developers.google.com/assistant/transactions/physical/dev-guide-physical-reservations#set_up_asynchronous_requests_to_the_orders_api) as we don't need to update user appoint time and user can't cancel appointment.
Is there any other way we can avoid reservation? please guide me, thanks in advance.

Pre-checked checkbox in Bootbox

I'm using Bootbox and want to have one of the check boxes pre-selected. For example:
bootbox.prompt({
title: 'What would you like on your pizza?',
inputType: 'checkbox',
inputOptions: [
{
text: 'pepperoni',
value: '1',
},
{
text: 'mushrooms',
value: '2',
},
{
text: 'onions',
value: '3',
}
],
callback: function (result) {
console.log(result);
};
Lets say that I want to have the first item in the array, which is pepperoni, selected as a default. Is it possible to do this using Bootbox? Thanks in advance.
You need to add the value option to prompt.
For a single checked option (https://jsfiddle.net/j7wgncsf/):
bootbox.prompt({
title: 'What would you like on your pizza?',
inputType: 'checkbox',
value: '1', // <----- this
inputOptions: [
{
text: 'pepperoni',
value: '1',
},
{
text: 'mushrooms',
value: '2',
},
{
text: 'onions',
value: '3',
}
],
callback: function (result) {
console.log(result);
}
});
Or, to have multiple options checked, use an array (https://jsfiddle.net/yasok05p/):
bootbox.prompt({
title: 'What would you like on your pizza?',
inputType: 'checkbox',
value: ['1', '2'],// <----- this
inputOptions: [
{
text: 'pepperoni',
value: '1',
},
{
text: 'mushrooms',
value: '2',
},
{
text: 'onions',
value: '3',
}
],
callback: function (result) {
console.log(result);
}
});

Is AlloyUI Form Builder Works For Liferay 6.0.5

Is AlloyUI Form Builder works for liferay 6.0.5. Because our site works on Liferay 6.0.5 and we can't update it with the latest version. I have placed the code mentioned in alloyui.com. I can drag and drop the fields but I can't submit the form. There is a script error in firebug M.loaded[n], I didn't understand what to do.
Suggest something on this.
I am using the below code in liferay 6.0.5 jsp pages
<script src="http://cdn.alloyui.com/3.0.0/aui/aui-min.js">
<link href="http://cdn.alloyui.com/3.0.0/aui-css/css/bootstrap.min.css" rel="stylesheet"></link>
<div id="myFormBuilder"></div>
<script>
YUI().use(
'aui-form-builder',
function(Y) {
new Y.FormBuilder(
{
availableFields: [
{
iconClass: 'form-builder-field-icon-text',
id: 'firstName1',
label: 'First Name',
readOnlyAttributes: ['name'],
type: 'text',
//unique: true,
width: 75
},
{
iconClass: 'form-builder-field-icon-text',
id: 'lastName',
label: 'Last Name',
readOnlyAttributes: ['name'],
type: 'text',
//unique: true,
width: 75
},
{
iconClass: 'form-builder-field-icon-text',
id: 'preferredName',
label: 'Preferred Name',
readOnlyAttributes: ['name'],
type: 'text',
//unique: true,
width: 75
},
{
iconClass: 'form-builder-field-icon-text',
id: 'emailAddress',
label: 'Email Address',
readOnlyAttributes: ['name'],
type: 'text',
//unique: true,
width: 75
},
{
iconClass: 'form-builder-field-icon-radio',
label: 'Gender',
options: [
{
label: 'Male',
value: 'male'
},
{
label: 'Female',
value: 'female'
}
],
type: 'radio'
},
{
iconClass: 'form-builder-field-icon-button',
label: 'Button',
type: 'button'
},
],
boundingBox: '#myFormBuilder',
fields: [
{
label: 'City',
options: [
{
label: 'Ney York',
value: 'new york'
},
{
label: 'Chicago',
value: 'chicago'
}
],
predefinedValue: 'chicago',
type: 'select'
},
{
label: 'Colors',
options: [
{
label: 'Red',
value: 'red'
},
{
label: 'Green',
value: 'green'
},
{
label: 'Blue',
value: 'blue'
}
],
type: 'radio'
}
]
}
).render();
}
);
</script>
It is NOT possible to use the aui-form-builder in Liferay 6.0.
According to the Liferay Integration wiki article, Liferay 6.0 uses AlloyUI 1.0.3. After searching the source in the AlloyUI 1.0.3 tag, it seems like the aui-form-builder did not exist in that version. As far as I can tell from the API docs, aui-form-builder was added in the 2.0.x version.
Note: it is not possible to upgrade to a new major version of AlloyUI in Liferay either.

Sencha Touch: Problems with ext.List inside a Tabpanel?

Learning Sencha Touch, and already love it. Much better then JQTouch in my opinion. Just working on some app idea I had, and I need to have 2 tabs where the first tab will hold a ext.List with some data. I've come this far, but have one problem I can't figure out.
Problem: The detailpanel won't show when I touch a name from the list. When it wasn't in a tab panel, I had no problems at all. Tried the forums, can't find the solution.
This is my entire code (based upon many examples):
ShotjesApp = new Ext.Application({
name: "Shotjes",
launch: function() {
ShotjesApp.detailPanel = new Ext.Panel({
id: 'detailpanel',
tpl: 'Omschrijving: {Naam} <br> <br> {Inhoud}',
dockedItems: [
{
xtype: 'toolbar',
items: [{
text: 'terug',
ui: 'back',
handler: function() {
ShotjesApp.Viewport.setActiveItem('listwrapper', {type:'slide', direction:'right'});
}
}]
}
]
});
ShotjesApp.listPanel = new Ext.List({
id: 'disclosurelist',
store: ListStore,
itemTpl: '<div class="contact">{Naam} {Basis}</div>',
grouped: true,
onItemDisclosure: function(record, btn, index) {
var naam = record.data.Naam;
ShotjesApp.detailPanel.update(record.data);
ShotjesApp.Viewport.setActiveItem('detailpanel') //THIS WON'T WORK?
ShotjesApp.detailPanel.dockedItems.items[0].setTitle(naam);
}
});
ShotjesApp.listWrapper = new Ext.Panel ({
id: 'listwrapper',
layout: 'fit',
items: [ShotjesApp.listPanel],
dockedItems: [
{
dock : 'top',
xtype: 'toolbar',
title: 'Shotjes'
}],
});
this.mainView = new Ext.TabPanel({
tabBar: {
dock: 'bottom',
ui: 'dark',
layout: { pack: 'center' }
},
cardSwitchAnimation: {
type: 'fade',
cover: true
},
items:[{
title: 'Shotjes',
cls: 'card 1',
id: 'card 1',
items: [ShotjesApp.listWrapper, ShotjesApp.detailPanel] ,
iconCls: 'home',
layout: 'card',
}, {
title: 'About',
cls: 'card 2',
id: 'card 2',
html: 'about',
iconCls: 'calendar',
layout: 'card',
}
],
tabBarDock: 'bottom',
fullscreen: true,
layout: 'fit'
});
this.Viewport = this.mainView;
}
});
try this
ShotjesApp.Viewport.setActiveItem(ShotjesApp.detailPanel);
Also in your code the semicolon is missing.
Cool, thanks. I also added this, otherwise the slide would open as a new tab:
ShotjesApp.Viewport = new Ext.Panel ({
fullscreen: true,
layout: 'card',
cardSwitchAnimation: 'slide',
items: [ShotjesApp.listWrapper, ShotjesApp.detailPanel]
});
Combined with your change, it works perfectly..
One huge problem though. Because the Viewport is Fullscreen, The second tab won't show when I press it. When I set the second tab to Fullscreen: true, I see the animation, but first tab is still on top of it.
When I change fullscreen: false in the Viewport, the old problem comes back and the details pane won't show.