diy-template-components 0.2.68 → 0.2.70

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.
Binary file
Binary file
package/build/index.es.js CHANGED
@@ -1,12 +1,12 @@
1
- function ___$insertStyle(css) {
2
- if (!css || typeof window === 'undefined') {
3
- return;
4
- }
5
- const style = document.createElement('style');
6
- style.setAttribute('type', 'text/css');
7
- style.innerHTML = css;
8
- document.head.appendChild(style);
9
- return css;
1
+ function ___$insertStyle(css) {
2
+ if (!css || !window) {
3
+ return;
4
+ }
5
+ const style = document.createElement('style');
6
+ style.setAttribute('type', 'text/css');
7
+ style.innerHTML = css;
8
+ document.head.appendChild(style);
9
+ return css;
10
10
  }
11
11
 
12
12
  import React, { createContext, useContext, forwardRef, useRef, useEffect, useState, useMemo, useLayoutEffect, Suspense, memo, lazy, Fragment } from 'react';
@@ -2068,7 +2068,9 @@ function PageRenderer$1({
2068
2068
  isTutorWebsite = false,
2069
2069
  extraProps,
2070
2070
  hideLogin,
2071
- isCustomWebsite
2071
+ isCustomWebsite,
2072
+ countryCode,
2073
+ currencySymbol
2072
2074
  }) {
2073
2075
  const theme = useMemo(() => getTheme(color, font), [color, font]);
2074
2076
  const navList = header?.navs;
@@ -2089,8 +2091,10 @@ function PageRenderer$1({
2089
2091
  extraProps,
2090
2092
  hideLogin,
2091
2093
  isCustomWebsite,
2092
- _id
2093
- }), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin, _id]);
2094
+ _id,
2095
+ countryCode,
2096
+ currencySymbol
2097
+ }), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin, _id, countryCode, currencySymbol]);
2094
2098
  const Wrapper = SectionWrapper || Fragment;
