Skip to content

Commit c6a546a

Browse files
committed
standardized the word standard
1 parent 0bf2db7 commit c6a546a

File tree

6 files changed

+17
-8
lines changed

6 files changed

+17
-8
lines changed

components/chatbot/ChatBot.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Button } from "@/components/ui/button";
33
import { Card, CardHeader, CardContent, CardFooter } from "@/components/ui/card";
44
import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";
55
import { Input } from "@/components/ui/input";
6-
import { wait } from "@/utils/utils";
76

87
import { v4 as uuidv4 } from "uuid";
98
import { useLDClient } from "launchdarkly-react-client-sdk";

components/ui/logincomponent.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import toggleBankVerticalLogo from '@/public/banking/toggleBank_logo_vertical.sv
1717
import frontierCapitalVerticalLogo from '@/public/investment/frontier_capital_logo_vertical.svg'
1818
import launchAirwaysVerticalLogo from '@/public/airline/launch_airways_logo_vertical.svg'
1919
import galaxyMarketplaceVerticalLogo from '@/public/marketplace/galaxy_marketplace_logo_vertical.svg'
20+
import { STANDARD } from "@/utils/constants";
2021

2122
const variantToImageMap = {
2223
bank: toggleBankVerticalLogo.src,
@@ -72,7 +73,7 @@ export function LoginComponent({ isLoggedIn, setIsLoggedIn, loginUser, variant,
7273
email = defaultEmail;
7374
name = email.split('@')[0];
7475
name = name.charAt(0).toUpperCase() + name.slice(1);
75-
role = 'Standard'
76+
role = STANDARD
7677
}
7778
loginUser(name, email, role);
7879
};

pages/api/chat.ts

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export default async function chatResponse(req: NextApiRequest, res: NextApiResp
3939
name: "anonymous",
4040
key: "abc-123",
4141
};
42+
console.log(getCookie("ld-context") )
4243

4344
const model = await ldClient.variation("ai-chatbot", context, {
4445
modelId: "anthropic.claude-instant-v1",

utils/constants.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@ export const ALERT_TYPES = {
2525
ERROR: "error",
2626
WARNING: "warning",
2727
INFO: "info",
28-
};
28+
};
29+
30+
export const STANDARD = "standard";
31+
32+
export const LD_CONTEXT_COOKIE_KEY = "ld-context"

utils/contexts/StarterUserPersonas.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import { STANDARD } from "../constants";
2+
13
export const STARTER_PERSONAS = [
24
{
35
personaname: "Cody",
46
personatype: "Standard User",
57
personaimage: "standard.jpg",
68
personaemail: "[email protected]",
7-
personarole: "Standard",
9+
personarole: STANDARD,
810
},
911
{
1012
personaname: "Alysha",
@@ -22,9 +24,9 @@ export const STARTER_PERSONAS = [
2224
},
2325
{
2426
personaname: "User",
25-
personatype: "Standard",
27+
personatype: "Standard User",
2628
personaimage: "/personas/persona3.png",
2729
personaemail: "[email protected]",
28-
personarole: "Standard",
30+
personarole: STANDARD,
2931
},
3032
];

utils/contexts/login.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { v4 as uuidv4 } from "uuid";
55
import CryptoJS from 'crypto-js';
66
import { isAndroid, isIOS, isBrowser, isMobile, isMacOs, isWindows } from 'react-device-detect';
77
import { setCookie } from "cookies-next";
8+
import { STANDARD } from "../constants";
89

910
const LoginContext = createContext();
1011

@@ -17,7 +18,7 @@ export const LoginProvider = ({ children }) => {
1718
const [user, setUser] = useState({});
1819
const [email, setEmail] = useState({});
1920
const [enrolledInLaunchClub, setEnrolledInLaunchClub] = useState(false);
20-
const [launchClubStatus, setLaunchClubStatus] = useState("standard");
21+
const [launchClubStatus, setLaunchClubStatus] = useState(STANDARD);
2122
const operatingSystem = isAndroid ? 'Android' : isIOS ? 'iOS' : isWindows ? 'Windows' : isMacOs ? 'macOS' : '';
2223
const device = isMobile ? 'Mobile' : isBrowser ? 'Desktop' : '';
2324

@@ -38,6 +39,7 @@ export const LoginProvider = ({ children }) => {
3839
context.audience.key = uuidv4().slice(0, 10);
3940
context.user.launchclub = launchClubStatus;
4041
await client?.identify(context);
42+
console.log
4143
setCookie("ld-context", context);
4244
setIsLoggedIn(true);
4345
setUser(user);
@@ -55,7 +57,7 @@ export const LoginProvider = ({ children }) => {
5557
setIsLoggedIn(false);
5658
setUser("anonymous");
5759
setEnrolledInLaunchClub(false);
58-
setLaunchClubStatus("standard");
60+
setLaunchClubStatus(STANDARD);
5961
const context = await createAnonymousContext();
6062
await client?.identify(context);
6163
setCookie("ld-context", context);

0 commit comments

Comments
 (0)