@axos-web-dev/shared-components 1.0.77-patch.35 → 1.0.77-patch.36

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.
@@ -1,5 +1,6 @@
1
1
  export type ChatbotProps = {
2
2
  project?: "axos" | "ufb";
3
3
  debug?: boolean;
4
+ env?: "dev" | "qa" | "uat" | "prod";
4
5
  };
5
6
  export declare const Chatbot: (props: ChatbotProps) => import("react/jsx-runtime").JSX.Element;
@@ -17,7 +17,8 @@ const Chatbot = (props) => {
17
17
  // or your region
18
18
  projectId: process.env.CCAI_PROJECT_ID || props.project || "axos",
19
19
  getToken: authenticate,
20
- debug: props.debug || process.env.NODE_ENV === "development"
20
+ debug: props.debug || process.env.NODE_ENV === "development",
21
+ env_project: props.env || "prod"
21
22
  });
22
23
  return /* @__PURE__ */ jsxs("div", { className: props.project === "ufb" ? chatbotUFB : chatbotAXB, children: [
23
24
  /* @__PURE__ */ jsx(Bubble, {}),
@@ -9,6 +9,7 @@ interface UseHeadlessChatOptions {
9
9
  projectId?: "axos" | "" | "ufb" | string;
10
10
  debug?: boolean;
11
11
  menuOption?: string;
12
+ env_project?: "dev" | "qa" | "uat" | "prod";
12
13
  }
13
14
  export interface ChatMessage {
14
15
  id: string;
@@ -16,7 +17,7 @@ export interface ChatMessage {
16
17
  sender?: string;
17
18
  timestamp?: string;
18
19
  }
19
- export declare function useHeadlessChat({ companyId, tenant, host, getToken, projectId, debug, menuOption, }: UseHeadlessChatOptions): {
20
+ export declare function useHeadlessChat({ companyId, tenant, host, getToken, projectId, debug, menuOption, env_project, }: UseHeadlessChatOptions): {
20
21
  status: "error" | "idle" | "connected" | "connecting" | "finished";
21
22
  sendMessage: (body: string) => Promise<void>;
22
23
  showReconnect: boolean;
@@ -14,7 +14,8 @@ function useHeadlessChat({
14
14
  getToken,
15
15
  projectId = "axos",
16
16
  debug = false,
17
- menuOption = "Support Virtual Agent"
17
+ menuOption = "Support Virtual Agent",
18
+ env_project = "prod"
18
19
  }) {
19
20
  const { hostname } = useLocation();
20
21
  const addMessage = useMessages((state) => state.addMessage);
@@ -55,14 +56,14 @@ function useHeadlessChat({
55
56
  },
56
57
  env: {
57
58
  label: "env",
58
- value: hostname?.includes("www") ? "prod" : hostname?.split(".")[1] ? hostname?.split(".")[1] : ""
59
+ value: env_project
59
60
  }
60
61
  }
61
62
  }
62
63
  }
63
64
  );
64
65
  }
65
- }, [clearMessages, hostname, menuOption, projectId]);
66
+ }, [clearMessages, env_project, menuOption, projectId]);
66
67
  useEffect(() => {
67
68
  let messageHandler;
68
69
  let chatReadyHandler;
@@ -114,7 +115,7 @@ function useHeadlessChat({
114
115
  },
115
116
  env: {
116
117
  label: "env",
117
- value: hostname?.includes("www") ? "prod" : hostname?.split(".")[1] ? hostname?.split(".")[1] : ""
118
+ value: env_project
118
119
  }
119
120
  }
120
121
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@axos-web-dev/shared-components",
3
3
  "description": "Axos shared components library for web.",
4
- "version": "1.0.77-patch.35",
4
+ "version": "1.0.77-patch.36",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",