@fayz-ai/plugin-inventory 0.13.7 → 0.14.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 (35) hide show
  1. package/dist/context.d.ts +27 -1
  2. package/dist/context.d.ts.map +1 -1
  3. package/dist/data/supabase.d.ts.map +1 -1
  4. package/dist/data/tables.d.ts +7 -0
  5. package/dist/data/tables.d.ts.map +1 -1
  6. package/dist/data/types.d.ts +5 -1
  7. package/dist/data/types.d.ts.map +1 -1
  8. package/dist/index.d.ts +12 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +4428 -2403
  11. package/dist/index.js.map +1 -1
  12. package/dist/locales/en.d.ts.map +1 -1
  13. package/dist/locales/pt-BR.d.ts.map +1 -1
  14. package/dist/migrations/index.d.ts +3 -0
  15. package/dist/migrations/index.d.ts.map +1 -1
  16. package/dist/store.d.ts.map +1 -1
  17. package/dist/types.d.ts +147 -0
  18. package/dist/types.d.ts.map +1 -1
  19. package/dist/views/GapScreens.d.ts +10 -0
  20. package/dist/views/GapScreens.d.ts.map +1 -1
  21. package/dist/views/InventoryPage.d.ts.map +1 -1
  22. package/dist/views/MovementHistoryView.d.ts.map +1 -1
  23. package/dist/views/ProductBarcodesTab.d.ts +6 -0
  24. package/dist/views/ProductBarcodesTab.d.ts.map +1 -0
  25. package/dist/views/ProductCrudForm.d.ts.map +1 -1
  26. package/dist/views/ProductDetailView.d.ts.map +1 -1
  27. package/dist/views/ProductRecipeTab.d.ts +8 -0
  28. package/dist/views/ProductRecipeTab.d.ts.map +1 -0
  29. package/dist/views/UnitStockLocationsWidget.d.ts +10 -0
  30. package/dist/views/UnitStockLocationsWidget.d.ts.map +1 -0
  31. package/dist/views/productEntity.d.ts +11 -1
  32. package/dist/views/productEntity.d.ts.map +1 -1
  33. package/dist/views/productFichas.d.ts +101 -0
  34. package/dist/views/productFichas.d.ts.map +1 -0
  35. package/package.json +4 -4
