@fayz-ai/plugin-inventory 0.16.2 → 0.18.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 (79) hide show
  1. package/README.md +2 -0
  2. package/dist/components/InventorySettings.d.ts.map +1 -1
  3. package/dist/context.d.ts +3 -3
  4. package/dist/context.d.ts.map +1 -1
  5. package/dist/index.d.ts +25 -9
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1298 -4204
  8. package/dist/index.js.map +1 -1
  9. package/dist/locales/en.d.ts.map +1 -1
  10. package/dist/locales/pt-BR.d.ts.map +1 -1
  11. package/dist/views/InventoryPage.d.ts +2 -2
  12. package/dist/views/InventoryPage.d.ts.map +1 -1
  13. package/dist/views/MovementHistoryView.d.ts.map +1 -1
  14. package/dist/views/ProductBarcodesTab.d.ts +1 -1
  15. package/dist/views/ProductBarcodesTab.d.ts.map +1 -1
  16. package/dist/views/ProductComplementsTab.d.ts +1 -1
  17. package/dist/views/ProductComplementsTab.d.ts.map +1 -1
  18. package/dist/views/ProductCrudForm.d.ts.map +1 -1
  19. package/dist/views/ProductRecipeTab.d.ts +1 -1
  20. package/dist/views/ProductRecipeTab.d.ts.map +1 -1
  21. package/dist/views/ProductStockTab.d.ts +1 -1
  22. package/dist/views/ProductStockTab.d.ts.map +1 -1
  23. package/dist/views/ProductVariantsTab.d.ts +1 -1
  24. package/dist/views/ProductVariantsTab.d.ts.map +1 -1
  25. package/dist/views/StockCountFormView.d.ts.map +1 -1
  26. package/dist/views/StockCountSessionView.d.ts.map +1 -1
  27. package/dist/views/StockMovementView.d.ts +1 -1
  28. package/dist/views/StockMovementView.d.ts.map +1 -1
  29. package/dist/views/StockPanelView.d.ts.map +1 -1
  30. package/dist/views/dashboardWidgets.d.ts +2 -2
  31. package/dist/views/dashboardWidgets.d.ts.map +1 -1
  32. package/dist/views/productEntity.d.ts +2 -2
  33. package/dist/views/productEntity.d.ts.map +1 -1
  34. package/dist/views/recipe/GenerateImageDialog.d.ts +1 -1
  35. package/dist/views/recipe/GenerateImageDialog.d.ts.map +1 -1
  36. package/dist/views/recipe/IngredientCostDialog.d.ts +1 -1
  37. package/dist/views/recipe/IngredientCostDialog.d.ts.map +1 -1
  38. package/dist/views/recipe/QuickIngredientDialog.d.ts +2 -1
  39. package/dist/views/recipe/QuickIngredientDialog.d.ts.map +1 -1
  40. package/dist/views/recipe/RecipeAiDialog.d.ts +2 -1
  41. package/dist/views/recipe/RecipeAiDialog.d.ts.map +1 -1
  42. package/dist/views/recipe/RecipeEditor.d.ts +1 -1
  43. package/dist/views/recipe/RecipeEditor.d.ts.map +1 -1
  44. package/dist/views/recipe/TransformIntermediateDialog.d.ts +2 -1
  45. package/dist/views/recipe/TransformIntermediateDialog.d.ts.map +1 -1
  46. package/dist/views/recipe/exportRecipesXlsx.d.ts +1 -1
  47. package/dist/views/recipe/exportRecipesXlsx.d.ts.map +1 -1
  48. package/dist/views/recipe/printRecipe.d.ts +2 -2
  49. package/dist/views/recipe/printRecipe.d.ts.map +1 -1
  50. package/dist/views/recipe/shared.d.ts.map +1 -1
  51. package/package.json +5 -4
  52. package/dist/data/index.d.ts +0 -3
  53. package/dist/data/index.d.ts.map +0 -1
  54. package/dist/data/mock.d.ts +0 -3
  55. package/dist/data/mock.d.ts.map +0 -1
  56. package/dist/data/reference-data.d.ts +0 -37
  57. package/dist/data/reference-data.d.ts.map +0 -1
  58. package/dist/data/supabase.d.ts +0 -3
  59. package/dist/data/supabase.d.ts.map +0 -1
  60. package/dist/data/tables.d.ts +0 -27
  61. package/dist/data/tables.d.ts.map +0 -1
  62. package/dist/data/types.d.ts +0 -150
  63. package/dist/data/types.d.ts.map +0 -1
  64. package/dist/lib/idempotency.d.ts +0 -2
  65. package/dist/lib/idempotency.d.ts.map +0 -1
  66. package/dist/lib/movement-vocabulary.d.ts +0 -30
  67. package/dist/lib/movement-vocabulary.d.ts.map +0 -1
  68. package/dist/lib/recipe-cost.d.ts +0 -28
  69. package/dist/lib/recipe-cost.d.ts.map +0 -1
  70. package/dist/lib/stock-count.d.ts +0 -22
  71. package/dist/lib/stock-count.d.ts.map +0 -1
  72. package/dist/lib/stock-health.d.ts +0 -14
  73. package/dist/lib/stock-health.d.ts.map +0 -1
  74. package/dist/lib/tenant.d.ts +0 -3
  75. package/dist/lib/tenant.d.ts.map +0 -1
  76. package/dist/store.d.ts +0 -55
  77. package/dist/store.d.ts.map +0 -1
  78. package/dist/types.d.ts +0 -825
  79. package/dist/types.d.ts.map +0 -1
