@atlaskit/teams-public 0.63.4 → 0.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/controllers/hooks/use-team-containers/index.js +6 -5
  3. package/dist/cjs/controllers/hooks/use-team-containers/mocks.js +125 -0
  4. package/dist/cjs/services/agg-client/index.js +8 -72
  5. package/dist/cjs/services/agg-client/mocks/index.js +1 -0
  6. package/dist/cjs/services/agg-client/utils/queries/team-containers-query.js +4 -6
  7. package/dist/cjs/services/agg-client/utils/query-context-headers.js +19 -0
  8. package/dist/cjs/services/graphql-client/main.js +34 -7
  9. package/dist/cjs/services/graphql-client/utils/index.js +5 -2
  10. package/dist/es2019/controllers/hooks/use-team-containers/index.js +6 -5
  11. package/dist/es2019/controllers/hooks/use-team-containers/mocks.js +119 -0
  12. package/dist/es2019/services/agg-client/index.js +14 -71
  13. package/dist/es2019/services/agg-client/mocks/index.js +1 -0
  14. package/dist/es2019/services/agg-client/utils/queries/team-containers-query.js +1 -53
  15. package/dist/es2019/services/agg-client/utils/query-context-headers.js +14 -0
  16. package/dist/es2019/services/graphql-client/main.js +26 -1
  17. package/dist/es2019/services/graphql-client/utils/index.js +2 -1
  18. package/dist/esm/controllers/hooks/use-team-containers/index.js +6 -5
  19. package/dist/esm/controllers/hooks/use-team-containers/mocks.js +119 -0
  20. package/dist/esm/services/agg-client/index.js +9 -73
  21. package/dist/esm/services/agg-client/mocks/index.js +1 -0
  22. package/dist/esm/services/agg-client/utils/queries/team-containers-query.js +3 -5
  23. package/dist/esm/services/agg-client/utils/query-context-headers.js +14 -0
  24. package/dist/esm/services/graphql-client/main.js +34 -7
  25. package/dist/esm/services/graphql-client/utils/index.js +5 -2
  26. package/dist/types/controllers/hooks/use-team-containers/index.d.ts +2 -1
  27. package/dist/types/controllers/hooks/use-team-containers/mocks.d.ts +127 -0
  28. package/dist/types/services/agg-client/index.d.ts +1 -2
  29. package/dist/types/services/agg-client/mocks/index.d.ts +1 -0
  30. package/dist/types/services/agg-client/utils/queries/team-containers-query.d.ts +0 -1
  31. package/dist/types/services/agg-client/utils/query-context-headers.d.ts +5 -0
  32. package/dist/types/services/graphql-client/main.d.ts +4 -0
  33. package/dist/types/services/graphql-client/types.d.ts +1 -0
  34. package/dist/types/services/types.d.ts +2 -2
  35. package/dist/types-ts4.5/controllers/hooks/use-team-containers/index.d.ts +2 -1
  36. package/dist/types-ts4.5/controllers/hooks/use-team-containers/mocks.d.ts +127 -0
  37. package/dist/types-ts4.5/services/agg-client/index.d.ts +1 -2
  38. package/dist/types-ts4.5/services/agg-client/mocks/index.d.ts +1 -0
  39. package/dist/types-ts4.5/services/agg-client/utils/queries/team-containers-query.d.ts +0 -1
  40. package/dist/types-ts4.5/services/agg-client/utils/query-context-headers.d.ts +5 -0
  41. package/dist/types-ts4.5/services/graphql-client/main.d.ts +4 -0
  42. package/dist/types-ts4.5/services/graphql-client/types.d.ts +1 -0
  43. package/dist/types-ts4.5/services/types.d.ts +2 -2
  44. package/package.json +10 -12
