create-bluecopa-react-app 1.0.11 → 1.0.13

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 (29) hide show
  1. package/bin/create-bluecopa-react-app.js +1 -1
  2. package/package.json +1 -1
  3. package/templates/latest/.dockerignore +5 -1
  4. package/templates/latest/Agent.md +621 -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 → dashboard.tsx} +1 -1
  13. package/templates/latest/app/routes/payments.tsx +342 -0
  14. package/templates/latest/app/routes/websocket.tsx +450 -0
  15. package/templates/latest/app/routes.tsx +8 -5
  16. package/templates/latest/dist/assets/{__federation_expose_App-C8_sl1dD.js → __federation_expose_App-BIH7hwj_.js} +12 -2
  17. package/templates/latest/dist/assets/{home-DhyEFlEc.js → client-CsvW46cT.js} +18530 -983
  18. package/templates/latest/dist/assets/{index-DkyIpbj3.js → index-CFECuPSy.js} +1 -1
  19. package/templates/latest/dist/assets/remoteEntry.css +155 -23
  20. package/templates/latest/dist/assets/remoteEntry.js +1 -1
  21. package/templates/latest/dist/favicon.ico +0 -0
  22. package/templates/latest/dist/index.html +2 -2
  23. package/templates/latest/package-lock.json +203 -203
  24. package/templates/latest/package.json +1 -1
  25. package/templates/latest/public/favicon.ico +0 -0
  26. package/templates/latest/dist/assets/client-Hh38T4k9.js +0 -12660
  27. package/templates/latest/dist/avatars/shadcn.svg +0 -6
  28. package/templates/latest/public/avatars/shadcn.svg +0 -6
  29. /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.11",
3
+ "version": "1.0.13",
4
4
  "description": "CLI tool to create bluecopa React applications",
5
5
  "type": "module",
6
6
  "main": "./bin/create-bluecopa-react-app.js",
