posabsolute/inker

View on GitHub
src/templates/components/jsonld/actions/_component.jsonld.one-click-action.html

Summary

Maintainability
Test Coverage
<!-- 
JSON-LD One Click Action
https://developers.google.com/gmail/markup/reference/one-click-action
@type {string} ConfirmAction || SaveAction
@name {string} textshown in inbox
@url  {string}  Url action
@description {string} Call description

* ---- *
 
One Click actions currently supported in Gmail and Inbox are:

* ConfirmAction
* SaveAction

You may add a one-click confirm button to emails requiring users to approve, confirm and acknowledge something. Once the user clicks on the button, an http request will be issued from Google to your service, recording the confirmation. ConfirmAction can only be interacted with once.

SaveAction can be used to describe interactions like saving a coupon or adding songs to the listen queue. SaveAction can only be interacted with once.

-->



{% macro jsonldOneClick() %}
<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "EmailMessage",
  "potentialAction": {
    "@type": "{{'{{ jsonLD.type }}'}}",
    "name": "{{'{{ jsonLD.name }}'}}",
    "handler": {
      "@type": "HttpActionHandler",
      "url": "{{'{{ jsonLD.url }}'}}"
    }
  },
  "description": "{{'{{ jsonLD.description }}'}}"
}
</script>
{% endmacro %}