diy-template-components 0.1.3 → 0.1.6
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 +97 -49
- package/build/index.es.js.map +1 -1
- package/build/index.js +97 -49
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -449,6 +449,10 @@ function useLinkBuilder(data) {
|
|
|
449
449
|
return data.link;
|
|
450
450
|
}
|
|
451
451
|
|
|
452
|
+
if (data?.isExternal) {
|
|
453
|
+
return data.link;
|
|
454
|
+
}
|
|
455
|
+
|
|
452
456
|
if (!isPreview) {
|
|
453
457
|
const link = data.link === '/' ? '' : '/' + data.link;
|
|
454
458
|
return basePath ? `//${basePath}${link}` : null;
|
|
@@ -487,8 +491,8 @@ const Button = /*#__PURE__*/forwardRef(function Button({
|
|
|
487
491
|
return data?.isLink ? /*#__PURE__*/React.createElement("a", _extends({
|
|
488
492
|
ref: ref,
|
|
489
493
|
href: link,
|
|
490
|
-
target: data?.
|
|
491
|
-
rel: data?.
|
|
494
|
+
target: data?.isExternal ? '_blank' : null,
|
|
495
|
+
rel: data?.isExternal ? 'nofollow noopener' : null,
|
|
492
496
|
className: (active ? classes.active : '') + ' ' + classes[type] + ' ' + classes[size] + ' ' + classes.anchorClass,
|
|
493
497
|
style: styling
|
|
494
498
|
}, elementProps), data?.value) : /*#__PURE__*/React.createElement("button", _extends({
|
|
@@ -987,7 +991,7 @@ function Dropdown(props) {
|
|
|
987
991
|
link: dt.slug,
|
|
988
992
|
isLink: true,
|
|
989
993
|
value: dt.title,
|
|
990
|
-
isExternal:
|
|
994
|
+
isExternal: 0
|
|
991
995
|
},
|
|
992
996
|
fluid: true,
|
|
993
997
|
active: dt.active,
|
|
@@ -1019,7 +1023,7 @@ function OptionList({
|
|
|
1019
1023
|
link: dt.slug,
|
|
1020
1024
|
active: dt.active,
|
|
1021
1025
|
isLink: true,
|
|
1022
|
-
|
|
1026
|
+
isExternal: 0
|
|
1023
1027
|
};
|
|
1024
1028
|
});
|
|
1025
1029
|
};
|
|
@@ -1070,7 +1074,7 @@ function OptionList({
|
|
|
1070
1074
|
link: headerData?.appLink,
|
|
1071
1075
|
isLink: 1,
|
|
1072
1076
|
value: 'Download App',
|
|
1073
|
-
|
|
1077
|
+
isExternal: 1
|
|
1074
1078
|
},
|
|
1075
1079
|
type: 'primary',
|
|
1076
1080
|
size: 'small',
|
|
@@ -1084,7 +1088,7 @@ function OptionList({
|
|
|
1084
1088
|
link: headerData?.loginCtaLink,
|
|
1085
1089
|
isLink: 1,
|
|
1086
1090
|
value: 'Login',
|
|
1087
|
-
|
|
1091
|
+
isExternal: 1
|
|
1088
1092
|
},
|
|
1089
1093
|
type: 'primary',
|
|
1090
1094
|
size: isMobile ? 'small' : 'medium',
|
|
@@ -1211,7 +1215,7 @@ function MobileHeader({
|
|
|
1211
1215
|
src: phoneIos,
|
|
1212
1216
|
alt: "iosUrl"
|
|
1213
1217
|
}),
|
|
1214
|
-
|
|
1218
|
+
isExternal: 1
|
|
1215
1219
|
},
|
|
1216
1220
|
type: '',
|
|
1217
1221
|
size: 'small',
|
|
@@ -1233,7 +1237,7 @@ function MobileHeader({
|
|
|
1233
1237
|
src: phoneAndroid,
|
|
1234
1238
|
alt: "iosUrl"
|
|
1235
1239
|
}),
|
|
1236
|
-
|
|
1240
|
+
isExternal: 1
|
|
1237
1241
|
},
|
|
1238
1242
|
type: '',
|
|
1239
1243
|
size: 'small',
|
|
@@ -1253,7 +1257,7 @@ function MobileHeader({
|
|
|
1253
1257
|
link: header?.iosUrl,
|
|
1254
1258
|
isLink: 1,
|
|
1255
1259
|
value: 'Download App',
|
|
1256
|
-
|
|
1260
|
+
isExternal: 1
|
|
1257
1261
|
},
|
|
1258
1262
|
type: 'primary',
|
|
1259
1263
|
size: 'small',
|
|
@@ -1266,7 +1270,7 @@ function MobileHeader({
|
|
|
1266
1270
|
link: header?.androidURL,
|
|
1267
1271
|
isLink: 1,
|
|
1268
1272
|
value: 'Download App',
|
|
1269
|
-
|
|
1273
|
+
isExternal: 1
|
|
1270
1274
|
},
|
|
1271
1275
|
type: 'primary',
|
|
1272
1276
|
size: 'small',
|
|
@@ -1283,7 +1287,7 @@ function MobileHeader({
|
|
|
1283
1287
|
link: header?.appLink,
|
|
1284
1288
|
isLink: 1,
|
|
1285
1289
|
value: 'Download App',
|
|
1286
|
-
|
|
1290
|
+
isExternal: 1
|
|
1287
1291
|
},
|
|
1288
1292
|
type: 'primary',
|
|
1289
1293
|
size: 'small',
|
|
@@ -3135,7 +3139,7 @@ async function postApiCall(baseURLs, data) {
|
|
|
3135
3139
|
baseURL: baseURLs?.API_DIY_URL,
|
|
3136
3140
|
url: '/v1/section/form',
|
|
3137
3141
|
headers: {
|
|
3138
|
-
'website-url': '
|
|
3142
|
+
'website-url': 'https://' + location.host + location.pathname
|
|
3139
3143
|
},
|
|
3140
3144
|
data
|
|
3141
3145
|
});
|
|
@@ -3149,6 +3153,30 @@ async function postApiCall(baseURLs, data) {
|
|
|
3149
3153
|
}
|
|
3150
3154
|
}
|
|
3151
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
|
+
}
|
|
3152
3180
|
|
|
3153
3181
|
const inputStyles = createUseStyles(theme => ({
|
|
3154
3182
|
inputField: {
|
|
@@ -6552,7 +6580,13 @@ const useWebinarPromotionPage = createUseStyles(theme => {
|
|
|
6552
6580
|
webinarCarousel: {
|
|
6553
6581
|
display: 'flex',
|
|
6554
6582
|
justifyContent: 'flex-start',
|
|
6555
|
-
gap: '
|
|
6583
|
+
gap: '20px'
|
|
6584
|
+
},
|
|
6585
|
+
'@media screen and (max-width: 767px)': {
|
|
6586
|
+
webinarCarousel: {
|
|
6587
|
+
display: 'flex',
|
|
6588
|
+
flexDirection: 'column-reverse'
|
|
6589
|
+
}
|
|
6556
6590
|
},
|
|
6557
6591
|
iframeSuperContainer: {
|
|
6558
6592
|
height: '100%',
|
|
@@ -6572,8 +6606,8 @@ const useWebinarPromotionPage = createUseStyles(theme => {
|
|
|
6572
6606
|
color: theme.palette.font.primary
|
|
6573
6607
|
},
|
|
6574
6608
|
offerPrice: {
|
|
6575
|
-
fontSize: '
|
|
6576
|
-
fontWeight: '
|
|
6609
|
+
fontSize: '28px',
|
|
6610
|
+
fontWeight: '600'
|
|
6577
6611
|
},
|
|
6578
6612
|
priceContainer: {
|
|
6579
6613
|
display: 'flex',
|
|
@@ -6590,8 +6624,9 @@ const useWebinarPromotionPage = createUseStyles(theme => {
|
|
|
6590
6624
|
},
|
|
6591
6625
|
bottomContainer: {
|
|
6592
6626
|
display: 'flex',
|
|
6593
|
-
justifyContent: 'space-
|
|
6594
|
-
marginTop: '5%'
|
|
6627
|
+
justifyContent: 'space-between',
|
|
6628
|
+
marginTop: '5%',
|
|
6629
|
+
padding: '0px 5% 0px 5%'
|
|
6595
6630
|
},
|
|
6596
6631
|
iframe: {
|
|
6597
6632
|
position: 'absolute',
|
|
@@ -6617,7 +6652,10 @@ const useWebinarPromotionPage = createUseStyles(theme => {
|
|
|
6617
6652
|
width: '645px',
|
|
6618
6653
|
backgroundColor: '#f4f9ff',
|
|
6619
6654
|
display: 'flex',
|
|
6620
|
-
flexDirection: 'column'
|
|
6655
|
+
flexDirection: 'column',
|
|
6656
|
+
justifyContent: 'center',
|
|
6657
|
+
paddingTop: '20px',
|
|
6658
|
+
borderRadius: '10px'
|
|
6621
6659
|
},
|
|
6622
6660
|
bannerContainer: {
|
|
6623
6661
|
background: '#EB5757',
|
|
@@ -6737,7 +6775,7 @@ const SingleVideoSlide$1 = props => {
|
|
|
6737
6775
|
completed
|
|
6738
6776
|
}) => {
|
|
6739
6777
|
if (hours < 24) {
|
|
6740
|
-
return /*#__PURE__*/React.createElement("span", null, hours, "
|
|
6778
|
+
return /*#__PURE__*/React.createElement("span", null, hours, "h ", minutes, "m ", seconds, "s");
|
|
6741
6779
|
} else {
|
|
6742
6780
|
let given = moment(props.data.endTime);
|
|
6743
6781
|
let current = moment().startOf('day');
|
|
@@ -6745,6 +6783,14 @@ const SingleVideoSlide$1 = props => {
|
|
|
6745
6783
|
}
|
|
6746
6784
|
};
|
|
6747
6785
|
|
|
6786
|
+
const discount = ({
|
|
6787
|
+
price,
|
|
6788
|
+
discount
|
|
6789
|
+
}) => {
|
|
6790
|
+
console.log('discountxx', props.data.price, props.data.discount);
|
|
6791
|
+
return ((price - discount) / price * 100).toFixed(2);
|
|
6792
|
+
};
|
|
6793
|
+
|
|
6748
6794
|
const classes = useWebinarPromotionPage();
|
|
6749
6795
|
return /*#__PURE__*/React.createElement("div", {
|
|
6750
6796
|
className: classes.videoCarouselContainer
|
|
@@ -6754,9 +6800,9 @@ const SingleVideoSlide$1 = props => {
|
|
|
6754
6800
|
className: classes.iframeSuperContainer
|
|
6755
6801
|
}, /*#__PURE__*/React.createElement("div", {
|
|
6756
6802
|
className: classes.videoDetails
|
|
6757
|
-
}, /*#__PURE__*/React.createElement("h3", {
|
|
6803
|
+
}, data?.isPaid ? /*#__PURE__*/React.createElement("h3", {
|
|
6758
6804
|
className: classes.bannerContainer
|
|
6759
|
-
}, 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", {
|
|
6760
6806
|
ref: data?.videoTextHeading?.refSetter,
|
|
6761
6807
|
className: classes.videoDetailsHeading,
|
|
6762
6808
|
dangerouslySetInnerHTML: {
|
|
@@ -6786,14 +6832,14 @@ const SingleVideoSlide$1 = props => {
|
|
|
6786
6832
|
}
|
|
6787
6833
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
6788
6834
|
className: classes.courseViewContainer
|
|
6789
|
-
}, /*#__PURE__*/React.createElement("p", {
|
|
6835
|
+
}, data.isPaid ? /*#__PURE__*/React.createElement("p", {
|
|
6790
6836
|
className: classes.offerText
|
|
6791
6837
|
}, "Offer Ends in", ' ', /*#__PURE__*/React.createElement("span", {
|
|
6792
6838
|
className: classes.courseDetailTime
|
|
6793
6839
|
}, /*#__PURE__*/React.createElement(Countdown, {
|
|
6794
6840
|
renderer: renderer,
|
|
6795
|
-
date: data.
|
|
6796
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
6841
|
+
date: data.offerPriceEndDate
|
|
6842
|
+
}))) : null, /*#__PURE__*/React.createElement("div", {
|
|
6797
6843
|
ref: data?.videoFrame?.refSetter,
|
|
6798
6844
|
className: classes.iframeContainer
|
|
6799
6845
|
}, /*#__PURE__*/React.createElement(VideoPlayer, {
|
|
@@ -6802,24 +6848,26 @@ const SingleVideoSlide$1 = props => {
|
|
|
6802
6848
|
videoUrl: data.thumbnail
|
|
6803
6849
|
})), /*#__PURE__*/React.createElement("div", {
|
|
6804
6850
|
className: classes.bottomContainer
|
|
6805
|
-
}, data.isPaid
|
|
6851
|
+
}, data.isPaid ? /*#__PURE__*/React.createElement("div", {
|
|
6806
6852
|
className: classes.priceContainer
|
|
6807
6853
|
}, /*#__PURE__*/React.createElement("div", {
|
|
6808
6854
|
className: classes.offerPrice
|
|
6809
|
-
}, data
|
|
6855
|
+
}, "\u20B9", data?.discount), /*#__PURE__*/React.createElement("p", {
|
|
6810
6856
|
style: {
|
|
6811
|
-
fontSize: '20px'
|
|
6857
|
+
fontSize: '20px',
|
|
6858
|
+
marginTop: '0px'
|
|
6812
6859
|
}
|
|
6813
6860
|
}, /*#__PURE__*/React.createElement("span", {
|
|
6814
6861
|
className: classes.originalPrice
|
|
6815
|
-
}, data
|
|
6862
|
+
}, "\u20B9", data?.price), ' ', /*#__PURE__*/React.createElement("span", {
|
|
6816
6863
|
className: classes.offerDiscount
|
|
6817
|
-
},
|
|
6864
|
+
}, `${data && discount(data)}%`))) : null, /*#__PURE__*/React.createElement("div", {
|
|
6818
6865
|
className: classes.webinarButtonContainer
|
|
6819
6866
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
6820
6867
|
style: {
|
|
6821
6868
|
backgroundColor: '#009AE0',
|
|
6822
|
-
width: data.isPaid ? '
|
|
6869
|
+
width: data.isPaid ? '100%' : '250px',
|
|
6870
|
+
fontSize: 'large'
|
|
6823
6871
|
},
|
|
6824
6872
|
data: {
|
|
6825
6873
|
// link: 'headerData?.loginCtaLink',
|
|
@@ -6847,7 +6895,6 @@ function CoursePromotionPage$1({
|
|
|
6847
6895
|
const classes = useWebinarPromotionPage({
|
|
6848
6896
|
containerWidth
|
|
6849
6897
|
});
|
|
6850
|
-
console.log(sectionData);
|
|
6851
6898
|
return /*#__PURE__*/React.createElement("div", {
|
|
6852
6899
|
className: classes.webinarSuperContainer
|
|
6853
6900
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -6916,7 +6963,7 @@ const useCoursePromotionPage = createUseStyles(theme => {
|
|
|
6916
6963
|
coursePageCarousel: {
|
|
6917
6964
|
display: 'flex',
|
|
6918
6965
|
justifyContent: 'flex-start',
|
|
6919
|
-
gap: '
|
|
6966
|
+
gap: '20px'
|
|
6920
6967
|
},
|
|
6921
6968
|
iframeSuperContainer: {
|
|
6922
6969
|
height: '100%',
|
|
@@ -6936,7 +6983,7 @@ const useCoursePromotionPage = createUseStyles(theme => {
|
|
|
6936
6983
|
color: theme.palette.font.primary
|
|
6937
6984
|
},
|
|
6938
6985
|
offerPrice: {
|
|
6939
|
-
fontSize: '
|
|
6986
|
+
fontSize: '28px',
|
|
6940
6987
|
fontWeight: '700'
|
|
6941
6988
|
},
|
|
6942
6989
|
priceContainer: {
|
|
@@ -6981,7 +7028,8 @@ const useCoursePromotionPage = createUseStyles(theme => {
|
|
|
6981
7028
|
width: '645px',
|
|
6982
7029
|
backgroundColor: '#f4f9ff',
|
|
6983
7030
|
display: 'flex',
|
|
6984
|
-
flexDirection: 'column'
|
|
7031
|
+
flexDirection: 'column',
|
|
7032
|
+
borderRadius: '10px'
|
|
6985
7033
|
},
|
|
6986
7034
|
bannerContainer: {
|
|
6987
7035
|
background: '#EB5757',
|
|
@@ -7175,7 +7223,8 @@ const SingleVideoSlide = props => {
|
|
|
7175
7223
|
className: classes.offerPrice
|
|
7176
7224
|
}, "\u20B9 ", data.effectivePrice), /*#__PURE__*/React.createElement("p", {
|
|
7177
7225
|
style: {
|
|
7178
|
-
fontSize: '20px'
|
|
7226
|
+
fontSize: '20px',
|
|
7227
|
+
marginTop: '0px'
|
|
7179
7228
|
}
|
|
7180
7229
|
}, /*#__PURE__*/React.createElement("span", {
|
|
7181
7230
|
className: classes.originalPrice
|
|
@@ -7386,7 +7435,8 @@ const FormPage = ({
|
|
|
7386
7435
|
const classes = useFormPageStyles();
|
|
7387
7436
|
const metadata = sectionData?.components?.[0]?.metadata || formPageMock;
|
|
7388
7437
|
const {
|
|
7389
|
-
_id
|
|
7438
|
+
_id,
|
|
7439
|
+
baseURLs
|
|
7390
7440
|
} = useContext(PageContext);
|
|
7391
7441
|
|
|
7392
7442
|
const handleSubmit = async e => {
|
|
@@ -7400,18 +7450,14 @@ const FormPage = ({
|
|
|
7400
7450
|
questionType: value.questionType,
|
|
7401
7451
|
solutionArray: value.solutionArray
|
|
7402
7452
|
});
|
|
7403
|
-
}
|
|
7404
|
-
|
|
7453
|
+
}
|
|
7405
7454
|
|
|
7406
|
-
|
|
7407
|
-
paylaod: formResponse,
|
|
7455
|
+
const data = {
|
|
7408
7456
|
sectionId: sectionData?.components?.[0]?._id || null,
|
|
7409
|
-
landingPageId: _id || null
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
}
|
|
7414
|
-
});
|
|
7457
|
+
landingPageId: _id || null,
|
|
7458
|
+
payload: formResponse
|
|
7459
|
+
};
|
|
7460
|
+
postApiCallForm(baseURLs, data, extraProps);
|
|
7415
7461
|
};
|
|
7416
7462
|
|
|
7417
7463
|
return /*#__PURE__*/React.createElement("section", {
|
|
@@ -7573,7 +7619,8 @@ function PageRenderer({
|
|
|
7573
7619
|
sections,
|
|
7574
7620
|
header,
|
|
7575
7621
|
footer,
|
|
7576
|
-
validations = {}
|
|
7622
|
+
validations = {},
|
|
7623
|
+
_id
|
|
7577
7624
|
},
|
|
7578
7625
|
isMobile = false,
|
|
7579
7626
|
isLandingPages = false,
|
|
@@ -7607,8 +7654,9 @@ function PageRenderer({
|
|
|
7607
7654
|
validations,
|
|
7608
7655
|
isTutorWebsite,
|
|
7609
7656
|
extraProps,
|
|
7610
|
-
hideLogin
|
|
7611
|
-
|
|
7657
|
+
hideLogin,
|
|
7658
|
+
_id
|
|
7659
|
+
}), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin, _id]);
|
|
7612
7660
|
const Wrapper = SectionWrapper || Fragment;
|
|
7613
7661
|
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
7614
7662
|
theme: theme
|