@atlaskit/teams-public 0.2.0 → 0.3.1

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 (141) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/common/utils/error/index.js +120 -0
  3. package/dist/cjs/common/utils/get-container-properties.js +2 -12
  4. package/dist/cjs/common/utils/http.js +119 -0
  5. package/dist/cjs/common/utils/status-code-handlers-provider.js +30 -0
  6. package/dist/cjs/common/utils/team-id-to-ari.js +10 -0
  7. package/dist/cjs/controllers/hooks/use-team-containers/index.js +79 -0
  8. package/dist/cjs/controllers/index.js +12 -0
  9. package/dist/cjs/services/agg-client/index.js +79 -0
  10. package/dist/cjs/services/agg-client/mocks/index.js +52 -0
  11. package/dist/cjs/services/agg-client/utils/queries/team-containers-query.js +12 -0
  12. package/dist/cjs/services/base-client/index.js +92 -0
  13. package/dist/cjs/services/constants.js +9 -0
  14. package/dist/cjs/services/graphql-client/index.js +12 -0
  15. package/dist/cjs/services/graphql-client/main.js +69 -0
  16. package/dist/cjs/services/graphql-client/types.js +5 -0
  17. package/dist/cjs/services/graphql-client/utils/index.js +157 -0
  18. package/dist/cjs/services/index.js +18 -0
  19. package/dist/cjs/services/main.js +72 -0
  20. package/dist/cjs/services/types.js +5 -0
  21. package/dist/cjs/ui/team-containers/add-container-card/index.compiled.css +0 -2
  22. package/dist/cjs/ui/team-containers/add-container-card/index.js +30 -12
  23. package/dist/cjs/ui/team-containers/linked-container-card/index.compiled.css +1 -2
  24. package/dist/cjs/ui/team-containers/linked-container-card/index.js +45 -15
  25. package/dist/cjs/ui/team-containers/main.js +94 -16
  26. package/dist/cjs/ui/team-containers/team-containers-skeleton/index.compiled.css +4 -0
  27. package/dist/cjs/ui/team-containers/team-containers-skeleton/index.js +36 -0
  28. package/dist/cjs/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.compiled.css +14 -0
  29. package/dist/cjs/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.js +38 -0
  30. package/dist/es2019/common/utils/error/index.js +87 -0
  31. package/dist/es2019/common/utils/get-container-properties.js +3 -13
  32. package/dist/es2019/common/utils/http.js +82 -0
  33. package/dist/es2019/common/utils/status-code-handlers-provider.js +25 -0
  34. package/dist/es2019/common/utils/team-id-to-ari.js +2 -0
  35. package/dist/es2019/controllers/hooks/use-team-containers/index.js +45 -0
  36. package/dist/es2019/controllers/index.js +1 -0
  37. package/dist/es2019/services/agg-client/index.js +36 -0
  38. package/dist/es2019/services/agg-client/mocks/index.js +46 -0
  39. package/dist/es2019/services/agg-client/utils/queries/team-containers-query.js +46 -0
  40. package/dist/es2019/services/base-client/index.js +64 -0
  41. package/dist/es2019/services/constants.js +3 -0
  42. package/dist/es2019/services/graphql-client/index.js +1 -0
  43. package/dist/es2019/services/graphql-client/main.js +23 -0
  44. package/dist/es2019/services/graphql-client/types.js +1 -0
  45. package/dist/es2019/services/graphql-client/utils/index.js +76 -0
  46. package/dist/es2019/services/index.js +1 -0
  47. package/dist/es2019/services/main.js +39 -0
  48. package/dist/es2019/services/types.js +1 -0
  49. package/dist/es2019/ui/team-containers/add-container-card/index.compiled.css +0 -2
  50. package/dist/es2019/ui/team-containers/add-container-card/index.js +15 -7
  51. package/dist/es2019/ui/team-containers/linked-container-card/index.compiled.css +1 -2
  52. package/dist/es2019/ui/team-containers/linked-container-card/index.js +28 -9
  53. package/dist/es2019/ui/team-containers/main.js +79 -16
  54. package/dist/es2019/ui/team-containers/team-containers-skeleton/index.compiled.css +4 -0
  55. package/dist/es2019/ui/team-containers/team-containers-skeleton/index.js +27 -0
  56. package/dist/es2019/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.compiled.css +14 -0
  57. package/dist/es2019/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.js +31 -0
  58. package/dist/esm/common/utils/error/index.js +117 -0
  59. package/dist/esm/common/utils/get-container-properties.js +3 -13
  60. package/dist/esm/common/utils/http.js +109 -0
  61. package/dist/esm/common/utils/status-code-handlers-provider.js +23 -0
  62. package/dist/esm/common/utils/team-id-to-ari.js +4 -0
  63. package/dist/esm/controllers/hooks/use-team-containers/index.js +72 -0
  64. package/dist/esm/controllers/index.js +1 -0
  65. package/dist/esm/services/agg-client/index.js +72 -0
  66. package/dist/esm/services/agg-client/mocks/index.js +46 -0
  67. package/dist/esm/services/agg-client/utils/queries/team-containers-query.js +5 -0
  68. package/dist/esm/services/base-client/index.js +85 -0
  69. package/dist/esm/services/constants.js +3 -0
  70. package/dist/esm/services/graphql-client/index.js +1 -0
  71. package/dist/esm/services/graphql-client/main.js +62 -0
  72. package/dist/esm/services/graphql-client/types.js +1 -0
  73. package/dist/esm/services/graphql-client/utils/index.js +149 -0
  74. package/dist/esm/services/index.js +1 -0
  75. package/dist/esm/services/main.js +65 -0
  76. package/dist/esm/services/types.js +1 -0
  77. package/dist/esm/ui/team-containers/add-container-card/index.compiled.css +0 -2
  78. package/dist/esm/ui/team-containers/add-container-card/index.js +25 -7
  79. package/dist/esm/ui/team-containers/linked-container-card/index.compiled.css +1 -2
  80. package/dist/esm/ui/team-containers/linked-container-card/index.js +39 -9
  81. package/dist/esm/ui/team-containers/main.js +91 -16
  82. package/dist/esm/ui/team-containers/team-containers-skeleton/index.compiled.css +4 -0
  83. package/dist/esm/ui/team-containers/team-containers-skeleton/index.js +29 -0
  84. package/dist/esm/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.compiled.css +14 -0
  85. package/dist/esm/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.js +31 -0
  86. package/dist/types/common/types.d.ts +1 -1
  87. package/dist/types/common/utils/error/index.d.ts +59 -0
  88. package/dist/types/common/utils/http.d.ts +31 -0
  89. package/dist/types/common/utils/status-code-handlers-provider.d.ts +17 -0
  90. package/dist/types/common/utils/team-id-to-ari.d.ts +2 -0
  91. package/dist/types/controllers/hooks/use-team-containers/index.d.ts +12 -0
  92. package/dist/types/controllers/index.d.ts +1 -0
  93. package/dist/types/services/agg-client/index.d.ts +15 -0
  94. package/dist/types/services/agg-client/mocks/index.d.ts +55 -0
  95. package/dist/types/services/agg-client/utils/queries/team-containers-query.d.ts +44 -0
  96. package/dist/types/services/base-client/index.d.ts +37 -0
  97. package/dist/types/services/constants.d.ts +4 -0
  98. package/dist/types/services/graphql-client/index.d.ts +1 -0
  99. package/dist/types/services/graphql-client/main.d.ts +8 -0
  100. package/dist/types/services/graphql-client/types.d.ts +19 -0
  101. package/dist/types/services/graphql-client/utils/index.d.ts +3 -0
  102. package/dist/types/services/index.d.ts +1 -0
  103. package/dist/types/services/main.d.ts +25 -0
  104. package/dist/types/services/types.d.ts +19 -0
  105. package/dist/types/ui/team-containers/add-container-card/index.d.ts +3 -2
  106. package/dist/types/ui/team-containers/linked-container-card/index.d.ts +3 -6
  107. package/dist/types/ui/team-containers/main.d.ts +3 -1
  108. package/dist/types/ui/team-containers/team-containers-skeleton/index.d.ts +6 -0
  109. package/dist/types/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.d.ts +2 -0
  110. package/dist/types/ui/team-containers/types.d.ts +5 -0
  111. package/dist/types-ts4.5/common/types.d.ts +1 -1
  112. package/dist/types-ts4.5/common/utils/error/index.d.ts +59 -0
  113. package/dist/types-ts4.5/common/utils/http.d.ts +31 -0
  114. package/dist/types-ts4.5/common/utils/status-code-handlers-provider.d.ts +17 -0
  115. package/dist/types-ts4.5/common/utils/team-id-to-ari.d.ts +2 -0
  116. package/dist/types-ts4.5/controllers/hooks/use-team-containers/index.d.ts +12 -0
  117. package/dist/types-ts4.5/controllers/index.d.ts +1 -0
  118. package/dist/types-ts4.5/services/agg-client/index.d.ts +15 -0
  119. package/dist/types-ts4.5/services/agg-client/mocks/index.d.ts +55 -0
  120. package/dist/types-ts4.5/services/agg-client/utils/queries/team-containers-query.d.ts +44 -0
  121. package/dist/types-ts4.5/services/base-client/index.d.ts +37 -0
  122. package/dist/types-ts4.5/services/constants.d.ts +4 -0
  123. package/dist/types-ts4.5/services/graphql-client/index.d.ts +1 -0
  124. package/dist/types-ts4.5/services/graphql-client/main.d.ts +8 -0
  125. package/dist/types-ts4.5/services/graphql-client/types.d.ts +19 -0
  126. package/dist/types-ts4.5/services/graphql-client/utils/index.d.ts +3 -0
  127. package/dist/types-ts4.5/services/index.d.ts +1 -0
  128. package/dist/types-ts4.5/services/main.d.ts +25 -0
  129. package/dist/types-ts4.5/services/types.d.ts +19 -0
  130. package/dist/types-ts4.5/ui/team-containers/add-container-card/index.d.ts +3 -2
  131. package/dist/types-ts4.5/ui/team-containers/linked-container-card/index.d.ts +3 -6
  132. package/dist/types-ts4.5/ui/team-containers/main.d.ts +3 -1
  133. package/dist/types-ts4.5/ui/team-containers/team-containers-skeleton/index.d.ts +6 -0
  134. package/dist/types-ts4.5/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.d.ts +2 -0
  135. package/dist/types-ts4.5/ui/team-containers/types.d.ts +5 -0
  136. package/package.json +13 -9
  137. package/dist/cjs/ui/team-containers/constants.js +0 -7
  138. package/dist/es2019/ui/team-containers/constants.js +0 -1
  139. package/dist/esm/ui/team-containers/constants.js +0 -1
  140. package/dist/types/ui/team-containers/constants.d.ts +0 -1
  141. package/dist/types-ts4.5/ui/team-containers/constants.d.ts +0 -1
