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.js CHANGED
@@ -3153,7 +3153,7 @@ async function postApiCall(baseURLs, data) {
3153
3153
  baseURL: baseURLs?.API_DIY_URL,
3154
3154
  url: '/v1/section/form',
3155
3155
  headers: {
3156
- 'website-url': 'http://' + location.host + location.pathname
3156
+ 'website-url': 'https://' + location.host + location.pathname
3157
3157
  },
3158
3158
  data
3159
3159
  });
@@ -3167,6 +3167,30 @@ async function postApiCall(baseURLs, data) {
3167
3167
  }
3168
3168
  }
3169
3169
  }
3170
+ async function postApiCallForm(baseURLs, data, extraProps) {
3171
+ if (baseURLs) {
3172
+ try {
3173
+ let res = await axios__default["default"]({
3174
+ method: 'POST',
3175
+ baseURL: baseURLs?.API_DIY_URL,
3176
+ url: '/v1/diy/landingPages/form',
3177
+ headers: {
3178
+ 'website-url': 'https://' + location.host + location.pathname
3179
+ },
3180
+ data
3181
+ }).then(res => {
3182
+ if (extraProps && extraProps.formSubmitSuccess) {
3183
+ extraProps.formSubmitSuccess();
3184
+ }
3185
+
3186
+ return res.data;
3187
+ });
3188
+ } catch (err) {
3189
+ console.log(err);
3190
+ return;
3191
+ }
3192
+ }
3193
+ }
3170
3194
 
