@bridge-ai-dev/ecom-chat 1.1.1 → 1.1.2

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/README.md CHANGED
@@ -37,7 +37,15 @@ You can include the generic `ChatComponent` directly in your application, or use
37
37
 
38
38
  ### Method 1: Using the Generated Wrapper (Recommended for Litium)
39
39
 
40
- If you used `npx create-ecom-chat`, a `ChatWrapper.tsx` file was generated for you. It is pre-configured to handle Litium's cart context creation. Simply drop it into your root layout (`app/layout.tsx`):
40
+ If you used `npx create-ecom-chat`, a `ChatWrapper.tsx` file was generated for you. It uses environment variables to access your Bridge tenant ID and widget script URL.
41
+
42
+ First, add the following variables to your `.env.local` or `.env` file:
43
+ ```env
44
+ NEXT_PUBLIC_BRIDGE_TENANT_ID=your-tenant-uuid
45
+ NEXT_PUBLIC_BRIDGE_WIDGET_URL=https://your-cdn.com/chat-widget.js
46
+ ```
47
+
48
+ Then, simply drop the generated component into your root layout (`app/layout.tsx`):
41
49
 
42
50
  ```tsx
43
51
  import ChatWrapper from '@/components/ChatWrapper';
@@ -62,14 +70,14 @@ If you prefer to integrate the component manually without the wrapper, you can i
62
70
  'use client';
63
71
 
64
72
  import { ChatComponent } from '@bridge-ai-dev/ecom-chat';
65
- import { createCart } from '@/services/cartService.client'; // Adjust path to your project's mutation
73
+ import { get } from '@/services/cartService.client'; // Adjust path to your project's fetching function
66
74
 
67
75
  export default function ChatWrapper() {
68
76
  return (
69
77
  <ChatComponent
70
- tenantId="your-tenant-uuid"
71
- widgetScriptUrl="https://your-cdn.com/chat-widget.js"
72
- getCartFunction={createCart}
78
+ tenantId={process.env.NEXT_PUBLIC_BRIDGE_TENANT_ID || ""}
79
+ widgetScriptUrl={process.env.NEXT_PUBLIC_BRIDGE_WIDGET_URL}
80
+ getCartFunction={get}
73
81
  />
74
82
  );
75
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bridge-ai-dev/ecom-chat",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Bridge E-commerce Chat widget integration for Next.js with Litium authentication",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,14 +1,14 @@
1
1
  'use client';
2
2
 
3
3
  import { ChatComponent } from '@bridge-ai-dev/ecom-chat';
4
- import { createCart } from 'services/cartService.client';
4
+ import { get } from 'services/cartService.client';
5
5
 
6
6
  export default function ChatWrapper() {
7
7
  return (
8
8
  <ChatComponent
9
- tenantId="YOUR_TENANT_ID_HERE"
10
- widgetScriptUrl="https://YOUR_CLOUDFRONT_URL/chat-widget.js"
11
- getCartFunction={createCart}
9
+ tenantId={process.env.NEXT_PUBLIC_BRIDGE_TENANT_ID || ""}
10
+ widgetScriptUrl={process.env.NEXT_PUBLIC_BRIDGE_WIDGET_URL}
11
+ getCartFunction={get}
12
12
  />
13
13
  );
14
14
  }