@devgateway/dvz-ui-react 1.6.17 → 1.6.19

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),x=require("react"),o=require("semantic-ui-react"),a=require("@devgateway/wp-react-lib"),L=require("../connected-templates/PostIntro.js"),k=require("react-router"),y=require("../connected-templates/PostContent.js"),I=f=>{const{posts:d,showIcons:j,showContentToggle:l,contentToggleHPosition:C,locale:T,readMoreLabel:u,readLessLabel:w}=f,[s,b]=x.useState({}),i=x.createRef(),c=(e,n="Read More")=>e&&e.trim()!==""?e:n;x.useEffect(()=>{window.setTimeout(()=>{if(window.location.hash){const e=document.getElementById(window.location.hash.substr(1));e&&e.scrollIntoView({behavior:"auto",block:"start"})}},0)},[d]);const h=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[];return n.length>1?n[1]:n[0]},g=e=>{const n=s[e]||!1,r=n?c(w,"Read less"):c(u,"Read more");return t.jsx("div",{children:t.jsx("div",{style:{position:"relative",left:C+"%"},children:t.jsx("a",{className:"link",onClick:()=>{i.current&&n&&(i.current.scrollIntoView({behavior:"smooth",block:"start"}),i.current.scrollTop=0),b({...s,[e]:!n})},children:r})})})},m=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[],r=n.length>1?n[0]:null;return r?r.trim():null},P=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[];return n.length>1&&n[1].trim().length>0};return t.jsx(o.Container,{fluid:!0,className:"inline list",children:d&&d.map(e=>t.jsxs(o.Grid,{children:[j&&t.jsxs(o.Grid.Column,{textAlign:"center",width:1,children:[t.jsx("a",{id:e.slug}),t.jsx(a.MediaProvider,{id:e.meta_fields&&e.meta_fields.icon?e.meta_fields.icon[0]:null,children:t.jsx(a.MediaConsumer,{children:t.jsx(a.PostIcon,{as:o.Label})})})]}),t.jsxs(o.Grid.Column,{width:j?15:16,children:[m(e)&&t.jsx(L.default,{as:o.Container,fluid:!0,post:e,ref:i}),!m(e)&&t.jsx(y.default,{post:{content:{rendered:h(e)}},style:{clear:"both",display:"block"}}),P(e)&&t.jsxs(o.Container,{children:[l&&t.jsxs(t.Fragment,{children:[!s[e.slug]&&g(e.slug),t.jsx(y.default,{post:{content:{rendered:h(e)}},style:{clear:"both",display:s[e.slug]?"block":"none"}}),s[e.slug]&&g(e.slug)]}),!l&&t.jsx("a",{href:a.utils.replaceLink(e.link,T),className:"link",children:c(u)})]})]})]}))})},v=f=>{const[d,j]=x.useState(Math.random()*99998+1),{locale:l}=k.useParams(),{"data-width":C,"data-height":T,"data-type":u,"data-taxonomy":w,"data-categories":s,"data-items":b,"data-color":i,"data-show-post-icons":c,"data-show-content-toggle":h,"data-content-toggle-h-position":g,"data-read-more-label":m,"data-read-less-label":P,parent:e,editing:n,component:r,unique:R}=f;return t.jsx(o.Container,{fluid:!0,children:t.jsx(a.PostProvider,{type:u,locale:l,taxonomy:w,categories:s,store:"inline_list_"+e+"_"+R,page:1,perPage:b,children:t.jsx(a.PostConsumer,{children:t.jsx(I,{locale:l??"en",showIcons:c==="true",showContentToggle:h==="true",contentToggleHPosition:parseInt(g||"50",10),readMoreLabel:m,readLessLabel:P})})})})};exports.default=v;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),x=require("react"),o=require("semantic-ui-react"),l=require("@devgateway/wp-react-lib"),L=require("../connected-templates/PostIntro.js"),k=require("react-router"),T=require("../connected-templates/PostContent.js"),I=f=>{const{posts:d,showIcons:j,showContentToggle:a,contentToggleHPosition:w,locale:C,readMoreLabel:u,readLessLabel:b}=f,[s,P]=x.useState({}),i=x.createRef(),c=(e,n="Read More")=>e&&e.trim()!==""?e:n;x.useEffect(()=>{window.setTimeout(()=>{if(window.location.hash){const e=document.getElementById(window.location.hash.substr(1));e&&e.scrollIntoView({behavior:"auto",block:"start"})}},0)},[d]);const h=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[];return n.length>1?n[1]:n[0]},g=e=>{const n=s[e]||!1,r=n?c(b,"Read less"):c(u,"Read more");return t.jsx("div",{children:t.jsx("div",{style:{display:"flex",justifyContent:w<33?"flex-start":w<66?"center":"flex-end"},children:t.jsx("a",{className:"link",onClick:()=>{i.current&&n&&(i.current.scrollIntoView({behavior:"smooth",block:"start"}),i.current.scrollTop=0),P({...s,[e]:!n})},children:r})})})},m=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[],r=n.length>1?n[0]:null;return r?r.trim():null},y=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[];return n.length>1&&n[1].trim().length>0};return t.jsx(o.Container,{fluid:!0,className:"inline list",children:d&&d.map(e=>t.jsxs(o.Grid,{children:[j&&t.jsxs(o.Grid.Column,{textAlign:"center",width:1,children:[t.jsx("a",{id:e.slug}),t.jsx(l.MediaProvider,{id:e.meta_fields&&e.meta_fields.icon?e.meta_fields.icon[0]:null,children:t.jsx(l.MediaConsumer,{children:t.jsx(l.PostIcon,{as:o.Label})})})]}),t.jsxs(o.Grid.Column,{width:j?15:16,children:[m(e)&&t.jsx(L.default,{as:o.Container,fluid:!0,post:e,ref:i}),!m(e)&&t.jsx(T.default,{post:{content:{rendered:h(e)}},style:{clear:"both",display:"block"}}),y(e)&&t.jsxs(o.Container,{children:[a&&t.jsxs(t.Fragment,{children:[!s[e.slug]&&g(e.slug),t.jsx(T.default,{post:{content:{rendered:h(e)}},style:{clear:"both",display:s[e.slug]?"block":"none"}}),s[e.slug]&&g(e.slug)]}),!a&&t.jsx("a",{href:l.utils.replaceLink(e.link,C),className:"link",children:c(u)})]})]})]}))})},p=f=>{const[d,j]=x.useState(Math.random()*99998+1),{locale:a}=k.useParams(),{"data-width":w,"data-height":C,"data-type":u,"data-taxonomy":b,"data-categories":s,"data-items":P,"data-color":i,"data-show-post-icons":c,"data-show-content-toggle":h,"data-content-toggle-h-position":g,"data-read-more-label":m,"data-read-less-label":y,parent:e,editing:n,component:r,unique:R}=f;return t.jsx(o.Container,{fluid:!0,children:t.jsx(l.PostProvider,{type:u,locale:a,taxonomy:b,categories:s,store:"inline_list_"+e+"_"+R,page:1,perPage:P,children:t.jsx(l.PostConsumer,{children:t.jsx(I,{locale:a??"en",showIcons:c==="true",showContentToggle:h==="true",contentToggleHPosition:parseInt(g||"50",10),readMoreLabel:m,readLessLabel:y})})})})};exports.default=p;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),o=require("react"),t=require("react-router"),m=require("../embeddable/index.js"),f=require("react-intl"),s=require("@devgateway/wp-react-lib"),g=require("react-redux");require("semantic-ui-react");require("../utils/AppMedia.js");require("./Footer.js");require("./Header.js");const p=require("./Customizer.js");require("./Favicon.js");require("clsx");require("../utils/semanticUtils.js");require("./SearchControl.js");const h=require("../conf/index.js");require("./ClassicHeader.js");require("./FloatingMenuHeader.js");const x=require("../translations/en.json.js"),v=require("../translations/fr.json.js"),j=require("../translations/af.json.js"),w=require("../translations/am.json.js"),C=require("../lib/react-intl-redux/index.js");require("immutable");const n=require("../redux/store.js"),y=require("../tracker/withGoogleAnalytics.js"),i={en:x,fr:v,am:w,af:j},I=()=>{const a=t.useParams(),l=t.useLocation(),u=h.Config.DEFAULT_LOCALE,[b,d]=o.useState(!1),e=a.lan,q=l.pathname;return o.useEffect(()=>{d(!0),process.env.NODE_ENV==="development"&&(console.log("----------.env-----------"),console.log(process.env),console.log("----------.env-----------")),typeof window<"u"&&window.setTimeout(()=>{if(window.location.hash){const c=document.getElementById(window.location.hash.substring(1));c&&c.scrollIntoView({behavior:"auto",block:"start"})}},2e3)},[]),o.useEffect(()=>{n.store.dispatch(C.updateIntl({locale:e,formats:{},messages:i[e??"en"]}))},[e]),e?Object.keys(i).includes(e)?r.jsx(g.Provider,{store:n.store,children:r.jsx(f.IntlProvider,{locale:e,messages:i[e],children:r.jsx(s.AppContextProvider,{getComponent:m.getComponentByNameIgnoreCase,store:n.store,locale:e,children:r.jsx(s.SettingProvider,{locale:e,changeUUID:null,children:r.jsxs(s.SettingsConsumer,{children:[r.jsx(p.CustomizerWrapper,{}),r.jsx(t.Outlet,{})]})})})},e)}):r.jsx(t.Navigate,{to:`/${u}${q}`,replace:!0}):r.jsx(t.Navigate,{to:u,replace:!0})},L=y.withTracker(I);exports.default=L;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),o=require("react"),t=require("react-router"),m=require("../embeddable/index.js"),f=require("react-intl"),s=require("@devgateway/wp-react-lib"),g=require("react-redux");require("semantic-ui-react");require("../utils/AppMedia.js");require("./Footer.js");require("./Header.js");const p=require("./Customizer.js"),h=require("../conf/index.js"),x=require("../translations/en.json.js"),v=require("../translations/fr.json.js"),j=require("../translations/af.json.js"),C=require("../translations/am.json.js"),w=require("../lib/react-intl-redux/index.js");require("immutable");const n=require("../redux/store.js");require("./Favicon.js");require("clsx");require("../utils/semanticUtils.js");require("./SearchControl.js");require("./ClassicHeader.js");require("./FloatingMenuHeader.js");const i={en:x,fr:v,am:C,af:j},I=()=>{const a=t.useParams(),l=t.useLocation(),u=h.Config.DEFAULT_LOCALE,[b,d]=o.useState(!1),e=a.lan,q=l.pathname;return o.useEffect(()=>{d(!0),process.env.NODE_ENV==="development"&&(console.log("----------.env-----------"),console.log(process.env),console.log("----------.env-----------")),typeof window<"u"&&window.setTimeout(()=>{if(window.location.hash){const c=document.getElementById(window.location.hash.substring(1));c&&c.scrollIntoView({behavior:"auto",block:"start"})}},2e3)},[]),o.useEffect(()=>{n.store.dispatch(w.updateIntl({locale:e,formats:{},messages:i[e??"en"]}))},[e]),e?Object.keys(i).includes(e)?r.jsx(g.Provider,{store:n.store,children:r.jsx(f.IntlProvider,{locale:e,messages:i[e],children:r.jsx(s.AppContextProvider,{getComponent:m.getComponentByNameIgnoreCase,store:n.store,locale:e,children:r.jsx(s.SettingProvider,{locale:e,changeUUID:null,children:r.jsxs(s.SettingsConsumer,{children:[r.jsx(p.CustomizerWrapper,{}),r.jsx(t.Outlet,{})]})})})},e)}):r.jsx(t.Navigate,{to:`/${u}${q}`,replace:!0}):r.jsx(t.Navigate,{to:u,replace:!0})};exports.default=I;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react/jsx-runtime"),i=require("react"),c=require("react-ga4"),x=require("react-router"),P=require("../conf/index.js"),b=require("@devgateway/wp-react-lib"),E=require("./internalTrafficUtils.js"),C=new Set;let s=!1;const L=l=>{const f=T=>{var m;const d=i.useContext(b.SettingsContext)??{},e=((m=d==null?void 0:d.data)==null?void 0:m.google_analytics_code)??P.Config.GA_CODE,a=x.useLocation(),_=i.useRef(null),u=i.useRef(!1),g=i.useRef(!1);if(typeof window<"u"&&!s&&e&&e!=="#REACT_APP_GA_CODE#"){if(!C.has(e))try{c.initialize(e),C.add(e),console.log("GA initialized with code:",e)}catch(t){console.error("Failed to initialize GA:",t)}s=!0}return i.useEffect(()=>{if(typeof window>"u"||!e||e==="#REACT_APP_GA_CODE#"||!s)return;const t=a.pathname;if(_.current!==t){_.current=t,u.current=!1;try{const r=E.isInternalTrafficEnabled()?"internal":"external";c.event("page_view",{page_path:t,traffic_type:r}),console.log("GA pageview sent:",{page:t,traffic_type:r})}catch(r){console.error("Failed to send pageview:",r)}}},[a.pathname,e]),i.useEffect(()=>{if(typeof window>"u"||!e||e==="#REACT_APP_GA_CODE#"||!s||g.current)return;const t=E.isInternalTrafficEnabled()?"internal":"external",r=()=>{if(u.current)return;const n=Math.round(window.scrollY/(document.documentElement.scrollHeight-window.innerHeight)*100);if(n>10)try{c.event("scroll",{engagement_type:"scroll",scroll_depth:n,traffic_type:t}),console.log("GA scroll event sent:",{scrollPercentage:n,traffic_type:t}),u.current=!0}catch(o){console.error("Failed to send scroll event:",o)}},p=n=>{var A;const o=n.target,h=((A=o.textContent)==null?void 0:A.substring(0,50))||"",v=o.id||"",y=o.className||"";if(!(!h&&!v&&!y))try{c.event("element_click",{element_id:v,element_class:y,element_text:h.substring(0,50),traffic_type:t})}catch{}},G=Date.now(),w=()=>{const n=Math.round((Date.now()-G)/1e3);if(n>3)try{c.event("time_on_page",{page_path:a.pathname,duration_seconds:n,traffic_type:t}),console.log("GA time_on_page event sent:",{timeOnPage:n,path:a.pathname})}catch(o){console.error("Failed to send time_on_page event:",o)}};return window.addEventListener("scroll",r,{passive:!0}),document.addEventListener("click",p),window.addEventListener("beforeunload",w),g.current=!0,()=>{window.removeEventListener("scroll",r),document.removeEventListener("click",p),window.removeEventListener("beforeunload",w)}},[a.pathname,e]),R.jsx(l,{...T})};return f.displayName=`withTracker(${l.displayName||l.name||"Component"})`,f};exports.withTracker=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react/jsx-runtime"),o=require("react"),s=require("react-ga4"),R=require("react-router"),b=require("../conf/index.js"),P=require("@devgateway/wp-react-lib"),L=require("./internalTrafficUtils.js"),y=new Set;let l=!1;const k=d=>{const w=C=>{var _;const u=o.useContext(P.SettingsContext)??{},e=((_=u==null?void 0:u.data)==null?void 0:_.google_analytics_code)??b.Config.GA_CODE,c=R.useLocation(),g=o.useRef(null),f=o.useRef(!1),m=o.useRef(!1),i=o.useRef(!1);if(typeof window<"u"&&!i.current&&(i.current=L.isInternalTrafficEnabled(),i.current&&console.log("[GA] Internal traffic detected — GA will NOT be initialized and no events will be sent.")),typeof window<"u"&&!i.current&&!l&&e&&e!=="#REACT_APP_GA_CODE#"){if(!y.has(e))try{s.initialize(e),y.add(e),console.log("GA initialized with code:",e)}catch(t){console.error("Failed to initialize GA:",t)}l=!0}return o.useEffect(()=>{if(typeof window>"u"||i.current||!e||e==="#REACT_APP_GA_CODE#"||!l)return;const t=c.pathname;if(g.current!==t){g.current=t,f.current=!1;try{s.event("page_view",{page_path:t}),console.log("GA pageview sent:",{page:t})}catch(a){console.error("Failed to send pageview:",a)}}},[c.pathname,e]),o.useEffect(()=>{if(typeof window>"u"||i.current||!e||e==="#REACT_APP_GA_CODE#"||!l||m.current)return;const t=()=>{if(f.current)return;const n=Math.round(window.scrollY/(document.documentElement.scrollHeight-window.innerHeight)*100);if(n>10)try{s.event("scroll",{engagement_type:"scroll",scroll_depth:n}),console.log("GA scroll event sent:",{scrollPercentage:n}),f.current=!0}catch(r){console.error("Failed to send scroll event:",r)}},a=n=>{var E;const r=n.target,v=((E=r.textContent)==null?void 0:E.substring(0,50))||"",p=r.id||"",A=r.className||"";if(!(!v&&!p&&!A))try{s.event("element_click",{element_id:p,element_class:A,element_text:v.substring(0,50)})}catch{}},G=Date.now(),h=()=>{const n=Math.round((Date.now()-G)/1e3);if(n>3)try{s.event("time_on_page",{page_path:c.pathname,duration_seconds:n}),console.log("GA time_on_page event sent:",{timeOnPage:n,path:c.pathname})}catch(r){console.error("Failed to send time_on_page event:",r)}};return window.addEventListener("scroll",t,{passive:!0}),document.addEventListener("click",a),window.addEventListener("beforeunload",h),m.current=!0,()=>{window.removeEventListener("scroll",t),document.removeEventListener("click",a),window.removeEventListener("beforeunload",h)}},[c.pathname,e]),T.jsx(d,{...C})};return w.displayName=`withTracker(${d.displayName||d.name||"Component"})`,w};exports.withTracker=k;
@@ -1,13 +1,13 @@
1
- import { jsx as o, jsxs as i, Fragment as R } from "react/jsx-runtime";
2
- import v, { useState as I, useEffect as x } from "react";
1
+ import { jsx as o, jsxs as i, Fragment as L } from "react/jsx-runtime";
2
+ import R, { useState as x, useEffect as v } from "react";
3
3
  import { Container as u, Grid as T, Label as M } from "semantic-ui-react";
