@arizondigital/catalyst-sso 0.1.4 → 0.2.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.
- package/package.json +1 -1
- package/src/index.js +28 -22
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -32,19 +32,16 @@ function SsoButtonPlaceholder({ buttonText, loginUrl }) {
|
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export function OktaSamlButton({
|
|
35
|
+
export function OktaSamlButton({isSandbox,storeHash,channelId}) {
|
|
36
36
|
const [buttonName, setButtonName] = useState("Login With Okta");
|
|
37
37
|
const [redirectUrl, setRedirectUrl] = useState("");
|
|
38
38
|
console.log("OktaSamlButton Props:", { isSandbox, storeHash, channelId });
|
|
39
39
|
|
|
40
40
|
useEffect(() => {
|
|
41
41
|
axios
|
|
42
|
-
.get(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
withCredentials: true,
|
|
46
|
-
},
|
|
47
|
-
)
|
|
42
|
+
.get(`https://sso-app-merchant-dev.vercel.app/api/${storeHash}/okta/${channelId}/saml`, {
|
|
43
|
+
withCredentials: true,
|
|
44
|
+
})
|
|
48
45
|
.then((response) => {
|
|
49
46
|
const data = response.data;
|
|
50
47
|
|
|
@@ -52,34 +49,43 @@ export function OktaSamlButton({ isSandbox, storeHash, channelId }) {
|
|
|
52
49
|
|
|
53
50
|
setButtonName(data.button_name);
|
|
54
51
|
setRedirectUrl(data.redirect_url);
|
|
55
|
-
|
|
52
|
+
|
|
53
|
+
})
|
|
56
54
|
.catch((error) => {
|
|
57
55
|
console.error("Error fetching data:", error);
|
|
58
56
|
});
|
|
59
57
|
}, []);
|
|
60
58
|
|
|
61
59
|
return (
|
|
62
|
-
<SsoButtonPlaceholder
|
|
60
|
+
<SsoButtonPlaceholder
|
|
61
|
+
buttonText={buttonName}
|
|
62
|
+
loginUrl={redirectUrl}
|
|
63
|
+
/>
|
|
63
64
|
);
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
isSandbox = false,
|
|
69
|
-
storeHash = "",
|
|
70
|
-
}) {
|
|
71
|
-
const [redirectUrl, setRedirectUrl] = useState(loginUrl);
|
|
66
|
+
export function EntraSamlButton({ isSandbox, storeHash, channelId }) {
|
|
67
|
+
const [buttonName, setButtonName] = useState("Login With Entra");
|
|
68
|
+
const [redirectUrl, setRedirectUrl] = useState("");
|
|
72
69
|
|
|
73
70
|
useEffect(() => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
axios
|
|
72
|
+
.get(`https://sso-app-merchant-dev.vercel.app/${storeHash}/entra/${channelId}/saml`, {
|
|
73
|
+
withCredentials: true,
|
|
74
|
+
})
|
|
75
|
+
.then((response) => {
|
|
76
|
+
const data = response.data;
|
|
77
|
+
setButtonName(data.button_name);
|
|
78
|
+
setRedirectUrl(data.redirect_url);
|
|
79
|
+
})
|
|
80
|
+
.catch((error) => {
|
|
81
|
+
console.error("Error fetching Entra SSO data:", error);
|
|
82
|
+
});
|
|
83
|
+
}, [storeHash, channelId]);
|
|
78
84
|
|
|
79
85
|
return (
|
|
80
|
-
|
|
86
|
+
<SsoButtonPlaceholder
|
|
81
87
|
buttonText="Login With Entra"
|
|
82
88
|
loginUrl={redirectUrl}
|
|
83
89
|
/>
|
|
84
90
|
);
|
|
85
|
-
}
|
|
91
|
+
}
|