@fayz-ai/plugin-inventory 0.1.1

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 (93) hide show
  1. package/dist/InventoryContext.d.ts +37 -0
  2. package/dist/InventoryContext.d.ts.map +1 -0
  3. package/dist/InventoryPage.d.ts +13 -0
  4. package/dist/InventoryPage.d.ts.map +1 -0
  5. package/dist/components/InventoryGeneralSettings.d.ts +3 -0
  6. package/dist/components/InventoryGeneralSettings.d.ts.map +1 -0
  7. package/dist/components/InventoryOnboarding.d.ts +5 -0
  8. package/dist/components/InventoryOnboarding.d.ts.map +1 -0
  9. package/dist/components/InventorySettings.d.ts +8 -0
  10. package/dist/components/InventorySettings.d.ts.map +1 -0
  11. package/dist/data/index.d.ts +3 -0
  12. package/dist/data/index.d.ts.map +1 -0
  13. package/dist/data/mock.d.ts +3 -0
  14. package/dist/data/mock.d.ts.map +1 -0
  15. package/dist/data/supabase.d.ts +3 -0
  16. package/dist/data/supabase.d.ts.map +1 -0
  17. package/dist/data/types.d.ts +22 -0
  18. package/dist/data/types.d.ts.map +1 -0
  19. package/dist/index.cjs +2936 -0
  20. package/dist/index.cjs.map +1 -0
  21. package/dist/index.d.ts +48 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +2930 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/lib/tenant.d.ts +3 -0
  26. package/dist/lib/tenant.d.ts.map +1 -0
  27. package/dist/locales/en.d.ts +2 -0
  28. package/dist/locales/en.d.ts.map +1 -0
  29. package/dist/locales/index.d.ts +2 -0
  30. package/dist/locales/index.d.ts.map +1 -0
  31. package/dist/locales/pt-BR.d.ts +2 -0
  32. package/dist/locales/pt-BR.d.ts.map +1 -0
  33. package/dist/registries.d.ts +3 -0
  34. package/dist/registries.d.ts.map +1 -0
  35. package/dist/store.d.ts +28 -0
  36. package/dist/store.d.ts.map +1 -0
  37. package/dist/types.d.ts +213 -0
  38. package/dist/types.d.ts.map +1 -0
  39. package/dist/views/DashboardView.d.ts +8 -0
  40. package/dist/views/DashboardView.d.ts.map +1 -0
  41. package/dist/views/MovementHistoryView.d.ts +5 -0
  42. package/dist/views/MovementHistoryView.d.ts.map +1 -0
  43. package/dist/views/ProductCrudForm.d.ts +6 -0
  44. package/dist/views/ProductCrudForm.d.ts.map +1 -0
  45. package/dist/views/ProductFormView.d.ts +6 -0
  46. package/dist/views/ProductFormView.d.ts.map +1 -0
  47. package/dist/views/ProductListView.d.ts +6 -0
  48. package/dist/views/ProductListView.d.ts.map +1 -0
  49. package/dist/views/RecipeDetailView.d.ts +6 -0
  50. package/dist/views/RecipeDetailView.d.ts.map +1 -0
  51. package/dist/views/RecipeFormView.d.ts +5 -0
  52. package/dist/views/RecipeFormView.d.ts.map +1 -0
  53. package/dist/views/RecipesView.d.ts +6 -0
  54. package/dist/views/RecipesView.d.ts.map +1 -0
  55. package/dist/views/StockMovementView.d.ts +8 -0
  56. package/dist/views/StockMovementView.d.ts.map +1 -0
  57. package/dist/views/dashboardWidgets.d.ts +11 -0
  58. package/dist/views/dashboardWidgets.d.ts.map +1 -0
  59. package/dist/views/productEntity.d.ts +6 -0
  60. package/dist/views/productEntity.d.ts.map +1 -0
  61. package/package.json +55 -0
  62. package/src/InventoryContext.tsx +40 -0
  63. package/src/InventoryPage.tsx +170 -0
  64. package/src/README.md +177 -0
  65. package/src/components/InventoryGeneralSettings.tsx +26 -0
  66. package/src/components/InventoryOnboarding.tsx +60 -0
  67. package/src/components/InventorySettings.tsx +27 -0
  68. package/src/data/index.ts +2 -0
  69. package/src/data/mock.ts +266 -0
  70. package/src/data/supabase.ts +358 -0
  71. package/src/data/types.ts +35 -0
  72. package/src/index.ts +191 -0
  73. package/src/lib/tenant.ts +4 -0
  74. package/src/locales/en.ts +242 -0
  75. package/src/locales/index.ts +7 -0
  76. package/src/locales/pt-BR.ts +242 -0
  77. package/src/migrations/001_inventory_base.sql +69 -0
  78. package/src/migrations/002_recipes.sql +34 -0
  79. package/src/migrations/003_measurement_units.sql +13 -0
  80. package/src/registries.ts +111 -0
  81. package/src/store.ts +127 -0
  82. package/src/types.ts +256 -0
  83. package/src/views/DashboardView.tsx +11 -0
  84. package/src/views/MovementHistoryView.tsx +104 -0
  85. package/src/views/ProductCrudForm.tsx +99 -0
  86. package/src/views/ProductFormView.tsx +283 -0
  87. package/src/views/ProductListView.tsx +107 -0
  88. package/src/views/RecipeDetailView.tsx +192 -0
  89. package/src/views/RecipeFormView.tsx +235 -0
  90. package/src/views/RecipesView.tsx +103 -0
  91. package/src/views/StockMovementView.tsx +516 -0
  92. package/src/views/dashboardWidgets.tsx +101 -0
  93. package/src/views/productEntity.tsx +124 -0
