jovotech / jovo-framework

🔈 The React for Voice and Chat: Build Apps for Alexa, Messenger, Instagram, the Web, and more
https://www.jovo.tech
Apache License 2.0
1.68k stars 309 forks source link

🔧 Make AlexaHandles.onTask global #1608

Closed sadlowskij closed 8 months ago

sadlowskij commented 9 months ago

Proposed Changes

This adds the global flag to the onTask HanldeOptions, so the user won't have to manually add this, in case the handler is not placed in a global Component. This is the example request from the docs:

{
    "type": "LaunchRequest",
    "requestId": "string",
    "timestamp": "string",
    "locale": "string",
    "task": {
        "name": "AMAZON.PrintPDF",
        "version": "1",
        "input": {
            "@type": "PrintPDFRequest",
            "@version": "1",
            "title": "Flywheel",
            "description": "Flywheel",
            "url": "http://www.example.com/flywheel.pdf"
        }
    }
}

As can be seen, a task comes in with a LaunchRequest, therefore should never be possible within a session. This is why I think it'd be easier to already include the global flag in the onTask function.

Types of Changes

Checklist

sadlowskij commented 9 months ago

I pushed commit 08b0ffe on the wrong branch by mistake, which is why I instantly reverted it in this branch and pr. This is a seperate issue :)