diy-template-components 0.1.8 → 0.1.9
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 +76 -49
- package/build/index.es.js.map +1 -1
- package/build/index.js +76 -49
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -6769,13 +6769,14 @@ const SingleVideoSlide$1 = props => {
|
|
|
6769
6769
|
} = props;
|
|
6770
6770
|
|
|
6771
6771
|
const renderer = ({
|
|
6772
|
+
days,
|
|
6772
6773
|
hours,
|
|
6773
6774
|
minutes,
|
|
6774
6775
|
seconds,
|
|
6775
6776
|
completed
|
|
6776
6777
|
}) => {
|
|
6777
6778
|
if (hours < 24) {
|
|
6778
|
-
return /*#__PURE__*/React.createElement("span", null, hours, "h ", minutes, "m ", seconds, "s");
|
|
6779
|
+
return /*#__PURE__*/React.createElement("span", null, days, "d ", hours, "h ", minutes, "m ", seconds, "s");
|
|
6779
6780
|
} else {
|
|
6780
6781
|
let given = moment(props.data.endTime);
|
|
6781
6782
|
let current = moment().startOf('day');
|
|
@@ -6783,14 +6784,9 @@ const SingleVideoSlide$1 = props => {
|
|
|
6783
6784
|
}
|
|
6784
6785
|
};
|
|
6785
6786
|
|
|
6786
|
-
const discount = (
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
}) => {
|
|
6790
|
-
console.log('discountxx', props.data.price, props.data.discount);
|
|
6791
|
-
return (discount / price * 100).toFixed(2);
|
|
6792
|
-
};
|
|
6793
|
-
|
|
6787
|
+
const discount = parseInt((data?.regularPrice - data?.offerPrice) / data?.regularPrice * 100);
|
|
6788
|
+
let date = new Date();
|
|
6789
|
+
const todaysDate = moment(date).format('YYYY/MM/DD');
|
|
6794
6790
|
const classes = useWebinarPromotionPage();
|
|
6795
6791
|
return /*#__PURE__*/React.createElement("div", {
|
|
6796
6792
|
className: classes.videoCarouselContainer
|
|
@@ -6832,13 +6828,13 @@ const SingleVideoSlide$1 = props => {
|
|
|
6832
6828
|
}
|
|
6833
6829
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
6834
6830
|
className: classes.courseViewContainer
|
|
6835
|
-
}, data.isPaid ? /*#__PURE__*/React.createElement("p", {
|
|
6831
|
+
}, data.isPaid && todaysDate < data?.offerPriceEndDate ? /*#__PURE__*/React.createElement("p", {
|
|
6836
6832
|
className: classes.offerText
|
|
6837
6833
|
}, "Offer Ends in", ' ', /*#__PURE__*/React.createElement("span", {
|
|
6838
6834
|
className: classes.courseDetailTime
|
|
6839
6835
|
}, /*#__PURE__*/React.createElement(Countdown, {
|
|
6840
6836
|
renderer: renderer,
|
|
6841
|
-
date: data
|
|
6837
|
+
date: data?.offerPriceEndDate
|
|
6842
6838
|
}))) : null, /*#__PURE__*/React.createElement("div", {
|
|
6843
6839
|
ref: data?.videoFrame?.refSetter,
|
|
6844
6840
|
className: classes.iframeContainer
|
|
@@ -6852,16 +6848,16 @@ const SingleVideoSlide$1 = props => {
|
|
|
6852
6848
|
className: classes.priceContainer
|
|
6853
6849
|
}, /*#__PURE__*/React.createElement("div", {
|
|
6854
6850
|
className: classes.offerPrice
|
|
6855
|
-
}, "\u20B9", data?.
|
|
6851
|
+
}, "\u20B9", data?.offerPrice), /*#__PURE__*/React.createElement("p", {
|
|
6856
6852
|
style: {
|
|
6857
6853
|
fontSize: '20px',
|
|
6858
6854
|
marginTop: '0px'
|
|
6859
6855
|
}
|
|
6860
6856
|
}, /*#__PURE__*/React.createElement("span", {
|
|
6861
6857
|
className: classes.originalPrice
|
|
6862
|
-
}, "\u20B9", data?.
|
|
6858
|
+
}, "\u20B9", data?.regularPrice), ' ', /*#__PURE__*/React.createElement("span", {
|
|
6863
6859
|
className: classes.offerDiscount
|
|
6864
|
-
},
|
|
6860
|
+
}, discount > 0 && discount + '% OFF'))) : null, /*#__PURE__*/React.createElement("div", {
|
|
6865
6861
|
className: classes.webinarButtonContainer
|
|
6866
6862
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
6867
6863
|
style: {
|
|
@@ -7137,13 +7133,14 @@ const SingleVideoSlide = props => {
|
|
|
7137
7133
|
}, []);
|
|
7138
7134
|
|
|
7139
7135
|
const renderer = ({
|
|
7136
|
+
days,
|
|
7140
7137
|
hours,
|
|
7141
7138
|
minutes,
|
|
7142
7139
|
seconds,
|
|
7143
7140
|
completed
|
|
7144
7141
|
}) => {
|
|
7145
7142
|
if (hours < 24) {
|
|
7146
|
-
return /*#__PURE__*/React.createElement("span", null, hours, "
|
|
7143
|
+
return /*#__PURE__*/React.createElement("span", null, days, "d ", hours, "h ", minutes, "m ", seconds, "s");
|
|
7147
7144
|
} else {
|
|
7148
7145
|
let given = moment(props.data.endTime);
|
|
7149
7146
|
let current = moment().startOf('day');
|
|
@@ -7155,6 +7152,9 @@ const SingleVideoSlide = props => {
|
|
|
7155
7152
|
data,
|
|
7156
7153
|
courseBuyNow
|
|
7157
7154
|
} = props;
|
|
7155
|
+
const discount = parseInt((data?.price - data?.effectivePrice) / data?.price * 100);
|
|
7156
|
+
let date = new Date();
|
|
7157
|
+
const todaysDate = moment(date).format('YYYY/MM/DD');
|
|
7158
7158
|
const classes = useCoursePromotionPage();
|
|
7159
7159
|
console.log(courseBuyNow, 'courseBuyNow');
|
|
7160
7160
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -7201,14 +7201,14 @@ const SingleVideoSlide = props => {
|
|
|
7201
7201
|
}
|
|
7202
7202
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
7203
7203
|
className: classes.courseViewContainer
|
|
7204
|
-
}, /*#__PURE__*/React.createElement("p", {
|
|
7204
|
+
}, todaysDate < data.endDate ? /*#__PURE__*/React.createElement("p", {
|
|
7205
7205
|
className: classes.offerText
|
|
7206
7206
|
}, "Offer Ends in", ' ', /*#__PURE__*/React.createElement("span", {
|
|
7207
7207
|
className: classes.courseDetailTime
|
|
7208
7208
|
}, /*#__PURE__*/React.createElement(Countdown, {
|
|
7209
7209
|
renderer: renderer,
|
|
7210
7210
|
date: data.endDate
|
|
7211
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
7211
|
+
}))) : '', /*#__PURE__*/React.createElement("div", {
|
|
7212
7212
|
ref: data?.videoFrame?.refSetter,
|
|
7213
7213
|
className: classes.iframeContainer
|
|
7214
7214
|
}, /*#__PURE__*/React.createElement(VideoPlayer, {
|
|
@@ -7221,16 +7221,16 @@ const SingleVideoSlide = props => {
|
|
|
7221
7221
|
className: classes.priceContainer
|
|
7222
7222
|
}, /*#__PURE__*/React.createElement("div", {
|
|
7223
7223
|
className: classes.offerPrice
|
|
7224
|
-
}, "\u20B9 ", data
|
|
7224
|
+
}, "\u20B9 ", data?.effectivePrice), /*#__PURE__*/React.createElement("p", {
|
|
7225
7225
|
style: {
|
|
7226
7226
|
fontSize: '20px',
|
|
7227
7227
|
marginTop: '0px'
|
|
7228
7228
|
}
|
|
7229
7229
|
}, /*#__PURE__*/React.createElement("span", {
|
|
7230
7230
|
className: classes.originalPrice
|
|
7231
|
-
}, "\u20B9 ", data
|
|
7231
|
+
}, "\u20B9 ", data?.price), ' ', /*#__PURE__*/React.createElement("span", {
|
|
7232
7232
|
className: classes.offerDiscount
|
|
7233
|
-
},
|
|
7233
|
+
}, discount > 0 && discount + '% OFF'))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
|
|
7234
7234
|
style: {
|
|
7235
7235
|
width: '150px'
|
|
7236
7236
|
},
|
|
@@ -7458,6 +7458,54 @@ const FormPage = ({
|
|
|
7458
7458
|
payload: formResponse
|
|
7459
7459
|
};
|
|
7460
7460
|
postApiCallForm(baseURLs, data, extraProps);
|
|
7461
|
+
setFormData({});
|
|
7462
|
+
};
|
|
7463
|
+
|
|
7464
|
+
const handleOnClick = (e, item, option) => {
|
|
7465
|
+
// if the checkbox is checked
|
|
7466
|
+
if (!e.target.checked) {
|
|
7467
|
+
// if the checkbox is checked and the solution array is empty
|
|
7468
|
+
if (!formData[item._id]?.solutionArray?.length) {
|
|
7469
|
+
setFormData({ ...formData,
|
|
7470
|
+
[item._id]: {
|
|
7471
|
+
questionName: item.text,
|
|
7472
|
+
solutionArray: [option.value],
|
|
7473
|
+
questionType: 'MC'
|
|
7474
|
+
}
|
|
7475
|
+
});
|
|
7476
|
+
} // if the checkbox is checked and the solution array is not empty and the value is already in the array remove it
|
|
7477
|
+
else if (formData[item._id]?.solutionArray?.includes(option.value)) {
|
|
7478
|
+
// if only one value is in the array remove it
|
|
7479
|
+
setFormData({ ...formData,
|
|
7480
|
+
[item._id]: {
|
|
7481
|
+
questionName: item.text,
|
|
7482
|
+
solutionArray: formData[item._id]?.solutionArray?.filter(item => item !== option.value),
|
|
7483
|
+
questionType: 'MC'
|
|
7484
|
+
}
|
|
7485
|
+
});
|
|
7486
|
+
}
|
|
7487
|
+
} // if the checkbox is unchecked
|
|
7488
|
+
else {
|
|
7489
|
+
// if the checkbox is unchecked and the solution array is empty
|
|
7490
|
+
if (typeof formData[item._id]?.solutionArray?.length === 'undefined') {
|
|
7491
|
+
setFormData({ ...formData,
|
|
7492
|
+
[item._id]: {
|
|
7493
|
+
questionName: item.text,
|
|
7494
|
+
solutionArray: [option.value],
|
|
7495
|
+
questionType: 'MC'
|
|
7496
|
+
}
|
|
7497
|
+
});
|
|
7498
|
+
} // if the checkbox is unchecked and the solution array is not empty and the value is not in the array add it
|
|
7499
|
+
else if (!formData[item._id]?.solutionArray?.includes(option.value)) {
|
|
7500
|
+
setFormData({ ...formData,
|
|
7501
|
+
[item._id]: {
|
|
7502
|
+
questionName: item.text,
|
|
7503
|
+
solutionArray: [...formData[item._id]?.solutionArray, option.value],
|
|
7504
|
+
questionType: 'MC'
|
|
7505
|
+
}
|
|
7506
|
+
});
|
|
7507
|
+
}
|
|
7508
|
+
}
|
|
7461
7509
|
};
|
|
7462
7510
|
|
|
7463
7511
|
return /*#__PURE__*/React.createElement("section", {
|
|
@@ -7480,6 +7528,7 @@ const FormPage = ({
|
|
|
7480
7528
|
className: classes.inputFieldControl,
|
|
7481
7529
|
required: item.isRequired,
|
|
7482
7530
|
type: "text",
|
|
7531
|
+
value: formData[item._id]?.solutionArray?.[0] || '',
|
|
7483
7532
|
placeholder: "Short answer",
|
|
7484
7533
|
name: item._id,
|
|
7485
7534
|
onChange: e => {
|
|
@@ -7501,33 +7550,9 @@ const FormPage = ({
|
|
|
7501
7550
|
value: option.value,
|
|
7502
7551
|
type: "checkbox",
|
|
7503
7552
|
name: option.value,
|
|
7553
|
+
checked: formData[item._id]?.solutionArray?.includes(option.value),
|
|
7504
7554
|
id: option.value,
|
|
7505
|
-
|
|
7506
|
-
setFormData({ ...formData,
|
|
7507
|
-
[item._id]: {
|
|
7508
|
-
questionName: item.text,
|
|
7509
|
-
solutionArray: [],
|
|
7510
|
-
questionType: 'SA'
|
|
7511
|
-
}
|
|
7512
|
-
});
|
|
7513
|
-
},
|
|
7514
|
-
onBlur: e => {
|
|
7515
|
-
let newSolArray = [];
|
|
7516
|
-
|
|
7517
|
-
if (formData[item._id]) {
|
|
7518
|
-
if (!formData[item._id].solutionArray?.find(el => el === option.value)) {
|
|
7519
|
-
newSolArray.push(e.target.value);
|
|
7520
|
-
}
|
|
7521
|
-
}
|
|
7522
|
-
|
|
7523
|
-
setFormData({ ...formData,
|
|
7524
|
-
[item._id]: {
|
|
7525
|
-
questionName: item.text,
|
|
7526
|
-
solutionArray: [...newSolArray],
|
|
7527
|
-
questionType: 'SA'
|
|
7528
|
-
}
|
|
7529
|
-
});
|
|
7530
|
-
}
|
|
7555
|
+
onClick: e => handleOnClick(e, item, option)
|
|
7531
7556
|
}), /*#__PURE__*/React.createElement("label", {
|
|
7532
7557
|
htmlFor: option.value
|
|
7533
7558
|
}, option.value)))), item.type === 'SC' && /*#__PURE__*/React.createElement("div", {
|
|
@@ -7540,14 +7565,16 @@ const FormPage = ({
|
|
|
7540
7565
|
// value={option.value}
|
|
7541
7566
|
type: "radio",
|
|
7542
7567
|
name: "text",
|
|
7543
|
-
required: item.isRequired
|
|
7568
|
+
required: item.isRequired,
|
|
7569
|
+
value: option.value,
|
|
7570
|
+
checked: formData[item._id]?.solutionArray?.[0] === option.value // name={option.value}
|
|
7544
7571
|
// id={option.value}
|
|
7545
7572
|
,
|
|
7546
|
-
|
|
7573
|
+
onClick: e => {
|
|
7547
7574
|
setFormData({ ...formData,
|
|
7548
7575
|
[item._id]: {
|
|
7549
7576
|
questionName: item.text,
|
|
7550
|
-
solutionArray: [
|
|
7577
|
+
solutionArray: [option.value],
|
|
7551
7578
|
questionType: 'SC'
|
|
7552
7579
|
}
|
|
7553
7580
|
});
|