jamespot-react-core 1.1.12 → 1.1.13

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 (47) hide show
  1. package/.github/workflows/deploy-dev-branches.yml +1 -1
  2. package/.github/workflows/increment-npm-version.yml +26 -0
  3. package/.github/workflows/npm-package.yml +1 -1
  4. package/.husky/pre-commit +0 -2
  5. package/build/294.bundle.js +1 -1
  6. package/build/294.bundle.js.map +1 -1
  7. package/build/715.bundle.js +1 -1
  8. package/build/715.bundle.js.map +1 -1
  9. package/build/76.bundle.js +2 -0
  10. package/build/76.bundle.js.map +1 -0
  11. package/build/862.bundle.js +2 -0
  12. package/build/862.bundle.js.map +1 -0
  13. package/build/955.bundle.js +2 -0
  14. package/build/955.bundle.js.map +1 -0
  15. package/build/App.d.ts +4 -3
  16. package/build/app.bundle.js +41 -41
  17. package/build/app.bundle.js.map +1 -1
  18. package/build/components/AppStateLoader.component.d.ts +7 -0
  19. package/build/components/types.d.ts +1 -0
  20. package/build/displayer/DisplayForm.component.d.ts +19 -0
  21. package/build/displayer/Empty.d.ts +1 -0
  22. package/build/displayer/components/DisplaySingleValue.component.d.ts +1 -0
  23. package/build/displayer/list/formatter.d.ts +112 -10
  24. package/build/displayer/types.d.ts +54 -2
  25. package/build/redux/slice/AppState.slice.d.ts +29 -0
  26. package/build/redux/slice/Application.slice.d.ts +6 -0
  27. package/build/redux/slice/Article.slice.d.ts +6 -0
  28. package/build/redux/slice/Model.slice.d.ts +6 -0
  29. package/build/redux/slice/Toast.slice.d.ts +6 -0
  30. package/build/redux/slice/User.slice.d.ts +6 -0
  31. package/build/redux/store.d.ts +8 -1
  32. package/build/utils/types.d.ts +14 -5
  33. package/package.json +6 -5
  34. package/src/App.tsx +41 -8
  35. package/src/components/AppStateLoader.component.tsx +54 -0
  36. package/src/components/index.tsx +10 -0
  37. package/src/components/types.ts +1 -0
  38. package/src/displayer/DisplayAttribute.component.tsx +1 -2
  39. package/src/displayer/DisplayForm.component.tsx +78 -0
  40. package/src/displayer/Empty.tsx +4 -0
  41. package/src/displayer/components/DisplaySingleValue.component.tsx +6 -0
  42. package/src/displayer/list/formatter.tsx +182 -14
  43. package/src/displayer/types.ts +60 -2
  44. package/src/displayer/useDisplay.ts +32 -15
  45. package/src/redux/slice/AppState.slice.ts +25 -0
  46. package/src/redux/store.tsx +27 -21
  47. package/src/utils/types.ts +15 -5
@@ -1,4 +1,4 @@
1
- name: deploy-dev-branch
1
+ name: remote-stable
2
2
 
3
3
  on:
4
4
  push:
@@ -0,0 +1,26 @@
1
+ name: remote-stable
2
+ on:
3
+ push:
4
+ branches: [develop]
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - uses: actions/checkout@master
11
+ - name: Select Node v. 16.x (and thus npm v. 7.x)
12
+ uses: actions/setup-node@v2
13
+ with:
14
+ node-version: 16.x
15
+ - name: 🔨 set git
16
+ run: |
17
+ git config --local user.email "githubaction@localhost"
18
+ git config --local user.name "githubaction"
19
+ - name: 🔨 update package
20
+ run: |
21
+ npm version patch -m "v%s"
22
+ - name: Push changes on branches
23
+ uses: ad-m/github-push-action@master
24
+ with:
25
+ github_token: ${{ secrets.ONE_TOKEN_TO_RULE_THEM_ALL }}
26
+ force: true
@@ -1,4 +1,4 @@
1
- name: publish-npm-version
1
+ name: remote-stable
2
2
 
3
3
  on:
4
4
  push:
package/.husky/pre-commit CHANGED
@@ -1,6 +1,4 @@
1
1
  #!/bin/sh
2
2
  . "$(dirname "$0")/_/husky.sh"
