hvp-shared 6.2.0 → 6.4.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.
@@ -30,6 +30,37 @@ export declare const USAGE_TYPE_VALUES: UsageType[];
30
30
  * UsageType labels in Spanish (for UI)
31
31
  */
32
32
  export declare const USAGE_TYPE_LABELS: Record<UsageType, string>;
33
+ /**
34
+ * StockPolicy - How stock levels are managed for an item
35
+ *
36
+ * This is an HVP-only field (not in QVET).
37
+ * Determined by QVET's tipoControlStock field on sync.
38
+ */
39
+ export declare enum StockPolicy {
40
+ /** Stock min/max calculated based on consumption history */
41
+ DEMAND_BASED = "demandBased",
42
+ /** Only ordered when customer requests, min/max = 0 but system proposes values */
43
+ ON_DEMAND = "onDemand",
44
+ /** No longer sold, min/max = 0, no proposals */
45
+ DISCONTINUED = "discontinued",
46
+ /** User defines stock levels manually, system does not calculate */
47
+ MANUAL = "manual",
48
+ /** No stock control (services, etc.), field not editable */
49
+ NOT_APPLICABLE = "notApplicable"
50
+ }
51
+ /**
52
+ * All StockPolicy values as array (for dropdowns)
53
+ */
54
+ export declare const STOCK_POLICY_VALUES: StockPolicy[];
55
+ /**
56
+ * StockPolicy labels in Spanish (for UI)
57
+ */
58
+ export declare const STOCK_POLICY_LABELS: Record<StockPolicy, string>;
59
+ /**
60
+ * Editable stock policies (for UI validation)
61
+ * notApplicable is not editable - it's set automatically based on tipoControlStock
62
+ */
63
+ export declare const EDITABLE_STOCK_POLICIES: StockPolicy[];
33
64
  /**
34
65
  * ArticleType - Type of article in QVET
35
66
  */
@@ -5,7 +5,7 @@
5
5
  * Enums and constants for catalog items (products/services from QVET).
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.SYNC_STATUS_LABELS = exports.SYNC_STATUS_VALUES = exports.SyncStatus = exports.BRAND_VALUES = exports.Brand = exports.TARIFF_TYPE_LABELS = exports.TARIFF_TYPE_VALUES = exports.TariffType = exports.ARTICLE_TYPE_VALUES = exports.ArticleType = exports.USAGE_TYPE_LABELS = exports.USAGE_TYPE_VALUES = exports.UsageType = void 0;
8
+ exports.SYNC_STATUS_LABELS = exports.SYNC_STATUS_VALUES = exports.SyncStatus = exports.BRAND_VALUES = exports.Brand = exports.TARIFF_TYPE_LABELS = exports.TARIFF_TYPE_VALUES = exports.TariffType = exports.ARTICLE_TYPE_VALUES = exports.ArticleType = exports.EDITABLE_STOCK_POLICIES = exports.STOCK_POLICY_LABELS = exports.STOCK_POLICY_VALUES = exports.StockPolicy = exports.USAGE_TYPE_LABELS = exports.USAGE_TYPE_VALUES = exports.UsageType = void 0;
9
9
  /**
10
10
  * UsageType - How the item is used in HVP
11
11
  *
@@ -41,6 +41,49 @@ exports.USAGE_TYPE_LABELS = {
41
41
  [UsageType.FIXED_ASSET]: 'Activo Fijo',
42
42
  [UsageType.NOT_APPLICABLE]: 'No Aplica',
43
43
  };
44
+ /**
45
+ * StockPolicy - How stock levels are managed for an item
46
+ *
47
+ * This is an HVP-only field (not in QVET).
48
+ * Determined by QVET's tipoControlStock field on sync.
49
+ */
50
+ var StockPolicy;
51
+ (function (StockPolicy) {
52
+ /** Stock min/max calculated based on consumption history */
53
+ StockPolicy["DEMAND_BASED"] = "demandBased";
54
+ /** Only ordered when customer requests, min/max = 0 but system proposes values */
55
+ StockPolicy["ON_DEMAND"] = "onDemand";
56
+ /** No longer sold, min/max = 0, no proposals */
57
+ StockPolicy["DISCONTINUED"] = "discontinued";
58
+ /** User defines stock levels manually, system does not calculate */
59
+ StockPolicy["MANUAL"] = "manual";
60
+ /** No stock control (services, etc.), field not editable */
61
+ StockPolicy["NOT_APPLICABLE"] = "notApplicable";
62
+ })(StockPolicy || (exports.StockPolicy = StockPolicy = {}));
63
+ /**
64
+ * All StockPolicy values as array (for dropdowns)
65
+ */
66
+ exports.STOCK_POLICY_VALUES = Object.values(StockPolicy);
67
+ /**
68
+ * StockPolicy labels in Spanish (for UI)
69
+ */
70
+ exports.STOCK_POLICY_LABELS = {
71
+ [StockPolicy.DEMAND_BASED]: 'Basado en Demanda',
72
+ [StockPolicy.ON_DEMAND]: 'Bajo Pedido',
73
+ [StockPolicy.DISCONTINUED]: 'Descontinuado',
74
+ [StockPolicy.MANUAL]: 'Manual',
75
+ [StockPolicy.NOT_APPLICABLE]: 'No Aplica',
76
+ };
77
+ /**
78
+ * Editable stock policies (for UI validation)
79
+ * notApplicable is not editable - it's set automatically based on tipoControlStock
80
+ */
81
+ exports.EDITABLE_STOCK_POLICIES = [
82
+ StockPolicy.DEMAND_BASED,
83
+ StockPolicy.ON_DEMAND,
84
+ StockPolicy.DISCONTINUED,
85
+ StockPolicy.MANUAL,
86
+ ];
44
87
  /**
45
88
  * ArticleType - Type of article in QVET
46
89
  */
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Request DTOs for catalog item endpoints.
5
5
  */
