{
  "key": "com.stiltsoft.jira.smart-attachments.stage",
  "baseUrl": "https://smart-attachments-app-stage.stilt.run",
  "name": "Smart Attachments for Jira Cloud",
  "description": "The Smart Attachments for Jira Cloud app is a solution which lets you categorize attachments with labels, filter documents, and group them against labels.",
  "enableLicensing": true,
  "authentication": {
    "type": "jwt"
  },
  "vendor": {
    "name": "Stiltsoft Europe",
    "url": "https://www.stiltsoft.com"
  },
  "lifecycle": {
    "installed": "/installed",
    "uninstalled": "/uninstalled"
  },
  "scopes": [
    "READ",
    "WRITE",
    "DELETE"
  ],
  "apiMigrations": {
    "gdpr": true,
    "context-qsh": true
  },
  "cloudAppMigration": {
    "migrationWebhookPath" : "/migration"
  },
  "modules": {
    "generalPages": [
      {
        "key": "find-attachments-indexation",
        "url": "/attachment-indexation",
        "location": "admin_plugins_menu/find-attachments-section",
        "weight": 100,
        "name": {
          "value": "Attachment Indexation"
        },
        "conditions": [
          {
            "condition": "user_is_admin"
          }
        ]
      },
      {
        "key": "label-management",
        "url": "/label-management",
        "location": "admin_plugins_menu/find-attachments-section",
        "weight": 101,
        "name": {
          "value": "Label Management"
        },
        "conditions": [
          {
            "condition": "user_is_admin"
          }
        ]
      }
    ],
    "jiraProjectPages": [
      {
        "key": "search-attachments-page",
        "url": "/search-attachments",
        "weight": 100,
        "name": {
          "value": "Find attachments"
        },
        "iconUrl": "/images/app-icon.svg",
        "conditions": [
          {
            "condition": "user_is_logged_in"
          }
        ]
      }
    ],
    "jiraIssueContents": [
      {
        "icon": {
          "width": 0,
          "height": 0,
          "url": "/images/attachment.svg"
        },
        "target": {
          "type": "web_panel",
          "url": "/old-panel"
        },
        "tooltip": {
          "value": "Smart Attachments"
        },
        "name": {
          "value": "Smart Attachments"
        },
        "conditions": [
          {
            "and": [
              {
                "condition": "has_attachment"
              },
              {
                "condition": "entity_property_equal_to",
                "params": {
                  "entity": "project",
                  "propertyKey": "smartAttachmentProjectSettings",
                  "objectName": "showPanel",
                  "value": "true"
                }
              }
            ]
          }
        ],
        "contentPresentConditions": [
          {
            "condition": "user_is_logged_in",
            "invert": false
          }
        ],
        "key": "smart-attachment-content-panel"
      }
    ],
    "jiraIssueContexts": [
      {
        "icon": {
          "width": 0,
          "height": 0,
          "url": "/images/attachment.svg"
        },
        "content": {
          "type": "label",
          "label": {
            "value": "Smart Attachments"
          }
        },
        "target": {
          "type": "web_panel",
          "url": "/smart-attachment-issue-context"
        },
        "name": {
          "value": "Smart Attachments"
        },
        "key": "sa-issue-context",
        "conditions": [
          {
            "and": [
              {
                "condition": "has_attachment"
              },
              {
                "or": [
                  {
                    "condition": "entity_property_exists",
                    "invert": true,
                    "params": {
                      "entity": "project",
                      "propertyKey": "smartAttachmentProjectSettings"
                    }
                  },
                  {
                    "condition": "entity_property_equal_to",
                    "invert": true,
                    "params": {
                      "entity": "project",
                      "propertyKey": "smartAttachmentProjectSettings",
                      "objectName": "showPanel",
                      "value": "true"
                    }
                  }
                ]
              }
            ]
          }
        ]
      }
    ],
    "jiraIssueTabPanels": [
      {
        "url": "/attachment-labels-history",
        "weight": 100,
        "name": {
          "value": "Smart Attachments"
        },
        "key": "attachment-labels-history",
        "conditions": [
          {
            "condition": "has_attachment"
          }
        ]
      }
    ],
    "webSections": [
      {
        "location": "admin_plugins_menu",
        "weight": 100,
        "key": "find-attachments-section",
        "name": {
          "value": "Smart Attachments"
        }
      }
    ],
    "webhooks": [
      {
        "event": "attachment_created",
        "url": "/webhook/{project.id}/{issue.id}/attachment-created",
        "conditions": [
          {
            "condition": "addon_is_licensed"
          }
        ]
      },
      {
        "event": "attachment_deleted",
        "url": "/webhook/attachment-deleted",
        "conditions": [
          {
            "condition": "addon_is_licensed"
          }
        ]
      },
      {
        "filter": "attachments is not EMPTY",
        "event": "jira:issue_deleted",
        "url": "/webhook/{issue.id}/issue-deleted",
        "excludeBody": true,
        "conditions": [
          {
            "condition": "addon_is_licensed"
          }
        ]
      },
      {
        "filter": "attachments is not EMPTY",
        "event": "jira:issue_created",
        "url": "/webhook/{project.id}/{issue.id}/issue-created",
        "conditions": [
          {
            "condition": "addon_is_licensed"
          }
        ]
      },
      {
        "event": "project_deleted",
        "url": "/webhook/{project.id}/project-deleted",
        "excludeBody": true,
        "conditions": [
          {
            "condition": "addon_is_licensed"
          }
        ]
      }
    ],
    "configurePage": {
      "key": "admin-attachment-indexation-page",
      "name": {
        "value": "Attachment Indexation"
      },
      "url": "/attachment-indexation",
      "conditions": [
        {
          "condition": "user_is_admin"
        }
      ]
    },
    "jiraProjectAdminTabPanels": [
      {
        "location": "projectgroup1",
        "url": "/smart-attachment-project-settings-panel",
        "weight": 100,
        "name": {
          "value": "Smart Attachments"
        },
        "key": "smart-attachment-project-settings-panel"
      }
    ],
    "dialogs": [
      {
        "url": "/dialog/feedback",
        "key": "feedback-collection-dialog",
        "options": {
          "width": "548px",
          "height": "360px",
          "chrome": false
        }
      },
      {
        "url": "/dialog/delete-attachment",
        "key": "delete-attachment-dialog",
        "options": {
          "width": "548px",
          "height": "360px",
          "chrome": false
        }
      }
    ],
    "jiraWorkflowValidators": [
      {
        "description": {
          "value": "This validator will allow the transition only if the issue has any attachment with required labels."
        },
        "expression": "(config.expectedLabels||[]).length==0 || config.expectedLabels.every(item => issue.properties.get('all_labels').names.includes(item))",
        "errorMessage": {
          "expression": "'The issue has no attachments with the ' + config.text + ' labels. Please review your attachments and tag them with proper labels.'"
        },
        "view": {
          "url": "/workflow/required-label/view?id={validator.id}&config={validator.config}"
        },
        "edit": {
          "url": "/workflow/required-label/edit?id={validator.id}&config={validator.config}"
        },
        "create": {
          "url": "/workflow/required-label/create"
        },
        "name": {
          "value": "Issue has attachments with labels (by Smart Attachments)"
        },
        "key": "workflow-condition-every-label-present"
      }
    ],
    "jiraWorkflowPostFunctions": [
      {
        "description": {
          "value": "Adds or replaces labels of attachments based on the attachment name or regular expression"
        },
        "view": {
          "url": "/workflow/assign/view?id={postFunction.id}&config={postFunction.config}"
        },
        "edit": {
          "url": "/workflow/assign/edit?id={postFunction.id}&config={postFunction.config}"
        },
        "create": {
          "url": "/workflow/assign/create"
        },
        "triggered": {
          "url": "/webhook/assign/triggered"
        },
        "name": {
          "value": "Update attachment labels (by Smart Attachments)"
        },
        "key": "assing-attachment-labels"
      },
      {
        "name": {
          "value": "Delete attachments with labels (by Smart Attachments)"
        },
        "description": {
          "value": "Delete attachments based on their labels"
        },
        "view": {
          "url": "/workflow/delete/view?id={postFunction.id}&config={postFunction.config}"
        },
        "edit": {
          "url": "/workflow/delete/edit?id={postFunction.id}&config={postFunction.config}"
        },
        "create": {
          "url": "/workflow/delete/create"
        },
        "triggered": {
          "url": "/webhook/delete/triggered"
        },
        "key": "delete-attachments-by-label"
      }
    ],
    "jiraEntityProperties": [
      {
        "keyConfigurations": [
          {
            "extractions": [
              {
                "objectName": "names",
                "type": "string",
                "alias": "attachmentLabel"
              }
            ],
            "propertyKey": "all_labels"
          }
        ],
        "entityType": "issue",
        "name": {
          "value": "Attachment Label"
        },
        "key": "attachment-label-property"
      }
    ]
  }
}
