create-bluecopa-react-app 1.0.10 → 1.0.12

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.
Files changed (28) hide show
  1. package/bin/create-bluecopa-react-app.js +1 -1
  2. package/package.json +1 -1
  3. package/templates/latest/.dockerignore +5 -0
  4. package/templates/latest/Agent.md +577 -0
  5. package/templates/latest/Dockerfile +2 -2
  6. package/templates/latest/app/app.tsx +3 -1
  7. package/templates/latest/app/components/app-sidebar.tsx +14 -16
  8. package/templates/latest/app/components/nav-main.tsx +6 -22
  9. package/templates/latest/app/data/mock-payments.json +122 -0
  10. package/templates/latest/app/data/mock-transactions.json +128 -0
  11. package/templates/latest/app/routes/comments.tsx +552 -0
  12. package/templates/latest/app/routes/home.tsx +1 -1
  13. package/templates/latest/app/routes/payments.tsx +342 -0
  14. package/templates/latest/app/routes/websocket.tsx +449 -0
  15. package/templates/latest/app/routes.tsx +6 -0
  16. package/templates/latest/dist/assets/{__federation_expose_App-C8_sl1dD.js → __federation_expose_App-B2IoFaIA.js} +15 -4
  17. package/templates/latest/dist/assets/client-LFBsfOjG.js +2775 -0
  18. package/templates/latest/dist/assets/{home-DhyEFlEc.js → home-BBY02MnI.js} +87 -59
  19. package/templates/latest/dist/assets/{index-DkyIpbj3.js → index-CNNS7Foy.js} +4 -3
  20. package/templates/latest/dist/assets/{client-Hh38T4k9.js → index-D5og7-RT-BA7DwZw1.js} +46 -2789
  21. package/templates/latest/dist/assets/remoteEntry.css +4 -4
  22. package/templates/latest/dist/assets/remoteEntry.js +1 -1
  23. package/templates/latest/dist/index.html +3 -2
  24. package/templates/latest/package-lock.json +2094 -844
  25. package/templates/latest/package.json +1 -1
  26. package/templates/latest/public/favicon.ico +0 -0
  27. package/templates/latest/public/avatars/shadcn.svg +0 -6
  28. /package/templates/latest/app/{dashboard → data}/data.json +0 -0
@@ -42,7 +42,7 @@ Templates:
42
42
  latest Basic React Router setup with essential components
43
43
 
44
44
  For more information, visit:
45
- https://github.com/bluecopa/blui/tree/main/packages/boilerplate/react
45
+ https://github.com/bluecopa/blui/tree/dev/packages/boilerplate/react
46
46
  `)
47
47
  .action(async (projectName, options) => {
48
48
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bluecopa-react-app",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "CLI tool to create bluecopa React applications",
5
5
  "type": "module",
6
6
  "main": "./bin/create-bluecopa-react-app.js",
@@ -0,0 +1,5 @@
1
+ node_modules/
2
+ dist
3
+ .git
4
+ *.log
5
+ .DS_Store
@@ -73,6 +73,583 @@ export function Component({ className, children }: ComponentProps) {
73
73
  - Implement loading and error states
74
74
  - Use TanStack Query for caching
75
75
  - Handle optimistic updates
76
+ # @bluecopa/react [![npm version](https://img.shields.io/npm/v/@bluecopa/react)](https://www.npmjs.com/package/@bluecopa/react) [![License](https://img.shields.io/npm/l/@bluecopa/react)](https://github.com/bluecopa/blui/blob/main/packages/react/LICENSE)
77
+
78
+ ## A Comprehensive React Query Integration for Bluecopa
79
+
80
+ A React library providing opinionated custom hooks for TanStack React Query integration with Bluecopa core API. This package enables efficient data fetching, caching, and synchronization with the Bluecopa platform while maintaining type safety and developer experience.
81
+
82
+ ## Table of Contents
83
+
84
+ - [@bluecopa/react ](#bluecopareact--)
85
+ - [A Comprehensive React Query Integration for Bluecopa](#a-comprehensive-react-query-integration-for-bluecopa)
86
+ - [Table of Contents](#table-of-contents)
87
+ - [Features](#features)
88
+ - [Installation](#installation)
89
+ - [Peer Dependencies](#peer-dependencies)
90
+ - [Usage](#usage)
91
+ - [Query Provider Setup](#query-provider-setup)
92
+ - [Boilerplate Integration](#boilerplate-integration)
93
+ - [Hook Examples](#hook-examples)
94
+ - [`useUser` - Fetch authenticated user](#useuser---fetch-authenticated-user)
95
+ - [`useDataset` - Fetch dataset with query controls](#usedataset---fetch-dataset-with-query-controls)
96
+ - [API Documentation](#api-documentation)
97
+ - [`useUser(options?)`](#useuseroptions)
98
+ - [`useDataset(datasetId, options?)`](#usedatasetdatasetid-options)
99
+ - [`useDatasetSample(datasetId, options?)`](#usedatasetsampledatasetid-options)
100
+ - [`useMetric(metricId, options?)`](#usemetricmetricid-options)
101
+ - [`useInputTable(inputTableId, options?)`](#useinputtableinputtableid-options)
102
+ - [`useGetFileUrlByFileId(fileId, options?)`](#usegetfileurlbyfileidfileid-options)
103
+ - [`useGetPublishedWorkbookById(workbookId, options?)`](#usegetpublishedworkbookbyidworkbookid-options)
104
+ - [`useGetTableById(tableId, options?)`](#usegettablebyidtableid-options)
105
+ - [`useGetWorkbooksByType(workbookType, options?)`](#usegetworkbooksbytypeworkbooktype-options)
106
+ - [`useGetWorkflowInstanceStatusById(instanceId, options?)`](#usegetworkflowinstancestatusbyidinstanceid-options)
107
+ - [`useGetWorksheets(options?)`](#usegetworksheetsoptions)
108
+ - [`useGetWorksheetsByType(worksheetType, options?)`](#usegetworksheetsbytypeworksheettype-options)
109
+ - [`useRunDefinition(definitionId, options?)`](#userundefinitiondefinitionid-options)
110
+ - [`useRunPublishedDefinition(publishedDefinitionId, options?)`](#userunpublisheddefinitionpublisheddefinitionid-options)
111
+ - [`useRunSampleDefinition(sampleDefinitionId, options?)`](#userunsampledefinitionsampledefinitionid-options)
112
+ - [`useTriggerHttpWorkflow(workflowId, payload, options?)`](#usetriggerhttpworkflowworkflowid-payload-options)
113
+ - [`useTriggerWorkflow(workflowId, options?)`](#usetriggerworkflowworkflowid-options)
114
+ - [`useWorkbook(workbookId, options?)`](#useworkbookworkbookid-options)
115
+ - [`useWorkflow(workflowId, options?)`](#useworkflowworkflowid-options)
116
+ - [`useWorksheet(worksheetId, options?)`](#useworksheetworksheetid-options)
117
+ - [Configuration](#configuration)
118
+ - [Default Query Configuration](#default-query-configuration)
119
+ - [Customizable Parameters](#customizable-parameters)
120
+ - [Advanced Usage](#advanced-usage)
121
+ - [Error Handling](#error-handling)
122
+ - [Manual Refetching](#manual-refetching)
123
+ - [Re-exports](#re-exports)
124
+ - [TypeScript Support](#typescript-support)
125
+ - [Development](#development)
126
+
127
+ ## Features
128
+
129
+ - ✅ First-class TypeScript support with strict type definitions
130
+ - 🔁 Seamless integration with TanStack React Query (v5+)
131
+ - 🛡 Comprehensive error handling patterns
132
+ - ⚙ Optimized default query configuration
133
+ - 📦 Re-exports of core TanStack React Query utilities
134
+ - 📊 Sample data preview capabilities
135
+ - 🧩 Customizable query parameters (limit, caching, retries)
136
+
137
+ ## Installation
138
+
139
+ ```bash
140
+ npm install @bluecopa/react
141
+ # or with pnpm
142
+ pnpm add @bluecopa/react
143
+ ```
144
+
145
+ ### Peer Dependencies
146
+
147
+ This package requires the following in your application:
148
+
149
+ ```bash
150
+ npm install react@^18.0.0 react-dom@^18.0.0
151
+ ```
152
+
153
+ ## Usage
154
+
155
+ ### Query Provider Setup
156
+
157
+ Wrap your application with the React Query provider:
158
+
159
+ ```tsx
160
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
161
+
162
+ const queryClient = new QueryClient({
163
+ defaultOptions: {
164
+ queries: {
165
+ staleTime: 60 * 1000, // 1 minute
166
+ refetchOnWindowFocus: false,
167
+ },
168
+ },
169
+ });
170
+
171
+ function App() {
172
+ return (
173
+ <QueryClientProvider client={queryClient}>
174
+ <YourApp />
175
+ <ReactQueryDevtools initialIsOpen={false} />
176
+ </QueryClientProvider>
177
+ );
178
+ }
179
+ ```
180
+
181
+ ### Boilerplate Integration
182
+
183
+ For projects using the Bluecopa React boilerplate, use the pre-configured `QueryProvider` component that handles API configuration automatically:
184
+
185
+ ```tsx
186
+ // src/providers/query-provider.tsx
187
+ import { ReactQueryDevtools, reactQuery, copaSetConfig } from "@bluecopa/react";
188
+ import { useEffect, useState } from "react";
189
+
190
+ const { QueryClient, QueryClientProvider } = reactQuery;
191
+
192
+ export default function QueryProvider({ children }: { children: React.ReactNode }) {
193
+ const [queryClient] = useState(() => new QueryClient({
194
+ defaultOptions: {
195
+ queries: {
196
+ staleTime: 60 * 1000, // 1 minute
197
+ refetchOnWindowFocus: false,
198
+ },
199
+ },
200
+ }));
201
+
202
+ useEffect(() => {
203
+ let copaUser: any = {};
204
+ try {
205
+ const copaToken = import.meta.env.VITE_BLUECOPA_API_TOKEN
206
+ ? atob(import.meta.env.VITE_BLUECOPA_API_TOKEN)
207
+ : "{}";
208
+
209
+ copaUser = JSON.parse(copaToken);
210
+ } catch (error) {
211
+ console.warn("Failed to parse VITE_BLUECOPA_API_TOKEN:", error);
212
+ }
213
+
214
+ copaSetConfig({
215
+ apiBaseUrl: import.meta.env.VITE_BLUECOPA_API_URL || "https://develop.bluecopa.com/api/v1",
216
+ workspaceId: import.meta.env.VITE_BLUECOPA_WORKSPACE_ID || "",
217
+ accessToken: copaUser?.accessToken || "",
218
+ });
219
+ }, []);
220
+
221
+ return (
222
+ <QueryClientProvider client={queryClient}>
223
+ {children}
224
+ <ReactQueryDevtools initialIsOpen={false} />
225
+ </QueryClientProvider>
226
+ );
227
+ }
228
+ ```
229
+
230
+ **Required Environment Variables:**
231
+
232
+ | Variable | Description | Example |
233
+ |----------|-------------|---------|
234
+ | `VITE_BLUECOPA_API_URL` | Base URL for Bluecopa API | `https://develop.bluecopa.com` |
235
+ | `VITE_BLUECOPA_WORKSPACE_ID` | Your workspace identifier | `my-workspace-123` |
236
+ | `VITE_BLUECOPA_API_TOKEN` | Base64-encoded JSON string containing `accessToken` | `eyJhY2Nlc3NUb2tlbiI6IjEyMzQ1In0=` |
237
+
238
+ **Example `.env` file:**
239
+ ```
240
+ VITE_BLUECOPA_API_URL=https://develop.bluecopa.com
241
+ VITE_BLUECOPA_WORKSPACE_ID=your-workspace-id
242
+ VITE_BLUECOPA_API_TOKEN=base64-encoded-json-here
243
+ ```
244
+
245
+ Then wrap your application with this provider:
246
+
247
+ ```tsx
248
+ import QueryProvider from './providers/query-provider';
249
+
250
+ function App() {
251
+ return (
252
+ <QueryProvider>
253
+ <YourApp />
254
+ </QueryProvider>
255
+ );
256
+ }
257
+ ```
258
+
259
+ This setup automatically configures the API client with your environment-specific settings and applies optimal caching defaults.
260
+
261
+ ### Hook Examples
262
+
263
+ #### `useUser` - Fetch authenticated user
264
+
265
+ ```tsx
266
+ import { useUser } from '@bluecopa/react';
267
+
268
+ function UserProfile() {
269
+ const { data, isLoading, error } = useUser({
270
+ staleTime: 5 * 60 * 1000, // 5 minutes
271
+ retry: 2
272
+ });
273
+
274
+ if (isLoading) return <div>Loading...</div>;
275
+ if (error) return <div>Error: {error.message}</div>;
276
+
277
+ return <div>Welcome, {data?.name}!</div>;
278
+ }
279
+ ```
280
+
281
+ #### `useDataset` - Fetch dataset with query controls
282
+
283
+ ```tsx
284
+ import { useDataset } from '@bluecopa/react';
285
+
286
+ function DatasetViewer({ datasetId }) {
287
+ const { data, isLoading } = useDataset(datasetId, {
288
+ limit: 500,
289
+ staleTime: 10 * 60 * 1000 // 10 minutes
290
+ });
291
+
292
+ if (isLoading) return <div>Loading dataset...</div>;
293
+ return <div>{data?.name} ({data?.records?.length} records)</div>;
294
+ }
295
+ ```
296
+
297
+ ## API Documentation
298
+
299
+ ### `useUser(options?)`
300
+
301
+ Fetches authenticated user details with query controls.
302
+
303
+ **Parameters:**
304
+ - `options` (optional): Query options extending TanStack React Query's `UseQueryOptions`
305
+
306
+ **Returns:**
307
+ - `data`: User object or `undefined`
308
+ - `isLoading`: Boolean indicating loading state
309
+ - `error`: Error object if request failed
310
+ - `refetch`: Function to manually trigger refetch
311
+
312
+ ### `useDataset(datasetId, options?)`
313
+
314
+ Fetches dataset data by ID with configurable parameters.
315
+
316
+ **Parameters:**
317
+ - `datasetId`: ID of the dataset to fetch
318
+ - `options` (optional): Query options with:
319
+ - `limit`: Maximum records to fetch
320
+ - `staleTime`: Duration (ms) before data is considered stale
321
+
322
+ **Returns:**
323
+ - `data`: Dataset object containing name and records
324
+ - `isLoading`: Boolean indicating loading state
325
+ - `error`: Error object if request failed
326
+ - `refetch`: Function to manually trigger refetch
327
+
328
+ ### `useDatasetSample(datasetId, options?)`
329
+
330
+ Fetches a representative sample of dataset data.
331
+
332
+ **Parameters:**
333
+ - `datasetId`: ID of the dataset
334
+ - `options` (optional): Query options with `enabled` flag
335
+
336
+ **Returns:**
337
+ - `data`: Object containing sample data
338
+ - `isLoading`: Boolean indicating loading state
339
+ - `refetch`: Function to manually trigger refetch
340
+
341
+ ### `useMetric(metricId, options?)`
342
+
343
+ Fetches metric data by ID.
344
+
345
+ **Parameters:**
346
+ - `metricId`: ID of the metric
347
+ - `options` (optional): Query options
348
+
349
+ **Returns:**
350
+ - `data`: Metric object with name and value
351
+ - `isLoading`: Boolean indicating loading state
352
+ - `error`: Error object if request failed
353
+ - `refetch`: Function to manually trigger refetch
354
+
355
+ ### `useInputTable(inputTableId, options?)`
356
+
357
+ Fetches input table data with limit parameters.
358
+
359
+ **Parameters:**
360
+ - `inputTableId`: ID of the input table
361
+ - `options` (optional): Query options with `limitParams`:
362
+ - `limit`: Maximum rows to fetch
363
+ - `limitFrom`: Direction to apply limit from ('top' or 'bottom')
364
+
365
+ **Returns:**
366
+ - `data`: Input table object with rows
367
+ - `isLoading`: Boolean indicating loading state
368
+ - `error`: Error object if request failed
369
+ - `refetch`: Function to manually trigger refetch
370
+
371
+ ### `useGetFileUrlByFileId(fileId, options?)`
372
+
373
+ Fetches the URL for a file by its ID.
374
+
375
+ **Parameters:**
376
+ - `fileId`: ID of the file to fetch URL for
377
+ - `options` (optional): Query options extending TanStack React Query's `UseQueryOptions`
378
+
379
+ **Returns:**
380
+ - `data`: Object containing file URL
381
+ - `isLoading`: Boolean indicating loading state
382
+ - `error`: Error object if request failed
383
+ - `refetch`: Function to manually trigger refetch
384
+
385
+ ### `useGetPublishedWorkbookById(workbookId, options?)`
386
+
387
+ Fetches published workbook details by ID.
388
+
389
+ **Parameters:**
390
+ - `workbookId`: ID of the published workbook
391
+ - `options` (optional): Query options
392
+
393
+ **Returns:**
394
+ - `data`: Published workbook object
395
+ - `isLoading`: Boolean indicating loading state
396
+ - `error`: Error object if request failed
397
+ - `refetch`: Function to manually trigger refetch
398
+
399
+ ### `useGetTableById(tableId, options?)`
400
+
401
+ Fetches table metadata by ID.
402
+
403
+ **Parameters:**
404
+ - `tableId`: ID of the table
405
+ - `options` (optional): Query options
406
+
407
+ **Returns:**
408
+ - `data`: Table metadata object
409
+ - `isLoading`: Boolean indicating loading state
410
+ - `error`: Error object if request failed
411
+ - `refetch`: Function to manually trigger refetch
412
+
413
+ ### `useGetWorkbooksByType(workbookType, options?)`
414
+
415
+ Fetches workbooks filtered by type.
416
+
417
+ **Parameters:**
418
+ - `workbookType`: Type of workbooks to fetch
419
+ - `options` (optional): Query options
420
+
421
+ **Returns:**
422
+ - `data`: Array of workbook objects
423
+ - `isLoading`: Boolean indicating loading state
424
+ - `error`: Error object if request failed
425
+ - `refetch`: Function to manually trigger refetch
426
+
427
+ ### `useGetWorkflowInstanceStatusById(instanceId, options?)`
428
+
429
+ Fetches workflow instance status by ID.
430
+
431
+ **Parameters:**
432
+ - `instanceId`: ID of the workflow instance
433
+ - `options` (optional): Query options
434
+
435
+ **Returns:**
436
+ - `data`: Workflow status object
437
+ - `isLoading`: Boolean indicating loading state
438
+ - `error`: Error object if request failed
439
+ - `refetch`: Function to manually trigger refetch
440
+
441
+ ### `useGetWorksheets(options?)`
442
+
443
+ Fetches all available worksheets.
444
+
445
+ **Parameters:**
446
+ - `options` (optional): Query options
447
+
448
+ **Returns:**
449
+ - `data`: Array of worksheet objects
450
+ - `isLoading`: Boolean indicating loading state
451
+ - `error`: Error object if request failed
452
+ - `refetch`: Function to manually trigger refetch
453
+
454
+ ### `useGetWorksheetsByType(worksheetType, options?)`
455
+
456
+ Fetches worksheets filtered by type.
457
+
458
+ **Parameters:**
459
+ - `worksheetType`: Type of worksheets to fetch
460
+ - `options` (optional): Query options
461
+
462
+ **Returns:**
463
+ - `data`: Array of worksheet objects
464
+ - `isLoading`: Boolean indicating loading state
465
+ - `error`: Error object if request failed
466
+ - `refetch`: Function to manually trigger refetch
467
+
468
+ ### `useRunDefinition(definitionId, options?)`
469
+
470
+ Executes a run definition.
471
+
472
+ **Parameters:**
473
+ - `definitionId`: ID of the run definition
474
+ - `options` (optional): Query options
475
+
476
+ **Returns:**
477
+ - `data`: Execution result
478
+ - `isLoading`: Boolean indicating loading state
479
+ - `error`: Error object if request failed
480
+ - `refetch`: Function to manually trigger refetch
481
+
482
+ ### `useRunPublishedDefinition(publishedDefinitionId, options?)`
483
+
484
+ Executes a published run definition.
485
+
486
+ **Parameters:**
487
+ - `publishedDefinitionId`: ID of the published definition
488
+ - `options` (optional): Query options
489
+
490
+ **Returns:**
491
+ - `data`: Execution result
492
+ - `isLoading`: Boolean indicating loading state
493
+ - `error`: Error object if request failed
494
+ - `refetch`: Function to manually trigger refetch
495
+
496
+ ### `useRunSampleDefinition(sampleDefinitionId, options?)`
497
+
498
+ Executes a sample run definition.
499
+
500
+ **Parameters:**
501
+ - `sampleDefinitionId`: ID of the sample definition
502
+ - `options` (optional): Query options
503
+
504
+ **Returns:**
505
+ - `data`: Sample execution result
506
+ - `isLoading`: Boolean indicating loading state
507
+ - `error`: Error object if request failed
508
+ - `refetch`: Function to manually trigger refetch
509
+
510
+ ### `useTriggerHttpWorkflow(workflowId, payload, options?)`
511
+
512
+ Triggers an HTTP workflow execution.
513
+
514
+ **Parameters:**
515
+ - `workflowId`: ID of the workflow
516
+ - `payload`: Request payload
517
+ - `options` (optional): Query options
518
+
519
+ **Returns:**
520
+ - `data`: Workflow execution response
521
+ - `isLoading`: Boolean indicating loading state
522
+ - `error`: Error object if request failed
523
+ - `refetch`: Function to manually trigger refetch
524
+
525
+ ### `useTriggerWorkflow(workflowId, options?)`
526
+
527
+ Triggers a workflow execution.
528
+
529
+ **Parameters:**
530
+ - `workflowId`: ID of the workflow
531
+ - `options` (optional): Query options
532
+
533
+ **Returns:**
534
+ - `data`: Workflow execution response
535
+ - `isLoading`: Boolean indicating loading state
536
+ - `error`: Error object if request failed
537
+ - `refetch`: Function to manually trigger refetch
538
+
539
+ ### `useWorkbook(workbookId, options?)`
540
+
541
+ Fetches workbook details by ID.
542
+
543
+ **Parameters:**
544
+ - `workbookId`: ID of the workbook
545
+ - `options` (optional): Query options
546
+
547
+ **Returns:**
548
+ - `data`: Workbook object
549
+ - `isLoading`: Boolean indicating loading state
550
+ - `error`: Error object if request failed
551
+ - `refetch`: Function to manually trigger refetch
552
+
553
+ ### `useWorkflow(workflowId, options?)`
554
+
555
+ Fetches workflow configuration by ID.
556
+
557
+ **Parameters:**
558
+ - `workflowId`: ID of the workflow
559
+ - `options` (optional): Query options
560
+
561
+ **Returns:**
562
+ - `data`: Workflow configuration object
563
+ - `isLoading`: Boolean indicating loading state
564
+ - `error`: Error object if request failed
565
+ - `refetch`: Function to manually trigger refetch
566
+
567
+ ### `useWorksheet(worksheetId, options?)`
568
+
569
+ Fetches worksheet details by ID.
570
+
571
+ **Parameters:**
572
+ - `worksheetId`: ID of the worksheet
573
+ - `options` (optional): Query options
574
+
575
+ **Returns:**
576
+ - `data`: Worksheet object
577
+ - `isLoading`: Boolean indicating loading state
578
+ - `error`: Error object if request failed
579
+ - `refetch`: Function to manually trigger refetch
580
+
581
+
582
+ ## Configuration
583
+
584
+ ### Default Query Configuration
585
+
586
+ ```tsx
587
+ const queryClient = new QueryClient({
588
+ defaultOptions: {
589
+ queries: {
590
+ retry: 3,
591
+ staleTime: 1000 * 60 * 5, // 5 minutes
592
+ gcTime: 1000 * 60 * 10, // 10 minutes
593
+ },
594
+ },
595
+ });
596
+ ```
597
+
598
+ ### Customizable Parameters
599
+
600
+ All hooks accept standard TanStack React Query options:
601
+
602
+ ```ts
603
+ interface QueryOptions {
604
+ enabled?: boolean; // Enable/disable query
605
+ staleTime?: number; // Duration (ms) before data is stale
606
+ gcTime?: number; // Duration (ms) to keep data in cache
607
+ retry?: number | boolean; // Number of retries or disable retries
608
+ onSuccess?: (data: any) => void; // Success callback
609
+ onError?: (error: Error) => void; // Error callback
610
+ }
611
+ ```
612
+
613
+ ## Advanced Usage
614
+
615
+ ### Error Handling
616
+
617
+ ```tsx
618
+ useUser({
619
+ onError: (error) => {
620
+ console.error('User fetch failed:', error.message);
621
+ // Custom error recovery logic
622
+ }
623
+ });
624
+ ```
625
+
626
+ ### Manual Refetching
627
+
628
+ ```tsx
629
+ function ManualRefetch() {
630
+ const { data, refetch } = useUser();
631
+
632
+ return (
633
+ <div>
634
+ <button onClick={() => refetch()}>Refresh</button>
635
+ </div>
636
+ );
637
+ }
638
+ ```
639
+
640
+ ## Re-exports
641
+
642
+ This package re-exports core TanStack React Query utilities:
643
+
644
+ ```ts
645
+ import {
646
+ useQuery,
647
+ useMutation,
648
+ QueryClient,
649
+ QueryClientProvider,
650
+ ReactQueryDevtools
651
+ } from '@bluecopa/react';
652
+ ```
76
653
 
