diy-template-components 2.0.67 → 2.0.69

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/build/index.es.js CHANGED
@@ -226,6 +226,76 @@ const useSectionStyles$a = createUseStyles(theme => ({
226
226
  justifyContent: 'center',
227
227
  width: '10%'
228
228
  },
229
+ offerPrice: {
230
+ fontSize: theme.typography.fontSize.h4,
231
+ fontWeight: '700'
232
+ },
233
+ originalPrice: {
234
+ textDecoration: 'line-through',
235
+ color: 'rgba(51, 51, 51, 0.6)'
236
+ },
237
+ offerDiscount: {
238
+ color: '#08BD80',
239
+ fontWeight: '600'
240
+ },
241
+ rightNav: {
242
+ marginRight: '120px',
243
+ display: 'flex'
244
+ },
245
+ priceBox: {
246
+ marginRight: '16px'
247
+ },
248
+ offerBox: {
249
+ marginRight: '24px',
250
+ display: 'flex',
251
+ flexDirection: 'column',
252
+ backgroundColor: 'rgba(244, 249, 253, 1)',
253
+ justifyContent: 'space-between',
254
+ borderRadius: '8px'
255
+ },
256
+ offerBoxText: {
257
+ color: 'rgba(51, 51, 51, 0.6)',
258
+ fontWeight: '600',
259
+ fontSize: '10px',
260
+ padding: '3px 12px 3px, 12px',
261
+ padding: '4px',
262
+ textAlign: 'center',
263
+ marginTop: '4px'
264
+ },
265
+ offerBoxCountDown: {
266
+ backgroundColor: 'rgba(235, 87, 87, 0.1)',
267
+ border: '0px 1px 1px 1px',
268
+ borderRadius: '8px',
269
+ color: '#EB5757',
270
+ fontSize: '16px',
271
+ fontWeight: '700',
272
+ padding: '6px 16px'
273
+ },
274
+ BottomSheetContainer: {
275
+ display: 'flex',
276
+ flexDirection: 'column',
277
+ borderTop: '1px solid #e5e5e5',
278
+ background: '#021927',
279
+ color: '#FFFFFF'
280
+ },
281
+ BottomSheetPriceContainer: {
282
+ display: 'flex',
283
+ justifyContent: 'space-between',
284
+ padding: '16px 16px 24px'
285
+ },
286
+ BottomSheetOfferContainer: {
287
+ padding: '12px 0 ',
288
+ padding: '16px 16px 24px',
289
+ border: '1px solid rgba(0, 0, 0, 1)'
290
+ },
291
+ offerBottom: {
292
+ display: 'flex',
293
+ justifyContent: 'space-between'
294
+ },
295
+ smallText: {
296
+ fontWeight: '400',
297
+ fontSize: '8px'
298
+ },
229
299
  '@media screen and (max-width: 767px)': {
230
300
  optionsContainer: {
231
301
  flexDirection: 'column',
@@ -261,6 +331,17 @@ const useSectionStyles$a = createUseStyles(theme => ({
261
331
  borderBottom: '1px solid #F3F3F3',
262
332
  width: '100%'
263
333
  }
334
+ },
335
+ offerPrice: {
336
+ color: '#FFFFFF',
337
+ fontSize: '18px'
338
+ },
339
+ offerDiscount: {
340
+ color: 'rgba(8, 189, 128, 1)'
341
+ },
342
+ originalPrice: {
343
+ color: '#FFFFFF',
344
+ textDecoration: 'line-through'
264
345
  }
265
346
  },
266
347
  mobileAppNameClass: {
@@ -1305,8 +1386,17 @@ function DesktopHeader({
1305
1386
  navData,
1306
1387
  isTutorWebsite,
1307
1388
  isLandingPage = false,
1308
- onDownloadAppTriggered
1389
+ onDownloadAppTriggered,
1390
+ extraProps
1309
1391
  }) {
1392
+ let mockHeader = {
1393
+ isOfferActive: true,
1394
+ effectivePrice: 0.51,
1395
+ price: 1,
1396
+ discount: 0.5,
1397
+ endDate: Date.now() + 24 * 60 * 60 * 1000,
1398
+ offerPriceValidFor: 20
1399
+ };
1310
1400
  const {
1311
1401
  isFixed = true
1312
1402
  } = header;
@@ -1342,13 +1432,113 @@ function DesktopHeader({
1342
1432
 
1343
1433
  // console.log(header, 'sakshat header desktop');
1344
1434
 
1435
+ const renderer = ({
1436
+ days,
1437
+ hours,
1438
+ minutes,
1439
+ seconds
1440
+ }) => {
1441
+ if (days === 0 && hours < 24) {
1442
+ return /*#__PURE__*/React.createElement("span", null, hours, "h : ", minutes, "m : ", seconds, "s");
1443
+ } else {
1444
+ let given = moment(mockHeader.endDate);
1445
+ let current = moment().startOf('day');
1446
+ return /*#__PURE__*/React.createElement("span", null, Math.floor(moment.duration(given.diff(current)).asDays()), " ", 'Days');
1447
+ }
1448
+ };
1449
+ const checkIfOfferIsValid = (endDate = null) => moment().diff(moment(endDate || 0)) < 0;
1450
+ const checkForShowDiscount = (endDate = null, offerPriceValidFor = null, discount = 0) => {
1451
+ let conversions = extraProps?.conversions || 0;
1452
+ if (endDate === null || checkIfOfferIsValid()) {
1453
+ if (discount > 0 && offerPriceValidFor === null) {
1454
+ return true;
1455
+ } else if (discount > 0 && offerPriceValidFor !== null && offerPriceValidFor - conversions <= 0) {
1456
+ return false;
1457
+ }
1458
+ } else if (offerPriceValidFor >= null && discount) {
1459
+ if (offerPriceValidFor <= conversions) {
1460
+ return false;
1461
+ }
1462
+ if (offerPriceValidFor - conversions < 0) {
1463
+ return false;
1464
+ } else {
1465
+ return true;
1466
+ }
1467
+ }
1468
+ if (discount > 0) {
1469
+ return true;
1470
+ }
1471
+ };
1472
+ const getDiscount = (price, discount) => {
1473
+ return (discount / price * 100).toFixed(2);
1474
+ };
1475
+ const OfferDetailsJSX = () => {
1476
+ let conversions = extraProps?.conversions || 0;
1477
+ if (checkForShowDiscount(mockHeader?.endDate, mockHeader?.offerPriceValidFor, mockHeader?.discount) && mockHeader?.endDate ? checkIfOfferIsValid(mockHeader?.endDate) : true) {
1478
+ return /*#__PURE__*/React.createElement("div", {
1479
+ className: classes.rightNav
1480
+ }, mockHeader?.isOfferActive && (mockHeader?.offerPriceValidFor ? mockHeader.offerPriceValidFor - conversions > 0 : true) ? /*#__PURE__*/React.createElement("div", {
1481
+ className: classes.offerBox
1482
+ }, /*#__PURE__*/React.createElement("div", {
1483
+ className: classes.offerBoxText
1484
+ }, "Offer Ends In"), /*#__PURE__*/React.createElement("div", {
1485
+ className: classes.offerBoxCountDown
1486
+ }, /*#__PURE__*/React.createElement(Countdown, {
1487
+ renderer: renderer,
1488
+ date: mockHeader?.endDate
1489
+ }))) : null, /*#__PURE__*/React.createElement("div", {
1490
+ className: classes.priceBox
1491
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
1492
+ className: classes.offerDiscount
1493
+ }, `${getDiscount(mockHeader?.price, mockHeader?.discount)}%`, "\xA0OFF"), "\xA0\xA0", /*#__PURE__*/React.createElement("span", {
1494
+ className: classes.originalPrice
1495
+ }, mockHeader?.price), ' '), /*#__PURE__*/React.createElement("div", {
1496
+ style: {
1497
+ textAlign: 'end'
1498
+ }
1499
+ }, /*#__PURE__*/React.createElement("span", {
1500
+ className: classes.offerPrice
1501
+ }, mockHeader?.effectivePrice), ' ')), /*#__PURE__*/React.createElement(Button, {
1502
+ data: {
1503
+ // link: 'headerData?.loginCtaLink',
1504
+ // isLink: 1,
1505
+ value: 'BUY NOW'
1506
+ // isExternal: 1
1507
+ },
1508
+
1509
+ onClick: extraProps?.courseBuyNow,
1510
+ type: 'primary',
1511
+ size: 'small',
1512
+ target: null,
1513
+ name: "button",
1514
+ rel: null
1515
+ // styling={isMobile ? { margin: '0 40px' } : {}}
1516
+ }));
1517
+ } else return /*#__PURE__*/React.createElement(Button, {
1518
+ data: {
1519
+ // link: 'headerData?.loginCtaLink',
1520
+ // isLink: 1,
1521
+ value: 'BUY NOW'
1522
+ // isExternal: 1
1523
+ },
1524
+
1525
+ onClick: extraProps?.courseBuyNow,
1526
+ type: 'primary',
1527
+ size: 'medium',
1528
+ target: null,
1529
+ name: "button",
1530
+ rel: null
1531
+ // styling={isMobile ? { margin: '0 40px' } : {}}
1532
+ });
1533
+ };
1534
+
1345
1535
  return /*#__PURE__*/React.createElement("nav", {
1346
1536
  className: classes.section
1347
1537
  }, !(header?.websiteLogo === DEFAULT_HEADER_IMAGE_LP && isCustomWebsite) ? /*#__PURE__*/React.createElement("div", {
1348
1538
  className: classes.headerSection
1349
1539
  }, /*#__PURE__*/React.createElement("div", {
1350
1540
  className: classes.headerContainer
1351
- }, /*#__PURE__*/React.createElement("div", {
1541
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
1352
1542
  className: classes.imageDiv
1353
1543
  }, header?.websiteLogo ? /*#__PURE__*/React.createElement("a", {
1354
1544
  href: logoUrl,
@@ -1376,20 +1566,31 @@ function DesktopHeader({
1376
1566
  moreContent: moreContentFn(),
1377
1567
  isTutorWebsite: isTutorWebsite,
1378
1568
  onDownloadAppTriggered: onDownloadAppTriggered
1379
- }))) : /*#__PURE__*/React.createElement("div", {
1569
+ })), OfferDetailsJSX())) : /*#__PURE__*/React.createElement("div", {
1380
1570
  style: {
1381
1571
  paddingTop: '30px'
1382
1572
  }
1383
1573
  }));
1384
1574
  }
1385
1575
 
1576
+ var timer = "data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M7.99996%2015.1667C4.50663%2015.1667%201.66663%2012.3267%201.66663%208.83333C1.66663%205.34%204.50663%202.5%207.99996%202.5C11.4933%202.5%2014.3333%205.34%2014.3333%208.83333C14.3333%2012.3267%2011.4933%2015.1667%207.99996%2015.1667ZM7.99996%203.5C5.05996%203.5%202.66663%205.89333%202.66663%208.83333C2.66663%2011.7733%205.05996%2014.1667%207.99996%2014.1667C10.94%2014.1667%2013.3333%2011.7733%2013.3333%208.83333C13.3333%205.89333%2010.94%203.5%207.99996%203.5Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M8%209.16671C7.72667%209.16671%207.5%208.94004%207.5%208.66671V5.33337C7.5%205.06004%207.72667%204.83337%208%204.83337C8.27333%204.83337%208.5%205.06004%208.5%205.33337V8.66671C8.5%208.94004%208.27333%209.16671%208%209.16671Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M10%201.83337H6C5.72667%201.83337%205.5%201.60671%205.5%201.33337C5.5%201.06004%205.72667%200.833374%206%200.833374H10C10.2733%200.833374%2010.5%201.06004%2010.5%201.33337C10.5%201.60671%2010.2733%201.83337%2010%201.83337Z%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E";
1577
+
1386
1578
  function MobileHeader({
1387
1579
  header,
1388
1580
  navData,
1389
1581
  isTutorWebsite,
1390
1582
  isLandingPage = false,
1391
- onDownloadAppTriggered
1583
+ onDownloadAppTriggered,
1584
+ extraProps
1392
1585
  }) {
1586
+ let mockHeader = {
1587
+ isOfferActive: true,
1588
+ effectivePrice: 0.51,
1589
+ price: 1,
1590
+ discount: 0.5,
1591
+ endDate: Date.now() + 24 * 60 * 60 * 1000,
1592
+ offerPriceValidFor: 20
1593
+ };
1393
1594
  const {
1394
1595
  isCustomWebsite,
1395
1596
  countryCode
@@ -1425,6 +1626,94 @@ function MobileHeader({
1425
1626
 
1426
1627
  // console.log(header, 'sakshat header mobile');
1427
1628
 
1629
+ const getDiscount = (price, discount) => {
1630
+ return (discount / price * 100).toFixed(2);
1631
+ };
1632
+ const renderer = ({
1633
+ days,
1634
+ hours,
1635
+ minutes,
1636
+ seconds
1637
+ }) => {
1638
+ if (days === 0 && hours < 24) {
1639
+ return /*#__PURE__*/React.createElement("div", {
1640
+ className: classes.offerBottom
1641
+ }, /*#__PURE__*/React.createElement("div", null, "Offer ends in"), /*#__PURE__*/React.createElement("div", {
1642
+ style: {
1643
+ display: 'flex',
1644
+ gap: '5px'
1645
+ }
1646
+ }, /*#__PURE__*/React.createElement("img", {
1647
+ src: timer,
1648
+ alt: ""
1649
+ }), ' ', /*#__PURE__*/React.createElement("div", null, hours, " ", /*#__PURE__*/React.createElement("span", {
1650
+ className: classes.smallText
1651
+ }, "hrs"), " : ", minutes, ' ', /*#__PURE__*/React.createElement("span", {
1652
+ className: classes.smallText
1653
+ }, "Mins"), " : ", seconds, ' ', /*#__PURE__*/React.createElement("span", {
1654
+ className: classes.smallText
1655
+ }, "Secs"))));
1656
+ } else {
1657
+ let given = moment(mockHeader.endDate);
1658
+ let current = moment().startOf('day');
1659
+ return /*#__PURE__*/React.createElement("div", {
1660
+ className: classes.offerBottom
1661
+ }, /*#__PURE__*/React.createElement("div", null, "This offer is only valid for"), /*#__PURE__*/React.createElement("div", {
1662
+ style: {
1663
+ display: 'flex',
1664
+ gap: '5px'
1665
+ }
1666
+ }, /*#__PURE__*/React.createElement("img", {
1667
+ src: timer,
1668
+ alt: ""
1669
+ }), ' ', /*#__PURE__*/React.createElement("div", null, Math.floor(moment.duration(given.diff(current)).asDays()), /*#__PURE__*/React.createElement("span", {
1670
+ className: classes.smallText
1671
+ }, "\xA0\xA0Days"))));
1672
+ }
1673
+ };
1674
+ const OfferDetailsJSX = () => {
1675
+ return /*#__PURE__*/React.createElement("div", {
1676
+ className: classes.BottomSheetOfferContainer
1677
+ }, ' ', /*#__PURE__*/React.createElement(Countdown, {
1678
+ renderer: renderer,
1679
+ date: mockHeader?.endDate
1680
+ }));
1681
+ };
1682
+ const BottomSheetJSX = () => {
1683
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
1684
+ className: classes.BottomSheetContainer
1685
+ }, OfferDetailsJSX(), /*#__PURE__*/React.createElement("div", {
1686
+ className: classes.BottomSheetPriceContainer
1687
+ }, /*#__PURE__*/React.createElement("div", {
1688
+ className: classes.BottomSheetPrice
1689
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
1690
+ style: {
1691
+ textAlign: 'start'
1692
+ }
1693
+ }, /*#__PURE__*/React.createElement("span", {
1694
+ className: classes.offerPrice
1695
+ }, mockHeader?.effectivePrice), ' '), /*#__PURE__*/React.createElement("span", {
1696
+ className: classes.originalPrice
1697
+ }, mockHeader?.price), ' ', /*#__PURE__*/React.createElement("span", {
1698
+ className: classes.offerDiscount
1699
+ }, `${getDiscount(mockHeader?.price, mockHeader?.discount)}%`, "\xA0OFF"), "\xA0\xA0")), /*#__PURE__*/React.createElement(Button, {
1700
+ data: {
1701
+ // link: 'headerData?.loginCtaLink',
1702
+ // isLink: 1,
1703
+ value: 'BUY NOW'
1704
+ // isExternal: 1
1705
+ },
1706
+
1707
+ onClick: extraProps?.courseBuyNow,
1708
+ type: 'primary',
1709
+ size: 'medium',
1710
+ target: null,
1711
+ name: "button",
1712
+ rel: null
1713
+ // styling={isMobile ? { margin: '0 40px' } : {}}
1714
+ }))));
1715
+ };
1716
+
1428
1717
  if (isTutorWebsite) {
1429
1718
  if (isAndroidDelisted && apkURL) {
1430
1719
  downloadLink = /*#__PURE__*/React.createElement(Button, {
@@ -1497,7 +1786,7 @@ function MobileHeader({
1497
1786
  downloadLink = null;
1498
1787
  }
1499
1788
  }
1500
- return /*#__PURE__*/React.createElement("nav", {
1789
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("nav", {
1501
1790
  ref: navEl,
1502
1791
  className: classes.section
1503
1792
  }, !(header?.websiteLogo === DEFAULT_HEADER_IMAGE_LP && isCustomWebsite) ? /*#__PURE__*/React.createElement("div", {
@@ -1530,7 +1819,7 @@ function MobileHeader({
1530
1819
  order: 1
1531
1820
  }))) : null, isTutorWebsite && header?.appName ? /*#__PURE__*/React.createElement("p", {
1532
1821
  className: classes.mobileAppNameClass
1533
- }, " ", header?.appName) : null), downloadLink), sideMenu ? /*#__PURE__*/React.createElement("div", {
1822
+ }, ' ', header?.appName) : null), downloadLink), sideMenu ? /*#__PURE__*/React.createElement("div", {
1534
1823
  className: classes.mobileMenu
1535
1824
  }, /*#__PURE__*/React.createElement("div", {
1536
1825
  className: classes.backdrop,
@@ -1550,7 +1839,7 @@ function MobileHeader({
1550
1839
  style: {
1551
1840
  paddingTop: '30px'
1552
1841
  }
1553
- }));
1842
+ })), /*#__PURE__*/React.createElement(BottomSheetJSX, null));
1554
1843
  }
1555
1844
 
1556
1845
  function Header({
@@ -1570,13 +1859,15 @@ function Header({
1570
1859
  header: data,
1571
1860
  isTutorWebsite: isTutorWebsite,
1572
1861
  isLandingPage: isLandingPage,
1573
- onDownloadAppTriggered: extraProps?.DownloadAppButtonTriggered
1862
+ onDownloadAppTriggered: extraProps?.DownloadAppButtonTriggered,
1863
+ extraProps: extraProps
1574
1864
  }) : /*#__PURE__*/React.createElement(DesktopHeader, {
1575
1865
  navData: filterHiddenNavs(),
1576
1866
  header: data,
1577
1867
  isTutorWebsite: isTutorWebsite,
1578
1868
  isLandingPage: isLandingPage,
1579
- onDownloadAppTriggered: extraProps?.DownloadAppButtonTriggered
1869
+ onDownloadAppTriggered: extraProps?.DownloadAppButtonTriggered,
1870
+ extraProps: extraProps
1580
1871
  });
1581
1872
  }
1582
1873
 
@@ -10206,21 +10497,28 @@ const TimerAndCall = ({
10206
10497
  text: "Secs"
10207
10498
  }));
10208
10499
  };
10500
+ const CountDownJSX = offerPriceValidFor => {
10501
+ let conversions = extraProps?.conversions || 0;
10502
+ if (offerPriceValidFor && offerPriceValidFor - conversions <= 0) {
10503
+ return null;
10504
+ }
10505
+ return /*#__PURE__*/React.createElement("div", {
10506
+ className: classes.offerWrapper
10507
+ }, /*#__PURE__*/React.createElement("div", {
10508
+ className: classes.offerEndsTitle
10509
+ }, "Offer ends in"), /*#__PURE__*/React.createElement(Countdown, {
10510
+ renderer: renderer,
10511
+ date: nodeData.offerCounter?.metadata?.endDate,
10512
+ daysInHours: true
10513
+ }));
10514
+ };
10209
10515
  return /*#__PURE__*/React.createElement("section", {
10210
10516
  className: classes.timerAndCallSection
10211
10517
  }, /*#__PURE__*/React.createElement("div", {
10212
10518
  className: classes.timerAndCallContainer
10213
10519
  }, /*#__PURE__*/React.createElement("div", {
10214
10520
  className: classes.timerAndCallBox
10215
- }, nodeData?.showOffer?.metadata?.value && nodeData.offerCounter?.metadata?.isOfferActive ? /*#__PURE__*/React.createElement("div", {
10216
- className: classes.offerWrapper
10217
- }, /*#__PURE__*/React.createElement("div", {
10218
- className: classes.offerEndsTitle
10219
- }, "Offer ends in"), /*#__PURE__*/React.createElement(Countdown, {
10220
- renderer: renderer,
10221
- date: nodeData.offerCounter?.metadata?.endDate,
10222
- daysInHours: true
10223
- })) : null, nodeData?.title?.metadata?.value ? /*#__PURE__*/React.createElement("div", {
10521
+ }, nodeData?.showOffer?.metadata?.value && nodeData.offerCounter?.metadata?.isOfferActive ? CountDownJSX(nodeData.offerCounter?.metadata?.offerPriceValidFor) : null, nodeData?.title?.metadata?.value ? /*#__PURE__*/React.createElement("div", {
10224
10522
  className: classes.title
10225
10523
  }, /*#__PURE__*/React.createElement("span", {
10226
10524
  ref: nodeData?.heading?.refSetter,