@@ -0,0 +1,101 @@
1
+ import type { FieldDef, FieldGroup } from '@fayz-ai/core';
2
+ import type { InventoryCurrency } from '../context';
3
+ type T9n = (key: string, params?: Record<string, string | number>) => string;
4
+ /** Os canais do V1. Texto livre no banco: cada praça tem o seu aplicativo. */
5
+ export declare const SALE_CHANNELS: readonly [{
6
+ readonly key: "counter";
7
+ readonly label: "Balcão";
8
+ }, {
9
+ readonly key: "delivery";
10
+ readonly label: "Delivery Próprio";
11
+ }, {
12
+ readonly key: "ifood";
13
+ readonly label: "iFood";
14
+ }, {
15
+ readonly key: "99food";
16
+ readonly label: "99Food";
17
+ }, {
18
+ readonly key: "keeta";
19
+ readonly label: "Keeta";
20
+ }];
21
+ export declare const channelFieldKey: (channel: string) => string;
22
+ /**
23
+ * Os sete interruptores e as duas travas de entrada — a seção que decide quais
24
+ * outras existem. Fica numa coluna só porque cada linha é um interruptor com
25
+ * uma explicação, e três por linha espremem a explicação a ponto de ela sumir.
26
+ */
27
+ export declare function classificationFields(t: T9n, currency: InventoryCurrency): FieldDef[];
28
+ /** Embalagem e conversões — como a casa compra versus como ela conta. */
29
+ export declare function packagingFields(t: T9n): FieldDef[];
30
+ /** A ficha do insumo: o que a COMPRA precisa saber. */
31
+ export declare function ingredientFields(t: T9n): FieldDef[];
32
+ /** A ficha de venda: o que o cardápio e o balcão precisam saber. */
33
+ export declare function saleFields(t: T9n, currency: InventoryCurrency): FieldDef[];
34
+ export declare function intermediateFields(t: T9n): FieldDef[];
35
+ export declare function assetFields(t: T9n, currency: InventoryCurrency): FieldDef[];
36
+ /**
37
+ * A ficha fiscal. Só existe para o que se vende — comprar não emite nota, e
38
+ * pedir NCM de um insumo que nunca sai da casa é campo para ninguém preencher.
39
+ */
40
+ export declare function taxFields(t: T9n): FieldDef[];
41
+ /**
42
+ * As fichas em ABAS, como no V1 — e com os mesmos nomes.
43
+ *
44
+ * O cadastro do produto tem dez assuntos. Empilhados numa rolagem só, quem veio
45
+ * trocar o preço percorre noventa campos; é por isso que o V1 usa abas, e a
46
+ * aba é parte do fluxo, não enfeite. Uma aba cujo interruptor está desligado
47
+ * não é desenhada (todos os campos somem por `visibleWhen`, e `CrudFormPage`
48
+ * não oferece aba vazia).
49
+ */
50
+ export declare function fichaGroups(t: T9n): FieldGroup[];
51
+ /** Prefixo → chaves da ficha. A ordem das chaves é a da ficha no domínio. */
52
+ export declare const FICHA_KEYS: {
53
+ readonly ingredientInfo: {
54
+ readonly prefix: "ing";
55
+ readonly keys: readonly ["minimumQuantity", "maximumQuantity", "reorderPoint", "leadTimeDays", "shelfLifeDays", "storageTemperature", "notes"];
56
+ };
57
+ readonly saleInfo: {
58
+ readonly prefix: "sale";
59
+ readonly keys: readonly ["menuDescription", "allergens", "preparationTimeMinutes", "servesQuantity", "calories", "soldByWeight", "highlightDelivery", "availableForDelivery", "availableForCounter", "notes"];
60
+ };
61
+ readonly intermediateInfo: {
62
+ readonly prefix: "int";
63
+ readonly keys: readonly ["yieldPercentage", "preparationTimeMinutes", "shelfLifeHours", "batchSize", "batchUnitId", "storageInstructions", "notes"];
64
+ };
65
+ readonly assetInfo: {
66
+ readonly prefix: "asset";
67
+ readonly keys: readonly ["assetValue", "residualValue", "usefulLifeMonths", "depreciationRate", "serialNumber", "acquisitionDate", "warrantyExpiryDate", "assetStatus", "assetLocation", "responsiblePersonId", "insurancePolicy", "lastMaintenanceDate", "nextMaintenanceDate", "notes"];
68
+ };
69
+ readonly taxInfo: {
70
+ readonly prefix: "tax";
71
+ readonly keys: readonly ["taxGroupId", "ncm", "cest", "icmsOrigin", "icmsRate", "cfop", "cst", "pisSituation", "pisRate", "cofinsSituation", "cofinsRate", "baseCalculationMode", "benefitCode", "povertyFundRate", "ibsCbsSituation", "ibsCbsClassification"];
72
+ };
73
+ };
74
+ export type FichaName = keyof typeof FICHA_KEYS;
75
+ /**
76
+ * `assetValue` com prefixo `asset` viraria `assetAssetValue`. Quando a chave
77
+ * do domínio já começa pelo prefixo, ela mantém o próprio nome — é o que a
78
+ * entidade declara e é como a pessoa lê na tela.
79
+ */
80
+ export declare function flatKey(prefix: string, key: string): string;
81
+ /** Produto (com fichas) → o registro PLANO que as telas leem. */
82
+ export declare function flattenProduct(p: Record<string, any>): Record<string, any>;
83
+ /**
84
+ * Valores planos → as fichas do produto.
85
+ *
86
+ * Uma ficha só é enviada quando o interruptor dela está LIGADO: desligar
87
+ * «Patrimônio» esconde a seção e não apaga o valor do equipamento — o dado
88
+ * volta inteiro se o interruptor voltar. É o que o V1 faz, e apagar valor de
89
+ * patrimônio por causa de um clique seria perda silenciosa.
90
+ */
91
+ export declare function toFichas(values: Record<string, any>): Record<string, unknown>;
92
+ /**
93
+ * O caminho de volta: valores planos → o que o provider grava.
94
+ *
95
+ * Recebe o registro INTEIRO (o plano atual com as alterações por cima), e não
96
+ * só os campos encostados: uma ficha é gravada como linha completa, então
97
+ * mandar meia ficha apagaria o resto dela em silêncio.
98
+ */
99
+ export declare function unflattenProduct(values: Record<string, any>): Record<string, unknown>;
100
+ export {};
101
+ //# sourceMappingURL=productFichas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"productFichas.d.ts","sourceRoot":"","sources":["../../src/views/productFichas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAiBnD,KAAK,GAAG,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAA;AAI5E,8EAA8E;AAC9E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;EAMhB,CAAA;AAEV,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,WAA6B,CAAA;AAkE5E;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,iBAAiB,GAAG,QAAQ,EAAE,C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EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiCrF"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "status": "beta",
5
5
  "dependencies": []
6
6
  },
7
- "version": "0.13.7",
7
+ "version": "0.14.0",
8
8
  "description": "Fayz SDK — plugin-inventory plugin",
9
9
  "type": "module",
10
10
  "sideEffects": false,
@@ -28,9 +28,9 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@tanstack/react-table": "^8.20.0",
31
- "@fayz-ai/core": "^0.35.0",
32
- "@fayz-ai/ui": "^0.35.0",
33
- "@fayz-ai/admin": "^0.35.0"
31
+ "@fayz-ai/core": "^0.36.0",
32
+ "@fayz-ai/ui": "^0.36.0",
33
+ "@fayz-ai/admin": "^0.36.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/react": "^18.3.0",