@arizondigital/catalyst-sso 0.1.3 → 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 +31 -26
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
"use client";
|
|
5
2
|
|
|
3
|
+
import axios from "axios";
|
|
6
4
|
import React, { useEffect, useState } from "react";
|
|
7
5
|
|
|
8
6
|
console.log("SSO Package Loaded.......123");
|
|
@@ -34,21 +32,25 @@ function SsoButtonPlaceholder({ buttonText, loginUrl }) {
|
|
|
34
32
|
);
|
|
35
33
|
}
|
|
36
34
|
|
|
37
|
-
export function OktaSamlButton({
|
|
35
|
+
export function OktaSamlButton({isSandbox,storeHash,channelId}) {
|
|
38
36
|
const [buttonName, setButtonName] = useState("Login With Okta");
|
|
39
37
|
const [redirectUrl, setRedirectUrl] = useState("");
|
|
38
|
+
console.log("OktaSamlButton Props:", { isSandbox, storeHash, channelId });
|
|
40
39
|
|
|
41
40
|
useEffect(() => {
|
|
42
|
-
|
|
43
|
-
`https://sso-app-merchant-dev.vercel.app/api/${storeHash}/okta/saml
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
.then((
|
|
47
|
-
|
|
41
|
+
axios
|
|
42
|
+
.get(`https://sso-app-merchant-dev.vercel.app/api/${storeHash}/okta/${channelId}/saml`, {
|
|
43
|
+
withCredentials: true,
|
|
44
|
+
})
|
|
45
|
+
.then((response) => {
|
|
46
|
+
const data = response.data;
|
|
47
|
+
|
|
48
|
+
console.log("API 2 Response:", data);
|
|
48
49
|
|
|
49
50
|
setButtonName(data.button_name);
|
|
50
51
|
setRedirectUrl(data.redirect_url);
|
|
51
|
-
|
|
52
|
+
|
|
53
|
+
})
|
|
52
54
|
.catch((error) => {
|
|
53
55
|
console.error("Error fetching data:", error);
|
|
54
56
|
});
|
|
@@ -61,26 +63,29 @@ export function OktaSamlButton({ isSandbox, storeHash }) {
|
|
|
61
63
|
/>
|
|
62
64
|
);
|
|
63
65
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
isSandbox = false,
|
|
68
|
-
storeHash = "",
|
|
69
|
-
}) {
|
|
70
|
-
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("");
|
|
71
69
|
|
|
72
70
|
useEffect(() => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
|
|
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]);
|
|
79
84
|
|
|
80
85
|
return (
|
|
81
|
-
|
|
86
|
+
<SsoButtonPlaceholder
|
|
82
87
|
buttonText="Login With Entra"
|
|
83
88
|
loginUrl={redirectUrl}
|
|
84
89
|
/>
|
|
85
90
|
);
|
|
86
|
-
}
|
|
91
|
+
}
|