@@ -0,0 +1,37 @@
1
+ import { type ClientContext, type ClientContextProps } from '../types';
2
+ type NestedContext = {
3
+ [key: string]: string | number | boolean | NestedContext;
4
+ };
5
+ export type LogExceptionFN = (ex: unknown | Error, name: string, context?: NestedContext & {
6
+ tags?: Record<string, string>;
7
+ }) => void;
8
+ export type ClientConfig = {
9
+ logException: LogExceptionFN;
10
+ };
11
+ export declare class BaseClient {
12
+ private config;
13
+ private context;
14
+ private cache;
15
+ constructor(config: ClientConfig);
16
+ setContext(context: ClientContextProps): void;
17
+ getContext(): ClientContext;
18
+ /**
19
+ *
20
+ * @param localValue is used for backwards compatibility
21
+ * @returns
22
+ */
23
+ getOrgId(localValue?: string): string;
24
+ /**
25
+ *
26
+ * @param localValue is used for backwards compatibility
27
+ * @returns
28
+ */
29
+ getCloudId(localValue?: string): string | null | undefined;
30
+ logException: (ex: unknown | Error, name: string, context?: NestedContext & {
31
+ tags?: Record<string, string>;
32
+ }) => void;
33
+ private keyWithContext;
34
+ cacheValue<T>(key: string, value: T, expiryMs?: number): void;
35
+ getCachedValue<T>(key: string): T | undefined;
36
+ }
37
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface TeamsConfig {
2
+ stargateRoot: string;
3
+ }
4
+ export declare const DEFAULT_CONFIG: TeamsConfig;
@@ -0,0 +1 @@
1
+ export { BaseGraphQlClient } from './main';
@@ -0,0 +1,8 @@
1
+ import { BaseClient, type ClientConfig } from '../base-client';
2
+ import { type Body, type Options, type ResultResponse } from './types';
3
+ export declare class BaseGraphQlClient extends BaseClient {
4
+ private serviceUrl;
5
+ constructor(serviceUrl: string, config: ClientConfig);
6
+ setServiceUrl(serviceUrl: string): void;
7
+ makeGraphQLRequest<Key extends string, Data = unknown, Variables = unknown>(body: Body<Variables>, options?: Options): Promise<ResultResponse<Key, Data>>;
8
+ }
@@ -0,0 +1,19 @@
1
+ import { type ErrorData } from '../../common/utils/error';
2
+ export interface Options {
3
+ operationName?: string;
4
+ errorPolicy?: 'none' | 'all' | 'ignore';
5
+ }
6
+ export type InnerResponse<T> = {
7
+ data: T;
8
+ errors?: ErrorData[];
9
+ };
10
+ export type ResultResponse<Key extends string, Data> = {
11
+ [name in Key]: Data;
12
+ };
13
+ export type Body<Variables> = {
14
+ query: string;
15
+ variables?: Variables;
16
+ };
17
+ export type GraphQLRequestDataResponse<Data> = Data | {
18
+ response: Response;
19
+ };
@@ -0,0 +1,3 @@
1
+ import { type Body, type GraphQLRequestDataResponse, type Options, type ResultResponse } from '../types';
2
+ export declare function makeGraphQLRequestWithoutRetries<Data, Variables>(serviceUrl: string, body: Body<Variables>, options?: Options): Promise<GraphQLRequestDataResponse<Data>>;
3
+ export declare function handleGraphQLRequest<Key extends string, Data = unknown, Variables = unknown>(serviceUrl: string, body: Body<Variables>, options?: Options): Promise<ResultResponse<Key, Data>>;
@@ -0,0 +1 @@
1
+ export { teamsClient, TeamsClient } from './main';
@@ -0,0 +1,25 @@
1
+ import { type ClientContextProps, type TeamContainers } from './types';
2
+ export declare class TeamsClient {
3
+ private readonly _aggClient;
4
+ constructor(
5
+ /**
6
+ * @param {ClientContextProps} context - Context including CloudId & OrgId to be used for all requests
7
+ */
8
+ context?: ClientContextProps);
9
+ /**
10
+ * Sets the base URL to be used in the client requests
11
+ * @param {string} baseUrl - The new base URL
12
+ */
13
+ setBaseUrl(baseUrl: string): void;
14
+ /**
15
+ * Sets context including CloudId & OrgId to be used for all requests
16
+ */
17
+ setContext(context: ClientContextProps): void;
18
+ /**
19
+ * Get the containers for a given team
20
+ * @param {string} teamId
21
+ * @returns {Promise<TeamContainers>}
22
+ */
23
+ getTeamContainers(teamId: string): Promise<TeamContainers>;
24
+ }
25
+ export declare const teamsClient: TeamsClient;
@@ -0,0 +1,19 @@
1
+ import { type ContainerTypes } from '../common/types';
2
+ export type ClientContext = {
3
+ cloudId?: string | null;
4
+ orgId?: string;
5
+ userId?: string;
6
+ };
7
+ export type ClientContextProps = {
8
+ cloudId?: string | null;
9
+ orgId?: string;
10
+ userId?: string;
11
+ };
12
+ export type TeamContainers = Array<{
13
+ id: string;
14
+ type: ContainerTypes;
15
+ name: string;
16
+ icon: string;
17
+ createdDate: Date;
18
+ link: string;
19
+ }>;
@@ -1,7 +1,8 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { type ContainerTypes } from '../../../common/types';
3
3
  interface AddContainerCardProps {
4
4
  containerType: ContainerTypes;
5
+ onAddAContainerClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
5
6
  }
