diy-template-components 0.1.21 → 0.1.24

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
@@ -6756,6 +6756,7 @@ const useWebinarPromotionPage = createUseStyles(theme => {
6756
6756
  });
6757
6757
 
6758
6758
  const SingleVideoSlide$1 = props => {
6759
+ const theme = useTheme();
6759
6760
  useEffect(() => {// remaining days epoch
6760
6761
  // current date epoch
6761
6762
  // subtract remaining days from current day epoch
@@ -6830,7 +6831,7 @@ const SingleVideoSlide$1 = props => {
6830
6831
  className: classes.videoDetails
6831
6832
  }, data?.isPaid !== 0 && (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", {
6832
6833
  className: classes.bannerContainer
6833
- }, "Hurry up! Offer is left for", ' ', data.offerPriceValidFor - conversions, " users now") : checkIfOfferIsValid() && /*#__PURE__*/React.createElement("h3", {
6834
+ }, "Hurry up! Offer left for", ' ', data.offerPriceValidFor - conversions, " users now") : checkIfOfferIsValid() && /*#__PURE__*/React.createElement("h3", {
6834
6835
  className: classes.bannerContainer
6835
6836
  }, "Hurry up! Offer for limited period only")), /*#__PURE__*/React.createElement("h3", {
6836
6837
  ref: data?.videoTextHeading?.refSetter,
@@ -6843,10 +6844,12 @@ const SingleVideoSlide$1 = props => {
6843
6844
  }, /*#__PURE__*/React.createElement("div", {
6844
6845
  className: classes.courseDetailTag
6845
6846
  }, /*#__PURE__*/React.createElement(Icon, {
6846
- name: 'Calendar'
6847
+ name: 'Calendar',
6848
+ color: theme.palette.primary.main
6847
6849
  }), /*#__PURE__*/React.createElement("div", null, moment(data.startDate).format('Do MMM YY') + ' ', moment(data.startTime).format('h:mm A'), /*#__PURE__*/React.createElement("span", null, " - "), moment(data.endTime).format('h:mm A'))), /*#__PURE__*/React.createElement("div", {
6848
6850
  className: classes.courseDetailTag
6849
6851
  }, /*#__PURE__*/React.createElement(Icon, {
6852
+ color: theme.palette.primary.main,
6850
6853
  width: "20px",
6851
6854
  name: `${data.webinarLocation === 'Location' ? 'Location' : 'Video'}`
6852
6855
  }), /*#__PURE__*/React.createElement("div", null, data.webinarLocation === 'Location' ? data.webinarLink : data.webinarLocation))), /*#__PURE__*/React.createElement("p", {
@@ -7183,6 +7186,7 @@ const useCoursePromotionPage = createUseStyles(theme => {
7183
7186
  });
7184
7187
 
7185
7188
  const SingleVideoSlide = props => {
7189
+ const theme = useTheme();
7186
7190
  useEffect(() => {// remaining days epoch
7187
7191
  // current date epoch
7188
7192
  // subtract remaining days from current day epoch
@@ -7258,7 +7262,7 @@ const SingleVideoSlide = props => {
7258
7262
  className: classes.videoDetails
7259
7263
  }, (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", {
7260
7264
  className: classes.bannerContainer
7261
- }, "Hurry up! Offer is left for", ' ', data.offerPriceValidFor - conversions, " users now") : checkIfOfferIsValid() && /*#__PURE__*/React.createElement("h3", {
7265
+ }, "Hurry up! Offer left for", ' ', data.offerPriceValidFor - conversions, " users now") : checkIfOfferIsValid() && /*#__PURE__*/React.createElement("h3", {
7262
7266
  className: classes.bannerContainer
7263
7267
  }, "Hurry up! Offer for limited period only")), /*#__PURE__*/React.createElement("div", {
7264
7268
  className: classes.emblemContainer
@@ -7277,19 +7281,23 @@ const SingleVideoSlide = props => {
7277
7281
  }, data?.courseOverviewData?.courseDuration?.text ? /*#__PURE__*/React.createElement("div", {
7278
7282
  className: classes.courseDetailTag
7279
7283
  }, /*#__PURE__*/React.createElement(Icon, {
7280
- name: 'Clock'
7284
+ name: 'Clock',
7285
+ color: theme.palette.primary.main
7281
7286
  }), /*#__PURE__*/React.createElement("div", null, data?.courseOverviewData?.courseDuration?.text)) : null, data?.courseOverviewData?.metaData?.isPhysicalDeliveryEnabled ? /*#__PURE__*/React.createElement("div", {
7282
7287
  className: classes.courseDetailTag
7283
7288
  }, /*#__PURE__*/React.createElement(Icon, {
7284
- name: 'Book Saved'
7289
+ name: 'Book Saved',
7290
+ color: theme.palette.primary.main
7285
7291
  }), /*#__PURE__*/React.createElement("div", null, data?.courseOverviewData?.metaData?.isPhysicalDeliveryEnabled ? 'Physical Books' : null)) : null, data?.courseOverviewData?.metaData?.isCertificateEnabled ? /*#__PURE__*/React.createElement("div", {
7286
7292
  className: classes.courseDetailTag
7287
7293
  }, /*#__PURE__*/React.createElement(Icon, {
7288
- name: 'Certificate'
7294
+ name: 'Certificate',
7295
+ color: theme.palette.primary.main
7289
7296
  }), /*#__PURE__*/React.createElement("div", null, data?.courseOverviewData?.metaData?.isCertificateEnabled ? 'Course Cerficate' : null)) : null, data?.courseOverviewData?.resourseDataText.heading ? /*#__PURE__*/React.createElement("div", {
7290
7297
  className: classes.courseDetailTag
7291
7298
  }, /*#__PURE__*/React.createElement(Icon, {
7292
- name: 'Certificate'
7299
+ name: 'Certificate',
7300
+ color: theme.palette.primary.main
7293
7301
  }), /*#__PURE__*/React.createElement("div", null, data?.courseOverviewData?.resourseDataText?.heading)) : null), /*#__PURE__*/React.createElement("p", {
7294
7302
  ref: data?.videoTextContent?.refSetter,
7295
7303
  className: classes.courseDetailContent,
@@ -7489,7 +7497,7 @@ const formPageMock = {
7489
7497
  subTitle: 'Sed ut perspiciatis unde omnis iste natus error',
7490
7498
  questions: [{
7491
7499
  _id: '22',
7492
- text: 'fdsafds',
7500
+ text: 'Question 0',
7493
7501
  type: 'SA',
7494
7502
  options: [{
7495
7503
  value: ''
@@ -7498,31 +7506,19 @@ const formPageMock = {
7498
7506
  order: 1
7499
7507
  }, {
7500
7508
  _id: '23',
7501
- text: 'fasdfdsaffdsafds',
7502
- type: 'MC',
7509
+ text: 'Question 1',
7510
+ type: 'SA',
7503
7511
  options: [{
7504
- value: 'fadsfdsf'
7505
- }, {
7506
- value: 'fdsafdsaf'
7507
- }, {
7508
- value: 'fsadfd'
7509
- }, {
7510
- value: 'fadsf'
7512
+ value: ''
7511
7513
  }],
7512
7514
  isRequired: false,
7513
7515
  order: 1
7514
7516
  }, {
7515
7517
  _id: '24',
7516
- text: 'ewaofdsfkds',
7517
- type: 'SC',
7518
+ text: 'Question 2',
7519
+ type: 'SA',
7518
7520
  options: [{
7519
- value: 'fasdfdsf'
7520
- }, {
7521
- value: 'fasdfdasf'
7522
- }, {
7523
- value: 'fdsafsdf'
7524
- }, {
7525
- value: 'fdsafds'
7521
+ value: ''
7526
7522
  }],
7527
7523
  isRequired: false,
7528
7524
  order: 1
@@ -7535,6 +7531,7 @@ const FormPage = ({
7535
7531
  }) => {
7536
7532
  const [formData, setFormData] = useState({});
7537
7533
  const classes = useFormPageStyles();
7534
+ const [formSubmitted, setformSubmitted] = useState(false);
7538
7535
  const metadata = sectionData?.components?.[0]?.metadata || formPageMock;
7539
7536
  const {
7540
7537
  _id,
@@ -7561,8 +7558,22 @@ const FormPage = ({
7561
7558
  };
7562
7559
  postApiCallForm(baseURLs, data, extraProps);
7563
7560
  setFormData({});
7561
+ setformSubmitted(!formSubmitted);
7564
7562
  };
7565
7563
 
7564
+ useEffect(() => {
7565
+ //add all questions to formData
7566
+ let formData = {};
7567
+ metadata.questions.forEach(question => {
7568
+ formData[question._id] = {
7569
+ questionName: question.text,
7570
+ questionType: question.type,
7571
+ solutionArray: [' ']
7572
+ };
7573
+ });
7574
+ setFormData(formData);
7575
+ }, [metadata, formSubmitted]);
7576
+
7566
7577
  const handleOnClick = (e, item, option) => {
7567
7578
  // if the checkbox is checked
7568
7579
  if (!e.target.checked) {
@@ -7636,6 +7647,7 @@ const FormPage = ({
7636
7647
  onChange: e => {
7637
7648
  setFormData({ ...formData,
7638
7649
  [item._id]: {
7650
+ index,
7639
7651
  questionName: item.text,
7640
7652
  solutionArray: [e.target.value],
7641
7653
  questionType: 'SA'