diy-template-components 0.1.16 → 0.1.19

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
@@ -6765,7 +6765,8 @@ const SingleVideoSlide$1 = props => {
6765
6765
  }, []);
6766
6766
  const {
6767
6767
  data,
6768
- webinarCtaClick
6768
+ webinarCtaClick,
6769
+ conversions = 0
6769
6770
  } = props;
6770
6771
 
6771
6772
  const renderer = ({
@@ -6786,7 +6787,29 @@ const SingleVideoSlide$1 = props => {
6786
6787
 
6787
6788
  const checkIfOfferIsValid = () => moment().diff(moment(props.data.offerPriceEndDate)) < 0;
6788
6789
 
6789
- console.log(checkIfOfferIsValid(), 'checkIfOfferIsValid');
6790
+ const checkForShowDiscount = () => {
6791
+ if (props.data.endDate === null || checkIfOfferIsValid()) {
6792
+ if (data.discount > 0 && data.offerPriceValidFor === 0) {
6793
+ return true;
6794
+ } else if (data.discount > 0 && data.offerPriceValidFor !== 0 && data.offerPriceValidFor - conversions <= 0) {
6795
+ return false;
6796
+ }
6797
+ } else if (data.offerPriceValidFor >= 0 && data.discount) {
6798
+ if (data.offerPriceValidFor <= conversions) {
6799
+ return false;
6800
+ }
6801
+
6802
+ if (data.offerPriceValidFor - conversions < 0) {
6803
+ return false;
6804
+ } else {
6805
+ return true;
6806
+ }
6807
+ }
6808
+
6809
+ if (data.discount > 0) {
6810
+ return true;
6811
+ }
6812
+ };
6790
6813
 
6791
6814
  const discount = ({
6792
6815
  price,
@@ -6805,9 +6828,11 @@ const SingleVideoSlide$1 = props => {
6805
6828
  className: classes.iframeSuperContainer
6806
6829
  }, /*#__PURE__*/React.createElement("div", {
6807
6830
  className: classes.videoDetails
6808
- }, data?.isPaid && checkIfOfferIsValid() ? /*#__PURE__*/React.createElement("h3", {
6831
+ }, data?.isPaid && (checkIfOfferIsValid() || data.offerPriceValidFor > 0) && data.offerPriceValidFor > conversions && /*#__PURE__*/React.createElement("div", null, data.offerPriceValidFor - conversions > 0 && data.discount && (data.offerPriceEndDate ? checkIfOfferIsValid() : true) ? /*#__PURE__*/React.createElement("h3", {
6809
6832
  className: classes.bannerContainer
6810
- }, data.offerPriceValidFor <= 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, "Hurry up! Offer for limited period only") : /*#__PURE__*/React.createElement(React.Fragment, null, "Hurry up! Offer is left for ", data.offerPriceValidFor, " users now")) : null, /*#__PURE__*/React.createElement("h3", {
6833
+ }, "Hurry up! Offer is left for", ' ', data.offerPriceValidFor - conversions, " users now") : checkIfOfferIsValid() && /*#__PURE__*/React.createElement("h3", {
6834
+ className: classes.bannerContainer
6835
+ }, "Hurry up! Offer for limited period only")), /*#__PURE__*/React.createElement("h3", {
6811
6836
  ref: data?.videoTextHeading?.refSetter,
6812
6837
  className: classes.videoDetailsHeading,
6813
6838
  dangerouslySetInnerHTML: {
@@ -6838,14 +6863,14 @@ const SingleVideoSlide$1 = props => {
6838
6863
  }
6839
6864
  }))), /*#__PURE__*/React.createElement("div", {
6840
6865
  className: classes.courseViewContainer
6841
- }, data.isPaid && checkIfOfferIsValid() ? /*#__PURE__*/React.createElement("p", {
6866
+ }, data.isPaid && checkIfOfferIsValid() && (data.offerPriceValidFor !== 0 ? data.offerPriceValidFor - conversions > 0 : true) && /*#__PURE__*/React.createElement("p", {
6842
6867
  className: classes.offerText
6843
6868
  }, "Offer Ends in", ' ', /*#__PURE__*/React.createElement("span", {
6844
6869
  className: classes.courseDetailTime
6845
6870
  }, /*#__PURE__*/React.createElement(Countdown, {
6846
6871
  renderer: renderer,
6847
6872
  date: data.offerPriceEndDate
6848
- }))) : null, /*#__PURE__*/React.createElement("div", {
6873
+ }))), /*#__PURE__*/React.createElement("div", {
6849
6874
  ref: data?.videoFrame?.refSetter,
6850
6875
  className: classes.iframeContainer
6851
6876
  }, /*#__PURE__*/React.createElement(VideoPlayer, {
@@ -6858,7 +6883,7 @@ const SingleVideoSlide$1 = props => {
6858
6883
  className: classes.priceContainer
6859
6884
  }, /*#__PURE__*/React.createElement("div", {
6860
6885
  className: classes.offerPrice
6861
- }, "\u20B9", data?.effectivePrice), data?.discount > 0 && checkIfOfferIsValid() && /*#__PURE__*/React.createElement("p", {
6886
+ }, "\u20B9", data?.effectivePrice), checkForShowDiscount() && (data.offerPriceEndDate ? checkIfOfferIsValid() : true) && /*#__PURE__*/React.createElement("p", {
6862
6887
  style: {
6863
6888
  fontSize: '20px',
6864
6889
  marginTop: '0px'
@@ -6908,7 +6933,8 @@ function CoursePromotionPage$1({
6908
6933
  className: classes.sectionContainer
6909
6934
  }, /*#__PURE__*/React.createElement(SingleVideoSlide$1, {
6910
6935
  data: sectionData.components[0].metadata,
6911
- webinarCtaClick: extraProps.webinarCtaClick
6936
+ webinarCtaClick: extraProps.webinarCtaClick,
6937
+ conversions: extraProps.conversions
6912
6938
  }))));
6913
6939
  }
6914
6940
 
@@ -7177,11 +7203,36 @@ const SingleVideoSlide = props => {
7177
7203
 
7178
7204
  const {
7179
7205
  data,
7180
- courseBuyNow
7206
+ courseBuyNow,
7207
+ conversions = 20
7181
7208
  } = props;
7182
7209
 
7183
7210
  const checkIfOfferIsValid = () => moment().diff(moment(props?.data?.endDate || 0)) < 0;
7184
7211
 
7212
+ const checkForShowDiscount = () => {
7213
+ if (props.data.endDate === null || checkIfOfferIsValid()) {
7214
+ if (data.discount > 0 && data.offerPriceValidFor === 0) {
7215
+ return true;
7216
+ } else if (data.discount > 0 && data.offerPriceValidFor !== 0 && data.offerPriceValidFor - conversions <= 0) {
7217
+ return false;
7218
+ }
7219
+ } else if (data.offerPriceValidFor >= 0 && data.discount) {
7220
+ if (data.offerPriceValidFor <= conversions) {
7221
+ return false;
7222
+ }
7223
+
7224
+ if (data.offerPriceValidFor - conversions < 0) {
7225
+ return false;
7226
+ } else {
7227
+ return true;
7228
+ }
7229
+ }
7230
+
7231
+ if (data.discount > 0) {
7232
+ return true;
7233
+ }
7234
+ };
7235
+
7185
7236
  const classes = useCoursePromotionPage();
7186
7237
 
7187
7238
  const discount = ({
@@ -7199,9 +7250,11 @@ const SingleVideoSlide = props => {
7199
7250
  className: classes.iframeSuperContainer
7200
7251
  }, /*#__PURE__*/React.createElement("div", {
7201
7252
  className: classes.videoDetails
7202
- }, (checkIfOfferIsValid() || data.offerPriceValidFor > 0) && /*#__PURE__*/React.createElement("h3", {
7253
+ }, (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("h3", {
7254
+ className: classes.bannerContainer
7255
+ }, "Hurry up! Offer is left for", ' ', data.offerPriceValidFor - conversions, " users now") : checkIfOfferIsValid() && /*#__PURE__*/React.createElement("h3", {
7203
7256
  className: classes.bannerContainer
7204
- }, data.offerPriceValidFor <= 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, "Hurry up! Offer for limited period only") : /*#__PURE__*/React.createElement(React.Fragment, null, "Hurry up! Offer is left for ", data.offerPriceValidFor, " users now")), /*#__PURE__*/React.createElement("div", {
7257
+ }, "Hurry up! Offer for limited period only")), /*#__PURE__*/React.createElement("div", {
7205
7258
  className: classes.emblemContainer
7206
7259
  }, data?.courseOverviewData?.courseTagList.length && data?.courseOverviewData?.courseTagList?.map(data => {
7207
7260
  return /*#__PURE__*/React.createElement("div", {
@@ -7245,7 +7298,7 @@ const SingleVideoSlide = props => {
7245
7298
  }
7246
7299
  }))), /*#__PURE__*/React.createElement("div", {
7247
7300
  className: classes.courseViewContainer
7248
- }, checkIfOfferIsValid() && /*#__PURE__*/React.createElement("p", {
7301
+ }, checkIfOfferIsValid() && (data.offerPriceValidFor !== 0 ? data.offerPriceValidFor - conversions > 0 : true) && /*#__PURE__*/React.createElement("p", {
7249
7302
  className: classes.offerText
7250
7303
  }, "Offer Ends in", ' ', /*#__PURE__*/React.createElement("span", {
7251
7304
  className: classes.courseDetailTime
@@ -7265,7 +7318,7 @@ const SingleVideoSlide = props => {
7265
7318
  className: classes.priceContainer
7266
7319
  }, /*#__PURE__*/React.createElement("div", {
7267
7320
  className: classes.offerPrice
7268
- }, "\u20B9 ", data.effectivePrice), data.discount > 0 && checkIfOfferIsValid() && /*#__PURE__*/React.createElement("p", {
7321
+ }, "\u20B9 ", data.effectivePrice), checkForShowDiscount() && (data.endDate ? checkIfOfferIsValid() : true) && /*#__PURE__*/React.createElement("p", {
7269
7322
  style: {
7270
7323
  fontSize: '20px',
7271
7324
  marginTop: '0px'
@@ -7314,7 +7367,8 @@ function CoursePromotionPage({
7314
7367
  className: classes.sectionContainer
7315
7368
  }, /*#__PURE__*/React.createElement(SingleVideoSlide, {
7316
7369
  data: sectionData.components[0].metadata,
7317
- courseBuyNow: extraProps.courseBuyNow
7370
+ courseBuyNow: extraProps.courseBuyNow,
7371
+ conversions: extraProps.conversions
7318
7372
  }))));
7319
7373
  }
7320
7374