@ebubekirylmaz/link-test 1.2.44 → 1.2.45

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 (73) hide show
  1. package/package.json +9 -6
  2. package/src/Platform.jsx +14 -15
  3. package/src/config/schemas.js +1 -0
  4. package/src/context/Context.js +98 -0
  5. package/src/context/reducer.js +590 -10
  6. package/src/hooks/index.js +2 -1
  7. package/src/hooks/use-beta.js +8 -0
  8. package/src/layouts/auth/modern.jsx +4 -2
  9. package/src/layouts/common/account-popover.jsx +1 -2
  10. package/src/lib/APIDialogAction/APIDialogAction.jsx +109 -0
  11. package/src/lib/APIDialogAction/index.js +1 -0
  12. package/src/lib/APIDialogAction/styles.js +6 -0
  13. package/src/lib/APIParams/APIParams.jsx +57 -0
  14. package/src/lib/APIParams/index.js +1 -0
  15. package/src/lib/APIPath/APIPath.jsx +82 -0
  16. package/src/lib/APIPath/index.js +1 -0
  17. package/src/lib/APIPath/styles.js +19 -0
  18. package/src/lib/APITree/APITree.jsx +409 -0
  19. package/src/lib/APITree/Arrow.jsx +21 -0
  20. package/src/lib/APITree/DeleteMethodDialog.jsx +41 -0
  21. package/src/lib/APITree/index.js +1 -0
  22. package/src/lib/APITree/styles.js +19 -0
  23. package/src/lib/APITypes/APITypes.jsx +141 -0
  24. package/src/lib/APITypes/TypeEditor.jsx +46 -0
  25. package/src/lib/APITypes/TypeList.jsx +180 -0
  26. package/src/lib/APITypes/index.js +1 -0
  27. package/src/lib/BlankTreeMessage/BlankTreeMessage.jsx +39 -0
  28. package/src/lib/BlankTreeMessage/index.js +1 -0
  29. package/src/lib/DialogTootip/DialogTooltip.jsx +67 -0
  30. package/src/lib/DialogTootip/index.js +1 -0
  31. package/src/lib/DialogTootip/styles.js +9 -0
  32. package/src/lib/Flow/connectors/DynamicConnector.jsx +179 -107
  33. package/src/lib/Flow/core/Flow.jsx +2 -0
  34. package/src/lib/Flow/core/FlowNode.jsx +2 -0
  35. package/src/lib/Flow/core/FlowViewport.jsx +41 -9
  36. package/src/lib/Flow/hooks/useNodeStyle.js +14 -0
  37. package/src/lib/Flow/nodes/FlowNodeView.jsx +105 -21
  38. package/src/lib/Flow/styles.js +4 -0
  39. package/src/lib/NewApiBody/NewAPIBody.jsx +97 -0
  40. package/src/lib/NewApiBody/ParamView.jsx +38 -0
  41. package/src/lib/NucDialog/NucDialog.jsx +108 -0
  42. package/src/lib/NucDialog/index.js +1 -0
  43. package/src/lib/ParamTable/ParamTable.jsx +133 -0
  44. package/src/lib/ParamTable/TypeMenu.jsx +102 -0
  45. package/src/lib/ParamTable/defaults.js +47 -0
  46. package/src/lib/ParamTable/index.js +1 -0
  47. package/src/lib/ParamTable/styles.js +12 -0
  48. package/src/lib/ResourceMenu/AlertMassage.jsx +28 -0
  49. package/src/lib/ResourceMenu/DeleteResourceDialog.jsx +60 -0
  50. package/src/lib/ResourceMenu/ResourceMenu.jsx +156 -0
  51. package/src/lib/ResourceMenu/index.js +1 -0
  52. package/src/lib/ResourceMenu/styles.js +5 -0
  53. package/src/lib/Schema/Schema.jsx +204 -0
  54. package/src/lib/Schema/index.js +1 -0
  55. package/src/lib/SchemaEditor/SchemaEditor.jsx +258 -0
  56. package/src/lib/SchemaEditor/SchemaEditor.test.js +193 -0
  57. package/src/lib/SchemaEditor/SchemaPropertyEditor.jsx +135 -0
  58. package/src/lib/SchemaEditor/SchemaUtils.js +152 -0
  59. package/src/lib/SchemaEditor/index.js +1 -0
  60. package/src/lib/ToggleableMenu/ToggleableMenu.jsx +35 -0
  61. package/src/lib/ToggleableMenu/index.js +1 -0
  62. package/src/lib/index.js +14 -0
  63. package/src/pages/Callback.jsx +6 -8
  64. package/src/pages/LoginPage.jsx +3 -12
  65. package/src/stories/APITree.stories.jsx +429 -0
  66. package/src/stories/FlowChart.stories.jsx +1 -1
  67. package/src/templates/ActionTemplate.js +24 -0
  68. package/src/widgets/Login/CognitoLogin.jsx +163 -179
  69. package/src/widgets/Login/DemoLogin.jsx +9 -7
  70. package/src/widgets/Login/amplifyAuth.js +6 -6
  71. package/src/widgets/Login/amplifyConfig.js +3 -0
  72. package/src/widgets/LoginForm/LoginForm.jsx +8 -3
  73. package/src/widgets/SettingsDialog.jsx +171 -7
