@arizondigital/catalyst-sso 0.1.2 → 0.1.4

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +16 -17
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.1.2",
6
+ "version": "0.1.4",
7
7
  "description": "Integer Catalyst SSO package",
8
8
  "license": "MIT",
9
9
  "author": "Arizon Digital",
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,17 +32,23 @@ 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
- fetch(
43
- "https://sso-app-merchant-dev.vercel.app/api/pqhmp0hlit/okta/saml"
44
- )
45
- .then((response) => response.json())
46
- .then((data) => {
47
- console.log("API Response:", data);
41
+ axios
42
+ .get(
43
+ `https://sso-app-merchant-dev.vercel.app/api/${storeHash}/okta/saml?channel_id=${channelId}`,
44
+ {
45
+ withCredentials: true,
46
+ },
47
+ )
48
+ .then((response) => {
49
+ const data = response.data;
50
+
51
+ console.log("API 2 Response:", data);
48
52
 
49
53
  setButtonName(data.button_name);
50
54
  setRedirectUrl(data.redirect_url);
@@ -55,10 +59,7 @@ export function OktaSamlButton() {
55
59
  }, []);
56
60
 
57
61
  return (
58
- <SsoButtonPlaceholder
59
- buttonText={buttonName}
60
- loginUrl={redirectUrl}
61
- />
62
+ <SsoButtonPlaceholder buttonText={buttonName} loginUrl={redirectUrl} />
62
63
  );
63
64
  }
64
65
 
@@ -71,9 +72,7 @@ export function EntraSamlButton({
71
72
 
72
73
  useEffect(() => {
73
74
  if (isSandbox && storeHash) {
74
- setRedirectUrl(
75
- `https://sso-app-merchant-dev.vercel.app/api/entra/login`
76
- );
75
+ setRedirectUrl(`https://sso-app-merchant-dev.vercel.app/api/entra/login`);
77
76
  }
78
77
  }, [isSandbox, storeHash]);
79
78