@@ -0,0 +1,37 @@
1
+ import { formatCurrency, type CurrencyConfig } from '@fayz-ai/saas';
2
+ import type { InventoryPluginLabels } from './index';
3
+ import type { InventoryDataProvider } from './data/types';
4
+ import type { InventoryUIState } from './store';
5
+ export interface InventoryModules {
6
+ recipes: boolean;
7
+ stockLocations: boolean;
8
+ batchTracking: boolean;
9
+ }
10
+ export type InventoryCurrency = CurrencyConfig;
11
+ export interface ProductTypeOption {
12
+ value: string;
13
+ label: string;
14
+ }
15
+ export interface LocationOption {
16
+ id: string;
17
+ name: string;
18
+ isHQ?: boolean;
19
+ }
20
+ export interface ResolvedInventoryConfig {
21
+ modules: InventoryModules;
22
+ labels: InventoryPluginLabels;
23
+ currency: InventoryCurrency;
24
+ productTypes: ProductTypeOption[];
25
+ locations: LocationOption[];
26
+ }
27
+ export declare const InventoryContextProvider: import("react").FC<{
28
+ config: ResolvedInventoryConfig;
29
+ provider: InventoryDataProvider;
30
+ store: import("zustand").StoreApi<InventoryUIState>;
31
+ children?: React.ReactNode;
32
+ }>;
33
+ export declare const useInventoryConfig: () => ResolvedInventoryConfig;
34
+ export declare const useInventoryProvider: () => InventoryDataProvider;
35
+ export declare const useInventoryStore: <T>(selector: (state: InventoryUIState) => T) => T;
36
+ export { formatCurrency };
37
+ //# sourceMappingURL=InventoryContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InventoryContext.d.ts","sourceRoot":"","sources":["../src/InventoryContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AACxF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAA;IAChB,cAAc,EAAE,OAAO,CAAA;IACvB,aAAa,EAAE,OAAO,CAAA;CACvB;AAED,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAA;AAE9C,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,gBAAgB,CAAA;IACzB,MAAM,EAAE,qBAAqB,CAAA;IAC7B,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,YAAY,EAAE,iBAAiB,EAAE,CAAA;IACjC,SAAS,EAAE,cAAc,EAAE,CAAA;CAC5B;AAID,eAAO,MAAM,wBAAwB;;;;;EAAsB,CAAA;AAC3D,eAAO,MAAM,kBAAkB,+BAAgB,CAAA;AAC/C,eAAO,MAAM,oBAAoB,6BAAkB,CAAA;AACnD,eAAO,MAAM,iBAAiB,oDAAe,CAAA;AAE7C,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { StoreApi } from 'zustand/vanilla';
3
+ import { type ResolvedInventoryConfig } from './InventoryContext';
4
+ import type { InventoryDataProvider } from './data/types';
5
+ import type { InventoryUIState } from './store';
6
+ import type { PluginRegistryDef } from '@fayz-ai/core';
7
+ export declare function InventoryPage({ config, provider, store, registries }: {
8
+ config: ResolvedInventoryConfig;
9
+ provider: InventoryDataProvider;
10
+ store: StoreApi<InventoryUIState>;
11
+ registries?: PluginRegistryDef[];
12
+ }): React.JSX.Element;
13
+ //# sourceMappingURL=InventoryPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InventoryPage.d.ts","sourceRoot":"","sources":["../src/InventoryPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE/C,OAAO,EAA4B,KAAK,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAC3F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAqB,MAAM,eAAe,CAAA;AA+CzE,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;IACrE,MAAM,EAAE,uBAAuB,CAAA;IAC/B,QAAQ,EAAE,qBAAqB,CAAA;IAC/B,KAAK,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAA;IACjC,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAA;CACjC,qBA+GA"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare function InventoryGeneralSettings(): React.JSX.Element;
3
+ //# sourceMappingURL=InventoryGeneralSettings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InventoryGeneralSettings.d.ts","sourceRoot":"","sources":["../../src/components/InventoryGeneralSettings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,wBAAgB,wBAAwB,sBAqBvC"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare function InventoryOnboarding({ onComplete }: {
3
+ onComplete: () => void;
4
+ }): React.JSX.Element;
5
+ //# sourceMappingURL=InventoryOnboarding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InventoryOnboarding.d.ts","sourceRoot":"","sources":["../../src/components/InventoryOnboarding.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAWvC,wBAAgB,mBAAmB,CAAC,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,IAAI,CAAA;CAAE,qBAgD7E"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { PluginRegistryDef } from '@fayz-ai/core';
3
+ export declare function InventorySettings({ registries, routeBase, onClose }: {
4
+ registries: PluginRegistryDef[];
5
+ routeBase: string;
6
+ onClose: () => void;
7
+ }): React.JSX.Element;
8
+ //# sourceMappingURL=InventorySettings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InventorySettings.d.ts","sourceRoot":"","sources":["../../src/components/InventorySettings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAGtD,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;IACpE,UAAU,EAAE,iBAAiB,EAAE,CAAA;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,qBAgBA"}
@@ -0,0 +1,3 @@
1
+ export type { InventoryDataProvider } from './types';
2
+ export { createMockInventoryProvider } from './mock';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { InventoryDataProvider } from './types';
2
+ export declare function createMockInventoryProvider(): InventoryDataProvider;
3
+ //# sourceMappingURL=mock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../src/data/mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AA2CpD,wBAAgB,2BAA2B,IAAI,qBAAqB,CA8NnE"}
@@ -0,0 +1,3 @@
1
+ import type { InventoryDataProvider } from './types';
2
+ export declare function createSupabaseInventoryProvider(): InventoryDataProvider;
3
+ //# sourceMappingURL=supabase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../../src/data/supabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AA4DpD,wBAAgB,+BAA+B,IAAI,qBAAqB,CAySvE"}
@@ -0,0 +1,22 @@
1
+ import type { Product, StockMovement, StockPosition, StockLocation, Recipe, RecipeIngredient, CreateProductInput, CreateStockMovementInput, CreateRecipeInput, ProductQuery, MovementQuery, PaginatedResult, InventorySummary } from '../types';
2
+ export interface InventoryDataProvider {
3
+ getProducts(query: ProductQuery): Promise<PaginatedResult<Product>>;
4
+ getProductById(id: string): Promise<Product | null>;
5
+ createProduct(input: CreateProductInput): Promise<Product>;
6
+ updateProduct(id: string, data: Partial<Product>): Promise<Product>;
7
+ getMovements(query: MovementQuery): Promise<PaginatedResult<StockMovement>>;
8
+ createMovement(input: CreateStockMovementInput): Promise<StockMovement>;
9
+ getPositions(productId: string): Promise<StockPosition[]>;
10
+ getLocations(): Promise<StockLocation[]>;
11
+ createLocation(data: {
12
+ name: string;
13
+ description?: string;
14
+ unitId?: string;
15
+ }): Promise<StockLocation>;
16
+ getRecipes(): Promise<Recipe[]>;
17
+ getRecipeById(id: string): Promise<Recipe | null>;
18
+ getRecipeIngredients(recipeId: string): Promise<RecipeIngredient[]>;
19
+ createRecipe(input: CreateRecipeInput): Promise<Recipe>;
20
+ getSummary(): Promise<InventorySummary>;
21
+ }
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/data/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EACpD,MAAM,EAAE,gBAAgB,EACxB,kBAAkB,EAAE,wBAAwB,EAAE,iBAAiB,EAC/D,YAAY,EAAE,aAAa,EAC3B,eAAe,EAAE,gBAAgB,EAClC,MAAM,UAAU,CAAA;AAEjB,MAAM,WAAW,qBAAqB;IAEpC,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAA;IACnE,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IACnD,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC1D,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAGnE,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAA;IAC3E,cAAc,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;IAGvE,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAA;IAGzD,YAAY,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAA;IACxC,cAAc,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;IAGrG,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAC/B,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IACjD,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAA;IACnE,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAGvD,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAA;CACxC"}