@@ -1 +1,5 @@
1
- node_modules/
1
+ node_modules/
2
+ dist
3
+ .git
4
+ *.log
5
+ .DS_Store
@@ -74,6 +74,627 @@ export function Component({ className, children }: ComponentProps) {
74
74
  - Use TanStack Query for caching
75
75
  - Handle optimistic updates
76
76
 
77
+ # @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)
78
+
79
+ ## A Comprehensive React Query Integration for Bluecopa
80
+
81
+ 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.
82
+
83
+ ## Table of Contents
84
+
85
+ - [AI Agent Guide for BlueCopa React shadcn/ui Template](#ai-agent-guide-for-bluecopa-react-shadcnui-template)
86
+ - [🏗️ Project Architecture Overview](#️-project-architecture-overview)
87
+ - [Core Stack](#core-stack)
88
+ - [Key Directories](#key-directories)
89
+ - [🎨 Component Patterns](#-component-patterns)
90
+ - [shadcn/ui Components](#shadcnui-components)
91
+ - [Custom Components](#custom-components)
92
+ - [Example Component Structure](#example-component-structure)
93
+ - [🔧 Development Patterns](#-development-patterns)
94
+ - [State Management](#state-management)
95
+ - [Data Fetching](#data-fetching)
96
+ - [@bluecopa/react ](#bluecopareact--)
97
+ - [A Comprehensive React Query Integration for Bluecopa](#a-comprehensive-react-query-integration-for-bluecopa)
98
+ - [Table of Contents](#table-of-contents)
99
+ - [Features](#features)
100
+ - [Installation](#installation)
101
+ - [Peer Dependencies](#peer-dependencies)
102
+ - [Usage](#usage)
103
+ - [Query Provider Setup](#query-provider-setup)
104
+ - [Boilerplate Integration](#boilerplate-integration)
105
+ - [Hook Examples](#hook-examples)
106
+ - [`useUser` - Fetch authenticated user](#useuser---fetch-authenticated-user)
107
+ - [`useDataset` - Fetch dataset with query controls](#usedataset---fetch-dataset-with-query-controls)
108
+ - [API Documentation](#api-documentation)
109
+ - [`useUser(options?)`](#useuseroptions)
110
+ - [`useDataset(datasetId, options?)`](#usedatasetdatasetid-options)
111
+ - [`useDatasetSample(datasetId, options?)`](#usedatasetsampledatasetid-options)
112
+ - [`useMetric(metricId, options?)`](#usemetricmetricid-options)
113
+ - [`useInputTable(inputTableId, options?)`](#useinputtableinputtableid-options)
114
+ - [`useGetFileUrlByFileId(fileId, options?)`](#usegetfileurlbyfileidfileid-options)
115
+ - [`useGetPublishedWorkbookById(workbookId, options?)`](#usegetpublishedworkbookbyidworkbookid-options)
116
+ - [`useGetTableById(tableId, options?)`](#usegettablebyidtableid-options)
117
+ - [`useGetWorkbooksByType(workbookType, options?)`](#usegetworkbooksbytypeworkbooktype-options)
118
+ - [`useGetWorkflowInstanceStatusById(instanceId, options?)`](#usegetworkflowinstancestatusbyidinstanceid-options)
119
+ - [`useGetWorksheets(options?)`](#usegetworksheetsoptions)
120
+ - [`useGetWorksheetsByType(worksheetType, options?)`](#usegetworksheetsbytypeworksheettype-options)
121
+ - [`useRunDefinition(definitionId, options?)`](#userundefinitiondefinitionid-options)
122
+ - [`useRunPublishedDefinition(publishedDefinitionId, options?)`](#userunpublisheddefinitionpublisheddefinitionid-options)
123
+ - [`useRunSampleDefinition(sampleDefinitionId, options?)`](#userunsampledefinitionsampledefinitionid-options)
124
+ - [`useTriggerHttpWorkflow(workflowId, payload, options?)`](#usetriggerhttpworkflowworkflowid-payload-options)
125
+ - [`useTriggerWorkflow(workflowId, options?)`](#usetriggerworkflowworkflowid-options)
126
+ - [`useWorkbook(workbookId, options?)`](#useworkbookworkbookid-options)
127
+ - [`useWorkflow(workflowId, options?)`](#useworkflowworkflowid-options)
128
+ - [`useWorksheet(worksheetId, options?)`](#useworksheetworksheetid-options)
129
+ - [Configuration](#configuration)
130
+ - [Default Query Configuration](#default-query-configuration)
131
+ - [Customizable Parameters](#customizable-parameters)
132
+ - [Advanced Usage](#advanced-usage)
133
+ - [Error Handling](#error-handling)
134
+ - [Manual Refetching](#manual-refetching)
135
+ - [Re-exports](#re-exports)
136
+ - [Styling Guidelines](#styling-guidelines)
137
+ - [📊 Data Visualization](#-data-visualization)
138
+ - [Charts (Recharts)](#charts-recharts)
139
+ - [Tables (TanStack Table)](#tables-tanstack-table)
140
+ - [🎯 Common Tasks \& Solutions](#-common-tasks--solutions)
141
+ - [Adding New Pages](#adding-new-pages)
142
+ - [Adding New Components](#adding-new-components)
143
+ - [Working with Forms](#working-with-forms)
144
+ - [API Integration](#api-integration)
145
+ - [🚀 Performance Optimization](#-performance-optimization)
146
+ - [Code Splitting](#code-splitting)
147
+ - [Bundle Optimization](#bundle-optimization)
148
+ - [Runtime Performance](#runtime-performance)
149
+ - [🧪 Testing Strategies](#-testing-strategies)
150
+ - [Component Testing](#component-testing)
151
+ - [Integration Testing](#integration-testing)
152
+ - [🔒 Security Considerations](#-security-considerations)
153
+ - [Data Handling](#data-handling)
154
+ - [📱 Responsive Design](#-responsive-design)
155
+ - [Breakpoints](#breakpoints)
156
+ - [Layout Patterns](#layout-patterns)
157
+ - [🌙 Dark Mode Implementation](#-dark-mode-implementation)
158
+ - [Theme System](#theme-system)
159
+ - [Component Theming](#component-theming)
160
+ - [🐛 Debugging Tips](#-debugging-tips)
161
+ - [Common Issues](#common-issues)
162
+ - [Development Tools](#development-tools)
163
+ - [📚 Useful Resources](#-useful-resources)
164
+ - [Documentation](#documentation)
165
+ - [BlueCopa Specific](#bluecopa-specific)
166
+ - [🎯 Best Practices Summary](#-best-practices-summary)
167
+ - [🔄 Common Workflows](#-common-workflows)
168
+ - [Adding a New Feature](#adding-a-new-feature)
169
+ - [Debugging Issues](#debugging-issues)
170
+
171
+ ## Features
172
+
173
+ - ✅ First-class TypeScript support with strict type definitions
174
+ - 🔁 Seamless integration with TanStack React Query (v5+)
175
+ - 🛡 Comprehensive error handling patterns
176
+ - ⚙ Optimized default query configuration
177
+ - 📦 Re-exports of core TanStack React Query utilities
178
+ - 📊 Sample data preview capabilities
179
+ - 🧩 Customizable query parameters (limit, caching, retries)
180
+
181
+ ## Installation
182
+
183
+ ```bash
184
+ npm install @bluecopa/react
185
+ # or with pnpm
186
+ pnpm add @bluecopa/react
187
+ ```
188
+
189
+ ### Peer Dependencies
190
+
191
+ This package requires the following in your application:
192
+
193
+ ```bash
194
+ npm install react@^18.0.0 react-dom@^18.0.0
195
+ ```
196
+
197
+ ## Usage
198
+
199
+ ### Query Provider Setup
200
+
201
+ Wrap your application with the React Query provider:
202
+
203
+ ```tsx
204
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
205
+
206
+ const queryClient = new QueryClient({
207
+ defaultOptions: {
208
+ queries: {
209
+ staleTime: 60 * 1000, // 1 minute
210
+ refetchOnWindowFocus: false,
211
+ },
212
+ },
213
+ });
214
+
215
+ function App() {
216
+ return (
217
+ <QueryClientProvider client={queryClient}>
218
+ <YourApp />
219
+ <ReactQueryDevtools initialIsOpen={false} />
220
+ </QueryClientProvider>
221
+ );
222
+ }
223
+ ```
224
+
225
+ ### Boilerplate Integration
226
+
227
+ For projects using the Bluecopa React boilerplate, use the pre-configured `QueryProvider` component that handles API configuration automatically:
228
+
229
+ ```tsx
230
+ // src/providers/query-provider.tsx
231
+ import { ReactQueryDevtools, reactQuery, copaSetConfig } from "@bluecopa/react";
232
+ import { useEffect, useState } from "react";
233
+
234
+ const { QueryClient, QueryClientProvider } = reactQuery;
235
+
236
+ export default function QueryProvider({ children }: { children: React.ReactNode }) {
237
+ const [queryClient] = useState(() => new QueryClient({
238
+ defaultOptions: {
239
+ queries: {
240
+ staleTime: 60 * 1000, // 1 minute
241
+ refetchOnWindowFocus: false,
242
+ },
243
+ },
244
+ }));
245
+
246
+ useEffect(() => {
247
+ let copaUser: any = {};
248
+ try {
249
+ const copaToken = import.meta.env.VITE_BLUECOPA_API_TOKEN
250
+ ? atob(import.meta.env.VITE_BLUECOPA_API_TOKEN)
251
+ : "{}";
252
+
253
+ copaUser = JSON.parse(copaToken);
254
+ } catch (error) {
255
+ console.warn("Failed to parse VITE_BLUECOPA_API_TOKEN:", error);
256
+ }
257
+
258
+ copaSetConfig({
259
+ apiBaseUrl: import.meta.env.VITE_BLUECOPA_API_URL || "https://develop.bluecopa.com/api/v1",
260
+ workspaceId: import.meta.env.VITE_BLUECOPA_WORKSPACE_ID || "",
261
+ accessToken: copaUser?.accessToken || "",
262
+ });
263
+ }, []);
264
+
265
+ return (
266
+ <QueryClientProvider client={queryClient}>
267
+ {children}
268
+ <ReactQueryDevtools initialIsOpen={false} />
269
+ </QueryClientProvider>
270
+ );
271
+ }
272
+ ```
273
+
274
+ **Required Environment Variables:**
275
+
276
+ | Variable | Description | Example |
277
+ |----------|-------------|---------|
278
+ | `VITE_BLUECOPA_API_URL` | Base URL for Bluecopa API | `https://develop.bluecopa.com` |
279
+ | `VITE_BLUECOPA_WORKSPACE_ID` | Your workspace identifier | `my-workspace-123` |
280
+ | `VITE_BLUECOPA_API_TOKEN` | Base64-encoded JSON string containing `accessToken` | `eyJhY2Nlc3NUb2tlbiI6IjEyMzQ1In0=` |
281
+
282
+ **Example `.env` file:**
283
+ ```
284
+ VITE_BLUECOPA_API_URL=https://develop.bluecopa.com
285
+ VITE_BLUECOPA_WORKSPACE_ID=your-workspace-id
286
+ VITE_BLUECOPA_API_TOKEN=base64-encoded-json-here
287
+ ```
288
+
289
+ Then wrap your application with this provider:
290
+
291
+ ```tsx
292
+ import QueryProvider from './providers/query-provider';
293
+
294
+ function App() {
295
+ return (
296
+ <QueryProvider>
297
+ <YourApp />
298
+ </QueryProvider>
299
+ );
300
+ }
301
+ ```
302
+
303
+ This setup automatically configures the API client with your environment-specific settings and applies optimal caching defaults.
304
+
305
+ ### Hook Examples
306
+
307
+ #### `useUser` - Fetch authenticated user
308
+
309
+ ```tsx
310
+ import { useUser } from '@bluecopa/react';
311
+
312
+ function UserProfile() {
313
+ const { data, isLoading, error } = useUser({
314
+ staleTime: 5 * 60 * 1000, // 5 minutes
315
+ retry: 2
316
+ });
317
+
318
+ if (isLoading) return <div>Loading...</div>;
319
+ if (error) return <div>Error: {error.message}</div>;
320
+
321
+ return <div>Welcome, {data?.name}!</div>;
322
+ }
323
+ ```
324
+
325
+ #### `useDataset` - Fetch dataset with query controls
326
+
327
+ ```tsx
328
+ import { useDataset } from '@bluecopa/react';
329
+
330
+ function DatasetViewer({ datasetId }) {
331
+ const { data, isLoading } = useDataset(datasetId, {
332
+ limit: 500,
333
+ staleTime: 10 * 60 * 1000 // 10 minutes
334
+ });
335
+
336
+ if (isLoading) return <div>Loading dataset...</div>;
337
+ return <div>{data?.name} ({data?.records?.length} records)</div>;
338
+ }
339
+ ```
340
+
341
+ ## API Documentation
342
+
343
+ ### `useUser(options?)`
344
+
345
+ Fetches authenticated user details with query controls.
346
+
347
+ **Parameters:**
348
+ - `options` (optional): Query options extending TanStack React Query's `UseQueryOptions`
349
+
350
+ **Returns:**
351
+ - `data`: User object or `undefined`
352
+ - `isLoading`: Boolean indicating loading state
353
+ - `error`: Error object if request failed
354
+ - `refetch`: Function to manually trigger refetch
355
+
356
+ ### `useDataset(datasetId, options?)`
357
+
358
+ Fetches dataset data by ID with configurable parameters.
359
+
360
+ **Parameters:**
361
+ - `datasetId`: ID of the dataset to fetch
362
+ - `options` (optional): Query options with:
363
+ - `limit`: Maximum records to fetch
364
+ - `staleTime`: Duration (ms) before data is considered stale
365
+
366
+ **Returns:**
367
+ - `data`: Dataset object containing name and records
368
+ - `isLoading`: Boolean indicating loading state
369
+ - `error`: Error object if request failed
370
+ - `refetch`: Function to manually trigger refetch
371
+
372
+ ### `useDatasetSample(datasetId, options?)`
373
+
374
+ Fetches a representative sample of dataset data.
375
+
376
+ **Parameters:**
377
+ - `datasetId`: ID of the dataset
378
+ - `options` (optional): Query options with `enabled` flag
379
+
380
+ **Returns:**
381
+ - `data`: Object containing sample data
382
+ - `isLoading`: Boolean indicating loading state
383
+ - `refetch`: Function to manually trigger refetch
384
+
385
+ ### `useMetric(metricId, options?)`
386
+
387
+ Fetches metric data by ID.
388
+
389
+ **Parameters:**
390
+ - `metricId`: ID of the metric
391
+ - `options` (optional): Query options
392
+
393
+ **Returns:**
394
+ - `data`: Metric object with name and value
395
+ - `isLoading`: Boolean indicating loading state
396
+ - `error`: Error object if request failed
397
+ - `refetch`: Function to manually trigger refetch
398
+
399
+ ### `useInputTable(inputTableId, options?)`
400
+
401
+ Fetches input table data with limit parameters.
402
+
403
+ **Parameters:**
404
+ - `inputTableId`: ID of the input table
405
+ - `options` (optional): Query options with `limitParams`:
406
+ - `limit`: Maximum rows to fetch
407
+ - `limitFrom`: Direction to apply limit from ('top' or 'bottom')
408
+
409
+ **Returns:**
410
+ - `data`: Input table object with rows
411
+ - `isLoading`: Boolean indicating loading state
412
+ - `error`: Error object if request failed
413
+ - `refetch`: Function to manually trigger refetch
414
+
415
+ ### `useGetFileUrlByFileId(fileId, options?)`
416
+
417
+ Fetches the URL for a file by its ID.
418
+
419
+ **Parameters:**
420
+ - `fileId`: ID of the file to fetch URL for
421
+ - `options` (optional): Query options extending TanStack React Query's `UseQueryOptions`
422
+
423
+ **Returns:**
424
+ - `data`: Object containing file URL
425
+ - `isLoading`: Boolean indicating loading state
426
+ - `error`: Error object if request failed
427
+ - `refetch`: Function to manually trigger refetch
428
+
429
+ ### `useGetPublishedWorkbookById(workbookId, options?)`
430
+
431
+ Fetches published workbook details by ID.
432
+
433
+ **Parameters:**
434
+ - `workbookId`: ID of the published workbook
435
+ - `options` (optional): Query options
436
+
437
+ **Returns:**
438
+ - `data`: Published workbook object
439
+ - `isLoading`: Boolean indicating loading state
440
+ - `error`: Error object if request failed
441
+ - `refetch`: Function to manually trigger refetch
442
+
443
+ ### `useGetTableById(tableId, options?)`
444
+
445
+ Fetches table metadata by ID.
446
+
447
+ **Parameters:**
448
+ - `tableId`: ID of the table
449
+ - `options` (optional): Query options
450
+
451
+ **Returns:**
452
+ - `data`: Table metadata object
453
+ - `isLoading`: Boolean indicating loading state
454
+ - `error`: Error object if request failed
455
+ - `refetch`: Function to manually trigger refetch
456
+
457
+ ### `useGetWorkbooksByType(workbookType, options?)`
458
+
459
+ Fetches workbooks filtered by type.
460
+
461
+ **Parameters:**
462
+ - `workbookType`: Type of workbooks to fetch
463
+ - `options` (optional): Query options
464
+
465
+ **Returns:**
466
+ - `data`: Array of workbook objects
467
+ - `isLoading`: Boolean indicating loading state
468
+ - `error`: Error object if request failed
469
+ - `refetch`: Function to manually trigger refetch
470
+
471
+ ### `useGetWorkflowInstanceStatusById(instanceId, options?)`
472
+
473
+ Fetches workflow instance status by ID.
474
+
475
+ **Parameters:**
476
+ - `instanceId`: ID of the workflow instance
477
+ - `options` (optional): Query options
478
+
479
+ **Returns:**
480
+ - `data`: Workflow status object
481
+ - `isLoading`: Boolean indicating loading state
482
+ - `error`: Error object if request failed
483
+ - `refetch`: Function to manually trigger refetch
484
+
485
+ ### `useGetWorksheets(options?)`
486
+
487
+ Fetches all available worksheets.
488
+
489
+ **Parameters:**
490
+ - `options` (optional): Query options
491
+
492
+ **Returns:**
493
+ - `data`: Array of worksheet objects
494
+ - `isLoading`: Boolean indicating loading state
495
+ - `error`: Error object if request failed
496
+ - `refetch`: Function to manually trigger refetch
497
+
498
+ ### `useGetWorksheetsByType(worksheetType, options?)`
499
+
500
+ Fetches worksheets filtered by type.
501
+
502
+ **Parameters:**
503
+ - `worksheetType`: Type of worksheets to fetch
504
+ - `options` (optional): Query options
505
+
506
+ **Returns:**
507
+ - `data`: Array of worksheet objects
508
+ - `isLoading`: Boolean indicating loading state
509
+ - `error`: Error object if request failed
510
+ - `refetch`: Function to manually trigger refetch
511
+
512
+ ### `useRunDefinition(definitionId, options?)`
513
+
514
+ Executes a run definition.
515
+
516
+ **Parameters:**
517
+ - `definitionId`: ID of the run definition
518
+ - `options` (optional): Query options
519
+
520
+ **Returns:**
521
+ - `data`: Execution result
522
+ - `isLoading`: Boolean indicating loading state
523
+ - `error`: Error object if request failed
524
+ - `refetch`: Function to manually trigger refetch
525
+
526
+ ### `useRunPublishedDefinition(publishedDefinitionId, options?)`
527
+
528
+ Executes a published run definition.
529
+
530
+ **Parameters:**
531
+ - `publishedDefinitionId`: ID of the published definition
532
+ - `options` (optional): Query options
533
+
534
+ **Returns:**
535
+ - `data`: Execution result
536
+ - `isLoading`: Boolean indicating loading state
537
+ - `error`: Error object if request failed
538
+ - `refetch`: Function to manually trigger refetch
539
+
540
+ ### `useRunSampleDefinition(sampleDefinitionId, options?)`
541
+
542
+ Executes a sample run definition.
543
+
544
+ **Parameters:**
545
+ - `sampleDefinitionId`: ID of the sample definition
546
+ - `options` (optional): Query options
547
+
548
+ **Returns:**
549
+ - `data`: Sample execution result
550
+ - `isLoading`: Boolean indicating loading state
551
+ - `error`: Error object if request failed
552
+ - `refetch`: Function to manually trigger refetch
553
+
554
+ ### `useTriggerHttpWorkflow(workflowId, payload, options?)`
555
+
556
+ Triggers an HTTP workflow execution.
557
+
558
+ **Parameters:**
559
+ - `workflowId`: ID of the workflow
560
+ - `payload`: Request payload
561
+ - `options` (optional): Query options
562
+
563
+ **Returns:**
564
+ - `data`: Workflow execution response
565
+ - `isLoading`: Boolean indicating loading state
566
+ - `error`: Error object if request failed
567
+ - `refetch`: Function to manually trigger refetch
568
+
569
+ ### `useTriggerWorkflow(workflowId, options?)`
570
+
571
+ Triggers a workflow execution.
572
+
573
+ **Parameters:**
574
+ - `workflowId`: ID of the workflow
575
+ - `options` (optional): Query options
576
+
577
+ **Returns:**
578
+ - `data`: Workflow execution response
579
+ - `isLoading`: Boolean indicating loading state
580
+ - `error`: Error object if request failed
581
+ - `refetch`: Function to manually trigger refetch
582
+
583
+ ### `useWorkbook(workbookId, options?)`
584
+
585
+ Fetches workbook details by ID.
586
+
587
+ **Parameters:**
588
+ - `workbookId`: ID of the workbook
589
+ - `options` (optional): Query options
590
+
591
+ **Returns:**
592
+ - `data`: Workbook object
593
+ - `isLoading`: Boolean indicating loading state
594
+ - `error`: Error object if request failed
595
+ - `refetch`: Function to manually trigger refetch
596
+
597
+ ### `useWorkflow(workflowId, options?)`
598
+
599
+ Fetches workflow configuration by ID.
600
+
601
+ **Parameters:**
602
+ - `workflowId`: ID of the workflow
603
+ - `options` (optional): Query options
604
+
605
+ **Returns:**
606
+ - `data`: Workflow configuration object
607
+ - `isLoading`: Boolean indicating loading state
608
+ - `error`: Error object if request failed
609
+ - `refetch`: Function to manually trigger refetch
610
+
611
+ ### `useWorksheet(worksheetId, options?)`
612
+
613
+ Fetches worksheet details by ID.
614
+
615
+ **Parameters:**
616
+ - `worksheetId`: ID of the worksheet
617
+ - `options` (optional): Query options
618
+
619
+ **Returns:**
620
+ - `data`: Worksheet object
621
+ - `isLoading`: Boolean indicating loading state
622
+ - `error`: Error object if request failed
623
+ - `refetch`: Function to manually trigger refetch
624
+
625
+
626
+ ## Configuration
627
+
628
+ ### Default Query Configuration
629
+
630
+ ```tsx
631
+ const queryClient = new QueryClient({
632
+ defaultOptions: {
633
+ queries: {
634
+ retry: 3,
635
+ staleTime: 1000 * 60 * 5, // 5 minutes
636
+ gcTime: 1000 * 60 * 10, // 10 minutes
637
+ },
638
+ },
639
+ });
640
+ ```
641
+
642
+ ### Customizable Parameters
643
+
644
+ All hooks accept standard TanStack React Query options:
645
+
646
+ ```ts
647
+ interface QueryOptions {
648
+ enabled?: boolean; // Enable/disable query
649
+ staleTime?: number; // Duration (ms) before data is stale
650
+ gcTime?: number; // Duration (ms) to keep data in cache
651
+ retry?: number | boolean; // Number of retries or disable retries
652
+ onSuccess?: (data: any) => void; // Success callback
653
+ onError?: (error: Error) => void; // Error callback
654
+ }
655
+ ```
656
+
657
+ ## Advanced Usage
658
+
659
+ ### Error Handling
660
+
661
+ ```tsx
662
+ useUser({
663
+ onError: (error) => {
664
+ console.error('User fetch failed:', error.message);
665
+ // Custom error recovery logic
666
+ }
667
+ });
668
+ ```
669
+
670
+ ### Manual Refetching
671
+
672
+ ```tsx
673
+ function ManualRefetch() {
674
+ const { data, refetch } = useUser();
675
+
676
+ return (
677
+ <div>
678
+ <button onClick={() => refetch()}>Refresh</button>
679
+ </div>
680
+ );
681
+ }
682
+ ```
683
+
684
+ ## Re-exports
685
+
686
+ This package re-exports core TanStack React Query utilities:
687
+
688
+ ```ts
689
+ import {
690
+ useQuery,
691
+ useMutation,
692
+ QueryClient,
693
+ QueryClientProvider,
694
+ ReactQueryDevtools
695
+ } from '@bluecopa/react';
696
+ ```
697
+
77
698
  ### Styling Guidelines
78
699
  - Use Tailwind CSS classes
79
700
  - Leverage CSS variables for theming
@@ -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
  )