@@ -0,0 +1,119 @@
1
+ // Mock data for tests
2
+ export const MOCK_TEAM_CONTAINERS = {
3
+ graphStore: {
4
+ cypherQuery: {
5
+ edges: [{
6
+ node: {
7
+ from: {
8
+ id: '1'
9
+ },
10
+ to: {
11
+ id: '2',
12
+ data: {
13
+ __typename: 'ConfluenceSpace',
14
+ confluenceSpaceName: 'Confluence Space',
15
+ type: 'confluence',
16
+ createdDate: '2021-01-01',
17
+ links: {
18
+ webUi: 'web-link'
19
+ },
20
+ icon: {
21
+ path: 'https://avatar-management--avatars.us-west-2.staging.public.atl-paas.net/712020:2981defd-17f1-440e-a377-8c7657b72a6f/4b5b0d55-614b-4e75-858f-9da3d0c7e3f8/128'
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }, {
27
+ node: {
28
+ from: {
29
+ id: '1'
30
+ },
31
+ to: {
32
+ id: '3',
33
+ data: {
34
+ __typename: 'JiraProject',
35
+ jiraProjectName: 'Jira Project',
36
+ webUrl: 'web-link',
37
+ created: '2021-01-01',
38
+ avatar: {
39
+ medium: 'https://avatar-management--avatars.us-west-2.staging.public.atl-paas.net/712020:2981defd-17f1-440e-a377-8c7657b72a6f/4b5b0d55-614b-4e75-858f-9da3d0c7e3f8/128'
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }]
45
+ }
46
+ }
47
+ };
48
+ export const MOCK_TEAM_CONTAINERSV2 = {
49
+ graphStore: {
50
+ cypherQueryV2: {
51
+ edges: [{
52
+ node: {
53
+ columns: [{
54
+ key: 'container',
55
+ value: {
56
+ data: {
57
+ __typename: 'ConfluenceSpace',
58
+ id: '2',
59
+ confluenceSpaceName: 'Confluence Space',
60
+ type: 'confluence',
61
+ createdDate: '2021-01-01',
62
+ links: {
63
+ base: 'https://example.com',
64
+ webUi: '/wiki/spaces/SPACE'
65
+ },
66
+ icon: {
67
+ path: '/wiki/download/attachments/123/icon.png'
68
+ }
69
+ }
70
+ }
71
+ }]
72
+ }
73
+ }, {
74
+ node: {
75
+ columns: [{
76
+ key: 'container',
77
+ value: {
78
+ data: {
79
+ __typename: 'JiraProject',
80
+ id: '3',
81
+ jiraProjectName: 'Jira Project',
82
+ webUrl: 'https://example.com/jira/project',
83
+ created: '2021-01-01',
84
+ avatar: {
85
+ medium: 'https://avatar-management--avatars.us-west-2.staging.public.atl-paas.net/712020:2981defd-17f1-440e-a377-8c7657b72a6f/4b5b0d55-614b-4e75-858f-9da3d0c7e3f8/128'
86
+ },
87
+ projectType: 'software',
88
+ projectTypeName: 'Software Project'
89
+ }
90
+ }
91
+ }]
92
+ }
93
+ }]
94
+ }
95
+ }
96
+ };
97
+ export const MOCK_CONNECTED_TEAMS_RESULT = [{
98
+ id: 'ari:cloud:identity::team/8ee37950-7de7-41ec-aee2-2c02c95949f4',
99
+ displayName: 'THE SUPER TEAM',
100
+ description: "Super team's super description",
101
+ state: 'ACTIVE',
102
+ membershipSettings: 'MEMBER_INVITE',
103
+ organizationId: 'ari:cloud:platform::org/434kbc65-c30c-1a22-6933-d25085c532ca',
104
+ creatorId: 'ari:cloud:identity::user/70121:c17bdf1f-39db-4611-a700-2f8c1aff841e',
105
+ isVerified: false,
106
+ members: [{
107
+ id: '70121:c17bdf1f-39db-4611-a700-2f8c1aff841e',
108
+ fullName: 'Shrutha Kashyap',
109
+ avatarUrl: 'https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/70121:c17bdf1f-39db-4611-a700-2f8c1aff841e/cf4058fd-75f2-4824-8041-c8efa4cc0ea8/128',
110
+ status: 'active'
111
+ }],
112
+ includesYou: false,
113
+ memberCount: 1,
114
+ smallAvatarImageUrl: 'https://ptc-directory-sited-static.us-east-1.prod.public.atl-paas.net/teams/avatars/0.svg',
115
+ smallHeaderImageUrl: 'https://ptc-directory-sited-static.us-east-1.prod.public.atl-paas.net/gradients/0.svg',
116
+ largeAvatarImageUrl: 'https://ptc-directory-sited-static.us-east-1.prod.public.atl-paas.net/teams/avatars/0.svg',
117
+ largeHeaderImageUrl: 'https://ptc-directory-sited-static.us-east-1.prod.public.atl-paas.net/gradients/0.svg',
118
+ restriction: 'ORG_MEMBERS'
119
+ }];
@@ -1,4 +1,3 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
1
  import { teamIdToAri } from '../../common/utils/team-id-to-ari';
3
2
  import { toUserId } from '../../common/utils/user-ari';
4
3
  import { DEFAULT_CONFIG } from '../constants';
@@ -6,7 +5,7 @@ import { BaseGraphQlClient } from '../graphql-client';
6
5
  import { UnlinkContainerMutation } from './utils/mutations/unlink-container-mutation';
7
6
  import { NumberOfTeamConnectedToContainerQuery } from './utils/queries/number-of-team-connected-to-container-query';
8
7
  import { TeamConnectedToContainerQuery } from './utils/queries/team-connected-to-container-query';
9
- import { TeamContainersQuery, TeamContainersQueryV2 } from './utils/queries/team-containers-query';
8
+ import { TeamContainersQueryV2 } from './utils/queries/team-containers-query';
10
9
  export class AGGClient extends BaseGraphQlClient {
11
10
  constructor(baseUrl, config) {
12
11
  super(`${baseUrl}/graphql`, config);
@@ -17,37 +16,25 @@ export class AGGClient extends BaseGraphQlClient {
17
16
  async getTeamContainers(teamId) {
18
17
  const teamAri = teamIdToAri(teamId);
19
18
  const cypherQuery = `MATCH (team:IdentityTeam {ari: '${teamAri}'})-[:team_connected_to_container]->(container) RETURN container`;
20
- if (fg('teams_containers_cypher_query_v2_migration')) {
21
- const response = await this.makeGraphQLRequest({
22
- query: TeamContainersQueryV2,
23
- variables: {
24
- cypherQuery,
25
- params: {
26
- id: teamAri
27
- }
28
- }
29
- }, {
30
- operationName: 'TeamContainersQueryV2'
31
- });
32
- return this.processV2Response(response);
33
- } else {
34
- const response = await this.makeGraphQLRequest({
35
- query: TeamContainersQuery,
36
- variables: {
37
- cypherQuery
19
+ const response = await this.makeGraphQLRequest({
20
+ query: TeamContainersQueryV2,
21
+ variables: {
22
+ cypherQuery,
23
+ params: {
24
+ id: teamAri
38
25
  }
39
- }, {
40
- operationName: 'TeamContainersQuery'
41
- });
42
- return this.processV1Response(response);
43
- }
26
+ }
27
+ }, {
28
+ operationName: 'TeamContainersQueryV2'
29
+ });
30
+ return this.processResponse(response);
44
31
  }
45
- processV2Response(response) {
32
+ processResponse(response) {
46
33
  const containersResult = response.graphStore.cypherQueryV2.edges.reduce((containers, edge) => {
47
34
  edge.node.columns.forEach(column => {
48
35
  var _column$value;
49
36
  const containerData = (_column$value = column.value) === null || _column$value === void 0 ? void 0 : _column$value.data;
50
- if (!containerData && fg('enable_team_containers_null_check')) {
37
+ if (!containerData) {
51
38
  return;
52
39
  }
53
40
  if ((containerData === null || containerData === void 0 ? void 0 : containerData.__typename) === 'ConfluenceSpace') {
@@ -90,50 +77,6 @@ export class AGGClient extends BaseGraphQlClient {
90
77
  }, []);
91
78
  return containersResult;
92
79
  }
93
- processV1Response(response) {
94
- const containersResult = response.graphStore.cypherQuery.edges.reduce((containers, edge) => {
95
- if (!edge.node.to.data && fg('enable_team_containers_null_check')) {
96
- return containers;
97
- }
98
- if (edge.node.to.data.__typename === 'ConfluenceSpace') {
99
- containers.push({
100
- id: edge.node.to.id,
101
- type: edge.node.to.data.__typename,
102
- name: edge.node.to.data.confluenceSpaceName || '',
103
- icon: `${edge.node.to.data.links.base}${edge.node.to.data.icon.path}`,
104
- createdDate: new Date(edge.node.to.data.createdDate),
105
- link: `${edge.node.to.data.links.base}${edge.node.to.data.links.webUi}`,
106
- containerTypeProperties: {
107
- subType: undefined,
108
- name: undefined
109
- }
110
- });
111
- } else if (edge.node.to.data.__typename === 'JiraProject') {
112
- containers.push({
113
- id: edge.node.to.id,
114
- type: edge.node.to.data.__typename,
115
- name: edge.node.to.data.jiraProjectName,
116
- icon: edge.node.to.data.avatar.medium,
117
- createdDate: new Date(edge.node.to.data.created),
118
- link: edge.node.to.data.webUrl,
119
- containerTypeProperties: {
120
- subType: edge.node.to.data.projectType || '',
121
- name: edge.node.to.data.projectTypeName || ''
122
- }
123
- });
124
- } else if (edge.node.to.data.__typename === 'LoomSpace') {
125
- containers.push({
126
- id: edge.node.to.id,
127
- type: edge.node.to.data.__typename,
128
- name: edge.node.to.data.loomSpaceName,
129
- icon: '',
130
- link: edge.node.to.data.url
131
- });
132
- }
133
- return containers;
134
- }, []);
135
- return containersResult;
136
- }
137
80
  async unlinkTeamContainer(teamId, containerId) {
138
81
  const teamAri = teamIdToAri(teamId);
139
82
  const response = await this.makeGraphQLRequest({
@@ -14,6 +14,7 @@ export const MOCK_TEAM_CONTAINERS = {
14
14
  type: 'confluence',
15
15
  createdDate: '2021-01-01',
16
16
  links: {
17
+ base: 'https://example.com',
17
18
  webUi: 'web-link'
18
19
  },
19
20
  icon: {
@@ -1,57 +1,5 @@
1
1
  import { print } from 'graphql';
2
2
  import gql from 'graphql-tag';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
- export const TeamContainersQuery = print(gql`
5
- query TeamContainersQuery($cypherQuery: String!) {
6
- graphStore @optIn(to: ["GraphStore"]) {
7
- cypherQuery(query: $cypherQuery) @optIn(to: ["GraphStoreCypherQuery"]) {
8
- edges {
9
- __typename
10
- node {
11
- from {
12
- id
13
- }
14
- to {
15
- id
16
- data {
17
- __typename
18
- ... on ConfluenceSpace {
19
- id
20
- confluenceSpaceName: name
21
- type
22
- createdDate
23
- links {
24
- base
25
- webUi
26
- }
27
- icon {
28
- path
29
- }
30
- }
31
- ... on JiraProject {
32
- id
33
- jiraProjectName: name
34
- webUrl
35
- created
36
- avatar {
37
- medium
38
- }
39
- projectType
40
- projectTypeName
41
- }
42
- ... on LoomSpace {
43
- id
44
- loomSpaceName: name
45
- url
46
- }
47
- }
48
- }
49
- }
50
- }
51
- }
52
- }
53
- }
54
- `);
55
3
  export const TeamContainersQueryV2 = print(gql`
56
4
  query TeamContainersQueryV2($cypherQuery: String!, $params: JSON!) {
57
5
  graphStore @optIn(to: ["GraphStore", "GraphStoreCypherQueryV2"]) {
@@ -104,5 +52,5 @@ export const TeamContainersQueryV2 = print(gql`
104
52
  }
105
53
  `);
106
54
  export const getTeamContainersQuery = () => {
107
- return fg('teams_containers_cypher_query_v2_migration') ? TeamContainersQueryV2 : TeamContainersQuery;
55
+ return TeamContainersQueryV2;
108
56
  };
@@ -0,0 +1,14 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
2
+
3
+ /**
4
+ * Creates headers object with X-Query-Context header if cloudId is provided and feature flag is enabled.
5
+ * Use this for AGG client makeGraphQLRequest calls.
6
+ */
7
+ export function createQueryContextHeaders(cloudId) {
8
+ if (!cloudId || !fg('enable_x_query_context_header')) {
9
+ return undefined;
10
+ }
11
+ return {
12
+ 'X-Query-Context': `ari:cloud:platform::site/${cloudId}`
13
+ };
14
+ }
@@ -1,3 +1,4 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  import { DefaultError, GraphQLError } from '../../common/utils/error';
2
3
  import { BaseClient } from '../base-client';
3
4
  import { handleGraphQLRequest } from './utils';
@@ -9,9 +10,33 @@ export class BaseGraphQlClient extends BaseClient {
9
10
  setServiceUrl(serviceUrl) {
10
11
  this.serviceUrl = serviceUrl;
11
12
  }
13
+
14
+ /**
15
+ * Creates query context headers if cloudId is available and feature flag is enabled.
16
+ */
17
+ createQueryContextHeaders(cloudId) {
18
+ if (!cloudId || !fg('enable_x_query_context_header')) {
19
+ return undefined;
20
+ }
21
+ return {
22
+ 'X-Query-Context': `ari:cloud:platform::site/${cloudId}`
23
+ };
24
+ }
12
25
  async makeGraphQLRequest(body, options = {}) {
13
26
  try {
14
- return handleGraphQLRequest(this.serviceUrl, body, options);
27
+ // Automatically add X-Query-Context header if cloudId is available in context
28
+ const cloudId = this.getCloudId();
29
+ const queryContextHeaders = this.createQueryContextHeaders(cloudId);
30
+
31
+ // Merge headers: query context headers first, then provided headers (provided headers take precedence)
32
+ const mergedOptions = {
33
+ ...options,
34
+ headers: {
35
+ ...queryContextHeaders,
36
+ ...options.headers
37
+ }
38
+ };
39
+ return handleGraphQLRequest(this.serviceUrl, body, mergedOptions);
15
40
  } catch (error) {
16
41
  if (error instanceof GraphQLError) {
17
42
  throw error;
@@ -8,7 +8,8 @@ export async function makeGraphQLRequestWithoutRetries(serviceUrl, body, options
8
8
  const request = fetch(url, {
9
9
  method: 'POST',
10
10
  headers: new Headers({
11
- 'Content-Type': 'application/json'
11
+ 'Content-Type': 'application/json',
12
+ ...(options.headers || {})
12
13
  }),
13
14
  credentials: 'include',
14
15
  body: JSON.stringify(body)
@@ -10,6 +10,7 @@ import { createHook, createStore } from 'react-sweet-state';
10
10
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
12
  import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
13
+ import { teamsClient as externalTeamsClient } from '@atlaskit/teams-client';
13
14
  import { AnalyticsAction, usePeopleAndTeamAnalytics } from '../../../common/utils/analytics';
14
15
  import { teamsClient } from '../../../services';
15
16
  var initialConnectedTeamsState = {
@@ -60,7 +61,7 @@ var actions = {
60
61
  });
61
62
  _context.prev = 5;
62
63
  _context.next = 8;
63
- return teamsClient.getTeamContainers(teamId);
64
+ return fg('enable_teams_public_migration_using_teams-client') ? externalTeamsClient.getTeamContainers(teamId) : teamsClient.getTeamContainers(teamId);
64
65
  case 8:
65
66
  containers = _context.sent;
66
67
  if (fg('ptc-enable-teams-public-analytics-refactor')) {
@@ -126,7 +127,7 @@ var actions = {
126
127
  case 4:
127
128
  _context2.prev = 4;
128
129
  _context2.next = 7;
129
- return teamsClient.getTeamContainers(teamId);
130
+ return fg('enable_teams_public_migration_using_teams-client') ? externalTeamsClient.getTeamContainers(teamId) : teamsClient.getTeamContainers(teamId);
130
131
  case 7:
131
132
  containers = _context2.sent;
132
133
  if (fg('ptc-enable-teams-public-analytics-refactor')) {
@@ -201,7 +202,7 @@ var actions = {
201
202
  });
202
203
  _context3.prev = 5;
203
204
  _context3.next = 8;
204
- return teamsClient.getNumberOfConnectedTeams(containerId);
205
+ return fg('enable_teams_public_migration_using_teams-client') ? externalTeamsClient.getNumberOfConnectedTeams(containerId) : teamsClient.getNumberOfConnectedTeams(containerId);
205
206
  case 8:
206
207
  numberOfTeams = _context3.sent;
207
208
  if (fg('ptc-enable-teams-public-analytics-refactor')) {
@@ -290,7 +291,7 @@ var actions = {
290
291
  });
291
292
  _context4.prev = 5;
292
293
  _context4.next = 8;
293
- return teamsClient.getConnectedTeams(containerId);
294
+ return fg('enable_teams_public_migration_using_teams-client') ? externalTeamsClient.getConnectedTeams(containerId) : teamsClient.getConnectedTeams(containerId);
294
295
  case 8:
295
296
  teams = _context4.sent;
296
297
  if (fg('ptc-enable-teams-public-analytics-refactor')) {
@@ -373,7 +374,7 @@ var actions = {
373
374
  });
374
375
  _context5.prev = 2;
375
376
  _context5.next = 5;
376
- return teamsClient.unlinkTeamContainer(teamId, containerId);
377
+ return fg('enable_teams_public_migration_using_teams-client') ? externalTeamsClient.unlinkTeamContainer(teamId, containerId) : teamsClient.unlinkTeamContainer(teamId, containerId);
377
378
  case 5:
378
379
  mutationResult = _context5.sent;
379
380
  if (mutationResult.deleteTeamConnectedToContainer.errors.length) {
@@ -0,0 +1,119 @@
1
+ // Mock data for tests
2
+ export var MOCK_TEAM_CONTAINERS = {
3
+ graphStore: {
4
+ cypherQuery: {
5
+ edges: [{
6
+ node: {
7
+ from: {
8
+ id: '1'
9
+ },
10
+ to: {
11
+ id: '2',
12
+ data: {
13
+ __typename: 'ConfluenceSpace',
14
+ confluenceSpaceName: 'Confluence Space',
15
+ type: 'confluence',
16
+ createdDate: '2021-01-01',
17
+ links: {
18
+ webUi: 'web-link'
19
+ },
20
+ icon: {
21
+ path: 'https://avatar-management--avatars.us-west-2.staging.public.atl-paas.net/712020:2981defd-17f1-440e-a377-8c7657b72a6f/4b5b0d55-614b-4e75-858f-9da3d0c7e3f8/128'
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }, {
27
+ node: {
28
+ from: {
29
+ id: '1'
30
+ },
31
+ to: {
32
+ id: '3',
33
+ data: {
34
+ __typename: 'JiraProject',
35
+ jiraProjectName: 'Jira Project',
36
+ webUrl: 'web-link',
37
+ created: '2021-01-01',
38
+ avatar: {
39
+ medium: 'https://avatar-management--avatars.us-west-2.staging.public.atl-paas.net/712020:2981defd-17f1-440e-a377-8c7657b72a6f/4b5b0d55-614b-4e75-858f-9da3d0c7e3f8/128'
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }]
45
+ }
46
+ }
47
+ };
48
+ export var MOCK_TEAM_CONTAINERSV2 = {
49
+ graphStore: {
50
+ cypherQueryV2: {
51
+ edges: [{
52
+ node: {
53
+ columns: [{
54
+ key: 'container',
55
+ value: {
56
+ data: {
57
+ __typename: 'ConfluenceSpace',
58
+ id: '2',
59
+ confluenceSpaceName: 'Confluence Space',
60
+ type: 'confluence',
61
+ createdDate: '2021-01-01',
62
+ links: {
63
+ base: 'https://example.com',
64
+ webUi: '/wiki/spaces/SPACE'
65
+ },
66
+ icon: {
67
+ path: '/wiki/download/attachments/123/icon.png'
68
+ }
69
+ }
70
+ }
71
+ }]
72
+ }
73
+ }, {
74
+ node: {
75
+ columns: [{
76
+ key: 'container',
77
+ value: {
78
+ data: {
79
+ __typename: 'JiraProject',
80
+ id: '3',
81
+ jiraProjectName: 'Jira Project',
82
+ webUrl: 'https://example.com/jira/project',
83
+ created: '2021-01-01',
84
+ avatar: {
85
+ medium: 'https://avatar-management--avatars.us-west-2.staging.public.atl-paas.net/712020:2981defd-17f1-440e-a377-8c7657b72a6f/4b5b0d55-614b-4e75-858f-9da3d0c7e3f8/128'
86
+ },
87
+ projectType: 'software',
88
+ projectTypeName: 'Software Project'
89
+ }
90
+ }
91
+ }]
92
+ }
93
+ }]
94
+ }
95
+ }
96
+ };
97
+ export var MOCK_CONNECTED_TEAMS_RESULT = [{
98
+ id: 'ari:cloud:identity::team/8ee37950-7de7-41ec-aee2-2c02c95949f4',
99
+ displayName: 'THE SUPER TEAM',
100
+ description: "Super team's super description",
101
+ state: 'ACTIVE',
102
+ membershipSettings: 'MEMBER_INVITE',
103
+ organizationId: 'ari:cloud:platform::org/434kbc65-c30c-1a22-6933-d25085c532ca',
104
+ creatorId: 'ari:cloud:identity::user/70121:c17bdf1f-39db-4611-a700-2f8c1aff841e',
105
+ isVerified: false,
106
+ members: [{
107
+ id: '70121:c17bdf1f-39db-4611-a700-2f8c1aff841e',
108
+ fullName: 'Shrutha Kashyap',
109
+ avatarUrl: 'https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/70121:c17bdf1f-39db-4611-a700-2f8c1aff841e/cf4058fd-75f2-4824-8041-c8efa4cc0ea8/128',
110
+ status: 'active'
111
+ }],
112
+ includesYou: false,
113
+ memberCount: 1,
114
+ smallAvatarImageUrl: 'https://ptc-directory-sited-static.us-east-1.prod.public.atl-paas.net/teams/avatars/0.svg',
115
+ smallHeaderImageUrl: 'https://ptc-directory-sited-static.us-east-1.prod.public.atl-paas.net/gradients/0.svg',
116
+ largeAvatarImageUrl: 'https://ptc-directory-sited-static.us-east-1.prod.public.atl-paas.net/teams/avatars/0.svg',
117
+ largeHeaderImageUrl: 'https://ptc-directory-sited-static.us-east-1.prod.public.atl-paas.net/gradients/0.svg',
118
+ restriction: 'ORG_MEMBERS'
119
+ }];
@@ -7,7 +7,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
9
9
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
10
  import { teamIdToAri } from '../../common/utils/team-id-to-ari';
12
11
  import { toUserId } from '../../common/utils/user-ari';
13
12
  import { DEFAULT_CONFIG } from '../constants';
@@ -15,7 +14,7 @@ import { BaseGraphQlClient } from '../graphql-client';
15
14
  import { UnlinkContainerMutation } from './utils/mutations/unlink-container-mutation';
16
15
  import { NumberOfTeamConnectedToContainerQuery } from './utils/queries/number-of-team-connected-to-container-query';
17
16
  import { TeamConnectedToContainerQuery } from './utils/queries/team-connected-to-container-query';
18
- import { TeamContainersQuery, TeamContainersQueryV2 } from './utils/queries/team-containers-query';
17
+ import { TeamContainersQueryV2 } from './utils/queries/team-containers-query';
19
18
  export var AGGClient = /*#__PURE__*/function (_BaseGraphQlClient) {
20
19
  function AGGClient(baseUrl, config) {
21
20
  _classCallCheck(this, AGGClient);
@@ -31,17 +30,13 @@ export var AGGClient = /*#__PURE__*/function (_BaseGraphQlClient) {
31
30
  key: "getTeamContainers",
32
31
  value: function () {
33
32
  var _getTeamContainers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(teamId) {
34
- var teamAri, cypherQuery, response, _response;
33
+ var teamAri, cypherQuery, response;
35
34
  return _regeneratorRuntime.wrap(function _callee$(_context) {
36
35
  while (1) switch (_context.prev = _context.next) {
37
36
  case 0:
38
37
  teamAri = teamIdToAri(teamId);
39
38
  cypherQuery = "MATCH (team:IdentityTeam {ari: '".concat(teamAri, "'})-[:team_connected_to_container]->(container) RETURN container");
40
- if (!fg('teams_containers_cypher_query_v2_migration')) {
41
- _context.next = 9;
42
- break;
43
- }
44
- _context.next = 5;
39
+ _context.next = 4;
45
40
  return this.makeGraphQLRequest({
46
41
  query: TeamContainersQueryV2,
47
42
  variables: {
@@ -53,23 +48,10 @@ export var AGGClient = /*#__PURE__*/function (_BaseGraphQlClient) {
53
48
  }, {
54
49
  operationName: 'TeamContainersQueryV2'
55
50
  });
56
- case 5:
51
+ case 4:
57
52
  response = _context.sent;
58
- return _context.abrupt("return", this.processV2Response(response));
59
- case 9:
60
- _context.next = 11;
61
- return this.makeGraphQLRequest({
62
- query: TeamContainersQuery,
63
- variables: {
64
- cypherQuery: cypherQuery
65
- }
66
- }, {
67
- operationName: 'TeamContainersQuery'
68
- });
69
- case 11:
70
- _response = _context.sent;
71
- return _context.abrupt("return", this.processV1Response(_response));
72
- case 13:
53
+ return _context.abrupt("return", this.processResponse(response));
54
+ case 6:
73
55
  case "end":
74
56
  return _context.stop();
75
57
  }
@@ -81,13 +63,13 @@ export var AGGClient = /*#__PURE__*/function (_BaseGraphQlClient) {
81
63
  return getTeamContainers;
82
64
  }()
83
65
  }, {
84
- key: "processV2Response",
85
- value: function processV2Response(response) {
66
+ key: "processResponse",
67
+ value: function processResponse(response) {
86
68
  var containersResult = response.graphStore.cypherQueryV2.edges.reduce(function (containers, edge) {
87
69
  edge.node.columns.forEach(function (column) {
88
70
  var _column$value;
89
71
  var containerData = (_column$value = column.value) === null || _column$value === void 0 ? void 0 : _column$value.data;
90
- if (!containerData && fg('enable_team_containers_null_check')) {
72
+ if (!containerData) {
91
73
  return;
92
74
  }
93
75
  if ((containerData === null || containerData === void 0 ? void 0 : containerData.__typename) === 'ConfluenceSpace') {
@@ -130,52 +112,6 @@ export var AGGClient = /*#__PURE__*/function (_BaseGraphQlClient) {
130
112
  }, []);
131
113
  return containersResult;
132
114
  }
133
- }, {
134
- key: "processV1Response",
135
- value: function processV1Response(response) {
136
- var containersResult = response.graphStore.cypherQuery.edges.reduce(function (containers, edge) {
137
- if (!edge.node.to.data && fg('enable_team_containers_null_check')) {
138
- return containers;
139
- }
140
- if (edge.node.to.data.__typename === 'ConfluenceSpace') {
141
- containers.push({
142
- id: edge.node.to.id,
143
- type: edge.node.to.data.__typename,
144
- name: edge.node.to.data.confluenceSpaceName || '',
145
- icon: "".concat(edge.node.to.data.links.base).concat(edge.node.to.data.icon.path),
146
- createdDate: new Date(edge.node.to.data.createdDate),
147
- link: "".concat(edge.node.to.data.links.base).concat(edge.node.to.data.links.webUi),
148
- containerTypeProperties: {
149
- subType: undefined,
150
- name: undefined
151
- }
152
- });
153
- } else if (edge.node.to.data.__typename === 'JiraProject') {
154
- containers.push({
155
- id: edge.node.to.id,
156
- type: edge.node.to.data.__typename,
157
- name: edge.node.to.data.jiraProjectName,
158
- icon: edge.node.to.data.avatar.medium,
159
- createdDate: new Date(edge.node.to.data.created),
160
- link: edge.node.to.data.webUrl,
161
- containerTypeProperties: {
162
- subType: edge.node.to.data.projectType || '',
163
- name: edge.node.to.data.projectTypeName || ''
164
- }
165
- });
166
- } else if (edge.node.to.data.__typename === 'LoomSpace') {
167
- containers.push({
168
- id: edge.node.to.id,
169
- type: edge.node.to.data.__typename,
170
- name: edge.node.to.data.loomSpaceName,
171
- icon: '',
172
- link: edge.node.to.data.url
173
- });
174
- }
175
- return containers;
176
- }, []);
177
- return containersResult;
178
- }
179
115
  }, {
180
116
  key: "unlinkTeamContainer",
181
117
  value: function () {