diy-template-components 2.0.49 → 2.0.51

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.js CHANGED
@@ -1089,12 +1089,23 @@ function OptionList({
1089
1089
  isPreview,
1090
1090
  countryCode
1091
1091
  } = React.useContext(PageContext);
1092
+ function checkIsActiveTab(slug = "") {
1093
+ if (typeof window !== "undefined") {
1094
+ const pathname = window.location.pathname;
1095
+ const slugFromPathname = pathname?.split('/')[1];
1096
+ if (slug && slugFromPathname.includes(slug)) {
1097
+ return true;
1098
+ } else {
1099
+ return false;
1100
+ }
1101
+ }
1102
+ }
1092
1103
  const tabsDataModifier = () => {
1093
1104
  return optionsData?.map(dt => {
1094
1105
  return {
1095
1106
  value: dt.title,
1096
1107
  link: dt.slug,
1097
- active: dt.active,
1108
+ active: checkIsActiveTab(dt.slug),
1098
1109
  isLink: true,
1099
1110
  isExternal: 0
1100
1111
  };