{
  "format": "ghost-plugin/1",
  "id": "parcels",
  "version": "1.0.0",
  "name": "Parcels",
  "tagline": "Delivery texts in one tab, tracking numbers a press away",
  "description": "Texts about a parcel (shipped, out for delivery, delivered, a missed delivery) go to a Parcels tab. Where a text gives a tracking number, the row shows it and a press copies it. It can silence parcel texts, and answer a courier for you with a line you send yourself. Nobody in your contacts is ever sorted.",
  "icon": "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAV0lEQVR42u3YsQ0AAARFQfsvzQg6kZ+7ARSvEFEFAAAAsOjnBBBAgNsAKXMEEEAAAQQQwB0ggAACWIICCCCAAAIIIIAAAggggAACCOAfIIAAAgAAABBmAFislQaarP23AAAAAElFTkSuQmCC",
  "symbol": "map-pin",
  "hue": "indigo",
  "shelf": "organise",
  "labels": [
    "deliveries",
    "sorting"
  ],
  "permissions": [
    "sort",
    "copy",
    "write",
    "move",
    "mute",
    "links"
  ],
  "links": [
    "https://example.com/plugins/parcels/help"
  ],
  "developer": "yourname",
  "support": "https://example.com/plugins/parcels",
  "settings": [
    {
      "type": "choice",
      "key": "level",
      "label": "What counts as a parcel",
      "options": [
        {
          "value": "strict",
          "label": "Only clear delivery texts"
        },
        {
          "value": "loose",
          "label": "Anything about shipping",
          "hint": "Catches more, and now and then a text that isn't about a parcel."
        }
      ],
      "default": "strict"
    },
    {
      "type": "toggle",
      "key": "quiet",
      "label": "Silence parcel texts",
      "hint": "No sound or banner for texts in Parcels. They still arrive.",
      "default": false,
      "icon": "bell"
    }
  ],
  "rules": {
    "tags": [
      {
        "tag": "parcel",
        "any": [
          "your {words:0-3} has shipped",
          "your {words:0-3} is out for delivery",
          "out for delivery",
          "has been delivered",
          "missed delivery",
          "delivery attempt"
        ]
      },
      {
        "tag": "parcel",
        "any": [
          "shipped",
          "dispatched",
          "on its way"
        ],
        "when": {
          "setting": {
            "key": "level",
            "is": "loose"
          }
        }
      },
      {
        "tag": "track",
        "any": [
          "tracking number {code:8-24}",
          "tracking number: {code:8-24}",
          "tracking no. {code:8-24}"
        ],
        "when": {
          "tagged": [
            "parcel"
          ]
        },
        "detail": {
          "from": "token"
        }
      }
    ],
    "sections": [
      {
        "key": "parcels",
        "label": "Parcels",
        "icon": "map-pin",
        "kind": "tab",
        "takes": {
          "tagged": [
            "parcel"
          ]
        },
        "row": {
          "value": "{tag:track}",
          "caption": "A parcel",
          "face": {
            "name": "Parcels",
            "color": "#4F46E5"
          },
          "end": "copytrack"
        }
      }
    ],
    "actions": [
      {
        "id": "copytrack",
        "label": "Copy the tracking number",
        "icon": "copy",
        "slots": [
          "row",
          "list.conversation.menu",
          "conversation.header"
        ],
        "when": {
          "tagged": [
            "track"
          ]
        },
        "do": "copy",
        "text": "{tag:track}",
        "say": "Tracking number copied"
      },
      {
        "id": "neighbour",
        "label": "Ask for it to go to a neighbour",
        "icon": "pen-line",
        "slots": [
          "conversation.message.menu"
        ],
        "when": {
          "tagged": [
            "parcel"
          ]
        },
        "do": "write",
        "text": "If I'm out, please leave it with a neighbour. Thank you!"
      },
      {
        "id": "help",
        "label": "Where's my parcel?",
        "icon": "external-link",
        "slots": [
          "list.conversation.menu"
        ],
        "when": {
          "tagged": [
            "parcel"
          ]
        },
        "do": "link",
        "url": "https://example.com/plugins/parcels/help"
      },
      {
        "id": "notparcel",
        "label": "Not a parcel",
        "icon": "undo-2",
        "slots": [
          "list.conversation.menu"
        ],
        "when": {
          "section": "parcels"
        },
        "do": "move",
        "to": "main"
      }
    ],
    "incoming": [
      {
        "in": "parcels",
        "do": [
          "mute"
        ],
        "setting": "quiet"
      }
    ]
  }
}
