@yoctol/kurator
Advanced tools
Comparing version 0.5.10 to 0.5.11
{ | ||
"name": "@yoctol/kurator", | ||
"license": "UNLICENSED", | ||
"version": "0.5.10", | ||
"version": "0.5.11", | ||
"main": "src/index.js", | ||
@@ -6,0 +6,0 @@ "files": [ |
@@ -6,2 +6,3 @@ const BottenderTransformer = require('../BottenderTransformer'); | ||
context: { | ||
platform: 'messenger', | ||
sendText: jest.fn(), | ||
@@ -537,2 +538,3 @@ sendImage: jest.fn(), | ||
{ | ||
platform: 'messenger', | ||
type: 'text', | ||
@@ -544,2 +546,3 @@ descriptor: { | ||
{ | ||
platform: 'messenger', | ||
type: 'text', | ||
@@ -567,2 +570,3 @@ descriptor: { | ||
{ | ||
platform: 'messenger', | ||
type: 'text', | ||
@@ -574,2 +578,3 @@ descriptor: { | ||
{ | ||
platform: 'messenger', | ||
type: 'quick_replies', | ||
@@ -615,2 +620,3 @@ descriptor: {}, | ||
{ | ||
platform: 'messenger', | ||
type: 'text', | ||
@@ -622,2 +628,3 @@ descriptor: { | ||
{ | ||
platform: 'messenger', | ||
type: 'quick_replies', | ||
@@ -652,2 +659,3 @@ descriptor: {}, | ||
{ | ||
platform: 'messenger', | ||
type: 'text', | ||
@@ -659,2 +667,3 @@ descriptor: { | ||
{ | ||
platform: 'messenger', | ||
type: 'quick_replies', | ||
@@ -689,2 +698,3 @@ descriptor: {}, | ||
{ | ||
platform: 'messenger', | ||
type: 'text', | ||
@@ -696,2 +706,3 @@ descriptor: { | ||
{ | ||
platform: 'messenger', | ||
type: 'quick_replies', | ||
@@ -726,2 +737,3 @@ descriptor: {}, | ||
{ | ||
platform: 'messenger', | ||
type: 'text', | ||
@@ -745,2 +757,3 @@ descriptor: { | ||
{ | ||
platform: 'messenger', | ||
type: 'quick_replies', | ||
@@ -801,2 +814,3 @@ descriptor: {}, | ||
{ | ||
platform: 'messenger', | ||
type: 'image', | ||
@@ -808,2 +822,3 @@ descriptor: { | ||
{ | ||
platform: 'messenger', | ||
type: 'quick_replies', | ||
@@ -852,2 +867,3 @@ descriptor: {}, | ||
{ | ||
platform: 'messenger', | ||
type: 'image', | ||
@@ -874,2 +890,3 @@ descriptor: { | ||
{ | ||
platform: 'messenger', | ||
type: 'quick_replies', | ||
@@ -943,2 +960,3 @@ descriptor: {}, | ||
{ | ||
platform: 'messenger', | ||
type: 'carousel', | ||
@@ -1004,2 +1022,3 @@ descriptor: {}, | ||
{ | ||
platform: 'messenger', | ||
type: 'quick_replies', | ||
@@ -1106,2 +1125,3 @@ descriptor: {}, | ||
{ | ||
platform: 'messenger', | ||
type: 'weight', | ||
@@ -1125,2 +1145,3 @@ descriptor: {}, | ||
{ | ||
platform: 'messenger', | ||
type: 'quick_replies', | ||
@@ -1170,2 +1191,3 @@ descriptor: {}, | ||
{ | ||
platform: 'messenger', | ||
type: 'weight', | ||
@@ -1191,2 +1213,3 @@ descriptor: { | ||
{ | ||
platform: 'messenger', | ||
type: 'quick_replies', | ||
@@ -1242,2 +1265,3 @@ descriptor: {}, | ||
{ | ||
platform: 'messenger', | ||
type: 'text', | ||
@@ -1249,2 +1273,3 @@ descriptor: { | ||
{ | ||
platform: 'messenger', | ||
type: 'rpc', | ||
@@ -1284,2 +1309,3 @@ descriptor: { | ||
{ | ||
platform: 'messenger', | ||
type: 'text', | ||
@@ -1291,2 +1317,3 @@ descriptor: { | ||
{ | ||
platform: 'messenger', | ||
type: 'bridge', | ||
@@ -1293,0 +1320,0 @@ descriptor: { |
@@ -88,2 +88,3 @@ const nock = require('nock'); | ||
const context = { | ||
platform: 'messenger', | ||
sendText: jest.fn(), | ||
@@ -102,2 +103,3 @@ }; | ||
const context = { | ||
platform: 'messenger', | ||
sendText: jest.fn(), | ||
@@ -118,2 +120,3 @@ }; | ||
const context = { | ||
platform: 'messenger', | ||
sendText: jest.fn(), | ||
@@ -148,2 +151,3 @@ }; | ||
const context = { | ||
platform: 'messenger', | ||
event: { | ||
@@ -167,2 +171,3 @@ isText: false, | ||
const context = { | ||
platform: 'messenger', | ||
event: { | ||
@@ -186,2 +191,3 @@ isText: false, | ||
const context = { | ||
platform: 'messenger', | ||
event: { | ||
@@ -205,2 +211,3 @@ isText: true, | ||
const context = { | ||
platform: 'messenger', | ||
event: { | ||
@@ -224,2 +231,3 @@ isText: true, | ||
const context = { | ||
platform: 'messenger', | ||
event: { | ||
@@ -226,0 +234,0 @@ isText: false, |
@@ -5,3 +5,7 @@ const B = require('bottender-compose'); | ||
const pick = require('lodash/pick'); | ||
const mapValues = require('lodash/mapValues'); | ||
const groupBy = require('lodash/groupBy'); | ||
const toImagemapAction = require('./toImagemapAction'); | ||
const buttonKeyWhitelist = { | ||
@@ -133,2 +137,4 @@ web_url: ['url', 'title', 'messenger_extensions'], | ||
return toCarouselAction(action, messageOptions); | ||
case 'imagemap': | ||
return toImagemapAction(action, messageOptions); | ||
case 'rpc': | ||
@@ -152,6 +158,11 @@ return kurator.getLocalAction(action.descriptor.name, { | ||
function createFromActionDefinition(def, { kurator } = {}) { | ||
const validActions = def.actions | ||
.map(createBottenderComposeActionFactory({ kurator })) | ||
.filter(action => typeof action === 'function'); | ||
return B.series(validActions); | ||
return B.platform( | ||
mapValues(groupBy(def.actions, 'platform'), actions => | ||
B.series( | ||
actions | ||
.map(createBottenderComposeActionFactory({ kurator })) | ||
.filter(action => typeof action === 'function') | ||
) | ||
) | ||
); | ||
} | ||
@@ -158,0 +169,0 @@ |
67669
12
2472