@devgateway/dvz-ui-react 1.3.0 → 1.3.1

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),o=require("react"),c=require("../conf/index.js");function s(){const[n,i]=o.useState(null);if(!n){const r=c.Config.REACT_APP_WP_API;fetch(r).then(e=>e.json()).then(e=>{e&&e.site_icon_url&&i(e.site_icon_url)}).catch(e=>{console.error("Failed to fetch favicon:",e)})}return t.jsx(t.Fragment,{children:n&&t.jsxs(t.Fragment,{children:[t.jsx("link",{rel:"icon",href:n}),t.jsx("link",{rel:"apple-touch-icon",href:n}),t.jsx("link",{rel:"shortcut",href:n})]})})}const l=o.memo(s);exports.default=l;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("react"),r=require("react-router"),g=require("../embeddable/index.js"),l=require("react-intl"),s=require("@devgateway/wp-react-lib"),p=require("react-redux");require("semantic-ui-react");require("../utils/AppMedia.js");require("./Footer.js");require("./Header.js");const q=require("./Customizer.js");require("./Favicon.js");const f=require("../conf/index.js"),h=require("../translations/en.json.js"),x=require("../translations/fr.json.js"),j=require("../translations/af.json.js"),v=require("../lib/react-intl-redux/index.js");require("immutable");const i=require("../redux/store.js"),c={en:h,fr:x,am:j},w=l.injectIntl(o=>(document.title=o.settings.description,e.jsx(e.Fragment,{}))),C=()=>{const o=r.useParams(),d=r.useLocation(),n=f.Config.DEFAULT_LOCALE;console.log("defaultLocale",n);const t=o.lan,m=d.pathname;return console.log("pathParams",o),u.useEffect(()=>{process.env.NODE_ENV==="development"&&(console.log("----------.env-----------"),console.log(process.env),console.log("----------.env-----------")),window&&window.setTimeout(()=>{if(window&&window.location.hash){const a=document.getElementById(window.location.hash.substring(1));a&&a.scrollIntoView({behavior:"auto",block:"start"})}},2e3)},[]),u.useEffect(()=>{i.store.dispatch(v.updateIntl({locale:t,formats:{},messages:c[t??"en"]}))},[t]),t?Object.keys(c).includes(t)?e.jsx(p.Provider,{store:i.store,children:e.jsx(l.IntlProvider,{locale:t,messages:c[t],children:e.jsx(s.AppContextProvider,{getComponent:g.getComponentByNameIgnoreCase,store:i.store,locale:t,children:e.jsx(s.SettingProvider,{locale:t,changeUUID:null,children:e.jsxs(s.SettingsConsumer,{children:[e.jsx(q.CustomizerWrapper,{children:e.jsx(w,{})}),e.jsx(r.Outlet,{})]})})})},t)}):e.jsx(r.Navigate,{to:`/${n}${m}`,replace:!0}):e.jsx(r.Navigate,{to:n,replace:!0})};exports.default=C;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),r=require("semantic-ui-react"),t=()=>e.jsx(r.Segment,{className:"h-screen w-screen",children:e.jsx(r.Dimmer,{active:!0,inverted:!0,children:e.jsx(r.Loader,{size:"large",active:!0,inline:"centered",inverted:!0})})});exports.default=t;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),r=require("react"),o=require("react-router"),u=require("semantic-ui-react"),g=require("@devgateway/wp-react-lib"),w=require("../embeddable/index.js"),f=()=>{const m=o.useParams();o.useLocation();const[a]=r.useState(()=>w.getComponentByNameIgnoreCase(m.name??""));let[n,d]=o.useSearchParams();const i=l=>{console.log("-------------------------------reading message ----------------------------------------");const t=l.data;if(t.messageType&&t.messageType=="component-attributes"){const c={...n};Object.keys(t).forEach(s=>{c["data-"+s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()]=typeof t[s]=="object"?JSON.stringify(t[s]):t[s]}),d(c)}};r.useEffect(()=>(window.addEventListener("message",i,!1),window.parent&&window.parent.postMessage({type:"componentReady",value:!0},"*"),window.top&&window.top.postMessage({type:"componentReady",value:!0},"*"),()=>{window.removeEventListener("message",i)}),[]);const p=r.useMemo(()=>Object.fromEntries(n.entries()),[n]);return e.jsx("div",{children:e.jsx(u.Container,{fluid:!0,className:"editing",children:a?e.jsx(a,{...p,editing:!0}):e.jsx(u.Segment.Group,{color:"red",textAlign:"center",children:e.jsx("h1",{children:"Wrong Component Name"})})})})},j=()=>e.jsx(g.SettingsConsumer,{children:e.jsx(f,{})});exports.default=j;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./ResponsiveContainer.js"),r=require("./ScrollTop.js"),t=require("./containers/PreviewPageContainer.js"),o=require("./containers/PreviewTypeContainer.js"),i=require("./containers/SlugContainer.js"),n=require("./containers/SlugPostContainer.js"),u=require("./Customizer.js");exports.default=e.default;exports.ScrollToTop=r.default;exports.PreviewPageContainer=t.default;exports.PreviewTypeContainer=o.default;exports.SlugContainer=i.default;exports.SlugPostContainer=n.default;exports.CustomizerWrapper=u.CustomizerWrapper;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./ResponsiveContainer.js"),r=require("./ScrollTop.js"),o=require("./containers/PreviewPageContainer.js"),t=require("./containers/PreviewTypeContainer.js"),n=require("./containers/SlugContainer.js"),i=require("./containers/SlugPostContainer.js"),u=require("./Customizer.js"),a=require("./Layout.js"),l=require("./PreviewComponent.js"),s=require("./Favicon.js"),c=require("./Loading.js");exports.default=e.default;exports.ScrollToTop=r.default;exports.PreviewPageContainer=o.default;exports.PreviewTypeContainer=t.default;exports.SlugContainer=n.default;exports.SlugPostContainer=i.default;exports.CustomizerWrapper=u.CustomizerWrapper;exports.RootLayout=a.default;exports.PreviewComponent=l.default;exports.Favicon=s.default;exports.Loading=c.default;
@@ -0,0 +1,23 @@
1
+ import { jsx as t, Fragment as i, jsxs as c } from "react/jsx-runtime";
2
+ import l, { useState as s } from "react";
3
+ import { Config as f } from "../conf/index.js";
4
+ function h() {
5
+ const [e, n] = s(null);
6
+ if (!e) {
7
+ const r = f.REACT_APP_WP_API;
8
+ fetch(r).then((o) => o.json()).then((o) => {
9
+ o && o.site_icon_url && n(o.site_icon_url);
10
+ }).catch((o) => {
11
+ console.error("Failed to fetch favicon:", o);
12
+ });
13
+ }
14
+ return /* @__PURE__ */ t(i, { children: e && /* @__PURE__ */ c(i, { children: [
15
+ /* @__PURE__ */ t("link", { rel: "icon", href: e }),
16
+ /* @__PURE__ */ t("link", { rel: "apple-touch-icon", href: e }),
17
+ /* @__PURE__ */ t("link", { rel: "shortcut", href: e })
18
+ ] }) });
19
+ }
20
+ const _ = l.memo(h);
21
+ export {
22
+ _ as default
23
+ };
@@ -0,0 +1,45 @@
1
+ import { jsx as e, Fragment as p, jsxs as f } from "react/jsx-runtime";
2
+ import { useEffect as m } from "react";
3
+ import { useParams as d, useLocation as u, Navigate as a, Outlet as g } from "react-router";
4
+ import { getComponentByNameIgnoreCase as h } from "../embeddable/index.js";
5
+ import { injectIntl as v, 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 P } from "react-redux";
8
+ import "semantic-ui-react";
9
+ import "../utils/AppMedia.js";
10
+ import "./Footer.js";
11
+ import "./Header.js";
12
+ import { CustomizerWrapper as E } from "./Customizer.js";
13
+ import "./Favicon.js";
14
+ import { Config as j } from "../conf/index.js";
15
+ import * as b from "../translations/en.json.js";
16
+ import * as x from "../translations/fr.json.js";
17
+ import * as y from "../translations/af.json.js";
18
+ import { updateIntl as N } from "../lib/react-intl-redux/index.js";
19
+ import "immutable";
20
+ import { store as n } from "../redux/store.js";
21
+ const i = {
22
+ en: b,
23
+ fr: x,
24
+ am: y
25
+ }, O = v((t) => (document.title = t.settings.description, /* @__PURE__ */ e(p, {}))), J = () => {
26
+ const t = d(), l = u(), r = j.DEFAULT_LOCALE;
27
+ console.log("defaultLocale", r);
28
+ const o = t.lan, c = l.pathname;
29
+ return console.log("pathParams", t), m(() => {
30
+ process.env.NODE_ENV === "development" && (console.log("----------.env-----------"), console.log(process.env), console.log("----------.env-----------")), window && window.setTimeout(() => {
31
+ if (window && window.location.hash) {
32
+ const s = document.getElementById(window.location.hash.substring(1));
33
+ s && s.scrollIntoView({ behavior: "auto", block: "start" });
34
+ }
35
+ }, 2e3);
36
+ }, []), m(() => {
37
+ n.dispatch(N({ locale: o, formats: {}, messages: i[o ?? "en"] }));
38
+ }, [o]), o ? Object.keys(i).includes(o) ? /* @__PURE__ */ e(P, { store: n, children: /* @__PURE__ */ e(w, { locale: o, messages: i[o], children: /* @__PURE__ */ e(C, { getComponent: h, store: n, locale: o, children: /* @__PURE__ */ e(I, { locale: o, changeUUID: null, children: /* @__PURE__ */ f(L, { children: [
39
+ /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(O, {}) }),
40
+ /* @__PURE__ */ e(g, {})
41
+ ] }) }) }) }, o) }) : /* @__PURE__ */ e(a, { to: `/${r}${c}`, replace: !0 }) : /* @__PURE__ */ e(a, { to: r, replace: !0 });
42
+ };
43
+ export {
44
+ J as default
45
+ };
@@ -0,0 +1,6 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { Segment as r, Dimmer as t, Loader as i } from "semantic-ui-react";
3
+ const c = () => /* @__PURE__ */ e(r, { className: "h-screen w-screen", children: /* @__PURE__ */ e(t, { active: !0, inverted: !0, children: /* @__PURE__ */ e(i, { size: "large", active: !0, inline: "centered", inverted: !0 }) }) });
4
+ export {
5
+ c as default
6
+ };
@@ -0,0 +1,30 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import d, { useState as u, useEffect as g } from "react";
3
+ import { useParams as f, useLocation as l, useSearchParams as w } from "react-router";
4
+ import { Container as y, Segment as P } from "semantic-ui-react";
5
+ import { SettingsConsumer as C } from "@devgateway/wp-react-lib";
6
+ import { getComponentByNameIgnoreCase as h } from "../embeddable/index.js";
7
+ const v = () => {
8
+ const m = f();
9
+ l();
10
+ const [n] = u(() => h(m.name ?? ""));
11
+ let [r, i] = w();
12
+ const a = (c) => {
13
+ console.log("-------------------------------reading message ----------------------------------------");
14
+ const t = c.data;
15
+ if (t.messageType && t.messageType == "component-attributes") {
16
+ const s = { ...r };
17
+ Object.keys(t).forEach((o) => {
18
+ s["data-" + o.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()] = typeof t[o] == "object" ? JSON.stringify(t[o]) : t[o];
19
+ }), i(s);
20
+ }
21
+ };
22
+ g(() => (window.addEventListener("message", a, !1), window.parent && window.parent.postMessage({ type: "componentReady", value: !0 }, "*"), window.top && window.top.postMessage({ type: "componentReady", value: !0 }, "*"), () => {
23
+ window.removeEventListener("message", a);
24
+ }), []);
25
+ const p = d.useMemo(() => Object.fromEntries(r.entries()), [r]);
26
+ return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(y, { fluid: !0, className: "editing", children: n ? /* @__PURE__ */ e(n, { ...p, editing: !0 }) : /* @__PURE__ */ e(P.Group, { color: "red", textAlign: "center", children: /* @__PURE__ */ e("h1", { children: "Wrong Component Name" }) }) }) });
27
+ }, N = () => /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(v, {}) });
28
+ export {
29
+ N as default
30
+ };
@@ -1,16 +1,24 @@
1
- import o from "./ResponsiveContainer.js";
1
+ import e from "./ResponsiveContainer.js";
2
2
  import { default as a } from "./ScrollTop.js";