4
- import { PostProvider as _, PostConsumer as S, MediaProvider as B, MediaConsumer as H, PostIcon as N, utils as j } from "@devgateway/wp-react-lib";
4
+ import { PostProvider as _, PostConsumer as S, MediaProvider as j, MediaConsumer as B, PostIcon as H, utils as N } from "@devgateway/wp-react-lib";
5
5
  import E from "../connected-templates/PostIntro.js";
6
6
  import { useParams as V } from "react-router";
7
7
  import k from "../connected-templates/PostContent.js";
8
8
  const q = (f) => {
9
- const { posts: c, showIcons: w, showContentToggle: s, contentToggleHPosition: y, locale: C, readMoreLabel: d, readLessLabel: P } = f, [n, b] = I({}), l = v.createRef(), a = (t, e = "Read More") => t && t.trim() !== "" ? t : e;
10
- x(() => {
9
+ const { posts: c, showIcons: w, showContentToggle: s, contentToggleHPosition: P, locale: C, readMoreLabel: d, readLessLabel: b } = f, [n, p] = x({}), l = R.createRef(), a = (t, e = "Read More") => t && t.trim() !== "" ? t : e;
10
+ v(() => {
11
11
  window.setTimeout(
12
12
  () => {
13
13
  if (window.location.hash) {
@@ -22,14 +22,17 @@ const q = (f) => {
22
22
  const e = t.content ? t.content.rendered.split("<!--more-->") : [];
23
23
  return e.length > 1 ? e[1] : e[0];
24
24
  }, m = (t) => {
25
- const e = n[t] || !1, r = e ? a(P, "Read less") : a(d, "Read more");
26
- return /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o("div", { style: { position: "relative", left: y + "%" }, children: /* @__PURE__ */ o("a", { className: "link", onClick: () => {
27
- l.current && e && (l.current.scrollIntoView({ behavior: "smooth", block: "start" }), l.current.scrollTop = 0), b({ ...n, [t]: !e });
25
+ const e = n[t] || !1, r = e ? a(b, "Read less") : a(d, "Read more");
26
+ return /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o("div", { style: {
27
+ display: "flex",
28
+ justifyContent: P < 33 ? "flex-start" : P < 66 ? "center" : "flex-end"
29
+ }, children: /* @__PURE__ */ o("a", { className: "link", onClick: () => {
30
+ l.current && e && (l.current.scrollIntoView({ behavior: "smooth", block: "start" }), l.current.scrollTop = 0), p({ ...n, [t]: !e });
28
31
  }, children: r }) }) });
29
32
  }, g = (t) => {
30
33
  const e = t.content ? t.content.rendered.split("<!--more-->") : [], r = e.length > 1 ? e[0] : null;
31
34
  return r ? r.trim() : null;
32
- }, p = (t) => {
35
+ }, y = (t) => {
33
36
  const e = t.content ? t.content.rendered.split("<!--more-->") : [];
34
37
  return e.length > 1 && e[1].trim().length > 0;
35
38
  };
@@ -37,10 +40,10 @@ const q = (f) => {
37
40
  w && /* @__PURE__ */ i(T.Column, { textAlign: "center", width: 1, children: [
38
41
  /* @__PURE__ */ o("a", { id: t.slug }),
39
42
  /* @__PURE__ */ o(
40
- B,
43
+ j,
41
44
  {
42
45
  id: t.meta_fields && t.meta_fields.icon ? t.meta_fields.icon[0] : null,
43
- children: /* @__PURE__ */ o(H, { children: /* @__PURE__ */ o(N, { as: M }) })
46
+ children: /* @__PURE__ */ o(B, { children: /* @__PURE__ */ o(H, { as: M }) })
44
47
  }
45
48
  )
46
49
  ] }),
@@ -53,8 +56,8 @@ const q = (f) => {
53
56
  style: { clear: "both", display: "block" }
54
57
  }
55
58
  ),
56
- p(t) && /* @__PURE__ */ i(u, { children: [
57
- s && /* @__PURE__ */ i(R, { children: [
59
+ y(t) && /* @__PURE__ */ i(u, { children: [
60
+ s && /* @__PURE__ */ i(L, { children: [
58
61
  !n[t.slug] && m(t.slug),
59
62
  /* @__PURE__ */ o(
60
63
  k,
@@ -68,40 +71,40 @@ const q = (f) => {
68
71
  ),
69
72
  n[t.slug] && m(t.slug)
70
73
  ] }),
71
- !s && /* @__PURE__ */ o("a", { href: j.replaceLink(t.link, C), className: "link", children: a(d) })
74
+ !s && /* @__PURE__ */ o("a", { href: N.replaceLink(t.link, C), className: "link", children: a(d) })
72
75
  ] })
73
76
  ] })
74
77
  ] })) });
75
78
  }, K = (f) => {
76
- const [c, w] = I(Math.random() * 99998 + 1), { locale: s } = V(), {
77
- "data-width": y,
79
+ const [c, w] = x(Math.random() * 99998 + 1), { locale: s } = V(), {
80
+ "data-width": P,
78
81
  "data-height": C,
79
82
  "data-type": d,
80
- "data-taxonomy": P,
83
+ "data-taxonomy": b,
81
84
  "data-categories": n,
82
- "data-items": b,
85
+ "data-items": p,
83
86
  "data-color": l,
84
87
  "data-show-post-icons": a,
85
88
  "data-show-content-toggle": h,
86
89
  "data-content-toggle-h-position": m,
87
90
  //horizontal position
88
91
  "data-read-more-label": g,
89
- "data-read-less-label": p,
92
+ "data-read-less-label": y,
90
93
  parent: t,
91
94
  editing: e,
92
95
  component: r,
93
- unique: L
96
+ unique: I
94
97
  } = f;
95
98
  return /* @__PURE__ */ o(u, { fluid: !0, children: /* @__PURE__ */ o(
96
99
  _,
97
100
  {
98
101
  type: d,
99
102
  locale: s,
100
- taxonomy: P,
103
+ taxonomy: b,
101
104
  categories: n,
102
- store: "inline_list_" + t + "_" + L,
105
+ store: "inline_list_" + t + "_" + I,
103
106
  page: 1,
104
- perPage: b,
107
+ perPage: p,
105
108
  children: /* @__PURE__ */ o(S, { children: /* @__PURE__ */ o(
106
109
  q,
107
110
  {
@@ -110,7 +113,7 @@ const q = (f) => {
110
113
  showContentToggle: h === "true",
111
114
  contentToggleHPosition: parseInt(m || "50", 10),
112
115
  readMoreLabel: g,
113
- readLessLabel: p
116
+ readLessLabel: y
114
117
  }
115
118
  ) })
116
119
  }
@@ -2,21 +2,15 @@ import { jsx as t, jsxs as f } from "react/jsx-runtime";
2
2
  import { useState as u, useEffect as m } from "react";
3
3
  import { useParams as d, useLocation as g, Navigate as s, Outlet as h } from "react-router";
4
4
  import { getComponentByNameIgnoreCase as v } from "../embeddable/index.js";
5
- import { IntlProvider as w } from "react-intl";
6
- import { AppContextProvider as C, SettingProvider as I, SettingsConsumer as L } from "@devgateway/wp-react-lib";
7
- import { Provider as y } from "react-redux";
5
+ import { IntlProvider as C } from "react-intl";
6
+ import { AppContextProvider as w, SettingProvider as I, SettingsConsumer as E } from "@devgateway/wp-react-lib";
7
+ import { Provider as L } from "react-redux";
8
8
  import "semantic-ui-react";
9
9
  import "../utils/AppMedia.js";
10
10
  import "./Footer.js";
11
11
  import "./Header.js";
12
- import { CustomizerWrapper as E } from "./Customizer.js";
13
- import "./Favicon.js";
14
- import "clsx";
15
- import "../utils/semanticUtils.js";
16
- import "./SearchControl.js";
17
- import { Config as P } from "../conf/index.js";
18
- import "./ClassicHeader.js";
19
- import "./FloatingMenuHeader.js";
12
+ import { CustomizerWrapper as P } from "./Customizer.js";
13
+ import { Config as y } from "../conf/index.js";
20
14
  import * as b from "../translations/en.json.js";
21
15
  import * as x from "../translations/fr.json.js";
22
16
  import * as N from "../translations/af.json.js";
@@ -24,16 +18,21 @@ import * as O from "../translations/am.json.js";
24
18
  import { updateIntl as j } from "../lib/react-intl-redux/index.js";
25
19
  import "immutable";
26
20
  import { store as e } from "../redux/store.js";
27
- import { withTracker as k } from "../tracker/withGoogleAnalytics.js";
21
+ import "./Favicon.js";
22
+ import "clsx";
23
+ import "../utils/semanticUtils.js";
24
+ import "./SearchControl.js";
25
+ import "./ClassicHeader.js";
26
+ import "./FloatingMenuHeader.js";
28
27
  const r = {
29
28
  en: b,
30
29
  fr: x,
31
30
  am: O,
32
31
  af: N
33
- }, A = () => {
34
- const a = d(), p = g(), i = P.DEFAULT_LOCALE, [D, c] = u(!1), o = a.lan, l = p.pathname;
32
+ }, Z = () => {
33
+ const a = d(), p = g(), i = y.DEFAULT_LOCALE, [A, l] = u(!1), o = a.lan, c = p.pathname;
35
34
  return m(() => {
36
- c(!0), process.env.NODE_ENV === "development" && (console.log("----------.env-----------"), console.log(process.env), console.log("----------.env-----------")), typeof window < "u" && window.setTimeout(() => {
35
+ l(!0), process.env.NODE_ENV === "development" && (console.log("----------.env-----------"), console.log(process.env), console.log("----------.env-----------")), typeof window < "u" && window.setTimeout(() => {
37
36
  if (window.location.hash) {
38
37
  const n = document.getElementById(window.location.hash.substring(1));
39
38
  n && n.scrollIntoView({ behavior: "auto", block: "start" });
@@ -41,11 +40,11 @@ const r = {
41
40
  }, 2e3);
42
41
  }, []), m(() => {
43
42
  e.dispatch(j({ locale: o, formats: {}, messages: r[o ?? "en"] }));
44
- }, [o]), o ? Object.keys(r).includes(o) ? /* @__PURE__ */ t(y, { store: e, children: /* @__PURE__ */ t(w, { locale: o, messages: r[o], children: /* @__PURE__ */ t(C, { getComponent: v, store: e, locale: o, children: /* @__PURE__ */ t(I, { locale: o, changeUUID: null, children: /* @__PURE__ */ f(L, { children: [
45
- /* @__PURE__ */ t(E, {}),
43
+ }, [o]), o ? Object.keys(r).includes(o) ? /* @__PURE__ */ t(L, { store: e, children: /* @__PURE__ */ t(C, { locale: o, messages: r[o], children: /* @__PURE__ */ t(w, { getComponent: v, store: e, locale: o, children: /* @__PURE__ */ t(I, { locale: o, changeUUID: null, children: /* @__PURE__ */ f(E, { children: [
44
+ /* @__PURE__ */ t(P, {}),
46
45
  /* @__PURE__ */ t(h, {})
47
- ] }) }) }) }, o) }) : /* @__PURE__ */ t(s, { to: `/${i}${l}`, replace: !0 }) : /* @__PURE__ */ t(s, { to: i, replace: !0 });
48
- }, eo = k(A);
46
+ ] }) }) }) }, o) }) : /* @__PURE__ */ t(s, { to: `/${i}${c}`, replace: !0 }) : /* @__PURE__ */ t(s, { to: i, replace: !0 });
47
+ };
49
48
  export {
50
- eo as default
49
+ Z as default
51
50
  };
@@ -1,44 +1,42 @@
1
1
  import { jsx as P } from "react/jsx-runtime";
2
- import L, { useRef as f, useEffect as E } from "react";
2
+ import L, { useRef as l, useEffect as C } from "react";
3
3
  import a from "react-ga4";
4
- import { useLocation as k } from "react-router";
5
- import { Config as D } from "../conf/index.js";
6
- import { SettingsContext as O } from "@devgateway/wp-react-lib";
7
- import { isInternalTrafficEnabled as C } from "./internalTrafficUtils.js";
8
- const G = /* @__PURE__ */ new Set();
9
- let c = !1;
10
- const M = (l) => {
11
- const m = (T) => {
12
- var _;
13
- const s = L.useContext(O) ?? {}, e = ((_ = s == null ? void 0 : s.data) == null ? void 0 : _.google_analytics_code) ?? D.GA_CODE, i = k(), u = f(null), d = f(!1), p = f(!1);
14
- if (typeof window < "u" && !c && e && e !== "#REACT_APP_GA_CODE#") {
15
- if (!G.has(e))
4
+ import { useLocation as b } from "react-router";
5
+ import { Config as k } from "../conf/index.js";
6
+ import { SettingsContext as x } from "@devgateway/wp-react-lib";
7
+ import { isInternalTrafficEnabled as O } from "./internalTrafficUtils.js";
8
+ const y = /* @__PURE__ */ new Set();
9
+ let s = !1;
10
+ const M = (d) => {
11
+ const m = (G) => {
12
+ var p;
13
+ const u = L.useContext(x) ?? {}, e = ((p = u == null ? void 0 : u.data) == null ? void 0 : p.google_analytics_code) ?? k.GA_CODE, i = b(), w = l(null), f = l(!1), g = l(!1), o = l(!1);
14
+ if (typeof window < "u" && !o.current && (o.current = O(), o.current && console.log("[GA] Internal traffic detected — GA will NOT be initialized and no events will be sent.")), typeof window < "u" && !o.current && !s && e && e !== "#REACT_APP_GA_CODE#") {
15
+ if (!y.has(e))
16
16
  try {
17
- a.initialize(e), G.add(e), console.log("GA initialized with code:", e);
17
+ a.initialize(e), y.add(e), console.log("GA initialized with code:", e);
18
18
  } catch (t) {
19
19
  console.error("Failed to initialize GA:", t);
20
20
  }
21
- c = !0;
21
+ s = !0;
22
22
  }
23
- return E(() => {
24
- if (typeof window > "u" || !e || e === "#REACT_APP_GA_CODE#" || !c) return;
23
+ return C(() => {
24
+ if (typeof window > "u" || o.current || !e || e === "#REACT_APP_GA_CODE#" || !s) return;
25
25
  const t = i.pathname;
26
- if (u.current !== t) {
27
- u.current = t, d.current = !1;
26
+ if (w.current !== t) {
27
+ w.current = t, f.current = !1;
28
28
  try {
29
- const r = C() ? "internal" : "external";
30
29
  a.event("page_view", {
31
- page_path: t,
32
- traffic_type: r
33
- }), console.log("GA pageview sent:", { page: t, traffic_type: r });
34
- } catch (r) {
35
- console.error("Failed to send pageview:", r);
30
+ page_path: t
31
+ }), console.log("GA pageview sent:", { page: t });
32
+ } catch (c) {
33
+ console.error("Failed to send pageview:", c);
36
34
  }
37
35
  }
38
- }, [i.pathname, e]), E(() => {
39
- if (typeof window > "u" || !e || e === "#REACT_APP_GA_CODE#" || !c || p.current) return;
40
- const t = C() ? "internal" : "external", r = () => {
41
- if (d.current) return;
36
+ }, [i.pathname, e]), C(() => {
37
+ if (typeof window > "u" || o.current || !e || e === "#REACT_APP_GA_CODE#" || !s || g.current) return;
38
+ const t = () => {
39
+ if (f.current) return;
42
40
  const n = Math.round(
43
41
  window.scrollY / (document.documentElement.scrollHeight - window.innerHeight) * 100
44
42
  );
@@ -46,44 +44,41 @@ const M = (l) => {
46
44
  try {
47
45
  a.event("scroll", {
48
46
  engagement_type: "scroll",
49
- scroll_depth: n,
50
- traffic_type: t
51
- }), console.log("GA scroll event sent:", { scrollPercentage: n, traffic_type: t }), d.current = !0;
52
- } catch (o) {
53
- console.error("Failed to send scroll event:", o);
47
+ scroll_depth: n
48
+ }), console.log("GA scroll event sent:", { scrollPercentage: n }), f.current = !0;
49
+ } catch (r) {
50
+ console.error("Failed to send scroll event:", r);
54
51
  }
55
- }, g = (n) => {
56
- var A;
57
- const o = n.target, h = ((A = o.textContent) == null ? void 0 : A.substring(0, 50)) || "", v = o.id || "", y = o.className || "";
58
- if (!(!h && !v && !y))
52
+ }, c = (n) => {
53
+ var E;
54
+ const r = n.target, h = ((E = r.textContent) == null ? void 0 : E.substring(0, 50)) || "", v = r.id || "", A = r.className || "";
55
+ if (!(!h && !v && !A))
59
56
  try {
60
57
  a.event("element_click", {
61
58
  element_id: v,
62
- element_class: y,
63
- element_text: h.substring(0, 50),
64
- traffic_type: t
59
+ element_class: A,
60
+ element_text: h.substring(0, 50)
65
61
  });
66
62
  } catch {
67
63
  }
68
- }, x = Date.now(), w = () => {
69
- const n = Math.round((Date.now() - x) / 1e3);
64
+ }, T = Date.now(), _ = () => {
65
+ const n = Math.round((Date.now() - T) / 1e3);
70
66
  if (n > 3)
71
67
  try {
72
68
  a.event("time_on_page", {
73
69
  page_path: i.pathname,
74
- duration_seconds: n,
75
- traffic_type: t
70
+ duration_seconds: n
76
71
  }), console.log("GA time_on_page event sent:", { timeOnPage: n, path: i.pathname });
77
- } catch (o) {
78
- console.error("Failed to send time_on_page event:", o);
72
+ } catch (r) {
73
+ console.error("Failed to send time_on_page event:", r);
79
74
  }
80
75
  };
81
- return window.addEventListener("scroll", r, { passive: !0 }), document.addEventListener("click", g), window.addEventListener("beforeunload", w), p.current = !0, () => {
82
- window.removeEventListener("scroll", r), document.removeEventListener("click", g), window.removeEventListener("beforeunload", w);
76
+ return window.addEventListener("scroll", t, { passive: !0 }), document.addEventListener("click", c), window.addEventListener("beforeunload", _), g.current = !0, () => {
77
+ window.removeEventListener("scroll", t), document.removeEventListener("click", c), window.removeEventListener("beforeunload", _);
83
78
  };
84
- }, [i.pathname, e]), /* @__PURE__ */ P(l, { ...T });
79
+ }, [i.pathname, e]), /* @__PURE__ */ P(d, { ...G });
85
80
  };
86
- return m.displayName = `withTracker(${l.displayName || l.name || "Component"})`, m;
81
+ return m.displayName = `withTracker(${d.displayName || d.name || "Component"})`, m;
87
82
  };
88
83
  export {
89
84
  M as withTracker
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.6.17",
3
+ "version": "1.6.19",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",