77
654
  ### Styling Guidelines
78
655
  - Use Tailwind CSS classes
@@ -1,4 +1,4 @@
1
- FROM node:18-alpine AS production
1
+ FROM node:22-alpine AS production
2
2
 
3
3
  # Set working directory
4
4
  WORKDIR /usr/src/app
@@ -7,7 +7,7 @@ WORKDIR /usr/src/app
7
7
  COPY package*.json ./
8
8
 
9
9
  # Install dependencies
10
- RUN npm install
10
+ RUN npm install --no-audit --no-fund
11
11
 
12
12
  # Copy source code
13
13
  COPY . .
@@ -1,5 +1,6 @@
1
1
  import { Suspense, useEffect, useState } from 'react'
2
2
  import { reactQuery, ReactQueryDevtools, copaSetConfig } from "@bluecopa/react";
3
+ import { Toaster } from "sonner";
3
4
  import RouteConfig from './routes';
4
5
 
5
6
  import './app.css'
@@ -32,7 +33,7 @@ export default function App(props: any) {
32
33
  apiBaseUrl: props.apiBaseUrl || import.meta.env.VITE_BLUECOPA_API_URL || 'https://develop.bluecopa.com',
33
34
  workspaceId: props.workspaceId || import.meta.env.VITE_BLUECOPA_WORKSPACE_ID || '',
34
35
  accessToken: props.accessToken || copaUser?.accessToken || '',
35
- userId: props.userId || ''
36
+ userId: props.userId || copaUser.userId || ''
36
37
  } as any);