6
- export declare const AddContainerCard: ({ containerType }: AddContainerCardProps) => JSX.Element;
7
+ export declare const AddContainerCard: ({ containerType, onAddAContainerClick, }: AddContainerCardProps) => React.JSX.Element;
7
8
  export {};
@@ -1,13 +1,10 @@
1
- /// <reference types="react" />
2
- /**
3
- * @jsxRuntime classic
4
- * @jsx jsx
5
- */
1
+ import React from 'react';
6
2
  import { type ContainerTypes } from '../../../common/types';
7
3
  interface LinkedContainerCardProps {
8
4
  containerType: ContainerTypes;
9
5
  title: string;
10
6
  containerIcon: string;
7
+ link: string;
11
8
  }
12
- export declare const LinkedContainerCard: ({ containerType, title, containerIcon, }: LinkedContainerCardProps) => JSX.Element;
9
+ export declare const LinkedContainerCard: ({ containerType, title, containerIcon, link, }: LinkedContainerCardProps) => React.JSX.Element;
13
10
  export {};
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
+ import { type TeamContainerProps } from './types';
2
3
  export declare const ICON_BACKGROUND: "var(--ds-icon-inverse)";
3
4
  export declare const ICON_COLOR: "var(--ds-icon-subtle)";
4
- export declare const TeamContainers: () => React.JSX.Element;
5
+ export declare const MAX_NUMBER_OF_CONTAINERS_TO_SHOW = 4;
6
+ export declare const TeamContainers: ({ teamId, onAddAContainerClick }: TeamContainerProps) => React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface TeamContainersSkeletonProps {
3
+ numberOfContainers: number;
4
+ }
5
+ export declare const TeamContainersSkeleton: ({ numberOfContainers }: TeamContainersSkeletonProps) => React.JSX.Element;
6
+ export {};
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const LinkedContainerCardSkeleton: () => React.JSX.Element;
@@ -1,6 +1,11 @@
1
+ /// <reference types="react" />
1
2
  export interface TeamContainerProps {
2
3
  /**
3
4
  * The team id to fetch the team container for
4
5
  */
5
6
  teamId: string;
7
+ /**
8
+ * The function to call when the add a container button is clicked
9
+ */
10
+ onAddAContainerClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
6
11
  }
