@devgateway/dvz-ui-react 1.7.13 → 1.7.15

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 n=require("react/jsx-runtime"),m=require("react"),c=require("@devgateway/wp-react-lib"),h=require("semantic-ui-react"),P=require("react-intl"),w=(e,s)=>!e||!s?e:e.replace(/href\s*=\s*(['"])(https?:\/\/[^'"]+)\1/ig,(o,a,t)=>{try{const r=new URL(t),u=r.pathname.indexOf("/wp/");if(u===-1)return o;const i=r.pathname.slice(u+3);return r.pathname=i.startsWith("/"+s)?i:"/"+s+i,`href=${a}${r.toString()}${a}`}catch{return o}}),I=e=>{const s=e.as?e.as:h.Container,o=["post","pageNumber","visibility","intl","as"],a={};return Object.keys(e).filter(t=>t).forEach(t=>{o.indexOf(t)==-1&&(a[t]=e[t])}),n.jsx(s,{...a,children:e.children})},_=e=>{const s=P.useIntl(),[o,a]=m.useState(!1);m.useEffect(()=>{e.onLoad&&e.onLoad()},[]);const{post:t,pageNumber:r,showTitle:u,showContent:i,showIntro:p,showDate:C,showLoading:L,as:N,locale:b,messages:y,preview:S}=e,d=b||s.locale;if(t){const l=t.content?t.content.rendered.split("<!--more-->"):[],v=l.length>1?l[0]:null,f=l.length>1?l[1]:l[0],x=f?f.split("<!--nextpage-->"):"";let g="";return r!=null&&x.length>0?g=x[r]:g=f,n.jsx(c.EmbeddedGateway,{parentUnique:e.parentUnique,messages:y,parent:S?t.parent:t.id,children:n.jsxs(I,{className:"entry-content",...e,children:[n.jsx("div",{}),C&&n.jsx(h.Container,{fluid:!0,className:"date",children:t.date.toLocaleString()}),u&&n.jsx("span",{id:t.slug,className:"title",dangerouslySetInnerHTML:{__html:t.title.rendered}},"title"),p&&n.jsx(h.Container,{fluid:!0,className:"excerpt",dangerouslySetInnerHTML:{__html:c.utils.removePatternBrackets(w(c.dvizTranslate(v,d),d))}},"intro"),i&&n.jsx(h.Container,{fluid:!0,className:"content ",dangerouslySetInnerHTML:{__html:c.utils.removePatternBrackets(w(c.dvizTranslate(g,d),d))}},"content")]})})}else return L?"Loading":!1},j=e=>n.jsx(m.Suspense,{children:n.jsx(_,{...e,showContent:!0})});exports.FilteredPostContent=j;exports.default=j;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),p=require("react"),l=require("@devgateway/wp-react-lib"),f=require("semantic-ui-react"),P=require("react-intl"),x=(e,s)=>!e||!s||!e.includes("/wp/")||e.includes("/wp/"+s+"/")||e.includes("/wp/wp-content/uploads/")?e:e.replace(/href\s*=\s*(['"])(https?:\/\/[^'"]+)\1/ig,(i,a,t)=>{try{const r=new URL(t),u=r.pathname.indexOf("/wp/");if(u===-1)return i;const o=r.pathname.slice(u+3);return r.pathname=o.startsWith("/"+s)?o:"/"+s+o,`href=${a}${r.toString()}${a}`}catch{return i}}),I=e=>{const s=e.as?e.as:f.Container,i=["post","pageNumber","visibility","intl","as"],a={};return Object.keys(e).filter(t=>t).forEach(t=>{i.indexOf(t)==-1&&(a[t]=e[t])}),n.jsx(s,{...a,children:e.children})},_=e=>{const s=P.useIntl(),[i,a]=p.useState(!1);p.useEffect(()=>{e.onLoad&&e.onLoad()},[]);const{post:t,pageNumber:r,showTitle:u,showContent:o,showIntro:m,showDate:L,showLoading:b,as:N,locale:C,messages:y,preview:S}=e,d=C||s.locale;if(t){const c=t.content?t.content.rendered.split("<!--more-->"):[],v=c.length>1?c[0]:null,h=c.length>1?c[1]:c[0],w=h?h.split("<!--nextpage-->"):"";let g="";return r!=null&&w.length>0?g=w[r]:g=h,n.jsx(l.EmbeddedGateway,{parentUnique:e.parentUnique,messages:y,parent:S?t.parent:t.id,children:n.jsxs(I,{className:"entry-content",...e,children:[n.jsx("div",{}),L&&n.jsx(f.Container,{fluid:!0,className:"date",children:t.date.toLocaleString()}),u&&n.jsx("span",{id:t.slug,className:"title",dangerouslySetInnerHTML:{__html:t.title.rendered}},"title"),m&&n.jsx(f.Container,{fluid:!0,className:"excerpt",dangerouslySetInnerHTML:{__html:l.utils.removePatternBrackets(x(l.dvizTranslate(v,d),d))}},"intro"),o&&n.jsx(f.Container,{fluid:!0,className:"content ",dangerouslySetInnerHTML:{__html:l.utils.removePatternBrackets(x(l.dvizTranslate(g,d),d))}},"content")]})})}else return b?"Loading":!1},j=e=>n.jsx(p.Suspense,{children:n.jsx(_,{...e})});exports.FilteredPostContent=j;exports.default=j;
@@ -1,14 +1,14 @@
1
1
  import { jsx as n, jsxs as P } from "react/jsx-runtime";
2
- import p, { Suspense as v } from "react";
2
+ import m, { Suspense as v } from "react";
3
3
  import { EmbeddedGateway as E, utils as g, dvizTranslate as w } from "@devgateway/wp-react-lib";
4
4
  import { Container as u } from "semantic-ui-react";
5
5
  import { useIntl as _ } from "react-intl";
6
- const L = (e, r) => !e || !r ? e : e.replace(/href\s*=\s*(['"])(https?:\/\/[^'"]+)\1/ig, (a, o, t) => {
6
+ const L = (e, r) => !e || !r || !e.includes("/wp/") || e.includes("/wp/" + r + "/") || e.includes("/wp/wp-content/uploads/") ? e : e.replace(/href\s*=\s*(['"])(https?:\/\/[^'"]+)\1/ig, (a, o, t) => {
7
7
  try {
8
- const s = new URL(t), c = s.pathname.indexOf("/wp/");
9
- if (c === -1) return a;
10
- const l = s.pathname.slice(c + 3);
11
- return s.pathname = l.startsWith("/" + r) ? l : "/" + r + l, `href=${o}${s.toString()}${o}`;
8
+ const s = new URL(t), l = s.pathname.indexOf("/wp/");
9
+ if (l === -1) return a;
10
+ const i = s.pathname.slice(l + 3);
11
+ return s.pathname = i.startsWith("/" + r) ? i : "/" + r + i, `href=${o}${s.toString()}${o}`;
12
12
  } catch {
13
13
  return a;
14
14
  }
@@ -18,36 +18,36 @@ const L = (e, r) => !e || !r ? e : e.replace(/href\s*=\s*(['"])(https?:\/\/[^'"]
18
18
  a.indexOf(t) == -1 && (o[t] = e[t]);
19
19
  }), /* @__PURE__ */ n(r, { ...o, children: e.children });
20
20
  }, j = (e) => {
21
- const r = _(), [a, o] = p.useState(!1);
22
- p.useEffect(() => {
21
+ const r = _(), [a, o] = m.useState(!1);
22
+ m.useEffect(() => {
23
23
  e.onLoad && e.onLoad();
24
24
  }, []);
25
25
  const {
26
26
  post: t,
27
27
  pageNumber: s,
28
- showTitle: c,
29
- showContent: l,
28
+ showTitle: l,
29
+ showContent: i,
30
30
  showIntro: y,
31
31
  showDate: b,
32
32
  showLoading: x,
33
33
  as: k,
34
- locale: C,
35
- messages: S,
34
+ locale: S,
35
+ messages: C,
36
36
  preview: I
37
- } = e, d = C || r.locale;
37
+ } = e, d = S || r.locale;
38
38
  if (t) {
39
- const i = t.content ? t.content.rendered.split("<!--more-->") : [], N = i.length > 1 ? i[0] : null, f = i.length > 1 ? i[1] : i[0], m = f ? f.split("<!--nextpage-->") : "";
40
- let h = "";
41
- return s != null && m.length > 0 ? h = m[s] : h = f, /* @__PURE__ */ n(
39
+ const c = t.content ? t.content.rendered.split("<!--more-->") : [], N = c.length > 1 ? c[0] : null, f = c.length > 1 ? c[1] : c[0], h = f ? f.split("<!--nextpage-->") : "";
40
+ let p = "";
41
+ return s != null && h.length > 0 ? p = h[s] : p = f, /* @__PURE__ */ n(
42
42
  E,
43
43
  {
44
44
  parentUnique: e.parentUnique,
45
- messages: S,
45
+ messages: C,
46
46
  parent: I ? t.parent : t.id,
47
47
  children: /* @__PURE__ */ P(T, { className: "entry-content", ...e, children: [
48
48
  /* @__PURE__ */ n("div", {}),
49
49
  b && /* @__PURE__ */ n(u, { fluid: !0, className: "date", children: t.date.toLocaleString() }),
50
- c && /* @__PURE__ */ n(
50
+ l && /* @__PURE__ */ n(
51
51
  "span",
52
52
  {
53
53
  id: t.slug,
@@ -65,12 +65,12 @@ const L = (e, r) => !e || !r ? e : e.replace(/href\s*=\s*(['"])(https?:\/\/[^'"]
65
65
  },
66
66
  "intro"
67
67
  ),
68
- l && /* @__PURE__ */ n(
68
+ i && /* @__PURE__ */ n(
69
69
  u,
70
70
  {
71
71
  fluid: !0,
72
72
  className: "content ",
73
- dangerouslySetInnerHTML: { __html: g.removePatternBrackets(L(w(h, d), d)) }
73
+ dangerouslySetInnerHTML: { __html: g.removePatternBrackets(L(w(p, d), d)) }
74
74
  },
75
75
  "content"
76
76
  )
@@ -79,7 +79,7 @@ const L = (e, r) => !e || !r ? e : e.replace(/href\s*=\s*(['"])(https?:\/\/[^'"]
79
79
  );
80
80
  } else
81
81
  return x ? "Loading" : !1;
82
- }, B = (e) => /* @__PURE__ */ n(v, { children: /* @__PURE__ */ n(j, { ...e, showContent: !0 }) });
82
+ }, B = (e) => /* @__PURE__ */ n(v, { children: /* @__PURE__ */ n(j, { ...e }) });
83
83
  export {
84
84
  B as FilteredPostContent,
85
85
  B as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.7.13",
3
+ "version": "1.7.15",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",