diy-template-components 0.1.4 → 0.1.5

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: {
@@ -6768,9 +6792,9 @@ const SingleVideoSlide$1 = props => {
6768
6792
  className: classes.iframeSuperContainer
6769
6793
  }, /*#__PURE__*/React.createElement("div", {
6770
6794
  className: classes.videoDetails
6771
- }, /*#__PURE__*/React.createElement("h3", {
6795
+ }, data?.isPaid ? /*#__PURE__*/React.createElement("h3", {
6772
6796
  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", {
6797
+ }, 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
6798
  ref: data?.videoTextHeading?.refSetter,
6775
6799
  className: classes.videoDetailsHeading,
6776
6800
  dangerouslySetInnerHTML: {
@@ -6816,7 +6840,7 @@ const SingleVideoSlide$1 = props => {
6816
6840
  videoUrl: data.thumbnail
6817
6841
  })), /*#__PURE__*/React.createElement("div", {
6818
6842
  className: classes.bottomContainer
6819
- }, data.isPaid && /*#__PURE__*/React.createElement("div", {
6843
+ }, data.isPaid ? /*#__PURE__*/React.createElement("div", {
6820
6844
  className: classes.priceContainer
6821
6845
  }, /*#__PURE__*/React.createElement("div", {
6822
6846
  className: classes.offerPrice
@@ -6828,7 +6852,7 @@ const SingleVideoSlide$1 = props => {
6828
6852
  className: classes.originalPrice
6829
6853
  }, data?.price), ' ', /*#__PURE__*/React.createElement("span", {
6830
6854
  className: classes.offerDiscount
6831
- }, `${data && discount(data)}%`))), /*#__PURE__*/React.createElement("div", {
6855
+ }, `${data && discount(data)}%`))) : null, /*#__PURE__*/React.createElement("div", {
6832
6856
  className: classes.webinarButtonContainer
6833
6857
  }, /*#__PURE__*/React.createElement(Button, {
6834
6858
  style: {
@@ -7399,7 +7423,8 @@ const FormPage = ({
7399
7423
  const classes = useFormPageStyles();
7400
7424
  const metadata = sectionData?.components?.[0]?.metadata || formPageMock;
7401
7425
  const {
7402
- _id
7426
+ _id,
7427
+ baseURLs
7403
7428
  } = useContext(PageContext);
7404
7429
 
7405
7430
  const handleSubmit = async e => {
@@ -7413,18 +7438,14 @@ const FormPage = ({
7413
7438
  questionType: value.questionType,
7414
7439
  solutionArray: value.solutionArray
7415
7440
  });
7416
- } // page id - section id
7417
-
7441
+ }
7418
7442
 
7419
- axios.post(`https://diy.clp.staging.classplus.co/v1/diy/landingPages/form`, {
7420
- paylaod: formResponse,
7443
+ const data = {
7421
7444
  sectionId: sectionData?.components?.[0]?._id || null,
7422
- landingPageId: _id || null
7423
- }).then(() => {
7424
- if (extraProps && extraProps.formSubmitSuccess) {
7425
- extraProps.formSubmitSuccess();
7426
- }
7427
- });
7445
+ landingPageId: _id || null,
7446
+ payload: formResponse
7447
+ };
7448
+ postApiCallForm(baseURLs, data, extraProps);
7428
7449
  };
7429
7450
 
7430
7451
  return /*#__PURE__*/React.createElement("section", {
@@ -7586,7 +7607,8 @@ function PageRenderer({
7586
7607
  sections,
7587
7608
  header,
7588
7609
  footer,
7589
- validations = {}
7610
+ validations = {},
7611
+ _id
7590
7612
  },
7591
7613
  isMobile = false,
7592
7614
  isLandingPages = false,
@@ -7620,8 +7642,9 @@ function PageRenderer({
7620
7642
  validations,
7621
7643
  isTutorWebsite,
7622
7644
  extraProps,
7623
- hideLogin
7624
- }), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin]);
7645
+ hideLogin,
7646
+ _id
7647
+ }), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin, _id]);
7625
7648
  const Wrapper = SectionWrapper || Fragment;
7626
7649
  return /*#__PURE__*/React.createElement(ThemeProvider, {
7627
7650
  theme: theme