jamespot-react-core 1.1.116 → 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.
Files changed (63) hide show
  1. package/build/562.bundle.js +235 -0
  2. package/build/562.bundle.js.map +1 -0
  3. package/build/app.bundle.js +541 -571
  4. package/build/app.bundle.js.map +1 -1
  5. package/build/assets/gif.605d1d151a01356b376d5c4ac2f40d19.png +0 -0
  6. package/build/socket.sharedworker.dd3721cc98a91b6cf80a.js +2 -0
  7. package/build/socket.sharedworker.dd3721cc98a91b6cf80a.js.map +1 -0
  8. package/build/src/components/Empty.d.ts +2 -1
  9. package/build/src/components/ExtensionProvider.component.d.ts +2 -2
  10. package/build/src/components/IfAppIsActivated.component.d.ts +1 -1
  11. package/build/src/components/RTProvider.component.d.ts +1 -1
  12. package/build/src/components/Toaster.d.ts +2 -1
  13. package/build/src/components/TwoColLayout.d.ts +5 -5
  14. package/build/src/components/editors/Editor.d.ts +2 -1
  15. package/build/src/components/editors/EditorPopup.d.ts +2 -1
  16. package/build/src/components/editors/EditorTabWidgets.d.ts +2 -1
  17. package/build/src/components/editors/EditorTabWrapper.d.ts +2 -1
  18. package/build/src/components/editors/EditorWrapper.d.ts +2 -1
  19. package/build/src/components/editors/EditorsPortal.d.ts +3 -2
  20. package/build/src/components/editors/style.d.ts +2 -2
  21. package/build/src/components/widgets/Widget.d.ts +3 -2
  22. package/build/src/components/widgets/WidgetLayer/WidgetLayer.d.ts +3 -3
  23. package/build/src/components/widgets/WidgetList/WidgetList.d.ts +5 -3
  24. package/build/src/components/widgets/WidgetState.d.ts +2 -1
  25. package/build/src/components/widgets/WidgetWrapperCore.d.ts +2 -1
  26. package/build/src/components/widgets/components/WidgetUploader.d.ts +15 -0
  27. package/build/src/components/widgets/utils.d.ts +0 -7
  28. package/build/src/components/widgets/wrapper/JRCWidgetArticleAttachmentWrapper.d.ts +10 -0
  29. package/build/src/components/widgets/wrapper/JRCWidgetArticleGalleryWrapper.d.ts +8 -0
  30. package/build/src/components/widgets/wrapper/JRCWidgetArticleImageWrapper.d.ts +8 -0
  31. package/build/src/components/widgets/wrapper/JRCWidgetArticleTitleWrapper.d.ts +11 -0
  32. package/build/src/displayer/DisplayForm.component.d.ts +2 -2
  33. package/build/src/displayer/components/DisplayRender.d.ts +8 -8
  34. package/build/src/displayer/components/inputs/Date.d.ts +3 -2
  35. package/build/src/displayer/components/inputs/DefaultInput.d.ts +2 -1
  36. package/build/src/displayer/components/inputs/InputEmail.d.ts +2 -1
  37. package/build/src/displayer/components/inputs/InputRichText.d.ts +2 -1
  38. package/build/src/displayer/components/inputs/InputSelect.d.ts +3 -2
  39. package/build/src/displayer/components/inputs/InputTaxonomy.d.ts +3 -2
  40. package/build/src/displayer/components/inputs/InputTextarea.d.ts +2 -1
  41. package/build/src/displayer/components/inputs/OrientedLink.d.ts +2 -1
  42. package/build/src/displayer/components/inputs/Radio.d.ts +3 -2
  43. package/build/src/displayer/displayer.utils.d.ts +1 -1
  44. package/build/src/displayer/types.d.ts +14 -14
  45. package/build/src/displayer/useDisplay.d.ts +2 -1
  46. package/build/src/hooks/useWindowDimension.d.ts +2 -2
  47. package/build/src/redux/slice/Generic.actions.d.ts +1 -1
  48. package/build/src/registry/ext-component-list.d.ts +3 -1
  49. package/build/src/registry/types.d.ts +9 -9
  50. package/build/src/utils/translation.d.ts +3 -3
  51. package/build/src/utils/types.d.ts +18 -14
  52. package/package.json +93 -94
  53. package/build/155.bundle.js +0 -198
  54. package/build/155.bundle.js.map +0 -1
  55. package/build/socket.sharedworker.9cc9b5b3f5d4700f41ee.js +0 -2
  56. package/build/socket.sharedworker.9cc9b5b3f5d4700f41ee.js.map +0 -1
  57. package/build/src/components/widgets/WidgetInplace/WidgetInplace.style.d.ts +0 -1
  58. package/build/src/components/widgets/WidgetInplace/WidgetInplaceUpload.d.ts +0 -14
  59. package/build/src/components/widgets/WidgetInplace/WidgetInplaceWrapper.d.ts +0 -6
  60. package/build/src/redux/slice/Article.slice.d.ts +0 -97
  61. package/build/src/redux/slice/User.slice.d.ts +0 -97
  62. package/build/src/redux/store.d.ts +0 -121
  63. package/pnpm-lock.yaml +0 -11173
