@cuekit-ai/react 1.2.1 → 1.2.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 +36 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -190,6 +190,7 @@ The SDK can integrate with your application's router via the `navigationHandler`
|
|
|
190
190
|
```tsx
|
|
191
191
|
import { useNavigate } from 'react-router-dom'
|
|
192
192
|
import { CuekitProvider } from '@cuekit-ai/react'
|
|
193
|
+
import '@cuekit-ai/react/styles.css'
|
|
193
194
|
|
|
194
195
|
function AppProviders({ children }) {
|
|
195
196
|
const navigate = useNavigate()
|
|
@@ -208,6 +209,41 @@ function AppProviders({ children }) {
|
|
|
208
209
|
}
|
|
209
210
|
```
|
|
210
211
|
|
|
212
|
+
**Next.js Example**:
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
'use client'
|
|
216
|
+
|
|
217
|
+
import { CuekitProvider } from '@cuekit-ai/react'
|
|
218
|
+
import { useRouter } from 'next/navigation'
|
|
219
|
+
import dynamic from 'next/dynamic'
|
|
220
|
+
import React from 'react'
|
|
221
|
+
import '@cuekit-ai/react/styles.css'
|
|
222
|
+
|
|
223
|
+
const DynamicCuekitProvider = dynamic(
|
|
224
|
+
() => import('@/providers/cuekit-provider').then((mod) => mod.CuekitProvider),
|
|
225
|
+
{
|
|
226
|
+
ssr: false,
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
export default function AppProviders({ children }: { children: React.ReactNode }) {
|
|
231
|
+
const router = useRouter()
|
|
232
|
+
return (
|
|
233
|
+
<DynamicCuekitProvider
|
|
234
|
+
apiKey="YOUR_API_KEY"
|
|
235
|
+
appId="YOUR_APP_ID"
|
|
236
|
+
navigationHandler={(path, params) => {
|
|
237
|
+
const qs = params ? `?${new URLSearchParams(params).toString()}` : ''
|
|
238
|
+
router.push(`${path}${qs}`)
|
|
239
|
+
}}
|
|
240
|
+
>
|
|
241
|
+
{children}
|
|
242
|
+
</DynamicCuekitProvider>
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
211
247
|
## 🐛 Troubleshooting
|
|
212
248
|
|
|
213
249
|
If you're having trouble, here are a few things to check:
|