3
3
  import { default as p } from "./containers/PreviewPageContainer.js";
4
- import { default as i } from "./containers/PreviewTypeContainer.js";
4
+ import { default as l } from "./containers/PreviewTypeContainer.js";
5
5
  import { default as s } from "./containers/SlugContainer.js";
6
- import { default as u } from "./containers/SlugPostContainer.js";
7
- import { CustomizerWrapper as d } from "./Customizer.js";
6
+ import { default as i } from "./containers/SlugPostContainer.js";
7
+ import { CustomizerWrapper as x } from "./Customizer.js";
8
+ import { default as v } from "./Layout.js";
9
+ import { default as g } from "./PreviewComponent.js";
10
+ import { default as S } from "./Favicon.js";
11
+ import { default as c } from "./Loading.js";
8
12
  export {
9
- d as CustomizerWrapper,
13
+ x as CustomizerWrapper,
14
+ S as Favicon,
15
+ c as Loading,
16
+ g as PreviewComponent,
10
17
  p as PreviewPageContainer,
11
- i as PreviewTypeContainer,
18
+ l as PreviewTypeContainer,
19
+ v as RootLayout,
12
20
  a as ScrollToTop,
13
21
  s as SlugContainer,
14
- u as SlugPostContainer,
15
- o as default
22
+ i as SlugPostContainer,
23
+ e as default
16
24
  };
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ declare function Favicon(): React.JSX.Element;
3
+ declare const _default: React.MemoExoticComponent<typeof Favicon>;
4
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ declare const RootLayout: () => React.JSX.Element;
3
+ export default RootLayout;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ declare const Loading: () => React.JSX.Element;
3
+ export default Loading;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ declare const PreviewComponent: () => React.JSX.Element;
3
+ export default PreviewComponent;
@@ -4,3 +4,7 @@ export * from './containers';
4
4
  export * from './Customizer';
5
5
  export default ResponsiveContainer;
6
6
  export { ScrollToTop };
7
+ export { default as RootLayout } from './Layout';
8
+ export { default as PreviewComponent } from './PreviewComponent';
9
+ export { default as Favicon } from './Favicon';
10
+ export { default as Loading } from './Loading';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -80,7 +80,7 @@
80
80
  "string-template": "^1.0.0",
81
81
  "topojson-client": "^3.1.0",
82
82
  "uuid": "^11.1.0",
83
- "@devgateway/wp-react-lib": "0.4.3"
83
+ "@devgateway/wp-react-lib": "0.4.4"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@eslint/js": "^9.26.0",