6
- import { UsageType, SyncStatus } from '../../constants/catalog-item.constants';
6
+ import { UsageType, SyncStatus, StockPolicy } from '../../constants/catalog-item.constants';
7
7
  import { MarketCompetition } from '../../constants/market-competition.constants';
8
8
  import { PricingRuleCode } from '../../constants/pricing-rule.constants';
9
9
  /**
@@ -104,7 +104,11 @@ export interface UpdateCatalogItemHvpDataRequest {
104
104
  pricingRuleCode?: PricingRuleCode;
105
105
  /** Recommended price (calculated from pricing rule) */
106
106
  recommendedPrice?: number;
107
- /** Flag: item requires manual stock review (algorithm doesn't apply) */
107
+ /** How stock levels are managed */
108
+ stockPolicy?: StockPolicy;
109
+ /** Observations generated by analysis script */
110
+ stockObservations?: string;
111
+ /** @deprecated Use stockPolicy: 'manual' instead */
108
112
  requiresManualReview?: boolean;
109
113
  }
110
114
  /**
@@ -4,7 +4,7 @@
4
4
  * Response DTOs for catalog item endpoints.
5
5
  */
6
6
  import { SyncField } from '../../types/sync-field.types';
7
- import { UsageType, SyncStatus } from '../../constants/catalog-item.constants';
7
+ import { UsageType, SyncStatus, StockPolicy } from '../../constants/catalog-item.constants';
8
8
  import { MarketCompetition } from '../../constants/market-competition.constants';
9
9
  import { PricingRuleCode } from '../../constants/pricing-rule.constants';
10
10
  import { Warehouse } from '../../types/qvet.types';
@@ -136,7 +136,11 @@ export interface CatalogItemDetailResponse {
136
136
  * Calculated from: cost * (1 + targetMargin/100) * (1 + VAT/100)
137
137
  */
138
138
  recommendedPrice?: number;
139
- /** Flag: item requires manual stock review (algorithm doesn't apply) */
139
+ /** How stock levels are managed */
140
+ stockPolicy?: StockPolicy;
141
+ /** Observations generated by analysis script */
142
+ stockObservations?: string;
143
+ /** @deprecated Use stockPolicy: 'manual' instead */
140
144
  requiresManualReview?: boolean;
141
145
  };
142
146
  hasPendingChanges: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "6.2.0",
3
+ "version": "6.4.0",
4
4
  "description": "Shared types and utilities for HVP backend and frontend",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",