{
  "key": "com.plugins4people.merge.issue-merge",
  "baseUrl": "https://imc.test-apps.appsvio.com",
  "name": "Issue Merger Pro",
  "vendor": {
    "name": "Appsvio LLC",
    "url": "https://www.appsvio.com"
  },
  "authentication": {
    "type": "jwt"
  },
  "apiMigrations": {
    "context-qsh": true,
    "signed-install": true
  },
  "enableLicensing": true,
  "lifecycle": {
    "installed": "/installed",
    "uninstalled": "/uninstalled"
  },
  "scopes": [
    "ADMIN",
    "ACT_AS_USER",
    "READ"
  ],
  "modules": {
    "webSections": [
      {
        "key": "issue-merger-admin-menu-section",
        "location": "admin_plugins_menu",
        "weight": 10,
        "name": {
          "value": "Issue Merger Pro"
        }
      }
    ],
    "webItems": [
      {
        "url": "/merge-issue?issueKey={issue.key}&projectId={project.id}",
        "key": "merge-issue",
        "location": "operations-operations",
        "weight": 10,
        "target": {
          "type": "dialog",
          "options": {
            "height": "70%",
            "width": "760px",
            "chrome": false
          }
        },
        "name": {
          "value": "Merge"
        },
        "conditions": [
          {
            "condition": "addon_is_licensed",
            "invert": "false"
          },
          {
            "condition": "jira_expression",
            "params": {
              "expression": "!app.properties.projects || (app.properties.projects.includes(project.key) || app.properties.projects.length == 0)"
            }
          },
          {
            "or": [
              {
                "condition": "jira_expression",
                "params": {
                  "expression": "project.properties.statusFilter.length == 0"
                }
              },
              {
                "condition": "jira_expression",
                "params": {
                  "expression": "project.properties.statusFilter == null"
                }
              },
              {
                "condition": "jira_expression",
                "params": {
                  "expression": "project.properties.statusFilter == undefined"
                }
              },
              {
                "condition": "jira_expression",
                "params": {
                  "expression": "project.properties.statusFilter.filter(prop => prop.issueTypes.includes(issue.issueType.id))[0].statuses.includes(issue.status.id)"
                }
              }
            ]
          },
          {
            "or": [
              {
                "condition": "jira_expression",
                "params": {
                  "expression": "!app.properties.keys().includes('roles')"
                }
              },
              {
                "condition": "jira_expression",
                "params": {
                  "expression": "app.properties.roles.length == 0"
                }
              },
              {
                "condition": "addon_property_contains_any_user_role",
                "params": {
                  "propertyKey": "roles"
                }
              }
            ]
          }
        ]
      },
      {
        "url": "/sync-comments?issueKey={issue.key}&projectId={project.id}&issueId={issue.id}",
        "key": "sync-comments",
        "location": "operations-operations",
        "weight": 20,
        "target": {
          "type": "dialog",
          "options": {
            "height": "70%",
            "width": "760px",
            "chrome": false
          }
        },
        "name": {
          "value": "Synchronize comments"
        },
        "conditions": [
          {
            "condition": "addon_is_licensed",
            "invert": "false"
          }
        ]
      }
    ],
    "adminPages": [
      {
        "key": "global-configuration",
        "location": "admin_plugins_menu/issue-merger-admin-menu-section",
        "url": "/global-configuration",
        "weight": 20,
        "name": {
          "value": "Configuration"
        }
      },
      {
        "key": "presets",
        "location": "admin_plugins_menu/issue-merger-admin-menu-section",
        "url": "/presets",
        "weight": 30,
        "name": {
          "value": "Presets"
        }
      },
      {
        "key": "merge-history",
        "location": "admin_plugins_menu/issue-merger-admin-menu-section",
        "url": "/merge-history",
        "weight": 40,
        "name": {
          "value": "Audit log"
        }
      }
    ],
    "jiraProjectAdminTabPanels": [
      {
        "key": "project-configuration",
        "location": "projectgroup1",
        "url": "/project-configuration?projectId={project.id}&serviceDeskId={servicedesk.serviceDeskId}",
        "weight": 90,
        "name": {
          "value": "Issue Merger manual"
        },
        "conditions": [
          {
            "condition": "user_is_logged_in"
          }
        ]
      },
      {
        "key": "project-automation",
        "location": "projectgroup1",
        "url": "/automation?projectId={project.id}&serviceDeskId={servicedesk.serviceDeskId}",
        "weight": 100,
        "name": {
          "value": "Issue Merger auto-merge"
        },
        "conditions": [
          {
            "condition": "user_is_logged_in"
          }
        ]
      }
    ],
    "webhooks": [
      {
        "event": "jira:issue_created",
        "url": "/automation-issue-created?projectId={project.id}",
        "filter": "project.automationIssueCreated is not empty and project.automationIssueCreated = 1"
      },
      {
        "event": "jira:issue_updated",
        "url": "/sync-issue-updated?projectId={project.id}",
        "filter": "issue.property[com.plugins4people.merge.issue-merge__watch_status].enabled is not empty and issue.property[com.plugins4people.merge.issue-merge__watch_status].enabled = 1"
      },
      {
        "event": "jira:issue_deleted",
        "url": "/sync-issue-deleted?projectId={project.id}",
        "filter": "issue.property[com.plugins4people.merge.issue-merge__watch_status].enabled is not empty and issue.property[com.plugins4people.merge.issue-merge__watch_status].enabled = 1"
      },
      {
        "event": "comment_created",
        "url": "/sync-comment?projectId={project.id}&commentId={comment.id}",
        "filter": "issue.property[com.plugins4people.merge.issue-merge__sync_comment].enabled is not empty and issue.property[com.plugins4people.merge.issue-merge__sync_comment].enabled = 1"
      }
    ],
    "jiraEntityProperties": [
      {
        "key": "automation",
        "name": {
          "value": "automation"
        },
        "entityType": "project",
        "keyConfigurations": [
          {
            "propertyKey": "com.plugins4people.merge.issue-merge__issue_created",
            "extractions": [
              {
                "objectName": "enabled",
                "type": "number",
                "alias": "automationIssueCreated"
              }
            ]
          }
        ]
      },
      {
        "key": "sync",
        "name": {
          "value": "sync"
        },
        "entityType": "issue",
        "keyConfigurations": [
          {
            "propertyKey": "com.plugins4people.merge.issue-merge__sync_comment",
            "extractions": [
              {
                "objectName": "enabled",
                "type": "number"
              }
            ]
          },
          {
            "propertyKey": "com.plugins4people.merge.issue-merge__watch_status",
            "extractions": [
              {
                "objectName": "enabled",
                "type": "number"
              }
            ]
          }
        ]
      },
      {
        "key": "merge-history-property",
        "name": {
          "value": "Merge history"
        },
        "entityType": "issue",
        "keyConfigurations": [
          {
            "propertyKey": "com.plugins4people.merge.issue-merge__history",
            "extractions": [
              {
                "objectName": "sourceIssueIds",
                "type": "number",
                "alias": "sourceIssue"
              },
              {
                "objectName": "sourceIssueTrigger",
                "type": "string",
                "alias": "sourceTrigger"
              },
              {
                "objectName": "targetIssueIds",
                "type": "number",
                "alias": "targetIssue"
              },
              {
                "objectName": "targetIssueTrigger",
                "type": "string",
                "alias": "targetTrigger"
              },
              {
                "objectName": "mergeCount",
                "type": "number"
              }
            ]
          }
        ]
      },
      {
        "key": "merge-history-property-2",
        "name": {
          "value": "Merge history"
        },
        "entityType": "issue",
        "keyConfigurations": [
          {
            "propertyKey": "com.plugins4people.merge.issue-merge__history-2",
            "extractions": [
              {
                "objectName": "sourceIssueIds",
                "type": "number",
                "alias": "sourceIssue"
              },
              {
                "objectName": "sourceIssueTrigger",
                "type": "string",
                "alias": "sourceTrigger"
              },
              {
                "objectName": "targetIssueIds",
                "type": "number",
                "alias": "targetIssue"
              },
              {
                "objectName": "targetIssueTrigger",
                "type": "string",
                "alias": "targetTrigger"
              },
              {
                "objectName": "mergeCount",
                "type": "number"
              }
            ]
          }
        ]
      },
      {
        "key": "merge-history-property-3",
        "name": {
          "value": "Merge history"
        },
        "entityType": "issue",
        "keyConfigurations": [
          {
            "propertyKey": "com.plugins4people.merge.issue-merge__history-3",
            "extractions": [
              {
                "objectName": "sourceIssueIds",
                "type": "number",
                "alias": "sourceIssue"
              },
              {
                "objectName": "sourceIssueTrigger",
                "type": "string",
                "alias": "sourceTrigger"
              },
              {
                "objectName": "targetIssueIds",
                "type": "number",
                "alias": "targetIssue"
              },
              {
                "objectName": "targetIssueTrigger",
                "type": "string",
                "alias": "targetTrigger"
              },
              {
                "objectName": "mergeCount",
                "type": "number"
              }
            ]
          }
        ]
      },
      {
        "key": "merge-history-property-4",
        "name": {
          "value": "Merge history"
        },
        "entityType": "issue",
        "keyConfigurations": [
          {
            "propertyKey": "com.plugins4people.merge.issue-merge__history-4",
            "extractions": [
              {
                "objectName": "sourceIssueIds",
                "type": "number",
                "alias": "sourceIssue"
              },
              {
                "objectName": "sourceIssueTrigger",
                "type": "string",
                "alias": "sourceTrigger"
              },
              {
                "objectName": "targetIssueIds",
                "type": "number",
                "alias": "targetIssue"
              },
              {
                "objectName": "targetIssueTrigger",
                "type": "string",
                "alias": "targetTrigger"
              },
              {
                "objectName": "mergeCount",
                "type": "number"
              }
            ]
          }
        ]
      },
      {
        "key": "bulk-actions-property",
        "name": {
          "value": "Bulk Actions"
        },
        "entityType": "project",
        "keyConfigurations": [
          {
            "propertyKey": "com.plugins4people.merge.issue-merge__bulk-actions",
            "extractions": [
              {
                "objectName": "enabled",
                "type": "number"
              }
            ]
          }
        ]
      }
    ],
    "jiraIssueContexts": [
      {
        "icon": {
          "width": 24,
          "height": 24,
          "url": "/assets/refresh.png"
        },
        "content": {
          "type": "label",
          "label": {
            "value": "Synchronized issues"
          }
        },
        "target": {
          "type": "web_panel",
          "url": "/synchronization?issueKey={issue.key}"
        },
        "name": {
          "value": "Issue Merger"
        },
        "key": "issue-synchronization",
        "conditions": [
          {
            "or": [
              {
                "condition": "entity_property_equal_to",
                "params": {
                  "entity": "issue",
                  "propertyKey": "com.plugins4people.merge.issue-merge__sync_comment",
                  "objectName": "enabled",
                  "value": 1
                }
              },
              {
                "condition": "entity_property_equal_to",
                "params": {
                  "entity": "issue",
                  "propertyKey": "com.plugins4people.merge.issue-merge__watch_status",
                  "objectName": "enabled",
                  "value": 1
                }
              }
            ]
          }
        ]
      }
    ],
    "jiraIssueContents": [
      {
        "icon": {
          "width": 24,
          "height": 24,
          "url": "/assets/issue-merger-logo.svg"
        },
        "target": {
          "type": "web_panel",
          "url": "/bulk-actions?issueId={issue.id}&issueKey={issue.key}"
        },
        "tooltip": {
          "value": "Bulk actions"
        },
        "name": {
          "value": "Issue Merger PRO - bulk actions"
        },
        "key": "bulk-actions",
        "conditions": [
          {
            "or": [
              {
                "condition": "entity_property_exists",
                "invert": true,
                "params": {
                  "entity": "project",
                  "propertyKey": "com.plugins4people.merge.issue-merge__bulk-actions"
                }
              },
              {
                "condition": "entity_property_equal_to",
                "params": {
                  "entity": "project",
                  "propertyKey": "com.plugins4people.merge.issue-merge__bulk-actions",
                  "value": 0,
                  "objectName": "disabled"
                }
              }
            ]
          }
        ]
      }
    ],
    "dialogs": [
      {
        "url": "/bulk-actions-result",
        "options": {
          "chrome": false,
          "size": "medium"
        },
        "key": "bulk-actions-result"
      },
      {
        "url": "/bulk-actions-multi",
        "options": {
          "chrome": false,
          "size": "large"
        },
        "key": "bulk-actions-multi"
      }
    ]
  }
}

