@devgateway/dvz-ui-react 1.8.6 → 1.8.8
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/dist/cjs/conf/index.js +1 -1
- package/dist/cjs/embeddable/filtered-posts/index.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/tracker/InternalTrafficToggle.js +1 -1
- package/dist/cjs/tracker/InternalTrafficWatermark.js +1 -0
- package/dist/cjs/tracker/index.js +1 -1
- package/dist/cjs/tracker/internalTrafficUtils.js +1 -1
- package/dist/cjs/tracker/useInternalTrafficBypass.js +1 -0
- package/dist/esm/conf/index.js +1 -2
- package/dist/esm/embeddable/filtered-posts/index.js +97 -97
- package/dist/esm/index.js +76 -73
- package/dist/esm/tracker/InternalTrafficToggle.js +21 -73
- package/dist/esm/tracker/InternalTrafficWatermark.js +67 -0
- package/dist/esm/tracker/index.js +11 -8
- package/dist/esm/tracker/internalTrafficUtils.js +9 -10
- package/dist/esm/tracker/useInternalTrafficBypass.js +34 -0
- package/dist/types/conf/index.d.ts +0 -1
- package/dist/types/tracker/InternalTrafficToggle.d.ts +0 -1
- package/dist/types/tracker/InternalTrafficWatermark.d.ts +13 -0
- package/dist/types/tracker/index.d.ts +2 -0
- package/dist/types/tracker/internalTrafficUtils.d.ts +0 -7
- package/dist/types/tracker/useInternalTrafficBypass.d.ts +13 -0
- package/package.json +1 -1
package/dist/cjs/conf/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _={REACT_APP_WP_API:process.env.VITE_REACT_APP_WP_API??"/wp/wp-json",REACT_APP_API_ROOT:process.env.VITE_REACT_APP_API_ROOT??null,GA_CODE:process.env.VITE_REACT_APP_GA_CODE??"",DEFAULT_LOCALE:process.env.VITE_REACT_APP_DEFAULT_LOCALE??"en"
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _={REACT_APP_WP_API:process.env.VITE_REACT_APP_WP_API??"/wp/wp-json",REACT_APP_API_ROOT:process.env.VITE_REACT_APP_API_ROOT??null,GA_CODE:process.env.VITE_REACT_APP_GA_CODE??"",DEFAULT_LOCALE:process.env.VITE_REACT_APP_DEFAULT_LOCALE??"en"};exports.Config=_;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),y=require("react"),g=require("semantic-ui-react"),ie=require("../connected-templates/PostIntro.js"),le=require("./FilteredPostsIntro.js"),Y=require("react-intl"),ue=require("./NoData.js"),V=require("react-redux"),ce=require("../reducers/data-api.js"),W=require("../../utils/data.js"),de=x=>{const{posts:u,numberOfColumns:C,sortFirstBy:c,countryCategory:s,postWidth:N,postHeight:O,locale:j}=x,m=[];if(s&&c&&c!=="none"){const i=u.filter(f=>f[s].includes(Number(c))),F=u.filter(f=>!f[s].includes(Number(c)));m.push(...i),m.push(...F)}else m.push(...u);const v=x.wordpressSourceType==="internal"||!x.wordpressSourceType;return n.jsx(g.Grid,{className:"filtered-posts",columns:C,children:n.jsx(g.GridRow,{children:m.map(i=>n.jsx(g.Grid.Column,{children:n.jsx("div",{className:"filtered-posts-column",style:{width:N,height:O,overflow:"hidden"},children:v?n.jsx(ie.default,{style:{width:"100%",height:"100%",overflow:"hidden",margin:0,padding:0},as:g.Container,fluid:!0,post:i},i.id):n.jsx(le.default,{style:{width:"100%",height:"100%",overflow:"hidden",margin:0,padding:0},as:g.Container,fluid:!0,post:i,locale:j},i.id)})},i.id))})})},ye=x=>{const{"data-group":u,"data-number-of-columns":C,"data-type":c,"data-taxonomy":s,"data-categories":N="[]","data-height":O,"data-post-width":j,"data-post-height":m,"data-number-of-items-per-page":v,"data-enable-sorting":i,"data-sort-first-by":F,"data-sorting-taxonomy":f,"data-wordpress-source-type":k,"data-wordpress-source":_,"data-no-data-msg":J,"data-clear-filter-msg":L,editing:U}=x,$=V.useDispatch(),{locale:B}=Y.useIntl(),[M,T]=y.useState(!1),P=y.useRef(0),z=V.useSelector(e=>e).getIn(["data","posts",u]),[E,S]=y.useState([]),I=y.useRef(null),[A,G]=y.useState(void 0),K=W.toBoolean(i)&&F!=="none"?W.toNumber(F):null,p=z??{yearFilter:null,categoryFilter:null,countryFilter:null,page:1,countryTaxonomy:null,categoryTaxonomy:null},w=e=>{if(e==null)return{values:[],isExplicitNone:!1};const t=Array.isArray(e)?e:[e],o=t.some(r=>Number(r)===Number.MIN_SAFE_INTEGER);return{values:t.map(r=>Number(r)).filter(r=>Number.isFinite(r)&&r!==Number.MIN_SAFE_INTEGER),isExplicitNone:o}},Q=e=>{if(!e||e.length===0)return null;const t=Array.from(new Set(e)).map(o=>Number(o)).filter(o=>Number.isFinite(o)&&o>0).sort((o,a)=>o-a);return t.length>0?t:null},X=()=>{const e=w(p.yearFilter),t=e.isExplicitNone?null:Q(e.values),o=p.countryFilter??null,a=p.categoryFilter??null,r=p.categoryTaxonomy||(s&&s!=="none"?s:null),d=p.countryTaxonomy||null;return{years:t,categoryFilter:a,categoryTaxonomy:r,countryFilter:o,countryTaxonomy:d}},D=e=>U?e:decodeURIComponent(e),Z=e=>{try{return JSON.parse(D(e))}catch(t){return console.warn("JSON parsing failed for value:",e,"- treating as plain string. Error:",t),D(e)}},ee=()=>{const e=Z(N);return e?typeof e=="string"?e.split(",").map(Number):typeof e=="number"?[e]:e:[]},te=(e,t,o)=>{if(o)return null;if(e.length===0)return t.length>0?t:null;if(t.length===0)return e;const a=new Set(e),r=t.filter(d=>a.has(d));return r.length>0?r:null},re=async()=>{const e=++P.current;I.current&&G(I.current.offsetHeight),T(!0);const t=X(),o=w(ee()).values,a=w(t.categoryFilter),r=te(o,a.values,a.isExplicitNone),d=w(t.countryFilter);if(a.isExplicitNone){S([]),T(!1);return}if(d.isExplicitNone){S([]),T(!1);return}const R=t.categoryTaxonomy&&t.categoryTaxonomy!=="none"?t.categoryTaxonomy:null,oe=R||(s&&s!=="none"?s:null)||void 0,q=new Map;R&&r&&r.length>0&&q.set(R,r),t.countryTaxonomy&&d.values.length>0&&q.set(t.countryTaxonomy,d.values);const ne=r?r.join(","):void 0,se={years:t.years||void 0,after:void 0,before:void 0,perPage:Number(v||10),page:p.page||1,locale:B||"en",postType:c,taxonomy:oe,category:ne||void 0,taxonomyFilters:q,ordering:"date",orderingDirection:"desc",wpApiBase:_??void 0};await ce.getCustomPosts(se).then(l=>{if(e===P.current)if(l){let b=null,h=null;if(l&&typeof l=="object"&&"data"in l?(b=l.data,h=l.meta):(Array.isArray(l),b=l),S(Array.isArray(b)?b:[]),h){const H=h["x-wp-totalpages"]?h["x-wp-totalpages"]:1,ae=h["x-wp-total"]?h["x-wp-total"]:0;H&&$({type:"SET_POSTS_PAGINATION",group:u,totalPages:Number(H),totalItems:Number(ae)})}}else S([])}).finally(()=>{e===P.current&&(T(!1),G(void 0))})};return y.useEffect(()=>{c&&(async()=>await re())()},[z,c,s,v,N,f]),n.jsx("div",{ref:I,id:`filtered-posts-${u}`,style:A!==void 0?{minHeight:A,border:"1px solid #e0e0e0",borderRadius:"4px"}:void 0,children:n.jsx(g.Container,{fluid:!0,children:M?n.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:A??"100%"},children:n.jsx(g.Loader,{active:!0,inline:"centered"})}):!M&&E&&E.length>0?n.jsx(de,{posts:E,postWidth:Number(j),postHeight:Number(m),numberOfColumns:Number(C),sortFirstBy:K,countryCategory:f,wordpressSourceType:k,wordpressSource:_,locale:B}):n.jsx(ue.default,{noDataMsg:J,clearFilterMsg:L,group:u})})})},ge=Y.injectIntl(y.memo(ye));exports.default=ge;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./embeddable/index.js"),c=require("./conf/index.js"),l=require("./layout/ResponsiveContainer.js"),d=require("./layout/ScrollTop.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./embeddable/index.js"),c=require("./conf/index.js"),l=require("./layout/ResponsiveContainer.js"),d=require("./layout/ScrollTop.js"),f=require("./layout/containers/PreviewPageContainer.js"),p=require("./layout/containers/PreviewTypeContainer.js"),m=require("./layout/containers/SlugContainer.js"),q=require("./layout/containers/SlugPostContainer.js"),C=require("./layout/Customizer.js"),T=require("./layout/Layout.js"),g=require("./layout/PreviewComponent.js"),P=require("./layout/Favicon.js"),S=require("./layout/SSRFavicon.js"),I=require("./layout/Loading.js"),h=require("./layout/CustomSemanticSearch.js"),y=require("./layout/Header.js"),v=require("./layout/SearchControl.js"),x=require("./layout/LangSwitcher.js"),A=require("./layout/Footer.js"),H=require("./layout/ClassicHeader.js"),D=require("./layout/FlexWrapDetector.js"),w=require("./layout/FloatingMenuHeader.js"),R=require("./tracker/withGoogleAnalytics.js"),o=require("./tracker/internalTrafficUtils.js"),k=require("./tracker/InternalTrafficToggle.js"),E=require("./tracker/InternalTrafficWatermark.js"),F=require("./tracker/useInternalTrafficBypass.js"),M=require("./redux/store.js"),u=require("./redux/hooks.js"),n=require("./lib/react-intl-redux/index.js"),O=require("./lib/redux-immutable/index.js"),U=require("./translations/en.json.js"),b=require("./translations/fr.json.js"),L=require("./translations/af.json.js"),N=require("./translations/am.json.js"),B=require("./countries.js"),r=require("./utils/data.js"),a=require("./utils/AppMedia.js"),e=require("./utils/semanticUtils.js"),W=require("./embeddable/data/DataConsumer.js"),z=require("./embeddable/data/DataProvider.js"),i=require("./embeddable/data/DataContext.js");require("react/jsx-runtime");require("react");require("./embeddable/data/CategoriesProvider.js");const s=require("./embeddable/utils/parseUtils.js"),K=require("./embeddable/reducers/data.js"),$=require("./lib/react-intl-redux/providers/Provider.js"),J=require("./lib/react-intl-redux/providers/IntlProvider.js");exports.components=t.components;exports.customizer=t.customizer;exports.getComponentByNameIgnoreCase=t.getComponentByNameIgnoreCase;exports.reducers=t.reducers;exports.Config=c.Config;exports.ResponsiveContainer=l.default;exports.ScrollToTop=d.default;exports.PreviewPageContainer=f.default;exports.PreviewTypeContainer=p.default;exports.SlugContainer=m.default;exports.SlugPostContainer=q.default;exports.CustomizerWrapper=C.CustomizerWrapper;exports.RootLayout=T.default;exports.PreviewComponent=g.default;exports.Favicon=P.default;exports.SSRFavicon=S.default;exports.Loading=I.default;exports.CustomSemanticSearch=h.default;exports.Header=y.default;exports.SearchControl=v.default;exports.LangSwitcher=x.default;exports.Footer=A.default;exports.ClassicHeader=H.default;exports.FlexWrapDetector=D.default;exports.FloatingMenuHeader=w.default;exports.withTracker=R.withTracker;exports.clearInternalTrafficCookie=o.clearInternalTrafficCookie;exports.isInternalTrafficEnabled=o.isInternalTrafficEnabled;exports.setInternalTrafficCookie=o.setInternalTrafficCookie;exports.InternalTrafficToggle=k.default;exports.InternalTrafficWatermark=E.default;exports.useInternalTrafficBypass=F.useInternalTrafficBypass;exports.store=M.store;exports.useAppDispatch=u.useAppDispatch;exports.useAppSelector=u.useAppSelector;exports.UPDATE=n.UPDATE;exports.initialState=n.initialState;exports.intlReducer=n.intlReducer;exports.updateIntl=n.updateIntl;exports.combineReducers=O.combineReducers;exports.englishTranslations=U;exports.frenchTranslations=b;exports.afrikaansTranslations=L;exports.amharicTranslations=N;exports.COUNTRY_OPTIONS=B.COUNTRY_OPTIONS;exports.decodeHtmlEntitiesToHtml=r.decodeHtmlEntitiesToHtml;exports.decodeHtmlEntitiesToText=r.decodeHtmlEntitiesToText;exports.stringToArray=r.stringToArray;exports.toBoolean=r.toBoolean;exports.toNumber=r.toNumber;exports.uriStringToArray=r.uriStringToArray;exports.Media=a.Media;exports.MediaContextProvider=a.MediaContextProvider;exports.mediaStyle=a.mediaStyle;exports.getUnhandledProps=e.getUnhandledProps;exports.htmlImageProps=e.htmlImageProps;exports.htmlInputAttrs=e.htmlInputAttrs;exports.htmlInputEvents=e.htmlInputEvents;exports.htmlInputProps=e.htmlInputProps;exports.partitionHTMLProps=e.partitionHTMLProps;exports.useKeyOnly=e.useKeyOnly;exports.useValueAndKey=e.useValueAndKey;exports.DataConsumer=W.default;exports.DataProvider=z.default;exports.CategoriesContext=i.CategoriesContext;exports.DataContext=i.DataContext;exports.PostsContext=i.PostsContext;exports.compareJsonProps=s.compareJsonProps;exports.decode=s.decode;exports.parse=s.parse;exports.reducer=K;exports.Provider=$.default;exports.IntlProvider=J.default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),r=require("semantic-ui-react"),o=require("./useInternalTrafficBypass.js"),u=({redirectTo:n="/"})=>{const{status:e,message:c}=o.useInternalTrafficBypass(n),t=e==="success"?"Success":e==="error"?"Error":"Processing",i=e==="success"?"green":e==="error"?"red":"blue",a=e==="success"?"check circle":e==="error"?"warning sign":"spinner";return s.jsxs(r.Container,{as:"div",children:[s.jsxs(r.Segment,{textAlign:"center",basic:!0,vertical:!0,children:[s.jsx(r.Header,{as:"h1",content:t}),e==="success"&&s.jsx(r.Message,{size:"small",content:"Redirecting to home page in 3 seconds..."})]}),s.jsx(r.Segment,{vertical:!0,children:s.jsx(r.Message,{size:"large",icon:a,color:i,content:c})})]})};exports.default=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),t=require("react"),i=require("semantic-ui-react"),d=require("./internalTrafficUtils.js"),M=()=>{const[f,r]=t.useState(!1),[g,x]=t.useState(!1),[n,a]=t.useState({x:-20,y:-20}),[o,l]=t.useState(!1),[u,p]=t.useState({x:0,y:0});t.useEffect(()=>{if(typeof document>"u")return;x(!0),r(d.isInternalTrafficEnabled()),typeof window<"u"&&a({x:window.innerWidth-200,y:window.innerHeight-40});const e=()=>{r(d.isInternalTrafficEnabled())};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[]);const y=e=>{l(!0),p({x:e.clientX-n.x,y:e.clientY-n.y})},b=e=>{o&&a({x:e.clientX-u.x,y:e.clientY-u.y})},c=()=>{l(!1)};if(!g||!f)return null;const w={position:"fixed",left:`${n.x}px`,top:`${n.y}px`,zIndex:999999,willChange:o?"transform":"auto",cursor:o?"grabbing":"grab"};return s.jsx("div",{style:w,onMouseDown:y,onMouseMove:b,onMouseUp:c,onMouseLeave:c,role:"status","aria-label":"GA bypass enabled. Drag to move this notification.",children:s.jsx(i.Popup,{content:"Drag to move",position:"left center",trigger:s.jsxs(i.Label,{color:"yellow",image:!0,children:[s.jsx(i.Icon,{name:"spinner",loading:!0,color:"red"}),"GA Bypass Enabled"]})})})};exports.default=M;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./withGoogleAnalytics.js"),e=require("./internalTrafficUtils.js"),a=require("./InternalTrafficToggle.js");exports.withTracker=r.withTracker;exports.clearInternalTrafficCookie=e.clearInternalTrafficCookie;exports.isInternalTrafficEnabled=e.isInternalTrafficEnabled;exports.setInternalTrafficCookie=e.setInternalTrafficCookie;exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./withGoogleAnalytics.js"),e=require("./internalTrafficUtils.js"),a=require("./InternalTrafficToggle.js"),n=require("./InternalTrafficWatermark.js"),t=require("./useInternalTrafficBypass.js");exports.withTracker=r.withTracker;exports.clearInternalTrafficCookie=e.clearInternalTrafficCookie;exports.isInternalTrafficEnabled=e.isInternalTrafficEnabled;exports.setInternalTrafficCookie=e.setInternalTrafficCookie;exports.InternalTrafficToggle=a.default;exports.InternalTrafficWatermark=n.default;exports.useInternalTrafficBypass=t.useInternalTrafficBypass;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t="_ga_internal_traffic",c=365*24*60*60,i=e=>{if(typeof document>"u")return;const o=e?"1":"0",n="/";document.cookie=`${t}=${o}; max-age=${c}; path=${n}; SameSite=Lax`,console.log(`Internal traffic cookie ${e?"enabled":"disabled"}`)},r=()=>{if(typeof document>"u")return!1;const e=document.cookie.split(";");for(const o of e){const[n,a]=o.trim().split("=");if(n===t)return a==="1"}return!1},f=()=>{typeof document>"u"||(document.cookie=`${t}=; max-age=0; path=/; SameSite=Lax`,console.log("Internal traffic cookie cleared"))};exports.clearInternalTrafficCookie=f;exports.isInternalTrafficEnabled=r;exports.setInternalTrafficCookie=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),l=require("react-router"),m=require("./internalTrafficUtils.js"),d=e=>e instanceof Error?`Error: ${e.message}`:"Error: Unknown error",k=(e="/")=>{const i=l.useNavigate(),[n]=l.useSearchParams(),[u,r]=c.useState("validating"),[g,s]=c.useState("Processing...");return c.useEffect(()=>{const t=n.get("enable");if(!n.get("k")){r("error"),s("Missing token parameter. Use ?k=your_token"),console.error("Missing token parameter");return}if(!t){r("error"),s("Missing enable parameter. Use ?enable=0 or ?enable=1"),console.error("Missing enable parameter");return}if(t!=="0"&&t!=="1"){r("error"),s("Invalid enable parameter. Use ?enable=0 or ?enable=1"),console.error("Invalid enable parameter:",t);return}const o=t==="1",f=o?"✓ Internal traffic enabled. GA4 events will be tagged as internal.":"✓ Internal traffic disabled. GA4 events will be tagged as external.",b=`Internal traffic ${o?"enabled":"disabled"} successfully`;try{m.setInternalTrafficCookie(o),r("success"),s(f),console.log(b);const a=setTimeout(()=>{i(e)},3e3);return()=>clearTimeout(a)}catch(a){r("error"),s(d(a)),console.error("Error setting internal traffic cookie:",a)}},[n,i,e]),{status:u,message:g}};exports.useInternalTrafficBypass=k;
|
package/dist/esm/conf/index.js
CHANGED
|
@@ -2,8 +2,7 @@ const _ = {
|
|
|
2
2
|
REACT_APP_WP_API: process.env.VITE_REACT_APP_WP_API ?? "/wp/wp-json",
|
|
3
3
|
REACT_APP_API_ROOT: process.env.VITE_REACT_APP_API_ROOT ?? null,
|
|
4
4
|
GA_CODE: process.env.VITE_REACT_APP_GA_CODE ?? "",
|
|
5
|
-
DEFAULT_LOCALE: process.env.VITE_REACT_APP_DEFAULT_LOCALE ?? "en"
|
|
6
|
-
INTERNAL_GA_TOKEN: process.env.VITE_INTERNAL_GA_TOKEN ?? ""
|
|
5
|
+
DEFAULT_LOCALE: process.env.VITE_REACT_APP_DEFAULT_LOCALE ?? "en"
|
|
7
6
|
};
|
|
8
7
|
export {
|
|
9
8
|
_ as Config
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { Container as O, Loader as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { injectIntl as
|
|
7
|
-
import
|
|
8
|
-
import { useDispatch as gt, useSelector as
|
|
9
|
-
import { getCustomPosts as
|
|
10
|
-
import { toNumber as
|
|
11
|
-
const
|
|
12
|
-
const { posts:
|
|
13
|
-
if (
|
|
14
|
-
const
|
|
15
|
-
m.push(...
|
|
2
|
+
import it, { useState as B, useRef as q, useEffect as at } from "react";
|
|
3
|
+
import { Container as O, Loader as lt, Grid as W, GridRow as ct } from "semantic-ui-react";
|
|
4
|
+
import ut from "../connected-templates/PostIntro.js";
|
|
5
|
+
import dt from "./FilteredPostsIntro.js";
|
|
6
|
+
import { injectIntl as mt, useIntl as yt } from "react-intl";
|
|
7
|
+
import ft from "./NoData.js";
|
|
8
|
+
import { useDispatch as gt, useSelector as pt } from "react-redux";
|
|
9
|
+
import { getCustomPosts as ht } from "../reducers/data-api.js";
|
|
10
|
+
import { toNumber as xt, toBoolean as bt } from "../../utils/data.js";
|
|
11
|
+
const Nt = (p) => {
|
|
12
|
+
const { posts: c, numberOfColumns: w, sortFirstBy: u, countryCategory: s, postWidth: x, postHeight: z, locale: S } = p, m = [];
|
|
13
|
+
if (s && u && u !== "none") {
|
|
14
|
+
const a = c.filter((y) => y[s].includes(Number(u))), N = c.filter((y) => !y[s].includes(Number(u)));
|
|
15
|
+
m.push(...a), m.push(...N);
|
|
16
16
|
} else
|
|
17
|
-
m.push(...
|
|
18
|
-
const
|
|
19
|
-
return /* @__PURE__ */ n(
|
|
20
|
-
|
|
17
|
+
m.push(...c);
|
|
18
|
+
const b = p.wordpressSourceType === "internal" || !p.wordpressSourceType;
|
|
19
|
+
return /* @__PURE__ */ n(W, { className: "filtered-posts", columns: w, children: /* @__PURE__ */ n(ct, { children: m.map((a) => /* @__PURE__ */ n(W.Column, { children: /* @__PURE__ */ n("div", { className: "filtered-posts-column", style: { width: x, height: z, overflow: "hidden" }, children: b ? /* @__PURE__ */ n(
|
|
20
|
+
ut,
|
|
21
21
|
{
|
|
22
22
|
style: {
|
|
23
23
|
width: "100%",
|
|
@@ -28,11 +28,11 @@ const bt = (p) => {
|
|
|
28
28
|
},
|
|
29
29
|
as: O,
|
|
30
30
|
fluid: !0,
|
|
31
|
-
post:
|
|
31
|
+
post: a
|
|
32
32
|
},
|
|
33
|
-
|
|
33
|
+
a.id
|
|
34
34
|
) : /* @__PURE__ */ n(
|
|
35
|
-
|
|
35
|
+
dt,
|
|
36
36
|
{
|
|
37
37
|
style: {
|
|
38
38
|
width: "100%",
|
|
@@ -43,145 +43,145 @@ const bt = (p) => {
|
|
|
43
43
|
},
|
|
44
44
|
as: O,
|
|
45
45
|
fluid: !0,
|
|
46
|
-
post:
|
|
47
|
-
locale:
|
|
46
|
+
post: a,
|
|
47
|
+
locale: S
|
|
48
48
|
},
|
|
49
|
-
|
|
50
|
-
) }) },
|
|
51
|
-
},
|
|
49
|
+
a.id
|
|
50
|
+
) }) }, a.id)) }) });
|
|
51
|
+
}, vt = (p) => {
|
|
52
52
|
const {
|
|
53
|
-
"data-group":
|
|
54
|
-
"data-number-of-columns":
|
|
53
|
+
"data-group": c,
|
|
54
|
+
"data-number-of-columns": w,
|
|
55
55
|
"data-type": u,
|
|
56
|
-
"data-taxonomy":
|
|
57
|
-
"data-categories":
|
|
58
|
-
"data-height":
|
|
59
|
-
"data-post-width":
|
|
56
|
+
"data-taxonomy": s,
|
|
57
|
+
"data-categories": x = "[]",
|
|
58
|
+
"data-height": z,
|
|
59
|
+
"data-post-width": S,
|
|
60
60
|
"data-post-height": m,
|
|
61
|
-
"data-number-of-items-per-page":
|
|
62
|
-
"data-enable-sorting":
|
|
61
|
+
"data-number-of-items-per-page": b,
|
|
62
|
+
"data-enable-sorting": a,
|
|
63
63
|
"data-sort-first-by": N,
|
|
64
|
-
"data-sorting-taxonomy":
|
|
65
|
-
"data-wordpress-source-type":
|
|
66
|
-
"data-wordpress-source":
|
|
67
|
-
"data-no-data-msg":
|
|
64
|
+
"data-sorting-taxonomy": y,
|
|
65
|
+
"data-wordpress-source-type": Y,
|
|
66
|
+
"data-wordpress-source": _,
|
|
67
|
+
"data-no-data-msg": k,
|
|
68
68
|
"data-clear-filter-msg": J,
|
|
69
69
|
editing: L
|
|
70
|
-
} = p, U = gt(), { locale: D } =
|
|
70
|
+
} = p, U = gt(), { locale: D } = yt(), [G, v] = B(!1), C = q(0), H = pt((t) => t).getIn(["data", "posts", c]), [P, F] = B([]), E = q(null), [I, M] = B(void 0), $ = bt(a) && N !== "none" ? xt(N) : null, f = H ?? {
|
|
71
71
|
yearFilter: null,
|
|
72
72
|
categoryFilter: null,
|
|
73
73
|
countryFilter: null,
|
|
74
74
|
page: 1,
|
|
75
75
|
countryTaxonomy: null,
|
|
76
76
|
categoryTaxonomy: null
|
|
77
|
-
},
|
|
77
|
+
}, T = (t) => {
|
|
78
78
|
if (t == null)
|
|
79
79
|
return { values: [], isExplicitNone: !1 };
|
|
80
|
-
const e = Array.isArray(t) ? t : [t],
|
|
81
|
-
(
|
|
80
|
+
const e = Array.isArray(t) ? t : [t], r = e.some(
|
|
81
|
+
(o) => Number(o) === Number.MIN_SAFE_INTEGER
|
|
82
82
|
);
|
|
83
83
|
return {
|
|
84
|
-
values: e.map((
|
|
85
|
-
isExplicitNone:
|
|
84
|
+
values: e.map((o) => Number(o)).filter((o) => Number.isFinite(o) && o !== Number.MIN_SAFE_INTEGER),
|
|
85
|
+
isExplicitNone: r
|
|
86
86
|
};
|
|
87
|
-
},
|
|
87
|
+
}, K = (t) => {
|
|
88
88
|
if (!t || t.length === 0)
|
|
89
89
|
return null;
|
|
90
|
-
const e = Array.from(new Set(t)).map((
|
|
90
|
+
const e = Array.from(new Set(t)).map((r) => Number(r)).filter((r) => Number.isFinite(r) && r > 0).sort((r, i) => r - i);
|
|
91
91
|
return e.length > 0 ? e : null;
|
|
92
|
-
},
|
|
93
|
-
const t =
|
|
92
|
+
}, Q = () => {
|
|
93
|
+
const t = T(f.yearFilter), e = t.isExplicitNone ? null : K(t.values), r = f.countryFilter ?? null, i = f.categoryFilter ?? null, o = f.categoryTaxonomy || (s && s !== "none" ? s : null), d = f.countryTaxonomy || null;
|
|
94
94
|
return {
|
|
95
95
|
years: e,
|
|
96
|
-
categoryFilter:
|
|
97
|
-
categoryTaxonomy:
|
|
98
|
-
countryFilter:
|
|
96
|
+
categoryFilter: i,
|
|
97
|
+
categoryTaxonomy: o,
|
|
98
|
+
countryFilter: r,
|
|
99
99
|
countryTaxonomy: d
|
|
100
100
|
};
|
|
101
|
-
}, V = (t) => L ? t : decodeURIComponent(t),
|
|
101
|
+
}, V = (t) => L ? t : decodeURIComponent(t), X = (t) => {
|
|
102
102
|
try {
|
|
103
103
|
return JSON.parse(V(t));
|
|
104
104
|
} catch (e) {
|
|
105
105
|
return console.warn("JSON parsing failed for value:", t, "- treating as plain string. Error:", e), V(t);
|
|
106
106
|
}
|
|
107
|
-
},
|
|
108
|
-
const t =
|
|
107
|
+
}, Z = () => {
|
|
108
|
+
const t = X(x);
|
|
109
109
|
return t ? typeof t == "string" ? t.split(",").map(Number) : typeof t == "number" ? [t] : t : [];
|
|
110
|
-
},
|
|
111
|
-
if (
|
|
110
|
+
}, tt = (t, e, r) => {
|
|
111
|
+
if (r) return null;
|
|
112
112
|
if (t.length === 0) return e.length > 0 ? e : null;
|
|
113
113
|
if (e.length === 0) return t;
|
|
114
|
-
const
|
|
115
|
-
return
|
|
116
|
-
},
|
|
114
|
+
const i = new Set(t), o = e.filter((d) => i.has(d));
|
|
115
|
+
return o.length > 0 ? o : null;
|
|
116
|
+
}, et = async () => {
|
|
117
117
|
const t = ++C.current;
|
|
118
|
-
E.current && M(E.current.offsetHeight),
|
|
119
|
-
const e =
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
), d =
|
|
124
|
-
if (
|
|
125
|
-
|
|
118
|
+
E.current && M(E.current.offsetHeight), v(!0);
|
|
119
|
+
const e = Q(), r = T(Z()).values, i = T(e.categoryFilter), o = tt(
|
|
120
|
+
r,
|
|
121
|
+
i.values,
|
|
122
|
+
i.isExplicitNone
|
|
123
|
+
), d = T(e.countryFilter);
|
|
124
|
+
if (i.isExplicitNone) {
|
|
125
|
+
F([]), v(!1);
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
if (d.isExplicitNone) {
|
|
129
|
-
|
|
129
|
+
F([]), v(!1);
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
|
-
const A = /* @__PURE__ */ new Map();
|
|
133
|
-
|
|
134
|
-
const
|
|
132
|
+
const A = e.categoryTaxonomy && e.categoryTaxonomy !== "none" ? e.categoryTaxonomy : null, ot = A || (s && s !== "none" ? s : null) || void 0, R = /* @__PURE__ */ new Map();
|
|
133
|
+
A && o && o.length > 0 && R.set(A, o), e.countryTaxonomy && d.values.length > 0 && R.set(e.countryTaxonomy, d.values);
|
|
134
|
+
const rt = o ? o.join(",") : void 0, nt = {
|
|
135
135
|
years: e.years || void 0,
|
|
136
136
|
after: void 0,
|
|
137
137
|
before: void 0,
|
|
138
|
-
perPage: Number(
|
|
138
|
+
perPage: Number(b || 10),
|
|
139
139
|
page: f.page || 1,
|
|
140
140
|
locale: D || "en",
|
|
141
141
|
postType: u,
|
|
142
|
-
taxonomy:
|
|
143
|
-
category:
|
|
144
|
-
taxonomyFilters:
|
|
142
|
+
taxonomy: ot,
|
|
143
|
+
category: rt || void 0,
|
|
144
|
+
taxonomyFilters: R,
|
|
145
145
|
ordering: "date",
|
|
146
146
|
orderingDirection: "desc",
|
|
147
|
-
wpApiBase:
|
|
147
|
+
wpApiBase: _ ?? void 0
|
|
148
148
|
};
|
|
149
|
-
await
|
|
149
|
+
await ht(nt).then((l) => {
|
|
150
150
|
if (t === C.current)
|
|
151
|
-
if (
|
|
152
|
-
let h = null,
|
|
153
|
-
if (
|
|
154
|
-
const j =
|
|
151
|
+
if (l) {
|
|
152
|
+
let h = null, g = null;
|
|
153
|
+
if (l && typeof l == "object" && "data" in l ? (h = l.data, g = l.meta) : (Array.isArray(l), h = l), F(Array.isArray(h) ? h : []), g) {
|
|
154
|
+
const j = g["x-wp-totalpages"] ? g["x-wp-totalpages"] : 1, st = g["x-wp-total"] ? g["x-wp-total"] : 0;
|
|
155
155
|
j && U({
|
|
156
156
|
type: "SET_POSTS_PAGINATION",
|
|
157
|
-
group:
|
|
157
|
+
group: c,
|
|
158
158
|
totalPages: Number(j),
|
|
159
|
-
totalItems: Number(
|
|
159
|
+
totalItems: Number(st)
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
} else
|
|
163
|
-
|
|
163
|
+
F([]);
|
|
164
164
|
}).finally(() => {
|
|
165
|
-
t === C.current && (
|
|
165
|
+
t === C.current && (v(!1), M(void 0));
|
|
166
166
|
});
|
|
167
167
|
};
|
|
168
|
-
return
|
|
169
|
-
u && (async () => await
|
|
170
|
-
}, [H, u,
|
|
171
|
-
|
|
168
|
+
return at(() => {
|
|
169
|
+
u && (async () => await et())();
|
|
170
|
+
}, [H, u, s, b, x, y]), /* @__PURE__ */ n("div", { ref: E, id: `filtered-posts-${c}`, style: I !== void 0 ? { minHeight: I, border: "1px solid #e0e0e0", borderRadius: "4px" } : void 0, children: /* @__PURE__ */ n(O, { fluid: !0, children: G ? /* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", height: I ?? "100%" }, children: /* @__PURE__ */ n(lt, { active: !0, inline: "centered" }) }) : !G && P && P.length > 0 ? /* @__PURE__ */ n(
|
|
171
|
+
Nt,
|
|
172
172
|
{
|
|
173
173
|
posts: P,
|
|
174
|
-
postWidth: Number(
|
|
174
|
+
postWidth: Number(S),
|
|
175
175
|
postHeight: Number(m),
|
|
176
|
-
numberOfColumns: Number(
|
|
176
|
+
numberOfColumns: Number(w),
|
|
177
177
|
sortFirstBy: $,
|
|
178
|
-
countryCategory:
|
|
179
|
-
wordpressSourceType:
|
|
180
|
-
wordpressSource:
|
|
178
|
+
countryCategory: y,
|
|
179
|
+
wordpressSourceType: Y,
|
|
180
|
+
wordpressSource: _,
|
|
181
181
|
locale: D
|
|
182
182
|
}
|
|
183
|
-
) : /* @__PURE__ */ n(
|
|
184
|
-
},
|
|
183
|
+
) : /* @__PURE__ */ n(ft, { noDataMsg: k, clearFilterMsg: J, group: c }) }) });
|
|
184
|
+
}, zt = mt(it.memo(vt));
|
|
185
185
|
export {
|
|
186
|
-
|
|
186
|
+
zt as default
|
|
187
187
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import { components as i, customizer as l, getComponentByNameIgnoreCase as d, re
|
|
|
2
2
|
import { Config as c } from "./conf/index.js";
|
|
3
3
|
import { default as C } from "./layout/ResponsiveContainer.js";
|
|
4
4
|
import { default as P } from "./layout/ScrollTop.js";
|
|
5
|
-
import { default as
|
|
6
|
-
import { default as
|
|
5
|
+
import { default as S } from "./layout/containers/PreviewPageContainer.js";
|
|
6
|
+
import { default as v } from "./layout/containers/PreviewTypeContainer.js";
|
|
7
7
|
import { default as A } from "./layout/containers/SlugContainer.js";
|
|
8
8
|
import { default as D } from "./layout/containers/SlugPostContainer.js";
|
|
9
9
|
import { CustomizerWrapper as k } from "./layout/Customizer.js";
|
|
@@ -11,66 +11,69 @@ import { default as E } from "./layout/Layout.js";
|
|
|
11
11
|
import { default as L } from "./layout/PreviewComponent.js";
|
|
12
12
|
import { default as N } from "./layout/Favicon.js";
|
|
13
13
|
import { default as b } from "./layout/SSRFavicon.js";
|
|
14
|
-
import { default as
|
|
15
|
-
import { default as
|
|
14
|
+
import { default as U } from "./layout/Loading.js";
|
|
15
|
+
import { default as z } from "./layout/CustomSemanticSearch.js";
|
|
16
16
|
import { default as J } from "./layout/Header.js";
|
|
17
17
|
import { default as Y } from "./layout/SearchControl.js";
|
|
18
18
|
import { default as j } from "./layout/LangSwitcher.js";
|
|
19
19
|
import { default as G } from "./layout/Footer.js";
|
|
20
20
|
import { default as X } from "./layout/ClassicHeader.js";
|
|
21
21
|
import { default as $ } from "./layout/FlexWrapDetector.js";
|
|
22
|
-
import { default as
|
|
23
|
-
import { withTracker as
|
|
24
|
-
import { clearInternalTrafficCookie as
|
|
25
|
-
import { default as
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import
|
|
31
|
-
import
|
|
22
|
+
import { default as er } from "./layout/FloatingMenuHeader.js";
|
|
23
|
+
import { withTracker as tr } from "./tracker/withGoogleAnalytics.js";
|
|
24
|
+
import { clearInternalTrafficCookie as fr, isInternalTrafficEnabled as sr, setInternalTrafficCookie as pr } from "./tracker/internalTrafficUtils.js";
|
|
25
|
+
import { default as nr } from "./tracker/InternalTrafficToggle.js";
|
|
26
|
+
import { default as lr } from "./tracker/InternalTrafficWatermark.js";
|
|
27
|
+
import { useInternalTrafficBypass as xr } from "./tracker/useInternalTrafficBypass.js";
|
|
28
|
+
import { store as cr } from "./redux/store.js";
|
|
29
|
+
import { useAppDispatch as Cr, useAppSelector as gr } from "./redux/hooks.js";
|
|
30
|
+
import { UPDATE as Ir, initialState as Sr, intlReducer as hr, updateIntl as vr } from "./lib/react-intl-redux/index.js";
|
|
31
|
+
import { combineReducers as Ar } from "./lib/redux-immutable/index.js";
|
|
32
|
+
import * as r from "./translations/en.json.js";
|
|
33
|
+
import * as e from "./translations/fr.json.js";
|
|
32
34
|
import * as o from "./translations/af.json.js";
|
|
33
35
|
import * as t from "./translations/am.json.js";
|
|
34
|
-
import { COUNTRY_OPTIONS as
|
|
35
|
-
import { decodeHtmlEntitiesToHtml as
|
|
36
|
-
import { Media as
|
|
37
|
-
import { getUnhandledProps as
|
|
38
|
-
import { default as
|
|
39
|
-
import { default as
|
|
40
|
-
import { CategoriesContext as
|
|
36
|
+
import { COUNTRY_OPTIONS as Dr } from "./countries.js";
|
|
37
|
+
import { decodeHtmlEntitiesToHtml as kr, decodeHtmlEntitiesToText as wr, stringToArray as Er, toBoolean as Fr, toNumber as Lr, uriStringToArray as Mr } from "./utils/data.js";
|
|
38
|
+
import { Media as Or, MediaContextProvider as br, mediaStyle as Br } from "./utils/AppMedia.js";
|
|
39
|
+
import { getUnhandledProps as Wr, htmlImageProps as zr, htmlInputAttrs as Kr, htmlInputEvents as Jr, htmlInputProps as Vr, partitionHTMLProps as Yr, useKeyOnly as _r, useValueAndKey as jr } from "./utils/semanticUtils.js";
|
|
40
|
+
import { default as Gr } from "./embeddable/data/DataConsumer.js";
|
|
41
|
+
import { default as Xr } from "./embeddable/data/DataProvider.js";
|
|
42
|
+
import { CategoriesContext as $r, DataContext as re, PostsContext as ee } from "./embeddable/data/DataContext.js";
|
|
41
43
|
import "react/jsx-runtime";
|
|
42
44
|
import "react";
|
|
43
45
|
import "./embeddable/data/CategoriesProvider.js";
|
|
44
|
-
import { compareJsonProps as
|
|
46
|
+
import { compareJsonProps as te, decode as ae, parse as fe } from "./embeddable/utils/parseUtils.js";
|
|
45
47
|
import * as p from "./embeddable/reducers/data.js";
|
|
46
|
-
import { default as
|
|
47
|
-
import { default as
|
|
48
|
+
import { default as pe } from "./lib/react-intl-redux/providers/Provider.js";
|
|
49
|
+
import { default as ne } from "./lib/react-intl-redux/providers/IntlProvider.js";
|
|
48
50
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
Dr as COUNTRY_OPTIONS,
|
|
52
|
+
$r as CategoriesContext,
|
|
51
53
|
X as ClassicHeader,
|
|
52
54
|
c as Config,
|
|
53
|
-
|
|
55
|
+
z as CustomSemanticSearch,
|
|
54
56
|
k as CustomizerWrapper,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
Gr as DataConsumer,
|
|
58
|
+
re as DataContext,
|
|
59
|
+
Xr as DataProvider,
|
|
58
60
|
N as Favicon,
|
|
59
61
|
$ as FlexWrapDetector,
|
|
60
|
-
|
|
62
|
+
er as FloatingMenuHeader,
|
|
61
63
|
G as Footer,
|
|
62
64
|
J as Header,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
nr as InternalTrafficToggle,
|
|
66
|
+
lr as InternalTrafficWatermark,
|
|
67
|
+
ne as IntlProvider,
|
|
65
68
|
j as LangSwitcher,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
U as Loading,
|
|
70
|
+
Or as Media,
|
|
71
|
+
br as MediaContextProvider,
|
|
72
|
+
ee as PostsContext,
|
|
70
73
|
L as PreviewComponent,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
S as PreviewPageContainer,
|
|
75
|
+
v as PreviewTypeContainer,
|
|
76
|
+
pe as Provider,
|
|
74
77
|
C as ResponsiveContainer,
|
|
75
78
|
E as RootLayout,
|
|
76
79
|
b as SSRFavicon,
|
|
@@ -78,44 +81,44 @@ export {
|
|
|
78
81
|
Y as SearchControl,
|
|
79
82
|
A as SlugContainer,
|
|
80
83
|
D as SlugPostContainer,
|
|
81
|
-
|
|
84
|
+
Ir as UPDATE,
|
|
82
85
|
o as afrikaansTranslations,
|
|
83
86
|
t as amharicTranslations,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
fr as clearInternalTrafficCookie,
|
|
88
|
+
Ar as combineReducers,
|
|
89
|
+
te as compareJsonProps,
|
|
87
90
|
i as components,
|
|
88
91
|
l as customizer,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
ae as decode,
|
|
93
|
+
kr as decodeHtmlEntitiesToHtml,
|
|
94
|
+
wr as decodeHtmlEntitiesToText,
|
|
95
|
+
r as englishTranslations,
|
|
96
|
+
e as frenchTranslations,
|
|
94
97
|
d as getComponentByNameIgnoreCase,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
Wr as getUnhandledProps,
|
|
99
|
+
zr as htmlImageProps,
|
|
100
|
+
Kr as htmlInputAttrs,
|
|
101
|
+
Jr as htmlInputEvents,
|
|
102
|
+
Vr as htmlInputProps,
|
|
103
|
+
Sr as initialState,
|
|
104
|
+
hr as intlReducer,
|
|
105
|
+
sr as isInternalTrafficEnabled,
|
|
106
|
+
Br as mediaStyle,
|
|
107
|
+
fe as parse,
|
|
108
|
+
Yr as partitionHTMLProps,
|
|
106
109
|
p as reducer,
|
|
107
110
|
x as reducers,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
pr as setInternalTrafficCookie,
|
|
112
|
+
cr as store,
|
|
113
|
+
Er as stringToArray,
|
|
114
|
+
Fr as toBoolean,
|
|
115
|
+
Lr as toNumber,
|
|
116
|
+
vr as updateIntl,
|
|
117
|
+
Mr as uriStringToArray,
|
|
118
|
+
Cr as useAppDispatch,
|
|
119
|
+
gr as useAppSelector,
|
|
120
|
+
xr as useInternalTrafficBypass,
|
|
121
|
+
_r as useKeyOnly,
|
|
122
|
+
jr as useValueAndKey,
|
|
123
|
+
tr as withTracker
|
|
121
124
|
};
|
|
@@ -1,76 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
), console.log(`Internal traffic ${r ? "enabled" : "disabled"} successfully`), setTimeout(() => {
|
|
22
|
-
f(c);
|
|
23
|
-
}, 3e3);
|
|
24
|
-
} catch (r) {
|
|
25
|
-
s("error"), t(`Error: ${r instanceof Error ? r.message : "Unknown error"}`), console.error("Error setting internal traffic cookie:", r);
|
|
26
|
-
}
|
|
27
|
-
}, [a, l, f, c]);
|
|
28
|
-
const m = {
|
|
29
|
-
display: "flex",
|
|
30
|
-
justifyContent: "center",
|
|
31
|
-
alignItems: "center",
|
|
32
|
-
minHeight: "100vh",
|
|
33
|
-
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'
|
|
34
|
-
}, i = {
|
|
35
|
-
textAlign: "center",
|
|
36
|
-
padding: "2rem",
|
|
37
|
-
borderRadius: "8px",
|
|
38
|
-
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
39
|
-
maxWidth: "500px"
|
|
40
|
-
}, b = e === "success" ? {
|
|
41
|
-
...i,
|
|
42
|
-
backgroundColor: "#f0f9ff",
|
|
43
|
-
borderLeft: "4px solid #10b981"
|
|
44
|
-
} : e === "error" ? {
|
|
45
|
-
...i,
|
|
46
|
-
backgroundColor: "#fef2f2",
|
|
47
|
-
borderLeft: "4px solid #ef4444"
|
|
48
|
-
} : {
|
|
49
|
-
...i,
|
|
50
|
-
backgroundColor: "#f3f4f6",
|
|
51
|
-
borderLeft: "4px solid #3b82f6"
|
|
52
|
-
};
|
|
53
|
-
return /* @__PURE__ */ o("div", { style: m, children: /* @__PURE__ */ p("div", { style: b, children: [
|
|
54
|
-
/* @__PURE__ */ o("h1", { style: {
|
|
55
|
-
fontSize: "1.5rem",
|
|
56
|
-
fontWeight: "600",
|
|
57
|
-
margin: "0 0 1rem 0",
|
|
58
|
-
color: e === "success" ? "#059669" : e === "error" ? "#dc2626" : "#1f2937"
|
|
59
|
-
}, children: e === "success" ? "Success" : e === "error" ? "Error" : "Processing" }),
|
|
60
|
-
/* @__PURE__ */ o("p", { style: {
|
|
61
|
-
fontSize: "1rem",
|
|
62
|
-
margin: "1rem 0",
|
|
63
|
-
color: e === "success" ? "#047857" : e === "error" ? "#991b1b" : "#374151",
|
|
64
|
-
lineHeight: "1.5"
|
|
65
|
-
}, children: g }),
|
|
66
|
-
e === "success" && /* @__PURE__ */ o("p", { style: {
|
|
67
|
-
fontSize: "0.875rem",
|
|
68
|
-
color: "#6b7280",
|
|
69
|
-
marginTop: "1.5rem",
|
|
70
|
-
fontStyle: "italic"
|
|
71
|
-
}, children: "Redirecting to home page in 3 seconds..." })
|
|
72
|
-
] }) });
|
|
1
|
+
import { jsxs as r, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { Container as a, Segment as n, Header as i, Message as c } from "semantic-ui-react";
|
|
3
|
+
import { useInternalTrafficBypass as g } from "./useInternalTrafficBypass.js";
|
|
4
|
+
const p = ({ redirectTo: o = "/" }) => {
|
|
5
|
+
const { status: e, message: t } = g(o);
|
|
6
|
+
return /* @__PURE__ */ r(a, { as: "div", children: [
|
|
7
|
+
/* @__PURE__ */ r(n, { textAlign: "center", basic: !0, vertical: !0, children: [
|
|
8
|
+
/* @__PURE__ */ s(i, { as: "h1", content: e === "success" ? "Success" : e === "error" ? "Error" : "Processing" }),
|
|
9
|
+
e === "success" && /* @__PURE__ */ s(c, { size: "small", content: "Redirecting to home page in 3 seconds..." })
|
|
10
|
+
] }),
|
|
11
|
+
/* @__PURE__ */ s(n, { vertical: !0, children: /* @__PURE__ */ s(
|
|
12
|
+
c,
|
|
13
|
+
{
|
|
14
|
+
size: "large",
|
|
15
|
+
icon: e === "success" ? "check circle" : e === "error" ? "warning sign" : "spinner",
|
|
16
|
+
color: e === "success" ? "green" : e === "error" ? "red" : "blue",
|
|
17
|
+
content: t
|
|
18
|
+
}
|
|
19
|
+
) })
|
|
20
|
+
] });
|
|
73
21
|
};
|
|
74
22
|
export {
|
|
75
|
-
|
|
23
|
+
p as default
|
|
76
24
|
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as s, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { useState as n, useEffect as b } from "react";
|
|
3
|
+
import { Popup as h, Label as M, Icon as v } from "semantic-ui-react";
|
|
4
|
+
import { isInternalTrafficEnabled as f } from "./internalTrafficUtils.js";
|
|
5
|
+
const S = () => {
|
|
6
|
+
const [c, r] = n(!1), [u, g] = n(!1), [t, i] = n({ x: -20, y: -20 }), [o, a] = n(!1), [l, p] = n({ x: 0, y: 0 });
|
|
7
|
+
b(() => {
|
|
8
|
+
if (typeof document > "u") return;
|
|
9
|
+
g(!0), r(f()), typeof window < "u" && i({
|
|
10
|
+
x: window.innerWidth - 200,
|
|
11
|
+
y: window.innerHeight - 40
|
|
12
|
+
});
|
|
13
|
+
const e = () => {
|
|
14
|
+
r(f());
|
|
15
|
+
};
|
|
16
|
+
return window.addEventListener("storage", e), () => window.removeEventListener("storage", e);
|
|
17
|
+
}, []);
|
|
18
|
+
const m = (e) => {
|
|
19
|
+
a(!0), p({
|
|
20
|
+
x: e.clientX - t.x,
|
|
21
|
+
y: e.clientY - t.y
|
|
22
|
+
});
|
|
23
|
+
}, x = (e) => {
|
|
24
|
+
o && i({
|
|
25
|
+
x: e.clientX - l.x,
|
|
26
|
+
y: e.clientY - l.y
|
|
27
|
+
});
|
|
28
|
+
}, d = () => {
|
|
29
|
+
a(!1);
|
|
30
|
+
};
|
|
31
|
+
if (!u || !c)
|
|
32
|
+
return null;
|
|
33
|
+
const y = {
|
|
34
|
+
position: "fixed",
|
|
35
|
+
left: `${t.x}px`,
|
|
36
|
+
top: `${t.y}px`,
|
|
37
|
+
zIndex: 999999,
|
|
38
|
+
willChange: o ? "transform" : "auto",
|
|
39
|
+
cursor: o ? "grabbing" : "grab"
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ s(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
style: y,
|
|
45
|
+
onMouseDown: m,
|
|
46
|
+
onMouseMove: x,
|
|
47
|
+
onMouseUp: d,
|
|
48
|
+
onMouseLeave: d,
|
|
49
|
+
role: "status",
|
|
50
|
+
"aria-label": "GA bypass enabled. Drag to move this notification.",
|
|
51
|
+
children: /* @__PURE__ */ s(
|
|
52
|
+
h,
|
|
53
|
+
{
|
|
54
|
+
content: "Drag to move",
|
|
55
|
+
position: "left center",
|
|
56
|
+
trigger: /* @__PURE__ */ w(M, { color: "yellow", image: !0, children: [
|
|
57
|
+
/* @__PURE__ */ s(v, { name: "spinner", loading: !0, color: "red" }),
|
|
58
|
+
"GA Bypass Enabled"
|
|
59
|
+
] })
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
S as default
|
|
67
|
+
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { withTracker as
|
|
2
|
-
import { clearInternalTrafficCookie as
|
|
3
|
-
import { default as
|
|
1
|
+
import { withTracker as e } from "./withGoogleAnalytics.js";
|
|
2
|
+
import { clearInternalTrafficCookie as t, isInternalTrafficEnabled as o, setInternalTrafficCookie as n } from "./internalTrafficUtils.js";
|
|
3
|
+
import { default as i } from "./InternalTrafficToggle.js";
|
|
4
|
+
import { default as T } from "./InternalTrafficWatermark.js";
|
|
5
|
+
import { useInternalTrafficBypass as m } from "./useInternalTrafficBypass.js";
|
|
4
6
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
t as
|
|
7
|
+
i as InternalTrafficToggle,
|
|
8
|
+
T as InternalTrafficWatermark,
|
|
9
|
+
t as clearInternalTrafficCookie,
|
|
10
|
+
o as isInternalTrafficEnabled,
|
|
8
11
|
n as setInternalTrafficCookie,
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
m as useInternalTrafficBypass,
|
|
13
|
+
e as withTracker
|
|
11
14
|
};
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t = "_ga_internal_traffic";
|
|
2
2
|
const c = (e) => {
|
|
3
3
|
if (typeof document > "u") return;
|
|
4
|
-
const
|
|
5
|
-
document.cookie = `${
|
|
4
|
+
const o = e ? "1" : "0", n = "/";
|
|
5
|
+
document.cookie = `${t}=${o}; max-age=31536000; path=${n}; SameSite=Lax`, console.log(`Internal traffic cookie ${e ? "enabled" : "disabled"}`);
|
|
6
6
|
}, i = () => {
|
|
7
7
|
if (typeof document > "u") return !1;
|
|
8
8
|
const e = document.cookie.split(";");
|
|
9
|
-
for (const
|
|
10
|
-
const [n, a] =
|
|
11
|
-
if (n ===
|
|
9
|
+
for (const o of e) {
|
|
10
|
+
const [n, a] = o.trim().split("=");
|
|
11
|
+
if (n === t)
|
|
12
12
|
return a === "1";
|
|
13
13
|
}
|
|
14
14
|
return !1;
|
|
15
15
|
}, r = () => {
|
|
16
|
-
typeof document > "u" || (document.cookie = `${
|
|
17
|
-
}
|
|
16
|
+
typeof document > "u" || (document.cookie = `${t}=; max-age=0; path=/; SameSite=Lax`, console.log("Internal traffic cookie cleared"));
|
|
17
|
+
};
|
|
18
18
|
export {
|
|
19
19
|
r as clearInternalTrafficCookie,
|
|
20
20
|
i as isInternalTrafficEnabled,
|
|
21
|
-
c as setInternalTrafficCookie
|
|
22
|
-
f as validateToken
|
|
21
|
+
c as setInternalTrafficCookie
|
|
23
22
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useState as c, useEffect as b } from "react";
|
|
2
|
+
import { useNavigate as m, useSearchParams as p } from "react-router";
|
|
3
|
+
import { setInternalTrafficCookie as d } from "./internalTrafficUtils.js";
|
|
4
|
+
const k = (e) => e instanceof Error ? `Error: ${e.message}` : "Error: Unknown error", T = (e = "/") => {
|
|
5
|
+
const l = m(), [n] = p(), [i, r] = c("validating"), [g, s] = c("Processing...");
|
|
6
|
+
return b(() => {
|
|
7
|
+
const t = n.get("enable");
|
|
8
|
+
if (!n.get("k")) {
|
|
9
|
+
r("error"), s("Missing token parameter. Use ?k=your_token"), console.error("Missing token parameter");
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (!t) {
|
|
13
|
+
r("error"), s("Missing enable parameter. Use ?enable=0 or ?enable=1"), console.error("Missing enable parameter");
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (t !== "0" && t !== "1") {
|
|
17
|
+
r("error"), s("Invalid enable parameter. Use ?enable=0 or ?enable=1"), console.error("Invalid enable parameter:", t);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const o = t === "1", u = o ? "✓ Internal traffic enabled. GA4 events will be tagged as internal." : "✓ Internal traffic disabled. GA4 events will be tagged as external.", f = `Internal traffic ${o ? "enabled" : "disabled"} successfully`;
|
|
21
|
+
try {
|
|
22
|
+
d(o), r("success"), s(u), console.log(f);
|
|
23
|
+
const a = setTimeout(() => {
|
|
24
|
+
l(e);
|
|
25
|
+
}, 3e3);
|
|
26
|
+
return () => clearTimeout(a);
|
|
27
|
+
} catch (a) {
|
|
28
|
+
r("error"), s(k(a)), console.error("Error setting internal traffic cookie:", a);
|
|
29
|
+
}
|
|
30
|
+
}, [n, l, e]), { status: i, message: g };
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
T as useInternalTrafficBypass
|
|
34
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* InternalTrafficWatermark
|
|
4
|
+
*
|
|
5
|
+
* Displays a watermark badge indicating that internal traffic bypassing
|
|
6
|
+
* is enabled. This ensures staff members know they are not contributing
|
|
7
|
+
* to Google Analytics statistics when browsing with this setting enabled.
|
|
8
|
+
*
|
|
9
|
+
* The watermark is only rendered when the _ga_internal_traffic cookie is
|
|
10
|
+
* set to '1', and it updates reactively if the cookie state changes.
|
|
11
|
+
*/
|
|
12
|
+
declare const InternalTrafficWatermark: React.FC;
|
|
13
|
+
export default InternalTrafficWatermark;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export * from './withGoogleAnalytics';
|
|
2
2
|
export * from './internalTrafficUtils';
|
|
3
3
|
export { default as InternalTrafficToggle } from './InternalTrafficToggle';
|
|
4
|
+
export { default as InternalTrafficWatermark } from './InternalTrafficWatermark';
|
|
5
|
+
export { useInternalTrafficBypass } from './useInternalTrafficBypass';
|
|
@@ -15,10 +15,3 @@ export declare const isInternalTrafficEnabled: () => boolean;
|
|
|
15
15
|
* Clear the internal traffic cookie
|
|
16
16
|
*/
|
|
17
17
|
export declare const clearInternalTrafficCookie: () => void;
|
|
18
|
-
/**
|
|
19
|
-
* Validate the token against the expected value
|
|
20
|
-
* @param providedToken - The token from query params
|
|
21
|
-
* @param expectedToken - The expected token from environment
|
|
22
|
-
* @returns true if tokens match, false otherwise
|
|
23
|
-
*/
|
|
24
|
-
export declare const validateToken: (providedToken: string | null, expectedToken: string) => boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface BypassStatus {
|
|
2
|
+
status: 'validating' | 'success' | 'error';
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Custom hook to handle internal traffic GA bypass logic
|
|
7
|
+
* Processes URL query parameters and manages cookie state
|
|
8
|
+
*
|
|
9
|
+
* @param redirectTo - URL to redirect to after successful toggle (default: '/')
|
|
10
|
+
* @returns Object containing status, message, and validation state
|
|
11
|
+
*/
|
|
12
|
+
export declare const useInternalTrafficBypass: (redirectTo?: string) => BypassStatus;
|
|
13
|
+
export {};
|