37
38
  }, []);
38
39
 
@@ -41,6 +42,7 @@ export default function App(props: any) {
41
42
  <Suspense fallback={<div className="p-4 text-sm text-muted-foreground">Loading…</div>}>
42
43
  <RouteConfig />
43
44
  <ReactQueryDevtools initialIsOpen={false} />
45
+ <Toaster />
44
46
  </Suspense>
45
47
  </QueryClientProvider>
46
48
  )
@@ -2,9 +2,12 @@ import * as React from "react"
2
2
  import {
3
3
  IconCamera,
4
4
  IconChartBar,
5
+ IconCreditCard,
5
6
  IconDashboard,
6
7
  IconDatabase,
7
8
  IconFileAi,
9
+ IconMessageCircle,
10
+ IconPlug,
8
11
  IconFileDescription,
9
12
  IconFileWord,
10
13
  IconFolder,
@@ -35,29 +38,24 @@ const data = {
35
38
  navMain: [
36
39
  {
37
40
  title: "Dashboard",
38
- url: "#",
41
+ url: "/",
39
42
  icon: IconDashboard,
40
43
  },
41
44
  {
42
- title: "Lifecycle",
43
- url: "#",
44
- icon: IconListDetails,
45
- },
46
- {
47
- title: "Analytics",
48
- url: "#",
49
- icon: IconChartBar,
45
+ title: "Comments",
46
+ url: "/comments",
47
+ icon: IconMessageCircle,
50
48
  },
51
49
  {
52
- title: "Projects",
53
- url: "#",
54
- icon: IconFolder,
50
+ title: "WebSocket",
51
+ url: "/websocket",
52
+ icon: IconPlug,
55
53
  },
56
54
  {
57
- title: "Team",
58
- url: "#",
59
- icon: IconUsers,
60
- },
55
+ title: "Payments",
56
+ url: "/payments",
57
+ icon: IconCreditCard,
58
+ }
61
59
  ],
62
60
  navClouds: [
63
61
  {