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.js
CHANGED
|
@@ -463,6 +463,10 @@ function useLinkBuilder(data) {
|
|
|
463
463
|
return data.link;
|
|
464
464
|
}
|
|
465
465
|
|
|
466
|
+
if (data?.isExternal) {
|
|
467
|
+
return data.link;
|
|
468
|
+
}
|
|
469
|
+
|
|
466
470
|
if (!isPreview) {
|
|
467
471
|
const link = data.link === '/' ? '' : '/' + data.link;
|
|
468
472
|
return basePath ? `//${basePath}${link}` : null;
|
|
@@ -501,8 +505,8 @@ const Button = /*#__PURE__*/React.forwardRef(function Button({
|
|
|
501
505
|
return data?.isLink ? /*#__PURE__*/React__default["default"].createElement("a", _extends({
|
|
502
506
|
ref: ref,
|
|
503
507
|
href: link,
|
|
504
|
-
target: data?.
|
|
505
|
-
rel: data?.
|
|
508
|
+
target: data?.isExternal ? '_blank' : null,
|
|
509
|
+
rel: data?.isExternal ? 'nofollow noopener' : null,
|
|
506
510
|
className: (active ? classes.active : '') + ' ' + classes[type] + ' ' + classes[size] + ' ' + classes.anchorClass,
|
|
507
511
|
style: styling
|
|
508
512
|
}, elementProps), data?.value) : /*#__PURE__*/React__default["default"].createElement("button", _extends({
|
|
@@ -1001,7 +1005,7 @@ function Dropdown(props) {
|
|
|
1001
1005
|
link: dt.slug,
|
|
1002
1006
|
isLink: true,
|
|
1003
1007
|
value: dt.title,
|
|
1004
|
-
isExternal:
|
|
1008
|
+
isExternal: 0
|
|
1005
1009
|
},
|
|
1006
1010
|
fluid: true,
|
|
1007
1011
|
active: dt.active,
|
|
@@ -1033,7 +1037,7 @@ function OptionList({
|
|
|
1033
1037
|
link: dt.slug,
|
|
1034
1038
|
active: dt.active,
|
|
1035
1039
|
isLink: true,
|
|
1036
|
-
|
|
1040
|
+
isExternal: 0
|
|
1037
1041
|
};
|
|
1038
1042
|
});
|
|
1039
1043
|
};
|
|
@@ -1084,7 +1088,7 @@ function OptionList({
|
|
|
1084
1088
|
link: headerData?.appLink,
|
|
1085
1089
|
isLink: 1,
|
|
1086
1090
|
value: 'Download App',
|
|
1087
|
-
|
|
1091
|
+
isExternal: 1
|
|
1088
1092
|
},
|
|
1089
1093
|
type: 'primary',
|
|
1090
1094
|
size: 'small',
|
|
@@ -1098,7 +1102,7 @@ function OptionList({
|
|
|
1098
1102
|
link: headerData?.loginCtaLink,
|
|
1099
1103
|
isLink: 1,
|
|
1100
1104
|
value: 'Login',
|
|
1101
|
-
|
|
1105
|
+
isExternal: 1
|
|
1102
1106
|
},
|
|
1103
1107
|
type: 'primary',
|
|
1104
1108
|
size: isMobile ? 'small' : 'medium',
|
|
@@ -1225,7 +1229,7 @@ function MobileHeader({
|
|
|
1225
1229
|
src: phoneIos,
|
|
1226
1230
|
alt: "iosUrl"
|
|
1227
1231
|
}),
|
|
1228
|
-
|
|
1232
|
+
isExternal: 1
|
|
1229
1233
|
},
|
|
1230
1234
|
type: '',
|
|
1231
1235
|
size: 'small',
|
|
@@ -1247,7 +1251,7 @@ function MobileHeader({
|
|
|
1247
1251
|
src: phoneAndroid,
|
|
1248
1252
|
alt: "iosUrl"
|
|
1249
1253
|
}),
|
|
1250
|
-
|
|
1254
|
+
isExternal: 1
|
|
1251
1255
|
},
|
|
1252
1256
|
type: '',
|
|
1253
1257
|
size: 'small',
|
|
@@ -1267,7 +1271,7 @@ function MobileHeader({
|
|
|
1267
1271
|
link: header?.iosUrl,
|
|
1268
1272
|
isLink: 1,
|
|
1269
1273
|
value: 'Download App',
|
|
1270
|
-
|
|
1274
|
+
isExternal: 1
|
|
1271
1275
|
},
|
|
1272
1276
|
type: 'primary',
|
|
1273
1277
|
size: 'small',
|
|
@@ -1280,7 +1284,7 @@ function MobileHeader({
|
|
|
1280
1284
|
link: header?.androidURL,
|
|
1281
1285
|
isLink: 1,
|
|
1282
1286
|
value: 'Download App',
|
|
1283
|
-
|
|
1287
|
+
isExternal: 1
|
|
1284
1288
|
},
|
|
1285
1289
|
type: 'primary',
|
|
1286
1290
|
size: 'small',
|
|
@@ -1297,7 +1301,7 @@ function MobileHeader({
|
|
|
1297
1301
|
link: header?.appLink,
|
|
1298
1302
|
isLink: 1,
|
|
1299
1303
|
value: 'Download App',
|
|
1300
|
-
|
|
1304
|
+
isExternal: 1
|
|
1301
1305
|
},
|
|
1302
1306
|
type: 'primary',
|
|
1303
1307
|
size: 'small',
|
|
@@ -3149,7 +3153,7 @@ async function postApiCall(baseURLs, data) {
|
|
|
3149
3153
|
baseURL: baseURLs?.API_DIY_URL,
|
|
3150
3154
|
url: '/v1/section/form',
|
|
3151
3155
|
headers: {
|
|
3152
|
-
'website-url': '
|
|
3156
|
+
'website-url': 'https://' + location.host + location.pathname
|
|
3153
3157
|
},
|
|
3154
3158
|
data
|
|
3155
3159
|
});
|
|
@@ -3163,6 +3167,30 @@ async function postApiCall(baseURLs, data) {
|
|
|
3163
3167
|
}
|
|
3164
3168
|
}
|
|
3165
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
|
+
}
|
|
3166
3194
|
|
|
3167
3195
|
const inputStyles = createUseStyles(theme => ({
|
|
3168
3196
|
inputField: {
|
|
@@ -6566,7 +6594,13 @@ const useWebinarPromotionPage = createUseStyles(theme => {
|
|
|
6566
6594
|
webinarCarousel: {
|
|
6567
6595
|
display: 'flex',
|
|
6568
6596
|
justifyContent: 'flex-start',
|
|
6569
|
-
gap: '
|
|
6597
|
+
gap: '20px'
|
|
6598
|
+
},
|
|
6599
|
+
'@media screen and (max-width: 767px)': {
|
|
6600
|
+
webinarCarousel: {
|
|
6601
|
+
display: 'flex',
|
|
6602
|
+
flexDirection: 'column-reverse'
|
|
6603
|
+
}
|
|
6570
6604
|
},
|
|
6571
6605
|
iframeSuperContainer: {
|
|
6572
6606
|
height: '100%',
|
|
@@ -6586,8 +6620,8 @@ const useWebinarPromotionPage = createUseStyles(theme => {
|
|
|
6586
6620
|
color: theme.palette.font.primary
|
|
6587
6621
|
},
|
|
6588
6622
|
offerPrice: {
|
|
6589
|
-
fontSize: '
|
|
6590
|
-
fontWeight: '
|
|
6623
|
+
fontSize: '28px',
|
|
6624
|
+
fontWeight: '600'
|
|
6591
6625
|
},
|
|
6592
6626
|
priceContainer: {
|
|
6593
6627
|
display: 'flex',
|
|
@@ -6604,8 +6638,9 @@ const useWebinarPromotionPage = createUseStyles(theme => {
|
|
|
6604
6638
|
},
|
|
6605
6639
|
bottomContainer: {
|
|
6606
6640
|
display: 'flex',
|
|
6607
|
-
justifyContent: 'space-
|
|
6608
|
-
marginTop: '5%'
|
|
6641
|
+
justifyContent: 'space-between',
|
|
6642
|
+
marginTop: '5%',
|
|
6643
|
+
padding: '0px 5% 0px 5%'
|
|
6609
6644
|
},
|
|
6610
6645
|
iframe: {
|
|
6611
6646
|
position: 'absolute',
|
|
@@ -6631,7 +6666,10 @@ const useWebinarPromotionPage = createUseStyles(theme => {
|
|
|
6631
6666
|
width: '645px',
|
|
6632
6667
|
backgroundColor: '#f4f9ff',
|
|
6633
6668
|
display: 'flex',
|
|
6634
|
-
flexDirection: 'column'
|
|
6669
|
+
flexDirection: 'column',
|
|
6670
|
+
justifyContent: 'center',
|
|
6671
|
+
paddingTop: '20px',
|
|
6672
|
+
borderRadius: '10px'
|
|
6635
6673
|
},
|
|
6636
6674
|
bannerContainer: {
|
|
6637
6675
|
background: '#EB5757',
|
|
@@ -6751,7 +6789,7 @@ const SingleVideoSlide$1 = props => {
|
|
|
6751
6789
|
completed
|
|
6752
6790
|
}) => {
|
|
6753
6791
|
if (hours < 24) {
|
|
6754
|
-
return /*#__PURE__*/React__default["default"].createElement("span", null, hours, "
|
|
6792
|
+
return /*#__PURE__*/React__default["default"].createElement("span", null, hours, "h ", minutes, "m ", seconds, "s");
|
|
6755
6793
|
} else {
|
|
6756
6794
|
let given = moment__default["default"](props.data.endTime);
|
|
6757
6795
|
let current = moment__default["default"]().startOf('day');
|
|
@@ -6759,6 +6797,14 @@ const SingleVideoSlide$1 = props => {
|
|
|
6759
6797
|
}
|
|
6760
6798
|
};
|
|
6761
6799
|
|
|
6800
|
+
const discount = ({
|
|
6801
|
+
price,
|
|
6802
|
+
discount
|
|
6803
|
+
}) => {
|
|
6804
|
+
console.log('discountxx', props.data.price, props.data.discount);
|
|
6805
|
+
return ((price - discount) / price * 100).toFixed(2);
|
|
6806
|
+
};
|
|
6807
|
+
|
|
6762
6808
|
const classes = useWebinarPromotionPage();
|
|
6763
6809
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6764
6810
|
className: classes.videoCarouselContainer
|
|
@@ -6768,9 +6814,9 @@ const SingleVideoSlide$1 = props => {
|
|
|
6768
6814
|
className: classes.iframeSuperContainer
|
|
6769
6815
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6770
6816
|
className: classes.videoDetails
|
|
6771
|
-
}, /*#__PURE__*/React__default["default"].createElement("h3", {
|
|
6817
|
+
}, data?.isPaid ? /*#__PURE__*/React__default["default"].createElement("h3", {
|
|
6772
6818
|
className: classes.bannerContainer
|
|
6773
|
-
}, 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", {
|
|
6774
6820
|
ref: data?.videoTextHeading?.refSetter,
|
|
6775
6821
|
className: classes.videoDetailsHeading,
|
|
6776
6822
|
dangerouslySetInnerHTML: {
|
|
@@ -6800,14 +6846,14 @@ const SingleVideoSlide$1 = props => {
|
|
|
6800
6846
|
}
|
|
6801
6847
|
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6802
6848
|
className: classes.courseViewContainer
|
|
6803
|
-
}, /*#__PURE__*/React__default["default"].createElement("p", {
|
|
6849
|
+
}, data.isPaid ? /*#__PURE__*/React__default["default"].createElement("p", {
|
|
6804
6850
|
className: classes.offerText
|
|
6805
6851
|
}, "Offer Ends in", ' ', /*#__PURE__*/React__default["default"].createElement("span", {
|
|
6806
6852
|
className: classes.courseDetailTime
|
|
6807
6853
|
}, /*#__PURE__*/React__default["default"].createElement(Countdown__default["default"], {
|
|
6808
6854
|
renderer: renderer,
|
|
6809
|
-
date: data.
|
|
6810
|
-
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6855
|
+
date: data.offerPriceEndDate
|
|
6856
|
+
}))) : null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6811
6857
|
ref: data?.videoFrame?.refSetter,
|
|
6812
6858
|
className: classes.iframeContainer
|
|
6813
6859
|
}, /*#__PURE__*/React__default["default"].createElement(VideoPlayer, {
|
|
@@ -6816,24 +6862,26 @@ const SingleVideoSlide$1 = props => {
|
|
|
6816
6862
|
videoUrl: data.thumbnail
|
|
6817
6863
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6818
6864
|
className: classes.bottomContainer
|
|
6819
|
-
}, data.isPaid
|
|
6865
|
+
}, data.isPaid ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6820
6866
|
className: classes.priceContainer
|
|
6821
6867
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6822
6868
|
className: classes.offerPrice
|
|
6823
|
-
}, data
|
|
6869
|
+
}, "\u20B9", data?.discount), /*#__PURE__*/React__default["default"].createElement("p", {
|
|
6824
6870
|
style: {
|
|
6825
|
-
fontSize: '20px'
|
|
6871
|
+
fontSize: '20px',
|
|
6872
|
+
marginTop: '0px'
|
|
6826
6873
|
}
|
|
6827
6874
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
6828
6875
|
className: classes.originalPrice
|
|
6829
|
-
}, data
|
|
6876
|
+
}, "\u20B9", data?.price), ' ', /*#__PURE__*/React__default["default"].createElement("span", {
|
|
6830
6877
|
className: classes.offerDiscount
|
|
6831
|
-
},
|
|
6878
|
+
}, `${data && discount(data)}%`))) : null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6832
6879
|
className: classes.webinarButtonContainer
|
|
6833
6880
|
}, /*#__PURE__*/React__default["default"].createElement(Button, {
|
|
6834
6881
|
style: {
|
|
6835
6882
|
backgroundColor: '#009AE0',
|
|
6836
|
-
width: data.isPaid ? '
|
|
6883
|
+
width: data.isPaid ? '100%' : '250px',
|
|
6884
|
+
fontSize: 'large'
|
|
6837
6885
|
},
|
|
6838
6886
|
data: {
|
|
6839
6887
|
// link: 'headerData?.loginCtaLink',
|
|
@@ -6861,7 +6909,6 @@ function CoursePromotionPage$1({
|
|
|
6861
6909
|
const classes = useWebinarPromotionPage({
|
|
6862
6910
|
containerWidth
|
|
6863
6911
|
});
|
|
6864
|
-
console.log(sectionData);
|
|
6865
6912
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6866
6913
|
className: classes.webinarSuperContainer
|
|
6867
6914
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -6930,7 +6977,7 @@ const useCoursePromotionPage = createUseStyles(theme => {
|
|
|
6930
6977
|
coursePageCarousel: {
|
|
6931
6978
|
display: 'flex',
|
|
6932
6979
|
justifyContent: 'flex-start',
|
|
6933
|
-
gap: '
|
|
6980
|
+
gap: '20px'
|
|
6934
6981
|
},
|
|
6935
6982
|
iframeSuperContainer: {
|
|
6936
6983
|
height: '100%',
|
|
@@ -6950,7 +6997,7 @@ const useCoursePromotionPage = createUseStyles(theme => {
|
|
|
6950
6997
|
color: theme.palette.font.primary
|
|
6951
6998
|
},
|
|
6952
6999
|
offerPrice: {
|
|
6953
|
-
fontSize: '
|
|
7000
|
+
fontSize: '28px',
|
|
6954
7001
|
fontWeight: '700'
|
|
6955
7002
|
},
|
|
6956
7003
|
priceContainer: {
|
|
@@ -6995,7 +7042,8 @@ const useCoursePromotionPage = createUseStyles(theme => {
|
|
|
6995
7042
|
width: '645px',
|
|
6996
7043
|
backgroundColor: '#f4f9ff',
|
|
6997
7044
|
display: 'flex',
|
|
6998
|
-
flexDirection: 'column'
|
|
7045
|
+
flexDirection: 'column',
|
|
7046
|
+
borderRadius: '10px'
|
|
6999
7047
|
},
|
|
7000
7048
|
bannerContainer: {
|
|
7001
7049
|
background: '#EB5757',
|
|
@@ -7189,7 +7237,8 @@ const SingleVideoSlide = props => {
|
|
|
7189
7237
|
className: classes.offerPrice
|
|
7190
7238
|
}, "\u20B9 ", data.effectivePrice), /*#__PURE__*/React__default["default"].createElement("p", {
|
|
7191
7239
|
style: {
|
|
7192
|
-
fontSize: '20px'
|
|
7240
|
+
fontSize: '20px',
|
|
7241
|
+
marginTop: '0px'
|
|
7193
7242
|
}
|
|
7194
7243
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
7195
7244
|
className: classes.originalPrice
|
|
@@ -7400,7 +7449,8 @@ const FormPage = ({
|
|
|
7400
7449
|
const classes = useFormPageStyles();
|
|
7401
7450
|
const metadata = sectionData?.components?.[0]?.metadata || formPageMock;
|
|
7402
7451
|
const {
|
|
7403
|
-
_id
|
|
7452
|
+
_id,
|
|
7453
|
+
baseURLs
|
|
7404
7454
|
} = React.useContext(PageContext);
|
|
7405
7455
|
|
|
7406
7456
|
const handleSubmit = async e => {
|
|
@@ -7414,18 +7464,14 @@ const FormPage = ({
|
|
|
7414
7464
|
questionType: value.questionType,
|
|
7415
7465
|
solutionArray: value.solutionArray
|
|
7416
7466
|
});
|
|
7417
|
-
}
|
|
7418
|
-
|
|
7467
|
+
}
|
|
7419
7468
|
|
|
7420
|
-
|
|
7421
|
-
paylaod: formResponse,
|
|
7469
|
+
const data = {
|
|
7422
7470
|
sectionId: sectionData?.components?.[0]?._id || null,
|
|
7423
|
-
landingPageId: _id || null
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
}
|
|
7428
|
-
});
|
|
7471
|
+
landingPageId: _id || null,
|
|
7472
|
+
payload: formResponse
|
|
7473
|
+
};
|
|
7474
|
+
postApiCallForm(baseURLs, data, extraProps);
|
|
7429
7475
|
};
|
|
7430
7476
|
|
|
7431
7477
|
return /*#__PURE__*/React__default["default"].createElement("section", {
|
|
@@ -7587,7 +7633,8 @@ function PageRenderer({
|
|
|
7587
7633
|
sections,
|
|
7588
7634
|
header,
|
|
7589
7635
|
footer,
|
|
7590
|
-
validations = {}
|
|
7636
|
+
validations = {},
|
|
7637
|
+
_id
|
|
7591
7638
|
},
|
|
7592
7639
|
isMobile = false,
|
|
7593
7640
|
isLandingPages = false,
|
|
@@ -7621,8 +7668,9 @@ function PageRenderer({
|
|
|
7621
7668
|
validations,
|
|
7622
7669
|
isTutorWebsite,
|
|
7623
7670
|
extraProps,
|
|
7624
|
-
hideLogin
|
|
7625
|
-
|
|
7671
|
+
hideLogin,
|
|
7672
|
+
_id
|
|
7673
|
+
}), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin, _id]);
|
|
7626
7674
|
const Wrapper = SectionWrapper || React.Fragment;
|
|
7627
7675
|
return /*#__PURE__*/React__default["default"].createElement(ThemeProvider, {
|
|
7628
7676
|
theme: theme
|