3
3
 
4
- npm version patch --no-git-tag-version
5
-
6
4
  npx lint-staged --allow-empty
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[294],{294:(e,c,t)=>{t.r(c),t.d(c,{IfAppIsActivated:()=>n});var s=t(855);const n=e=>{const{isDependencyActivated:c}=(0,s.useSelector)((c=>({isDependencyActivated:J.react.store.selectors.application.selectById(c,e.dependency)})));return c?e.children:null}}}]);
1
+ "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[294],{7294:(e,c,t)=>{t.r(c),t.d(c,{IfAppIsActivated:()=>n});var s=t(855);const n=e=>{const{isDependencyActivated:c}=(0,s.useSelector)((c=>({isDependencyActivated:J.react.store.selectors.application.selectById(c,e.dependency)})));return c?e.children:null}}}]);
2
2
  //# sourceMappingURL=294.bundle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"294.bundle.js","mappings":"wJAOO,MAAMA,EAAoBC,IAC7B,MAAM,sBAAEC,IAA0B,IAAAC,cAAaC,IACpC,CACHF,sBAAuBG,EAAEC,MAAMC,MAAMC,UAAUC,YAAYC,WAAWN,EAAOH,EAAMU,gBAG3F,OAAOT,EAAwBD,EAAMW,SAAW","sources":["webpack://ReactCore/./src/components/IfAppIsActivated.component.tsx"],"sourcesContent":["import { useSelector } from 'react-redux';\n\nexport type IfAppIsActivatedProps = {\n dependency: string;\n children: JSX.Element;\n};\n\nexport const IfAppIsActivated = (props: IfAppIsActivatedProps) => {\n const { isDependencyActivated } = useSelector((state: any) => {\n return {\n isDependencyActivated: J.react.store.selectors.application.selectById(state, props.dependency),\n };\n });\n return isDependencyActivated ? props.children : null;\n};\n"],"names":["IfAppIsActivated","props","isDependencyActivated","useSelector","state","J","react","store","selectors","application","selectById","dependency","children"],"sourceRoot":""}
