tee3apps-cms-sdk-react 0.0.32 → 0.0.34

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 {
@@ -203,13 +209,13 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
203
209
  if (currentstyle === 'STYLE1') {
204
210
  return (
205
211
  <div key={key}>
206
- <ProductListViewOne props={product} cardColor={props.cardColor} />
212
+ <ProductListViewOne props={product} cardColor={props.cardColor} layout={currentLayout} />
207
213
  </div>
208
214
  );
209
215
  } else if (currentstyle === 'STYLE2') {
210
216
  return (
211
217
  <div key={key}>
212
- <ProductListViewTwo props={product} cardColor={props.cardColor} />
218
+ <ProductListViewTwo props={product} cardColor={props.cardColor} layout={currentLayout} />
213
219
  </div>
214
220
  );
215
221
  } else {
@@ -220,7 +226,10 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
220
226
  className="productImageSlide"
221
227
  style={{
222
228
  height: 'auto',
223
- minWidth: deviceMode === 'mobileapp' || deviceMode === 'mobileweb' ? '120px' : '150px',
229
+ width: currentLayout === 'NONE' ? '400px' : '100%',
230
+ minWidth: currentLayout === 'NONE' ? '400px' : 'unset',
231
+ maxWidth: currentLayout === 'NONE' ? '420px' : '100%',
232
+ flex: currentLayout === 'NONE' ? '0 0 400px' : '1 1 auto',
224
233
  borderRadius: '8px',
225
234
  overflow: 'hidden',
226
235
  border: '1px solid #eee',
@@ -233,6 +242,7 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
233
242
  boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
234
243
  transition: 'transform 0.2s ease',
235
244
  cursor: 'pointer',
245
+ position: 'relative'
236
246
  }}
237
247
  onMouseOver={(e) => {
238
248
  e.currentTarget.style.transform = 'translateY(-2px)';
@@ -260,6 +270,27 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
260
270
  />
261
271
  </div>
262
272
 
273
+ {(Number(product?.starrating) > 0 || Number(product?.startRatingCount) > 0) && (
274
+ <div style={{
275
+ position: 'absolute',
276
+ top: '10px',
277
+ right: '10px',
278
+ zIndex: 2,
279
+ backgroundColor: 'rgba(255,255,255,0.8)',
280
+ padding: '4px 8px',
281
+ borderRadius: '20px',
282
+ display: 'flex',
283
+ alignItems: 'center',
284
+ gap: '3px',
285
+ boxShadow: '0 2px 4px rgba(0,0,0,0.1)'
286
+ }}>
287
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="#f46b27" width="11" height="11">
288
+ <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" />
289
+ </svg>
290
+ <span style={{ fontSize: '11px', color: '#333', fontWeight: '600' }}>{product.starrating}</span>
291
+ </div>
292
+ )}
293
+
263
294
  {showProductName && (
264
295
  <div
265
296
  style={{
@@ -277,16 +308,24 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
277
308
  }}
278
309
  >
279
310
  {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
311
  </div>
289
312
  )}
313
+
314
+ {(() => {
315
+ const prices = getProductPrices(product);
316
+ return prices.sellingPrice > 0 ? (
317
+ <div style={{ marginTop: '8px', textAlign: 'center' }}>
318
+ <p style={{ fontSize: '14px', fontWeight: '700', color: '#333', margin: 0 }}>
319
+ SP: {prices.sellingPrice.toLocaleString("en-IN")}
320
+ </p>
321
+ {prices.mrp > prices.sellingPrice && (
322
+ <p style={{ fontSize: '11px', color: '#666', textDecoration: 'line-through', margin: '1px 0' }}>
323
+ MRP: {prices.mrp.toLocaleString("en-IN")}
324
+ </p>
325
+ )}
326
+ </div>
327
+ ) : null;
328
+ })()}
290
329
  </div>
291
330
  </a>
292
331
  );
@@ -298,13 +337,13 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
298
337
  if (currentstyle === 'STYLE1') {
299
338
  return (
300
339
  <div key={key}>
301
- <ProductListViewOne props={product} cardColor={props.cardColor} />
340
+ <ProductListViewOne props={product} cardColor={props.cardColor} layout={currentLayout} />
302
341
  </div>
303
342
  );
304
343
  } else if (currentstyle === 'STYLE2') {
305
344
  return (
306
345
  <div key={key}>
307
- <ProductListViewTwo props={product} cardColor={props.cardColor} />
346
+ <ProductListViewTwo props={product} cardColor={props.cardColor} layout={currentLayout} />
308
347
  </div>
309
348
  );
310
349
  } else {
@@ -315,6 +354,9 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
315
354
  className="productImageSlide"
316
355
  style={{
317
356
  height: 'auto',
357
+ width: currentLayout === 'NONE' ? '400px' : '100%',
358
+ minWidth: currentLayout === 'NONE' ? '400px' : 'unset',
359
+ maxWidth: currentLayout === 'NONE' ? '420px' : '100%',
318
360
  borderRadius: '8px',
319
361
  overflow: 'hidden',
320
362
  border: '1px solid #eee',
@@ -326,7 +368,8 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
326
368
  padding: '12px',
327
369
  boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
328
370
  transition: 'transform 0.2s ease',
329
- cursor: 'pointer'
371
+ cursor: 'pointer',
372
+ position: 'relative'
330
373
  }}
331
374
  onMouseOver={(e) => {
332
375
  e.currentTarget.style.transform = 'translateY(-2px)';
@@ -342,6 +385,26 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
342
385
  }
343
386
  }}
344
387
  >
388
+ {(Number(product?.starrating) > 0 || Number(product?.startRatingCount) > 0) && (
389
+ <div style={{
390
+ position: 'absolute',
391
+ top: '10px',
392
+ right: '10px',
393
+ zIndex: 2,
394
+ backgroundColor: 'rgba(255,255,255,0.8)',
395
+ padding: '4px 8px',
396
+ borderRadius: '20px',
397
+ display: 'flex',
398
+ alignItems: 'center',
399
+ gap: '3px',
400
+ boxShadow: '0 2px 4px rgba(0,0,0,0.1)'
401
+ }}>
402
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="#f46b27" width="10" height="10">
403
+ <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" />
404
+ </svg>
405
+ <span style={{ fontSize: '10px', color: '#333', fontWeight: '600' }}>{product.starrating}</span>
406
+ </div>
407
+ )}
345
408
  <div style={{
346
409
  height: imageHeight,
347
410
  width: '100%',
@@ -362,6 +425,7 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
362
425
  fontWeight: fontWeight,
363
426
  color: '#333',
364
427
  lineHeight: '1.4',
428
+ width: '100%',
365
429
  ...(nameHeight === 'auto' ? {} : {
366
430
  height: nameHeight,
367
431
  overflow: 'hidden',
@@ -372,7 +436,18 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
372
436
  }}>
373
437
  {typeof product.name === 'object' ? (product.name as { all: string }).all : product.name}
374
438
  </div>}
375
- </div>
439
+
440
+ {(() => {
441
+ const prices = getProductPrices(product);
442
+ return prices.sellingPrice > 0 ? (
443
+ <div style={{ marginTop: '5px', textAlign: 'center' }}>
444
+ <p style={{ fontSize: '13px', fontWeight: '700', color: '#333', margin: 0 }}>
445
+ SP: {prices.sellingPrice.toLocaleString("en-IN")}
446
+ </p>
447
+ </div>
448
+ ) : null;
449
+ })()}
450
+ </div >
376
451
  );
377
452
  }
378
453
  };
@@ -397,18 +472,11 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
397
472
  <style>
398
473
  {`
399
474
  .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;
475
+ display: none;
409
476
  }
410
- .groupProductCarousel::-webkit-scrollbar-thumb:hover {
411
- background: #a1a1a1;
477
+ .groupProductCarousel {
478
+ scrollbar-width: none;
479
+ -ms-overflow-style: none;
412
480
  }
413
481
  `}
414
482
  </style>