jamespot-react-core 1.1.117 → 1.1.118

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,7 +1,7 @@
1
1
  import React from 'react';
2
2
  export declare const CSSEditorPortalWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
3
3
  export declare const CSSEditorPortalPopupWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
4
- on: boolean;
4
+ isActive: boolean;
5
5
  }, never>;
6
6
  export declare const CSSEditorPortalRow: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
7
  export declare const CSSEditorPortalFreeSpace: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -1,7 +1,7 @@
1
1
  export declare const CSSEditorComponentWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
2
2
  export declare const CSSEditorComponentLabel: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
3
3
  export declare const CSSEditorPortal: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
4
- on: boolean;
4
+ isActive: boolean;
5
5
  }, never>;
6
6
  export declare const CSSEditorHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
7
  export declare const CSSEditorAction: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -12,7 +12,7 @@ export declare const CSSEditor: import("styled-components").StyledComponent<"div
12
12
  export declare const CSSEditorContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
13
13
  export declare const CSSEditorMenu: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
14
14
  export declare const CSSEditorMenuButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
15
- on?: boolean | undefined;
15
+ isActive?: boolean | undefined;
16
16
  }, never>;
17
17
  export declare const CSSInputWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
18
18
  export declare const CSSEditorWidget: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { CombinedWidgetType, WidgetDisplayMode } from 'jamespot-user-api';