package/package.json CHANGED
@@ -30,19 +30,22 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@atlaskit/button": "^20.4.0",
33
- "@atlaskit/css": "^0.8.0",
34
- "@atlaskit/icon": "^23.5.0",
33
+ "@atlaskit/css": "^0.9.0",
34
+ "@atlaskit/icon": "^23.10.0",
35
35
  "@atlaskit/image": "^1.4.0",
36
- "@atlaskit/link": "^2.1.2",
37
- "@atlaskit/logo": "^15.2.0",
36
+ "@atlaskit/link": "^2.2.0",
37
+ "@atlaskit/logo": "^15.4.0",
38
38
  "@atlaskit/menu": "^2.14.0",
39
- "@atlaskit/primitives": "^13.5.0",
40
- "@atlaskit/theme": "^15.0.0",
39
+ "@atlaskit/primitives": "^13.6.0",
40
+ "@atlaskit/theme": "^16.0.0",
41
41
  "@atlaskit/tokens": "^3.3.0",
42
42
  "@babel/runtime": "^7.0.0",
43
- "@compiled/react": "^0.18.1",
43
+ "@compiled/react": "^0.18.2",
44
+ "graphql": "^15.8.0",
45
+ "graphql-tag": "^2.10.1",
44
46
  "react-intl-next": "npm:react-intl@^5.18.1",
