diy-template-components 2.0.66 → 2.0.68

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,51 @@ 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
+ },
229
274
  '@media screen and (max-width: 767px)': {
230
275
  optionsContainer: {
231
276
  flexDirection: 'column',
@@ -1305,8 +1350,17 @@ function DesktopHeader({
1305
1350
  navData,
1306
1351
  isTutorWebsite,
1307
1352
  isLandingPage = false,
1308
- onDownloadAppTriggered
1353
+ onDownloadAppTriggered,
1354
+ extraProps
1309
1355
  }) {
1356
+ let mockHeader = {
1357
+ isOfferActive: true,
1358
+ effectivePrice: 0.51,
1359
+ price: 1,
1360
+ discount: 0.5,
1361
+ endDate: Date.now() + 24 * 60 * 60 * 1000,
1362
+ offerPriceValidFor: 20
1363
+ };
1310
1364
  const {
1311
1365
  isFixed = true
1312
1366
  } = header;
@@ -1342,13 +1396,113 @@ function DesktopHeader({
1342
1396
 
1343
1397
  // console.log(header, 'sakshat header desktop');
1344
1398
 
1399
+ const renderer = ({
1400
+ days,
1401
+ hours,
1402
+ minutes,
1403
+ seconds
1404
+ }) => {
1405
+ if (days === 0 && hours < 24) {
1406
+ return /*#__PURE__*/React.createElement("span", null, hours, "h : ", minutes, "m : ", seconds, "s");
1407
+ } else {
1408
+ let given = moment(mockHeader.endDate);
1409
+ let current = moment().startOf('day');
1410
+ return /*#__PURE__*/React.createElement("span", null, Math.floor(moment.duration(given.diff(current)).asDays()), " ", 'Days');
1411
+ }
1412
+ };
1413
+ const checkIfOfferIsValid = (endDate = null) => moment().diff(moment(endDate || 0)) < 0;
1414
+ const checkForShowDiscount = (endDate = null, offerPriceValidFor = null, discount = 0) => {
1415
+ let conversions = extraProps?.conversions || 0;
1416
+ if (endDate === null || checkIfOfferIsValid()) {
1417
+ if (discount > 0 && offerPriceValidFor === null) {
1418
+ return true;
1419
+ } else if (discount > 0 && offerPriceValidFor !== null && offerPriceValidFor - conversions <= 0) {
1420
+ return false;
1421
+ }
1422
+ } else if (offerPriceValidFor >= null && discount) {
1423
+ if (offerPriceValidFor <= conversions) {
1424
+ return false;
1425
+ }
1426
+ if (offerPriceValidFor - conversions < 0) {
1427
+ return false;
1428
+ } else {
1429
+ return true;
1430
+ }
1431
+ }
1432
+ if (discount > 0) {
1433
+ return true;
1434
+ }
1435
+ };
1436
+ const getDiscount = (price, discount) => {
1437
+ return (discount / price * 100).toFixed(2);
1438
+ };
1439
+ const OfferDetailsJSX = () => {
1440
+ let conversions = extraProps?.conversions || 0;
1441
+ if (checkForShowDiscount(mockHeader?.endDate, mockHeader?.offerPriceValidFor, mockHeader?.discount) && mockHeader?.endDate ? checkIfOfferIsValid(mockHeader?.endDate) : true) {
1442
+ return /*#__PURE__*/React.createElement("div", {
1443
+ className: classes.rightNav
1444
+ }, mockHeader?.isOfferActive && (mockHeader?.offerPriceValidFor ? mockHeader.offerPriceValidFor - conversions > 0 : true) ? /*#__PURE__*/React.createElement("div", {
1445
+ className: classes.offerBox
1446
+ }, /*#__PURE__*/React.createElement("div", {
1447
+ className: classes.offerBoxText
1448
+ }, "Offer Ends In"), /*#__PURE__*/React.createElement("div", {
1449
+ className: classes.offerBoxCountDown
1450
+ }, /*#__PURE__*/React.createElement(Countdown, {
1451
+ renderer: renderer,
1452
+ date: mockHeader?.endDate
1453
+ }))) : null, /*#__PURE__*/React.createElement("div", {
1454
+ className: classes.priceBox
1455
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
1456
+ className: classes.offerDiscount
1457
+ }, `${getDiscount(mockHeader?.price, mockHeader?.discount)}%`, "\xA0OFF"), "\xA0\xA0", /*#__PURE__*/React.createElement("span", {
1458
+ className: classes.originalPrice
1459
+ }, mockHeader?.price), ' '), /*#__PURE__*/React.createElement("div", {
1460
+ style: {
1461
+ textAlign: 'end'
1462
+ }
1463
+ }, /*#__PURE__*/React.createElement("span", {
1464
+ className: classes.offerPrice
1465
+ }, mockHeader?.effectivePrice), ' ')), /*#__PURE__*/React.createElement(Button, {
1466
+ data: {
1467
+ // link: 'headerData?.loginCtaLink',
1468
+ // isLink: 1,
1469
+ value: 'BUY NOW'
1470
+ // isExternal: 1
1471
+ },
1472
+
1473
+ onClick: extraProps?.courseBuyNow,
1474
+ type: 'primary',
1475
+ size: 'small',
1476
+ target: null,
1477
+ name: "button",
1478
+ rel: null
1479
+ // styling={isMobile ? { margin: '0 40px' } : {}}
1480
+ }));
1481
+ } else return /*#__PURE__*/React.createElement(Button, {
1482
+ data: {
1483
+ // link: 'headerData?.loginCtaLink',
1484
+ // isLink: 1,
1485
+ value: 'BUY NOW'
1486
+ // isExternal: 1
1487
+ },
1488
+
1489
+ onClick: extraProps?.courseBuyNow,
1490
+ type: 'primary',
1491
+ size: 'medium',
1492
+ target: null,
1493
+ name: "button",
1494
+ rel: null
1495
+ // styling={isMobile ? { margin: '0 40px' } : {}}
1496
+ });
1497
+ };
1498
+
1345
1499
  return /*#__PURE__*/React.createElement("nav", {
1346
1500
  className: classes.section
1347
1501
  }, !(header?.websiteLogo === DEFAULT_HEADER_IMAGE_LP && isCustomWebsite) ? /*#__PURE__*/React.createElement("div", {
1348
1502
  className: classes.headerSection
1349
1503
  }, /*#__PURE__*/React.createElement("div", {
1350
1504
  className: classes.headerContainer
1351
- }, /*#__PURE__*/React.createElement("div", {
1505
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
1352
1506
  className: classes.imageDiv
1353
1507
  }, header?.websiteLogo ? /*#__PURE__*/React.createElement("a", {
1354
1508
  href: logoUrl,
@@ -1376,7 +1530,7 @@ function DesktopHeader({
1376
1530
  moreContent: moreContentFn(),
1377
1531
  isTutorWebsite: isTutorWebsite,
1378
1532
  onDownloadAppTriggered: onDownloadAppTriggered
1379
- }))) : /*#__PURE__*/React.createElement("div", {
1533
+ })), OfferDetailsJSX())) : /*#__PURE__*/React.createElement("div", {
1380
1534
  style: {
1381
1535
  paddingTop: '30px'
1382
1536
  }
@@ -1570,13 +1724,15 @@ function Header({
1570
1724
  header: data,
1571
1725
  isTutorWebsite: isTutorWebsite,
1572
1726
  isLandingPage: isLandingPage,
1573
- onDownloadAppTriggered: extraProps?.DownloadAppButtonTriggered
1727
+ onDownloadAppTriggered: extraProps?.DownloadAppButtonTriggered,
1728
+ extraProps: extraProps
1574
1729
  }) : /*#__PURE__*/React.createElement(DesktopHeader, {
1575
1730
  navData: filterHiddenNavs(),
1576
1731
  header: data,
1577
1732
  isTutorWebsite: isTutorWebsite,
1578
1733
  isLandingPage: isLandingPage,
1579
- onDownloadAppTriggered: extraProps?.DownloadAppButtonTriggered
1734
+ onDownloadAppTriggered: extraProps?.DownloadAppButtonTriggered,
1735
+ extraProps: extraProps
1580
1736
  });
1581
1737
  }
1582
1738
 
@@ -10102,7 +10258,7 @@ const useTimerCallPageStyles = createUseStyles(theme => ({
10102
10258
  },
10103
10259
  timerAndCallContainer: {
10104
10260
  padding: '72px',
10105
- background: theme?.colors?.background3,
10261
+ background: '#F4F9FF',
10106
10262
  borderRadius: '8px',
10107
10263
  boxShadow: '0px 4px 10px rgba(0, 0, 0, 0.16)'
10108
10264
  },
@@ -10116,7 +10272,8 @@ const useTimerCallPageStyles = createUseStyles(theme => ({
10116
10272
  title: {
10117
10273
  fontWeight: '700',
10118
10274
  fontSize: '40px',
10119
- textAlign: 'center'
10275
+ textAlign: 'center',
10276
+ lineHeight: '45px'
10120
10277
  },
10121
10278
  offerWrapper: {
10122
10279
  display: 'flex',
@@ -10205,28 +10362,35 @@ const TimerAndCall = ({
10205
10362
  text: "Secs"
10206
10363
  }));
10207
10364
  };
10365
+ const CountDownJSX = offerPriceValidFor => {
10366
+ let conversions = extraProps?.conversions || 0;
10367
+ if (offerPriceValidFor && offerPriceValidFor - conversions <= 0) {
10368
+ return null;
10369
+ }
10370
+ return /*#__PURE__*/React.createElement("div", {
10371
+ className: classes.offerWrapper
10372
+ }, /*#__PURE__*/React.createElement("div", {
10373
+ className: classes.offerEndsTitle
10374
+ }, "Offer ends in"), /*#__PURE__*/React.createElement(Countdown, {
10375
+ renderer: renderer,
10376
+ date: nodeData.offerCounter?.metadata?.endDate,
10377
+ daysInHours: true
10378
+ }));
10379
+ };
10208
10380
  return /*#__PURE__*/React.createElement("section", {
10209
10381
  className: classes.timerAndCallSection
10210
10382
  }, /*#__PURE__*/React.createElement("div", {
10211
10383
  className: classes.timerAndCallContainer
10212
10384
  }, /*#__PURE__*/React.createElement("div", {
10213
10385
  className: classes.timerAndCallBox
10214
- }, nodeData?.showOffer?.metadata?.value && nodeData.offerCounter?.metadata?.isOfferActive ? /*#__PURE__*/React.createElement("div", {
10215
- className: classes.offerWrapper
10216
- }, /*#__PURE__*/React.createElement("div", {
10217
- className: classes.offerEndsTitle
10218
- }, "Offer ends in"), /*#__PURE__*/React.createElement(Countdown, {
10219
- renderer: renderer,
10220
- date: nodeData.offerCounter?.metadata?.endDate,
10221
- daysInHours: true
10222
- })) : null, nodeData?.title?.metadata?.value ? /*#__PURE__*/React.createElement("div", {
10386
+ }, nodeData?.showOffer?.metadata?.value && nodeData.offerCounter?.metadata?.isOfferActive ? CountDownJSX(nodeData.offerCounter?.metadata?.offerPriceValidFor) : null, nodeData?.title?.metadata?.value ? /*#__PURE__*/React.createElement("div", {
10223
10387
  className: classes.title
10224
10388
  }, /*#__PURE__*/React.createElement("span", {
10225
10389
  ref: nodeData?.heading?.refSetter,
10226
10390
  dangerouslySetInnerHTML: {
10227
10391
  __html: nodeData?.title?.metadata?.value
10228
10392
  }
10229
- })) : null, /*#__PURE__*/React.createElement(Button, {
10393
+ })) : null, nodeData?.timerButton?.metadata?.value ? /*#__PURE__*/React.createElement(Button, {
10230
10394
  style: {
10231
10395
  width: '100%',
10232
10396
  fontWeight: '700',
@@ -10235,18 +10399,18 @@ const TimerAndCall = ({
10235
10399
  data: {
10236
10400
  // link: 'headerData?.loginCtaLink',
10237
10401
  // isLink: 1,
10238
- value: 'Buy Now today for ₹1,000'
10402
+ value: nodeData.timerButton.metadata.value
10239
10403
  // isExternal: 1
10240
10404
  },
10241
10405
 
10242
- onClick: () => {},
10406
+ onClick: extraProps?.courseBuyNow,
10243
10407
  type: 'primary',
10244
10408
  size: 'medium',
10245
10409
  target: null,
10246
10410
  name: "button",
10247
10411
  rel: null
10248
10412
  // styling={isMobile ? { margin: '0 40px' } : {}}
10249
- }))));
10413
+ }) : null)));
10250
10414
  };
10251
10415
 
10252
10416
  var index = /*#__PURE__*/Object.freeze({