tee3apps-cms-sdk-react 0.0.33 → 0.0.35

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.
@@ -56,15 +56,19 @@ const getPriceFromPricingArray = (pricingArray: any[]): number => {
56
56
  return 0;
57
57
  };
58
58
 
59
+ const resolvePrice = (priceData: any): number => {
60
+ if (!priceData) return 0;
61
+ if (Array.isArray(priceData)) {
62
+ return getPriceFromPricingArray(priceData);
63
+ }
64
+ return getPriceValue(priceData);
65
+ };
66
+
59
67
  // Utility function to get MRP and Selling Price from product pricing object
60
68
  const getProductPrices = (product: any) => {
61
69
  // Use pricing object only
62
- const mrp = product.pricing?.mrp ? getPriceFromPricingArray(product.pricing.mrp) : 0;
63
- const sellingPrice = product.pricing?.nlcPrice
64
- ? getPriceFromPricingArray(product.pricing.nlcPrice)
65
- : product.pricing?.costPrice
66
- ? getPriceFromPricingArray(product.pricing.costPrice)
67
- : 0;
70
+ const mrp = resolvePrice(product.pricing?.mrp);
71
+ const sellingPrice = resolvePrice(product.pricing?.costPrice);
68
72
 
69
73
  return {
70
74
  mrp,
@@ -80,6 +84,8 @@ interface Product {
80
84
  image: any;
81
85
  isActive: boolean;
82
86
  price?: any;
87
+ starrating?: number;
88
+ startRatingCount?: number;
83
89
  }
84
90
 
85
91
  interface GroupProductStatic {
@@ -145,6 +151,8 @@ export interface GroupProductComponentProps {
145
151
  isHorizontalScroll: DeviceBooleanProps;
146
152
  headerBackground: string;
147
153
  viewAllLink?: string;
154
+ showsp?: boolean;
155
+ showdiscount?: boolean;
148
156
  }
149
157
 
150
158
  interface GroupProductComponentMainProps {
@@ -203,13 +211,13 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
203
211
  if (currentstyle === 'STYLE1') {
204
212
  return (
205
213
  <div key={key}>
206
- <ProductListViewOne props={product} cardColor={props.cardColor} />
214
+ <ProductListViewOne props={product} cardColor={props.cardColor} layout={currentLayout} showsp={props.showsp} showdiscount={props.showdiscount} />
207
215
  </div>
208
216
  );
209
217
  } else if (currentstyle === 'STYLE2') {
210
218
  return (
211
219
  <div key={key}>
212
- <ProductListViewTwo props={product} cardColor={props.cardColor} />
220
+ <ProductListViewTwo props={product} cardColor={props.cardColor} layout={currentLayout} showsp={props.showsp} showdiscount={props.showdiscount} />
213
221
  </div>
214
222
  );
215
223
  } else {
@@ -220,7 +228,10 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
220
228
  className="productImageSlide"
221
229
  style={{
222
230
  height: 'auto',
223
- minWidth: deviceMode === 'mobileapp' || deviceMode === 'mobileweb' ? '120px' : '150px',
231
+ width: currentLayout === 'NONE' ? '400px' : '100%',
232
+ minWidth: currentLayout === 'NONE' ? '400px' : 'unset',
233
+ maxWidth: currentLayout === 'NONE' ? '420px' : '100%',
234
+ flex: currentLayout === 'NONE' ? '0 0 400px' : '1 1 auto',
224
235
  borderRadius: '8px',
225
236
  overflow: 'hidden',
226
237
  border: '1px solid #eee',
@@ -233,6 +244,7 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
233
244
  boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
234
245
  transition: 'transform 0.2s ease',
235
246
  cursor: 'pointer',
247
+ position: 'relative'
236
248
  }}
237
249
  onMouseOver={(e) => {
238
250
  e.currentTarget.style.transform = 'translateY(-2px)';
@@ -260,6 +272,27 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
260
272
  />
261
273
  </div>
262
274
 
275
+ {(Number(product?.starrating) > 0 || Number(product?.startRatingCount) > 0) && (
276
+ <div style={{
277
+ position: 'absolute',
278
+ top: '10px',
279
+ right: '10px',
280
+ zIndex: 2,
281
+ backgroundColor: 'rgba(255,255,255,0.8)',
282
+ padding: '4px 8px',
283
+ borderRadius: '20px',
284
+ display: 'flex',
285
+ alignItems: 'center',
286
+ gap: '3px',
287
+ boxShadow: '0 2px 4px rgba(0,0,0,0.1)'
288
+ }}>
289
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="#f46b27" width="11" height="11">
290
+ <path d="M10 15l-5.878 3.09 1.122-6.545L.488 6.91l6.562-.955L10 0l2.95 5.955 6.562.955-4.756 4.635 1.122 6.545z" />
291
+ </svg>
292
+ <span style={{ fontSize: '11px', color: '#333', fontWeight: '600' }}>{product.starrating}</span>
293
+ </div>
294
+ )}
295
+
263
296
  {showProductName && (
264
297
  <div
265
298
  style={{
@@ -277,16 +310,24 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
277
310
  }}
278
311
  >
279
312
  {typeof product.name === 'object' ? product.name.all : product.name}
280
- {(() => {
281
- const prices = getProductPrices(product);
282
- return prices.sellingPrice > 0 ? (
283
- <h1 style={{ fontSize: '16px', fontWeight: '700', color: '#333' }}>
284
- {prices.sellingPrice.toLocaleString("en-IN")}
285
- </h1>
286
- ) : null;
287
- })()}
288
313
  </div>
289
314
  )}
315
+
316
+ {(() => {
317
+ const prices = getProductPrices(product);
318
+ return props.showsp !== false && prices.sellingPrice > 0 ? (
319
+ <div style={{ marginTop: '8px', textAlign: 'center' }}>
320
+ <p style={{ fontSize: '14px', fontWeight: '700', color: '#333', margin: 0, display: 'flex', alignItems: 'center', gap: '4px', flexWrap: 'wrap', justifyContent: 'center' }}>
321
+ <span>SP: {prices.sellingPrice.toLocaleString("en-IN")} (incl of all tax)</span>
322
+ {props.showdiscount !== false && prices.mrp > prices.sellingPrice && (
323
+ <span style={{ fontSize: '11px', color: '#666', textDecoration: 'line-through', fontWeight: 'normal' }}>
324
+ MRP: {prices.mrp.toLocaleString("en-IN")}
325
+ </span>
326
+ )}
327
+ </p>
328
+ </div>
329
+ ) : null;
330
+ })()}
290
331
  </div>
291
332
  </a>
292
333
  );
@@ -298,13 +339,13 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
298
339
  if (currentstyle === 'STYLE1') {
299
340
  return (
300
341
  <div key={key}>
301
- <ProductListViewOne props={product} cardColor={props.cardColor} />
342
+ <ProductListViewOne props={product} cardColor={props.cardColor} layout={currentLayout} showsp={props.showsp} showdiscount={props.showdiscount} />
302
343
  </div>
303
344
  );
304
345
  } else if (currentstyle === 'STYLE2') {
305
346
  return (
306
347
  <div key={key}>
307
- <ProductListViewTwo props={product} cardColor={props.cardColor} />
348
+ <ProductListViewTwo props={product} cardColor={props.cardColor} layout={currentLayout} showsp={props.showsp} showdiscount={props.showdiscount} />
308
349
  </div>
309
350
  );
310
351
  } else {
@@ -315,6 +356,9 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
315
356
  className="productImageSlide"
316
357
  style={{
317
358
  height: 'auto',
359
+ width: currentLayout === 'NONE' ? '400px' : '100%',
360
+ minWidth: currentLayout === 'NONE' ? '400px' : 'unset',
361
+ maxWidth: currentLayout === 'NONE' ? '420px' : '100%',
318
362
  borderRadius: '8px',
319
363
  overflow: 'hidden',
320
364
  border: '1px solid #eee',
@@ -326,7 +370,8 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
326
370
  padding: '12px',
327
371
  boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
328
372
  transition: 'transform 0.2s ease',
329
- cursor: 'pointer'
373
+ cursor: 'pointer',
374
+ position: 'relative'
330
375
  }}
331
376
  onMouseOver={(e) => {
332
377
  e.currentTarget.style.transform = 'translateY(-2px)';
@@ -342,6 +387,26 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
342
387
  }
343
388
  }}
344
389
  >
390
+ {(Number(product?.starrating) > 0 || Number(product?.startRatingCount) > 0) && (
391
+ <div style={{
392
+ position: 'absolute',
393
+ top: '10px',
394
+ right: '10px',
395
+ zIndex: 2,
396
+ backgroundColor: 'rgba(255,255,255,0.8)',
397
+ padding: '4px 8px',
398
+ borderRadius: '20px',
399
+ display: 'flex',
400
+ alignItems: 'center',
401
+ gap: '3px',
402
+ boxShadow: '0 2px 4px rgba(0,0,0,0.1)'
403
+ }}>
404
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="#f46b27" width="10" height="10">
405
+ <path d="M10 15l-5.878 3.09 1.122-6.545L.488 6.91l6.562-.955L10 0l2.95 5.955 6.562.955-4.756 4.635 1.122 6.545z" />
406
+ </svg>
407
+ <span style={{ fontSize: '10px', color: '#333', fontWeight: '600' }}>{product.starrating}</span>
408
+ </div>
409
+ )}
345
410
  <div style={{
346
411
  height: imageHeight,
347
412
  width: '100%',
@@ -362,6 +427,7 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
362
427
  fontWeight: fontWeight,
363
428
  color: '#333',
364
429
  lineHeight: '1.4',
430
+ width: '100%',
365
431
  ...(nameHeight === 'auto' ? {} : {
366
432
  height: nameHeight,
367
433
  overflow: 'hidden',
@@ -372,7 +438,23 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
372
438
  }}>
373
439
  {typeof product.name === 'object' ? (product.name as { all: string }).all : product.name}
374
440
  </div>}
375
- </div>
441
+
442
+ {(() => {
443
+ const prices = getProductPrices(product);
444
+ return props.showsp !== false && prices.sellingPrice > 0 ? (
445
+ <div style={{ marginTop: '5px', textAlign: 'center' }}>
446
+ <p style={{ fontSize: '13px', fontWeight: '700', color: '#333', margin: 0, display: 'flex', alignItems: 'center', gap: '3px', flexWrap: 'wrap', justifyContent: 'center' }}>
447
+ <span>SP: {prices.sellingPrice.toLocaleString("en-IN")} (incl of all tax)</span>
448
+ {props.showdiscount !== false && prices.mrp > prices.sellingPrice && (
449
+ <span style={{ fontSize: '11px', color: '#666', textDecoration: 'line-through', fontWeight: 'normal' }}>
450
+ MRP: {prices.mrp.toLocaleString("en-IN")}
451
+ </span>
452
+ )}
453
+ </p>
454
+ </div>
455
+ ) : null;
456
+ })()}
457
+ </div >
376
458
  );
377
459
  }
378
460
  };
@@ -397,18 +479,11 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
397
479
  <style>
398
480
  {`
399
481
  .groupProductCarousel::-webkit-scrollbar {
400
- height: 8px;
401
- }
402
- .groupProductCarousel::-webkit-scrollbar-track {
403
- background: #f0f0f0;
404
- border-radius: 4px;
405
- }
406
- .groupProductCarousel::-webkit-scrollbar-thumb {
407
- background: #c1c1c1;
408
- border-radius: 4px;
482
+ display: none;
409
483
  }
410
- .groupProductCarousel::-webkit-scrollbar-thumb:hover {
411
- background: #a1a1a1;
484
+ .groupProductCarousel {
485
+ scrollbar-width: none;
486
+ -ms-overflow-style: none;
412
487
  }
413
488
  `}
414
489
  </style>