@@ -8,7 +8,7 @@ import { ReactTranslation, SupportedLanguages, TranslationKeys } from './transla
8
8
  import { AnyRTHandlerFunction } from 'jamespot-user-api';
9
9
  import { TwoColLayoutRoute, TwoColLayoutRoutes } from '../components/types';
10
10
  import { RouteObject } from 'react-router-dom';
11
- export declare type Gabarit = 'core-1-cols' | 'core-2-cols' | 'core-3-cols' | 'content-1-cols' | 'content-2-cols' | 'content-3-cols' | 'app-1-cols' | 'app-2-cols' | 'empty';
11
+ export type Gabarit = 'core-1-cols' | 'core-2-cols' | 'core-3-cols' | 'content-1-cols' | 'content-2-cols' | 'content-3-cols' | 'app-1-cols' | 'app-2-cols' | 'empty';
12
12
  export interface ReactCore {
13
13
  extensions: ReactExtensions;
14
14
  store: any;
@@ -36,7 +36,7 @@ export interface ReactCore {
36
36
  export interface ReactExtensions {
37
37
  [key: string]: any;
38
38
  }
39
- export declare type ReactLoadedExtensions = {
39
+ export type ReactLoadedExtensions = {
40
40
  [key: string]: ReactExtensionContainer | undefined;
41
41
  };
42
42
  export interface ReactExtension {
@@ -46,7 +46,7 @@ export interface ReactExtension {
46
46
  export interface ReactExtensionContainer {
47
47
  default: ReactExtension;
48
48
  }
49
- export declare type ReactSocketEventHandler = AnyRTHandlerFunction;
49
+ export type ReactSocketEventHandler = AnyRTHandlerFunction;
50
50
  export interface ReactSocket {
51
51
  io: any;
52
52
  worker: any | undefined;
@@ -58,7 +58,7 @@ export interface ReactSocket {
58
58
  removeMessageListener: <T extends keyof Namespaces>(namespace: T, functionName: Namespaces[T], callback: ReactSocketEventHandler) => void;
59
59
  callEvent: (type: string, data: any) => void;
60
60
  }
61
- export declare type SocketSharedWorker = {
61
+ export type SocketSharedWorker = {
62
62
  user?: {
63
63
  idUser: number;
64
64
  } | undefined;
@@ -68,18 +68,18 @@ export declare type SocketSharedWorker = {
68
68
  ports: any[];
69
69
  call: (type: string, event: string, data?: any) => void;
70
70
  };
71
- export declare type SocketOptions = {
71
+ export type SocketOptions = {
72
72
  path: string;
73
73
  transports?: string[];
74
74
  upgrade?: boolean;
75
75
  };
76
- export declare type SocketError = {
76
+ export type SocketError = {
77
77
  message: string;
78
78
  };
79
- export declare type ReactSocketNamespaceEvents = {
79
+ export type ReactSocketNamespaceEvents = {
80
80
  [key: string]: ReactSocketEventHandler[];
81
81
  };
82
- export declare type ReactSocketEvents = {
82
+ export type ReactSocketEvents = {
83
83
  [key: string]: {
84
84
  [key: string]: ReactSocketNamespaceEvents | ReactSocketEventHandler[];
85
85
  all: ReactSocketEventHandler[];
@@ -96,7 +96,7 @@ export interface SharedWorkerEventData {
96
96
  export interface JConfig {
97
97
  resourceShowKey?: boolean;
98
98
  }
99
- declare type WindowJNG = {
99
+ type WindowJNG = {
100
100
  html5: boolean;
101
101
  addState: (stateName: string, options: any) => void;
102
102
  transitionTo: (stateName: string, args: {}, options?: {
@@ -112,14 +112,14 @@ declare type WindowJNG = {
112
112
  type?: string;
113
113
  }) => void;
114
114
  };
115
- export declare type JType = {
115
+ export type JType = {
116
116
  cssClass: string;
117
117
  cssColor: string;
118
118
  label: string;
119
119
  type: string;
120
120
  mainType: string;
121
121
  };
122
- declare type Networks = {
122
+ type Networks = {
123
123
  networkPublic: {
124
124
  uri: string;
125
125
  title: string;
@@ -142,13 +142,17 @@ 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
- export declare type IsAppActivateProps = {
151
+ export type IsAppActivateProps = {
148
152
  dependency: string;
149
153
  children: JSX.Element;
150
154
  };
151
- export declare type ReactExtensionProps = {
155
+ export type ReactExtensionProps = {
152
156
  extensionName: string;
153
157
  moduleName?: string;
154
158
  route?: string;
@@ -160,5 +164,5 @@ export declare type ReactExtensionProps = {
160
164
  /**
161
165
  * Gather routes definition both for the router and the TwoColsLayout component.
162
166
  */
163
- export declare type TwoColsAppRoutes = TwoColLayoutRoutes<Readable<TwoColLayoutRoute & RouteObject>>;
167
+ export type TwoColsAppRoutes = TwoColLayoutRoutes<Readable<TwoColLayoutRoute & RouteObject>>;
164
168
  export {};
package/package.json CHANGED
@@ -1,95 +1,94 @@
1
1
  {
2
- "name": "jamespot-react-core",
3
- "version": "1.1.116",
4
- "description": "Jamespot React Core",
5
- "main": "./build/app.bundle.js",
6
- "types": "./build/src/App.d.ts",
7
- "scripts": {
8
- "dev": "webpack --env NODE_ENV=development",
9
- "local": "webpack s --env NODE_ENV=development",
10
- "build": "webpack --env NODE_ENV=production",
11
- "build-theme": "webpack --env NODE_ENV=theme",
12
- "build-dev-vm": "webpack --env NODE_ENV=development NODE_RUN=VM",
13
- "watch-dev-vm": "webpack --env NODE_ENV=development NODE_RUN=VM WATCH=true",
14
- "prettier": "npx prettier --write ./",
15
- "lint": "npx eslint . --ext .ts,.tsx,.js",
16
- "lint:fix": "npx eslint . --ext .ts,.tsx,.js --fix ",
17
- "lint:ci": "npx eslint --output-file eslint_report.json --format json . --ext .ts,.tsx,.js",
18
- "generate-component-list": "node script/component-list-generator.js",
19
- "test": "jest",
20
- "test:watch": "npm run test -- --watch",
21
- "versions": "node -v && npm -v && webpack -v",
22
- "prepare": "husky install"
23
- },
24
- "devDependencies": {
25
- "@babel/core": "^7.12.8",
26
- "@babel/preset-env": "^7.12.7",
27
- "@babel/preset-react": "^7.12.7",
28
- "@types/jest": "^27.0.2",
29
- "@types/node": "^20.3.1",
30
- "@types/react": "^17.0.2",
31
- "@types/react-dom": "^17.0.2",
32
- "@types/react-redux": "^7.1.24",
33
- "@types/react-router-dom": "^5.3.3",
34
- "@types/react-test-renderer": "^17.0.1",
35
- "@types/react-transition-group": "^4.4.1",
36
- "@types/redux-form": "^8.3.5",
37
- "@types/socket.io-client": "^3.0.0",
38
- "@types/styled-components": "^5.1.4",
39
- "@typescript-eslint/eslint-plugin": "^5.4.0",
40
- "@typescript-eslint/parser": "^5.4.0",
41
- "babel-jest": "^27.3.1",
42
- "babel-loader": "^8.2.1",
43
- "copy-webpack-plugin": "^6.4.0",
44
- "enzyme": "^3.11.0",
45
- "enzyme-to-json": "^3.5.0",
46
- "eslint": "^8.2.0",
47
- "eslint-config-prettier": "^8.3.0",
48
- "file-loader": "^6.2.0",
49
- "husky": "^7.0.4",
50
- "identity-obj-proxy": "^3.0.0",
51
- "jest": "^27.3.1",
52
- "lint-staged": "^12.0.2",
53
- "mini-css-extract-plugin": "^0.10.0",
54
- "prettier": "^2.4.1",
55
- "react-test-renderer": "^17.0.1",
56
- "source-map-loader": "^1.0.1",
57
- "ts-jest": "^27.0.7",
58
- "ts-loader": "^8.0.2",
59
- "ts-node": "^10.3.0",
60
- "typescript": "^4.4.4",
61
- "webpack": "^5.62.1",
62
- "webpack-cli": "^4.9.1",
63
- "webpack-dev-server": "^4.4.0",
64
- "worker-loader": "^3.0.8"
65
- },
66
- "dependencies": {
67
- "@reduxjs/toolkit": "^1.9.0",
68
- "history": "^5.3.0",
69
- "jamespot-front-business": "^1.1.21",
70
- "jamespot-react-components": "^1.0.145",
71
- "jamespot-user-api": "^1.0.115",
72
- "react": "^17.0.2",
73
- "react-dom": "^17.0.2",
74
- "react-hook-form": "^7.25.0",
75
- "react-intl": "^5.8.6",
76
- "react-redux": "^7.2.9",
77
- "react-router-dom": "^6.2.1",
78
- "react-select": "^3.2.0",
79
- "react-transition-group": "^4.4.1",
80
- "redux": "^4.2.0",
81
- "redux-form": "^8.3.8",
82
- "redux-thunk": "^2.4.2",
83
- "socket.io-client": "^4.2.0",
84
- "styled-components": "^5.2.1"
85
- },
86
- "lint-staged": {
87
- "*.{js,jsx,ts,tsx}": [
88
- "npm run lint:fix",
89
- "npm run prettier"
90
- ],
91
- "*.{json,md}": [
92
- "npm run prettier"
93
- ]
94
- }
95
- }
2
+ "name": "jamespot-react-core",
3
+ "version": "1.1.118",
4
+ "description": "Jamespot React Core",
5
+ "main": "./build/app.bundle.js",
6
+ "types": "./build/src/App.d.ts",
7
+ "devDependencies": {
8
+ "@babel/core": "^7.12.8",
9
+ "@babel/preset-env": "^7.12.7",
10
+ "@babel/preset-react": "^7.12.7",
11
+ "@types/jest": "^27.0.2",
12
+ "@types/node": "^20.3.1",
13
+ "@types/react": "^17.0.2",
14
+ "@types/react-dom": "^17.0.2",
15
+ "@types/react-redux": "^7.1.24",
16
+ "@types/react-router-dom": "^5.3.3",
17
+ "@types/react-test-renderer": "^17.0.1",
18
+ "@types/react-transition-group": "^4.4.1",
19
+ "@types/redux-form": "^8.3.5",
20
+ "@types/socket.io-client": "^3.0.0",
21
+ "@types/styled-components": "^5.1.4",
22
+ "@typescript-eslint/eslint-plugin": "^5.4.0",
23
+ "@typescript-eslint/parser": "^5.4.0",
24
+ "babel-jest": "^27.3.1",
25
+ "babel-loader": "^8.2.1",
26
+ "copy-webpack-plugin": "^6.4.0",
27
+ "enzyme": "^3.11.0",
28
+ "enzyme-to-json": "^3.5.0",
29
+ "eslint": "^8.2.0",
30
+ "eslint-config-prettier": "^8.3.0",
31
+ "file-loader": "^6.2.0",
32
+ "husky": "^7.0.4",
33
+ "identity-obj-proxy": "^3.0.0",
34
+ "jest": "^27.3.1",
35
+ "lint-staged": "^12.0.2",
36
+ "mini-css-extract-plugin": "^0.10.0",
37
+ "prettier": "^2.4.1",
38
+ "react-test-renderer": "^17.0.1",
39
+ "source-map-loader": "^1.0.1",
40
+ "ts-jest": "^27.0.7",
41
+ "ts-loader": "^8.0.2",
42
+ "ts-node": "^10.3.0",
43
+ "typescript": "^4.4.4",
44
+ "webpack": "^5.62.1",
45
+ "webpack-cli": "^4.9.1",
46
+ "webpack-dev-server": "^4.4.0",
47
+ "worker-loader": "^3.0.8"
48
+ },
49
+ "dependencies": {
50
+ "@reduxjs/toolkit": "^1.9.0",
51
+ "history": "^5.3.0",
52
+ "jamespot-front-business": "^1.1.23",
53
+ "jamespot-react-components": "^1.0.147",
54
+ "jamespot-user-api": "^1.0.119",
55
+ "react": "^17.0.2",
56
+ "react-dom": "^17.0.2",
57
+ "react-hook-form": "^7.25.0",
58
+ "react-intl": "^5.8.6",
59
+ "react-redux": "^7.2.9",
60
+ "react-router-dom": "^6.2.1",
61
+ "react-select": "^3.2.0",
62
+ "react-transition-group": "^4.4.1",
63
+ "redux": "^4.2.0",
64
+ "redux-form": "^8.3.8",
65
+ "redux-thunk": "^2.4.2",
66
+ "socket.io-client": "^4.2.0",
67
+ "styled-components": "^5.2.1"
68
+ },
69
+ "lint-staged": {
70
+ "*.{js,jsx,ts,tsx}": [
71
+ "npm run lint:fix",
72
+ "npm run prettier"
73
+ ],
74
+ "*.{json,md}": [
75
+ "npm run prettier"
76
+ ]
77
+ },
78
+ "scripts": {
79
+ "dev": "webpack --env NODE_ENV=development",
80
+ "local": "webpack s --env NODE_ENV=development",
81
+ "build": "webpack --env NODE_ENV=production",
82
+ "build-theme": "webpack --env NODE_ENV=theme",
83
+ "build-dev-vm": "webpack --env NODE_ENV=development NODE_RUN=VM",
84
+ "watch-dev-vm": "webpack --env NODE_ENV=development NODE_RUN=VM WATCH=true",
85
+ "prettier": "npx prettier --write ./",
86
+ "lint": "npx eslint . --ext .ts,.tsx,.js",
87
+ "lint:fix": "npx eslint . --ext .ts,.tsx,.js --fix ",
88
+ "lint:ci": "npx eslint --output-file eslint_report.json --format json . --ext .ts,.tsx,.js",
89
+ "generate-component-list": "node script/component-list-generator.js",
90
+ "test": "jest",
91
+ "test:watch": "npm run test -- --watch",
92
+ "versions": "node -v && npm -v && webpack -v"
93
+ }
94
+ }
@@ -1,198 +0,0 @@
1
- "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[155],{1155:(e,t,n)=>{n.r(t),n.d(t,{DisplayForm:()=>m,EditorsPortal:()=>Oe,Empty:()=>g,TwoColLayout:()=>w,WidgetList:()=>te,WidgetWrapperCore:()=>N});var i=n(7363),l=n.n(i),o=n(3230),a=n(7375),r=n(6754),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(2248),E=n(5181),f=n(8804);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(1773);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(3904);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(997);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=155.bundle.js.map