@vc-shell/create-vc-app 1.1.98-rc.5 → 1.1.99-alpha.0

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 (83) hide show
  1. package/README.md +552 -26
  2. package/dist/cli/argv.d.ts +4 -0
  3. package/dist/cli/argv.d.ts.map +1 -0
  4. package/dist/cli/constants.d.ts +4 -0
  5. package/dist/cli/constants.d.ts.map +1 -0
  6. package/dist/cli/errors.d.ts +12 -0
  7. package/dist/cli/errors.d.ts.map +1 -0
  8. package/dist/cli/help.d.ts +3 -0
  9. package/dist/cli/help.d.ts.map +1 -0
  10. package/dist/cli/run.d.ts +2 -0
  11. package/dist/cli/run.d.ts.map +1 -0
  12. package/dist/cli/runtime.d.ts +7 -0
  13. package/dist/cli/runtime.d.ts.map +1 -0
  14. package/dist/cli/types.d.ts +30 -0
  15. package/dist/cli/types.d.ts.map +1 -0
  16. package/dist/cli/utils.d.ts +4 -0
  17. package/dist/cli/utils.d.ts.map +1 -0
  18. package/dist/cli/validation.d.ts +5 -0
  19. package/dist/cli/validation.d.ts.map +1 -0
  20. package/dist/commands/generate-blade.d.ts +16 -0
  21. package/dist/commands/generate-blade.d.ts.map +1 -0
  22. package/dist/index.js +1900 -530
  23. package/dist/templates/base/_package.json +5 -5
  24. package/dist/templates/base/ai-guides/.cursorrules-vc-shell +529 -0
  25. package/dist/templates/base/ai-guides/README.md +360 -0
  26. package/dist/templates/base/ai-guides/guides/AI_GUIDE.md +195 -0
  27. package/dist/templates/base/ai-guides/guides/blade-patterns.md +384 -0
  28. package/dist/templates/base/ai-guides/guides/complete-workflow.md +781 -0
  29. package/dist/templates/base/ai-guides/guides/composables-reference.md +338 -0
  30. package/dist/templates/base/ai-guides/guides/troubleshooting.md +529 -0
  31. package/dist/templates/base/ai-guides/guides/ui-components-reference.md +903 -0
  32. package/dist/templates/base/ai-guides/prompts/adapt-existing-module.md +1026 -0
  33. package/dist/templates/base/ai-guides/prompts/advanced-scenarios.md +852 -0
  34. package/dist/templates/base/ai-guides/prompts/api-client-generation.md +877 -0
  35. package/dist/templates/base/ai-guides/prompts/cli-usage.md +640 -0
  36. package/dist/templates/base/ai-guides/prompts/quick-start-scenarios.md +773 -0
  37. package/dist/templates/base/ai-guides/prompts/simple-modifications.md +987 -0
  38. package/dist/templates/base/src/main.ts +0 -4
  39. package/dist/templates/blades/details/blade.vue +175 -0
  40. package/dist/templates/blades/grid/blade.vue +340 -0
  41. package/dist/templates/composables/details-composable.ts +101 -0
  42. package/dist/templates/composables/grid-composable.ts +244 -0
  43. package/dist/templates/module/components/index.ts +2 -0
  44. package/dist/templates/module/components/widgets/index.ts +2 -0
  45. package/dist/templates/module/composables/index.ts +3 -0
  46. package/dist/templates/module/index.ts +13 -0
  47. package/dist/templates/module/locales/en.json +65 -0
  48. package/dist/templates/module/locales/index.ts +4 -0
  49. package/dist/templates/module/pages/index.ts +3 -0
  50. package/dist/templates/widgets/widget.vue +113 -0
  51. package/dist/utils/form-builder.d.ts +69 -0
  52. package/dist/utils/form-builder.d.ts.map +1 -0
  53. package/dist/utils/format.d.ts +24 -0
  54. package/dist/utils/format.d.ts.map +1 -0
  55. package/dist/utils/naming.d.ts +44 -0
  56. package/dist/utils/naming.d.ts.map +1 -0
  57. package/dist/utils/register-module.d.ts +21 -0
  58. package/dist/utils/register-module.d.ts.map +1 -0
  59. package/dist/workflows/create-app.d.ts +14 -0
  60. package/dist/workflows/create-app.d.ts.map +1 -0
  61. package/package.json +12 -7
  62. package/dist/templates/mocks/sample-data/constants.ts +0 -89
  63. package/dist/templates/mocks/sample-data/index.ts +0 -2
  64. package/dist/templates/mocks/sample-data/methods.ts +0 -65
  65. package/dist/templates/modules/classic-module/composables/index.ts +0 -2
  66. package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}Details/index.ts +0 -24
  67. package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}List/index.ts +0 -47
  68. package/dist/templates/modules/classic-module/index.ts +0 -8
  69. package/dist/templates/modules/classic-module/locales/en.json +0 -37
  70. package/dist/templates/modules/classic-module/locales/index.ts +0 -2
  71. package/dist/templates/modules/classic-module/pages/details.vue +0 -87
  72. package/dist/templates/modules/classic-module/pages/index.ts +0 -2
  73. package/dist/templates/modules/classic-module/pages/list.vue +0 -257
  74. package/dist/templates/sample/classic-module/composables/index.ts +0 -2
  75. package/dist/templates/sample/classic-module/composables/useDetails/index.ts +0 -54
  76. package/dist/templates/sample/classic-module/composables/useList/index.ts +0 -62
  77. package/dist/templates/sample/classic-module/index.ts +0 -8
  78. package/dist/templates/sample/classic-module/locales/en.json +0 -67
  79. package/dist/templates/sample/classic-module/locales/index.ts +0 -2
  80. package/dist/templates/sample/classic-module/pages/details.vue +0 -238
  81. package/dist/templates/sample/classic-module/pages/index.ts +0 -2
  82. package/dist/templates/sample/classic-module/pages/list.vue +0 -300
  83. package/dist/templates/sample/overrides/main.ts +0 -52
