ag-common 0.0.418 → 0.0.419
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.
- package/dist/api/helpers/api.js +34 -35
- package/dist/api/helpers/aws.js +9 -13
- package/dist/api/helpers/cloudfront.js +7 -24
- package/dist/api/helpers/dynamo.js +85 -134
- package/dist/api/helpers/dynamoInfra.js +14 -19
- package/dist/api/helpers/enforceDynamoProvisionCap.js +14 -18
- package/dist/api/helpers/index.js +14 -30
- package/dist/api/helpers/openApiHelpers.d.ts +2 -3
- package/dist/api/helpers/openApiHelpers.js +34 -37
- package/dist/api/helpers/s3.js +81 -126
- package/dist/api/helpers/ses.js +9 -28
- package/dist/api/helpers/sqs.js +9 -26
- package/dist/api/helpers/ssm.js +8 -14
- package/dist/api/helpers/sts.js +16 -34
- package/dist/api/helpers/validateOpenApi.js +92 -103
- package/dist/api/helpers/validations.js +29 -46
- package/dist/api/index.js +2 -18
- package/dist/api/openapi-prefix.js +25 -38
- package/dist/api/types/aws.js +1 -2
- package/dist/api/types/index.js +1 -17
- package/dist/common/const.js +2 -5
- package/dist/common/helpers/array.js +8 -19
- package/dist/common/helpers/async.js +10 -28
- package/dist/common/helpers/binary.js +5 -10
- package/dist/common/helpers/date.js +14 -25
- package/dist/common/helpers/email.js +5 -11
- package/dist/common/helpers/func.js +3 -7
- package/dist/common/helpers/generator.js +9 -24
- package/dist/common/helpers/groupBy.js +3 -9
- package/dist/common/helpers/hashCode.js +3 -9
- package/dist/common/helpers/i18n.js +9 -17
- package/dist/common/helpers/index.js +18 -34
- package/dist/common/helpers/log.js +16 -28
- package/dist/common/helpers/math.js +9 -21
- package/dist/common/helpers/memo.js +3 -7
- package/dist/common/helpers/object.js +20 -35
- package/dist/common/helpers/random.js +4 -10
- package/dist/common/helpers/secondsInNearest.js +2 -7
- package/dist/common/helpers/sleep.js +1 -5
- package/dist/common/helpers/string/base64.js +2 -7
- package/dist/common/helpers/string/chunk.js +1 -5
- package/dist/common/helpers/string/contains.js +2 -7
- package/dist/common/helpers/string/getExtendedStringSegment.js +5 -9
- package/dist/common/helpers/string/index.js +10 -26
- package/dist/common/helpers/string/json.js +1 -5
- package/dist/common/helpers/string/object.js +1 -5
- package/dist/common/helpers/string/surround.js +1 -5
- package/dist/common/helpers/string/trim.js +2 -7
- package/dist/common/helpers/string/truncate.js +1 -5
- package/dist/common/helpers/string/url.js +4 -9
- package/dist/common/index.js +2 -18
- package/dist/index.js +3 -19
- package/dist/ui/components/BorderGradient/index.js +18 -25
- package/dist/ui/components/Button/index.js +17 -25
- package/dist/ui/components/Chevron/index.js +9 -16
- package/dist/ui/components/Close/index.js +6 -13
- package/dist/ui/components/Confirm/Dialog.js +9 -25
- package/dist/ui/components/Confirm/Modal.js +20 -27
- package/dist/ui/components/Confirm/index.js +3 -19
- package/dist/ui/components/Confirm/types.js +1 -2
- package/dist/ui/components/DropdownList/Base.js +33 -64
- package/dist/ui/components/DropdownList/Dialog.js +8 -24
- package/dist/ui/components/DropdownList/index.js +2 -18
- package/dist/ui/components/DropdownList/types.js +1 -2
- package/dist/ui/components/FlexColumn/index.js +4 -14
- package/dist/ui/components/FlexRow/index.js +4 -14
- package/dist/ui/components/HeadersRaw/index.js +20 -27
- package/dist/ui/components/HorizontalScrollBar/index.js +6 -34
- package/dist/ui/components/Icon/index.js +9 -16
- package/dist/ui/components/Image/index.js +10 -28
- package/dist/ui/components/InfiniteScroll/index.js +18 -50
- package/dist/ui/components/KebabDots/index.js +6 -13
- package/dist/ui/components/Loader/index.js +9 -39
- package/dist/ui/components/Modal/Dialog.js +7 -23
- package/dist/ui/components/Modal/Modal.js +19 -49
- package/dist/ui/components/Modal/index.js +3 -19
- package/dist/ui/components/Modal/types.js +1 -2
- package/dist/ui/components/OpenApiCodeBlock/OpenApiCodeBlock.js +26 -34
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/body.js +12 -19
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/getCurlLines.js +6 -11
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/security.js +8 -15
- package/dist/ui/components/OpenApiCodeBlock/curl/index.js +14 -21
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/call.js +8 -15
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/getFetchLines.js +3 -8
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/req.js +27 -34
- package/dist/ui/components/OpenApiCodeBlock/fetch/index.js +11 -18
- package/dist/ui/components/OpenApiCodeBlock/helpers/common.js +7 -17
- package/dist/ui/components/OpenApiCodeBlock/helpers/joinJsx.js +6 -15
- package/dist/ui/components/OpenApiCodeBlock/index.js +2 -18
- package/dist/ui/components/OpenApiCodeBlock/types.js +1 -2
- package/dist/ui/components/PieChart/index.js +11 -18
- package/dist/ui/components/ProgressBar/index.js +15 -45
- package/dist/ui/components/Prompt/Dialog.js +7 -23
- package/dist/ui/components/Prompt/Modal.js +25 -55
- package/dist/ui/components/Prompt/index.js +2 -18
- package/dist/ui/components/RowOrColumn/index.js +7 -17
- package/dist/ui/components/Search/AutoHideSearchBox.js +24 -56
- package/dist/ui/components/Search/Base.js +21 -52
- package/dist/ui/components/Search/Dialog.js +10 -26
- package/dist/ui/components/Search/Inline.js +3 -10
- package/dist/ui/components/Search/Modal.js +10 -17
- package/dist/ui/components/Search/SearchBox.js +26 -58
- package/dist/ui/components/Search/index.js +7 -23
- package/dist/ui/components/Search/types.js +1 -2
- package/dist/ui/components/Sidebar/index.js +18 -25
- package/dist/ui/components/SparkLine/index.js +17 -27
- package/dist/ui/components/Table/index.js +15 -22
- package/dist/ui/components/TextEdit/CheckboxEdit.js +21 -51
- package/dist/ui/components/TextEdit/ColourEdit.js +17 -44
- package/dist/ui/components/TextEdit/LengthBox.js +5 -12
- package/dist/ui/components/TextEdit/ListboxEdit.js +15 -42
- package/dist/ui/components/TextEdit/RadioGroup.js +13 -43
- package/dist/ui/components/TextEdit/TextEdit.js +48 -78
- package/dist/ui/components/TextEdit/common.js +11 -17
- package/dist/ui/components/TextEdit/index.js +6 -22
- package/dist/ui/components/TextEdit/types.js +1 -2
- package/dist/ui/components/TextWithButton/index.js +10 -40
- package/dist/ui/components/TimelineChart/index.js +14 -24
- package/dist/ui/components/Toast/Cross.js +9 -16
- package/dist/ui/components/Toast/Tick.js +4 -11
- package/dist/ui/components/Toast/Warning.js +8 -15
- package/dist/ui/components/Toast/base.js +33 -65
- package/dist/ui/components/Toast/index.js +2 -18
- package/dist/ui/components/Toast/types.js +1 -2
- package/dist/ui/components/UserImage/index.js +17 -48
- package/dist/ui/components/index.js +30 -46
- package/dist/ui/helpers/axiosHelper.js +25 -39
- package/dist/ui/helpers/browserHelpers.js +7 -22
- package/dist/ui/helpers/callOpenApi/cached.js +18 -37
- package/dist/ui/helpers/callOpenApi/direct.js +46 -59
- package/dist/ui/helpers/callOpenApi/helpers.js +25 -40
- package/dist/ui/helpers/callOpenApi/hook.js +47 -36
- package/dist/ui/helpers/callOpenApi/index.js +5 -21
- package/dist/ui/helpers/callOpenApi/types.js +1 -2
- package/dist/ui/helpers/cognito.js +1 -2
- package/dist/ui/helpers/cookie/const.js +2 -5
- package/dist/ui/helpers/cookie/get.js +13 -14
- package/dist/ui/helpers/cookie/index.js +5 -21
- package/dist/ui/helpers/cookie/raw.js +9 -16
- package/dist/ui/helpers/cookie/set.js +10 -15
- package/dist/ui/helpers/cookie/use.js +23 -16
- package/dist/ui/helpers/date.js +10 -15
- package/dist/ui/helpers/debounce.js +5 -10
- package/dist/ui/helpers/dom.js +6 -13
- package/dist/ui/helpers/extractAttributes.js +2 -7
- package/dist/ui/helpers/index.js +25 -41
- package/dist/ui/helpers/jwt.js +1 -2
- package/dist/ui/helpers/plural.js +1 -5
- package/dist/ui/helpers/routes.js +17 -24
- package/dist/ui/helpers/serviceWorker.js +8 -23
- package/dist/ui/helpers/useContextMenu.js +9 -14
- package/dist/ui/helpers/useElementAttribute.js +3 -7
- package/dist/ui/helpers/useGranularHook.js +5 -10
- package/dist/ui/helpers/useInterval.js +8 -12
- package/dist/ui/helpers/useLocalStorage.js +24 -32
- package/dist/ui/helpers/useLockBodyScroll.js +3 -7
- package/dist/ui/helpers/useOnClickOutside.js +7 -12
- package/dist/ui/helpers/useOnScroll.js +15 -21
- package/dist/ui/helpers/useOverloadPageSearch.js +3 -7
- package/dist/ui/helpers/useQueryString.js +14 -20
- package/dist/ui/helpers/useResize.js +8 -12
- package/dist/ui/helpers/useTimeout.js +5 -9
- package/dist/ui/icons/ChevronRight.js +3 -9
- package/dist/ui/icons/CrossIcon.js +5 -12
- package/dist/ui/icons/Door.js +4 -10
- package/dist/ui/icons/HorizontalDots.js +3 -9
- package/dist/ui/icons/Magnify.js +3 -10
- package/dist/ui/icons/Pencil.js +5 -12
- package/dist/ui/icons/Save.js +4 -11
- package/dist/ui/icons/Undo.js +5 -12
- package/dist/ui/icons/UserOutline.js +3 -9
- package/dist/ui/icons/index.js +9 -25
- package/dist/ui/index.js +4 -20
- package/dist/ui/styles/colours.js +7 -12
- package/dist/ui/styles/common.js +14 -22
- package/dist/ui/styles/index.js +4 -20
- package/dist/ui/styles/media.js +7 -10
- package/dist/ui/styles/standaloneStyles.js +10 -16
- package/package.json +18 -17
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Tick = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
1
|
+
import React from 'react';
|
|
8
2
|
//green tick
|
|
9
|
-
const Tick = () => (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.Tick = Tick;
|
|
3
|
+
export const Tick = () => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 64" },
|
|
4
|
+
React.createElement("circle", { cx: "32", cy: "32", r: "30", fill: "#fff" }),
|
|
5
|
+
React.createElement("path", { fill: "#7cb342", d: "M32 2C15.431 2 2 15.432 2 32c0 16.568 13.432 30 30 30 16.568 0 30-13.432 30-30C62 15.432 48.568 2 32 2zm-6.975 48-.02-.02-.017.02L11 35.6l7.029-7.164 6.977 7.184 21-21.619L53 21.199 25.025 50z" })));
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Warning = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
1
|
+
import React from 'react';
|
|
8
2
|
//yellow warning
|
|
9
|
-
const Warning = () => (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports.Warning = Warning;
|
|
3
|
+
export const Warning = () => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 64" },
|
|
4
|
+
React.createElement("defs", null,
|
|
5
|
+
React.createElement("linearGradient", { id: "a", x2: "0", y1: "45.47", y2: "-.599", gradientTransform: "matrix(1.31117 0 0 1.30239 737.39 159.91)", gradientUnits: "userSpaceOnUse" },
|
|
6
|
+
React.createElement("stop", { stopColor: "#ffc515" }),
|
|
7
|
+
React.createElement("stop", { offset: "1", stopColor: "#ffd55b" }))),
|
|
8
|
+
React.createElement("path", { fill: "url(#a)", d: "m797.94 212.01-25.607-48c-.736-1.333-2.068-2.074-3.551-2.074s-2.822.889-3.569 2.222l-25.417 48c-.598 1.185-.605 2.815.132 4s1.921 1.778 3.404 1.778h51.02c1.483 0 2.821-.741 3.42-1.926.747-1.185.753-2.667.165-4", transform: "translate(-627.02 -130.8) scale(.85714)" }),
|
|
9
|
+
React.createElement("path", { fillOpacity: ".75", stroke: "#40330d", strokeWidth: ".90168", d: "M31.996 24.239a1.93 1.93 0 0 0-1.926 1.92v11.559c0 1.06.855 1.92 1.926 1.92a1.929 1.929 0 0 0 1.925-1.92v-11.56c0-1.06-.853-1.92-1.925-1.92zm0 19.249c-1.064 0-1.926.86-1.926 1.925 0 1.064.86 1.925 1.926 1.925 1.064 0 1.925-.86 1.925-1.925a1.922 1.922 0 0 0-1.925-1.925z" })));
|
|
@@ -1,48 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.ToastProvider = exports.Toast = exports.ToastContext = void 0;
|
|
30
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
31
|
-
const react_1 = __importStar(require("react"));
|
|
32
|
-
const random_1 = require("../../../common/helpers/random");
|
|
33
|
-
const ProgressBar_1 = require("../ProgressBar");
|
|
34
|
-
const Cross_1 = require("./Cross");
|
|
35
|
-
const Tick_1 = require("./Tick");
|
|
36
|
-
const Warning_1 = require("./Warning");
|
|
37
|
-
exports.ToastContext = (0, react_1.createContext)({});
|
|
38
|
-
const ToastContainerStyle = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React, { createContext, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { random } from '../../../common/helpers/random';
|
|
4
|
+
import { ProgressBar } from '../ProgressBar';
|
|
5
|
+
import { Cross } from './Cross';
|
|
6
|
+
import { Tick } from './Tick';
|
|
7
|
+
import { Warning } from './Warning';
|
|
8
|
+
export const ToastContext = createContext({});
|
|
9
|
+
const ToastContainerStyle = styled.div `
|
|
39
10
|
position: fixed;
|
|
40
11
|
bottom: 0;
|
|
41
12
|
right: 0;
|
|
42
13
|
margin: 0.5rem;
|
|
43
14
|
z-index: 10000;
|
|
44
15
|
`;
|
|
45
|
-
const ToastStyle =
|
|
16
|
+
const ToastStyle = styled.div `
|
|
46
17
|
display: flex;
|
|
47
18
|
flex-flow: row wrap;
|
|
48
19
|
align-items: center;
|
|
@@ -62,7 +33,7 @@ const ToastStyle = styled_1.default.div `
|
|
|
62
33
|
color: black;
|
|
63
34
|
}
|
|
64
35
|
`;
|
|
65
|
-
const CloseStyle =
|
|
36
|
+
const CloseStyle = styled.span `
|
|
66
37
|
position: absolute;
|
|
67
38
|
top: 0;
|
|
68
39
|
right: 0;
|
|
@@ -87,39 +58,38 @@ const CloseStyle = styled_1.default.span `
|
|
|
87
58
|
}
|
|
88
59
|
}
|
|
89
60
|
`;
|
|
90
|
-
const Icon =
|
|
61
|
+
const Icon = styled.div `
|
|
91
62
|
width: 1.5rem;
|
|
92
63
|
height: 1.5rem;
|
|
93
64
|
margin-right: 0.5rem;
|
|
94
65
|
`;
|
|
95
|
-
const ProgressBarStyled = (
|
|
66
|
+
const ProgressBarStyled = styled(ProgressBar) `
|
|
96
67
|
height: 0.75rem;
|
|
97
68
|
margin-top: 0.5rem;
|
|
98
69
|
`;
|
|
99
|
-
const Toast = ({ toast, close, providerOptions, }) => {
|
|
100
|
-
|
|
101
|
-
const darkMode = (_a = providerOptions === null || providerOptions === void 0 ? void 0 : providerOptions.darkMode) !== null && _a !== void 0 ? _a : false;
|
|
70
|
+
export const Toast = ({ toast, close, providerOptions, }) => {
|
|
71
|
+
const darkMode = providerOptions?.darkMode ?? false;
|
|
102
72
|
let closeMs;
|
|
103
|
-
if (
|
|
104
|
-
closeMs =
|
|
73
|
+
if (toast.options?.autoClose) {
|
|
74
|
+
closeMs = toast.options?.autoClose;
|
|
105
75
|
}
|
|
106
|
-
else if (
|
|
76
|
+
else if (toast.options?.autoClose === undefined) {
|
|
107
77
|
closeMs = 5000;
|
|
108
78
|
}
|
|
109
|
-
let icon =
|
|
110
|
-
switch (
|
|
79
|
+
let icon = React.createElement(Tick, null);
|
|
80
|
+
switch (toast?.options?.appearance) {
|
|
111
81
|
case 'error': {
|
|
112
82
|
closeMs = undefined;
|
|
113
|
-
icon =
|
|
83
|
+
icon = React.createElement(Cross, null);
|
|
114
84
|
break;
|
|
115
85
|
}
|
|
116
86
|
case 'warning': {
|
|
117
87
|
closeMs = undefined;
|
|
118
|
-
icon =
|
|
88
|
+
icon = React.createElement(Warning, null);
|
|
119
89
|
break;
|
|
120
90
|
}
|
|
121
91
|
}
|
|
122
|
-
|
|
92
|
+
useEffect(() => {
|
|
123
93
|
if (!closeMs) {
|
|
124
94
|
return;
|
|
125
95
|
}
|
|
@@ -127,23 +97,21 @@ const Toast = ({ toast, close, providerOptions, }) => {
|
|
|
127
97
|
return () => clearTimeout(timeout);
|
|
128
98
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
129
99
|
}, []);
|
|
130
|
-
return (
|
|
131
|
-
|
|
132
|
-
|
|
100
|
+
return (React.createElement(ToastStyle, { "data-dark": darkMode },
|
|
101
|
+
React.createElement(CloseStyle, { "data-dark": darkMode, onClick: () => close(toast.id) }, "\u00D7"),
|
|
102
|
+
React.createElement(Icon, null, icon),
|
|
133
103
|
toast.message,
|
|
134
|
-
closeMs !== undefined && (
|
|
104
|
+
closeMs !== undefined && (React.createElement(ProgressBarStyled, { max: 100, min: 0, dotPercentages: null, transitionToMs: closeMs }))));
|
|
135
105
|
};
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
const [toasts, setToasts] = (0, react_1.useState)([]);
|
|
106
|
+
export const ToastProvider = ({ children, providerOptions, }) => {
|
|
107
|
+
const [toasts, setToasts] = useState([]);
|
|
139
108
|
const addToast = (message, options) => setToasts((currentToasts) => [
|
|
140
109
|
...currentToasts,
|
|
141
|
-
{ id:
|
|
110
|
+
{ id: random(10000).toString(), message, options },
|
|
142
111
|
]);
|
|
143
112
|
const close = (id) => setToasts((currentToasts) => currentToasts.filter((toast) => toast.id !== id));
|
|
144
|
-
const contextValue =
|
|
145
|
-
return (
|
|
113
|
+
const contextValue = useMemo(() => ({ addToast }), []);
|
|
114
|
+
return (React.createElement(ToastContext.Provider, { value: contextValue },
|
|
146
115
|
children,
|
|
147
|
-
|
|
116
|
+
React.createElement(ToastContainerStyle, null, toasts.map((toast) => (React.createElement(Toast, { key: toast.id, toast: toast, close: close, providerOptions: providerOptions || {} }))))));
|
|
148
117
|
};
|
|
149
|
-
exports.ToastProvider = ToastProvider;
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./base"), exports);
|
|
18
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
export * from './base';
|
|
2
|
+
export * from './types';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,38 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.UserProfileImage = exports.UserImage = void 0;
|
|
30
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
31
|
-
const react_1 = __importStar(require("react"));
|
|
32
|
-
const array_1 = require("../../../common/helpers/array");
|
|
33
|
-
const log_1 = require("../../../common/helpers/log");
|
|
34
|
-
const UserOutline_1 = require("../../icons/UserOutline");
|
|
35
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { notEmpty } from '../../../common/helpers/array';
|
|
4
|
+
import { warn } from '../../../common/helpers/log';
|
|
5
|
+
import { UserOutline } from '../../icons/UserOutline';
|
|
6
|
+
const Base = styled.div `
|
|
36
7
|
width: 2.5rem;
|
|
37
8
|
height: 2.5rem;
|
|
38
9
|
border-radius: 50%;
|
|
@@ -40,29 +11,27 @@ const Base = styled_1.default.div `
|
|
|
40
11
|
overflow: hidden;
|
|
41
12
|
position: relative;
|
|
42
13
|
`;
|
|
43
|
-
const Img =
|
|
14
|
+
const Img = styled.img `
|
|
44
15
|
width: 2.5rem;
|
|
45
16
|
height: 2.5rem;
|
|
46
17
|
`;
|
|
47
18
|
const images = {
|
|
48
19
|
domains: ['platform-lookaside.fbsbx.com', 'lh3.googleusercontent.com'],
|
|
49
20
|
};
|
|
50
|
-
const UserImage = ({ image, className, title = 'user image', }) => {
|
|
51
|
-
const [fallback, setFallback] =
|
|
52
|
-
return (
|
|
53
|
-
image && !fallback && (
|
|
54
|
-
(!image || fallback) &&
|
|
21
|
+
export const UserImage = ({ image, className, title = 'user image', }) => {
|
|
22
|
+
const [fallback, setFallback] = useState(false);
|
|
23
|
+
return (React.createElement(Base, { className: className, title: title },
|
|
24
|
+
image && !fallback && (React.createElement(Img, { alt: "user", src: image, onError: () => setFallback(true) })),
|
|
25
|
+
(!image || fallback) && UserOutline));
|
|
55
26
|
};
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
const image = user === null || user === void 0 ? void 0 : user.picture;
|
|
27
|
+
export const UserProfileImage = ({ className, user }) => {
|
|
28
|
+
const image = user?.picture;
|
|
59
29
|
if (image) {
|
|
60
30
|
if (!images.domains.find((i) => image.includes(i))) {
|
|
61
|
-
|
|
31
|
+
warn(`bad domain:${image}`);
|
|
62
32
|
}
|
|
63
33
|
}
|
|
64
|
-
const titleA = [user
|
|
34
|
+
const titleA = [user?.fullname, user?.userId].filter(notEmpty);
|
|
65
35
|
const title = titleA.length === 0 ? '' : titleA.join(' - ');
|
|
66
|
-
return
|
|
36
|
+
return React.createElement(UserImage, { image: image, title: title, className: className });
|
|
67
37
|
};
|
|
68
|
-
exports.UserProfileImage = UserProfileImage;
|
|
@@ -1,46 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
__exportStar(require("./Loader"), exports);
|
|
32
|
-
__exportStar(require("./Modal"), exports);
|
|
33
|
-
__exportStar(require("./OpenApiCodeBlock"), exports);
|
|
34
|
-
__exportStar(require("./PieChart"), exports);
|
|
35
|
-
__exportStar(require("./ProgressBar"), exports);
|
|
36
|
-
__exportStar(require("./Prompt"), exports);
|
|
37
|
-
__exportStar(require("./RowOrColumn"), exports);
|
|
38
|
-
__exportStar(require("./Search"), exports);
|
|
39
|
-
__exportStar(require("./Sidebar"), exports);
|
|
40
|
-
__exportStar(require("./SparkLine"), exports);
|
|
41
|
-
__exportStar(require("./Table"), exports);
|
|
42
|
-
__exportStar(require("./TextEdit"), exports);
|
|
43
|
-
__exportStar(require("./TextWithButton"), exports);
|
|
44
|
-
__exportStar(require("./TimelineChart"), exports);
|
|
45
|
-
__exportStar(require("./Toast"), exports);
|
|
46
|
-
__exportStar(require("./UserImage"), exports);
|
|
1
|
+
export * from './BorderGradient';
|
|
2
|
+
export * from './Button';
|
|
3
|
+
export * from './Chevron';
|
|
4
|
+
export * from './Close';
|
|
5
|
+
export * from './Confirm';
|
|
6
|
+
export * from './DropdownList';
|
|
7
|
+
export * from './FlexColumn';
|
|
8
|
+
export * from './FlexRow';
|
|
9
|
+
export * from './HeadersRaw';
|
|
10
|
+
export * from './HorizontalScrollBar';
|
|
11
|
+
export * from './Icon';
|
|
12
|
+
export * from './Image';
|
|
13
|
+
export * from './InfiniteScroll';
|
|
14
|
+
export * from './KebabDots';
|
|
15
|
+
export * from './Loader';
|
|
16
|
+
export * from './Modal';
|
|
17
|
+
export * from './OpenApiCodeBlock';
|
|
18
|
+
export * from './PieChart';
|
|
19
|
+
export * from './ProgressBar';
|
|
20
|
+
export * from './Prompt';
|
|
21
|
+
export * from './RowOrColumn';
|
|
22
|
+
export * from './Search';
|
|
23
|
+
export * from './Sidebar';
|
|
24
|
+
export * from './SparkLine';
|
|
25
|
+
export * from './Table';
|
|
26
|
+
export * from './TextEdit';
|
|
27
|
+
export * from './TextWithButton';
|
|
28
|
+
export * from './TimelineChart';
|
|
29
|
+
export * from './Toast';
|
|
30
|
+
export * from './UserImage';
|
|
@@ -1,37 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.axiosHelper = void 0;
|
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
|
17
|
-
const const_1 = require("../../common/const");
|
|
18
|
-
const log_1 = require("../../common/helpers/log");
|
|
19
|
-
const object_1 = require("../../common/helpers/object");
|
|
20
|
-
const sleep_1 = require("../../common/helpers/sleep");
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { retryHttpCodes, retryHttpMs } from '../../common/const';
|
|
3
|
+
import { debug } from '../../common/helpers/log';
|
|
4
|
+
import { isJson } from '../../common/helpers/object';
|
|
5
|
+
import { sleep } from '../../common/helpers/sleep';
|
|
21
6
|
/**
|
|
22
7
|
*
|
|
23
8
|
* @param body accepts object or json, and passes as-is
|
|
24
9
|
* @returns
|
|
25
10
|
*/
|
|
26
|
-
const axiosHelper = ({ verb, url, body, headers, timeout = 30000, retryMax = 0, onStaleAuth, }) =>
|
|
27
|
-
var _a;
|
|
11
|
+
export const axiosHelper = async ({ verb, url, body, headers, timeout = 30000, retryMax = 0, onStaleAuth, }) => {
|
|
28
12
|
let retry = 0;
|
|
29
13
|
let ret;
|
|
30
14
|
do {
|
|
31
15
|
try {
|
|
32
|
-
const setHeaders =
|
|
16
|
+
const setHeaders = {
|
|
17
|
+
Accept: 'application/json',
|
|
18
|
+
...headers,
|
|
19
|
+
};
|
|
33
20
|
if (verb === 'get') {
|
|
34
|
-
ret =
|
|
21
|
+
ret = await axios.get(url, {
|
|
35
22
|
headers: setHeaders,
|
|
36
23
|
timeout,
|
|
37
24
|
timeoutErrorMessage: `${url} timeout`,
|
|
@@ -40,54 +27,53 @@ const axiosHelper = ({ verb, url, body, headers, timeout = 30000, retryMax = 0,
|
|
|
40
27
|
}
|
|
41
28
|
let noBody = false;
|
|
42
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
-
let axiosV =
|
|
30
|
+
let axiosV = axios.post;
|
|
44
31
|
if (verb === 'put') {
|
|
45
|
-
axiosV =
|
|
32
|
+
axiosV = axios.put;
|
|
46
33
|
}
|
|
47
34
|
else if (verb === 'post') {
|
|
48
|
-
axiosV =
|
|
35
|
+
axiosV = axios.post;
|
|
49
36
|
}
|
|
50
37
|
else if (verb === 'patch') {
|
|
51
|
-
axiosV =
|
|
38
|
+
axiosV = axios.patch;
|
|
52
39
|
}
|
|
53
40
|
else if (verb === 'delete') {
|
|
54
41
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
|
-
axiosV =
|
|
42
|
+
axiosV = axios.delete;
|
|
56
43
|
noBody = true;
|
|
57
44
|
}
|
|
58
45
|
if (noBody) {
|
|
59
|
-
ret =
|
|
46
|
+
ret = await axiosV(url, {
|
|
60
47
|
headers: setHeaders,
|
|
61
48
|
timeout,
|
|
62
49
|
timeoutErrorMessage: `${url} timeout`,
|
|
63
50
|
});
|
|
64
51
|
}
|
|
65
52
|
else {
|
|
66
|
-
if (body &&
|
|
53
|
+
if (body && isJson(body)) {
|
|
67
54
|
setHeaders['Content-Type'] =
|
|
68
55
|
setHeaders['Content-Type'] || 'application/json';
|
|
69
56
|
}
|
|
70
|
-
ret =
|
|
57
|
+
ret = await axiosV(url, body, { headers: setHeaders });
|
|
71
58
|
}
|
|
72
59
|
return ret;
|
|
73
60
|
}
|
|
74
61
|
catch (e) {
|
|
75
62
|
const em = e;
|
|
76
|
-
const c = Number(
|
|
63
|
+
const c = Number(em.code ?? '500');
|
|
77
64
|
// jwt expired or bad response
|
|
78
65
|
// 403 returned for old token - will be refreshed
|
|
79
66
|
if (c === 401 || c === 403) {
|
|
80
|
-
|
|
81
|
-
onStaleAuth
|
|
67
|
+
debug('auth expired');
|
|
68
|
+
onStaleAuth?.();
|
|
82
69
|
retry = retryMax;
|
|
83
70
|
}
|
|
84
|
-
if (!
|
|
71
|
+
if (!retryHttpCodes.includes(c) || retry >= retryMax) {
|
|
85
72
|
throw em;
|
|
86
73
|
}
|
|
87
74
|
}
|
|
88
75
|
retry += 1;
|
|
89
|
-
|
|
76
|
+
await sleep(retryHttpMs);
|
|
90
77
|
} while (retry <= retryMax);
|
|
91
78
|
throw new Error('unexpected');
|
|
92
|
-
}
|
|
93
|
-
exports.axiosHelper = axiosHelper;
|
|
79
|
+
};
|
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.supportsWebp = void 0;
|
|
13
|
-
function supportsWebp() {
|
|
14
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
if (!window.createImageBitmap) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
const webpData = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=';
|
|
19
|
-
const blob = yield fetch(webpData).then((r) => r.blob());
|
|
20
|
-
return createImageBitmap(blob).then(() => true, () => false);
|
|
21
|
-
});
|
|
1
|
+
export async function supportsWebp() {
|
|
2
|
+
if (!window.createImageBitmap) {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
const webpData = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=';
|
|
6
|
+
const blob = await fetch(webpData).then((r) => r.blob());
|
|
7
|
+
return createImageBitmap(blob).then(() => true, () => false);
|
|
22
8
|
}
|
|
23
|
-
exports.supportsWebp = supportsWebp;
|