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
|
Binary file
|
|
Binary file
|
package/build/index.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
function ___$insertStyle(css) {
|
|
2
|
-
if (!css ||
|
|
3
|
-
return;
|
|
4
|
-
}
|
|
5
|
-
const style = document.createElement('style');
|
|
6
|
-
style.setAttribute('type', 'text/css');
|
|
7
|
-
style.innerHTML = css;
|
|
8
|
-
document.head.appendChild(style);
|
|
9
|
-
return css;
|
|
1
|
+
function ___$insertStyle(css) {
|
|
2
|
+
if (!css || !window) {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
const style = document.createElement('style');
|
|
6
|
+
style.setAttribute('type', 'text/css');
|
|
7
|
+
style.innerHTML = css;
|
|
8
|
+
document.head.appendChild(style);
|
|
9
|
+
return css;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
import React, { createContext, useContext, forwardRef, useRef, useEffect, useState, useMemo, useLayoutEffect, Suspense, memo, lazy, Fragment } from 'react';
|
|
@@ -2068,7 +2068,9 @@ function PageRenderer$1({
|
|
|
2068
2068
|
isTutorWebsite = false,
|
|
2069
2069
|
extraProps,
|
|
2070
2070
|
hideLogin,
|
|
2071
|
-
isCustomWebsite
|
|
2071
|
+
isCustomWebsite,
|
|
2072
|
+
countryCode,
|
|
2073
|
+
currencySymbol
|
|
2072
2074
|
}) {
|
|
2073
2075
|
const theme = useMemo(() => getTheme(color, font), [color, font]);
|
|
2074
2076
|
const navList = header?.navs;
|
|
@@ -2089,8 +2091,10 @@ function PageRenderer$1({
|
|
|
2089
2091
|
extraProps,
|
|
2090
2092
|
hideLogin,
|
|
2091
2093
|
isCustomWebsite,
|
|
2092
|
-
_id
|
|
2093
|
-
|
|
2094
|
+
_id,
|
|
2095
|
+
countryCode,
|
|
2096
|
+
currencySymbol
|
|
2097
|
+
}), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin, _id, countryCode, currencySymbol]);
|
|
2094
2098
|
const Wrapper = SectionWrapper || Fragment;
|
|
2095
2099
|
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
2096
2100
|
theme: theme
|
|
@@ -5646,8 +5650,61 @@ function getShortenedSubstring(name, length, allowDots = true) {
|
|
|
5646
5650
|
return '';
|
|
5647
5651
|
}
|
|
5648
5652
|
|
|
5653
|
+
const formatCurrency = (countryCode, value, currencySymbol) => {
|
|
5654
|
+
let formattedValue = Number(value);
|
|
5655
|
+
const getFormattedValue = (countryCode, currencySymbol, value) => {
|
|
5656
|
+
return new Intl.NumberFormat(countryCode, {
|
|
5657
|
+
// style: "currency",
|
|
5658
|
+
// currency: currency,
|
|
5659
|
+
minimumFractionDigits: 0,
|
|
5660
|
+
maximumFractionDigits: 0
|
|
5661
|
+
}).format(value);
|
|
5662
|
+
};
|
|
5663
|
+
const getFormattedFractionValue = (countryCode, currencySymbol, value) => {
|
|
5664
|
+
return new Intl.NumberFormat(countryCode, {
|
|
5665
|
+
minimumFractionDigits: 2,
|
|
5666
|
+
maximumFractionDigits: 2
|
|
5667
|
+
}).format(value);
|
|
5668
|
+
};
|
|
5669
|
+
let func = getFormattedValue;
|
|
5670
|
+
if (countryCode === 'IN' || countryCode === 'SG') {
|
|
5671
|
+
if (value % 1 !== 0) {
|
|
5672
|
+
func = getFormattedFractionValue;
|
|
5673
|
+
}
|
|
5674
|
+
}
|
|
5675
|
+
|
|
5676
|
+
// India
|
|
5677
|
+
if (countryCode === 'IN') {
|
|
5678
|
+
formattedValue = `₹ ${func('en-IN', 'INR', value)}`;
|
|
5679
|
+
}
|
|
5680
|
+
// Vietnam
|
|
5681
|
+
else if (countryCode === 'VI' || countryCode === 'VN') {
|
|
5682
|
+
if (currencySymbol === '$') {
|
|
5683
|
+
formattedValue = `$ ${func('en-US', 'USD', value)}`;
|
|
5684
|
+
} else {
|
|
5685
|
+
formattedValue = `${func('vi-VN', 'VND', value)} đ`;
|
|
5686
|
+
formattedValue = formattedValue.replace(/[.]/g, ',');
|
|
5687
|
+
}
|
|
5688
|
+
}
|
|
5689
|
+
// South Korea
|
|
5690
|
+
else if (countryCode === 'KR') {
|
|
5691
|
+
if (currencySymbol === '$') {
|
|
5692
|
+
formattedValue = `$ ${func('en-US', 'USD', value)}`;
|
|
5693
|
+
} else {
|
|
5694
|
+
formattedValue = `${func('ko-KR', 'KRW', value)} 원`;
|
|
5695
|
+
}
|
|
5696
|
+
}
|
|
5697
|
+
// Singapore
|
|
5698
|
+
else if (countryCode === 'SG') {
|
|
5699
|
+
formattedValue = `S$ ${func('en-SG', 'SGD', value)}`;
|
|
5700
|
+
}
|
|
5701
|
+
return formattedValue;
|
|
5702
|
+
};
|
|
5703
|
+
|
|
5649
5704
|
function CourseCard({
|
|
5650
|
-
card
|
|
5705
|
+
card,
|
|
5706
|
+
countryCode,
|
|
5707
|
+
currencySymbol
|
|
5651
5708
|
}) {
|
|
5652
5709
|
const classes = useCourseStyles();
|
|
5653
5710
|
const {
|
|
@@ -5655,6 +5712,10 @@ function CourseCard({
|
|
|
5655
5712
|
} = useContext(PageContext);
|
|
5656
5713
|
const discount = parseInt((card?.price - card?.finalPrice) / card?.price * 100).toFixed(2);
|
|
5657
5714
|
const defaultCardImg = 'https://cp-assets-public.s3.ap-south-1.amazonaws.com/cams/cards-icon/default_course.png';
|
|
5715
|
+
const price = formatCurrency(countryCode, card?.price, currencySymbol);
|
|
5716
|
+
const finalPrice = formatCurrency(countryCode, card?.finalPrice, currencySymbol);
|
|
5717
|
+
const buyNowText = countryCode === 'KR' ? '이 강좌를 수강하세요.' : 'Buy Now';
|
|
5718
|
+
const offText = countryCode === 'KR' ? '할인' : 'OFF';
|
|
5658
5719
|
return /*#__PURE__*/React.createElement("div", {
|
|
5659
5720
|
className: classes.singleCard
|
|
5660
5721
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -5689,14 +5750,14 @@ function CourseCard({
|
|
|
5689
5750
|
className: classes.courseCardPriceContainer
|
|
5690
5751
|
}, /*#__PURE__*/React.createElement("div", {
|
|
5691
5752
|
className: classes.courseCardPrice
|
|
5692
|
-
},
|
|
5753
|
+
}, finalPrice), card?.price !== card?.finalPrice ? /*#__PURE__*/React.createElement("div", {
|
|
5693
5754
|
className: classes.courseCardStrikePrice
|
|
5694
|
-
}, /*#__PURE__*/React.createElement("span", null,
|
|
5755
|
+
}, /*#__PURE__*/React.createElement("span", null, price), " ", discount > 0 && discount + `% ${offText}`) : null), /*#__PURE__*/React.createElement("a", {
|
|
5695
5756
|
className: classes.coursesAnchorTag,
|
|
5696
5757
|
href: isEdit ? null : card?.shareableLink
|
|
5697
5758
|
}, /*#__PURE__*/React.createElement("div", {
|
|
5698
5759
|
className: classes.courseCardBuyBtn
|
|
5699
|
-
},
|
|
5760
|
+
}, buyNowText)))));
|
|
5700
5761
|
}
|
|
5701
5762
|
|
|
5702
5763
|
function courses({
|
|
@@ -5710,7 +5771,9 @@ function courses({
|
|
|
5710
5771
|
baseURLs,
|
|
5711
5772
|
hashToken,
|
|
5712
5773
|
isMasterTemplate,
|
|
5713
|
-
isEdit
|
|
5774
|
+
isEdit,
|
|
5775
|
+
countryCode,
|
|
5776
|
+
currencySymbol
|
|
5714
5777
|
} = useContext(PageContext);
|
|
5715
5778
|
const [cardList, setCardList] = useState(null);
|
|
5716
5779
|
const [errored, setErrored] = useState(false);
|
|
@@ -5800,7 +5863,9 @@ function courses({
|
|
|
5800
5863
|
}
|
|
5801
5864
|
})), !showShimmer ? /*#__PURE__*/React.createElement(Wrapper, wrapperProps, cardList != null ? cardList?.map((card, index) => /*#__PURE__*/React.createElement(CourseCard, {
|
|
5802
5865
|
key: index,
|
|
5803
|
-
card: card
|
|
5866
|
+
card: card,
|
|
5867
|
+
countryCode: countryCode,
|
|
5868
|
+
currencySymbol: currencySymbol
|
|
5804
5869
|
})) : fallBackImages?.map((dt, ind) => {
|
|
5805
5870
|
return /*#__PURE__*/React.createElement(Fragment, {
|
|
5806
5871
|
key: ind
|
|
@@ -8827,6 +8892,8 @@ function PageRenderer({
|
|
|
8827
8892
|
SectionWrapper,
|
|
8828
8893
|
isMasterTemplate,
|
|
8829
8894
|
basePath,
|
|
8895
|
+
countryCode,
|
|
8896
|
+
currencySymbol,
|
|
8830
8897
|
isPreview,
|
|
8831
8898
|
isEdit,
|
|
8832
8899
|
sectionPlaceholder,
|
|
@@ -8854,8 +8921,10 @@ function PageRenderer({
|
|
|
8854
8921
|
extraProps,
|
|
8855
8922
|
hideLogin,
|
|
8856
8923
|
isCustomWebsite,
|
|
8857
|
-
_id
|
|
8858
|
-
|
|
8924
|
+
_id,
|
|
8925
|
+
countryCode,
|
|
8926
|
+
currencySymbol
|
|
8927
|
+
}), [isMobile, isLandingPages, layout, baseURLs, hashToken, isPreview, isEdit, templateId, navList, isMasterTemplate, basePath, validations, isTutorWebsite, extraProps, hideLogin, _id, countryCode, currencySymbol]);
|
|
8859
8928
|
const Wrapper = SectionWrapper || Fragment;
|
|
8860
8929
|
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
8861
8930
|
theme: theme
|