shareneus 1.5.27 → 1.5.29

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.
@@ -23,8 +23,8 @@ type PriceListDoc = {
23
23
  export declare function ApplyServicePriceListToProcedure(procedure: any, priceList: PriceListDoc | null, quantity?: number): any;
24
24
  export declare function ApplyServicePriceListToOpcode(opcode: any, priceList: PriceListDoc | null, quantity?: number): any;
25
25
  /**
26
- * Applies price list to Service with support for equipment-based pricing (FitPrices)
27
- * Handles both simple services (healthcare) and equipment-based services (automotive, HVAC)
26
+ * Applies price list to Service with support for equipment-based pricing (FitPriceCosts)
27
+ * Handles both simple services (healthcare) and equipment-based services (automotive, HVAC, medical, industrial, etc.)
28
28
  */
29
- export declare function GetServicePriceForPriceList(service: any, priceList: PriceListDoc | null, vehicle?: any, quantity?: number): any;
29
+ export declare function GetServicePriceForPriceList(service: any, priceList: PriceListDoc | null, equipment?: any, quantity?: number): any;
30
30
  export {};
@@ -235,10 +235,10 @@ function buildAppliedTierMeta(tier) {
235
235
  };
236
236
  }
237
237
  /**
238
- * Applies price list to Service with support for equipment-based pricing (FitPrices)
239
- * Handles both simple services (healthcare) and equipment-based services (automotive, HVAC)
238
+ * Applies price list to Service with support for equipment-based pricing (FitPriceCosts)
239
+ * Handles both simple services (healthcare) and equipment-based services (automotive, HVAC, medical, industrial, etc.)
240
240
  */
