diy-template-components 0.1.4 → 0.1.7

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
@@ -3139,7 +3139,7 @@ async function postApiCall(baseURLs, data) {
3139
3139
  baseURL: baseURLs?.API_DIY_URL,
3140
3140
  url: '/v1/section/form',
3141
3141
  headers: {
3142
- 'website-url': 'http://' + location.host + location.pathname
3142
+ 'website-url': 'https://' + location.host + location.pathname
3143
3143
  },
3144
3144
  data
3145
3145
  });
@@ -3153,6 +3153,30 @@ async function postApiCall(baseURLs, data) {
3153
3153
  }
3154
3154
  }
3155
3155
  }
3156
+ async function postApiCallForm(baseURLs, data, extraProps) {
3157
+ if (baseURLs) {
3158
+ try {
3159
+ let res = await axios({
3160
+ method: 'POST',
3161
+ baseURL: baseURLs?.API_DIY_URL,
3162
+ url: '/v1/diy/landingPages/form',
3163
+ headers: {
3164
+ 'website-url': 'https://' + location.host + location.pathname
3165
+ },
3166
+ data
3167
+ }).then(res => {
3168
+ if (extraProps && extraProps.formSubmitSuccess) {
3169
+ extraProps.formSubmitSuccess();
3170
+ }
3171
+
3172
+ return res.data;
3173
+ });
3174
+ } catch (err) {
3175
+ console.log(err);
3176
+ return;
3177
+ }
3178
+ }
3179
+ }
3156
3180
 
