tee3apps-cms-sdk-react 0.0.17 → 0.0.18

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tee3apps-cms-sdk-react",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "Uses JSON to dynamically generate and render UI pages in a website",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -58,7 +58,7 @@ const getPriceFromPricingArray = (pricingArray: any[]): number => {
58
58
 
59
59
  // Utility function to get MRP and Selling Price from product pricing object
60
60
  const getProductPrices = (product: any) => {
61
- // Use pricing object first, fallback to price for backward compatibility
61
+ // Use pricing object only
62
62
  const mrp = product.pricing?.mrp ? getPriceFromPricingArray(product.pricing.mrp) : 0;
63
63
  const sellingPrice = product.pricing?.nlcPrice
64
64
  ? getPriceFromPricingArray(product.pricing.nlcPrice)
@@ -66,17 +66,9 @@ const getProductPrices = (product: any) => {
66
66
  ? getPriceFromPricingArray(product.pricing.costPrice)
67
67
  : 0;
68
68
 
69
- // Fallback to old price structure if pricing is not available
70
- const fallbackMRP = product.price?.MRP
71
- ? getPriceValue(product.price.MRP)
72
- : 0;
73
- const fallbackSP = product.price?.SP
74
- ? getPriceValue(product.price.SP)
75
- : 0;
76
-
77
69
  return {
78
- mrp: mrp || fallbackMRP,
79
- sellingPrice: sellingPrice || fallbackSP
70
+ mrp,
71
+ sellingPrice
80
72
  };
81
73
  };
82
74
 
@@ -76,17 +76,13 @@ const ProductListViewOne = (props: any) => {
76
76
  const data = props.props || props;
77
77
  const slug = data?.code; // Using code instead of slug
78
78
 
79
- // Updated price extraction to use pricing object
80
- const mrp = data.pricing?.mrp ? getPriceFromPricingArray(data.pricing.mrp) : 0;
81
- const sellingPrice = data.pricing?.nlcPrice
79
+ // Updated price extraction to use pricing object only - same logic as GroupProductComponent
80
+ const mrpPrice = data.pricing?.mrp ? getPriceFromPricingArray(data.pricing.mrp) : 0;
81
+ const finalSellingPrice = data.pricing?.nlcPrice
82
82
  ? getPriceFromPricingArray(data.pricing.nlcPrice)
83
83
  : data.pricing?.costPrice
84
84
  ? getPriceFromPricingArray(data.pricing.costPrice)
85
85
  : 0;
86
-
87
- // Fallback to old price structure if pricing is not available
88
- const mrpPrice = mrp || (data.price?.MRP ? getPriceValue(data.price.MRP) : 0);
89
- const finalSellingPrice = sellingPrice || (data.price?.SP ? getPriceValue(data.price.SP) : 0);
90
86
 
91
87
  const calculateDiscount = (): number | null => {
92
88
  if (!finalSellingPrice || !mrpPrice || mrpPrice <= finalSellingPrice) return null;
@@ -125,10 +121,10 @@ const ProductListViewOne = (props: any) => {
125
121
  <div className="card_value">
126
122
  {finalSellingPrice !== 0 && (
127
123
  <div className="card_price">
128
- <h4>₹{finalSellingPrice.toLocaleString("en-IN")}</h4>
124
+ <h4>{finalSellingPrice.toLocaleString("en-IN")}</h4>
129
125
  <div className="card_right_grid">
130
126
  {mrpPrice > finalSellingPrice && (
131
- <p >₹{mrpPrice.toLocaleString("en-IN")}</p>
127
+ <p >{mrpPrice.toLocaleString("en-IN")}</p>
132
128
  )}
133
129
  {discount !== null && discount > 0 && (
134
130
  <span>({discount}% OFF)</span>
@@ -77,17 +77,13 @@ const ProductListViewTwo = (props: any) => {
77
77
  const data = props.props || props;
78
78
  const slug = data?.code; // Using code instead of slug since slug doesn't exist in your data
79
79
 
80
- // Updated price extraction to use pricing object
81
- const mrp = data.pricing?.mrp ? getPriceFromPricingArray(data.pricing.mrp) : 0;
82
- const sellingPrice = data.pricing?.nlcPrice
80
+ // Updated price extraction to use pricing object only - same logic as GroupProductComponent
81
+ const mrpPrice = data.pricing?.mrp ? getPriceFromPricingArray(data.pricing.mrp) : 0;
82
+ const finalSellingPrice = data.pricing?.nlcPrice
83
83
  ? getPriceFromPricingArray(data.pricing.nlcPrice)
84
84
  : data.pricing?.costPrice
85
85
  ? getPriceFromPricingArray(data.pricing.costPrice)
86
86
  : 0;
87
-
88
- // Fallback to old price structure if pricing is not available
89
- const mrpPrice = mrp || (data.price?.MRP ? getPriceValue(data.price.MRP) : 0);
90
- const finalSellingPrice = sellingPrice || (data.price?.SP ? getPriceValue(data.price.SP) : 0);
91
87
 
92
88
  const calculateDiscount = () => {
93
89
  if (!finalSellingPrice || !mrpPrice || mrpPrice <= finalSellingPrice) return null;
@@ -130,13 +126,13 @@ const ProductListViewTwo = (props: any) => {
130
126
  {finalSellingPrice !== 0 && (
131
127
  <>
132
128
  <div className="price_row">
133
- <h4 className="selling_price">₹{finalSellingPrice.toLocaleString("en-IN")}</h4>
129
+ <h4 className="selling_price">{finalSellingPrice.toLocaleString("en-IN")}</h4>
134
130
  {discount !== null && discount > 0 && (
135
131
  <span className="discounts">{discount}% OFF</span>
136
132
  )}
137
133
  </div>
138
134
  {mrpPrice > finalSellingPrice && (
139
- <p className="save_amount">Save {(mrpPrice - finalSellingPrice).toLocaleString("en-IN")}</p>
135
+ <p className="save_amount">Save {(mrpPrice - finalSellingPrice).toLocaleString("en-IN")}</p>
140
136
  )}
141
137
  </>
142
138
  )}