diy-template-components 0.2.69 → 0.2.70
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/650233e8e2d7dfee.png +0 -0
- package/build/d15660fcfffcc0c8.png +0 -0
- package/build/index.es.js +89 -20
- package/build/index.es.js.map +1 -1
- package/build/index.js +89 -20
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
function ___$insertStyle(css) {
|
|
6
|
-
if (!css ||
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
const style = document.createElement('style');
|
|
10
|
-
style.setAttribute('type', 'text/css');
|
|
11
|
-
style.innerHTML = css;
|
|
12
|
-
document.head.appendChild(style);
|
|
13
|
-
return css;
|
|
5
|
+
function ___$insertStyle(css) {
|
|
6
|
+
if (!css || !window) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const style = document.createElement('style');
|
|
10
|
+
style.setAttribute('type', 'text/css');
|
|
11
|
+
style.innerHTML = css;
|
|
12
|
+
document.head.appendChild(style);
|
|
13
|
+
return css;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -2083,7 +2083,9 @@ function PageRenderer$1({
|
|
|
2083
2083
|
isTutorWebsite = false,
|
|
2084
2084
|
extraProps,
|
|
2085
2085
|
hideLogin,
|
|
2086
|
-
isCustomWebsite
|
|
2086
|
+
isCustomWebsite,
|
|
2087
|
+
countryCode,
|
|
2088
|
+
currencySymbol
|
|
2087
2089
|
}) {
|
|
2088
2090
|
const theme = React.useMemo(() => getTheme(color, font), [color, font]);
|
|
2089
2091
|
const navList = header?.navs;
|
|
@@ -2104,8 +2106,10 @@ function PageRenderer$1({
|
|
|
2104
2106
|
extraProps,
|
|
2105
2107
|
hideLogin,
|
|
2106
2108
|
isCustomWebsite,
|
|
2107
|
-
_id
|
|
2108
|
-
|
|
2109
|
+
_id,
|
|
2110
|
+
countryCode,
|
|
2111
|
+
currencySymbol
|
|
2112
|
+
}), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin, _id, countryCode, currencySymbol]);
|
|
2109
2113
|
const Wrapper = SectionWrapper || React.Fragment;
|
|
2110
2114
|
return /*#__PURE__*/React__default["default"].createElement(ThemeProvider, {
|
|
2111
2115
|
theme: theme
|
|
@@ -5661,8 +5665,61 @@ function getShortenedSubstring(name, length, allowDots = true) {
|
|
|
5661
5665
|
return '';
|
|
5662
5666
|
}
|
|
5663
5667
|
|
|
5668
|
+
const formatCurrency = (countryCode, value, currencySymbol) => {
|
|
5669
|
+
let formattedValue = Number(value);
|
|
5670
|
+
const getFormattedValue = (countryCode, currencySymbol, value) => {
|
|
5671
|
+
return new Intl.NumberFormat(countryCode, {
|
|
5672
|
+
// style: "currency",
|
|
5673
|
+
// currency: currency,
|
|
5674
|
+
minimumFractionDigits: 0,
|
|
5675
|
+
maximumFractionDigits: 0
|
|
5676
|
+
}).format(value);
|
|
5677
|
+
};
|
|
5678
|
+
const getFormattedFractionValue = (countryCode, currencySymbol, value) => {
|
|
5679
|
+
return new Intl.NumberFormat(countryCode, {
|
|
5680
|
+
minimumFractionDigits: 2,
|
|
5681
|
+
maximumFractionDigits: 2
|
|
5682
|
+
}).format(value);
|
|
5683
|
+
};
|
|
5684
|
+
let func = getFormattedValue;
|
|
5685
|
+
if (countryCode === 'IN' || countryCode === 'SG') {
|
|
5686
|
+
if (value % 1 !== 0) {
|
|
5687
|
+
func = getFormattedFractionValue;
|
|
5688
|
+
}
|
|
5689
|
+
}
|
|
5690
|
+
|
|
5691
|
+
// India
|
|
5692
|
+
if (countryCode === 'IN') {
|
|
5693
|
+
formattedValue = `₹ ${func('en-IN', 'INR', value)}`;
|
|
5694
|
+
}
|
|
5695
|
+
// Vietnam
|
|
5696
|
+
else if (countryCode === 'VI' || countryCode === 'VN') {
|
|
5697
|
+
if (currencySymbol === '$') {
|
|
5698
|
+
formattedValue = `$ ${func('en-US', 'USD', value)}`;
|
|
5699
|
+
} else {
|
|
5700
|
+
formattedValue = `${func('vi-VN', 'VND', value)} đ`;
|
|
5701
|
+
formattedValue = formattedValue.replace(/[.]/g, ',');
|
|
5702
|
+
}
|
|
5703
|
+
}
|
|
5704
|
+
// South Korea
|
|
5705
|
+
else if (countryCode === 'KR') {
|
|
5706
|
+
if (currencySymbol === '$') {
|
|
5707
|
+
formattedValue = `$ ${func('en-US', 'USD', value)}`;
|
|
5708
|
+
} else {
|
|
5709
|
+
formattedValue = `${func('ko-KR', 'KRW', value)} 원`;
|
|
5710
|
+
}
|
|
5711
|
+
}
|
|
5712
|
+
// Singapore
|
|
5713
|
+
else if (countryCode === 'SG') {
|
|
5714
|
+
formattedValue = `S$ ${func('en-SG', 'SGD', value)}`;
|
|
5715
|
+
}
|
|
5716
|
+
return formattedValue;
|
|
5717
|
+
};
|
|
5718
|
+
|
|
5664
5719
|
function CourseCard({
|
|
5665
|
-
card
|
|
5720
|
+
card,
|
|
5721
|
+
countryCode,
|
|
5722
|
+
currencySymbol
|
|
5666
5723
|
}) {
|
|
5667
5724
|
const classes = useCourseStyles();
|
|
5668
5725
|
const {
|
|
@@ -5670,6 +5727,10 @@ function CourseCard({
|
|
|
5670
5727
|
} = React.useContext(PageContext);
|
|
5671
5728
|
const discount = parseInt((card?.price - card?.finalPrice) / card?.price * 100).toFixed(2);
|
|
5672
5729
|
const defaultCardImg = 'https://cp-assets-public.s3.ap-south-1.amazonaws.com/cams/cards-icon/default_course.png';
|
|
5730
|
+
const price = formatCurrency(countryCode, card?.price, currencySymbol);
|
|
5731
|
+
const finalPrice = formatCurrency(countryCode, card?.finalPrice, currencySymbol);
|
|
5732
|
+
const buyNowText = countryCode === 'KR' ? '이 강좌를 수강하세요.' : 'Buy Now';
|
|
5733
|
+
const offText = countryCode === 'KR' ? '할인' : 'OFF';
|
|
5673
5734
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5674
5735
|
className: classes.singleCard
|
|
5675
5736
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -5704,14 +5765,14 @@ function CourseCard({
|
|
|
5704
5765
|
className: classes.courseCardPriceContainer
|
|
5705
5766
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5706
5767
|
className: classes.courseCardPrice
|
|
5707
|
-
},
|
|
5768
|
+
}, finalPrice), card?.price !== card?.finalPrice ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5708
5769
|
className: classes.courseCardStrikePrice
|
|
5709
|
-
}, /*#__PURE__*/React__default["default"].createElement("span", null,
|
|
5770
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", null, price), " ", discount > 0 && discount + `% ${offText}`) : null), /*#__PURE__*/React__default["default"].createElement("a", {
|
|
5710
5771
|
className: classes.coursesAnchorTag,
|
|
5711
5772
|
href: isEdit ? null : card?.shareableLink
|
|
5712
5773
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5713
5774
|
className: classes.courseCardBuyBtn
|
|
5714
|
-
},
|
|
5775
|
+
}, buyNowText)))));
|
|
5715
5776
|
}
|
|
5716
5777
|
|
|
5717
5778
|
function courses({
|
|
@@ -5725,7 +5786,9 @@ function courses({
|
|
|
5725
5786
|
baseURLs,
|
|
5726
5787
|
hashToken,
|
|
5727
5788
|
isMasterTemplate,
|
|
5728
|
-
isEdit
|
|
5789
|
+
isEdit,
|
|
5790
|
+
countryCode,
|
|
5791
|
+
currencySymbol
|
|
5729
5792
|
} = React.useContext(PageContext);
|
|
5730
5793
|
const [cardList, setCardList] = React.useState(null);
|
|
5731
5794
|
const [errored, setErrored] = React.useState(false);
|
|
@@ -5815,7 +5878,9 @@ function courses({
|
|
|
5815
5878
|
}
|
|
5816
5879
|
})), !showShimmer ? /*#__PURE__*/React__default["default"].createElement(Wrapper, wrapperProps, cardList != null ? cardList?.map((card, index) => /*#__PURE__*/React__default["default"].createElement(CourseCard, {
|
|
5817
5880
|
key: index,
|
|
5818
|
-
card: card
|
|
5881
|
+
card: card,
|
|
5882
|
+
countryCode: countryCode,
|
|
5883
|
+
currencySymbol: currencySymbol
|
|
5819
5884
|
})) : fallBackImages?.map((dt, ind) => {
|
|
5820
5885
|
return /*#__PURE__*/React__default["default"].createElement(React.Fragment, {
|
|
5821
5886
|
key: ind
|
|
@@ -8842,6 +8907,8 @@ function PageRenderer({
|
|
|
8842
8907
|
SectionWrapper,
|
|
8843
8908
|
isMasterTemplate,
|
|
8844
8909
|
basePath,
|
|
8910
|
+
countryCode,
|
|
8911
|
+
currencySymbol,
|
|
8845
8912
|
isPreview,
|
|
8846
8913
|
isEdit,
|
|
8847
8914
|
sectionPlaceholder,
|
|
@@ -8869,8 +8936,10 @@ function PageRenderer({
|
|
|
8869
8936
|
extraProps,
|
|
8870
8937
|
hideLogin,
|
|
8871
8938
|
isCustomWebsite,
|
|
8872
|
-
_id
|
|
8873
|
-
|
|
8939
|
+
_id,
|
|
8940
|
+
countryCode,
|
|
8941
|
+
currencySymbol
|
|
8942
|
+
}), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin, _id, countryCode, currencySymbol]);
|
|
8874
8943
|
const Wrapper = SectionWrapper || React.Fragment;
|
|
8875
8944
|
return /*#__PURE__*/React__default["default"].createElement(ThemeProvider, {
|
|
8876
8945
|
theme: theme
|