3157
3181
  const inputStyles = createUseStyles(theme => ({
3158
3182
  inputField: {
@@ -6556,7 +6580,13 @@ const useWebinarPromotionPage = createUseStyles(theme => {
6556
6580
  webinarCarousel: {
6557
6581
  display: 'flex',
6558
6582
  justifyContent: 'flex-start',
6559
- gap: '60px'
6583
+ gap: '20px'
6584
+ },
6585
+ '@media screen and (max-width: 767px)': {
6586
+ webinarCarousel: {
6587
+ display: 'flex',
6588
+ flexDirection: 'column-reverse'
6589
+ }
6560
6590
  },
6561
6591
  iframeSuperContainer: {
6562
6592
  height: '100%',
@@ -6576,8 +6606,8 @@ const useWebinarPromotionPage = createUseStyles(theme => {
6576
6606
  color: theme.palette.font.primary
6577
6607
  },
6578
6608
  offerPrice: {
6579
- fontSize: '32px',
6580
- fontWeight: '700'
6609
+ fontSize: '28px',
6610
+ fontWeight: '600'
6581
6611
  },
6582
6612
  priceContainer: {
6583
6613
  display: 'flex',
@@ -6594,8 +6624,9 @@ const useWebinarPromotionPage = createUseStyles(theme => {
6594
6624
  },
6595
6625
  bottomContainer: {
6596
6626
  display: 'flex',
6597
- justifyContent: 'space-around',
6598
- marginTop: '5%'
6627
+ justifyContent: 'space-between',
6628
+ marginTop: '5%',
6629
+ padding: '0px 5% 0px 5%'
6599
6630
  },
6600
6631
  iframe: {
6601
6632
  position: 'absolute',
@@ -6623,7 +6654,8 @@ const useWebinarPromotionPage = createUseStyles(theme => {
6623
6654
  display: 'flex',
6624
6655
  flexDirection: 'column',
6625
6656
  justifyContent: 'center',
6626
- paddingTop: '20px'
6657
+ paddingTop: '20px',
6658
+ borderRadius: '10px'
6627
6659
  },
6628
6660
  bannerContainer: {
6629
6661
  background: '#EB5757',
@@ -6743,7 +6775,7 @@ const SingleVideoSlide$1 = props => {
6743
6775
  completed
6744
6776
  }) => {
6745
6777
  if (hours < 24) {
6746
- return /*#__PURE__*/React.createElement("span", null, hours, ":", minutes, ":", seconds);
6778
+ return /*#__PURE__*/React.createElement("span", null, hours, "h ", minutes, "m ", seconds, "s");
6747
6779
  } else {
6748
6780
  let given = moment(props.data.endTime);
6749
6781
  let current = moment().startOf('day');
@@ -6756,7 +6788,7 @@ const SingleVideoSlide$1 = props => {
6756
6788
  discount
6757
6789
  }) => {
6758
6790
  console.log('discountxx', props.data.price, props.data.discount);
6759
- return (price - discount) / price * 100;
6791
+ return ((price - discount) / price * 100).toFixed(2);
6760
6792
  };
6761
6793
 
6762
6794
  const classes = useWebinarPromotionPage();
@@ -6768,9 +6800,9 @@ const SingleVideoSlide$1 = props => {
6768
6800
  className: classes.iframeSuperContainer
6769
6801
  }, /*#__PURE__*/React.createElement("div", {
6770
6802
  className: classes.videoDetails
6771
- }, /*#__PURE__*/React.createElement("h3", {
6803
+ }, data?.isPaid ? /*#__PURE__*/React.createElement("h3", {
6772
6804
  className: classes.bannerContainer
6773
- }, 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("h3", {
6805
+ }, 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", {
6774
6806
  ref: data?.videoTextHeading?.refSetter,
6775
6807
  className: classes.videoDetailsHeading,
6776
6808
  dangerouslySetInnerHTML: {
@@ -6816,24 +6848,26 @@ const SingleVideoSlide$1 = props => {
6816
6848
  videoUrl: data.thumbnail
6817
6849
  })), /*#__PURE__*/React.createElement("div", {
6818
6850
  className: classes.bottomContainer
6819
- }, data.isPaid && /*#__PURE__*/React.createElement("div", {
6851
+ }, data.isPaid ? /*#__PURE__*/React.createElement("div", {
6820
6852
  className: classes.priceContainer
6821
6853
  }, /*#__PURE__*/React.createElement("div", {
6822
6854
  className: classes.offerPrice
6823
- }, data?.discount), /*#__PURE__*/React.createElement("p", {
6855
+ }, "\u20B9", data?.discount), /*#__PURE__*/React.createElement("p", {
6824
6856
  style: {
6825
- fontSize: '20px'
6857
+ fontSize: '20px',
6858
+ marginTop: '0px'
6826
6859
  }
6827
6860
  }, /*#__PURE__*/React.createElement("span", {
6828
6861
  className: classes.originalPrice
6829
- }, data?.price), ' ', /*#__PURE__*/React.createElement("span", {
6862
+ }, "\u20B9", data?.price), ' ', /*#__PURE__*/React.createElement("span", {
6830
6863
  className: classes.offerDiscount
6831
- }, `${data && discount(data)}%`))), /*#__PURE__*/React.createElement("div", {
6864
+ }, `${data && discount(data)}%`))) : null, /*#__PURE__*/React.createElement("div", {
6832
6865
  className: classes.webinarButtonContainer
6833
6866
  }, /*#__PURE__*/React.createElement(Button, {
6834
6867
  style: {
6835
6868
  backgroundColor: '#009AE0',
6836
- width: data.isPaid ? '150px' : '250px'
6869
+ width: data.isPaid ? '100%' : '250px',
6870
+ fontSize: 'large'
6837
6871
  },
6838
6872
  data: {
6839
6873
  // link: 'headerData?.loginCtaLink',
@@ -6929,7 +6963,7 @@ const useCoursePromotionPage = createUseStyles(theme => {
6929
6963
  coursePageCarousel: {
6930
6964
  display: 'flex',
6931
6965
  justifyContent: 'flex-start',
6932
- gap: '60px'
6966
+ gap: '20px'
6933
6967
  },
6934
6968
  iframeSuperContainer: {
6935
6969
  height: '100%',
@@ -6949,7 +6983,7 @@ const useCoursePromotionPage = createUseStyles(theme => {
6949
6983
  color: theme.palette.font.primary
6950
6984
  },
6951
6985
  offerPrice: {
6952
- fontSize: '32px',
6986
+ fontSize: '28px',
6953
6987
  fontWeight: '700'
6954
6988
  },
6955
6989
  priceContainer: {
@@ -6994,7 +7028,8 @@ const useCoursePromotionPage = createUseStyles(theme => {
6994
7028
  width: '645px',
6995
7029
  backgroundColor: '#f4f9ff',
6996
7030
  display: 'flex',
6997
- flexDirection: 'column'
7031
+ flexDirection: 'column',
7032
+ borderRadius: '10px'
6998
7033
  },
6999
7034
  bannerContainer: {
7000
7035
  background: '#EB5757',
@@ -7188,7 +7223,8 @@ const SingleVideoSlide = props => {
7188
7223
  className: classes.offerPrice
7189
7224
  }, "\u20B9 ", data.effectivePrice), /*#__PURE__*/React.createElement("p", {
7190
7225
  style: {
7191
- fontSize: '20px'
7226
+ fontSize: '20px',
7227
+ marginTop: '0px'
7192
7228
  }
7193
7229
  }, /*#__PURE__*/React.createElement("span", {
7194
7230
  className: classes.originalPrice
@@ -7399,7 +7435,8 @@ const FormPage = ({
7399
7435
  const classes = useFormPageStyles();
7400
7436
  const metadata = sectionData?.components?.[0]?.metadata || formPageMock;
7401
7437
  const {
7402
- _id
7438
+ _id,
7439
+ baseURLs
7403
7440
  } = useContext(PageContext);
7404
7441
 
7405
7442
  const handleSubmit = async e => {
@@ -7413,18 +7450,14 @@ const FormPage = ({
7413
7450
  questionType: value.questionType,
7414
7451
  solutionArray: value.solutionArray
7415
7452
  });
7416
- } // page id - section id
7417
-
7453
+ }
7418
7454
 
7419
- axios.post(`https://diy.clp.staging.classplus.co/v1/diy/landingPages/form`, {
7420
- paylaod: formResponse,
7455
+ const data = {
7421
7456
  sectionId: sectionData?.components?.[0]?._id || null,
7422
- landingPageId: _id || null
7423
- }).then(() => {
7424
- if (extraProps && extraProps.formSubmitSuccess) {
7425
- extraProps.formSubmitSuccess();
7426
- }
7427
- });
7457
+ landingPageId: _id || null,
7458
+ payload: formResponse
7459
+ };
7460
+ postApiCallForm(baseURLs, data, extraProps);
7428
7461
  };
7429
7462
 
7430
7463
  return /*#__PURE__*/React.createElement("section", {
@@ -7445,6 +7478,7 @@ const FormPage = ({
7445
7478
  className: classes.inputFieldLabel
7446
7479
  }, item.text), /*#__PURE__*/React.createElement("input", {
7447
7480
  className: classes.inputFieldControl,
7481
+ required: item.isRequired,
7448
7482
  type: "text",
7449
7483
  placeholder: "Short answer",
7450
7484
  name: item._id,
@@ -7505,7 +7539,8 @@ const FormPage = ({
7505
7539
  }, /*#__PURE__*/React.createElement("input", {
7506
7540
  // value={option.value}
7507
7541
  type: "radio",
7508
- name: "text" // name={option.value}
7542
+ name: "text",
7543
+ required: item.isRequired // name={option.value}
7509
7544
  // id={option.value}
7510
7545
  ,
7511
7546
  onChange: e => {
@@ -7586,7 +7621,8 @@ function PageRenderer({
7586
7621
  sections,
7587
7622
  header,
7588
7623
  footer,
7589
- validations = {}
7624
+ validations = {},
7625
+ _id
7590
7626
  },
7591
7627
  isMobile = false,
7592
7628
  isLandingPages = false,
@@ -7620,8 +7656,9 @@ function PageRenderer({
7620
7656
  validations,
7621
7657
  isTutorWebsite,
7622
7658
  extraProps,
7623
- hideLogin
7624
- }), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin]);
7659
+ hideLogin,
7660
+ _id
7661
+ }), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin, _id]);
7625
7662
  const Wrapper = SectionWrapper || Fragment;
7626
7663
  return /*#__PURE__*/React.createElement(ThemeProvider, {
7627
7664
  theme: theme