45
- "react-router-dom": "^6.28.0"
47
+ "react-router-dom": "^6.28.0",
48
+ "react-sweet-state": "^2.6.5"
46
49
  },
47
50
  "peerDependencies": {
48
51
  "react": "^18.2.0"
@@ -53,6 +56,7 @@
53
56
  "@atlaskit/ssr": "*",
54
57
  "@atlaskit/visual-regression": "*",
55
58
  "@testing-library/react": "^13.4.0",
59
+ "@testing-library/react-hooks": "^8.0.1",
56
60
  "@testing-library/user-event": "^14.4.3",
57
61
  "react-dom": "^18.2.0",
58
62
  "typescript": "~5.4.2"
@@ -96,7 +100,7 @@
96
100
  }
97
101
  },
98
102
  "name": "@atlaskit/teams-public",
99
- "version": "0.2.0",
103
+ "version": "0.3.1",
100
104
  "description": "Public components related to teams",
101
105
  "author": "Atlassian Pty Ltd",
102
106
  "license": "Apache-2.0",
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PROGRESS_BAR_TEST_ID = void 0;
7
- var PROGRESS_BAR_TEST_ID = exports.PROGRESS_BAR_TEST_ID = 'myProgressBar';
@@ -1 +0,0 @@
1
- export const PROGRESS_BAR_TEST_ID = 'myProgressBar';
@@ -1 +0,0 @@
1
- export var PROGRESS_BAR_TEST_ID = 'myProgressBar';
@@ -1 +0,0 @@
1
- export declare const PROGRESS_BAR_TEST_ID = "myProgressBar";
@@ -1 +0,0 @@
1
- export declare const PROGRESS_BAR_TEST_ID = "myProgressBar";