package/dist/types.d.ts DELETED
@@ -1,825 +0,0 @@
1
- /** Product classification — a product can have multiple types */
2
- export type ProductType = 'ingredient' | 'sale' | 'intermediate' | 'asset';
3
- /** Stock movement direction/reason */
4
- export type MovementType = 'entry' | 'exit' | 'adjustment' | 'transfer' | 'loss';
5
- /** Product purpose for filtering */
6
- export type ProductPurpose = 'purchase' | 'sale' | 'both' | 'internal';
7
- /** Life of a physical count. `counting` starts at the first entry typed. */
8
- export type CountSessionStatus = 'open' | 'counting' | 'closed' | 'cancelled';
9
- export interface ProductClassification {
10
- /** Aparece nas fichas técnicas. */
11
- isIngredient: boolean;
12
- /** Cardápio, PDV, catálogo. */
13
- isForSale: boolean;
14
- /** Produzido para consumir depois (molho, massa). */
15
- isIntermediate: boolean;
16
- /** Equipamento: entra no balanço patrimonial, não se consome. */
17
- isAsset: boolean;
18
- /** Habilita a ficha técnica — o produto nasce de uma receita. */
19
- isProduced: boolean;
20
- /** Destinado à revenda ao cliente final. */
21
- isResale: boolean;
22
- /** Alto custo: cada unidade é acompanhada individualmente. */
23
- trackByUnitLabel: boolean;
24
- }
25
- /** A ficha do insumo: o que a compra precisa saber. */
26
- export interface ProductIngredientInfo {
27
- minimumQuantity?: number;
28
- maximumQuantity?: number;
29
- /** Saldo em que a compra deve ser disparada — fica ACIMA do mínimo. */
30
- reorderPoint?: number;
31
- leadTimeDays?: number;
32
- shelfLifeDays?: number;
33
- storageTemperature?: string;
34
- allowedSupplierIds?: string[];
35
- notes?: string;
36
- }
37
- /** A ficha de venda: o que o cardápio e o balcão precisam saber. */
38
- export interface ProductSaleInfo {
39
- menuDescription?: string;
40
- allergens?: string;
41
- preparationTimeMinutes?: number;
42
- servesQuantity?: number;
43
- calories?: number;
44
- soldByWeight?: boolean;
45
- highlightDelivery?: boolean;
46
- availableForDelivery?: boolean;
47
- availableForCounter?: boolean;
48
- notes?: string;
49
- }
50
- /** Preço por canal de venda. O canal é texto: cada praça tem os seus. */
51
- export interface ProductSaleChannel {
52
- channel: string;
53
- price: number;
54
- active?: boolean;
55
- }
56
- export interface ProductIntermediateInfo {
57
- yieldPercentage?: number;
58
- preparationTimeMinutes?: number;
59
- shelfLifeHours?: number;
60
- batchSize?: number;
61
- batchUnitId?: string;
62
- storageInstructions?: string;
63
- notes?: string;
64
- }
65
- export interface ProductAssetInfo {
66
- assetValue?: number;
67
- residualValue?: number;
68
- usefulLifeMonths?: number;
69
- depreciationRate?: number;
70
- serialNumber?: string;
71
- acquisitionDate?: string;
72
- warrantyExpiryDate?: string;
73
- assetStatus?: string;
74
- assetLocation?: string;
75
- responsiblePersonId?: string;
76
- insurancePolicy?: string;
77
- lastMaintenanceDate?: string;
78
- nextMaintenanceDate?: string;
79
- notes?: string;
80
- }
81
- /**
82
- * Tributos do produto — a EXCEÇÃO ao grupo fiscal, não a cópia dele.
83
- * `undefined` quer dizer «vale o que o grupo diz», nunca zero.
84
- */
85
- export interface ProductTaxInfo {
86
- taxGroupId?: string;
87
- ncm?: string;
88
- cest?: string;
89
- icmsOrigin?: string;
90
- icmsRate?: number;
91
- cfop?: string;
92
- cst?: string;
93
- pisSituation?: string;
94
- pisRate?: number;
95
- cofinsSituation?: string;
96
- cofinsRate?: number;
97
- baseCalculationMode?: string;
98
- benefitCode?: string;
99
- povertyFundRate?: number;
100
- ibsCbsSituation?: string;
101
- ibsCbsClassification?: string;
102
- }
103
- export interface ProductBarcode {
104
- id?: string;
105
- barcode: string;
106
- barcodeType?: string;
107
- description?: string;
108
- isPrimary?: boolean;
109
- }
110
- /** One sellable form of a product (size, colour). The default one stands for a product with none. */
111
- export interface ProductVariant {
112
- id: string;
113
- name: string;
114
- sku?: string;
115
- isDefault: boolean;
116
- isActive: boolean;
117
- /** Units in stock across the units the person can see. */
118
- onHand: number;
119
- }
120
- /** Os campos dos Dados Gerais do V1 que não cabiam em nenhuma ficha. */
121
- export interface ProductGeneralExtras {
122
- /** % que o profissional ganha ao vender este produto. */
123
- commissionPercent?: number;
124
- /** Conta de despesa do plano de contas. */
125
- chartAccountId?: string;
126
- /** Quanto de `contentUnitId` cabe em UMA unidade de estoque. */
127
- contentPerUnit?: number;
128
- contentUnitId?: string;
129
- /** Custo médio, reescrito a cada entrada de estoque. */
130
- avgPurchasePrice?: number;
131
- avgPurchasePriceUpdatedAt?: string;
132
- professionalResalePrice?: number;
133
- /** Trava a entrada de estoque sem número de lote. */
134
- requireBatchForStock?: boolean;
135
- /** Trava a entrada de estoque sem data de validade. */
136
- requireExpiryForStock?: boolean;
137
- }
138
- export interface Product {
139
- id: string;
140
- name: string;
141
- description?: string;
142
- sku?: string;
143
- barcode?: string;
144
- brand?: string;
145
- categoryId?: string;
146
- categoryName?: string;
147
- productType: ProductType;
148
- purpose?: ProductPurpose;
149
- /** Os sete interruptores do V1. `productType` é derivado deles. */
150
- classification?: ProductClassification;
151
- ingredientInfo?: ProductIngredientInfo;
152
- saleInfo?: ProductSaleInfo;
153
- saleChannels?: ProductSaleChannel[];
154
- intermediateInfo?: ProductIntermediateInfo;
155
- assetInfo?: ProductAssetInfo;
156
- taxInfo?: ProductTaxInfo;
157
- currentQuantity: number;
158
- minQuantity: number;
159
- maxQuantity?: number;
160
- costPrice: number;
161
- salePrice?: number;
162
- measurementUnitId?: string;
163
- measurementUnitName?: string;
164
- /** Unit the product is bought in, when it differs from the one it is counted in. */
165
- purchaseUnitId?: string;
166
- /** How many measurement units fit in one purchase unit. 1 when they are the same. */
167
- conversionFactor?: number;
168
- isActive: boolean;
169
- supplierId?: string;
170
- supplierName?: string;
171
- defaultLocationId?: string;
172
- imageUrl?: string;
173
- extras?: ProductGeneralExtras;
174
- metadata?: Record<string, unknown>;
175
- tenantId: string;
176
- createdAt: string;
177
- updatedAt: string;
178
- }
179
- export interface StockMovement {
180
- id: string;
181
- productId: string;
182
- productName?: string;
183
- quantity: number;
184
- movementType: MovementType;
185
- unitCost: number;
186
- totalCost: number;
187
- stockLocationId?: string;
188
- stockLocationName?: string;
189
- destinationLocationId?: string;
190
- destinationLocationName?: string;
191
- supplierId?: string;
192
- supplierName?: string;
193
- documentNumber?: string;
194
- /** `nfe`, `manual`, `transfer`… — é o que diz se o documento é abrível. */
195
- documentType?: string;
196
- /**
197
- * A operação de estoque que criou este movimento. É o caminho de volta ao
198
- * documento de origem: `plg_fiscalbr_inbox_documents.inventory_operation_id`
199
- * aponta para a mesma operação, e é por aqui que a linha abre a nota.
200
- */
201
- operationId?: string;
202
- measurementUnitId?: string;
203
- /** `UN`, `KG`, `CX` — o V1 escreve «12 SR» e a V2 escrevia só «12». */
204
- measurementUnitAbbreviation?: string;
205
- reason?: string;
206
- notes?: string;
207
- batchNumber?: string;
208
- expirationDate?: string;
209
- movementDate: string;
210
- userId?: string;
211
- userName?: string;
212
- metadata?: Record<string, unknown>;
213
- tenantId: string;
214
- createdAt: string;
215
- }
216
- export interface StockPosition {
217
- id: string;
218
- productId: string;
219
- productName?: string;
220
- quantity: number;
221
- unitCost: number;
222
- stockLocationId?: string;
223
- stockLocationName?: string;
224
- batchNumber?: string;
225
- expirationDate?: string;
226
- measurementUnitId?: string;
227
- /** Which of the product's units this quantity is counted in. */
228
- unitType?: 'base' | 'purchase' | 'content';
229
- tenantId: string;
230
- createdAt: string;
231
- updatedAt?: string;
232
- }
233
- /** O recorte do PAINEL DE ESTOQUE — o «Painel» do inventário do V1. */
234
- export interface StockPanelQuery {
235
- stockLocationId?: string;
236
- categoryId?: string;
237
- /** Nome ou código do produto. */
238
- productSearch?: string;
239
- batch?: string;
240
- expiry?: 'all' | 'expired' | 'le30' | 'le60' | 'le90' | 'none';
241
- /** Vazio = todos. */
242
- status?: StockHealth[];
243
- limit?: number;
244
- }
245
- /**
246
- * Como o estoque de uma linha está em relação ao mínimo do produto.
247
- *
248
- * `negative` existe porque o razão permite chegar lá (uma saída lançada antes
249
- * da entrada que a alimenta), e é a linha que alguém precisa ver primeiro.
250
- */
251
- export type StockHealth = 'negative' | 'zero' | 'below_min' | 'ok';
252
- /** Uma linha do painel: produto × local × lote × validade. */
253
- export interface StockPanelRow {
254
- id: string;
255
- productId: string;
256
- productName: string;
257
- categoryId?: string;
258
- categoryName?: string;
259
- stockLocationId?: string;
260
- stockLocationName?: string;
261
- batchNumber?: string;
262
- expirationDate?: string;
263
- quantity: number;
264
- minQuantity: number;
265
- unitCost: number;
266
- totalValue: number;
267
- health: StockHealth;
268
- }
269
- export interface StockLocation {
270
- id: string;
271
- name: string;
272
- description?: string;
273
- isActive: boolean;
274
- unitId?: string;
275
- tenantId: string;
276
- createdAt: string;
277
- updatedAt: string;
278
- }
279
- /** A physical count of one stock location, open through closed. */
280
- export interface StockCountSession {
281
- id: string;
282
- reference?: string;
283
- status: CountSessionStatus;
284
- stockLocationId: string;
285
- stockLocationName?: string;
286
- categoryId?: string;
287
- categoryName?: string;
288
- /** Hides the system quantity while counting. */
289
- blind: boolean;
290
- notes?: string;
291
- itemCount?: number;
292
- countedCount?: number;
293
- divergentCount?: number;
294
- openedAt: string;
295
- closedAt?: string;
296
- tenantId: string;
297
- createdAt: string;
298
- updatedAt: string;
299
- }
300
- export interface StockCountItem {
301
- id: string;
302
- sessionId: string;
303
- productId: string;
304
- productName?: string;
305
- productSku?: string;
306
- /** What the system believed when the session opened — never re-read. */
307
- systemQuantity: number;
308
- /** undefined means nobody counted this line. It is not zero. */
309
- countedQuantity?: number;
310
- unitCost: number;
311
- notes?: string;
312
- countedAt?: string;
313
- /** The adjustment this line already emitted, if the session is closed. */
314
- movementId?: string;
315
- tenantId: string;
316
- createdAt: string;
317
- updatedAt: string;
318
- }
319
- export interface Recipe {
320
- id: string;
321
- name: string;
322
- description?: string;
323
- productId: string;
324
- productName?: string;
325
- /** Sale price of the produced product — the denominator of CMV%. */
326
- productSalePrice?: number;
327
- yieldQuantity: number;
328
- yieldUnitId?: string;
329
- yieldUnitName?: string;
330
- /** portion = the sheet is one unit sold; batch = the sheet produces the yield. */
331
- yieldMode?: 'portion' | 'batch';
332
- preparationTimeMinutes?: number;
333
- instructions?: string;
334
- isActive: boolean;
335
- ingredientCount?: number;
336
- /** Carries what the assistant could not resolve — see RecipeGaps. */
337
- metadata?: Record<string, unknown>;
338
- tenantId: string;
339
- createdAt: string;
340
- updatedAt: string;
341
- }
342
- /** What an ingredient product contributes to a recipe line's cost. */
343
- export interface IngredientCostBasis {
344
- /** `products.cost` — the catalogue's cost for the product. */
345
- cost: number;
346
- /** Base units per purchase unit, from plg_inventory_product_details. */
347
- conversionFactor?: number;
348
- /** Set only when the product is bought in a unit other than the counted one. */
349
- purchaseUnitId?: string;
350
- }
351
- /** An ingredient the assistant proposed but could not match to the catalogue. */
352
- export interface RecipeGaps {
353
- unmatchedIngredients?: Array<{
354
- name?: string;
355
- quantity?: number;
356
- notes?: string;
357
- }>;
358
- /** Name of the produced product when it did not resolve to a catalogue row. */
359
- productHint?: string;
360
- }
361
- export interface RecipeIngredient {
362
- id: string;
363
- recipeId: string;
364
- productId: string;
365
- productName?: string;
366
- quantity: number;
367
- unitId?: string;
368
- unitName?: string;
369
- displayOrder: number;
370
- notes?: string;
371
- /** Reading unit of the line; quantity itself stays in the base unit. */
372
- displayUnitId?: string;
373
- /** Optional stage of the recipe this ingredient belongs to. */
374
- groupId?: string;
375
- groupName?: string;
376
- costBasis?: IngredientCostBasis;
377
- createdAt: string;
378
- }
379
- /** A stage of a recipe — "massa", "recheio", "montagem". */
380
- export interface RecipeGroup {
381
- id: string;
382
- recipeId: string;
383
- name: string;
384
- preparationNotes?: string;
385
- displayOrder: number;
386
- estimatedMinutes?: number;
387
- stationId?: string;
388
- tenantId: string;
389
- createdAt: string;
390
- updatedAt: string;
391
- }
392
- /** Who the operation buys from — the read shape of the supplier registry. */
393
- export interface Supplier {
394
- id: string;
395
- name: string;
396
- documentNumber?: string;
397
- phone?: string;
398
- }
399
- export interface MeasurementUnit {
400
- id: string;
401
- name: string;
402
- abbreviation: string;
403
- isActive: boolean;
404
- tenantId: string;
405
- createdAt: string;
406
- }
407
- export interface ProductCategory {
408
- id: string;
409
- name: string;
410
- parentId?: string;
411
- isActive: boolean;
412
- tenantId: string;
413
- createdAt: string;
414
- updatedAt: string;
415
- }
416
- export interface CreateProductInput {
417
- name: string;
418
- description?: string;
419
- sku?: string;
420
- barcode?: string;
421
- brand?: string;
422
- categoryId?: string;
423
- productType: ProductType;
424
- purpose?: ProductPurpose;
425
- minQuantity?: number;
426
- maxQuantity?: number;
427
- costPrice?: number;
428
- salePrice?: number;
429
- measurementUnitId?: string;
430
- purchaseUnitId?: string;
431
- conversionFactor?: number;
432
- supplierId?: string;
433
- defaultLocationId?: string;
434
- imageUrl?: string;
435
- classification?: Partial<ProductClassification>;
436
- extras?: ProductGeneralExtras;
437
- ingredientInfo?: ProductIngredientInfo;
438
- saleInfo?: ProductSaleInfo;
439
- saleChannels?: ProductSaleChannel[];
440
- intermediateInfo?: ProductIntermediateInfo;
441
- assetInfo?: ProductAssetInfo;
442
- taxInfo?: ProductTaxInfo;
443
- metadata?: Record<string, unknown>;
444
- }
445
- export interface CreateStockMovementInput {
446
- productId: string;
447
- quantity: number;
448
- movementType: MovementType;
449
- unitCost?: number;
450
- stockLocationId?: string;
451
- destinationLocationId?: string;
452
- supplierId?: string;
453
- documentNumber?: string;
454
- reason?: string;
455
- notes?: string;
456
- movementDate?: string;
457
- batchNumber?: string;
458
- expirationDate?: string;
459
- /** Stable for every retry of the same operator action. */
460
- idempotencyKey?: string;
461
- }
462
- export interface OpenStockCountInput {
463
- stockLocationId: string;
464
- categoryId?: string;
465
- reference?: string;
466
- blind?: boolean;
467
- notes?: string;
468
- }
469
- export interface CloseStockCountResult {
470
- sessionId: string;
471
- adjustmentsCreated: number;
472
- /** True when the session was already closed — nothing was emitted again. */
473
- alreadyClosed: boolean;
474
- }
475
- export type RecipeOutputType = 'main' | 'coproduct' | 'byproduct' | 'waste';
476
- /** A product a sheet yields besides (or instead of) its own product. */
477
- export interface RecipeOutput {
478
- id?: string;
479
- productId: string;
480
- productName?: string;
481
- outputType: RecipeOutputType;
482
- expectedQuantity: number;
483
- measurementUnitId?: string;
484
- /** % of the order cost; null on every line = split by market value. */
485
- costShare?: number | null;
486
- }
487
- export interface MeasurementUnit {
488
- id: string;
489
- name: string;
490
- abbreviation: string;
491
- }
492
- export interface ProductionStation {
493
- id: string;
494
- name: string;
495
- unitId?: string;
496
- }
497
- /** What an ingredient brings to a sheet line: its cost and its base unit. */
498
- export interface IngredientInfo {
499
- productId: string;
500
- name: string;
501
- /** Cost of one base unit — `products.cost`. */
502
- cost: number;
503
- /** The unit the stored quantity is in. Falls back to the unit the product
504
- * already has on other sheet lines when the catalogue row carries none. */
505
- baseUnitId?: string;
506
- }
507
- /** The whole sheet as the editor reads and writes it. */
508
- export interface RecipeSheet {
509
- id?: string;
510
- productId: string;
511
- name: string;
512
- description?: string;
513
- yieldQuantity: number;
514
- yieldUnitId?: string;
515
- yieldMode: 'portion' | 'batch';
516
- preparationTimeMinutes?: number;
517
- instructions?: string;
518
- groups: RecipeSheetGroup[];
519
- outputs: RecipeOutput[];
520
- }
521
- export interface RecipeSheetGroup {
522
- name: string;
523
- stationId?: string;
524
- preparationNotes?: string;
525
- estimatedMinutes?: number;
526
- ingredients: RecipeSheetLine[];
527
- }
528
- export interface RecipeSheetLine {
529
- productId: string;
530
- /** In the ingredient's base unit. */
531
- quantity: number;
532
- unitId?: string;
533
- displayUnitId?: string;
534
- notes?: string;
535
- }
536
- /** One row of the Fichas Técnicas list: every produced product, sheet or not. */
537
- export interface RecipeListRow {
538
- productId: string;
539
- productName: string;
540
- imageUrl?: string;
541
- categoryName?: string;
542
- isForSale: boolean;
543
- isIntermediate: boolean;
544
- recipeId?: string;
545
- description?: string;
546
- ingredientCount: number;
547
- yieldQuantity?: number;
548
- yieldUnitAbbr?: string;
549
- preparationTimeMinutes?: number;
550
- /** Cost of the whole sheet (sum of lines). */
551
- cost: number;
552
- salePrice: number;
553
- }
554
- /** A whole sheet as the spreadsheet export lays it out. */
555
- export interface RecipeExportSheet {
556
- productId: string;
557
- productName: string;
558
- categoryName?: string;
559
- salePrice: number;
560
- /** False for a produced product still waiting for its sheet. */
561
- hasSheet: boolean;
562
- yieldQuantity?: number;
563
- yieldUnitAbbr?: string;
564
- preparationTimeMinutes?: number;
565
- groups: Array<{
566
- name: string;
567
- lines: Array<{
568
- ingredientId: string;
569
- ingredientName: string;
570
- ingredientSku?: string;
571
- unitAbbr?: string;
572
- quantity: number;
573
- unitCost: number;
574
- }>;
575
- }>;
576
- }
577
- /** A product a sheet can be made for — sold, intermediate or already produced. */
578
- export interface RecipeCandidate {
579
- productId: string;
580
- name: string;
581
- imageUrl?: string;
582
- categoryName?: string;
583
- salePrice: number;
584
- kind: 'sale' | 'intermediate' | 'produced';
585
- hasRecipe: boolean;
586
- }
587
- export interface RecipeAiSuggestion {
588
- yieldQuantity?: number;
589
- yieldUnitId?: string;
590
- preparationTimeMinutes?: number;
591
- generalDescription?: string;
592
- groups: Array<{
593
- name: string;
594
- stationId?: string;
595
- preparationNotes?: string;
596
- ingredients: Array<{
597
- productId?: string;
598
- productNameHint?: string;
599
- quantity: number;
600
- unitId?: string;
601
- notes?: string;
602
- }>;
603
- }>;
604
- }
605
- export interface IngredientCostSuggestion {
606
- suggestedPrice: number;
607
- unitAbbreviation?: string;
608
- reasoning?: string;
609
- }
610
- /** A choice group of a product sold (Complementos): «Ponto da carne». */
611
- export interface ProductOptionGroup {
612
- id?: string;
613
- name: string;
614
- isActive: boolean;
615
- isRequired: boolean;
616
- minSelections: number;
617
- maxSelections: number;
618
- items: ProductOptionItem[];
619
- }
620
- export interface ProductOptionItem {
621
- id?: string;
622
- name: string;
623
- priceAdjustment: number;
624
- isActive: boolean;
625
- }
626
- export interface CreateRecipeInput {
627
- name: string;
628
- description?: string;
629
- productId: string;
630
- yieldQuantity: number;
631
- yieldUnitId?: string;
632
- preparationTimeMinutes?: number;
633
- instructions?: string;
634
- ingredients: CreateRecipeIngredientInput[];
635
- }
636
- export interface CreateRecipeIngredientInput {
637
- productId: string;
638
- quantity: number;
639
- unitId?: string;
640
- displayOrder?: number;
641
- notes?: string;
642
- groupId?: string;
643
- }
644
- /** A business line that consumes the active recipe of one catalogue product. */
645
- export interface ConsumeRecipeForSourceInput {
646
- /** Stable vocabulary owned by the caller, for example `order_item`. */
647
- sourceType: string;
648
- /** Stable source-line id. It is also the exactly-once boundary. */
649
- sourceId: string;
650
- /** Product produced by the recipe (the item that was sold). */
651
- productId: string;
652
- /** Number of recipe outputs consumed by this source line. */
653
- quantity: number;
654
- }
655
- export interface ReverseRecipeConsumptionInput {
656
- sourceType: string;
657
- sourceId: string;
658
- reason: string;
659
- }
660
- export type InventoryConsumptionStatus = 'confirmed' | 'reversed' | 'skipped';
661
- export type InventoryConsumptionSkipReason = 'no_active_recipe' | 'nothing_to_reverse';
662
- export interface InventoryConsumptionResult {
663
- sourceType: string;
664
- sourceId: string;
665
- idempotencyKey: string;
666
- status: InventoryConsumptionStatus;
667
- recipeId?: string;
668
- lineCount: number;
669
- skipReason?: InventoryConsumptionSkipReason;
670
- }
671
- export interface DateRange {
672
- from: string;
673
- to: string;
674
- }
675
- export interface ProductQuery {
676
- productType?: ProductType;
677
- categoryId?: string;
678
- search?: string;
679
- lowStockOnly?: boolean;
680
- isActive?: boolean;
681
- page?: number;
682
- pageSize?: number;
683
- }
684
- export interface MovementQuery {
685
- productId?: string;
686
- movementType?: MovementType | MovementType[];
687
- stockLocationId?: string;
688
- dateRange?: DateRange;
689
- search?: string;
690
- page?: number;
691
- pageSize?: number;
692
- }
693
- export interface PaginatedResult<T> {
694
- data: T[];
695
- total: number;
696
- }
697
- /**
698
- * One product used on one sold line, as the audit reads it back from the ledger.
699
- * The grain is (item × product), not the movement: a single consumption splits
700
- * into several ledger rows when FIFO crosses batches.
701
- */
702
- export interface UsageAuditEntry {
703
- itemId: string;
704
- productId: string;
705
- productName?: string;
706
- productSku?: string;
707
- usedAt: string;
708
- movementDate: string;
709
- /** What the sale posted out of stock. */
710
- postedQuantity: number;
711
- /** Posted plus every audit correction — what the balance actually reflects. */
712
- netQuantity: number;
713
- /** The recipe's standard for this line. Null when no recipe answers for it. */
714
- standardQuantity?: number | null;
715
- /** net − standard. Null follows standardQuantity. */
716
- variance?: number | null;
717
- unitAbbreviation?: string;
718
- totalCost: number;
719
- stockLocationId?: string;
720
- stockLocationName?: string;
721
- /** More than one means the exit crossed batches. */
722
- locationCount: number;
723
- recipeId?: string;
724
- recipeName?: string;
725
- orderId?: string;
726
- itemName?: string;
727
- orderReference?: string;
728
- performedById?: string;
729
- performedByName?: string;
730
- customerId?: string;
731
- customerName?: string;
732
- correctedAt?: string;
733
- correctionReason?: string;
734
- isCorrected: boolean;
735
- /**
736
- * De onde o consumo veio. `ledger` é a baixa que o pedido gerou; `clinical` é
737
- * o produto usado num atendimento que NUNCA baixou estoque — 116.911 linhas
738
- * do Espaço Facial são assim, porque no V1 a auditoria era portão pré-baixa e
739
- * a fila nunca foi drenada.
740
- */
741
- source?: 'ledger' | 'clinical';
742
- /**
743
- * A linha chegou a mexer no razão? Falsa na origem clínica, e é isso que
744
- * impede a tela de prometer um estorno que não tem o que estornar.
745
- */
746
- stockPosted?: boolean;
747
- }
748
- /** One line of a usage-audit batch: the sold line, the product, and what the
749
- * count says really left. */
750
- export interface UsageAuditCorrection {
751
- itemId: string;
752
- productId: string;
753
- quantity: number;
754
- }
755
- /** What closing a usage-audit batch reports back. `linesUnchanged` are the
756
- * lines whose quantity already matched — they emit no movement. */
757
- export interface UsageAuditBatchResult {
758
- operationId?: string;
759
- linesApplied: number;
760
- linesUnchanged: number;
761
- }
762
- /** Uma linha que o estoque aceita — com ou sem baixa. */
763
- export interface UsageAuditApproval {
764
- itemId: string;
765
- productId: string;
766
- }
767
- export interface UsageAuditApproveResult {
768
- linesApproved: number;
769
- linesPosted: number;
770
- linesSkipped: number;
771
- /** Linhas que não puderam ser baixadas por falta de saldo — seguem pendentes. */
772
- linesNoStock?: number;
773
- missing?: Array<{
774
- product: string;
775
- needed: number;
776
- available: number;
777
- }>;
778
- }
779
- export interface UsageAuditQuery {
780
- search?: string;
781
- /** Only the lines whose net differs from the recipe standard. */
782
- divergentOnly?: boolean;
783
- page?: number;
784
- pageSize?: number;
785
- /** ISO instant: only usage from this moment on. The queue has a window. */
786
- from?: string;
787
- /** Only what nobody has reviewed yet — the V1's default queue. */
788
- pendingOnly?: boolean;
789
- }
790
- export interface InventorySummary {
791
- totalProducts: number;
792
- lowStockCount: number;
793
- outOfStockCount: number;
794
- totalStockValue: number;
795
- recentMovementCount: number;
796
- movementsByType: Record<MovementType, number>;
797
- /**
798
- * Produtos ativos SEM estoque mínimo cadastrado.
799
- *
800
- * É o número que explica por que "Estoque Baixo" pode estar zerado com o
801
- * depósito vazio: sem mínimo não há de que estar abaixo. O V1 resolve o
802
- * mesmo caso ao contrário — trata mínimo 0 como alerta, 203 de 218 produtos
803
- * entram na lista de reposição urgente e ninguém olha mais a lista. Contar à
804
- * parte diz a verdade e convida a preencher, em vez de gritar ou calar.
805
- */
806
- noMinimumCount: number;
807
- }
808
- /** Uma linha da lista de reposição, com o motivo de estar nela. */
809
- export interface RestockLine {
810
- productId: string;
811
- name: string;
812
- categoryName?: string;
813
- currentQuantity: number;
814
- minQuantity: number;
815
- /** Unidade de medida do produto (`UN`, `KG`) — o número sozinho não informa. */
816
- unit?: string;
817
- reason: 'out-of-stock' | 'below-minimum';
818
- }
819
- /** Quantos produtos por categoria, com o balde dos sem categoria nomeado. */
820
- export interface CategoryCount {
821
- categoryId: string | null;
822
- name: string;
823
- count: number;
824
- }
825
- //# sourceMappingURL=types.d.ts.map