<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
  mail-lookout add-in manifest (add-in only, XML format).

  This manifest registers a Smart Alerts handler. The handler runs
  on send (OnMessageSend) and uses Outlook's built-in Smart Alerts
  dialog to show the review summary.

  Before you deploy:
    1. Replace the <Id> below with your own GUID.
    2. Replace every https://avishaikofun.com URL with your host.
    3. Replace ProviderName, SupportUrl, and AppDomains.

  SendMode is SoftBlock: a send this add-in cancels goes back to the
  draft, with no one-click "send anyway". Users who want that escape
  hatch turn on "allow send anyway" in the Settings pane, which makes
  the handler pass sendModeOverride="promptUser" at runtime. The
  override only ever relaxes, so the strict behaviour has to be the one
  declared here.

  Do not change this to Block. Block is the only mode that also refuses
  the send when the add-in is unavailable, which is the failure this
  add-in is worst at — but AppSource rejects it outright:

    Error #1: Block SendMode is not allowed

  So a Marketplace-distributed add-in cannot close that gap; SoftBlock
  and PromptUser both send the message when the runtime fails to load.
  Block is only reachable by sideloading or admin deployment. See the
  limitations section of the README.
-->
<OfficeApp
  xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
  xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0"
  xsi:type="MailApp">

  <Id>7888d7db-1c99-4e49-a191-ea73f4088740</Id>
  <Version>1.1.16.0</Version>
  <ProviderName>Avishai Kofun</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <DisplayName DefaultValue="Mail Lookout" />
  <Description DefaultValue="Review recipients, attachments, and body before an email is sent." />
  <IconUrl DefaultValue="https://avishaikofun.com/assets/icon-64.png" />
  <HighResolutionIconUrl DefaultValue="https://avishaikofun.com/assets/icon-128.png" />
  <SupportUrl DefaultValue="https://avishaikofun.com/support.html" />

  <AppDomains>
    <AppDomain>https://avishaikofun.com</AppDomain>
  </AppDomains>

  <Hosts>
    <Host Name="Mailbox" />
  </Hosts>

  <Requirements>
    <Sets>
      <Set Name="Mailbox" MinVersion="1.15" />
    </Sets>
  </Requirements>

  <!--
    Legacy activation block. Modern clients use VersionOverrides
    below, and Mailbox 1.15 is required to install at all, so every
    client that can install this add-in honours VersionOverrides and
    never activates from here. The block only has to stay valid and
    self-consistent.

    That consistency is the point: FormSettings declares an ItemRead
    form, so the rule below has to say FormType="Read". A FormType of
    "Edit" needs a matching ItemEdit form, and a rule that names a form
    the manifest does not declare is rejected as invalid. It points at
    the task pane rather than commands.html, which is a script-only
    runtime page with nothing to render.
  -->
  <FormSettings>
    <Form xsi:type="ItemRead">
      <DesktopSettings>
        <SourceLocation DefaultValue="https://avishaikofun.com/taskpane.html" />
        <RequestedHeight>250</RequestedHeight>
      </DesktopSettings>
    </Form>
  </FormSettings>

  <Permissions>ReadWriteItem</Permissions>

  <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read" />
  </Rule>

  <DisableEntityHighlighting>false</DisableEntityHighlighting>

  <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
    <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">

      <Requirements>
        <bt:Sets DefaultMinVersion="1.15">
          <bt:Set Name="Mailbox" MinVersion="1.15" />
        </bt:Sets>
      </Requirements>

      <Hosts>
        <Host xsi:type="MailHost">
          <!--
            The runtime that hosts the send handler. New Outlook
            and Outlook on the web load commands.html in a browser
            runtime. The javascript override is for the legacy
            JS-only runtime on classic Windows, which this project
            does not target. See the README limitations section.
          -->
          <Runtimes>
            <Runtime resid="WebViewRuntime.Url">
              <Override type="javascript" resid="JSRuntime.Url" />
            </Runtime>
          </Runtimes>

          <DesktopFormFactor>
            <FunctionFile resid="WebViewRuntime.Url" />

            <!-- Task pane opened from the Smart Alerts Take Action button. -->
            <ExtensionPoint xsi:type="MessageComposeCommandSurface">
              <OfficeTab id="TabDefault">
                <Group id="ReviewGroup">
                  <Label resid="ReviewGroup.Label" />
                  <Control xsi:type="Button" id="ReviewPaneButton">
                    <Label resid="ReviewPaneButton.Label" />
                    <Supertip>
                      <Title resid="ReviewPaneButton.Label" />
                      <Description resid="ReviewPaneButton.Tooltip" />
                    </Supertip>
                    <Icon>
                      <bt:Image size="16" resid="Icon.16" />
                      <bt:Image size="32" resid="Icon.32" />
                      <bt:Image size="80" resid="Icon.80" />
                    </Icon>
                    <Action xsi:type="ShowTaskpane">
                      <SourceLocation resid="Taskpane.Url" />
                    </Action>
                  </Control>
                  <Control xsi:type="Button" id="SettingsButton">
                    <Label resid="SettingsButton.Label" />
                    <Supertip>
                      <Title resid="SettingsButton.Label" />
                      <Description resid="SettingsButton.Tooltip" />
                    </Supertip>
                    <Icon>
                      <bt:Image size="16" resid="Icon.16" />
                      <bt:Image size="32" resid="Icon.32" />
                      <bt:Image size="80" resid="Icon.80" />
                    </Icon>
                    <Action xsi:type="ShowTaskpane">
                      <SourceLocation resid="Settings.Url" />
                    </Action>
                  </Control>
                </Group>
              </OfficeTab>
            </ExtensionPoint>

            <!-- The send-time event that drives the whole add-in. -->
            <ExtensionPoint xsi:type="LaunchEvent">
              <LaunchEvents>
                <LaunchEvent Type="OnMessageSend" FunctionName="onMessageSendHandler" SendMode="SoftBlock" />
              </LaunchEvents>
              <SourceLocation resid="WebViewRuntime.Url" />
            </ExtensionPoint>
          </DesktopFormFactor>
        </Host>
      </Hosts>

      <Resources>
        <bt:Images>
          <bt:Image id="Icon.16" DefaultValue="https://avishaikofun.com/assets/icon-16.png" />
          <bt:Image id="Icon.32" DefaultValue="https://avishaikofun.com/assets/icon-32.png" />
          <bt:Image id="Icon.80" DefaultValue="https://avishaikofun.com/assets/icon-80.png" />
        </bt:Images>

        <bt:Urls>
          <bt:Url id="WebViewRuntime.Url" DefaultValue="https://avishaikofun.com/commands.html" />
          <bt:Url id="JSRuntime.Url" DefaultValue="https://avishaikofun.com/assets/commands.js" />
          <bt:Url id="Taskpane.Url" DefaultValue="https://avishaikofun.com/taskpane.html" />
          <bt:Url id="Settings.Url" DefaultValue="https://avishaikofun.com/settings.html" />
        </bt:Urls>

        <bt:ShortStrings>
          <bt:String id="ReviewGroup.Label" DefaultValue="Mail Lookout" />
          <bt:String id="ReviewPaneButton.Label" DefaultValue="Open review" />
          <bt:String id="SettingsButton.Label" DefaultValue="Settings" />
        </bt:ShortStrings>

        <bt:LongStrings>
          <bt:String id="ReviewPaneButton.Tooltip" DefaultValue="Open the Mail Lookout review pane." />
          <bt:String id="SettingsButton.Tooltip" DefaultValue="Edit Mail Lookout settings: internal domains and the default wait." />
        </bt:LongStrings>
      </Resources>

    </VersionOverrides>
  </VersionOverrides>

</OfficeApp>
