@paramms/chat-widget 1.0.2 → 1.0.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.
package/README.md CHANGED
@@ -24,6 +24,80 @@ npm install @paramms/chat-widget
24
24
 
25
25
  ## React / Next.js
26
26
 
27
+ ### General support chat (`ChatWidget`)
28
+
29
+ ```tsx
30
+ 'use client'
31
+ import { ChatWidget } from '@paramms/chat-widget/react'
32
+
33
+ export default function SupportPage({ session }) {
34
+ return (
35
+ <ChatWidget
36
+ url={process.env.NEXT_PUBLIC_RELAY_WS_URL}
37
+ profileId={process.env.NEXT_PUBLIC_RELAY_PROFILE_ID}
38
+ userId={session?.user.id} // optional — anonymous if omitted
39
+ userName={session?.user.name} // optional — shown to agents
40
+ userEmail={session?.user.email} // optional — shown to agents
41
+ />
42
+ )
43
+ }
44
+ ```
45
+
46
+ ### Marketplace / multi-listing chat (`MarketplaceChat`)
47
+
48
+ Two modes — one component:
49
+
50
+ **On a listing page** (with `listingId`) → opens that item's chat directly. No list. Buyer is already looking at the item.
51
+
52
+ ```tsx
53
+ 'use client'
54
+ import { MarketplaceChat } from '@paramms/chat-widget/react'
55
+
56
+ // Listing detail page — floating bubble in bottom-right corner
57
+ export default function ListingPage({ car, session }) {
58
+ return (
59
+ <>
60
+ <YourPageContent />
61
+
62
+ <MarketplaceChat
63
+ url={process.env.NEXT_PUBLIC_RELAY_WS_URL}
64
+ profileId={process.env.NEXT_PUBLIC_RELAY_PROFILE_ID}
65
+ listingId={car.id}
66
+ listingTitle={car.title} // shown in chat header
67
+ listingPrice={car.price} // shown as "$12,500" tag
68
+ listingMeta="214,500 km · LPG" // one line of detail
69
+ listingStatus="Available"
70
+ userId={session?.user.id} // optional — anonymous if omitted
71
+ userName={session?.user.name} // optional
72
+ launcher // floating bubble button
73
+ position="bottom-right"
74
+ />
75
+ </>
76
+ )
77
+ }
78
+ ```
79
+
80
+ **On a /messages page** (without `listingId`) → shows the buyer's full thread list (WhatsApp-style). No conversation opens until they tap one.
81
+
82
+ ```tsx
83
+ // Dedicated inbox page — e.g. /messages
84
+ export default function MessagesPage({ session }) {
85
+ return (
86
+ <div style={{ height: '600px' }}>
87
+ <MarketplaceChat
88
+ url={process.env.NEXT_PUBLIC_RELAY_WS_URL}
89
+ profileId={process.env.NEXT_PUBLIC_RELAY_PROFILE_ID}
90
+ userId={session?.user.id}
91
+ userName={session?.user.name}
92
+ // no listingId = inbox mode, shows all threads
93
+ />
94
+ </div>
95
+ )
96
+ }
97
+ ```
98
+
99
+ ### Old section below (kept for reference)
100
+
27
101
  ```tsx
28
102
  'use client'
29
103
  import { ChatWidget } from '@paramms/chat-widget/react'