@atlaskit/teams-public 0.73.0 → 0.74.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 (32) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/package.json +2 -2
  3. package/dist/cjs/common/utils/error/index.js +0 -120
  4. package/dist/cjs/common/utils/http.js +0 -119
  5. package/dist/cjs/common/utils/status-code-handlers-provider.js +0 -30
  6. package/dist/cjs/common/utils/team-id-to-ari.js +0 -10
  7. package/dist/cjs/common/utils/user-ari.js +0 -16
  8. package/dist/cjs/ui/team-containers/utils.js +0 -81
  9. package/dist/es2019/common/utils/error/index.js +0 -87
  10. package/dist/es2019/common/utils/http.js +0 -82
  11. package/dist/es2019/common/utils/status-code-handlers-provider.js +0 -25
  12. package/dist/es2019/common/utils/team-id-to-ari.js +0 -2
  13. package/dist/es2019/common/utils/user-ari.js +0 -8
  14. package/dist/es2019/ui/team-containers/utils.js +0 -71
  15. package/dist/esm/common/utils/error/index.js +0 -117
  16. package/dist/esm/common/utils/http.js +0 -109
  17. package/dist/esm/common/utils/status-code-handlers-provider.js +0 -23
  18. package/dist/esm/common/utils/team-id-to-ari.js +0 -4
  19. package/dist/esm/common/utils/user-ari.js +0 -10
  20. package/dist/esm/ui/team-containers/utils.js +0 -74
  21. package/dist/types/common/utils/error/index.d.ts +0 -59
  22. package/dist/types/common/utils/http.d.ts +0 -31
  23. package/dist/types/common/utils/status-code-handlers-provider.d.ts +0 -17
  24. package/dist/types/common/utils/team-id-to-ari.d.ts +0 -2
  25. package/dist/types/common/utils/user-ari.d.ts +0 -3
  26. package/dist/types/ui/team-containers/utils.d.ts +0 -25
  27. package/dist/types-ts4.5/common/utils/error/index.d.ts +0 -59
  28. package/dist/types-ts4.5/common/utils/http.d.ts +0 -31
  29. package/dist/types-ts4.5/common/utils/status-code-handlers-provider.d.ts +0 -17
  30. package/dist/types-ts4.5/common/utils/team-id-to-ari.d.ts +0 -2
  31. package/dist/types-ts4.5/common/utils/user-ari.d.ts +0 -3
  32. package/dist/types-ts4.5/ui/team-containers/utils.d.ts +0 -25