@@ -0,0 +1,1026 @@
1
+ # Adapt Existing Module
2
+
3
+ Guide for taking ready-made VC-Shell modules and adapting them to your needs. Use when you have an existing module (from GitHub, vendor-portal, or other source) and want to customize it for your application.
4
+
5
+ ## What is Module Adaptation?
6
+
7
+ **Module adaptation** means taking an existing, working VC-Shell module and customizing it:
8
+ - Connect to your own API instead of the original one
9
+ - Modify UI (add/remove columns, fields, widgets)
10
+ - Change functionality (filters, bulk operations, validations)
11
+ - Update styling and branding
12
+
13
+ **Important**: The module type stays the same - if it was a product catalog, it remains a catalog with similar structure.
14
+
15
+ ## When to Use This Guide
16
+
17
+ ✅ You have a ready-made module from VirtoCommerce or community
18
+ ✅ You want to use its structure and UI
19
+ ✅ You need to connect it to your own API
20
+ ✅ You want to add/remove some features
21
+
22
+ ❌ Don't use if you need a completely different entity type (use `create-vc-app blade` generator instead)
23
+
24
+ ---
25
+
26
+ ## Step 1: Get the Module
27
+
28
+ ### Clone Module from Repository
29
+
30
+ ```
31
+ I need to get module {{moduleName}} from repository.
32
+ Repository URL: {{githubUrl}}
33
+ Target location in my app: src/modules/{{target-module-name}}
34
+
35
+ Commands:
36
+ 1. Clone repository: git clone {{githubUrl}} temp-module
37
+ 2. Copy module: cp -r temp-module/src/modules/{{source-module-name}} src/modules/{{target-module-name}}
38
+ 3. Clean up: rm -rf temp-module
39
+ 4. Install dependencies if needed
40
+ ```
41
+
42
+ **Example:**
43
+ ```
44
+ Repository URL: https://github.com/VirtoCommerce/vc-shell
45
+ Target location: src/modules/products
46
+ source-module-name: products
47
+ target-module-name: products
48
+ ```
49
+
50
+ ---
51
+
52
+ ### Download Module Files Manually
53
+
54
+ ```
55
+ I have module files for {{moduleName}}.
56
+ Files are located in: {{filesLocation}}
57
+
58
+ Copy structure:
59
+ - pages/ → src/modules/{{module-name}}/pages/
60
+ - components/ → src/modules/{{module-name}}/components/
61
+ - composables/ → src/modules/{{module-name}}/composables/
62
+ - locales/ → src/modules/{{module-name}}/locales/
63
+ - index.ts → src/modules/{{module-name}}/index.ts
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Step 2: Connect to Your API
69
+
70
+ ### Replace API Client
71
+
72
+ ```
73
+ Connect module {{moduleName}} to my API.
74
+
75
+ My API details:
76
+ Base URL: {{apiBaseUrl}}
77
+ Authentication: {{authMethod}}
78
+
79
+ Endpoints:
80
+ - List items: {{listEndpoint}} ({{listMethod}})
81
+ - Get by ID: {{getByIdEndpoint}} ({{getMethod}})
82
+ - Create: {{createEndpoint}} ({{createMethod}})
83
+ - Update: {{updateEndpoint}} ({{updateMethod}})
84
+ - Delete: {{deleteEndpoint}} ({{deleteMethod}})
85
+
86
+ Response structure:
87
+ {{apiResponseStructure}}
88
+
89
+ Request payload structure:
90
+ {{apiRequestStructure}}
91
+
92
+ Changes needed:
93
+ 1. Update composable files: use{{EntityName}}List.ts and use{{EntityName}}Details.ts
94
+ 2. Replace API client class: {{OldApiClient}} → {{NewApiClient}} or use fetch/axios
95
+ 3. Update endpoint URLs in all API calls
96
+ 4. Map API response fields to match component expectations
97
+ 5. Map component data to match API request payload
98
+ ```
99
+
100
+ **Example:**
101
+ ```
102
+ My API details:
103
+ Base URL: https://api.mystore.com/v1
104
+ Authentication: Bearer token in Authorization header
105
+
106
+ Endpoints:
107
+ - List items: /products (GET)
108
+ - Get by ID: /products/:id (GET)
109
+ - Create: /products (POST)
110
+ - Update: /products/:id (PUT)
111
+ - Delete: /products/:id (DELETE)
112
+
113
+ Response structure:
114
+ {
115
+ data: { items: [...], total: number },
116
+ success: boolean
117
+ }
118
+
119
+ Map response:
120
+ - response.data.items → items
121
+ - response.data.total → totalCount
122
+ ```
123
+
124
+ ---
125
+
126
+ ### Map API Response Fields
127
+
128
+ ```
129
+ Map API response fields for {{moduleName}}.
130
+
131
+ My API returns:
132
+ {{myApiFields}}
133
+
134
+ Module expects:
135
+ {{moduleExpectedFields}}
136
+
137
+ Field mapping:
138
+ {{fieldMapping}}
139
+
140
+ Apply mapping in composable: use{{EntityName}}{{Type}}.ts
141
+ Transform data in {{transformLocation}}
142
+ ```
143
+
144
+ **Example:**
145
+ ```
146
+ My API returns:
147
+ - product_id → map to → id
148
+ - product_name → map to → name
149
+ - product_sku → map to → sku
150
+ - image_url → map to → imgSrc
151
+ - created_at → map to → createdDate
152
+ - is_active → map to → isActive
153
+
154
+ Apply in: useProductsList.ts
155
+ Transform in: loadProducts function after API call
156
+ ```
157
+
158
+ ---
159
+
160
+ ### Handle API Errors
161
+
162
+ ```
163
+ Update error handling in {{moduleName}} composables.
164
+
165
+ My API error structure:
166
+ {{errorStructure}}
167
+
168
+ Error handling:
169
+ - Show notification: {{showNotification}}
170
+ - Error message location: {{errorMessagePath}}
171
+ - Retry logic: {{retryLogic}}
172
+ - Fallback behavior: {{fallbackBehavior}}
173
+ ```
174
+
175
+ ---
176
+
177
+ ## Step 3: Customize Table UI
178
+
179
+ ### Add/Remove Columns
180
+
181
+ ```
182
+ Customize table columns in {{moduleName}} list blade.
183
+
184
+ Add columns:
185
+ {{columnsToAdd}}
186
+
187
+ Remove columns:
188
+ {{columnsToRemove}}
189
+
190
+ Reorder columns:
191
+ {{newColumnOrder}}
192
+
193
+ Update in: modules/{{module-name}}/pages/{{module-name}}-list.vue
194
+ Update locales: modules/{{module-name}}/locales/en.json
195
+ ```
196
+
197
+ **Example:**
198
+ ```
199
+ Add columns:
200
+ - name: "supplier", type: "text", sortable: true, width: "150px"
201
+ - name: "warehouse", type: "text", sortable: true, width: "120px"
202
+
203
+ Remove columns:
204
+ - "oldColumn1"
205
+ - "oldColumn2"
206
+
207
+ New order: image, name, supplier, sku, warehouse, price, status, createdDate
208
+ ```
209
+
210
+ ---
211
+
212
+ ### Change Column Types
213
+
214
+ ```
215
+ Change column display types in {{moduleName}} table.
216
+
217
+ Column changes:
218
+ {{columnTypeChanges}}
219
+
220
+ Update cell templates if needed:
221
+ {{cellTemplateChanges}}
222
+ ```
223
+
224
+ **Example:**
225
+ ```
226
+ Column changes:
227
+ - "status": from "text" to "status-icon" (green=active, gray=inactive)
228
+ - "price": from "text" to "currency" (format with $)
229
+ - "createdDate": from "text" to "date-ago" (relative time)
230
+
231
+ Create custom cell template for "status" if needed
232
+ ```
233
+
234
+ ---
235
+
236
+ ### Update Mobile View
237
+
238
+ ```
239
+ Update mobile column positions in {{moduleName}} table.
240
+
241
+ Mobile position changes:
242
+ {{mobilePositionChanges}}
243
+
244
+ Hide on mobile:
245
+ {{hideOnMobile}}
246
+ ```
247
+
248
+ **Example:**
249
+ ```
250
+ Mobile positions:
251
+ - "image": mobile-position="image"
252
+ - "name": mobile-position="top-right"
253
+ - "sku": mobile-position="bottom-left"
254
+ - "status": mobile-position="status"
255
+
256
+ Hide on mobile: supplier, warehouse, createdDate
257
+ ```
258
+
259
+ ---
260
+
261
+ ## Step 4: Customize Form
262
+
263
+ ### Add/Remove Form Fields
264
+
265
+ ```
266
+ Customize form fields in {{moduleName}} details blade.
267
+
268
+ Add fields:
269
+ {{fieldsToAdd}}
270
+
271
+ Remove fields:
272
+ {{fieldsToRemove}}
273
+
274
+ Update validation:
275
+ {{validationChanges}}
276
+
277
+ Update in: modules/{{module-name}}/pages/{{module-name}}-details.vue
278
+ Update interface: {{interfaceName}}
279
+ Update locales: modules/{{module-name}}/locales/en.json
280
+ ```
281
+
282
+ **Example:**
283
+ ```
284
+ Add fields:
285
+ - name: "supplier", component: "VcSelect", required: true, options: [...]
286
+ - name: "warehouse", component: "VcSelect", required: true, options: [...]
287
+ - name: "expiryDate", component: "VcInput", type: "date", required: false
288
+
289
+ Remove fields:
290
+ - "oldField1"
291
+ - "oldField2"
292
+
293
+ Validation:
294
+ - "supplier": required, custom validation for unique
295
+ - "expiryDate": min date = today
296
+ ```
297
+
298
+ ---
299
+
300
+ ### Change Field Components
301
+
302
+ ```
303
+ Change field component types in {{moduleName}} details blade.
304
+
305
+ Field changes:
306
+ {{fieldComponentChanges}}
307
+
308
+ Update props:
309
+ {{propsChanges}}
310
+ ```
311
+
312
+ **Example:**
313
+ ```
314
+ Field changes:
315
+ - "description": from VcInput to VcEditor (rich text)
316
+ - "category": from VcInput to VcSelect (dropdown with options)
317
+ - "active": from VcCheckbox to VcSwitch (toggle)
318
+
319
+ Update props:
320
+ - VcEditor: height="300px", enable: bold, italic, lists
321
+ - VcSelect: searchable, options from API, clearable
322
+ ```
323
+
324
+ ---
325
+
326
+ ### Rearrange Form Layout
327
+
328
+ ```
329
+ Rearrange form layout in {{moduleName}} details blade.
330
+
331
+ Layout type: {{layoutType}}
332
+ Sections:
333
+ {{formSections}}
334
+
335
+ Grouping:
336
+ {{fieldGrouping}}
337
+ ```
338
+
339
+ **Example:**
340
+ ```
341
+ Layout: two-column
342
+
343
+ Sections:
344
+ 1. Basic Information (name, sku, category)
345
+ 2. Inventory (quantity, warehouse, supplier)
346
+ 3. Pricing (price, cost, currency)
347
+ 4. Media (images, videos)
348
+
349
+ Left column: Basic Information, Inventory
350
+ Right column: Pricing
351
+ Full width: Media
352
+ ```
353
+
354
+ ---
355
+
356
+ ## Step 5: Add Functionality
357
+
358
+ ### Add Filters
359
+
360
+ ```
361
+ Add filters to {{moduleName}} list blade.
362
+
363
+ Filters:
364
+ {{filtersList}}
365
+
366
+ Filter implementation:
367
+ {{filterImplementation}}
368
+
369
+ Update composable: use{{EntityName}}List.ts
370
+ Update API call with filter parameters
371
+ ```
372
+
373
+ **Example:**
374
+ ```
375
+ Filters:
376
+ - Status filter: select, options: [active, inactive, all], default: all
377
+ - Category filter: select, options: from API, multiple selection
378
+ - Date range: from/to dates, presets: today, last week, last month
379
+
380
+ Pass filters to API:
381
+ - status → ?status={{value}}
382
+ - category → ?categoryId={{value}}
383
+ - dateRange → ?from={{startDate}}&to={{endDate}}
384
+ ```
385
+
386
+ ---
387
+
388
+ ### Add Bulk Operations
389
+
390
+ ```
391
+ Add bulk operations to {{moduleName}} list blade.
392
+
393
+ Operations:
394
+ {{bulkOperations}}
395
+
396
+ Implementation:
397
+ {{operationImplementation}}
398
+
399
+ Update composable with bulk action functions
400
+ Add toolbar buttons for bulk actions
401
+ Add confirmation dialogs
402
+ ```
403
+
404
+ **Example:**
405
+ ```
406
+ Operations:
407
+ - Bulk delete: delete selected items, show confirmation
408
+ - Bulk status update: change status for selected items
409
+ - Bulk export: export selected items to CSV/Excel
410
+
411
+ Toolbar buttons:
412
+ - "Delete Selected": disabled when no selection, danger style
413
+ - "Change Status": show dropdown with status options
414
+ - "Export": show format selection (CSV/Excel)
415
+ ```
416
+
417
+ ---
418
+
419
+ ### Add Widgets
420
+
421
+ ```
422
+ Add widgets to {{moduleName}} details blade.
423
+
424
+ Widgets:
425
+ {{widgetsList}}
426
+
427
+ Widget implementation:
428
+ {{widgetImplementation}}
429
+
430
+ Create widget components in: modules/{{module-name}}/components/widgets/
431
+ Register widgets in details blade using useWidgets()
432
+ ```
433
+
434
+ **Example:**
435
+ ```
436
+ Widgets:
437
+ 1. Related Items Widget
438
+ - Shows: count of related items
439
+ - Icon: material-link
440
+ - Click: opens related items list blade
441
+
442
+ 2. Activity Widget
443
+ - Shows: recent activity count
444
+ - Icon: material-history
445
+ - Click: opens activity log blade
446
+
447
+ 3. Analytics Widget
448
+ - Shows: views/sales count
449
+ - Icon: material-insights
450
+ - Click: opens analytics blade
451
+ ```
452
+
453
+ ---
454
+
455
+ ### Add Custom Actions
456
+
457
+ ```
458
+ Add custom actions to {{moduleName}}.
459
+
460
+ Actions:
461
+ {{customActions}}
462
+
463
+ Location: {{actionLocation}}
464
+ Implementation: {{actionImplementation}}
465
+ ```
466
+
467
+ **Example:**
468
+ ```
469
+ Actions:
470
+ 1. Duplicate: creates a copy of the item
471
+ - Location: toolbar in details blade
472
+ - Behavior: copy all fields, add "(Copy)" to name, save as new
473
+
474
+ 2. Archive: soft delete (set isArchived=true)
475
+ - Location: row actions menu in list
476
+ - Behavior: confirmation dialog, update status, hide from list
477
+
478
+ 3. Publish: change status to published
479
+ - Location: toolbar in details blade
480
+ - Behavior: validate required fields, update status, show notification
481
+ ```
482
+
483
+ ---
484
+
485
+ ## Step 6: Update Styling
486
+
487
+ ### Change Colors and Branding
488
+
489
+ ```
490
+ Update colors and branding in {{moduleName}}.
491
+
492
+ Color changes:
493
+ {{colorChanges}}
494
+
495
+ Icon changes:
496
+ {{iconChanges}}
497
+
498
+ Apply to:
499
+ {{applyLocations}}
500
+ ```
501
+
502
+ **Example:**
503
+ ```
504
+ Colors:
505
+ - Primary buttons: from blue to #00A651 (company green)
506
+ - Status "active": from default green to #00A651
507
+ - Danger buttons: keep default red
508
+
509
+ Icons:
510
+ - Module menu icon: from "material-inventory_2" to "material-store"
511
+ - Add button: from "material-add" to "material-add_circle"
512
+
513
+ Apply to:
514
+ - Module menu item in index.ts
515
+ - Toolbar buttons
516
+ - Status indicators
517
+ ```
518
+
519
+ ---
520
+
521
+ ### Update Spacing and Layout
522
+
523
+ ```
524
+ Update spacing and layout in {{moduleName}}.
525
+
526
+ Spacing changes:
527
+ {{spacingChanges}}
528
+
529
+ Layout changes:
530
+ {{layoutChanges}}
531
+ ```
532
+
533
+ **Example:**
534
+ ```
535
+ Spacing:
536
+ - Form field gap: from 16px to 24px
537
+ - Card padding: from 16px to 20px
538
+ - Table row height: from 48px to 56px
539
+
540
+ Layout:
541
+ - List blade width: from 50% to 60%
542
+ - Details blade width: from 50% to 70%
543
+ - Form max-width: 800px centered
544
+ ```
545
+
546
+ ---
547
+
548
+ ### Add Custom Styles
549
+
550
+ ```
551
+ Add custom CSS styles to {{moduleName}}.
552
+
553
+ Custom styles:
554
+ {{customStyles}}
555
+
556
+ Style location: {{styleLocation}}
557
+ Scope: {{styleScope}}
558
+ ```
559
+
560
+ ---
561
+
562
+ ## Step 7: Update Localization
563
+
564
+ ### Rename Module in UI
565
+
566
+ ```
567
+ Update module name and labels in {{moduleName}}.
568
+
569
+ New names:
570
+ {{nameChanges}}
571
+
572
+ Update in locales:
573
+ {{localeChanges}}
574
+
575
+ Update menu item: {{menuItemChanges}}
576
+ ```
577
+
578
+ **Example:**
579
+ ```
580
+ New names:
581
+ - Module title: from "Products" to "Inventory Items"
582
+ - Menu item: from "Products" to "Inventory"
583
+ - List title: from "My Products" to "Inventory Management"
584
+
585
+ Update locales:
586
+ - {{MODULE_NAME}}.MENU.TITLE = "Inventory"
587
+ - {{MODULE_NAME}}.PAGES.LIST.TITLE = "Inventory Management"
588
+ - {{MODULE_NAME}}.PAGES.DETAILS.TITLE = "Item Details"
589
+
590
+ Menu item in index.ts:
591
+ - title: "INVENTORY.MENU.TITLE"
592
+ - icon: "material-inventory"
593
+ ```
594
+
595
+ ---
596
+
597
+ ### Add Field Labels
598
+
599
+ ```
600
+ Add/update field labels in {{moduleName}}.
601
+
602
+ Field label changes:
603
+ {{fieldLabelChanges}}
604
+
605
+ Update in: modules/{{module-name}}/locales/en.json
606
+ ```
607
+
608
+ **Example:**
609
+ ```
610
+ Field labels:
611
+ - "supplier": label = "Supplier Name", placeholder = "Select supplier"
612
+ - "warehouse": label = "Warehouse Location", placeholder = "Select warehouse"
613
+ - "expiryDate": label = "Expiration Date", placeholder = "Select date"
614
+
615
+ Locale structure:
616
+ FIELDS.SUPPLIER.TITLE = "Supplier Name"
617
+ FIELDS.SUPPLIER.PLACEHOLDER = "Select supplier"
618
+ FIELDS.WAREHOUSE.TITLE = "Warehouse Location"
619
+ ...
620
+ ```
621
+
622
+ ---
623
+
624
+ ### Add Additional Languages
625
+
626
+ ```
627
+ Add {{language}} translation for {{moduleName}}.
628
+
629
+ Copy en.json structure to {{languageCode}}.json
630
+ Translate all keys
631
+ Register in locales/index.ts
632
+ ```
633
+
634
+ ---
635
+
636
+ ## Complete Example: Adapting Products Module
637
+
638
+ ### Scenario
639
+
640
+ You have VirtoCommerce Products module and want to adapt it for your inventory system with your own API.
641
+
642
+ ### Step-by-Step
643
+
644
+ **1. Get the module:**
645
+ ```bash
646
+ git clone https://github.com/VirtoCommerce/vc-shell temp
647
+ cp -r temp/apps/vendor-portal/src/modules/products src/modules/inventory
648
+ rm -rf temp
649
+ ```
650
+
651
+ **2. Connect to your API:**
652
+
653
+ Update `src/modules/inventory/composables/useInventoryList.ts`:
654
+ ```typescript
655
+ // Replace VirtoCommerce API client with your API
656
+ const loadItems = async () => {
657
+ const response = await fetch(`${API_URL}/inventory?skip=${skip}&take=${take}`);
658
+ const data = await response.json();
659
+
660
+ // Map your API response to module structure
661
+ return {
662
+ results: data.items.map(item => ({
663
+ id: item.inventory_id,
664
+ name: item.item_name,
665
+ sku: item.item_sku,
666
+ imgSrc: item.image_url,
667
+ quantity: item.stock_quantity,
668
+ warehouse: item.warehouse_name,
669
+ supplier: item.supplier_name,
670
+ isActive: item.is_active,
671
+ createdDate: item.created_at
672
+ })),
673
+ totalCount: data.total
674
+ };
675
+ };
676
+ ```
677
+
678
+ **3. Update table columns:**
679
+
680
+ In `src/modules/inventory/pages/inventory-list.vue`:
681
+ ```typescript
682
+ const tableColumns = ref<ITableColumns[]>([
683
+ // Keep existing: image, name, sku
684
+ // Add new columns:
685
+ {
686
+ id: "quantity",
687
+ title: computed(() => t("INVENTORY.PAGES.LIST.TABLE.HEADER.QUANTITY")),
688
+ sortable: true,
689
+ },
690
+ {
691
+ id: "warehouse",
692
+ title: computed(() => t("INVENTORY.PAGES.LIST.TABLE.HEADER.WAREHOUSE")),
693
+ sortable: true,
694
+ },
695
+ {
696
+ id: "supplier",
697
+ title: computed(() => t("INVENTORY.PAGES.LIST.TABLE.HEADER.SUPPLIER")),
698
+ sortable: true,
699
+ },
700
+ // Keep: isActive, createdDate
701
+ ]);
702
+ ```
703
+
704
+ **4. Update form fields:**
705
+
706
+ In `src/modules/inventory/pages/inventory-details.vue`:
707
+ ```vue
708
+ <!-- Keep existing: name, sku, description -->
709
+
710
+ <!-- Add new fields: -->
711
+ <Field name="quantity" rules="required|min_value:0">
712
+ <VcInput
713
+ v-model="item.quantity"
714
+ type="number"
715
+ :label="$t('INVENTORY.PAGES.DETAILS.FIELDS.QUANTITY.TITLE')"
716
+ required
717
+ />
718
+ </Field>
719
+
720
+ <Field name="warehouse" rules="required">
721
+ <VcSelect
722
+ v-model="item.warehouseId"
723
+ :label="$t('INVENTORY.PAGES.DETAILS.FIELDS.WAREHOUSE.TITLE')"
724
+ :options="warehouseOptions"
725
+ required
726
+ />
727
+ </Field>
728
+
729
+ <Field name="supplier" rules="required">
730
+ <VcSelect
731
+ v-model="item.supplierId"
732
+ :label="$t('INVENTORY.PAGES.DETAILS.FIELDS.SUPPLIER.TITLE')"
733
+ :options="supplierOptions"
734
+ required
735
+ />
736
+ </Field>
737
+ ```
738
+
739
+ **5. Update locales:**
740
+
741
+ In `src/modules/inventory/locales/en.json`:
742
+ ```json
743
+ {
744
+ "INVENTORY": {
745
+ "MENU": {
746
+ "TITLE": "Inventory"
747
+ },
748
+ "PAGES": {
749
+ "LIST": {
750
+ "TITLE": "Inventory Management",
751
+ "TABLE": {
752
+ "HEADER": {
753
+ "QUANTITY": "Quantity",
754
+ "WAREHOUSE": "Warehouse",
755
+ "SUPPLIER": "Supplier"
756
+ }
757
+ }
758
+ },
759
+ "DETAILS": {
760
+ "FIELDS": {
761
+ "QUANTITY": {
762
+ "TITLE": "Quantity",
763
+ "PLACEHOLDER": "Enter quantity"
764
+ },
765
+ "WAREHOUSE": {
766
+ "TITLE": "Warehouse Location",
767
+ "PLACEHOLDER": "Select warehouse"
768
+ },
769
+ "SUPPLIER": {
770
+ "TITLE": "Supplier",
771
+ "PLACEHOLDER": "Select supplier"
772
+ }
773
+ }
774
+ }
775
+ }
776
+ }
777
+ }
778
+ ```
779
+
780
+ **6. Register module:**
781
+
782
+ In `src/main.ts`:
783
+ ```typescript
784
+ import inventoryModule from "./modules/inventory";
785
+
786
+ app.use(inventoryModule);
787
+ ```
788
+
789
+ **7. Test and format:**
790
+ ```bash
791
+ yarn serve
792
+ # Test all functionality
793
+ yarn lint --fix
794
+ yarn format
795
+ ```
796
+
797
+ ---
798
+
799
+ ## Adaptation Checklist
800
+
801
+ Use this checklist to ensure you've adapted everything:
802
+
803
+ ### Module Structure
804
+ - [ ] Module files copied to correct location
805
+ - [ ] Files/folders renamed if needed
806
+ - [ ] Module registered in main.ts
807
+ - [ ] Routes configured
808
+
809
+ ### API Integration
810
+ - [ ] API client replaced or configured
811
+ - [ ] Endpoints updated in all composables
812
+ - [ ] API response mapped to module structure
813
+ - [ ] API request payload mapped from module data
814
+ - [ ] Error handling updated
815
+ - [ ] Authentication handled
816
+
817
+ ### UI - List Blade
818
+ - [ ] Table columns added/removed
819
+ - [ ] Column types updated
820
+ - [ ] Column order adjusted
821
+ - [ ] Mobile column positions configured
822
+ - [ ] Sorting configured
823
+ - [ ] Empty/not found states updated
824
+
825
+ ### UI - Details Blade
826
+ - [ ] Form fields added/removed
827
+ - [ ] Field components updated
828
+ - [ ] Validation rules updated
829
+ - [ ] Form layout adjusted
830
+ - [ ] Field grouping/sections added
831
+
832
+ ### Functionality
833
+ - [ ] Filters added/updated
834
+ - [ ] Bulk operations implemented
835
+ - [ ] Widgets added
836
+ - [ ] Custom actions added
837
+ - [ ] Toolbar buttons updated
838
+
839
+ ### Styling
840
+ - [ ] Colors updated
841
+ - [ ] Icons changed
842
+ - [ ] Spacing adjusted
843
+ - [ ] Custom styles added
844
+ - [ ] Mobile responsiveness checked
845
+
846
+ ### Localization
847
+ - [ ] Module name updated
848
+ - [ ] All locale keys added
849
+ - [ ] Field labels updated
850
+ - [ ] Error messages updated
851
+ - [ ] Additional languages added (if needed)
852
+
853
+ ### TypeScript
854
+ - [ ] Interfaces updated
855
+ - [ ] Types aligned with API
856
+ - [ ] No TypeScript errors
857
+ - [ ] Props/emits defined
858
+
859
+ ### Testing
860
+ - [ ] List blade loads data
861
+ - [ ] Details blade opens/closes
862
+ - [ ] Create new item works
863
+ - [ ] Update item works
864
+ - [ ] Delete item works
865
+ - [ ] Validation works
866
+ - [ ] Search works
867
+ - [ ] Filters work
868
+ - [ ] Sorting works
869
+ - [ ] Pagination works
870
+
871
+ ### Final Steps
872
+ - [ ] Code formatted (Prettier)
873
+ - [ ] Linter passed
874
+ - [ ] Type check passed
875
+ - [ ] Console has no errors
876
+ - [ ] Tested on mobile
877
+ - [ ] Documentation updated
878
+
879
+ ---
880
+
881
+ ## Common Patterns
882
+
883
+ ### Pattern 1: Replace VirtoCommerce API with Custom REST API
884
+
885
+ ```typescript
886
+ // Before (VirtoCommerce):
887
+ const { getApiClient } = useApiClient(ProductsClient);
888
+ const client = await getApiClient();
889
+ const result = await client.searchProducts(searchQuery);
890
+
891
+ // After (Custom REST API):
892
+ const response = await fetch(`${API_URL}/products?${new URLSearchParams(searchQuery)}`);
893
+ const result = await response.json();
894
+
895
+ // Map response:
896
+ return {
897
+ results: result.data.map(item => ({
898
+ id: item.product_id,
899
+ name: item.product_name,
900
+ // ... other fields
901
+ })),
902
+ totalCount: result.total
903
+ };
904
+ ```
905
+
906
+ ---
907
+
908
+ ### Pattern 2: Add Custom Filter
909
+
910
+ ```typescript
911
+ // 1. Add filter state
912
+ const selectedCategory = ref<string | null>(null);
913
+
914
+ // 2. Add to search query
915
+ const searchQuery = ref({
916
+ skip: 0,
917
+ take: 20,
918
+ keyword: "",
919
+ categoryId: null, // Add filter
920
+ });
921
+
922
+ // 3. Update load function
923
+ const loadItems = async () => {
924
+ const params = {
925
+ ...searchQuery.value,
926
+ ...(selectedCategory.value && { categoryId: selectedCategory.value })
927
+ };
928
+ // ... API call with params
929
+ };
930
+
931
+ // 4. Add filter UI in template
932
+ <VcSelect
933
+ v-model="selectedCategory"
934
+ :options="categoryOptions"
935
+ placeholder="Filter by category"
936
+ clearable
937
+ @update:model-value="loadItems"
938
+ />
939
+ ```
940
+
941
+ ---
942
+
943
+ ### Pattern 3: Add Widget
944
+
945
+ ```typescript
946
+ // 1. Create widget component
947
+ // modules/{{module}}/components/widgets/my-widget/my-widget.vue
948
+
949
+ // 2. Register in details blade
950
+ import { useWidgets } from "@vc-shell/framework";
951
+ import MyWidget from "../components/widgets/my-widget/my-widget.vue";
952
+
953
+ const { registerWidget, unregisterWidget } = useWidgets();
954
+
955
+ onMounted(() => {
956
+ registerWidget({
957
+ id: "myWidget",
958
+ component: markRaw(MyWidget),
959
+ // ... widget config
960
+ });
961
+ });
962
+
963
+ onBeforeUnmount(() => {
964
+ unregisterWidget("myWidget");
965
+ });
966
+ ```
967
+
968
+ ---
969
+
970
+ ## Troubleshooting
971
+
972
+ ### Module Not Showing in Menu
973
+
974
+ **Problem:** Module copied but doesn't appear in navigation
975
+
976
+ **Solution:**
977
+ 1. Check module is registered in `main.ts`
978
+ 2. Check `defineOptions` in list blade has `isWorkspace: true`
979
+ 3. Check `menuItem` configuration in `defineOptions`
980
+ 4. Restart dev server
981
+
982
+ ---
983
+
984
+ ### API Calls Failing
985
+
986
+ **Problem:** API integration not working
987
+
988
+ **Solution:**
989
+ 1. Check API URL and endpoints
990
+ 2. Verify response structure matches expected
991
+ 3. Check network tab in browser DevTools
992
+ 4. Add console.log to see actual API response
993
+ 5. Verify authentication/headers
994
+
995
+ ---
996
+
997
+ ### Missing Translations
998
+
999
+ **Problem:** UI shows locale keys instead of text
1000
+
1001
+ **Solution:**
1002
+ 1. Check locale file exists: `modules/{{module}}/locales/en.json`
1003
+ 2. Verify locale structure matches keys used in templates
1004
+ 3. Check module exports locales in `locales/index.ts`
1005
+ 4. Restart dev server after locale changes
1006
+
1007
+ ---
1008
+
1009
+ ### TypeScript Errors
1010
+
1011
+ **Problem:** TypeScript compilation errors
1012
+
1013
+ **Solution:**
1014
+ 1. Update interface definitions to match API
1015
+ 2. Add missing properties to interfaces
1016
+ 3. Use correct types for props/emits
1017
+ 4. Run `yarn type-check` to see all errors
1018
+
1019
+ ---
1020
+
1021
+ ## Need More Help?
1022
+
1023
+ - **Simple modifications**: See `simple-modifications.md`
1024
+ - **Complete workflow**: See `guides/complete-workflow.md`
1025
+ - **Troubleshooting**: See `guides/troubleshooting.md`
1026
+ - **API client generation**: See `api-client-generation.md`