const ES_KEYS = {
  companiesHouseAccount: 'dit:Accounts',
  companiesHouseCompany: 'dit:Company',
  hmrcExporter: 'dit:Export',
  interaction: 'dit:Interaction',
  serviceDelivery: 'dit:ServiceDelivery',
  investmentProject: 'dit:InvestmentProject',
  omis: 'dit:OMISOrder',
  type: 'object.type',
  attributedTo: 'object.attributedTo.id',
}

const ES_KEYS_GROUPED = {
  allActivity: [
    ES_KEYS.companiesHouseAccount,
    ES_KEYS.companiesHouseCompany,
    ES_KEYS.hmrcExporter,
    ES_KEYS.interaction, // Interaction
    ES_KEYS.serviceDelivery, // Interaction
    ES_KEYS.investmentProject,
    ES_KEYS.omis,
  ],

  externalActivity: [
    ES_KEYS.companiesHouseAccount,
    ES_KEYS.companiesHouseCompany,
    ES_KEYS.hmrcExporter,
  ],

  dataHubActivity: [
    ES_KEYS.interaction, // Interaction
    ES_KEYS.serviceDelivery, // Interaction
    ES_KEYS.investmentProject,
    ES_KEYS.omis,
  ],
}

const FILTER_KEYS = {
  allActivity: 'allActivity',
  myActivity: 'myActivity',
  externalActivity: 'externalActivity',
  dataHubActivity: 'dataHubActivity',
  ultimateHQSubsidiaries: 'ultimateHQSubsidiaries',
}

const FILTER_ITEMS = {
  allActivity: {
    label: 'All Data Hub & external activity',
    value: FILTER_KEYS.allActivity,
  },

  externalActivity: {
    label: 'All external activity',
    value: FILTER_KEYS.externalActivity,
  },

  myActivity: {
    label: 'My activity',
    value: FILTER_KEYS.myActivity,
  },

  dataHubActivity: {
    label: 'All Data Hub activity',
    value: FILTER_KEYS.dataHubActivity,
  },
}

module.exports = {
  ES_KEYS,
  FILTER_KEYS,
  FILTER_ITEMS,
  ES_KEYS_GROUPED,
}

@@ -334,16 +334,58 @@
 To.id',%0A
+  companyReferral: 'dit:CompanyReferral',%0A
 %7D%0A%0Aconst
@@ -647,24 +647,53 @@
 _KEYS.omis,%0A
+    ES_KEYS.companyReferral,%0A
   %5D,%0A%0A  exte
@@ -938,32 +938,32 @@
 estmentProject,%0A
-
     ES_KEYS.omis
@@ -964,16 +964,45 @@
 S.omis,%0A
+    ES_KEYS.companyReferral,%0A
   %5D,%0A%7D%0A%0A

Add the referrals to the ES keys