@@ -1,71 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react';
3
- import { defineMessages, FormattedMessage } from 'react-intl-next';
4
- import LinkExternalIcon from '@atlaskit/icon/core/link-external';
5
- import { Flex } from '@atlaskit/primitives/compiled';
6
- export const getCreateContainerContactSupportFlag = () => ({
7
- id: 'teams-public.team-container.create-container.error.contact-support',
8
- type: 'error',
9
- title: /*#__PURE__*/React.createElement(FormattedMessage, messages.noConnectionTitle),
10
- description: /*#__PURE__*/React.createElement(FormattedMessage, messages.noConnectionDescription),
11
- actions: [{
12
- content: /*#__PURE__*/React.createElement(Flex, {
13
- alignItems: "center",
14
- columnGap: "space.100"
15
- }, /*#__PURE__*/React.createElement(FormattedMessage, messages.noConnectionAction), /*#__PURE__*/React.createElement(LinkExternalIcon, {
16
- label: ""
17
- })),
18
- href: 'https://support.atlassian.com/contact/#/&support_type=customer'
19
- }]
20
- });
21
- export const getCreateContainerTryAgainFlag = ({
22
- tryAgainAction,
23
- containerType
24
- }) => ({
25
- id: 'teams-public.team-container.create-container.error.try-again',
26
- type: 'error',
27
- title: /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.timeoutTitle, {
28
- values: {
29
- containerType
30
- }
31
- })),
32
- description: /*#__PURE__*/React.createElement(FormattedMessage, messages.timeoutDescription),
33
- actions: [{
34
- content: /*#__PURE__*/React.createElement(FormattedMessage, messages.timeoutAction),
35
- onClick: () => {
36
- tryAgainAction === null || tryAgainAction === void 0 ? void 0 : tryAgainAction();
37
- }
38
- }]
39
- });
40
- const messages = defineMessages({
41
- timeoutTitle: {
42
- id: 'teams-public.team-containers.timeout-title',
43
- defaultMessage: 'We’re couldn’t connect your {containerType}',
44
- description: 'Title for the timeout flag'
45
- },
46
- timeoutDescription: {
47
- id: 'teams-public.team-containers.timeout-description',
48
- defaultMessage: 'Something went wrong. Verify your connection and retry.',
49
- description: 'Description for the timeout flag'
50
- },
51
- timeoutAction: {
52
- id: 'teams-public.team-containers.timeout-action',
53
- defaultMessage: 'Try again',
54
- description: 'Action text for the timeout flag'
55
- },
56
- noConnectionTitle: {
57
- id: 'teams-public.team-containers.timeout-no-connection-title',
58
- defaultMessage: 'Connection failed',
59
- description: 'Title for the no connection flag'
60
- },
61
- noConnectionDescription: {
62
- id: 'teams-public.team-containers.timeout-no-connection-description',
63
- defaultMessage: 'Try manually creating the space yourself.',
64
- description: 'Description for the no connection flag'
65
- },
66
- noConnectionAction: {
67
- id: 'teams-public.team-containers.timeout-no-connection-action',
68
- defaultMessage: 'Contact support',
69
- description: 'Action text for the no connection flag'
70
- }
71
- });
@@ -1,117 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
- import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
8
- var _GraphQLError;
9
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
10
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
- export var StatusCode = /*#__PURE__*/function (StatusCode) {
12
- StatusCode[StatusCode["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
13
- StatusCode[StatusCode["FORBIDDEN"] = 403] = "FORBIDDEN";
14
- StatusCode[StatusCode["TIMEOUT"] = 408] = "TIMEOUT";
15
- StatusCode[StatusCode["GONE"] = 410] = "GONE";
16
- StatusCode[StatusCode["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
17
- return StatusCode;
18
- }({});
19
- var CommonError = /*#__PURE__*/function (_Error) {
20
- function CommonError(message) {
21
- var _this;
22
- _classCallCheck(this, CommonError);
23
- _this = _callSuper(this, CommonError, [message]);
24
- _this.name = _this.constructor.name;
25
- _this.message = message || 'UnknownError';
26
- _this.stack = new Error(message).stack || '';
27
- return _this;
28
- }
29
- _inherits(CommonError, _Error);
30
- return _createClass(CommonError);
31
- }( /*#__PURE__*/_wrapNativeSuper(Error));
32
- export var DefaultError = /*#__PURE__*/function (_CommonError) {
33
- function DefaultError(_ref) {
34
- var _this2;
35
- var message = _ref.message;
36
- _classCallCheck(this, DefaultError);
37
- _this2 = _callSuper(this, DefaultError, [message || 'UnknownError']);
38
- Object.setPrototypeOf(_this2, DefaultError.prototype);
39
- return _this2;
40
- }
41
- _inherits(DefaultError, _CommonError);
42
- return _createClass(DefaultError);
43
- }(CommonError);
44
-
45
- /**
46
- * These errors will not fail UFO experiences
47
- */
48
- export var SLOIgnoreError = /*#__PURE__*/function (_CommonError2) {
49
- function SLOIgnoreError(_ref2) {
50
- var _this3;
51
- var message = _ref2.message;
52
- _classCallCheck(this, SLOIgnoreError);
53
- _this3 = _callSuper(this, SLOIgnoreError, ["SentryIgnore: ".concat(message || 'UnknownError')]);
54
- Object.setPrototypeOf(_this3, SLOIgnoreError.prototype);
55
- return _this3;
56
- }
57
- _inherits(SLOIgnoreError, _CommonError2);
58
- return _createClass(SLOIgnoreError);
59
- }(CommonError);
60
- // Http Errors
61
- export var HttpError = /*#__PURE__*/function (_CommonError3) {
62
- function HttpError(_ref3) {
63
- var _this4;
64
- var message = _ref3.message,
65
- status = _ref3.status,
66
- traceId = _ref3.traceId,
67
- path = _ref3.path;
68
- _classCallCheck(this, HttpError);
69
- _this4 = _callSuper(this, HttpError, [message]);
70
- Object.setPrototypeOf(_this4, HttpError.prototype);
71
- _this4.status = status;
72
- _this4.traceId = traceId;
73
- _this4.path = path;
74
- return _this4;
75
- }
76
- _inherits(HttpError, _CommonError3);
77
- return _createClass(HttpError);
78
- }(CommonError);
79
-
80
- // Graphql Errors
81
-
82
- export var GraphQLError = /*#__PURE__*/function (_CommonError4) {
83
- // tslint:disable-line no-any
84
-
85
- function GraphQLError(_ref4) {
86
- var _this5;
87
- var message = _ref4.message,
88
- _ref4$category = _ref4.category,
89
- category = _ref4$category === void 0 ? 'default' : _ref4$category,
90
- fields = _ref4.fields;
91
- _classCallCheck(this, GraphQLError);
92
- _this5 = _callSuper(this, GraphQLError, [message]);
93
- Object.setPrototypeOf(_this5, GraphQLError.prototype);
94
- _this5.category = category;
95
- if (fields) {
96
- _this5.fields = fields;
97
- }
98
- return _this5;
99
- }
100
- _inherits(GraphQLError, _CommonError4);
101
- return _createClass(GraphQLError);
102
- }(CommonError);
103
- _GraphQLError = GraphQLError;
104
- _defineProperty(GraphQLError, "from", function (rawErrors) {
105
- var firstError = rawErrors[0];
106
- var errorData = {
107
- category: firstError.category,
108
- message: firstError.message
109
- };
110
- if (firstError.fields) {
111
- errorData.fields = firstError.fields.reduce(function (obj, item) {
112
- obj[item.field] = item.message;
113
- return obj;
114
- }, {});
115
- }
116
- return new _GraphQLError(errorData);
117
- });
@@ -1,109 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
- export var EXPONENTIAL_BACKOFF_RETRY_POLICY = {
4
- INITIAL_DELAY: 200,
5
- MAX_RETRIES: 5,
6
- JITTER: true
7
- };
8
-
9
- /**
10
- * Checks whether a status code is a 5xx HTTP code.
11
- * @param {number} status HTTP status code
12
- */
13
- export function is5xx(status) {
14
- return 500 <= status && status <= 599;
15
- }
16
- export function isFetchResponse(data) {
17
- if (!data || !data.hasOwnProperty('response')) {
18
- return false;
19
- }
20
- return data.response instanceof Response;
21
- }
22
-
23
- // tslint:disable-next-line no-any
24
-
25
- // tslint:disable-next-line no-any
26
- var defaultRetryIfCallback = function defaultRetryIfCallback(a) {
27
- return !a;
28
- };
29
- var defaultOptions = {
30
- initial: 200,
31
- jitter: false,
32
- max: 5,
33
- retryIf: defaultRetryIfCallback
34
- };
35
- /**
36
- * Transparently wrap a function so that it is retried until it succeeds or reaches a max retry limit.
37
- * The returned function has the same signature as the wrapped function.
38
- *
39
- * Modified from https://jsfiddle.net/pajtai/pLka0ow9/
40
- */
41
- export function withExponentialBackoff(toTry) {
42
- var hofOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
43
- var initial = hofOptions.initial,
44
- jitter = hofOptions.jitter,
45
- max = hofOptions.max,
46
- retryIf = hofOptions.retryIf;
47
-
48
- // Initialize max retry decrementing counter (range of max...0)
49
- var attemptsRemaining = max;
50
-
51
- // Initialize delay. This will exponentially increase each retry (delay = intial * 2^n)
52
- var delay = initial;
53
-
54
- /**
55
- * This function calls itself recursively until `retryIf` evaluates false or the retry limit is reached.
56
- * The functioned-to-be-retried is called on each recursion.
57
- */
58
- return /*#__PURE__*/function () {
59
- var _tryWithExponentialBackoff = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
60
- var result,
61
- _args = arguments;
62
- return _regeneratorRuntime.wrap(function _callee$(_context) {
63
- while (1) switch (_context.prev = _context.next) {
64
- case 0:
65
- _context.next = 2;
66
- return toTry.apply(void 0, _args);
67
- case 2:
68
- result = _context.sent;
69
- --attemptsRemaining;
70
-
71
- // If tried function was unsuccessful and there are still retries remaining, retry!
72
- if (!(retryIf && retryIf(result) && attemptsRemaining > 0)) {
73
- _context.next = 9;
74
- break;
75
- }
76
- _context.next = 7;
77
- return new Promise(function (resolve) {
78
- return setTimeout(resolve, jitter ? Math.random() * delay : delay);
79
- });
80
- case 7:
81
- // Exponentially increase delay
82
- delay *= 2;
83
-
84
- // Initiate retry
85
- return _context.abrupt("return", tryWithExponentialBackoff.apply(void 0, _args));
86
- case 9:
87
- return _context.abrupt("return", result);
88
- case 10:
89
- case "end":
90
- return _context.stop();
91
- }
92
- }, _callee);
93
- }));
94
- function tryWithExponentialBackoff() {
95
- return _tryWithExponentialBackoff.apply(this, arguments);
96
- }
97
- return tryWithExponentialBackoff;
98
- }();
99
- }
100
- export var fetchWithExponentialBackoff = withExponentialBackoff(function (url, init) {
101
- return fetch(url, init);
102
- }, {
103
- initial: EXPONENTIAL_BACKOFF_RETRY_POLICY.INITIAL_DELAY,
104
- jitter: EXPONENTIAL_BACKOFF_RETRY_POLICY.JITTER,
105
- max: EXPONENTIAL_BACKOFF_RETRY_POLICY.MAX_RETRIES,
106
- retryIf: function retryIf(response) {
107
- return is5xx(response.status);
108
- }
109
- });
@@ -1,23 +0,0 @@
1
- /**
2
- * Our REST clients are initialised when their module loads which makes it tricky for them to consume the `statusCodeHandlers` prop passed to App from the host application.
3
- * This is a temporary measure to enable the clients to consume `statusCodeHandlers`.
4
- * The long term solution is to replace our REST clients with Apollo client custom resolvers
5
- * This will unify all remote data handling under the apollo-client module which is able to easily receive `statusCodeHandlers` as it is initialised within the React portion of our app.
6
- */
7
-
8
- export var statusCodeHandlersProvider = {
9
- handlers: {},
10
- get: function get() {
11
- return statusCodeHandlersProvider.handlers;
12
- },
13
- setHandlers: function setHandlers(handlers) {
14
- statusCodeHandlersProvider.handlers = handlers;
15
- }
16
- };
17
- export function handleResponse(response) {
18
- var status = response.status;
19
- var handler = statusCodeHandlersProvider.get()[status];
20
- if (typeof handler === 'function') {
21
- handler(response);
22
- }
23
- }
@@ -1,4 +0,0 @@
1
- export var ARI_PREFIX = 'ari:cloud:identity::team/';
2
- export var teamIdToAri = function teamIdToAri(teamIdOrTeamAri) {
3
- return teamIdOrTeamAri.startsWith(ARI_PREFIX) ? teamIdOrTeamAri : "".concat(ARI_PREFIX).concat(teamIdOrTeamAri);
4
- };
@@ -1,10 +0,0 @@
1
- import { USER_ARI_PREFIX } from '../types';
2
- export var isUserARI = function isUserARI(ari) {
3
- return ari.startsWith(USER_ARI_PREFIX);
4
- };
5
- export var toUserId = function toUserId(ari) {
6
- if (isUserARI(ari)) {
7
- return ari.replace(USER_ARI_PREFIX, '');
8
- }
9
- throw new Error('Invalid UserARI');
10
- };
@@ -1,74 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react';
3
- import { defineMessages, FormattedMessage } from 'react-intl-next';
4
- import LinkExternalIcon from '@atlaskit/icon/core/link-external';
5
- import { Flex } from '@atlaskit/primitives/compiled';
6
- export var getCreateContainerContactSupportFlag = function getCreateContainerContactSupportFlag() {
7
- return {
8
- id: 'teams-public.team-container.create-container.error.contact-support',
9
- type: 'error',
10
- title: /*#__PURE__*/React.createElement(FormattedMessage, messages.noConnectionTitle),
11
- description: /*#__PURE__*/React.createElement(FormattedMessage, messages.noConnectionDescription),
12
- actions: [{
13
- content: /*#__PURE__*/React.createElement(Flex, {
14
- alignItems: "center",
15
- columnGap: "space.100"
16
- }, /*#__PURE__*/React.createElement(FormattedMessage, messages.noConnectionAction), /*#__PURE__*/React.createElement(LinkExternalIcon, {
17
- label: ""
18
- })),
19
- href: 'https://support.atlassian.com/contact/#/&support_type=customer'
20
- }]
21
- };
22
- };
23
- export var getCreateContainerTryAgainFlag = function getCreateContainerTryAgainFlag(_ref) {
24
- var tryAgainAction = _ref.tryAgainAction,
25
- containerType = _ref.containerType;
26
- return {
27
- id: 'teams-public.team-container.create-container.error.try-again',
28
- type: 'error',
29
- title: /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.timeoutTitle, {
30
- values: {
31
- containerType: containerType
32
- }
33
- })),
34
- description: /*#__PURE__*/React.createElement(FormattedMessage, messages.timeoutDescription),
35
- actions: [{
36
- content: /*#__PURE__*/React.createElement(FormattedMessage, messages.timeoutAction),
37
- onClick: function onClick() {
38
- tryAgainAction === null || tryAgainAction === void 0 || tryAgainAction();
39
- }
40
- }]
41
- };
42
- };
43
- var messages = defineMessages({
44
- timeoutTitle: {
45
- id: 'teams-public.team-containers.timeout-title',
46
- defaultMessage: 'We’re couldn’t connect your {containerType}',
47
- description: 'Title for the timeout flag'
48
- },
49
- timeoutDescription: {
50
- id: 'teams-public.team-containers.timeout-description',
51
- defaultMessage: 'Something went wrong. Verify your connection and retry.',
52
- description: 'Description for the timeout flag'
53
- },
54
- timeoutAction: {
55
- id: 'teams-public.team-containers.timeout-action',
56
- defaultMessage: 'Try again',
57
- description: 'Action text for the timeout flag'
58
- },
59
- noConnectionTitle: {
60
- id: 'teams-public.team-containers.timeout-no-connection-title',
61
- defaultMessage: 'Connection failed',
62
- description: 'Title for the no connection flag'
63
- },
64
- noConnectionDescription: {
65
- id: 'teams-public.team-containers.timeout-no-connection-description',
66
- defaultMessage: 'Try manually creating the space yourself.',
67
- description: 'Description for the no connection flag'
68
- },
69
- noConnectionAction: {
70
- id: 'teams-public.team-containers.timeout-no-connection-action',
71
- defaultMessage: 'Contact support',
72
- description: 'Action text for the no connection flag'
73
- }
74
- });
@@ -1,59 +0,0 @@
1
- export declare enum StatusCode {
2
- UNAUTHORIZED = 401,
3
- FORBIDDEN = 403,
4
- TIMEOUT = 408,
5
- GONE = 410,
6
- PAYLOAD_TOO_LARGE = 413
7
- }
8
- declare class CommonError extends Error {
9
- message: string;
10
- name: string;
11
- stack: string;
12
- constructor(message?: string);
13
- }
14
- export declare class DefaultError extends CommonError {
15
- constructor({ message }: {
16
- message?: string;
17
- });
18
- }
19
- /**
20
- * These errors will not fail UFO experiences
21
- */
22
- export declare class SLOIgnoreError extends CommonError {
23
- constructor({ message }: {
24
- message?: string;
25
- });
26
- }
27
- interface HttpErrorArguments {
28
- message: string;
29
- status: number;
30
- traceId?: string;
31
- path?: string;
32
- }
33
- export declare class HttpError extends CommonError {
34
- status: number;
35
- traceId?: string;
36
- path?: string;
37
- constructor({ message, status, traceId, path }: HttpErrorArguments);
38
- }
39
- interface ResultErrorData {
40
- category: string;
41
- message: string;
42
- fields?: object;
43
- }
44
- interface FieldError {
45
- message: string;
46
- field: string;
47
- }
48
- export interface ErrorData {
49
- category: string;
50
- message: string;
51
- fields?: FieldError[];
52
- }
53
- export declare class GraphQLError extends CommonError {
54
- fields?: any;
55
- category?: string;
56
- constructor({ message, category, fields }: Partial<ResultErrorData>);
57
- static from: (rawErrors: ErrorData[]) => GraphQLError;
58
- }
59
- export {};
@@ -1,31 +0,0 @@
1
- export declare const EXPONENTIAL_BACKOFF_RETRY_POLICY: {
2
- INITIAL_DELAY: number;
3
- MAX_RETRIES: number;
4
- JITTER: boolean;
5
- };
6
- /**
7
- * Checks whether a status code is a 5xx HTTP code.
8
- * @param {number} status HTTP status code
9
- */
10
- export declare function is5xx(status: number): boolean;
11
- export declare function isFetchResponse(data: unknown): data is {
12
- response: Response;
13
- };
14
- type ToTryFunctionArgs = any[];
15
- type ToTryFunction<T> = (...args: ToTryFunctionArgs) => Promise<T>;
16
- type RetryIfCallback<T> = (a: T) => boolean;
17
- interface WithExponentialBackoffOptions<T> {
18
- initial: number;
19
- jitter?: boolean;
20
- max: number;
21
- retryIf?: RetryIfCallback<T>;
22
- }
23
- /**
24
- * Transparently wrap a function so that it is retried until it succeeds or reaches a max retry limit.
25
- * The returned function has the same signature as the wrapped function.
26
- *
27
- * Modified from https://jsfiddle.net/pajtai/pLka0ow9/
28
- */
29
- export declare function withExponentialBackoff<ResponseType>(toTry: ToTryFunction<ResponseType>, hofOptions?: WithExponentialBackoffOptions<ResponseType>): (...args: ToTryFunctionArgs) => Promise<ResponseType>;
30
- export declare const fetchWithExponentialBackoff: (...args: ToTryFunctionArgs) => Promise<Response>;
31
- export {};
@@ -1,17 +0,0 @@
1
- /**
2
- * Our REST clients are initialised when their module loads which makes it tricky for them to consume the `statusCodeHandlers` prop passed to App from the host application.
3
- * This is a temporary measure to enable the clients to consume `statusCodeHandlers`.
4
- * The long term solution is to replace our REST clients with Apollo client custom resolvers
5
- * This will unify all remote data handling under the apollo-client module which is able to easily receive `statusCodeHandlers` as it is initialised within the React portion of our app.
6
- */
7
- type StatusCodeHandler = (response: Response) => void;
8
- export interface StatusCodeHandlerMap {
9
- [statusCode: number]: StatusCodeHandler;
10
- }
11
- export declare const statusCodeHandlersProvider: {
12
- handlers: StatusCodeHandlerMap;
13
- get(): StatusCodeHandlerMap;
14
- setHandlers(handlers: StatusCodeHandlerMap): void;
15
- };
16
- export declare function handleResponse(response: Response): void;
17
- export {};
@@ -1,2 +0,0 @@
1
- export declare const ARI_PREFIX = "ari:cloud:identity::team/";
2
- export declare const teamIdToAri: (teamIdOrTeamAri: string) => string;
@@ -1,3 +0,0 @@
1
- import { type UserARI } from '../types';
2
- export declare const isUserARI: (ari: string) => ari is UserARI;
3
- export declare const toUserId: (ari: UserARI | string) => string;
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import { type FlagType } from './types';
3
- export declare const getCreateContainerContactSupportFlag: () => {
4
- id: string;
5
- type: FlagType;
6
- title: React.JSX.Element;
7
- description: React.JSX.Element;
8
- actions: {
9
- content: React.JSX.Element;
10
- href: string;
11
- }[];
12
- };
13
- export declare const getCreateContainerTryAgainFlag: ({ tryAgainAction, containerType, }: {
14
- tryAgainAction?: () => void;
15
- containerType: string;
16
- }) => {
17
- id: string;
18
- type: FlagType;
19
- title: React.JSX.Element;
20
- description: React.JSX.Element;
21
- actions: {
22
- content: React.JSX.Element;
23
- onClick: () => void;
24
- }[];
25
- };
@@ -1,59 +0,0 @@
1
- export declare enum StatusCode {
2
- UNAUTHORIZED = 401,
3
- FORBIDDEN = 403,
4
- TIMEOUT = 408,
5
- GONE = 410,
6
- PAYLOAD_TOO_LARGE = 413
7
- }
8
- declare class CommonError extends Error {
9
- message: string;
10
- name: string;
11
- stack: string;
12
- constructor(message?: string);
13
- }
14
- export declare class DefaultError extends CommonError {
15
- constructor({ message }: {
16
- message?: string;
17
- });
18
- }
19
- /**
20
- * These errors will not fail UFO experiences
21
- */
22
- export declare class SLOIgnoreError extends CommonError {
23
- constructor({ message }: {
24
- message?: string;
25
- });
26
- }
27
- interface HttpErrorArguments {
28
- message: string;
29
- status: number;
30
- traceId?: string;
31
- path?: string;
32
- }
33
- export declare class HttpError extends CommonError {
34
- status: number;
35
- traceId?: string;
36
- path?: string;
37
- constructor({ message, status, traceId, path }: HttpErrorArguments);
38
- }
39
- interface ResultErrorData {
40
- category: string;
41
- message: string;
42
- fields?: object;
43
- }
44
- interface FieldError {
45
- message: string;
46
- field: string;
47
- }
48
- export interface ErrorData {
49
- category: string;
50
- message: string;
51
- fields?: FieldError[];
52
- }
53
- export declare class GraphQLError extends CommonError {
54
- fields?: any;
55
- category?: string;
56
- constructor({ message, category, fields }: Partial<ResultErrorData>);
57
- static from: (rawErrors: ErrorData[]) => GraphQLError;
58
- }
59
- export {};
@@ -1,31 +0,0 @@
1
- export declare const EXPONENTIAL_BACKOFF_RETRY_POLICY: {
2
- INITIAL_DELAY: number;
3
- MAX_RETRIES: number;
4
- JITTER: boolean;
5
- };
6
- /**
7
- * Checks whether a status code is a 5xx HTTP code.
8
- * @param {number} status HTTP status code
9
- */
10
- export declare function is5xx(status: number): boolean;
11
- export declare function isFetchResponse(data: unknown): data is {
12
- response: Response;
13
- };
14
- type ToTryFunctionArgs = any[];
15
- type ToTryFunction<T> = (...args: ToTryFunctionArgs) => Promise<T>;
16
- type RetryIfCallback<T> = (a: T) => boolean;
17
- interface WithExponentialBackoffOptions<T> {
18
- initial: number;
19
- jitter?: boolean;
20
- max: number;
21
- retryIf?: RetryIfCallback<T>;
22
- }
23
- /**
24
- * Transparently wrap a function so that it is retried until it succeeds or reaches a max retry limit.
25
- * The returned function has the same signature as the wrapped function.
26
- *
27
- * Modified from https://jsfiddle.net/pajtai/pLka0ow9/
28
- */
29
- export declare function withExponentialBackoff<ResponseType>(toTry: ToTryFunction<ResponseType>, hofOptions?: WithExponentialBackoffOptions<ResponseType>): (...args: ToTryFunctionArgs) => Promise<ResponseType>;
30
- export declare const fetchWithExponentialBackoff: (...args: ToTryFunctionArgs) => Promise<Response>;
31
- export {};
@@ -1,17 +0,0 @@
1
- /**
2
- * Our REST clients are initialised when their module loads which makes it tricky for them to consume the `statusCodeHandlers` prop passed to App from the host application.
3
- * This is a temporary measure to enable the clients to consume `statusCodeHandlers`.
4
- * The long term solution is to replace our REST clients with Apollo client custom resolvers
5
- * This will unify all remote data handling under the apollo-client module which is able to easily receive `statusCodeHandlers` as it is initialised within the React portion of our app.
6
- */
7
- type StatusCodeHandler = (response: Response) => void;
8
- export interface StatusCodeHandlerMap {
9
- [statusCode: number]: StatusCodeHandler;
10
- }
11
- export declare const statusCodeHandlersProvider: {
12
- handlers: StatusCodeHandlerMap;
13
- get(): StatusCodeHandlerMap;
14
- setHandlers(handlers: StatusCodeHandlerMap): void;
15
- };
16
- export declare function handleResponse(response: Response): void;
17
- export {};
@@ -1,2 +0,0 @@
1
- export declare const ARI_PREFIX = "ari:cloud:identity::team/";
2
- export declare const teamIdToAri: (teamIdOrTeamAri: string) => string;
@@ -1,3 +0,0 @@
1
- import { type UserARI } from '../types';
2
- export declare const isUserARI: (ari: string) => ari is UserARI;
3
- export declare const toUserId: (ari: UserARI | string) => string;