1
+ {"version":3,"file":"294.bundle.js","mappings":"yJAOO,MAAMA,EAAoBC,IAC7B,MAAM,sBAAEC,IAA0B,IAAAC,cAAaC,IACpC,CACHF,sBAAuBG,EAAEC,MAAMC,MAAMC,UAAUC,YAAYC,WAAWN,EAAOH,EAAMU,gBAG3F,OAAOT,EAAwBD,EAAMW,SAAW","sources":["webpack://ReactCore/./src/components/IfAppIsActivated.component.tsx"],"sourcesContent":["import { useSelector } from 'react-redux';\n\nexport type IfAppIsActivatedProps = {\n dependency: string;\n children: JSX.Element;\n};\n\nexport const IfAppIsActivated = (props: IfAppIsActivatedProps) => {\n const { isDependencyActivated } = useSelector((state: any) => {\n return {\n isDependencyActivated: J.react.store.selectors.application.selectById(state, props.dependency),\n };\n });\n return isDependencyActivated ? props.children : null;\n};\n"],"names":["IfAppIsActivated","props","isDependencyActivated","useSelector","state","J","react","store","selectors","application","selectById","dependency","children"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[715],{715:(e,t,n)=>{n.r(t),n.d(t,{DisplayAttributes:()=>c});var r=n(363);const s=e=>{const{attribute:t}=e,n=t.components.render,s=t.components.wrapper;return r.createElement(s,null,r.createElement(n,Object.assign({},e)))},c=e=>{const{attributesName:t,object:n,componentsOverride:c}=e;return J.react.useDisplay(t||[],n.type).map((e=>{if(e)return e.components=Object.assign(Object.assign({},e.components),c&&c[e.name]),r.createElement(s,{attribute:e,object:n})}))}}}]);
1
+ "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[715],{715:(e,t,n)=>{n.r(t),n.d(t,{DisplayAttributes:()=>c});var r=n(7363);const s=e=>{const{attribute:t}=e,n=t.components.render,s=t.components.wrapper;return r.createElement(s,null,r.createElement(n,Object.assign({},e)))},c=e=>{const{attributesName:t,object:n,componentsOverride:c}=e;return J.react.useDisplay(t||[],n.type).map((e=>{if(e)return e.components=Object.assign(Object.assign({},e.components),c&&c[e.name]),r.createElement(s,{attribute:e,object:n})}))}}}]);
2
2
  //# sourceMappingURL=715.bundle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"715.bundle.js","mappings":"yJAOA,MAAMA,EAAmBC,IACrB,MAAM,UAAEC,GAAcD,EAChBE,EAA2DD,EAAUE,WAAWC,OAChFC,EAAiDJ,EAAUE,WAAWG,QAE5E,OACI,gBAACD,EAAgB,KACb,gBAACH,EAAe,iBAAKF,MAoBpBO,EAAqBP,IAC9B,MAAM,eAAEQ,EAAc,OAAEC,EAAM,mBAAEC,GAAuBV,EAGvD,OAFeW,EAAEC,MAAMC,WAAWL,GAAkB,GAAIC,EAAOK,MAEjDC,KAAKC,IACf,GAAKA,EAKL,OAJAA,EAAeb,WAAa,OAAH,wBAClBa,EAAeb,YACdO,GAAsBA,EAAmBM,EAAeC,OAEzD,gBAAClB,EAAe,CAACE,UAAWe,EAAgBP,OAAQA","sources":["webpack://ReactCore/./src/displayer/DisplayAttribute.component.tsx"],"sourcesContent":["import * as React from 'react';\nimport { FunctionComponent } from 'react';\nimport { DisplayAttributesProps, RenderAttributeProps } from './types';\n\n/***\n * Choose the component to render according to the type of the object\n */\nconst RenderAttribute = (props: RenderAttributeProps) => {\n const { attribute } = props;\n const RenderComponent: FunctionComponent<RenderAttributeProps> = attribute.components.render;\n const WrapperComponent: React.FunctionComponent<any> = attribute.components.wrapper;\n\n return (\n <WrapperComponent>\n <RenderComponent {...props} />\n </WrapperComponent>\n );\n};\n\n/****\n * The jamespot model depend on the platform\n * For example a user can have the size attribute only for a given platform\n * The model specifics of a platform are stored in J.model\n *\n * This component display an array of attributes only if this attribute is activated on the platform\n *\n * @param props.object the object to display (ie the user)\n * @param props.attributesName an array of string : the list of attributes we want to display\n * @param props.componentsOverride we can override the default render of the attribute\n * @param props.componentsOverride.render the whole component logic (we override @DisplayList or @DisplaySingleValue for exemple)\n * @param props.componentsOverride.wrapper the attribute is wrapped inside an element. For a list it can be an UL\n * @param props.componentsOverride.element the component just above the element value\n * Note :If we override the \"render\" you can't override \"wrapper\" and \"element\" because the render rewrite everything\n */\nexport const DisplayAttributes = (props: DisplayAttributesProps) => {\n const { attributesName, object, componentsOverride } = props;\n const config = J.react.useDisplay(attributesName || [], object.type);\n\n return config.map((attributeProps) => {\n if (!attributeProps) return;\n attributeProps.components = {\n ...attributeProps.components,\n ...(componentsOverride && componentsOverride[attributeProps.name]),\n };\n return <RenderAttribute attribute={attributeProps} object={object} />;\n });\n};\n"],"names":["RenderAttribute","props","attribute","RenderComponent","components","render","WrapperComponent","wrapper","DisplayAttributes","attributesName","object","componentsOverride","J","react","useDisplay","type","map","attributeProps","name"],"sourceRoot":""}