241
- function GetServicePriceForPriceList(service, priceList, vehicle = null, quantity = 1) {
241
+ function GetServicePriceForPriceList(service, priceList, equipment = null, quantity = 1) {
242
242
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
243
243
  if (!service || !priceList) {
244
244
  return service;
@@ -253,16 +253,16 @@ function GetServicePriceForPriceList(service, priceList, vehicle = null, quantit
253
253
  if (priceList.TType === "SALE" && service.Sale) {
254
254
  // Check if equipment-based service (FitPriceCosts) or simple service (Price)
255
255
  if (service.FitPriceCosts && service.FitPriceCosts.length > 0) {
256
- // Equipment-based service - need vehicle information
257
- if (!vehicle) {
258
- warnings.push("Vehicle information required for equipment-based service pricing.");
256
+ // Equipment-based service - need equipment information
257
+ if (!equipment) {
258
+ warnings.push("Equipment information required for equipment-based service pricing.");
259
259
  service.PriceListWarnings = warnings;
260
260
  return service;
261
261
  }
262
- // Find matching FitPriceCost for vehicle
263
- matchedFitPriceCost = findMatchingFitPriceCost(service.FitPriceCosts, vehicle);
262
+ // Find matching FitPriceCost for equipment
263
+ matchedFitPriceCost = findMatchingFitPriceCost(service.FitPriceCosts, equipment);
264
264
  if (!matchedFitPriceCost || !matchedFitPriceCost.Sale) {
265
- warnings.push(`No pricing found for ${vehicle.Make || 'Unknown'} ${vehicle.Model || ''}`);
265
+ warnings.push(`No pricing found for ${equipment.Make || 'Unknown'} ${equipment.Model || ''}`);
266
266
  service.PriceListWarnings = warnings;
267
267
  return service;
268
268
  }
@@ -373,16 +373,16 @@ function GetServicePriceForPriceList(service, priceList, vehicle = null, quantit
373
373
  let baseCost = null;
374
374
  let baseCostSource = "BASE";
375
375
  if (service.FitPriceCosts && service.FitPriceCosts.length > 0) {
376
- // Equipment-based service - need vehicle information
377
- if (!vehicle) {
378
- warnings.push("Vehicle information required for equipment-based service costing.");
376
+ // Equipment-based service - need equipment information
377
+ if (!equipment) {
378
+ warnings.push("Equipment information required for equipment-based service costing.");
379
379
  service.PriceListWarnings = warnings;
380
380
  return service;
381
381
  }
382
382
  // Reuse the matchedFitPriceCost from Sale section if available
383
- const fitPriceCostEntry = matchedFitPriceCost || findMatchingFitPriceCost(service.FitPriceCosts, vehicle);
383
+ const fitPriceCostEntry = matchedFitPriceCost || findMatchingFitPriceCost(service.FitPriceCosts, equipment);
384
384
  if (!fitPriceCostEntry || !fitPriceCostEntry.Pur) {
385
- warnings.push(`No costing found for ${vehicle.Make || 'Unknown'} ${vehicle.Model || ''}`);
385
+ warnings.push(`No costing found for ${equipment.Make || 'Unknown'} ${equipment.Model || ''}`);
386
386
  service.PriceListWarnings = warnings;
387
387
  return service;
388
388
  }
@@ -446,41 +446,41 @@ function GetServicePriceForPriceList(service, priceList, vehicle = null, quantit
446
446
  return service;
447
447
  }
448
448
  /**
449
- * Finds the matching FitPriceCost entry for a given vehicle
449
+ * Finds the matching FitPriceCost entry for a given equipment (automotive, HVAC, medical, industrial, etc.)
450
450
  * Tries most specific match first (Make + Model + Variant), then progressively less specific
451
451
  */
452
- function findMatchingFitPriceCost(fitPriceCosts, vehicle) {
452
+ function findMatchingFitPriceCost(fitPriceCosts, equipment) {
453
453
  var _a, _b, _c, _d, _e, _f, _g, _h;
454
- if (!Array.isArray(fitPriceCosts) || fitPriceCosts.length === 0 || !vehicle) {
454
+ if (!Array.isArray(fitPriceCosts) || fitPriceCosts.length === 0 || !equipment) {
455
455
  return null;
456
456
  }
457
- const vehicleMakeId = (_b = (_a = vehicle.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a);
458
- const vehicleModelId = (_d = (_c = vehicle.Model_Id) === null || _c === void 0 ? void 0 : _c.toString) === null || _d === void 0 ? void 0 : _d.call(_c);
459
- const vehicleVarId = ((_f = (_e = vehicle.Var_Id) === null || _e === void 0 ? void 0 : _e.toString) === null || _f === void 0 ? void 0 : _f.call(_e)) || ((_h = (_g = vehicle.Variant_Id) === null || _g === void 0 ? void 0 : _g.toString) === null || _h === void 0 ? void 0 : _h.call(_g));
457
+ const equipmentMakeId = (_b = (_a = equipment.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a);
458
+ const equipmentModelId = (_d = (_c = equipment.Model_Id) === null || _c === void 0 ? void 0 : _c.toString) === null || _d === void 0 ? void 0 : _d.call(_c);
459
+ const equipmentVarId = ((_f = (_e = equipment.Var_Id) === null || _e === void 0 ? void 0 : _e.toString) === null || _f === void 0 ? void 0 : _f.call(_e)) || ((_h = (_g = equipment.Variant_Id) === null || _g === void 0 ? void 0 : _g.toString) === null || _h === void 0 ? void 0 : _h.call(_g));
460
460
  // Try Make + Model + Variant
461
- if (vehicleMakeId && vehicleModelId && vehicleVarId) {
461
+ if (equipmentMakeId && equipmentModelId && equipmentVarId) {
462
462
  const match = fitPriceCosts.find((fpc) => {
463
463
  if (!Array.isArray(fpc.Fit) || fpc.Fit.length === 0)
464
464
  return false;
465
465
  return fpc.Fit.some((fit) => {
466
466
  var _a, _b, _c, _d, _e, _f;
467
- return ((_b = (_a = fit.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) === vehicleMakeId &&
468
- ((_d = (_c = fit.Model_Id) === null || _c === void 0 ? void 0 : _c.toString) === null || _d === void 0 ? void 0 : _d.call(_c)) === vehicleModelId &&
469
- ((_f = (_e = fit.Var_Id) === null || _e === void 0 ? void 0 : _e.toString) === null || _f === void 0 ? void 0 : _f.call(_e)) === vehicleVarId;
467
+ return ((_b = (_a = fit.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) === equipmentMakeId &&
468
+ ((_d = (_c = fit.Model_Id) === null || _c === void 0 ? void 0 : _c.toString) === null || _d === void 0 ? void 0 : _d.call(_c)) === equipmentModelId &&
469
+ ((_f = (_e = fit.Var_Id) === null || _e === void 0 ? void 0 : _e.toString) === null || _f === void 0 ? void 0 : _f.call(_e)) === equipmentVarId;
470
470
  });
471
471
  });
472
472
  if (match)
473
473
  return match;
474
474
  }
475
475
  // Try Make + Model
476
- if (vehicleMakeId && vehicleModelId) {
476
+ if (equipmentMakeId && equipmentModelId) {
477
477
  const match = fitPriceCosts.find((fpc) => {
478
478
  if (!Array.isArray(fpc.Fit) || fpc.Fit.length === 0)
479
479
  return false;
480
480
  return fpc.Fit.some((fit) => {
481
481
  var _a, _b, _c, _d;
482
- return ((_b = (_a = fit.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) === vehicleMakeId &&
483
- ((_d = (_c = fit.Model_Id) === null || _c === void 0 ? void 0 : _c.toString) === null || _d === void 0 ? void 0 : _d.call(_c)) === vehicleModelId &&
482
+ return ((_b = (_a = fit.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) === equipmentMakeId &&
483
+ ((_d = (_c = fit.Model_Id) === null || _c === void 0 ? void 0 : _c.toString) === null || _d === void 0 ? void 0 : _d.call(_c)) === equipmentModelId &&
484
484
  !fit.Var_Id;
485
485
  });
486
486
  });
@@ -488,13 +488,13 @@ function findMatchingFitPriceCost(fitPriceCosts, vehicle) {
488
488
  return match;
489
489
  }
490
490
  // Try Make only
491
- if (vehicleMakeId) {
491
+ if (equipmentMakeId) {
492
492
  const match = fitPriceCosts.find((fpc) => {
493
493
  if (!Array.isArray(fpc.Fit) || fpc.Fit.length === 0)
494
494
  return false;
495
495
  return fpc.Fit.some((fit) => {
496
496
  var _a, _b;
497
- return ((_b = (_a = fit.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) === vehicleMakeId &&
497
+ return ((_b = (_a = fit.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) === equipmentMakeId &&
498
498
  !fit.Model_Id;
499
499
  });
500
500
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.5.27",
3
+ "version": "1.5.29",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",