<?xml version="1.0" encoding="UTF-8"?>
<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" xsi:type="MailApp">

    <!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->

    <!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
    <Id>96232c55-0a3c-481b-ba94-eb88b04f284f</Id>

    <!--Version. Updates from the store only get triggered if there is a version change. -->
    <Version>10118.42877</Version>
    <ProviderName>Mailbutler</ProviderName>
    <DefaultLocale>en-US</DefaultLocale>

    <!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
    <DisplayName DefaultValue="Mailbutler" />
    <Description DefaultValue="Outlook add-in for Mailbutler" />

    <!-- Icon for your add-in. Used on installation screens and the add-ins dialog. -->
    <IconUrl DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/64x64iconic.png" />
    <HighResolutionIconUrl DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/128x128iconic.png" />

    <!--If you plan to submit this add-in to the Office Store, uncomment the SupportUrl element below-->
    <SupportUrl DefaultValue="https://help.mailbutler.io" />

    <!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
    <AppDomains>
        <AppDomain>https://edge.mailbutler.io</AppDomain>
        <AppDomain>https://beta.mailbutler.io</AppDomain>
        <AppDomain>https://bowtie.mailbutler.io</AppDomain>
        <AppDomain>https://mailbutler.eu.ngrok.io</AppDomain>
    </AppDomains>
    <!--End Basic Settings. -->

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

    <Requirements>
        <Sets>
            <!-- Support Office 2013 on Windows, including IE11 -->
            <Set Name="Mailbox" MinVersion="1.4" />
        </Sets>
    </Requirements>

    <FormSettings>
        <Form xsi:type="ItemRead">
            <DesktopSettings>
                <SourceLocation DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/index.html" />
                <!-- No idea what this height is for! -->
                <RequestedHeight>250</RequestedHeight>
            </DesktopSettings>
        </Form>
    </FormSettings>

    <Permissions>ReadWriteMailbox</Permissions>

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

    <DisableEntityHighlighting>false</DisableEntityHighlighting>

    <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
        <Hosts>
            <Host xsi:type="MailHost">
                <DesktopFormFactor>
                    <!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
                    <FunctionFile resid="functionFile" />

                    <!-- Message Read -->
                    <ExtensionPoint xsi:type="MessageReadCommandSurface">
                        <!-- Use the default tab of the ExtensionPoint or create your own with
                        <CustomTab id="myTab"> -->
                        <OfficeTab id="TabDefault">
                            <!-- Only a single group allowed for the default tab -->
                            <Group id="msgReadGroup">
                                <Label resid="groupLabel" />

                                <Control xsi:type="Button" id="msgReadOpenPaneButton">
                                    <Label resid="paneReadButtonLabel" />
                                    <Supertip>
                                        <Title resid="paneReadSuperTipTitle" />
                                        <Description resid="paneReadSuperTipDescription" />
                                    </Supertip>
                                    <Icon>
                                        <bt:Image size="16" resid="icon25" />
                                        <bt:Image size="32" resid="icon32" />
                                        <bt:Image size="80" resid="icon80" />
                                    </Icon>
                                    <Action xsi:type="ShowTaskpane">
                                        <SourceLocation resid="messageReadTaskPaneUrl" />
                                    </Action>
                                </Control>
                            </Group>
                        </OfficeTab>
                    </ExtensionPoint>

                    <ExtensionPoint xsi:type="MessageComposeCommandSurface">
                        <!-- Use the default tab of the ExtensionPoint or create your own with
                        <CustomTab id="myTab"> -->
                        <OfficeTab id="TabDefault">
                            <!-- Only a single group allowed for the default tab -->
                            <Group id="msgComposeGroup">
                                <Label resid="groupLabel" />

                                <Control xsi:type="Button" id="msgComposeOpenPaneButton">
                                    <Label resid="paneReadButtonLabel" />
                                    <Supertip>
                                        <Title resid="paneReadSuperTipTitle" />
                                        <Description resid="paneReadSuperTipDescription" />
                                    </Supertip>
                                    <Icon>
                                        <bt:Image size="16" resid="icon16" />
                                        <bt:Image size="32" resid="icon32" />
                                        <bt:Image size="80" resid="icon80" />
                                    </Icon>
                                    <Action xsi:type="ShowTaskpane">
                                        <SourceLocation resid="messageReadTaskPaneUrl" />
                                    </Action>
                                </Control>
                                <Control xsi:type="Button" id="msgComposeSendButton">
                                    <Label resid="sendButtonLabel" />
                                    <Supertip>
                                        <Title resid="sendButtonSuperTipTitle" />
                                        <Description resid="sendButtonSuperTipDescription" />
                                    </Supertip>
                                    <Icon>
                                        <bt:Image size="16" resid="sendIcon25" />
                                        <bt:Image size="32" resid="sendIcon32" />
                                        <bt:Image size="80" resid="sendIcon80" />
                                    </Icon>
                                    <Action xsi:type="ExecuteFunction">
                                        <FunctionName>sendEmailThroughBackend</FunctionName>
                                    </Action>
                                </Control>
                            </Group>
                        </OfficeTab>
                    </ExtensionPoint>
                    <!-- Go to http://aka.ms/ExtensionPointsCommands to learn how to add more
                    Extension Points: MessageRead, AppointmentOrganizer, AppointmentAttendee -->
                </DesktopFormFactor>
            </Host>
        </Hosts>

        <Resources>
            <bt:Images>
                <bt:Image id="icon16" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/16x16iconic.png" />
                <bt:Image id="icon25" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/25x25iconic.png" />
                <bt:Image id="icon32" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/32x32iconic.png" />
                <bt:Image id="icon80" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/80x80iconic.png" />
                <bt:Image id="sendIcon16" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/16x16send.png" />
                <bt:Image id="sendIcon25" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/25x25send.png" />
                <bt:Image id="sendIcon32" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/32x32send.png" />
                <bt:Image id="sendIcon80" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/80x80send.png" />
                <bt:Image id="warning32" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/32x32warning.png" />
            </bt:Images>
            <bt:Urls>
                <bt:Url id="functionFile" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/functions.html" />
                <bt:Url id="messageReadTaskPaneUrl" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/index.html" />
            </bt:Urls>
            <bt:ShortStrings>
                <bt:String id="groupLabel" DefaultValue="Mailbutler" />
                <bt:String id="paneReadButtonLabel" DefaultValue="Show Sidebar" />
                <bt:String id="paneReadSuperTipTitle" DefaultValue="Open the Mailbutler sidebar" />
                <bt:String id="sendButtonLabel" DefaultValue="Tailored Send" />
                <bt:String id="sendButtonSuperTipTitle" DefaultValue="Send to each recipient individually" />
            </bt:ShortStrings>
            <bt:LongStrings>
                <bt:String id="paneReadSuperTipDescription" DefaultValue="Opens a sidebar that provides access to all Mailbutler features." />
                <bt:String id="sendButtonSuperTipDescription" DefaultValue="Send personalized emails to each recipient, enabling features like Mail Merge and Per-recipient Tracking." />
            </bt:LongStrings>
        </Resources>

        <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
            <Hosts>
                <Host xsi:type="MailHost">
                    <!-- Event-based activation happens in a lightweight runtime.-->
                    <Runtimes>
                        <!-- HTML file including reference to or inline JavaScript event handlers. This is used by Outlook on the web. -->
                        <Runtime resid="WebViewEventsRuntime.Url">
                            <!-- JavaScript file containing event handlers. This is ONLY used by Outlook Classic on Windows. -->
                            <Override type="javascript" resid="JSEventsRuntime.Url" />
                        </Runtime>
                    </Runtimes>

                    <DesktopFormFactor>
                        <SupportsSharedFolders>true</SupportsSharedFolders>
                        <!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
                        <FunctionFile resid="functionFile" />

                        <!-- Message Read -->
                        <ExtensionPoint xsi:type="MessageReadCommandSurface">
                            <!-- Use the default tab of the ExtensionPoint or create your own with
                            <CustomTab id="myTab"> -->
                            <OfficeTab id="TabDefault">
                                <!-- Only a single group allowed for the default tab -->
                                <Group id="msgReadGroup">
                                    <Label resid="groupLabel" />

                                    <Control xsi:type="Button" id="msgReadOpenPaneButton">
                                        <Label resid="paneReadButtonLabel" />
                                        <Supertip>
                                            <Title resid="paneReadSuperTipTitle" />
                                            <Description resid="paneReadSuperTipDescription" />
                                        </Supertip>
                                        <Icon>
                                            <bt:Image size="16" resid="icon16" />
                                            <bt:Image size="32" resid="icon32" />
                                            <bt:Image size="80" resid="icon80" />
                                        </Icon>
                                        <Action xsi:type="ShowTaskpane">
                                            <SourceLocation resid="messageReadTaskPaneUrl" />
                                            <SupportsPinning>true</SupportsPinning>
                                            <!-- Unfortunately, `SupportsNoItemContext` and `SupportsMultiSelect` breaks switching between 'read' and 'compose' sidebar, at least in macOS app. Maybe we can revisit this at some point... -->
                                            <!-- <SupportsNoItemContext>true</SupportsNoItemContext> -->
                                        </Action>
                                    </Control>
                                </Group>
                            </OfficeTab>
                        </ExtensionPoint>

                        <!-- Message Compose -->
                        <ExtensionPoint xsi:type="MessageComposeCommandSurface">
                            <!-- Use the default tab of the ExtensionPoint or create your own with
                            <CustomTab id="myTab"> -->
                            <OfficeTab id="TabDefault">
                                <!-- Only a single group allowed for the default tab -->
                                <Group id="msgComposeGroup">
                                    <Label resid="groupLabel" />

                                    <Control xsi:type="Button" id="msgComposeOpenPaneButton">
                                        <Label resid="paneReadButtonLabel" />
                                        <Supertip>
                                            <Title resid="paneReadSuperTipTitle" />
                                            <Description resid="paneReadSuperTipDescription" />
                                        </Supertip>
                                        <Icon>
                                            <bt:Image size="16" resid="icon25" />
                                            <bt:Image size="32" resid="icon32" />
                                            <bt:Image size="80" resid="icon80" />
                                        </Icon>
                                        <Action xsi:type="ShowTaskpane">
                                            <SourceLocation resid="messageReadTaskPaneUrl" />
                                            <SupportsPinning>true</SupportsPinning>
                                        </Action>
                                    </Control>
                                    <Control xsi:type="Button" id="msgComposeSendButton">
                                        <Label resid="sendButtonLabel" />
                                        <Supertip>
                                            <Title resid="sendButtonSuperTipTitle" />
                                            <Description resid="sendButtonSuperTipDescription" />
                                        </Supertip>
                                        <Icon>
                                            <bt:Image size="16" resid="sendIcon25" />
                                            <bt:Image size="32" resid="sendIcon32" />
                                            <bt:Image size="80" resid="sendIcon80" />
                                        </Icon>
                                        <Action xsi:type="ExecuteFunction">
                                            <FunctionName>sendEmailThroughBackend</FunctionName>
                                        </Action>
                                    </Control>
                                </Group>
                            </OfficeTab>
                        </ExtensionPoint>

                        <ExtensionPoint xsi:type="DetectedEntity">
                            <Label resid="paneReadButtonLabel" />
                            <SourceLocation resid="detectedEntityURL" />
                            <Rule xsi:type="RuleCollection" Mode="And">
                                <Rule xsi:type="ItemHasRegularExpressionMatch"
                                    PropertyName="SenderSMTPAddress"
                                    RegExValue="support@mailbutler\.io"
                                    RegExName="Sender"
                                    Highlight="none" />
                                <Rule xsi:type="ItemHasRegularExpressionMatch"
                                    PropertyName="BodyAsPlaintext"
                                    RegExValue="[A-Za-z0-9]{21,22}"
                                    RegExName="LoginCode"
                                    Highlight="all" />
                            </Rule>
                        </ExtensionPoint>

                        <!-- Enable launching the add-in on the included events. -->
                        <ExtensionPoint xsi:type="LaunchEvent">
                            <LaunchEvents>
                                <LaunchEvent Type="OnNewMessageCompose" FunctionName="onMessageComposeHandler" />
                                <LaunchEvent Type="OnMessageFromChanged" FunctionName="onMessageFromChangedHandler" />
                                <LaunchEvent Type="OnMessageRecipientsChanged" FunctionName="onMessageRecipientsChangedHandler" />
                                <LaunchEvent Type="OnMessageAttachmentsChanged" FunctionName="onMessageAttachmentChangedHandler" />
                                <LaunchEvent Type="OnMessageSend" FunctionName="onMessageSendHandler" SendMode="PromptUser" />
                            </LaunchEvents>
                            <!-- Identifies the runtime to be used (also referenced by the Runtime element). -->
                            <SourceLocation resid="WebViewEventsRuntime.Url" />
                        </ExtensionPoint>
                    </DesktopFormFactor>

                    <MobileFormFactor>
                        <ExtensionPoint xsi:type="MobileMessageReadCommandSurface">
                            <Group id="mobileMsgRead">
                                <Label resid="groupLabel" />

                                <Control xsi:type="MobileButton" id="TaskPaneBtn">
                                    <Label resid="paneReadButtonLabel" />
                                    <Icon xsi:type="bt:MobileIconList">
                                        <bt:Image size="25" scale="1" resid="icon25" />
                                        <bt:Image size="25" scale="2" resid="icon25x2" />
                                        <bt:Image size="25" scale="3" resid="icon25x3" />

                                        <bt:Image size="32" scale="1" resid="icon32" />
                                        <bt:Image size="32" scale="2" resid="icon32x2" />
                                        <bt:Image size="32" scale="3" resid="icon32x3" />

                                        <bt:Image size="48" scale="1" resid="icon48" />
                                        <bt:Image size="48" scale="2" resid="icon48x2" />
                                        <bt:Image size="48" scale="3" resid="icon48x3" />
                                    </Icon>
                                    <Action xsi:type="ShowTaskpane">
                                        <SourceLocation resid="mobileMessageReadTaskPaneUrl" />
                                    </Action>
                                </Control>
                            </Group>
                        </ExtensionPoint>

                        <!-- <ExtensionPoint xsi:type="LaunchEvent">
                            <LaunchEvents>
                                <LaunchEvent Type="OnNewMessageCompose" FunctionName="onMessageComposeHandler" />
                            </LaunchEvents>
                            <SourceLocation resid="WebViewEventsRuntime.Url" />
                        </ExtensionPoint> -->
                    </MobileFormFactor>
                </Host>
            </Hosts>

            <Resources>
                <bt:Images>
                    <bt:Image id="icon16" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/16x16iconic.png" />
                    <bt:Image id="icon25" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/25x25iconic.png" />
                    <bt:Image id="icon25x2" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/25x25iconic@2x.png" />
                    <bt:Image id="icon25x3" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/25x25iconic@3x.png" />
                    <bt:Image id="icon32" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/32x32iconic.png" />
                    <bt:Image id="icon32x2" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/32x32iconic@2x.png" />
                    <bt:Image id="icon32x3" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/32x32iconic@3x.png" />
                    <bt:Image id="icon48" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/48x48iconic.png" />
                    <bt:Image id="icon48x2" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/48x48iconic@2x.png" />
                    <bt:Image id="icon48x3" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/48x48iconic@3x.png" />
                    <bt:Image id="icon80" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/80x80iconic.png" />
                    <bt:Image id="sendIcon16" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/16x16send.png" />
                    <bt:Image id="sendIcon25" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/25x25send.png" />
                    <bt:Image id="sendIcon32" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/32x32send.png" />
                    <bt:Image id="sendIcon80" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/80x80send.png" />
                    <bt:Image id="warning32" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/static/32x32warning.png" />
                </bt:Images>
                <bt:Urls>
                    <bt:Url id="functionFile" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/functions.html" />
                    <bt:Url id="WebViewEventsRuntime.Url" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/events.html" />
                    <bt:Url id="JSEventsRuntime.Url" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/js_windows/events.js" />
                    <bt:Url id="messageReadTaskPaneUrl" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/index.html" />
                    <bt:Url id="mobileMessageReadTaskPaneUrl" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/mobile.html" />
                    <bt:Url id="detectedEntityURL" DefaultValue="https://staging.outlook.mailbutler.io/10118.42877/detectedEntity.html" />
                </bt:Urls>
                <bt:ShortStrings>
                    <bt:String id="groupLabel" DefaultValue="Mailbutler" />
                    <bt:String id="paneReadButtonLabel" DefaultValue="Show Sidebar" />
                    <bt:String id="paneReadSuperTipTitle" DefaultValue="Open the Mailbutler sidebar" />
                    <bt:String id="sendButtonLabel" DefaultValue="Tailored Send" />
                    <bt:String id="sendButtonSuperTipTitle" DefaultValue="Send to each recipient individually" />
                </bt:ShortStrings>
                <bt:LongStrings>
                    <bt:String id="paneReadSuperTipDescription" DefaultValue="Opens a sidebar that provides access to all Mailbutler features." />
                    <bt:String id="sendButtonSuperTipDescription" DefaultValue="Send personalized emails to each recipient, enabling features like Mail Merge and Per-recipient Tracking." />
                </bt:LongStrings>
            </Resources>

            <ExtendedPermissions>
                <ExtendedPermission>AppendOnSend</ExtendedPermission>
            </ExtendedPermissions>
        </VersionOverrides>
    </VersionOverrides>
</OfficeApp>