diy-template-components 0.1.2 → 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 +73 -37
- package/build/index.es.js.map +1 -1
- package/build/index.js +73 -37
- package/build/index.js.map +1 -1
- package/package.json +1 -2
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: {
|
|
@@ -6617,7 +6645,9 @@ const useWebinarPromotionPage = createUseStyles(theme => {
|
|
|
6617
6645
|
width: '645px',
|
|
6618
6646
|
backgroundColor: '#f4f9ff',
|
|
6619
6647
|
display: 'flex',
|
|
6620
|
-
flexDirection: 'column'
|
|
6648
|
+
flexDirection: 'column',
|
|
6649
|
+
justifyContent: 'center',
|
|
6650
|
+
paddingTop: '20px'
|
|
6621
6651
|
},
|
|
6622
6652
|
bannerContainer: {
|
|
6623
6653
|
background: '#EB5757',
|
|
@@ -6745,6 +6775,14 @@ const SingleVideoSlide$1 = props => {
|
|
|
6745
6775
|
}
|
|
6746
6776
|
};
|
|
6747
6777
|
|
|
6778
|
+
const discount = ({
|
|
6779
|
+
price,
|
|
6780
|
+
discount
|
|
6781
|
+
}) => {
|
|
6782
|
+
console.log('discountxx', props.data.price, props.data.discount);
|
|
6783
|
+
return (price - discount) / price * 100;
|
|
6784
|
+
};
|
|
6785
|
+
|
|
6748
6786
|
const classes = useWebinarPromotionPage();
|
|
6749
6787
|
return /*#__PURE__*/React.createElement("div", {
|
|
6750
6788
|
className: classes.videoCarouselContainer
|
|
@@ -6754,9 +6792,9 @@ const SingleVideoSlide$1 = props => {
|
|
|
6754
6792
|
className: classes.iframeSuperContainer
|
|
6755
6793
|
}, /*#__PURE__*/React.createElement("div", {
|
|
6756
6794
|
className: classes.videoDetails
|
|
6757
|
-
}, /*#__PURE__*/React.createElement("h3", {
|
|
6795
|
+
}, data?.isPaid ? /*#__PURE__*/React.createElement("h3", {
|
|
6758
6796
|
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", {
|
|
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", {
|
|
6760
6798
|
ref: data?.videoTextHeading?.refSetter,
|
|
6761
6799
|
className: classes.videoDetailsHeading,
|
|
6762
6800
|
dangerouslySetInnerHTML: {
|
|
@@ -6786,14 +6824,14 @@ const SingleVideoSlide$1 = props => {
|
|
|
6786
6824
|
}
|
|
6787
6825
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
6788
6826
|
className: classes.courseViewContainer
|
|
6789
|
-
}, /*#__PURE__*/React.createElement("p", {
|
|
6827
|
+
}, data.isPaid ? /*#__PURE__*/React.createElement("p", {
|
|
6790
6828
|
className: classes.offerText
|
|
6791
6829
|
}, "Offer Ends in", ' ', /*#__PURE__*/React.createElement("span", {
|
|
6792
6830
|
className: classes.courseDetailTime
|
|
6793
6831
|
}, /*#__PURE__*/React.createElement(Countdown, {
|
|
6794
6832
|
renderer: renderer,
|
|
6795
|
-
date: data.
|
|
6796
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
6833
|
+
date: data.offerPriceEndDate
|
|
6834
|
+
}))) : null, /*#__PURE__*/React.createElement("div", {
|
|
6797
6835
|
ref: data?.videoFrame?.refSetter,
|
|
6798
6836
|
className: classes.iframeContainer
|
|
6799
6837
|
}, /*#__PURE__*/React.createElement(VideoPlayer, {
|
|
@@ -6802,19 +6840,19 @@ const SingleVideoSlide$1 = props => {
|
|
|
6802
6840
|
videoUrl: data.thumbnail
|
|
6803
6841
|
})), /*#__PURE__*/React.createElement("div", {
|
|
6804
6842
|
className: classes.bottomContainer
|
|
6805
|
-
}, data.isPaid
|
|
6843
|
+
}, data.isPaid ? /*#__PURE__*/React.createElement("div", {
|
|
6806
6844
|
className: classes.priceContainer
|
|
6807
6845
|
}, /*#__PURE__*/React.createElement("div", {
|
|
6808
6846
|
className: classes.offerPrice
|
|
6809
|
-
}, data
|
|
6847
|
+
}, data?.discount), /*#__PURE__*/React.createElement("p", {
|
|
6810
6848
|
style: {
|
|
6811
6849
|
fontSize: '20px'
|
|
6812
6850
|
}
|
|
6813
6851
|
}, /*#__PURE__*/React.createElement("span", {
|
|
6814
6852
|
className: classes.originalPrice
|
|
6815
|
-
}, data
|
|
6853
|
+
}, data?.price), ' ', /*#__PURE__*/React.createElement("span", {
|
|
6816
6854
|
className: classes.offerDiscount
|
|
6817
|
-
},
|
|
6855
|
+
}, `${data && discount(data)}%`))) : null, /*#__PURE__*/React.createElement("div", {
|
|
6818
6856
|
className: classes.webinarButtonContainer
|
|
6819
6857
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
6820
6858
|
style: {
|
|
@@ -6847,7 +6885,6 @@ function CoursePromotionPage$1({
|
|
|
6847
6885
|
const classes = useWebinarPromotionPage({
|
|
6848
6886
|
containerWidth
|
|
6849
6887
|
});
|
|
6850
|
-
console.log(sectionData);
|
|
6851
6888
|
return /*#__PURE__*/React.createElement("div", {
|
|
6852
6889
|
className: classes.webinarSuperContainer
|
|
6853
6890
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -7386,7 +7423,8 @@ const FormPage = ({
|
|
|
7386
7423
|
const classes = useFormPageStyles();
|
|
7387
7424
|
const metadata = sectionData?.components?.[0]?.metadata || formPageMock;
|
|
7388
7425
|
const {
|
|
7389
|
-
_id
|
|
7426
|
+
_id,
|
|
7427
|
+
baseURLs
|
|
7390
7428
|
} = useContext(PageContext);
|
|
7391
7429
|
|
|
7392
7430
|
const handleSubmit = async e => {
|
|
@@ -7400,18 +7438,14 @@ const FormPage = ({
|
|
|
7400
7438
|
questionType: value.questionType,
|
|
7401
7439
|
solutionArray: value.solutionArray
|
|
7402
7440
|
});
|
|
7403
|
-
}
|
|
7404
|
-
|
|
7441
|
+
}
|
|
7405
7442
|
|
|
7406
|
-
|
|
7407
|
-
paylaod: formResponse,
|
|
7443
|
+
const data = {
|
|
7408
7444
|
sectionId: sectionData?.components?.[0]?._id || null,
|
|
7409
|
-
landingPageId: _id || null
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
}
|
|
7414
|
-
});
|
|
7445
|
+
landingPageId: _id || null,
|
|
7446
|
+
payload: formResponse
|
|
7447
|
+
};
|
|
7448
|
+
postApiCallForm(baseURLs, data, extraProps);
|
|
7415
7449
|
};
|
|
7416
7450
|
|
|
7417
7451
|
return /*#__PURE__*/React.createElement("section", {
|
|
@@ -7573,7 +7607,8 @@ function PageRenderer({
|
|
|
7573
7607
|
sections,
|
|
7574
7608
|
header,
|
|
7575
7609
|
footer,
|
|
7576
|
-
validations = {}
|
|
7610
|
+
validations = {},
|
|
7611
|
+
_id
|
|
7577
7612
|
},
|
|
7578
7613
|
isMobile = false,
|
|
7579
7614
|
isLandingPages = false,
|
|
@@ -7607,8 +7642,9 @@ function PageRenderer({
|
|
|
7607
7642
|
validations,
|
|
7608
7643
|
isTutorWebsite,
|
|
7609
7644
|
extraProps,
|
|
7610
|
-
hideLogin
|
|
7611
|
-
|
|
7645
|
+
hideLogin,
|
|
7646
|
+
_id
|
|
7647
|
+
}), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin, _id]);
|
|
7612
7648
|
const Wrapper = SectionWrapper || Fragment;
|
|
7613
7649
|
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
7614
7650
|
theme: theme
|