1
+ {"version":3,"file":"715.bundle.js","mappings":"0JAMA,MAAMA,EAAmBC,IACrB,MAAM,UAAEC,GAAcD,EAChBE,EAAiED,EAAUE,WAAWC,OACtFC,EAAiDJ,EAAUE,WAAWG,QAE5E,OACI,gBAACD,EAAgB,KACb,gBAACH,EAAe,iBAAKF,MAoBpBO,EAAqBP,IAC9B,MAAM,eAAEQ,EAAc,OAAEC,EAAM,mBAAEC,GAAuBV,EAGvD,OAFeW,EAAEC,MAAMC,WAAWL,GAAkB,GAAIC,EAAOK,MAEjDC,KAAKC,IACf,GAAKA,EAKL,OAJAA,EAAeb,WAAa,OAAH,wBAClBa,EAAeb,YACdO,GAAsBA,EAAmBM,EAAeC,OAEzD,gBAAClB,EAAe,CAACE,UAAWe,EAAgBP,OAAQA","sources":["webpack://ReactCore/./src/displayer/DisplayAttribute.component.tsx"],"sourcesContent":["import * as React from 'react';\nimport { DisplayAttributesProps, RenderAttributeProps } from './types';\n\n/***\n * Choose the component to render according to the type of the object\n */\nconst RenderAttribute = (props: RenderAttributeProps) => {\n const { attribute } = props;\n const RenderComponent: React.FunctionComponent<RenderAttributeProps> = attribute.components.render;\n const WrapperComponent: React.FunctionComponent<any> = attribute.components.wrapper;\n\n return (\n <WrapperComponent>\n <RenderComponent {...props} />\n </WrapperComponent>\n );\n};\n\n/****\n * The jamespot model depend on the platform\n * For example a user can have the size attribute only for a given platform\n * The model specifics of a platform are stored in J.model\n *\n * This component display an array of attributes only if this attribute is activated on the platform\n *\n * @param props.object the object to display (ie the user)\n * @param props.attributesName an array of string : the list of attributes we want to display\n * @param props.componentsOverride we can override the default render of the attribute\n * @param props.componentsOverride.render the whole component logic (we override @DisplayList or @DisplaySingleValue for exemple)\n * @param props.componentsOverride.wrapper the attribute is wrapped inside an element. For a list it can be an UL\n * @param props.componentsOverride.element the component just above the element value\n * Note :If we override the \"render\" you can't override \"wrapper\" and \"element\" because the render rewrite everything\n */\nexport const DisplayAttributes = (props: DisplayAttributesProps) => {\n const { attributesName, object, componentsOverride } = props;\n const config = J.react.useDisplay(attributesName || [], object.type);\n\n return config.map((attributeProps) => {\n if (!attributeProps) return;\n attributeProps.components = {\n ...attributeProps.components,\n ...(componentsOverride && componentsOverride[attributeProps.name]),\n };\n return <RenderAttribute attribute={attributeProps} object={object} />;\n });\n};\n"],"names":["RenderAttribute","props","attribute","RenderComponent","components","render","WrapperComponent","wrapper","DisplayAttributes","attributesName","object","componentsOverride","J","react","useDisplay","type","map","attributeProps","name"],"sourceRoot":""}
@@ -0,0 +1,2 @@
1
+ "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[76],{3076:(e,t,n)=>{n.r(t),n.d(t,{DisplayForm:()=>c});var a=n(7363),r=n(3230),s=n(5181);const o=e=>a.createElement(e.components.input,Object.assign({},e)),c=a.forwardRef(((e,t)=>{const n=(0,s.useIntl)(),c=a.useRef(null),{attributesName:l,object:i,componentsOverride:u}=e,m=J.react.useDisplay(l||[],i.type),p=J.react.registry.getLazyComponent("ValidationButton"),{handleSubmit:b,control:d,reset:f}=(0,r.useForm)({defaultValues:Object.assign({},Object.fromEntries(m.map((e=>[e.accessor,"checkbox"===e.widget.type?[]:""])))),criteriaMode:"all"});return a.useImperativeHandle(t,(()=>({reset:()=>{var e;null===(e=null==c?void 0:c.current)||void 0===e||e.scrollTo(0,0),f()}})),[]),a.createElement("form",{onSubmit:b(e.onSubmit),ref:c},m.map(((e,t)=>(e.components=Object.assign(Object.assign({},e.components),null==u?void 0:u[e.name]),a.createElement(o,Object.assign({key:t,control:d},e))))),a.createElement(p,{type:"submit"},n.formatMessage({id:"APP_ASEI_Modal_Creation_Title"})))}))}}]);
2
+ //# sourceMappingURL=76.bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"76.bundle.js","mappings":"wKASA,MAAMA,EAAeC,GAA4B,gBAACA,EAAMC,WAAWC,MAAK,iBAAKF,IAkBhEG,EAAc,cAAmD,CAACH,EAAOI,KAClF,MAAMC,GAAO,IAAAC,WAEPC,EAAU,SAA8B,OAExC,eAAEC,EAAc,OAAEC,EAAM,mBAAEC,GAAuBV,EACjDW,EAAaC,EAAEC,MAAMC,WAAWN,GAAkB,GAAIC,EAAOM,MAC7DC,EAAmBJ,EAAEC,MAAMI,SAASC,iBAAiC,qBAErE,aAAEC,EAAY,QAAEC,EAAO,MAAEC,IAAU,IAAAC,SAAQ,CAC7CC,cAAe,OAAF,UAELC,OAAeC,YACfd,EAAWe,KAAKC,GAAgB,CAC5BA,EAAYC,SACgB,aAA5BD,EAAYE,OAAOd,KAAsB,GAAK,QAI1De,aAAc,QAgBlB,OAbA,sBACI1B,GACA,KAAM,CACFiB,MAAO,K,MAEa,QAAhB,EAAAd,MAAAA,OAAO,EAAPA,EAASwB,eAAO,SAAEC,SAAS,EAAG,GAE9BX,QAGR,IAIA,wBAAMY,SAAUd,EAAanB,EAAMiC,UAAW7B,IAAKG,GAC9CI,EAAWe,KAAI,CAACC,EAAaO,KAC1BP,EAAY1B,WAAa,OAAH,wBACf0B,EAAY1B,YACZS,MAAAA,OAAkB,EAAlBA,EAAqBiB,EAAYQ,OAEjC,gBAACpC,EAAW,eAACqC,IAAKF,EAAOd,QAASA,GAAaO,OAG1D,gBAACX,EAAgB,CAACD,KAAK,UAClBV,EAAKgC,cAAc,CAAEC,GAAI","sources":["webpack://ReactCore/./src/displayer/DisplayForm.component.tsx"],"sourcesContent":["import * as React from 'react';\nimport { DisplayFormProps, DisplayFormRef, RenderInputProps } from './types';\nimport { useForm } from 'react-hook-form';\nimport type { JRCButtonProps } from 'jamespot-react-components';\nimport { useIntl } from 'react-intl';\n\n/***\n * Choose the component to render according to the type of the object\n */\nconst RenderInput = (props: RenderInputProps) => <props.components.input {...props} />;\n\n/****\n * The jamespot model depend on the platform\n * For example a user can have the size attribute only for a given platform\n * The model specifics of a platform are stored in J.model\n *\n * This component display an array of attributes only if this attribute is activated on the platform\n *\n * @param props.object the object to display (ie the user)\n * @param props.attributesName an array of string : the list of attributes we want to display\n * @param props.componentsOverride we can override the default render of the attribute\n * @param props.componentsOverride.render the whole component logic (we override @DisplayList or @DisplaySingleValue for exemple)\n * @param props.componentsOverride.wrapper the attribute is wrapped inside an element. For a list it can be an UL\n * @param props.componentsOverride.element the component just above the element value\n * @param props.componentsOverride.input the component input\n * Note :If we override the \"render\" you can't override \"wrapper\" and \"element\" because the render rewrite everything\n */\nexport const DisplayForm = React.forwardRef<DisplayFormRef, DisplayFormProps>((props, ref) => {\n const intl = useIntl();\n\n const formRef = React.useRef<HTMLFormElement>(null);\n\n const { attributesName, object, componentsOverride } = props;\n const formConfig = J.react.useDisplay(attributesName || [], object.type);\n const ValidationButton = J.react.registry.getLazyComponent<JRCButtonProps>('ValidationButton');\n\n const { handleSubmit, control, reset } = useForm({\n defaultValues: {\n // initialize with empty array of checkbox, empty string otherwise\n ...(Object as any).fromEntries(\n formConfig.map((inputConfig) => [\n inputConfig.accessor,\n inputConfig.widget.type === 'checkbox' ? [] : '',\n ]),\n ),\n },\n criteriaMode: 'all',\n });\n\n React.useImperativeHandle(\n ref,\n () => ({\n reset: () => {\n // in case the form is scrollable\n formRef?.current?.scrollTo(0, 0);\n // reset react-hook-form form\n reset();\n },\n }),\n [],\n );\n\n return (\n <form onSubmit={handleSubmit(props.onSubmit)} ref={formRef}>\n {formConfig.map((inputConfig, index) => {\n inputConfig.components = {\n ...inputConfig.components,\n ...componentsOverride?.[inputConfig.name],\n };\n return <RenderInput key={index} control={control} {...inputConfig} />;\n })}\n\n <ValidationButton type=\"submit\">\n {intl.formatMessage({ id: 'APP_ASEI_Modal_Creation_Title' })}\n </ValidationButton>\n </form>\n );\n});\n"],"names":["RenderInput","props","components","input","DisplayForm","ref","intl","useIntl","formRef","attributesName","object","componentsOverride","formConfig","J","react","useDisplay","type","ValidationButton","registry","getLazyComponent","handleSubmit","control","reset","useForm","defaultValues","Object","fromEntries","map","inputConfig","accessor","widget","criteriaMode","current","scrollTo","onSubmit","index","name","key","formatMessage","id"],"sourceRoot":""}
@@ -0,0 +1,2 @@
1
+ "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[862],{2862:(e,t,a)=>{a.r(t),a.d(t,{Empty:()=>r});var c=a(7363);const r=()=>c.createElement(c.Fragment,null)}}]);
2
+ //# sourceMappingURL=862.bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"862.bundle.js","mappings":"+IAGO,MAAMA,EAAQ,IAAM","sources":["webpack://ReactCore/./src/displayer/Empty.tsx"],"sourcesContent":["import * as React from 'react';\n\n// FIXME move to j-react-components + display error if dev mode\nexport const Empty = () => <></>;\n"],"names":["Empty"],"sourceRoot":""}
@@ -0,0 +1,2 @@
1
+ "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[955],{8955:(e,r,t)=>{t.r(r),t.d(r,{AppStateLoader:()=>d});var a=t(7363),s=t.n(a),o=t(5181),n=t(855),c=t(1851);const p=J.react.store.actions.appState,i=J.react.registry.getLazyComponent("Loader"),l=J.react.registry.getLazyComponent("Card"),d=e=>{const r=J.react.store.useAppDispatch(),t=(0,o.useIntl)(),{appState:a}=(0,n.useSelector)((r=>({appState:J.react.store.selectors.appState(r,e.appId)})));return s().useEffect((()=>{e.initPromises&&(r(c.gn.setLoading(e.appId)),Promise.all(e.initPromises).then((()=>r(p.setLoaded(e.appId)))).catch((()=>{r(p.setError({app:e.appId,error:{message:"Error"}})),r(J.react.toasts.error({label:t.formatMessage({id:"GLOBAL_Error_occurred"})}))})))}),[]),a&&a.error?s().createElement(l,{variant:"div",type:"error"},s().createElement(o.FormattedMessage,{id:"GLOBAL_Error_occurred"})):s().createElement(s().Fragment,null,a&&a.isLoading?s().createElement(i,{variant:"skeleton"}):s().createElement(s().Fragment,null,e.children))}}}]);
2
+ //# sourceMappingURL=955.bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"955.bundle.js","mappings":"8LAMA,MAAMA,EAAiBC,EAAEC,MAAMC,MAAMC,QAAQC,SACvCC,EAASL,EAAEC,MAAMK,SAASC,iBAAiC,UAC3DC,EAAOR,EAAEC,MAAMK,SAASC,iBAA+B,QAShDE,EAAkBC,IAC3B,MAAMC,EAAWX,EAAEC,MAAMC,MAAMU,iBACzBC,GAAO,IAAAC,YAEP,SAAEV,IAAa,IAAAW,cAAaC,IACvB,CACHZ,SAAUJ,EAAEC,MAAMC,MAAMe,UAAUb,SAASY,EAAON,EAAMQ,WAqBhE,OAhBA,eAAgB,KACRR,EAAMS,eACNR,EAAS,gBAA2BD,EAAMQ,QAC1CE,QAAQC,IAAIX,EAAMS,cACbG,MAAK,IAAMX,EAASZ,EAAewB,UAAUb,EAAMQ,UACnDM,OAAM,KACHb,EACIZ,EAAe0B,SAAS,CACpBC,IAAKhB,EAAMQ,MACXS,MAAO,CAAEC,QAAS,YAG1BjB,EAASX,EAAEC,MAAM4B,OAAOF,MAAM,CAAEG,MAAOjB,EAAKkB,cAAc,CAAEC,GAAI,mCAG7E,IACC5B,GAAYA,EAASuB,MAEjB,kBAACnB,EAAI,CAACyB,QAAQ,MAAMC,KAAK,SACrB,kBAAC,EAAAC,iBAAgB,CAACH,GAAG,2BAK1B,oCAAG5B,GAAYA,EAASgC,UAAY,kBAAC/B,EAAM,CAAC4B,QAAQ,aAAgB,oCAAGvB,EAAM2B","sources":["webpack://ReactCore/./src/components/AppStateLoader.component.tsx"],"sourcesContent":["import { JRCCardProps, JRCLoaderProps } from 'jamespot-react-components';\nimport React from 'react';\nimport { FormattedMessage, useIntl } from 'react-intl';\nimport { useSelector } from 'react-redux';\nimport { appStateActions } from 'redux/slice/AppState.slice';\n\nconst appStateAction = J.react.store.actions.appState;\nconst Loader = J.react.registry.getLazyComponent<JRCLoaderProps>('Loader');\nconst Card = J.react.registry.getLazyComponent<JRCCardProps>('Card');\n\nexport type AppStateLoaderProps = {\n appId: string;\n children: JSX.Element;\n loader?: JSX.Element;\n initPromises: Promise<any>[];\n};\n\nexport const AppStateLoader = (props: AppStateLoaderProps) => {\n const dispatch = J.react.store.useAppDispatch();\n const intl = useIntl();\n\n const { appState } = useSelector((state: any) => {\n return {\n appState: J.react.store.selectors.appState(state, props.appId),\n };\n });\n\n // Init Function\n React.useEffect(() => {\n if (props.initPromises) {\n dispatch(appStateActions.setLoading(props.appId));\n Promise.all(props.initPromises)\n .then(() => dispatch(appStateAction.setLoaded(props.appId)))\n .catch(() => {\n dispatch(\n appStateAction.setError({\n app: props.appId,\n error: { message: 'Error' },\n }),\n );\n dispatch(J.react.toasts.error({ label: intl.formatMessage({ id: 'GLOBAL_Error_occurred' }) }));\n });\n }\n }, []);\n if (appState && appState.error) {\n return (\n <Card variant=\"div\" type=\"error\">\n <FormattedMessage id=\"GLOBAL_Error_occurred\" />\n </Card>\n );\n }\n\n return <>{appState && appState.isLoading ? <Loader variant=\"skeleton\" /> : <>{props.children}</>}</>;\n};\n"],"names":["appStateAction","J","react","store","actions","appState","Loader","registry","getLazyComponent","Card","AppStateLoader","props","dispatch","useAppDispatch","intl","useIntl","useSelector","state","selectors","appId","initPromises","Promise","all","then","setLoaded","catch","setError","app","error","message","toasts","label","formatMessage","id","variant","type","FormattedMessage","isLoading","children"],"sourceRoot":""}
package/build/App.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { ReactCore, ReactExtensions, WindowJ, ReactSocket, gabarit } from './utils/types';
1
+ import { JInjectStore } from './redux/store';
2
+ import { ReactCore, ReactExtensions, WindowJ, ReactSocket, Gabarit } from './utils/types';
2
3
  import { ReactRegistry } from './utils/registry';
3
4
  import './components';
4
5
  import { ReactTranslation, SupportedLanguages } from './utils/translation';
@@ -10,7 +11,7 @@ declare global {
10
11
  }
11
12
  declare class App implements ReactCore {
12
13
  extensions: ReactExtensions;
13
- store: any;
14
+ store: JInjectStore;
14
15
  actions: object;
15
16
  registry: ReactRegistry;
16
17
  useDisplay: typeof useDisplay;
@@ -22,7 +23,7 @@ declare class App implements ReactCore {
22
23
  constructor(store: any, ActionCreators: object, registry: ReactRegistry);
23
24
  require: (extensionName: string, args: any) => void;
24
25
  extensionAdd(extensionName: string, load: () => void): void;
25
- routeAdd(route: string, extensionName: string, idDiv: string, gabarit?: gabarit, gabaritOptions?: object): void;
26
+ routeAdd(route: string, extensionName: string, idDiv: string, gabarit?: Gabarit, gabaritOptions?: object): void;
26
27
  transitionTo(stateName: string, args: {}, options?: {
27
28
  reload: boolean;
28
29
  notify?: boolean;