3
- export declare const DisplayWidget: ({ widget, width, inplace, isComponentVisible, mode, onClick, }: {
3
+ export declare const DisplayWidget: ({ widget, inplace, isComponentVisible, mode, onClick, }: {
4
4
  widget: CombinedWidgetType;
5
5
  width?: number | undefined;
6
6
  inplace: boolean;
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import { WidgetWrapperProps } from 'jamespot-user-api';
3
3
  type WidgetListMode = 'button' | 'list' | 'gallery' | 'custom' | 'article';
4
- export declare const WidgetList: ({ mode, children, namespace, onChange, }: {
4
+ export declare const WidgetList: ({ mode, view, children, namespace, onChange, }: {
5
5
  mode?: WidgetListMode | undefined;
6
+ view?: string | undefined;
6
7
  children?: any;
7
8
  namespace?: string | undefined;
8
9
  onChange: (widget: WidgetWrapperProps) => void;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { jFileLittle } from 'jamespot-user-api';
3
+ export declare const CSSHidden: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
4
+ type InplaceUploaderProps = {
5
+ children: React.ReactNode;
6
+ initialFiles: jFileLittle[];
7
+ initialClick?: boolean;
8
+ multiple: boolean;
9
+ accept: string;
10
+ onUploadStart: () => void;
11
+ onUploadEnd: () => void;
12
+ onUploadSuccess: (files: jFileLittle[]) => void;
13
+ };
14
+ export declare const WidgetUploader: ({ children, initialFiles, initialClick, multiple, accept, onUploadStart, onUploadEnd, onUploadSuccess, }: InplaceUploaderProps) => React.JSX.Element;
15
+ export {};
@@ -1,15 +1,8 @@
1
- import { FileResponse, WidgetFileType } from 'jamespot-user-api';
2
1
  export declare const loadImage: (setImageDimensions: React.Dispatch<React.SetStateAction<{
3
2
  width: number;
4
3
  height: number;
5
4
  }>>, imageUrl: string, setError: React.Dispatch<React.SetStateAction<boolean>>) => void;
6
- export declare function getFileFamily(mime: string): string;
7
- export declare const allowedFileExtensions: string[];
8
- export declare function getExtensionFromName(name: string): string | undefined;
9
- export declare function apiFileToWidgetFile(fileResponse: FileResponse): WidgetFileType;
10
- export declare function getMimetypeFromExtension(ext: string | undefined): string;
11
5
  export declare function reduce(obj: Record<string, unknown>, prop: string): Record<string, unknown>;
12
- export declare function imagecache(file: WidgetFileType, width: number): string;
13
6
  export declare function imageResize(width: number, height: number, maxWidth: number, maxHeight: number): {
14
7
  width: number;
15
8
  height: number;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { WidgetArticleAttachmentType, WidgetDisplayMode, WidgetStateProps } from 'jamespot-user-api';
3
+ export declare const wedocWindowOpen: (idFile: number, hash: string, target?: '_blank') => void;
4
+ export declare function getWedocFilePath(idFile: number, hash: string): string;
5
+ export declare const JRCWidgetArticleAttachmentWrapper: ({ widget, inplace, mode, onStateChange, }: {
6
+ widget: WidgetArticleAttachmentType;
7
+ inplace?: boolean | undefined;
8
+ mode?: WidgetDisplayMode | undefined;
9
+ onStateChange: (state: WidgetStateProps) => void;
10
+ }) => React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { WidgetArticleGalleryType, WidgetDisplayMode, WidgetStateProps } from 'jamespot-user-api';
3
+ export declare const JRCWidgetArticleGalleryWrapper: ({ widget, inplace, mode, onStateChange, }: {
4
+ widget: WidgetArticleGalleryType;
5
+ inplace?: boolean | undefined;
6
+ mode?: WidgetDisplayMode | undefined;
7
+ onStateChange: (state: WidgetStateProps) => void;
8
+ }) => React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { WidgetArticleImageType, WidgetDisplayMode, WidgetStateProps } from 'jamespot-user-api';
3
+ export declare const JRCWidgetArticleImageWrapper: ({ widget, inplace, mode, onStateChange, }: {
4
+ widget: WidgetArticleImageType;
5
+ inplace?: boolean | undefined;
6
+ mode?: WidgetDisplayMode | undefined;
7
+ onStateChange: (state: WidgetStateProps) => void;
8
+ }) => React.JSX.Element;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { WidgetArticleTitleType, WidgetDisplayMode } from 'jamespot-user-api';
3
+ export declare const JRCWidgetArticleTitleWrapper: ({ widget, inplace, mode, }: {
4
+ widget: WidgetArticleTitleType;
5
+ inplace: boolean;
6
+ mode?: WidgetDisplayMode | undefined;
7
+ }) => React.JSX.Element;
8
+ export declare const Toolbar: ({ heading, onClick }: {
9
+ heading?: string | undefined;
10
+ onClick: (size: string) => void;
11
+ }) => React.JSX.Element;
@@ -31,9 +31,10 @@ declare const _default: {
31
31
  readonly DropDown: "JRCDropDown";
32
32
  readonly Ellipsis: "JRCEllipsis";
33
33
  readonly FadeStepper: "JRCFadeStepper";
34
+ readonly FileAvatar: "JRCFileAvatar";
34
35
  readonly FileOpen: "JRCFileOpen";
36
+ readonly FileViewer: "JRCFileViewer";
35
37
  readonly File: "JRCFile";
36
- readonly FileAvatar: "JRCFileAvatar";
37
38
  readonly FlexBox: "JRCFlexBox";
38
39
  readonly Folders: "JRCFolders";
39
40
  readonly DEPRECATEDFormCheckbox: "JRCFormCheckbox";
@@ -55,6 +56,7 @@ declare const _default: {
55
56
  readonly DEPRECATEDFormTextareaField: "JRCFormTextareaField";
56
57
  readonly DEPRECATEDFormTextField: "JRCFormTextField";
57
58
  readonly DEPRECATEDFormUrlField: "JRCFormUrlField";
59
+ readonly EmptySpace: "JRCEmptySpace";
58
60
  readonly Grid: "JRCGrid";
59
61
  readonly H1: "JRCH1";
60
62
  readonly H2: "JRCH2";
@@ -142,6 +142,10 @@ export interface WindowJ {
142
142
  urlBase: string;
143
143
  jlandUrlBase: string;
144
144
  types: JType[];
145
+ platform?: {
146
+ name: string;
147
+ logo: string | null;
148
+ };
145
149
  networks: Networks;
146
150
  }
147
151
  export type IsAppActivateProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jamespot-react-core",
3
- "version": "1.1.117",
3
+ "version": "1.1.118",
4
4
  "description": "Jamespot React Core",
5
5
  "main": "./build/app.bundle.js",
6
6
  "types": "./build/src/App.d.ts",
@@ -49,9 +49,9 @@
49
49
  "dependencies": {
50
50
  "@reduxjs/toolkit": "^1.9.0",
51
51
  "history": "^5.3.0",
52
- "jamespot-front-business": "^1.1.22",
53
- "jamespot-react-components": "^1.0.146",
54
- "jamespot-user-api": "^1.0.116",
52
+ "jamespot-front-business": "^1.1.23",
53
+ "jamespot-react-components": "^1.0.147",
54
+ "jamespot-user-api": "^1.0.119",
55
55
  "react": "^17.0.2",
56
56
  "react-dom": "^17.0.2",
57
57
  "react-hook-form": "^7.25.0",
@@ -1,198 +0,0 @@
1
- "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[55],{55:(e,t,n)=>{n.r(t),n.d(t,{DisplayForm:()=>m,EditorsPortal:()=>Oe,Empty:()=>g,TwoColLayout:()=>w,WidgetList:()=>te,WidgetWrapperCore:()=>N});var i=n(363),l=n.n(i),o=n(230),a=n(185),r=n(754),c=n.n(r),s=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(i=Object.getOwnPropertySymbols(e);l<i.length;l++)t.indexOf(i[l])<0&&Object.prototype.propertyIsEnumerable.call(e,i[l])&&(n[i[l]]=e[i[l]])}return n};const d=c().form`
2
- ${e=>e.stretch&&"\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n "}
3
- `,u=c().div`
4
- ${e=>e.stretch&&"\n flex: 1;\n"}
5
- `,m=i.forwardRef(((e,t)=>{const n=i.useRef(null),[l,r]=(0,a.GF)(e.fields,e.type),c=(0,o.useForm)({defaultValues:Object.assign(Object.assign({},r),e.defaultValues),criteriaMode:"all"}),{handleSubmit:m,control:g,reset:p}=c,E=s(c,["handleSubmit","control","reset"]);return i.useImperativeHandle(t,(()=>Object.assign(Object.assign({},E),{handleSubmit:m,control:g,reset:()=>{var e;null===(e=null==n?void 0:n.current)||void 0===e||e.scrollTo(0,0),p()}})),[]),i.createElement(d,{stretch:e.stretch,onSubmit:m(e.onSubmit),ref:n},i.createElement(u,{stretch:e.stretch},l.map((t=>{var{Input:n}=t,l=s(t,["Input"]);return i.createElement(n,Object.assign({key:l.name,control:g},l,{dataCy:`${e.dataCy}-${l.name}`,readOnly:e.readOnly}))})),e.extraInputs&&e.extraInputs(g)),e.buttons)})),g=()=>i.createElement(i.Fragment,null);var p=n(248),E=n(181),f=n(556);const y=f.default.registry.getLazyComponent("Container"),v=f.default.registry.getLazyComponent("AppColumn"),h=f.default.registry.getLazyComponent("MainColumn");function w({extensionRoute:e,routes:t,description:n,mode:l="center"}){var o;const a=(0,E.useIntl)(),{pathname:r}=(0,p.useLocation)(),c=Object.values(t),[s,d]=i.useState(null===(o=null==c?void 0:c[0])||void 0===o?void 0:o.key),u=c.map((t=>Object.assign(Object.assign({},t),{label:a.formatMessage({id:t.label}),href:`/ng/rr/${e}/${t.path}`,group:t.group?a.formatMessage({id:t.group}):void 0})));return i.useEffect((()=>{const t=c.find((t=>r===`/ng/rr/${e}/${t.path}`));t&&d(t.key)}),[r]),i.createElement(i.Suspense,{fallback:i.createElement(i.Fragment,null)},i.createElement(y,{mode:l},i.createElement(v,{mode:l,description:n,tabs:u,activeTab:s||""}),i.createElement(h,{mode:l},i.createElement(p.Outlet,null))))}var b=n(855),x=n(420);const C=f.default.registry.getLazyComponent("Loader"),L=({name:e,uniqid:t,inplace:n})=>{const i=(0,b.useSelector)((e=>x.$L.selectors.selectWidgetState(e,t))),o=x.$L.definition(e);return(null==i?void 0:i.loading)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},l().createElement(C,null)):(null==i?void 0:i.hover)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}}):!(null==i?void 0:i.initialized)&&n||(null==i?void 0:i.initialized)||n?l().createElement(l().Fragment,null):l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,1)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},l().createElement("img",{src:o.img}))},q=f.default.registry.getLazyComponent("WidgetArticleButton"),T=f.default.registry.getLazyComponent("WidgetArticleGallery"),W=f.default.registry.getLazyComponent("WidgetArticleAttachment"),$=f.default.registry.getLazyComponent("WidgetArticleImage"),I=f.default.registry.getLazyComponent("WidgetArticleTitle"),k=f.default.registry.getLazyComponent("WidgetArticleText"),S=({widget:e,width:t,inplace:n=!1,isComponentVisible:i=!1,mode:o="view",onClick:a})=>{const r=(0,b.useDispatch)(),{name:c,uniqid:s}=e,d=(0,b.useSelector)(x.$L.selectors.selectToken),u=(e,t)=>r(x.$L.slice.actions.updateWidget({uniqid:s,content:e,override:t})),m=e=>r(x.$L.slice.actions.setWidgetState(Object.assign({uniqid:s},e)));switch(c){default:return l().createElement(l().Fragment,null,"cannot display widget (",c,")");case x.$L.const.WIDGET_ARTICLE_BUTTON:return l().createElement(q,{isComponentVisible:i,content:e.content,inplace:n,mode:o,onChange:u,onClick:a,onStateChange:m});case x.$L.const.WIDGET_ARTICLE_GALLERY:return l().createElement(T,{width:t,token:d,isComponentVisible:i,content:e.content,inplace:n,mode:o,onChange:u,onStateChange:m});case x.$L.const.WIDGET_ARTICLE_ATTACHMENT:return l().createElement(W,{token:d,content:e.content,isComponentVisible:i,inplace:n,mode:o,onChange:u,onStateChange:m});case x.$L.const.WIDGET_ARTICLE_IMAGE:return l().createElement($,{width:null!=t?t:800,token:d,content:e.content,isComponentVisible:i,inplace:n,mode:o,onChange:u,onClick:a,onStateChange:m});case x.$L.const.WIDGET_ARTICLE_TITLE:return l().createElement(I,{isComponentVisible:i,content:e.content,inplace:n,mode:o,onChange:u,onStateChange:m});case x.$L.const.WIDGET_ARTICLE_TEXT:return l().createElement(k,{content:e.content,isComponentVisible:i,inplace:n,mode:o,onChange:u,onStateChange:m})}};var _=n(349);const A={"widget-article-image":{accept:"image/png, image/jpeg, image/jpg",multiple:!1,label:"WIDGET_Article_Image_Empty_Label",description:"WIDGET_Article_Image_Empty_Description"},"widget-article-gallery":{accept:"image/png, image/jpeg, image/jpg",multiple:!0,label:"WIDGET_Article_Gallery_Empty_Label",description:"WIDGET_Article_Attachment_Empty_Description"},"widget-article-attachment":{accept:"*",multiple:!0,label:"WIDGET_Article_Attachment_Empty_Label",description:"WIDGET_Article_Attachment_Empty_Description"}};var D=n(6),F=n(816);const R=f.default.registry.getLazyComponent("DEPRECATEDFormInputFile"),G=({uniqid:e,initialFiles:t,accept:n,label:i,description:o,multiple:a,token:r,allowAutoOpening:c,onChange:s})=>{const d=(0,b.useDispatch)(),u=(0,b.useSelector)((t=>t.widgets.currentEditableWidgetId===e),b.shallowEqual),m=l().useRef(null),[g,p]=l().useState(0),[E,f]=l().useState(0),[y,v]=l().useState(null!=t?t:[]);return l().useEffect((()=>{g===E&&d(x.$L.slice.actions.setWidgetState({uniqid:e,loading:!1}))}),[g]),l().useEffect((()=>{s(y.map((e=>e)))}),[y]),l().useEffect((()=>{var t;u&&c&&(null===(t=m.current)||void 0===t||t.click(),d(x.$L.slice.actions.setWidgetState({uniqid:e,mounted:!0})))}),[u]),l().createElement(l().Fragment,null,l().createElement(F.JRCWidgetEmptyInplace,{url:"widget-article-image-placeholder.png",label:i,description:o,onClick:()=>{var e;u&&(null===(e=m.current)||void 0===e||e.click())}}),l().createElement("div",{style:{height:0,width:0,overflow:"hidden"}},l().createElement(R,{ref:m,id:"widget-upload-file",name:"editorFiles",content:"",accept:n,multiple:a,token:r,onUploadStart:t=>{void 0!==t&&f((e=>e+t)),d(x.$L.slice.actions.setWidgetState({uniqid:e,loading:!0}))},onUploadSuccess:t=>{p((e=>e+1)),void 0!==t&&v((e=>[...e,(0,D.apiFileToWidgetFile)(t)])),a||d(x.$L.slice.actions.setWidgetState({uniqid:e,loading:!1}))}})))},O=c().div`
6
- position: relative;
7
- inset: 0;
8
- display: flex;
9
- flex: 1;
10
- min-height: 180px;
11
- `,j=({uniqid:e,mode:t})=>{var n;const i=(0,b.useDispatch)(),o=(0,b.useSelector)((t=>x.$L.selectors.selectWidget(t,e))),a=(0,b.useSelector)((t=>t.widgets.currentEditableWidgetId===e),b.shallowEqual),r=(0,b.useSelector)(x.$L.selectors.selectToken);if(l().useEffect((()=>{a&&(null==o?void 0:o.widget.name)&&(i(x.Wq.slice.actions.flushAllEditor()),i(x.Wq.slice.actions.registerEditor({uniqid:e,name:null==o?void 0:o.widget.name})))}),[a]),void 0===o)return l().createElement(l().Fragment,null);const c=A&&A[null==o?void 0:o.widget.name]?A[null==o?void 0:o.widget.name].label:"",s=A&&A[null==o?void 0:o.widget.name]?A[null==o?void 0:o.widget.name].description:"",d=A&&A[null==o?void 0:o.widget.name]?A[null==o?void 0:o.widget.name].accept:"",u=!(!A||!A[null==o?void 0:o.widget.name])&&A[null==o?void 0:o.widget.name].multiple;switch(null==o?void 0:o.widget.name){case"widget-article-gallery":const a=o.widget.content.files;return void 0!==r&&"edit"===t?l().createElement("div",{style:{marginTop:(null==a?void 0:a.length)?24:0}},l().createElement(O,null,l().createElement(G,{label:c,description:s,initialFiles:[],accept:d,multiple:u,uniqid:e,token:r,allowAutoOpening:!(null==a?void 0:a.length),onChange:t=>{Array.isArray(t)&&t.forEach((t=>{i(x.$L.slice.actions.updateWidget({uniqid:e,content:{files:a?[...a,t]:[t]}}))}))}}))):l().createElement(l().Fragment,null);case"widget-article-attachment":const m=o.widget.content.files;return void 0!==r&&"edit"===t?l().createElement("div",{style:{marginTop:(null==m?void 0:m.length)?24:0}},l().createElement(O,null,l().createElement(G,{label:c,description:s,initialFiles:null!=m?m:[],accept:d,multiple:u,uniqid:e,token:r,allowAutoOpening:!(null==m?void 0:m.length),onChange:t=>{Array.isArray(t)&&i(x.$L.slice.actions.updateWidget({uniqid:e,content:{files:t}}))}}))):l().createElement(l().Fragment,null);case"widget-article-image":return void 0===r||"edit"!==t||o.widget.content.file?l().createElement("div",{style:{position:"absolute",inset:0},onClick:()=>{i(x.Wq.slice.actions.flushAllEditor()),i(x.Wq.slice.actions.registerEditor({uniqid:e,name:null==o?void 0:o.widget.name}))}}):l().createElement(l().Fragment,null,l().createElement(O,null,l().createElement(G,{label:c,description:s,initialFiles:null!==(n=o.widget.content.file)&&void 0!==n?n:[],accept:d,multiple:!1,uniqid:e,token:r,allowAutoOpening:!o.widget.content.file,onChange:t=>{t&&t[0]&&i(x.$L.slice.actions.updateWidget({uniqid:e,content:{file:t[0]}}))}})))}return l().createElement(l().Fragment,null)},z=c().div`
12
- position: absolute;
13
- inset: 0;
14
- opacity: ${e=>e.opacity};
15
- background-color: ${e=>e.backgroundColor};
16
- pointer-events: ${e=>e.pointerEvents};
17
- `,M=({uniqid:e,mode:t})=>{const n=(0,b.useSelector)((t=>t.widgets.ids[e].widget.layers),b.shallowEqual);return l().createElement(l().Fragment,null,null==n?void 0:n.map(((e,t)=>l().createElement(V,{uniqid:e,key:t,mode:"edit"}))))},V=({uniqid:e,mode:t})=>{const n=(0,b.useSelector)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(z,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(B,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(z,{opacity:n.visible?1:0,backgroundColor:n.visible?"rgba(255,255,255,.1)":"transparent",pointerEvents:n.locked?"none":"all"},n.widgets.map(((e,t)=>l().createElement(B,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},B=({uniqid:e,layerId:t,mode:n})=>{const i=(0,b.useDispatch)(),o=(0,b.useSelector)((t=>t.widgets.ids[e]),b.shallowEqual),a=(0,b.useSelector)((e=>e.widgets.layers[t]));return o&&a&&a.position?"view"===n?l().createElement("div",{style:{position:"absolute",top:a.position.y,left:a.position.x}},l().createElement(P,{uniqid:e,widget:o,mode:n,inplace:!0})):l().createElement(J,{position:{x:a.position.x,y:a.position.y},onMouseUp:e=>{(a.position&&a.position.x!==e.x||a.position&&a.position.y!==e.y)&&(e=>{i(x.$L.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)}},l().createElement(F.BETA_JRCDoubleClick,{onDoubleTap:()=>((e,t)=>{i(x.Wq.slice.actions.registerEditor({uniqid:e,name:t}))})(o.widget.uniqid,o.widget.name)},l().createElement(P,{uniqid:e,widget:o,mode:n,inplace:!0}))):l().createElement(l().Fragment,null)},J=({position:e,children:t,onMouseUp:n})=>{const[i,o]=l().useState(!1),[a,r]=l().useState({x:0,y:0}),[c,s]=l().useState({x:0,y:0}),[d,u]=l().useState({x:e.x,y:e.y}),m=l().useRef(null),g=l().useCallback((e=>{if(i&&m.current){const t=c.x+(e.clientX-a.x),n=c.y+(e.clientY-a.y);u({x:t,y:n})}}),[i]),p=()=>{o(!1),n({x:d.x,y:d.y})};return l().useEffect((()=>(document.addEventListener("mousemove",g),document.addEventListener("mouseup",p),()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",p)})),[g]),l().createElement("div",{style:{position:"absolute",top:d.y,left:d.x},ref:m,onMouseDown:e=>{o(!0),m.current&&(r({x:e.nativeEvent.clientX,y:e.nativeEvent.clientY}),s({x:d.x,y:d.y}))}},t)},N=({uniqid:e,widget:t,inplace:n=!0,mode:i,width:o})=>{const a=(0,b.useDispatch)(),r=(0,b.useSelector)((t=>x.$L.selectors.selectWidget(t,e))),c=(0,b.useSelector)((t=>{var n;return null===(n=x.$L.selectors.selectWidgetState(t,e))||void 0===n?void 0:n.busy}),b.shallowEqual),s=(0,b.useSelector)((t=>t.widgets.editableMap[e]),b.shallowEqual),d=(0,b.useSelector)((e=>e.widgets.currentEditableWidgetId),b.shallowEqual),u=(0,b.useSelector)((t=>t.widgets.currentEditableWidgetId===e),b.shallowEqual),{ref:m,isComponentVisible:g,setIsComponentVisible:p}=(0,_.I)(!1);if(l().useEffect((()=>{t&&a(x.$L.slice.actions.registerWidget({uniqid:e,widget:t}))}),[]),l().useEffect((()=>{g||e===d&&a(x.$L.slice.actions.setEditableWidgetId({uniqid:void 0}))}),[g]),l().useEffect((()=>{g!==u&&p(u)}),[u]),void 0===r)return l().createElement(l().Fragment,null,"This widget cannot be desplayed");const E=()=>{"edit"===i?f():"widget-article-button"===r.widget.name&&"link"===r.widget.content.openingType&&r.widget.content.openingTypeLink&&window.open(r.widget.content.openingTypeLink.url,r.widget.content.openingTypeLink.target)},f=()=>{if("view"===i)return;const{widget:e}=r;a(x.Wq.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))};return n&&"view"!==i?l().createElement("div",{style:{minWidth:void 0!==o?o:"100%"},ref:m,onClick:()=>{p(!0),s&&(a(x.$L.slice.actions.setEditableIndex({index:s.index})),a(x.$L.slice.actions.setEditableWidgetId({uniqid:e})))}},l().createElement(S,{width:o,widget:r.widget,inplace:n,isComponentVisible:!!(g||c||u),mode:i,onClick:E}),l().createElement(j,{uniqid:e,mode:i}),l().createElement(M,{uniqid:e,mode:i}),l().createElement(L,{name:r.widget.name,uniqid:r.widget.uniqid,inplace:n})):l().createElement("div",{style:{flex:1,display:"flex",minWidth:void 0!==o?o:"100%"},onClick:f},l().createElement(S,{widget:r.widget,isComponentVisible:!1,inplace:n,mode:i,width:o,onClick:E}),l().createElement(M,{uniqid:e,mode:i}),l().createElement(L,{name:r.widget.name,uniqid:r.widget.uniqid,inplace:n}))},P=N,U=c().div`
18
- display: flex;
19
- flex-direction: row;
20
- flex-wrap: wrap;
21
- gap: 10px;
22
- justify-content: center;
23
- `,H=c().div`
24
- border: 1px solid ${e=>e.theme.color.grey2};
25
- border-radius: 8px;
26
- cursor: pointer;
27
- padding: 12px;
28
- position: relative;
29
- opacity: ${e=>e.available?"1":".4"};
30
- pointer-events: ${e=>e.available?"all":"none"};
31
-
32
- .show-on-hover {
33
- position: absolute;
34
- inset: 0;
35
- border-radius: 8px;
36
- justify-content: center;
37
- align-items: center;
38
- display: flex;
39
- opacity: 0;
40
- background-color: #ffffffe6;
41
- }
42
-
43
- &:hover {
44
- .show-on-hover {
45
- opacity: 1;
46
- }
47
- }
48
- `,X=c().div`
49
- border: 2px solid ${e=>e.theme.color.primary};
50
- height: ${e=>e.open?"320":"54"}px;
51
- border-radius: 8px;
52
- display: flex;
53
- justify-content: top;
54
- flex-direction: column;
55
- transition: height 0.4s;
56
- overflow: hidden;
57
- flex-direction: column;
58
- `,Y=c().div`
59
- display: flex;
60
- flex-direction: row;
61
- flex-wrap: wrap;
62
- justify-content: center;
63
- gap: 10px;
64
- `,K=c().div`
65
- min-height: 50px;
66
- display: flex;
67
- justify-content: center;
68
- align-items: center;
69
- cursor: pointer;
70
- color: ${e=>e.theme.color.primary};
71
- `,Q=c().button`
72
- height: 72px;
73
- display: flex;
74
- justify-content: center;
75
- align-items: center;
76
- width: 40%;
77
- border: 1px solid ${e=>e.theme.color.grey2};
78
- border-radius: 8px;
79
- transition: opacity 0.4s ease ${e=>40*e.index}ms;
80
- opacity: ${e=>e.open?1:0};
81
- `,Z=f.default.registry.getLazyComponent("Button"),ee=f.default.registry.getLazyComponent("Modal"),te=({mode:e,children:t,namespace:n="default",onChange:i})=>{const[o,a]=l().useState(!1),r=function(e){return"widget-article-image"===e?[x.$L.definition(x.$L.const.WIDGET_ARTICLE_TITLE),x.$L.definition(x.$L.const.WIDGET_ARTICLE_BUTTON)]:[x.$L.definition(x.$L.const.WIDGET_ARTICLE_TITLE),x.$L.definition(x.$L.const.WIDGET_ARTICLE_TEXT),x.$L.definition(x.$L.const.WIDGET_ARTICLE_IMAGE),x.$L.definition(x.$L.const.WIDGET_ARTICLE_BUTTON),x.$L.definition(x.$L.const.WIDGET_ARTICLE_GALLERY),x.$L.definition(x.$L.const.WIDGET_ARTICLE_ATTACHMENT)]}(n),c=(0,E.useIntl)(),s={open:o,title:"widget builder",showIconClose:!0,portalId:"react-modal",isFullHeight:!0,closeHandler:()=>a(!1)},d=e=>{i(x.$L.factory(e)),a(!1)};return l().createElement(l().Fragment,null,l().createElement(ee,Object.assign({},s),l().createElement(U,null,r.map(((e,t)=>l().createElement(H,{key:t,onClick:()=>d(e.name),available:e.available},l().createElement("img",{src:e.img}),l().createElement("div",{className:"show-on-hover"},c.formatMessage({id:e.label}))))))),"custom"===e&&t?l().createElement("div",{onClick:()=>a(!0)},t):l().createElement(l().Fragment,null),"button"===e?l().createElement(Z,{onClick:()=>a(!0),variant:"outlined",minWidth:"100%"},c.formatMessage({id:"WIDGET_Add_Widget"})):l().createElement(l().Fragment,null),"gallery"===e?l().createElement(U,null,r.map(((e,t)=>l().createElement(H,{key:t,onClick:()=>d(e.name),available:e.available},l().createElement("img",{src:e.img}),l().createElement("div",{className:"show-on-hover"},c.formatMessage({id:e.label})))))):l().createElement(l().Fragment,null),"article"===e?l().createElement(ne,{widgets:r,onClick:d}):l().createElement(l().Fragment,null))},ne=({widgets:e,onClick:t})=>{const[n,i]=l().useState(!1),o=(0,E.useIntl)();return l().createElement(l().Fragment,null,l().createElement(X,{open:n},l().createElement(K,{onClick:()=>i(!n)},o.formatMessage({id:"WIDGET_Add_Widget"})),l().createElement(Y,null,e.map(((e,i)=>l().createElement(Q,{key:e.name,open:n,index:i,onClick:()=>t(e.name)},o.formatMessage({id:e.label})))))))},ie=(c().div`
82
- margin-bottom: 24px;
83
- `,c().div`
84
- margin-bottom: 4px;
85
- `,c().div`
86
- position: absolute;
87
- background-color: ${e=>e.on?"rgba(0,0,0,.1)":"transparent"};
88
- inset: 0;
89
- pointer-events: ${e=>e.on?"all":"none"};
90
- flex: 1;
91
- display: flex;
92
- overflow: hidden;
93
- `),le=c().div`
94
- flex-direction: row;
95
- display: flex;
96
- min-height: 60px;
97
- border-bottom: 1px solid ${e=>e.theme.color.grey2};
98
- `,oe=c().div`
99
- width: 60px;
100
- display: flex;
101
- align-items: center;
102
- justify-content: center;
103
- `,ae=c().div`
104
- flex: 1;
105
- display: flex;
106
- align-items: center;
107
- justify-content: center;
108
- `,re=c().div`
109
- position: absolute;
110
- top: 90px;
111
- right: ${e=>e.visible?"0":"-1000"}px;
112
- width: ${440}px;
113
- bottom: 0;
114
- display: flex;
115
- background-color: ${e=>e.theme.color.white};
116
- flex-direction: row;
117
- transition: all 0.4s;
118
- box-shadow: -1px 1px 10px 0px rgb(0 0 0 / 20%);
119
- `,ce=c().div`
120
- flex: 1;
121
- display: flex;
122
- flex-direction: row;
123
- padding: 12px;
124
- overflow: auto;
125
- `,se=c().div`
126
- width: ${50}px;
127
- padding-top: 60px;
128
- display: flex;
129
- flex-direction: column;
130
- border-right: 1px solid ${e=>e.theme.color.grey2};
131
- `,de=c().button`
132
- border-radius: 4px;
133
- cursor: pointer;
134
- height: 42px;
135
- margin: 4px;
136
- width: 42px;
137
- display: flex;
138
- align-items: center;
139
- justify-content: center;
140
- background-color: ${e=>e.on?e.theme.color.grey1:e.theme.color.white};
141
- &:hover {
142
- background-color: ${e=>e.theme.color.grey1};
143
- }
144
- `,ue=(c().div`
145
- display: flex;
146
- border: 1px solid ${e=>e.theme.color.grey1};
147
- border-radius: ${8}px;
148
- margin-bottom: 24px;
149
- input {
150
- width: 100%;
151
- border: 0;
152
- height: ${50}px;
153
- margin: 0;
154
- }
155
- `,c().div`
156
- display: flex;
157
- flex-direction: row;
158
- padding: 12px;
159
- background-color: ${e=>e.theme.color.grey0};
160
- border-radius: 8px;
161
- margin-bottom: 4px;
162
- `),me=c().div`
163
- display: flex;
164
- flex: 1;
165
- align-items: center;
166
- `,ge=c().div`
167
- width: 40px;
168
- display: flex;
169
- justify-content: center;
170
- align-items: center;
171
- `,pe=(c().div`
172
- flex-direction: row;
173
- display: flex;
174
- align-items: center;
175
- `,c().div`
176
- flex: 1;
177
- display: flex;
178
- align-items: center;
179
- `,({uniqid:e})=>{const t=(0,b.useDispatch)(),n=(0,b.useSelector)((t=>x.Wq.selectors.selectEditor(t,e)));return n&&n.popup&&n.view?l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"white",marginTop:90}},l().createElement(le,null,l().createElement(oe,null),l().createElement(ae,null,"Popup"),l().createElement(oe,null,l().createElement(de,{onClick:()=>{t(x.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(F.JRCIcon,{name:"icon-times",color:"grey2"})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(le,null,l().createElement(F.JRCButton,{onClick:()=>{t(x.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)}),Ee=f.default.registry.getLazyComponent("WidgetArticleTitleEditor"),fe=f.default.registry.getLazyComponent("WidgetArticleImageEditor"),ye=f.default.registry.getLazyComponent("WidgetArticleTextEditor"),ve=f.default.registry.getLazyComponent("WidgetArticleGalleryEditor"),he=f.default.registry.getLazyComponent("WidgetArticleButtonEditor"),we=f.default.registry.getLazyComponent("WidgetArticleAttachmentEditor"),be=({uniqid:e})=>{const t=(0,b.useDispatch)(),n=(0,b.useSelector)(x.$L.selectors.selectToken),i=(0,b.useSelector)((t=>x.$L.selectors.selectWidget(t,e))),o=n=>{i&&t(x.$L.slice.actions.updateWidget({uniqid:e,content:n})),t(x.Wq.slice.actions.flushEditor({uniqid:e}))},a=(n,i)=>t(x.$L.slice.actions.updateWidget({uniqid:e,content:n,override:i})),r=(n,i)=>{t(void 0!==i?x.$L.slice.actions.setWidgetState(Object.assign({uniqid:i},n)):x.$L.slice.actions.setWidgetState(Object.assign({uniqid:e},n)))},c=n=>{t(x.Wq.slice.actions.registerEditorPopup({uniqid:e,view:n}))};switch(null==i?void 0:i.widget.name){default:return l().createElement(l().Fragment,null,"cannot display editor");case x.$L.const.WIDGET_ARTICLE_BUTTON:return l().createElement(he,{content:i.widget.content,onChange:a,onSave:o,onStateChange:r});case x.$L.const.WIDGET_ARTICLE_ATTACHMENT:return l().createElement(we,{token:n,content:i.widget.content,onChange:a,onSave:o,onStateChange:r,onOpen:c});case x.$L.const.WIDGET_ARTICLE_GALLERY:return l().createElement(ve,{token:n,content:i.widget.content,onChange:a,onSave:o,onStateChange:r});case x.$L.const.WIDGET_ARTICLE_TEXT:return l().createElement(ye,{onChange:a,onSave:o,content:i.widget.content});case x.$L.const.WIDGET_ARTICLE_IMAGE:return l().createElement(fe,{content:i.widget.content,token:n,onChange:a,onSave:o,onStateChange:r});case x.$L.const.WIDGET_ARTICLE_TITLE:return l().createElement(Ee,{onChange:a,onSave:o,content:i.widget.content,onOpen:c})}},xe=({uniqid:e})=>{const t=(0,b.useDispatch)(),n=(0,E.useIntl)(),i=(0,b.useSelector)((t=>x.$L.selectors.selectWidgetContent(t,e)));return l().createElement("div",{style:{flex:1}},l().createElement(Ce,{uniqid:e}),i&&i.widgets?i.widgets.map(((o,a)=>{const r=x.$L.definition(o.widget.name);return l().createElement("div",{key:a},l().createElement(ue,null,l().createElement(me,{onClick:()=>((e,n)=>{t(x.Wq.slice.actions.registerEditor({uniqid:e,name:n}))})(o.widget.uniqid,o.widget.name)},n.formatMessage({id:r.label})),l().createElement(ge,{onClick:()=>{i.widgets&&t(x.$L.slice.actions.updateWidget({uniqid:e,content:Object.assign(Object.assign({},i),{widgets:[...i.widgets.filter(((e,t)=>t!==a))]})}))}},l().createElement(F.JRCIcon,{name:"icon-trash"}))))})):l().createElement(l().Fragment,null))},Ce=({uniqid:e})=>{const t=(0,b.useDispatch)(),n=(0,b.useSelector)((t=>t.widgets.ids[e].widget.layers),b.shallowEqual);return l().createElement(l().Fragment,null,l().createElement(F.BETA_JRCDragAndDrop,{onDrag:()=>{},renderEl:(e,t)=>l().createElement(We,{uniqid:e,key:t}),elms:n||[]}),l().createElement(te,{namespace:"default",onChange:n=>{t(x.$L.slice.actions.registerLayer({uniqid:e,widget:n}))},mode:"button"}))},Le=({uniqid:e})=>{const t=(0,b.useDispatch)(),n=(0,b.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(x.$L.slice.actions.updateLayer({uniqid:e,props:{locked:!n.locked}}))}},l().createElement(F.JRCIcon,{name:n.locked?"icon-lock":"icon-unlock"}))},qe=({uniqid:e})=>{const t=(0,b.useDispatch)(),n=(0,b.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(x.$L.slice.actions.updateLayer({uniqid:e,props:{visible:!n.visible}}))}},l().createElement(F.JRCIcon,{name:n.visible?"icon-eye":"icon-eye-slash"}))},Te=({uniqid:e,layerId:t})=>{const n=(0,b.useDispatch)();return l().createElement("div",{onClick:()=>{n(x.$L.slice.actions.flushLayer({uniqid:e,layerId:t}))}},l().createElement(F.JRCIcon,{name:"icon-trash"}))},We=({uniqid:e})=>{const t=(0,b.useSelector)((t=>t.widgets.layers[e]));return l().createElement(l().Fragment,null,t.title,t.widgets.map(((n,i)=>{const o=x.$L.definition(n.widget.name);return l().createElement("div",{style:{flexDirection:"row",display:"flex"},key:i},l().createElement("div",{style:{flex:1,alignItems:"center"}},o.label),l().createElement(Le,{uniqid:e}),l().createElement(qe,{uniqid:e}),l().createElement(Te,{uniqid:n.widget.uniqid,layerId:t.uniqid}))})))},$e=f.default.registry.getLazyComponent("Button"),Ie=({uniqid:e})=>{const t=(0,E.useIntl)(),n=(0,b.useDispatch)(),i=(0,b.useSelector)((t=>x.$L.selectors.selectWidget(t,e))),[a,r]=l().useState(null==i?void 0:i.title),{control:c,watch:s}=(0,o.useForm)({defaultValues:{text:null!=a?a:""},criteriaMode:"all"});return l().useEffect((()=>{const e=s((e=>{r(e.text)}));return()=>e.unsubscribe()}),[s]),i?l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},l().createElement(F.JRCInputText,{name:"text",control:c,placeholder:t.formatMessage({id:"EDITOR_Widget_Wrapper_Title"})}),l().createElement($e,{onClick:()=>{void 0!==a&&(n(x.$L.slice.actions.updateWidgetWrapper({uniqid:e,title:a})),n(x.Wq.slice.actions.flushEditor({uniqid:e})))},variant:"outlined",minWidth:"100%"},t.formatMessage({id:"EDITOR_Save_Widget"}))):l().createElement(l().Fragment,null,"No wrapper")},ke=f.default.registry.getLazyComponent("Icon"),Se=({uniqid:e})=>{const t=(0,E.useIntl)(),n=(0,b.useDispatch)(),i=(0,b.useSelector)((t=>x.Wq.selectors.selectEditor(t,e))),o=x.$L.definition(null==i?void 0:i.name),[a,r]=l().useState(!1),[c,s]=l().useState("default");return l().useEffect((()=>{setTimeout((()=>{r(!0)}),0)})),i?l().createElement("div",{style:{width:440,position:"relative"}},l().createElement(re,{visible:a},l().createElement(se,null,o.panel.useWrapper?l().createElement(de,{on:"wrapper"===c,onClick:()=>s("wrapper")},l().createElement(ke,{name:"icon-font",color:"grey2"})):l().createElement(l().Fragment,null),o.panel.useEditor?l().createElement(de,{on:"default"===c,onClick:()=>s("default")},l().createElement(ke,{name:"icon-pen",color:"grey2"})):l().createElement(l().Fragment,null),o.panel.useWidgets?l().createElement(Ae,{uniqid:e},l().createElement(de,{on:"widgets"===c,onClick:()=>s("widgets")},l().createElement(ke,{name:"icon-sliders",color:"grey2"}))):l().createElement(l().Fragment,null)),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},l().createElement(le,null,l().createElement(_e,{uniqid:e,position:i.position}),l().createElement(ae,null,t.formatMessage({id:o.label})),l().createElement(oe,null,l().createElement(de,{onClick:()=>{n(x.Wq.slice.actions.flushEditor({uniqid:e}))}},l().createElement(ke,{name:"icon-times",color:"grey2"})))),l().createElement(ce,null,"default"===c&&o.panel.useEditor?l().createElement(be,{uniqid:i.uniqid}):l().createElement(l().Fragment,null),"wrapper"===c&&o.panel.useWrapper?l().createElement(Ie,{uniqid:i.uniqid}):l().createElement(l().Fragment,null),"widgets"===c&&o.panel.useWidgets?l().createElement(xe,{uniqid:e,namespace:o.name}):l().createElement(l().Fragment,null)))),(null==i?void 0:i.popup)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},_e=({uniqid:e,position:t})=>{const n=(0,b.useDispatch)();return l().createElement(oe,null,l().createElement(de,{onClick:()=>{n(x.Wq.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(ke,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},Ae=({uniqid:e,children:t})=>{const n=(0,b.useSelector)((t=>x.$L.selectors.selectWidgetState(t,e)));return(null==n?void 0:n.initialized)?t:l().createElement(l().Fragment,null)},De=c().div`
180
- position: absolute;
181
- inset: 0;
182
- pointer-events: none;
183
- z-index: 100;
184
- `,Fe=c().div`
185
- flex: 1;
186
- display: flex;
187
- margintop: ${90}px;
188
- pointer-events: ${e=>e.on?"all":"none"};
189
- `,Re=c().div`
190
- flex: 1;
191
- display: flex;
192
- flex-direction: row;
193
- pointer-events: none;
194
- `,Ge=c().div`
195
- width: ${440}px;
196
- pointer-events: none;
197
- `,Oe=()=>{const e=(0,b.useSelector)(x.Wq.selectors.selectEditors);return l().createElement(De,null,e.map(((e,t)=>"left"===e.position?l().createElement(ie,{on:!1,key:t},l().createElement(Re,null,l().createElement(Se,{uniqid:e.uniqid}),l().createElement(Fe,{on:void 0!==e.popup},l().createElement(pe,{uniqid:e.uniqid})),l().createElement(Ge,null))):l().createElement(ie,{on:!1,key:t},l().createElement(Re,null,l().createElement(Ge,null),l().createElement(Fe,{on:void 0!==e.popup},l().createElement(pe,{uniqid:e.uniqid})),l().createElement(Se,{uniqid:e.uniqid}))))))}}}]);
198
- //# sourceMappingURL=55.bundle.js.map