@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 +13 -5
- package/package.json +1 -1
- package/templates/ChatWrapper.tsx.template +4 -4
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
|
|
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 {
|
|
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="
|
|
71
|
-
widgetScriptUrl=
|
|
72
|
-
getCartFunction={
|
|
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,14 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { ChatComponent } from '@bridge-ai-dev/ecom-chat';
|
|
4
|
-
import {
|
|
4
|
+
import { get } from 'services/cartService.client';
|
|
5
5
|
|
|
6
6
|
export default function ChatWrapper() {
|
|
7
7
|
return (
|
|
8
8
|
<ChatComponent
|
|
9
|
-
tenantId="
|
|
10
|
-
widgetScriptUrl=
|
|
11
|
-
getCartFunction={
|
|
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
|
}
|