Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const showLocationOnScreen = (conv) => {
const capability = 'actions.capability.SCREEN_OUTPUT';
if (conv.surface.capabilities.has(capability) ||
!conv.available.surfaces.capabilities.has(capability)) {
return conv.close(...responses.sayLocation(userData(conv).location));
}
conv.ask(new NewSurface({
context: responses.newSurfaceContext,
notification: responses.notificationText,
capabilities: capability,
}));
};
function handleSignIn(conv: CONV_TYPE) {
const hasScreen = conv.surface.capabilities.has(SIGN_SURFACE_CAPABILITY);
if (hasScreen) {
return conv.ask(new SignIn());
}
const screenAvailable = conv.available.surfaces.capabilities.has(
SIGN_SURFACE_CAPABILITY
);
if (screenAvailable) {
return conv.ask(
new NewSurface({
context: PROMPTS.SIGN_IN_ASK_FOR_TRANSFER,
notification: 'Link Github to star a repository',
capabilities: SIGN_SURFACE_CAPABILITY,
})
);
} else {
conv.contexts.set(
CONTEXTS.FETCH_TRENDING_FOLLOWUP,
DEFAULT_CONTEXT_LIFE_SPAN
);
return conv.ask(PROMPTS.SIGN_IN_NOT_SUPPORTED);
}
}
const showLocationOnScreen = conv => {
const capability = 'actions.capability.SCREEN_OUTPUT'
if (conv.surface.capabilities.has(capability) ||
!conv.available.surfaces.capabilities.has(capability)) {
return conv.close(...responses.sayLocation(conv.user.storage.location))
}
conv.ask(new NewSurface({
context: responses.newSurfaceContext,
notification: responses.notificationText,
capabilities: capability,
}))
}
const showLocationOnScreen = (conv: DialogflowConversation) => {
const capability: SurfaceCapability = 'actions.capability.SCREEN_OUTPUT'
if (conv.surface.capabilities.has(capability) ||
!conv.available.surfaces.capabilities.has(capability)) {
return conv.close(...responses.sayLocation(conv.user.storage.location))
}
conv.ask(new NewSurface({
context: responses.newSurfaceContext,
notification: responses.notificationText,
capabilities: capability,
}))
}