2095
2099
  return /*#__PURE__*/React.createElement(ThemeProvider, {
2096
2100
  theme: theme
@@ -2803,7 +2807,7 @@ var index$k = /*#__PURE__*/Object.freeze({
2803
2807
  const useSectionStyles$6 = createUseStyles(theme => ({
2804
2808
  bannerCarouselCenterSection: {
2805
2809
  width: '100%',
2806
- height: '100%',
2810
+ // height: '100%',
2807
2811
  textAlign: 'center',
2808
2812
  position: 'relative',
2809
2813
  '&, & *, & *:before, & *:after': {
@@ -2837,7 +2841,7 @@ const useSectionStyles$6 = createUseStyles(theme => ({
2837
2841
  // height: '100%',
2838
2842
  // display: 'flex',
2839
2843
  // alignItems: 'center'
2840
- height: '100%',
2844
+ // height: '100%',
2841
2845
  display: 'flex',
2842
2846
  /* padding: 100px 0; */
2843
2847
  alignItems: 'center'
@@ -2908,9 +2912,10 @@ const useSectionStyles$6 = createUseStyles(theme => ({
2908
2912
  textContainer: {
2909
2913
  padding: '20px 20px',
2910
2914
  height: '100%',
2911
- width: '100%',
2912
- backgroundColor: theme?.palette?.background?.primary
2915
+ width: '100%'
2916
+ // backgroundColor: theme?.palette?.background?.primary
2913
2917
  },
2918
+
2914
2919
  subTitleHeading: {
2915
2920
  color: theme?.palette?.font?.tertiary
2916
2921
  },
@@ -2964,34 +2969,34 @@ const Section$3 = ({
2964
2969
  className: classes.contentContainer
2965
2970
  }, /*#__PURE__*/React.createElement("div", {
2966
2971
  className: classes.sectionContainer
2967
- }, /*#__PURE__*/React.createElement("div", {
2972
+ }, !(nodeData.cardHeading.metadata.value === '<br>' && nodeData.title.metadata.value === '<br>' && nodeData.description.metadata.value === '<br>' && nodeData?.cta?.metadata?.value === '') ? /*#__PURE__*/React.createElement("div", {
2968
2973
  className: classes.textContainer
2969
- }, /*#__PURE__*/React.createElement("div", {
2974
+ }, nodeData.cardHeading.metadata.value !== '<br>' ? /*#__PURE__*/React.createElement("div", {
2970
2975
  className: classes.subTitleHeading
2971
2976
  }, /*#__PURE__*/React.createElement("span", {
2972
2977
  ref: nodeData?.cardHeading?.refSetter,
2973
2978
  dangerouslySetInnerHTML: {
2974
2979
  __html: nodeData.cardHeading.metadata.value
2975
2980
  }
2976
- })), /*#__PURE__*/React.createElement("h2", {
2981
+ })) : null, nodeData.title.metadata.value !== '<br>' ? /*#__PURE__*/React.createElement("h2", {
2977
2982
  className: classes.heading
2978
2983
  }, /*#__PURE__*/React.createElement("span", {
2979
2984
  ref: nodeData?.title?.refSetter,
2980
2985
  dangerouslySetInnerHTML: {
2981
2986
  __html: nodeData.title.metadata.value
2982
2987
  }
2983
- })), /*#__PURE__*/React.createElement("p", {
2988
+ })) : null, nodeData.description.metadata.value !== '<br>' ? /*#__PURE__*/React.createElement("p", {
2984
2989
  ref: nodeData?.description?.refSetter,
2985
2990
  className: classes.description,
2986
2991
  dangerouslySetInnerHTML: {
2987
2992
  __html: nodeData.description.metadata.value
2988
2993
  }
2989
- }), nodeData?.cta?.validations?.isEmptyAllowed && nodeData?.cta?.metadata?.value === '' ? null : /*#__PURE__*/React.createElement(Button, {
2994
+ }) : null, nodeData?.cta?.validations?.isEmptyAllowed && nodeData?.cta?.metadata?.value === '' ? null : /*#__PURE__*/React.createElement(Button, {
2990
2995
  ref: nodeData?.cta?.refSetter,
2991
2996
  data: nodeData.cta.metadata,
2992
2997
  type: nodeData?.cta?.metadata?.type,
2993
2998
  size: isMobile ? 'small' : 'medium'
2994
- }))), /*#__PURE__*/React.createElement("div", {
2999
+ })) : null), /*#__PURE__*/React.createElement("div", {
2995
3000
  className: classes?.centerBgImageContainer
2996
3001
  }, /*#__PURE__*/React.createElement(NextImageRenderer, {
2997
3002
  src: nodeData.image.metadata.value,
@@ -5460,7 +5465,11 @@ const useCourseStyles = createUseStyles(theme => {
5460
5465
  },
5461
5466
  courseCardImgThumbnail: {
5462
5467
  borderTopLeftRadius: theme?.shape?.borderRadius?.regular,
5463
- borderTopRightRadius: theme?.shape?.borderRadius?.regular
5468
+ borderTopRightRadius: theme?.shape?.borderRadius?.regular,
5469
+ maxWidth: '100%',
5470
+ minHeight: '100%',
5471
+ maxHeight: '100%',
5472
+ minWidth: '100%'
5464
5473
  },
5465
5474
  courseCardData: {
5466
5475
  padding: '20px',
@@ -5641,8 +5650,61 @@ function getShortenedSubstring(name, length, allowDots = true) {
5641
5650
  return '';
5642
5651
  }
5643
5652
 
5653
+ const formatCurrency = (countryCode, value, currencySymbol) => {
5654
+ let formattedValue = Number(value);
5655
+ const getFormattedValue = (countryCode, currencySymbol, value) => {
5656
+ return new Intl.NumberFormat(countryCode, {
5657
+ // style: "currency",
5658
+ // currency: currency,
5659
+ minimumFractionDigits: 0,
5660
+ maximumFractionDigits: 0
5661
+ }).format(value);
5662
+ };
5663
+ const getFormattedFractionValue = (countryCode, currencySymbol, value) => {
5664
+ return new Intl.NumberFormat(countryCode, {
5665
+ minimumFractionDigits: 2,
5666
+ maximumFractionDigits: 2
5667
+ }).format(value);
5668
+ };
5669
+ let func = getFormattedValue;
5670
+ if (countryCode === 'IN' || countryCode === 'SG') {
5671
+ if (value % 1 !== 0) {
5672
+ func = getFormattedFractionValue;
5673
+ }
5674
+ }
5675
+
5676
+ // India
5677
+ if (countryCode === 'IN') {
5678
+ formattedValue = `₹ ${func('en-IN', 'INR', value)}`;
5679
+ }
5680
+ // Vietnam
5681
+ else if (countryCode === 'VI' || countryCode === 'VN') {
5682
+ if (currencySymbol === '$') {
5683
+ formattedValue = `$ ${func('en-US', 'USD', value)}`;
5684
+ } else {
5685
+ formattedValue = `${func('vi-VN', 'VND', value)} đ`;
5686
+ formattedValue = formattedValue.replace(/[.]/g, ',');
5687
+ }
5688
+ }
5689
+ // South Korea
5690
+ else if (countryCode === 'KR') {
5691
+ if (currencySymbol === '$') {
5692
+ formattedValue = `$ ${func('en-US', 'USD', value)}`;
5693
+ } else {
5694
+ formattedValue = `${func('ko-KR', 'KRW', value)} 원`;
5695
+ }
5696
+ }
5697
+ // Singapore
5698
+ else if (countryCode === 'SG') {
5699
+ formattedValue = `S$ ${func('en-SG', 'SGD', value)}`;
5700
+ }
5701
+ return formattedValue;
5702
+ };
5703
+
5644
5704
  function CourseCard({
5645
- card
5705
+ card,
5706
+ countryCode,
5707
+ currencySymbol
5646
5708
  }) {
5647
5709
  const classes = useCourseStyles();
5648
5710
  const {
@@ -5650,6 +5712,10 @@ function CourseCard({
5650
5712
  } = useContext(PageContext);
5651
5713
  const discount = parseInt((card?.price - card?.finalPrice) / card?.price * 100).toFixed(2);
5652
5714
  const defaultCardImg = 'https://cp-assets-public.s3.ap-south-1.amazonaws.com/cams/cards-icon/default_course.png';
5715
+ const price = formatCurrency(countryCode, card?.price, currencySymbol);
5716
+ const finalPrice = formatCurrency(countryCode, card?.finalPrice, currencySymbol);
5717
+ const buyNowText = countryCode === 'KR' ? '이 강좌를 수강하세요.' : 'Buy Now';
5718
+ const offText = countryCode === 'KR' ? '할인' : 'OFF';
5653
5719
  return /*#__PURE__*/React.createElement("div", {
5654
5720
  className: classes.singleCard
5655
5721
  }, /*#__PURE__*/React.createElement("div", {
@@ -5684,14 +5750,14 @@ function CourseCard({
5684
5750
  className: classes.courseCardPriceContainer
5685
5751
  }, /*#__PURE__*/React.createElement("div", {
5686
5752
  className: classes.courseCardPrice
5687
- }, '₹', card?.finalPrice), card?.price !== card?.finalPrice ? /*#__PURE__*/React.createElement("div", {
5753
+ }, finalPrice), card?.price !== card?.finalPrice ? /*#__PURE__*/React.createElement("div", {
5688
5754
  className: classes.courseCardStrikePrice
5689
- }, /*#__PURE__*/React.createElement("span", null, '₹', card?.price), ' ', discount > 0 && discount + '% OFF') : null), /*#__PURE__*/React.createElement("a", {
5755
+ }, /*#__PURE__*/React.createElement("span", null, price), " ", discount > 0 && discount + `% ${offText}`) : null), /*#__PURE__*/React.createElement("a", {
5690
5756
  className: classes.coursesAnchorTag,
5691
5757
  href: isEdit ? null : card?.shareableLink
5692
5758
  }, /*#__PURE__*/React.createElement("div", {
5693
5759
  className: classes.courseCardBuyBtn
5694
- }, "Buy Now")))));
5760
+ }, buyNowText)))));
5695
5761
  }
5696
5762
 
5697
5763
  function courses({
@@ -5705,7 +5771,9 @@ function courses({
5705
5771
  baseURLs,
5706
5772
  hashToken,
5707
5773
  isMasterTemplate,
5708
- isEdit
5774
+ isEdit,
5775
+ countryCode,
5776
+ currencySymbol
5709
5777
  } = useContext(PageContext);
5710
5778
  const [cardList, setCardList] = useState(null);
5711
5779
  const [errored, setErrored] = useState(false);
@@ -5795,7 +5863,9 @@ function courses({
5795
5863
  }
5796
5864
  })), !showShimmer ? /*#__PURE__*/React.createElement(Wrapper, wrapperProps, cardList != null ? cardList?.map((card, index) => /*#__PURE__*/React.createElement(CourseCard, {
5797
5865
  key: index,
5798
- card: card
5866
+ card: card,
5867
+ countryCode: countryCode,
5868
+ currencySymbol: currencySymbol
5799
5869
  })) : fallBackImages?.map((dt, ind) => {
5800
5870
  return /*#__PURE__*/React.createElement(Fragment, {
5801
5871
  key: ind
@@ -7103,16 +7173,13 @@ const SingleVideoSlide$1 = props => {
7103
7173
  };
7104
7174
  const checkIfOfferIsValid = () => moment().diff(moment(props.data.offerPriceEndDate)) < 0;
7105
7175
  const checkForShowDiscount = () => {
7106
- if (checkIfOfferIsValid() && data?.discount) {
7107
- return true;
7108
- }
7109
7176
  if (props.data.endDate === null || checkIfOfferIsValid()) {
7110
- if (data.discount > 0 && data.offerPriceValidFor === 0) {
7177
+ if (data.discount > 0 && data.offerPriceValidFor === null) {
7111
7178
  return true;
7112
- } else if (data.discount > 0 && data.offerPriceValidFor !== 0 && data.offerPriceValidFor - conversions <= 0) {
7179
+ } else if (data.discount > 0 && data.offerPriceValidFor !== null && data.offerPriceValidFor - conversions <= 0) {
7113
7180
  return false;
7114
7181
  }
7115
- } else if (data.offerPriceValidFor >= 0 && data.discount) {
7182
+ } else if (data.offerPriceValidFor >= null && data.discount) {
7116
7183
  if (data.offerPriceValidFor <= conversions) {
7117
7184
  return false;
7118
7185
  }
@@ -7141,11 +7208,11 @@ const SingleVideoSlide$1 = props => {
7141
7208
  className: classes.iframeSuperContainer
7142
7209
  }, /*#__PURE__*/React.createElement("div", {
7143
7210
  className: classes.videoDetails
7144
- }, data?.isPaid !== 0 && (checkIfOfferIsValid() || data.offerPriceValidFor > 0) && /*#__PURE__*/React.createElement("div", null, data.offerPriceValidFor - conversions > 0 && (data.offerPriceEndDate ? checkIfOfferIsValid() : true) ? /*#__PURE__*/React.createElement("div", {
7211
+ }, data?.isPaid !== 0 && (checkIfOfferIsValid() || data.offerPriceValidFor > 0) && /*#__PURE__*/React.createElement("div", null, data.offerPriceValidFor > conversions && (data.discount && data.offerPriceEndDate ? checkIfOfferIsValid() : true) ? /*#__PURE__*/React.createElement("div", {
7145
7212
  className: classes.bannerContainer
7146
7213
  }, /*#__PURE__*/React.createElement("div", {
7147
7214
  className: classes.bannerContainerText
7148
- }, "Hurry up! Offer left for", ' ', data.offerPriceValidFor - conversions, ' ', data.offerPriceValidFor - conversions > 1 ? 'users now' : 'user only')) : checkIfOfferIsValid() && /*#__PURE__*/React.createElement("div", {
7215
+ }, "Hurry up! Offer left for", ' ', data.offerPriceValidFor - conversions, ' ', data.offerPriceValidFor - conversions > 1 ? 'users now' : 'user only')) : checkIfOfferIsValid() && data.offerPriceValidFor !== null ? data.offerPriceValidFor - conversions > 0 : /*#__PURE__*/React.createElement("div", {
7149
7216
  className: classes.bannerContainer
7150
7217
  }, /*#__PURE__*/React.createElement("div", {
7151
7218
  className: classes.bannerContainerText
@@ -7189,7 +7256,7 @@ const SingleVideoSlide$1 = props => {
7189
7256
  }
7190
7257
  }))), /*#__PURE__*/React.createElement("div", {
7191
7258
  className: classes.courseViewContainer
7192
- }, data.isPaid !== 0 && checkIfOfferIsValid() && (data.offerPriceValidFor === 0 ? data.offerPriceValidFor - conversions > 0 : true) && /*#__PURE__*/React.createElement("p", {
7259
+ }, data.isPaid !== 0 && checkIfOfferIsValid() && (data.offerPriceValidFor !== null ? data.offerPriceValidFor - conversions > 0 : true) && /*#__PURE__*/React.createElement("p", {
7193
7260
  className: classes.offerText
7194
7261
  }, "Offer Ends in", ' ', /*#__PURE__*/React.createElement("span", {
7195
7262
  className: classes.courseDetailTime
@@ -7595,12 +7662,12 @@ const SingleVideoSlide = props => {
7595
7662
  const checkIfOfferIsValid = () => moment().diff(moment(props?.data?.endDate || 0)) < 0;
7596
7663
  const checkForShowDiscount = () => {
7597
7664
  if (props.data.endDate === null || checkIfOfferIsValid()) {
7598
- if (data.discount > 0 && data.offerPriceValidFor === 0) {
7665
+ if (data.discount > 0 && data.offerPriceValidFor === null) {
7599
7666
  return true;
7600
- } else if (data.discount > 0 && data.offerPriceValidFor !== 0 && data.offerPriceValidFor - conversions <= 0) {
7667
+ } else if (data.discount > 0 && data.offerPriceValidFor !== null && data.offerPriceValidFor - conversions <= 0) {
7601
7668
  return false;
7602
7669
  }
7603
- } else if (data.offerPriceValidFor >= 0 && data.discount) {
7670
+ } else if (data.offerPriceValidFor >= null && data.discount) {
7604
7671
  if (data.offerPriceValidFor <= conversions) {
7605
7672
  return false;
7606
7673
  }
@@ -7629,7 +7696,7 @@ const SingleVideoSlide = props => {
7629
7696
  className: classes.iframeSuperContainer
7630
7697
  }, /*#__PURE__*/React.createElement("div", {
7631
7698
  className: classes.videoDetails
7632
- }, (checkIfOfferIsValid() || data.offerPriceValidFor > 0) && data.offerPriceValidFor > conversions && /*#__PURE__*/React.createElement("div", null, data.offerPriceValidFor - conversions > 0 && data.discount && (data.endDate ? checkIfOfferIsValid() : true) ? /*#__PURE__*/React.createElement("div", {
7699
+ }, (checkIfOfferIsValid() || data.offerPriceValidFor > 0) && (data.offerPriceValidFor > conversions || data.offerPriceValidFor === null) && /*#__PURE__*/React.createElement("div", null, data.offerPriceValidFor - conversions > 0 && data.discount && (data.endDate ? checkIfOfferIsValid() : true) ? /*#__PURE__*/React.createElement("div", {
7633
7700
  className: classes.bannerContainer
7634
7701
  }, /*#__PURE__*/React.createElement("div", {
7635
7702
  className: classes.bannerContainerText
@@ -7702,7 +7769,7 @@ const SingleVideoSlide = props => {
7702
7769
  }
7703
7770
  }, /*#__PURE__*/React.createElement("div", {
7704
7771
  className: classes.courseViewContainer
7705
- }, checkIfOfferIsValid() && (data.offerPriceValidFor !== 0 ? data.offerPriceValidFor - conversions > 0 : true) && /*#__PURE__*/React.createElement("p", {
7772
+ }, checkIfOfferIsValid() && (data.offerPriceValidFor !== null ? data.offerPriceValidFor - conversions > 0 : true) && /*#__PURE__*/React.createElement("p", {
7706
7773
  className: classes.offerText
7707
7774
  }, "Offer Ends in", ' ', /*#__PURE__*/React.createElement("span", {
7708
7775
  className: classes.courseDetailTime
@@ -8825,6 +8892,8 @@ function PageRenderer({
8825
8892
  SectionWrapper,
8826
8893
  isMasterTemplate,
8827
8894
  basePath,
8895
+ countryCode,
8896
+ currencySymbol,
8828
8897
  isPreview,
8829
8898
  isEdit,
8830
8899
  sectionPlaceholder,
@@ -8852,8 +8921,10 @@ function PageRenderer({
8852
8921
  extraProps,
8853
8922
  hideLogin,
8854
8923
  isCustomWebsite,
8855
- _id
8856
- }), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin, _id]);
8924
+ _id,
8925
+ countryCode,
8926
+ currencySymbol
8927
+ }), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin, _id, countryCode, currencySymbol]);
8857
8928
  const Wrapper = SectionWrapper || Fragment;
8858
8929
  return /*#__PURE__*/React.createElement(ThemeProvider, {
8859
8930
  theme: theme