3171
3195
  const inputStyles = createUseStyles(theme => ({
3172
3196
  inputField: {
@@ -6570,7 +6594,13 @@ const useWebinarPromotionPage = createUseStyles(theme => {
6570
6594
  webinarCarousel: {
6571
6595
  display: 'flex',
6572
6596
  justifyContent: 'flex-start',
6573
- gap: '60px'
6597
+ gap: '20px'
6598
+ },
6599
+ '@media screen and (max-width: 767px)': {
6600
+ webinarCarousel: {
6601
+ display: 'flex',
6602
+ flexDirection: 'column-reverse'
6603
+ }
6574
6604
  },
6575
6605
  iframeSuperContainer: {
6576
6606
  height: '100%',
@@ -6590,8 +6620,8 @@ const useWebinarPromotionPage = createUseStyles(theme => {
6590
6620
  color: theme.palette.font.primary
6591
6621
  },
6592
6622
  offerPrice: {
6593
- fontSize: '32px',
6594
- fontWeight: '700'
6623
+ fontSize: '28px',
6624
+ fontWeight: '600'
6595
6625
  },
6596
6626
  priceContainer: {
6597
6627
  display: 'flex',
@@ -6608,8 +6638,9 @@ const useWebinarPromotionPage = createUseStyles(theme => {
6608
6638
  },
6609
6639
  bottomContainer: {
6610
6640
  display: 'flex',
6611
- justifyContent: 'space-around',
6612
- marginTop: '5%'
6641
+ justifyContent: 'space-between',
6642
+ marginTop: '5%',
6643
+ padding: '0px 5% 0px 5%'
6613
6644
  },
6614
6645
  iframe: {
6615
6646
  position: 'absolute',
@@ -6637,7 +6668,8 @@ const useWebinarPromotionPage = createUseStyles(theme => {
6637
6668
  display: 'flex',
6638
6669
  flexDirection: 'column',
6639
6670
  justifyContent: 'center',
6640
- paddingTop: '20px'
6671
+ paddingTop: '20px',
6672
+ borderRadius: '10px'
6641
6673
  },
6642
6674
  bannerContainer: {
6643
6675
  background: '#EB5757',
@@ -6757,7 +6789,7 @@ const SingleVideoSlide$1 = props => {
6757
6789
  completed
6758
6790
  }) => {
6759
6791
  if (hours < 24) {
6760
- return /*#__PURE__*/React__default["default"].createElement("span", null, hours, ":", minutes, ":", seconds);
6792
+ return /*#__PURE__*/React__default["default"].createElement("span", null, hours, "h ", minutes, "m ", seconds, "s");
6761
6793
  } else {
6762
6794
  let given = moment__default["default"](props.data.endTime);
6763
6795
  let current = moment__default["default"]().startOf('day');
@@ -6770,7 +6802,7 @@ const SingleVideoSlide$1 = props => {
6770
6802
  discount
6771
6803
  }) => {
6772
6804
  console.log('discountxx', props.data.price, props.data.discount);
6773
- return (price - discount) / price * 100;
6805
+ return ((price - discount) / price * 100).toFixed(2);
6774
6806
  };
6775
6807
 
6776
6808
  const classes = useWebinarPromotionPage();
@@ -6782,9 +6814,9 @@ const SingleVideoSlide$1 = props => {
6782
6814
  className: classes.iframeSuperContainer
6783
6815
  }, /*#__PURE__*/React__default["default"].createElement("div", {
6784
6816
  className: classes.videoDetails
6785
- }, /*#__PURE__*/React__default["default"].createElement("h3", {
6817
+ }, data?.isPaid ? /*#__PURE__*/React__default["default"].createElement("h3", {
6786
6818
  className: classes.bannerContainer
6787
- }, data.offerPriceValidFor <= 0 ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, "Hurry up! Offer for limited period only") : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, "Hurry up! Offer is left for ", data.offerPriceValidFor, " users now")), /*#__PURE__*/React__default["default"].createElement("h3", {
6819
+ }, data.offerPriceValidFor <= 0 ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, "Hurry up! Offer for limited period only") : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, "Hurry up! Offer is left for ", data.offerPriceValidFor, " users now")) : null, /*#__PURE__*/React__default["default"].createElement("h3", {
6788
6820
  ref: data?.videoTextHeading?.refSetter,
6789
6821
  className: classes.videoDetailsHeading,
6790
6822
  dangerouslySetInnerHTML: {
@@ -6830,24 +6862,26 @@ const SingleVideoSlide$1 = props => {
6830
6862
  videoUrl: data.thumbnail
6831
6863
  })), /*#__PURE__*/React__default["default"].createElement("div", {
6832
6864
  className: classes.bottomContainer
6833
- }, data.isPaid && /*#__PURE__*/React__default["default"].createElement("div", {
6865
+ }, data.isPaid ? /*#__PURE__*/React__default["default"].createElement("div", {
6834
6866
  className: classes.priceContainer
6835
6867
  }, /*#__PURE__*/React__default["default"].createElement("div", {
6836
6868
  className: classes.offerPrice
6837
- }, data?.discount), /*#__PURE__*/React__default["default"].createElement("p", {
6869
+ }, "\u20B9", data?.discount), /*#__PURE__*/React__default["default"].createElement("p", {
6838
6870
  style: {
6839
- fontSize: '20px'
6871
+ fontSize: '20px',
6872
+ marginTop: '0px'
6840
6873
  }
6841
6874
  }, /*#__PURE__*/React__default["default"].createElement("span", {
6842
6875
  className: classes.originalPrice
6843
- }, data?.price), ' ', /*#__PURE__*/React__default["default"].createElement("span", {
6876
+ }, "\u20B9", data?.price), ' ', /*#__PURE__*/React__default["default"].createElement("span", {
6844
6877
  className: classes.offerDiscount
6845
- }, `${data && discount(data)}%`))), /*#__PURE__*/React__default["default"].createElement("div", {
6878
+ }, `${data && discount(data)}%`))) : null, /*#__PURE__*/React__default["default"].createElement("div", {
6846
6879
  className: classes.webinarButtonContainer
6847
6880
  }, /*#__PURE__*/React__default["default"].createElement(Button, {
6848
6881
  style: {
6849
6882
  backgroundColor: '#009AE0',
6850
- width: data.isPaid ? '150px' : '250px'
6883
+ width: data.isPaid ? '100%' : '250px',
6884
+ fontSize: 'large'
6851
6885
  },
6852
6886
  data: {
6853
6887
  // link: 'headerData?.loginCtaLink',
@@ -6943,7 +6977,7 @@ const useCoursePromotionPage = createUseStyles(theme => {
6943
6977
  coursePageCarousel: {
6944
6978
  display: 'flex',
6945
6979
  justifyContent: 'flex-start',
6946
- gap: '60px'
6980
+ gap: '20px'
6947
6981
  },
6948
6982
  iframeSuperContainer: {
6949
6983
  height: '100%',
@@ -6963,7 +6997,7 @@ const useCoursePromotionPage = createUseStyles(theme => {
6963
6997
  color: theme.palette.font.primary
6964
6998
  },
6965
6999
  offerPrice: {
6966
- fontSize: '32px',
7000
+ fontSize: '28px',
6967
7001
  fontWeight: '700'
6968
7002
  },
6969
7003
  priceContainer: {
@@ -7008,7 +7042,8 @@ const useCoursePromotionPage = createUseStyles(theme => {
7008
7042
  width: '645px',
7009
7043
  backgroundColor: '#f4f9ff',
7010
7044
  display: 'flex',
7011
- flexDirection: 'column'
7045
+ flexDirection: 'column',
7046
+ borderRadius: '10px'
7012
7047
  },
7013
7048
  bannerContainer: {
7014
7049
  background: '#EB5757',
@@ -7202,7 +7237,8 @@ const SingleVideoSlide = props => {
7202
7237
  className: classes.offerPrice
7203
7238
  }, "\u20B9 ", data.effectivePrice), /*#__PURE__*/React__default["default"].createElement("p", {
7204
7239
  style: {
7205
- fontSize: '20px'
7240
+ fontSize: '20px',
7241
+ marginTop: '0px'
7206
7242
  }
7207
7243
  }, /*#__PURE__*/React__default["default"].createElement("span", {
7208
7244
  className: classes.originalPrice
@@ -7413,7 +7449,8 @@ const FormPage = ({
7413
7449
  const classes = useFormPageStyles();
7414
7450
  const metadata = sectionData?.components?.[0]?.metadata || formPageMock;
7415
7451
  const {
7416
- _id
7452
+ _id,
7453
+ baseURLs
7417
7454
  } = React.useContext(PageContext);
7418
7455
 
7419
7456
  const handleSubmit = async e => {
@@ -7427,18 +7464,14 @@ const FormPage = ({
7427
7464
  questionType: value.questionType,
7428
7465
  solutionArray: value.solutionArray
7429
7466
  });
7430
- } // page id - section id
7431
-
7467
+ }
7432
7468
 
7433
- axios__default["default"].post(`https://diy.clp.staging.classplus.co/v1/diy/landingPages/form`, {
7434
- paylaod: formResponse,
7469
+ const data = {
7435
7470
  sectionId: sectionData?.components?.[0]?._id || null,
7436
- landingPageId: _id || null
7437
- }).then(() => {
7438
- if (extraProps && extraProps.formSubmitSuccess) {
7439
- extraProps.formSubmitSuccess();
7440
- }
7441
- });
7471
+ landingPageId: _id || null,
7472
+ payload: formResponse
7473
+ };
7474
+ postApiCallForm(baseURLs, data, extraProps);
7442
7475
  };
7443
7476
 
7444
7477
  return /*#__PURE__*/React__default["default"].createElement("section", {
@@ -7459,6 +7492,7 @@ const FormPage = ({
7459
7492
  className: classes.inputFieldLabel
7460
7493
  }, item.text), /*#__PURE__*/React__default["default"].createElement("input", {
7461
7494
  className: classes.inputFieldControl,
7495
+ required: item.isRequired,
7462
7496
  type: "text",
7463
7497
  placeholder: "Short answer",
7464
7498
  name: item._id,
@@ -7519,7 +7553,8 @@ const FormPage = ({
7519
7553
  }, /*#__PURE__*/React__default["default"].createElement("input", {
7520
7554
  // value={option.value}
7521
7555
  type: "radio",
7522
- name: "text" // name={option.value}
7556
+ name: "text",
7557
+ required: item.isRequired // name={option.value}
7523
7558
  // id={option.value}
7524
7559
  ,
7525
7560
  onChange: e => {
@@ -7600,7 +7635,8 @@ function PageRenderer({
7600
7635
  sections,
7601
7636
  header,
7602
7637
  footer,
7603
- validations = {}
7638
+ validations = {},
7639
+ _id
7604
7640
  },
7605
7641
  isMobile = false,
7606
7642
  isLandingPages = false,
@@ -7634,8 +7670,9 @@ function PageRenderer({
7634
7670
  validations,
7635
7671
  isTutorWebsite,
7636
7672
  extraProps,
7637
- hideLogin
7638
- }), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin]);
7673
+ hideLogin,
7674
+ _id
7675
+ }), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin, _id]);
7639
7676
  const Wrapper = SectionWrapper || React.Fragment;
7640
7677
  return /*#__PURE__*/React__default["default"].createElement(ThemeProvider, {
7641
7678
  theme: theme