diy-template-components 0.3.4 → 0.3.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 CHANGED
@@ -1,12 +1,12 @@
1
- function ___$insertStyle(css) {
2
- if (!css || typeof window === 'undefined') {
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';
@@ -4382,6 +4382,8 @@ function VideoTestimonial({
4382
4382
  layout: {
4383
4383
  containerWidth
4384
4384
  },
4385
+ countryCode,
4386
+ currencySymbol,
4385
4387
  isMobile
4386
4388
  } = useContext(PageContext);
4387
4389
  const classes = useVideoTestimonialStyles({
@@ -4413,7 +4415,9 @@ function VideoTestimonial({
4413
4415
  })), /*#__PURE__*/React.createElement(Wrapper, null, videoData.videoCarousel.components.map((data, index) => /*#__PURE__*/React.createElement(SingleVideoSlide$2, {
4414
4416
  data: data,
4415
4417
  key: index,
4416
- sectionIndex: sectionIndex
4418
+ sectionIndex: sectionIndex,
4419
+ countryCode: countryCode,
4420
+ currencySymbol: currencySymbol
4417
4421
  }))))));
4418
4422
  }
4419
4423
 
@@ -7322,7 +7326,9 @@ const SingleVideoSlide$1 = props => {
7322
7326
  const {
7323
7327
  data,
7324
7328
  webinarCtaClick,
7325
- conversions = 0
7329
+ conversions = 0,
7330
+ countryCode,
7331
+ currencySymbol
7326
7332
  } = props;
7327
7333
  const renderer = ({
7328
7334
  days,
@@ -7332,11 +7338,14 @@ const SingleVideoSlide$1 = props => {
7332
7338
  completed
7333
7339
  }) => {
7334
7340
  if (days === 0 && hours < 24) {
7341
+ if (countryCode === 'KR') {
7342
+ return /*#__PURE__*/React.createElement("span", null, hours, " \uC2DC\uAC04 ", minutes, " \uBD84 ", seconds, "\uCD08");
7343
+ }
7335
7344
  return /*#__PURE__*/React.createElement("span", null, hours, "h ", minutes, "m ", seconds, "s");
7336
7345
  } else {
7337
7346
  let given = moment(props.data.offerPriceEndDate);
7338
7347
  let current = moment().startOf('day');
7339
- return /*#__PURE__*/React.createElement("span", null, Math.floor(moment.duration(given.diff(current)).asDays()), " day(s)");
7348
+ return /*#__PURE__*/React.createElement("span", null, Math.floor(moment.duration(given.diff(current)).asDays()), ' ', countryCode === 'KR' ? '날' : 'day(s)');
7340
7349
  }
7341
7350
  };
7342
7351
  const checkIfOfferIsValid = () => moment().diff(moment(props.data.offerPriceEndDate)) < 0;
@@ -7368,6 +7377,44 @@ const SingleVideoSlide$1 = props => {
7368
7377
  return (discount / price * 100).toFixed(2);
7369
7378
  };
7370
7379
  const classes = useWebinarPromotionPage();
7380
+ const effectivePrice = formatCurrency(countryCode, data?.effectivePrice, currencySymbol);
7381
+ const renderHurryUpBannerText = () => {
7382
+ let count = data.offerPriceValidFor - conversions;
7383
+ if (countryCode === 'KR') {
7384
+ if (count > 1) {
7385
+ return `서두르세요! 현재 신청 가능 인원은 ${count}명 입니다.`;
7386
+ } else {
7387
+ return `서두르세요! ${count}명까지만 신청 가능이 가능합니다.`;
7388
+ }
7389
+ } else {
7390
+ return `Hurry up! Offer left for ${count} ${count > 1 ? 'users now' : 'user only'}`;
7391
+ }
7392
+ };
7393
+ const limitedPeriodOfferText = countryCode === 'KR' ? '기간 한정 딜이므로 서두르세요!' : 'Hurry up! Offer for limited period only';
7394
+ const renderOfferEndsInText = () => {
7395
+ if (countryCode === 'KR') {
7396
+ return /*#__PURE__*/React.createElement("p", {
7397
+ className: classes.offerText
7398
+ }, /*#__PURE__*/React.createElement("span", {
7399
+ className: classes.courseDetailTime
7400
+ }, /*#__PURE__*/React.createElement(Countdown, {
7401
+ renderer: renderer,
7402
+ date: data.offerPriceEndDate
7403
+ })), ' ', "\uD6C4\xA0\uC2E0\uCCAD\xA0\uB9C8\uAC10\xA0\uC608\uC815");
7404
+ } else {
7405
+ return /*#__PURE__*/React.createElement("p", {
7406
+ className: classes.offerText
7407
+ }, "Offer Ends in", ' ', /*#__PURE__*/React.createElement("span", {
7408
+ className: classes.courseDetailTime
7409
+ }, /*#__PURE__*/React.createElement(Countdown, {
7410
+ renderer: renderer,
7411
+ date: data.offerPriceEndDate
7412
+ })));
7413
+ }
7414
+ };
7415
+ const finalPrice = formatCurrency(countryCode, data?.price, currencySymbol);
7416
+ const buyNowText = countryCode === 'KR' ? '이 강좌를 수강하세요.' : 'BUY NOW';
7417
+ const registerNowText = countryCode === 'KR' ? '지금 신청하기' : 'REGISTER NOW';
7371
7418
  return /*#__PURE__*/React.createElement("div", {
7372
7419
  className: classes.videoCarouselContainer
7373
7420
  }, /*#__PURE__*/React.createElement("div", {
@@ -7380,11 +7427,11 @@ const SingleVideoSlide$1 = props => {
7380
7427
  className: classes.bannerContainer
7381
7428
  }, /*#__PURE__*/React.createElement("div", {
7382
7429
  className: classes.bannerContainerText
7383
- }, "Hurry up! Offer left for", ' ', data.offerPriceValidFor - conversions, ' ', data.offerPriceValidFor - conversions > 1 ? 'users now' : 'user only')) : checkIfOfferIsValid() && data.offerPriceValidFor !== null ? data.offerPriceValidFor - conversions > 0 : /*#__PURE__*/React.createElement("div", {
7430
+ }, renderHurryUpBannerText())) : checkIfOfferIsValid() && data.offerPriceValidFor !== null ? data.offerPriceValidFor - conversions > 0 : /*#__PURE__*/React.createElement("div", {
7384
7431
  className: classes.bannerContainer
7385
7432
  }, /*#__PURE__*/React.createElement("div", {
7386
7433
  className: classes.bannerContainerText
7387
- }, "Hurry up! Offer for limited period only"))), /*#__PURE__*/React.createElement("h3", {
7434
+ }, limitedPeriodOfferText))), /*#__PURE__*/React.createElement("h3", {
7388
7435
  ref: data?.videoTextHeading?.refSetter,
7389
7436
  className: classes.videoDetailsHeading,
7390
7437
  dangerouslySetInnerHTML: {
@@ -7424,14 +7471,7 @@ const SingleVideoSlide$1 = props => {
7424
7471
  }
7425
7472
  }))), /*#__PURE__*/React.createElement("div", {
7426
7473
  className: classes.courseViewContainer
7427
- }, data.isPaid !== 0 && checkIfOfferIsValid() && (data.offerPriceValidFor !== null ? data.offerPriceValidFor - conversions > 0 : true) && /*#__PURE__*/React.createElement("p", {
7428
- className: classes.offerText
7429
- }, "Offer Ends in", ' ', /*#__PURE__*/React.createElement("span", {
7430
- className: classes.courseDetailTime
7431
- }, /*#__PURE__*/React.createElement(Countdown, {
7432
- renderer: renderer,
7433
- date: data.offerPriceEndDate
7434
- }))), /*#__PURE__*/React.createElement("div", {
7474
+ }, data.isPaid !== 0 && checkIfOfferIsValid() && (data.offerPriceValidFor !== null ? data.offerPriceValidFor - conversions > 0 : true) && renderOfferEndsInText(), /*#__PURE__*/React.createElement("div", {
7435
7475
  ref: data?.videoFrame?.refSetter,
7436
7476
  className: classes.iframeContainer
7437
7477
  }, /*#__PURE__*/React.createElement(VideoPlayer, {
@@ -7448,13 +7488,13 @@ const SingleVideoSlide$1 = props => {
7448
7488
  className: classes.priceContainer
7449
7489
  }, /*#__PURE__*/React.createElement("div", {
7450
7490
  className: classes.offerPrice
7451
- }, "\u20B9", data?.effectivePrice), checkForShowDiscount() && (data.offerPriceEndDate ? checkIfOfferIsValid() : true) && /*#__PURE__*/React.createElement("p", {
7491
+ }, effectivePrice), checkForShowDiscount() && (data.offerPriceEndDate ? checkIfOfferIsValid() : true) && /*#__PURE__*/React.createElement("p", {
7452
7492
  style: {
7453
7493
  fontSize: '20px'
7454
7494
  }
7455
7495
  }, /*#__PURE__*/React.createElement("span", {
7456
7496
  className: classes.originalPrice
7457
- }, "\u20B9", data?.price), ' ', /*#__PURE__*/React.createElement("span", {
7497
+ }, finalPrice), ' ', /*#__PURE__*/React.createElement("span", {
7458
7498
  className: classes.offerDiscount
7459
7499
  }, `${data && discount(data)}%`))) : null, /*#__PURE__*/React.createElement("div", {
7460
7500
  className: classes.webinarButtonContainer
@@ -7466,7 +7506,7 @@ const SingleVideoSlide$1 = props => {
7466
7506
  data: {
7467
7507
  // link: 'headerData?.loginCtaLink',
7468
7508
  // isLink: 1,
7469
- value: data.isPaid ? 'BUY NOW' : 'REGISTER NOW'
7509
+ value: data.isPaid ? buyNowText : registerNowText
7470
7510
  // isExternal: 1
7471
7511
  },
7472
7512
 
@@ -7484,10 +7524,12 @@ function CoursePromotionPage$1({
7484
7524
  sectionIndex
7485
7525
  }) {
7486
7526
  const {
7487
- isMobile,
7488
7527
  layout: {
7489
7528
  containerWidth
7490
- }
7529
+ },
7530
+ countryCode,
7531
+ currencySymbol,
7532
+ isMobile
7491
7533
  } = useContext(PageContext);
7492
7534
  const classes = useWebinarPromotionPage({
7493
7535
  containerWidth,
@@ -7503,7 +7545,9 @@ function CoursePromotionPage$1({
7503
7545
  data: sectionData.components[0].metadata,
7504
7546
  webinarCtaClick: extraProps.webinarCtaClick,
7505
7547
  conversions: extraProps.conversions,
7506
- sectionIndex: sectionIndex
7548
+ sectionIndex: sectionIndex,
7549
+ countryCode: countryCode,
7550
+ currencySymbol: currencySymbol
7507
7551
  }))));
7508
7552
  }
7509
7553
 
@@ -7823,18 +7867,23 @@ const SingleVideoSlide = props => {
7823
7867
  completed
7824
7868
  }) => {
7825
7869
  if (days === 0 && hours < 24) {
7870
+ if (countryCode === 'KR') {
7871
+ return /*#__PURE__*/React.createElement("span", null, hours, " \uC2DC\uAC04 ", minutes, " \uBD84 ", seconds, "\uCD08");
7872
+ }
7826
7873
  return /*#__PURE__*/React.createElement("span", null, hours, "h ", minutes, "m ", seconds, "s");
7827
7874
  } else {
7828
7875
  let given = moment(props.data.endDate);
7829
7876
  let current = moment().startOf('day');
7830
- return /*#__PURE__*/React.createElement("span", null, Math.floor(moment.duration(given.diff(current)).asDays()), " day(s)");
7877
+ return /*#__PURE__*/React.createElement("span", null, Math.floor(moment.duration(given.diff(current)).asDays()), ' ', countryCode === 'KR' ? '날' : 'day(s)');
7831
7878
  }
7832
7879
  };
7833
7880
  const {
7834
7881
  data,
7835
7882
  courseBuyNow,
7836
7883
  conversions = 20,
7837
- showCourseInstallment
7884
+ showCourseInstallment,
7885
+ countryCode,
7886
+ currencySymbol
7838
7887
  } = props;
7839
7888
  const showCourseInstallmentData = data?.courseOverviewData;
7840
7889
  const InstalmentData = isEdit ? data?.courseOverviewData?.installments?.formData?.installments[0].installmentAmount : data?.courseOverviewData?.installments?.formData?.installmentInfo?.installments[0].installmentPrice;
@@ -7867,6 +7916,34 @@ const SingleVideoSlide = props => {
7867
7916
  }) => {
7868
7917
  return (discount / price * 100).toFixed(2);
7869
7918
  };
7919
+ const renderHurryUpBannerText = () => {
7920
+ return countryCode === 'KR' ? `서두르세요! 현재 신청 가능 인원은 ${data.offerPriceValidFor - conversions}명 입니다.` : `Hurry up! Offer left for ${data.offerPriceValidFor - conversions} users now`;
7921
+ };
7922
+ const limitedPeriodOfferText = countryCode === 'KR' ? `기간 한정 딜이므로 서두르세요!` : 'Hurry up! Offer for limited period only';
7923
+ const renderOfferEndsInText = () => {
7924
+ if (countryCode === 'KR') {
7925
+ return /*#__PURE__*/React.createElement("p", {
7926
+ className: classes.offerText
7927
+ }, /*#__PURE__*/React.createElement("span", {
7928
+ className: classes.courseDetailTime
7929
+ }, /*#__PURE__*/React.createElement(Countdown, {
7930
+ renderer: renderer,
7931
+ date: data.endDate
7932
+ })), ' ', "\uD6C4\xA0\uC2E0\uCCAD\xA0\uB9C8\uAC10\xA0\uC608\uC815");
7933
+ } else {
7934
+ return /*#__PURE__*/React.createElement("p", {
7935
+ className: classes.offerText
7936
+ }, "Offer Ends in", ' ', /*#__PURE__*/React.createElement("span", {
7937
+ className: classes.courseDetailTime
7938
+ }, /*#__PURE__*/React.createElement(Countdown, {
7939
+ renderer: renderer,
7940
+ date: data.endDate
7941
+ })));
7942
+ }
7943
+ };
7944
+ const effectivePrice = formatCurrency(countryCode, data?.effectivePrice, currencySymbol);
7945
+ const finalPrice = formatCurrency(countryCode, data?.price, currencySymbol);
7946
+ const buyNowText = countryCode === 'KR' ? '이 강좌를 수강하세요.' : 'BUY NOW';
7870
7947
  return /*#__PURE__*/React.createElement("div", {
7871
7948
  className: classes.videoCarouselContainer
7872
7949
  }, /*#__PURE__*/React.createElement("div", {
@@ -7879,11 +7956,11 @@ const SingleVideoSlide = props => {
7879
7956
  className: classes.bannerContainer
7880
7957
  }, /*#__PURE__*/React.createElement("div", {
7881
7958
  className: classes.bannerContainerText
7882
- }, "Hurry up! Offer left for", ' ', data.offerPriceValidFor - conversions, " users now")) : checkIfOfferIsValid() && /*#__PURE__*/React.createElement("div", {
7959
+ }, renderHurryUpBannerText())) : checkIfOfferIsValid() && /*#__PURE__*/React.createElement("div", {
7883
7960
  className: classes.bannerContainer
7884
7961
  }, /*#__PURE__*/React.createElement("div", {
7885
7962
  className: classes.bannerContainerText
7886
- }, "Hurry up! Offer for limited period only"))), /*#__PURE__*/React.createElement("div", {
7963
+ }, limitedPeriodOfferText))), /*#__PURE__*/React.createElement("div", {
7887
7964
  className: classes.emblemContainer
7888
7965
  }, data?.courseOverviewData?.courseTagList.length && data?.courseOverviewData?.courseTagList?.map(data => {
7889
7966
  return /*#__PURE__*/React.createElement("div", {
@@ -7948,14 +8025,7 @@ const SingleVideoSlide = props => {
7948
8025
  }
7949
8026
  }, /*#__PURE__*/React.createElement("div", {
7950
8027
  className: classes.courseViewContainer
7951
- }, checkIfOfferIsValid() && (data.offerPriceValidFor !== null ? data.offerPriceValidFor - conversions > 0 : true) && /*#__PURE__*/React.createElement("p", {
7952
- className: classes.offerText
7953
- }, "Offer Ends in", ' ', /*#__PURE__*/React.createElement("span", {
7954
- className: classes.courseDetailTime
7955
- }, /*#__PURE__*/React.createElement(Countdown, {
7956
- renderer: renderer,
7957
- date: data.endDate
7958
- }))), /*#__PURE__*/React.createElement("div", {
8028
+ }, checkIfOfferIsValid() && (data.offerPriceValidFor !== null ? data.offerPriceValidFor - conversions > 0 : true) && renderOfferEndsInText(), /*#__PURE__*/React.createElement("div", {
7959
8029
  ref: data?.videoFrame?.refSetter,
7960
8030
  className: classes.iframeContainer
7961
8031
  }, /*#__PURE__*/React.createElement(VideoPlayer, {
@@ -7969,14 +8039,14 @@ const SingleVideoSlide = props => {
7969
8039
  className: classes.priceContainer
7970
8040
  }, /*#__PURE__*/React.createElement("div", {
7971
8041
  className: classes.offerPrice
7972
- }, "\u20B9 ", data.effectivePrice), checkForShowDiscount() && (data.endDate ? checkIfOfferIsValid() : true) && /*#__PURE__*/React.createElement("p", {
8042
+ }, effectivePrice), checkForShowDiscount() && (data.endDate ? checkIfOfferIsValid() : true) && /*#__PURE__*/React.createElement("p", {
7973
8043
  style: {
7974
8044
  // fontSize: '20px',
7975
8045
  marginTop: '0px'
7976
8046
  }
7977
8047
  }, /*#__PURE__*/React.createElement("span", {
7978
8048
  className: classes.originalPrice
7979
- }, "\u20B9 ", data.price), ' ', /*#__PURE__*/React.createElement("span", {
8049
+ }, finalPrice), ' ', /*#__PURE__*/React.createElement("span", {
7980
8050
  className: classes.offerDiscount
7981
8051
  }, `${data && discount(data)}%`))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
7982
8052
  style: {
@@ -7985,7 +8055,7 @@ const SingleVideoSlide = props => {
7985
8055
  data: {
7986
8056
  // link: 'headerData?.loginCtaLink',
7987
8057
  // isLink: 1,
7988
- value: 'BUY NOW'
8058
+ value: buyNowText
7989
8059
  // isExternal: 1
7990
8060
  },
7991
8061
 
@@ -8021,10 +8091,12 @@ function CoursePromotionPage({
8021
8091
  sectionIndex
8022
8092
  }) {
8023
8093
  const {
8024
- isMobile,
8025
8094
  layout: {
8026
8095
  containerWidth
8027
- }
8096
+ },
8097
+ countryCode,
8098
+ currencySymbol,
8099
+ isMobile
8028
8100
  } = useContext(PageContext);
8029
8101
  const classes = useCoursePromotionPage({
8030
8102
  containerWidth,
@@ -8041,7 +8113,9 @@ function CoursePromotionPage({
8041
8113
  courseBuyNow: extraProps.courseBuyNow,
8042
8114
  showCourseInstallment: extraProps.showCourseInstallment,
8043
8115
  conversions: extraProps.conversions,
8044
- sectionIndex: sectionIndex
8116
+ sectionIndex: sectionIndex,
8117
+ countryCode: countryCode,
8118
+ currencySymbol: currencySymbol
8045
8119
  }))));
8046
8120
  }
8047
8121