@canmingir/link 1.2.22 → 1.2.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canmingir/link",
3
- "version": "1.2.22",
3
+ "version": "1.2.23",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -15,6 +15,7 @@ export const ConfigSchema = Joi.object({
15
15
  region: Joi.string().optional(),
16
16
  userPoolId: Joi.string().optional(),
17
17
  clientId: Joi.string().optional(),
18
+ requestUrl: Joi.string().uri().optional(),
18
19
  }).optional(),
19
20
  project: Joi.object({
20
21
  nucleoid: Joi.object().optional(),
@@ -29,6 +29,8 @@ export default function AuthModernLayout({ image }) {
29
29
  maxSize={140}
30
30
  sx={{
31
31
  mb: { xs: 1, md: 2 },
32
+ width: 80,
33
+ height: 80,
32
34
  }}
33
35
  />
34
36
 
@@ -1,5 +1,3 @@
1
- import CustomPopover, { usePopover } from "../../components/custom-popover";
2
-
3
1
  import Avatar from "@mui/material/Avatar";
4
2
  import Box from "@mui/material/Box";
5
3
  import Divider from "@mui/material/Divider";
@@ -16,6 +14,8 @@ import { useRouter } from "../../routes/hooks";
16
14
  import { useUser } from "../../hooks/use-user";
17
15
  import { varHover } from "../../components/animate";
18
16
 
17
+ import CustomPopover, { usePopover } from "../../components/custom-popover";
18
+
19
19
  // ----------------------------------------------------------------------
20
20
 
21
21
  export default function AccountPopover() {
@@ -27,11 +27,7 @@ export default function AccountPopover() {
27
27
 
28
28
  const handleLogout = async () => {
29
29
  try {
30
- storage.remove("link", "accessToken");
31
- storage.remove("link", "refreshToken");
32
- storage.remove("link", "identityProvider");
33
- storage.remove("projectId");
34
- storage.remove("landingLevel");
30
+ storage.clear();
35
31
  popover.onClose();
36
32
  router.replace("/login");
37
33
  } catch (error) {
@@ -33,7 +33,7 @@ function Callback() {
33
33
 
34
34
  if (state) {
35
35
  stateData = JSON.parse(decodeURIComponent(state));
36
- identityProvider = stateData.identityProvider;
36
+ identityProvider = stateData.identityProvider.toUpperCase();
37
37
  }
38
38
 
39
39
  if (error) {
@@ -54,9 +54,9 @@ function Callback() {
54
54
  hasProcessed.current = true;
55
55
 
56
56
  const providerConfigs = {
57
- github,
58
- linkedin,
59
- google,
57
+ GITHUB: github,
58
+ LINKEDIN: linkedin,
59
+ GOOGLE: google,
60
60
  };
61
61
 
62
62
  const providerConfig = providerConfigs[identityProvider];
@@ -53,7 +53,7 @@ export default function CognitoLogin() {
53
53
 
54
54
  const navigate = useNavigate();
55
55
 
56
- const { appId } = config();
56
+ const { appId, credentials } = config();
57
57
 
58
58
  const handleLogin = async () => {
59
59
  try {
@@ -63,7 +63,9 @@ export default function CognitoLogin() {
63
63
  if (!tokens?.accessToken)
64
64
  throw new Error("No Cognito access token received");
65
65
 
66
- const res = await fetch("/api/oauth", {
66
+ const requestUrl = credentials.requestUrl || "/api/oauth";
67
+
68
+ const res = await fetch(requestUrl, {
67
69
  method: "POST",
68
70
  headers: { "Content-Type": "application/json" },
69
71
  body: JSON.stringify({
@@ -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({
@@ -1,3 +1,10 @@
1
+ import Iconify from "../components/Iconify";
2
+ import config from "../config/config";
3
+ import pkg from "../../../../../package.json";
4
+ import { useEvent } from "@nucleoidai/react-event";
5
+ import useSettings from "../hooks/useSettings";
6
+ import { useUser } from "../hooks/use-user";
7
+
1
8
  import {
2
9
  Avatar,
3
10
  Box,
@@ -22,13 +29,6 @@ import {
22
29
  import { Button, Dialog, DialogActions, DialogContent } from "@mui/material";
23
30
  import React, { useEffect, useState } from "react";
24
31
 
25
- import Iconify from "../components/Iconify";
26
- import config from "../config/config";
27
- import pkg from "../../../../../../package.json";
28
- import { useEvent } from "@nucleoidai/react-event";
29
- import useSettings from "../hooks/useSettings";
30
- import { useUser } from "../hooks/use-user";
31
-
32
32
  function a11yProps(index) {
33
33
  return {
34
34
  id: `vertical-tab-${index}`,