@@ -1,7 +1,12 @@
1
+ import config from "../../config/config";
2
+ import { publish } from "@nucleoidai/react-event";
3
+ import { storage } from "@nucleoidjs/webstorage";
4
+ import { useNavigate } from "react-router-dom";
5
+ import { useState } from "react";
6
+
1
7
  import {
2
8
  Box,
3
9
  Button,
4
- Card,
5
10
  IconButton,
6
11
  InputAdornment,
7
12
  Stack,
@@ -10,6 +15,7 @@ import {
10
15
  alpha,
11
16
  } from "@mui/material";
12
17
  import {
18
+ CheckOutlined,
13
19
  EmailOutlined,
14
20
  LockOutlined,
15
21
  MarkEmailReadOutlined,
@@ -18,12 +24,6 @@ import {
18
24
  } from "@mui/icons-material";
19
25
  import { confirmSignup, getTokens, login, signup } from "./amplifyAuth";
20
26
 
21
- import config from "../../config/config";
22
- import { publish } from "@nucleoidai/react-event";
23
- import { storage } from "@nucleoidjs/webstorage";
24
- import { useNavigate } from "react-router-dom";
25
- import { useState } from "react";
26
-
27
27
  const inputSx = {
28
28
  "& .MuiOutlinedInput-root": {
29
29
  fontSize: "1rem",
@@ -38,14 +38,6 @@ const primaryButtonSx = {
38
38
  fontWeight: 600,
39
39
  textTransform: "none",
40
40
  borderRadius: 1.5,
41
- boxShadow: (theme) =>
42
- `0 8px 16px ${alpha(theme.palette.primary.main, 0.24)}`,
43
- transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
44
- "&:hover": {
45
- transform: "translateY(-2px)",
46
- boxShadow: (theme) =>
47
- `0 12px 24px ${alpha(theme.palette.primary.main, 0.32)}`,
48
- },
49
41
  "&:active": { transform: "translateY(0px)" },
50
42
  };
51
43
 
@@ -54,12 +46,14 @@ export default function CognitoLogin() {
54
46
 
55
47
  const [email, setEmail] = useState("");
56
48
  const [password, setPassword] = useState("");
49
+ const [confirmPassword, setConfirmPassword] = useState("");
57
50
  const [code, setCode] = useState("");
58
51
  const [showPassword, setShowPassword] = useState(false);
52
+ const [showConfirmPassword, setShowConfirmPassword] = useState(false);
59
53
 
60
54
  const navigate = useNavigate();
61
55
 
62
- const { appId } = config();
56
+ const { appId, credentials } = config();
63
57
 
64
58
  const handleLogin = async () => {
65
59
  try {
@@ -69,7 +63,9 @@ export default function CognitoLogin() {
69
63
  if (!tokens?.accessToken)
70
64
  throw new Error("No Cognito access token received");
71
65
 
72
- const res = await fetch("/api/oauth", {
66
+ const requestUrl = credentials.requestUrl || "/api/oauth";
67
+
68
+ const res = await fetch(requestUrl, {
73
69
  method: "POST",
74
70
  headers: { "Content-Type": "application/json" },
75
71
  body: JSON.stringify({
@@ -101,7 +97,7 @@ export default function CognitoLogin() {
101
97
 
102
98
  const handleSignup = async () => {
103
99
  try {
104
- await signup(email, password, password);
100
+ await signup(email, password);
105
101
  publish("GLOBAL_MESSAGE_POSTED", {
106
102
  status: true,
107
103
  message:
@@ -162,190 +158,178 @@ export default function CognitoLogin() {
162
158
  );
163
159
 
164
160
  return (
165
- <Box
166
- sx={{
167
- minHeight: "100vh",
168
- display: "flex",
169
- alignItems: "center",
170
- justifyContent: "center",
171
- px: 2,
172
- background: (theme) =>
173
- `linear-gradient(135deg, ${alpha(theme.palette.primary.lighter, 0.4)} 0%, ${alpha(theme.palette.background.default, 1)} 60%)`,
174
- }}
175
- >
176
- <Card
177
- sx={{
178
- width: "100%",
179
- maxWidth: 440,
180
- py: { xs: 5, md: 7 },
181
- px: { xs: 3, md: 5 },
182
- borderRadius: 3,
183
- boxShadow: (theme) =>
184
- `0 0 2px ${alpha(theme.palette.grey[500], 0.16)}, 0 24px 48px -4px ${alpha(theme.palette.grey[500], 0.16)}`,
185
- }}
186
- >
161
+ <Stack spacing={3} sx={{ mb: 2 }}>
162
+ <Box sx={{ textAlign: "center" }}>
187
163
  <Box
188
164
  sx={{
189
- mb: 4,
190
- display: "flex",
191
- flexDirection: "column",
165
+ width: 52,
166
+ height: 52,
167
+ borderRadius: 2,
168
+ display: "inline-flex",
192
169
  alignItems: "center",
193
- textAlign: "center",
170
+ justifyContent: "center",
171
+ mb: 2,
172
+ bgcolor: (theme) => alpha(theme.palette.primary.main, 0.1),
173
+ color: "primary.main",
194
174
  }}
195
175
  >
196
- <Box
197
- sx={{
198
- width: 56,
199
- height: 56,
200
- borderRadius: 2,
201
- display: "flex",
202
- alignItems: "center",
203
- justifyContent: "center",
204
- mb: 2.5,
205
- bgcolor: (theme) => alpha(theme.palette.primary.main, 0.1),
206
- color: "primary.main",
207
- }}
208
- >
209
- {mode === "confirm" ? (
210
- <MarkEmailReadOutlined sx={{ fontSize: 28 }} />
211
- ) : (
212
- <LockOutlined sx={{ fontSize: 28 }} />
213
- )}
214
- </Box>
215
-
216
- <Typography variant="h4" fontWeight={700} gutterBottom>
217
- {titles[mode].heading}
218
- </Typography>
219
- <Typography variant="body2" color="text.secondary">
220
- {titles[mode].sub}
221
- </Typography>
176
+ {mode === "confirm" ? (
177
+ <MarkEmailReadOutlined sx={{ fontSize: 26 }} />
178
+ ) : (
179
+ <LockOutlined sx={{ fontSize: 26 }} />
180
+ )}
222
181
  </Box>
223
182
 
224
- <Stack spacing={2.5}>
183
+ <Typography variant="h4" fontWeight={700} gutterBottom>
184
+ {titles[mode].heading}
185
+ </Typography>
186
+ <Typography variant="body2" color="text.secondary">
187
+ {titles[mode].sub}
188
+ </Typography>
189
+ </Box>
190
+
191
+ <Stack spacing={2}>
192
+ <TextField
193
+ label="Email"
194
+ value={email}
195
+ onChange={(e) => setEmail(e.target.value)}
196
+ fullWidth
197
+ InputProps={{
198
+ startAdornment: (
199
+ <InputAdornment position="start">
200
+ <EmailOutlined sx={{ color: "text.secondary", fontSize: 22 }} />
201
+ </InputAdornment>
202
+ ),
203
+ }}
204
+ sx={inputSx}
205
+ />
206
+
207
+ {mode !== "confirm" && (
225
208
  <TextField
226
- label="Email"
227
- value={email}
228
- onChange={(e) => setEmail(e.target.value)}
209
+ type={showPassword ? "text" : "password"}
210
+ label="Password"
211
+ value={password}
212
+ onChange={(e) => setPassword(e.target.value)}
229
213
  fullWidth
230
214
  InputProps={{
231
215
  startAdornment: (
232
216
  <InputAdornment position="start">
233
- <EmailOutlined
217
+ <LockOutlined
234
218
  sx={{ color: "text.secondary", fontSize: 22 }}
235
219
  />
236
220
  </InputAdornment>
237
221
  ),
222
+ endAdornment: passwordAdornment,
238
223
  }}
239
224
  sx={inputSx}
240
225
  />
226
+ )}
241
227
 
242
- {mode === "signup" && (
243
- <TextField
244
- type={showPassword ? "text" : "password"}
245
- label="Password"
246
- value={password}
247
- onChange={(e) => setPassword(e.target.value)}
248
- fullWidth
249
- InputProps={{
250
- startAdornment: (
251
- <InputAdornment position="start">
252
- <LockOutlined
253
- sx={{ color: "text.secondary", fontSize: 22 }}
254
- />
255
- </InputAdornment>
256
- ),
257
- endAdornment: passwordAdornment,
258
- }}
259
- sx={inputSx}
260
- />
261
- )}
262
-
263
- {mode !== "confirm" && (
264
- <TextField
265
- type={showPassword ? "text" : "password"}
266
- label="Password"
267
- value={password}
268
- onChange={(e) => setPassword(e.target.value)}
269
- fullWidth
270
- InputProps={{
271
- startAdornment: (
272
- <InputAdornment position="start">
273
- <LockOutlined
274
- sx={{ color: "text.secondary", fontSize: 22 }}
275
- />
276
- </InputAdornment>
277
- ),
278
- endAdornment: passwordAdornment,
279
- }}
280
- sx={inputSx}
281
- />
282
- )}
283
-
284
- {mode === "confirm" && (
285
- <TextField
286
- label="Confirmation Code"
287
- value={code}
288
- onChange={(e) => setCode(e.target.value)}
289
- fullWidth
290
- sx={inputSx}
291
- />
292
- )}
228
+ {mode === "signup" && (
229
+ <TextField
230
+ type={showConfirmPassword ? "text" : "password"}
231
+ label="Confirm Password"
232
+ value={confirmPassword}
233
+ onChange={(e) => setConfirmPassword(e.target.value)}
234
+ fullWidth
235
+ InputProps={{
236
+ startAdornment: (
237
+ <InputAdornment position="start">
238
+ <LockOutlined
239
+ sx={{ color: "text.secondary", fontSize: 22 }}
240
+ />
241
+ </InputAdornment>
242
+ ),
243
+ endAdornment: (
244
+ <InputAdornment position="end">
245
+ <IconButton
246
+ onClick={() => setShowConfirmPassword(!showConfirmPassword)}
247
+ edge="end"
248
+ size="small"
249
+ tabIndex={-1}
250
+ >
251
+ {showConfirmPassword ? <VisibilityOff /> : <Visibility />}
252
+ </IconButton>
253
+ </InputAdornment>
254
+ ),
255
+ }}
256
+ sx={inputSx}
257
+ />
258
+ )}
293
259
 
294
- {mode === "login" && (
295
- <Stack spacing={1.5} pt={0.5}>
296
- <Button
297
- variant="contained"
298
- onClick={handleLogin}
299
- size="large"
300
- fullWidth
301
- sx={primaryButtonSx}
302
- >
303
- Sign in
304
- </Button>
305
- <Button
306
- onClick={() => setMode("signup")}
307
- fullWidth
308
- sx={{ textTransform: "none", fontWeight: 500 }}
309
- >
310
- Create an account
311
- </Button>
312
- </Stack>
313
- )}
260
+ {mode === "confirm" && (
261
+ <TextField
262
+ label="Confirmation Code"
263
+ value={code}
264
+ onChange={(e) => setCode(e.target.value)}
265
+ fullWidth
266
+ InputProps={{
267
+ startAdornment: (
268
+ <InputAdornment position="start">
269
+ <CheckOutlined
270
+ sx={{ color: "text.secondary", fontSize: 22 }}
271
+ />
272
+ </InputAdornment>
273
+ ),
274
+ }}
275
+ sx={inputSx}
276
+ />
277
+ )}
278
+ </Stack>
314
279
 
315
- {mode === "signup" && (
316
- <Stack spacing={1.5} pt={0.5}>
317
- <Button
318
- variant="contained"
319
- onClick={handleSignup}
320
- size="large"
321
- fullWidth
322
- sx={primaryButtonSx}
323
- >
324
- Sign Up
325
- </Button>
326
- <Button
327
- onClick={() => setMode("login")}
328
- fullWidth
329
- sx={{ textTransform: "none", fontWeight: 500 }}
330
- >
331
- Back to login
332
- </Button>
333
- </Stack>
334
- )}
280
+ {mode === "login" && (
281
+ <Stack spacing={1.5}>
282
+ <Button
283
+ variant="contained"
284
+ onClick={handleLogin}
285
+ size="large"
286
+ fullWidth
287
+ sx={primaryButtonSx}
288
+ >
289
+ Sign in
290
+ </Button>
291
+ <Button
292
+ onClick={() => setMode("signup")}
293
+ fullWidth
294
+ sx={{ textTransform: "none", fontWeight: 500 }}
295
+ >
296
+ Create an account
297
+ </Button>
298
+ </Stack>
299
+ )}
335
300
 
336
- {mode === "confirm" && (
337
- <Button
338
- variant="contained"
339
- onClick={handleConfirm}
340
- size="large"
341
- fullWidth
342
- sx={{ ...primaryButtonSx, mt: 0.5 }}
343
- >
344
- Confirm
345
- </Button>
346
- )}
301
+ {mode === "signup" && (
302
+ <Stack spacing={1.5}>
303
+ <Button
304
+ variant="contained"
305
+ onClick={handleSignup}
306
+ size="large"
307
+ fullWidth
308
+ sx={primaryButtonSx}
309
+ >
310
+ Sign Up
311
+ </Button>
312
+ <Button
313
+ onClick={() => setMode("login")}
314
+ fullWidth
315
+ sx={{ textTransform: "none", fontWeight: 500 }}
316
+ >
317
+ Back to login
318
+ </Button>
347
319
  </Stack>
348
- </Card>
349
- </Box>
320
+ )}
321
+
322
+ {mode === "confirm" && (
323
+ <Button
324
+ variant="contained"
325
+ onClick={handleConfirm}
326
+ size="large"
327
+ fullWidth
328
+ sx={primaryButtonSx}
329
+ >
330
+ Confirm
331
+ </Button>
332
+ )}
333
+ </Stack>
350
334
  );
351
335
  }
@@ -1,3 +1,7 @@
1
+ import config from "../../config/config";
2
+ import { storage } from "@nucleoidjs/webstorage";
3
+ import { useNavigate } from "react-router-dom";
4
+
1
5
  import {
2
6
  Box,
3
7
  Button,
@@ -16,20 +20,18 @@ import {
16
20
  } from "@mui/icons-material";
17
21
  import React, { useState } from "react";
18
22
 
19
- import config from "../../config/config";
20
- import { storage } from "@nucleoidjs/webstorage";
21
- import { useNavigate } from "react-router-dom";
22
-
23
23
  export default function DemoLogin() {
24
24
  const [username, setUsername] = useState("");
25
25
  const [password, setPassword] = useState("");
26
26
  const [showPassword, setShowPassword] = useState(false);
27
27
  const navigate = useNavigate();
28
28
 
29
- const { appId } = config();
29
+ const { appId, credentials } = config();
30
30
 
31
31
  async function handleLogin() {
32
- const res = await fetch("/api/oauth", {
32
+ const requestUrl = credentials.requestUrl || "/api/oauth";
33
+
34
+ const res = await fetch(requestUrl, {
33
35
  method: "POST",
34
36
  headers: { "Content-Type": "application/json" },
35
37
  body: JSON.stringify({
@@ -53,7 +55,7 @@ export default function DemoLogin() {
53
55
  }
54
56
 
55
57
  return (
56
- <Stack spacing={2.5}>
58
+ <Stack spacing={2.5} sx={{ mb: 2 }}>
57
59
  <Stack spacing={2}>
58
60
  <TextField
59
61
  label="Username"
@@ -6,13 +6,13 @@ import {
6
6
  signUp,
7
7
  } from "aws-amplify/auth";
8
8
 
9
- export async function login(username, password) {
10
- return signIn({ username, password });
9
+ export async function login(email, password) {
10
+ return signIn({ username: email, password });
11
11
  }
12
12
 
13
- export async function signup(username, password, email) {
13
+ export async function signup(email, password) {
14
14
  return signUp({
15
- username,
15
+ username: email,
16
16
  password,
17
17
  options: {
18
18
  userAttributes: {
@@ -22,9 +22,9 @@ export async function signup(username, password, email) {
22
22
  });
23
23
  }
24
24
 
25
- export async function confirmSignup(username, code) {
25
+ export async function confirmSignup(email, code) {
26
26
  return confirmSignUp({
27
- username,
27
+ username: email,
28
28
  confirmationCode: code,
29
29
  });
30
30
  }
@@ -14,6 +14,9 @@ export function configureAmplify() {
14
14
  userPoolId: credentials.userPoolId,
15
15
  userPoolClientId: credentials.clientId,
16
16
  region: credentials.region,
17
+ loginWith: {
18
+ email: true,
19
+ },
17
20
  },
18
21
  },
19
22
  });
@@ -18,12 +18,17 @@ const handleOAuthLogin = (
18
18
  };
19
19
 
20
20
  function LoginForm() {
21
- const { name, project } = config();
21
+ const { name, project, credentials } = config();
22
22
 
23
23
  const [email, setEmail] = useState("");
24
24
  const [password, setPassword] = useState("");
25
25
 
26
- const renderHead = (
26
+ const providerCheck =
27
+ credentials?.provider === "COGNITO" || credentials?.provider === "DEMO";
28
+
29
+ const hasContent = !providerCheck || !!project.nucleoid;
30
+
31
+ const renderHead = hasContent ? (
27
32
  <Stack spacing={2} sx={{ mb: 5 }}>
28
33
  <Typography variant="h4">Sign in to {name}</Typography>
29
34
  {project.nucleoid && (
@@ -34,7 +39,7 @@ function LoginForm() {
34
39
  </Stack>
35
40
  )}
36
41
  </Stack>
37
- );
42
+ ) : null;
38
43
 
39
44
  const renderForm = (
40
45
  <>