@edifice.io/react 2.0.0-develop-rc.21 → 2.0.0-develop-rc.22

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.
package/dist/index.js CHANGED
@@ -92,6 +92,9 @@ import { useResourceSearch } from "./hooks/useResourceSearch/useResourceSearch.j
92
92
  import { default as default77 } from "./hooks/useToast/useToast.js";
93
93
  import { default as default78 } from "./hooks/useUser/useUser.js";
94
94
  import { EdificeClientProvider } from "./providers/EdificeClientProvider/EdificeClientProvider.js";
95
+ import { EdificeClientContext } from "./providers/EdificeClientProvider/EdificeClientProvider.context.js";
96
+ import { useEdificeClient } from "./providers/EdificeClientProvider/EdificeClientProvider.hook.js";
97
+ import { EdificeThemeProvider } from "./providers/EdificeThemeProvider/EdificeThemeProvider.js";
95
98
  import { EdificeThemeContext } from "./providers/EdificeThemeProvider/EdificeThemeProvider.context.js";
96
99
  import { useEdificeTheme } from "./providers/EdificeThemeProvider/EdificeThemeProvider.hook.js";
97
100
  import { checkUserRight } from "./utilities/check-user-rights/check-user-rights.js";
@@ -118,8 +121,10 @@ export {
118
121
  default13 as Dropdown,
119
122
  default14 as Dropzone,
120
123
  DropzoneContext,
124
+ EdificeClientContext,
121
125
  EdificeClientProvider,
122
126
  EdificeThemeContext,
127
+ EdificeThemeProvider,
123
128
  default15 as EmptyScreen,
124
129
  default64 as FormControl,
125
130
  default16 as FormText,
@@ -185,6 +190,7 @@ export {
185
190
  default37 as useDropdown,
186
191
  default38 as useDropzone,
187
192
  useDropzoneContext,
193
+ useEdificeClient,
188
194
  default39 as useEdificeIcons,
189
195
  useEdificeTheme,
190
196
  default74 as useHasWorkflow,
@@ -1,17 +1,17 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { App, IGetConf, IGetSession, IUserDescription, IUserInfo, IWebApp, UserProfile } from '@edifice.io/ts-client';
3
3
  import { UseQueryResult } from '../../../node_modules/@tanstack/react-query';
4
- export interface OdeProviderParams {
4
+ export interface EdificeClientParams {
5
5
  alternativeApp?: boolean;
6
6
  app: App;
7
7
  cdnDomain?: string | null;
8
8
  version?: string | null;
9
9
  }
10
- export interface OdeClientProps {
10
+ export interface EdificeClientProviderProps {
11
11
  children: ReactNode;
12
- params: OdeProviderParams;
12
+ params: EdificeClientParams;
13
13
  }
14
- export interface OdeContextProps {
14
+ export interface EdificeClientContextProps {
15
15
  appCode: App;
16
16
  applications: IWebApp[] | undefined;
17
17
  confQuery: UseQueryResult<IGetConf>;
@@ -23,4 +23,4 @@ export interface OdeContextProps {
23
23
  userDescription: Partial<IUserDescription> | undefined;
24
24
  userProfile: UserProfile | undefined;
25
25
  }
26
- export declare const EdificeClientContext: import('react').Context<OdeContextProps | null>;
26
+ export declare const EdificeClientContext: import('react').Context<EdificeClientContextProps | null>;
@@ -1,26 +1,9 @@
1
- import { ReactNode } from 'react';
2
- import { App, IGetConf, IGetSession, IUserDescription, IUserInfo, IWebApp, UserProfile } from '@edifice.io/ts-client';
3
- import { UseQueryResult } from '../../../node_modules/@tanstack/react-query';
1
+ import { App } from '@edifice.io/ts-client';
2
+ import { EdificeClientProviderProps } from './EdificeClientProvider.context';
4
3
  export interface OdeProviderParams {
5
4
  alternativeApp?: boolean;
6
5
  app: App;
7
6
  cdnDomain?: string | null;
8
7
  version?: string | null;
9
8
  }
10
- export interface OdeClientProps {
11
- children: ReactNode;
12
- params: OdeProviderParams;
13
- }
14
- export interface OdeContextProps {
15
- appCode: App;
16
- applications: IWebApp[] | undefined;
17
- confQuery: UseQueryResult<IGetConf>;
18
- currentApp: IWebApp | undefined;
19
- currentLanguage: string | undefined;
20
- init: boolean;
21
- sessionQuery: UseQueryResult<IGetSession>;
22
- user: IUserInfo | undefined;
23
- userDescription: Partial<IUserDescription> | undefined;
24
- userProfile: UserProfile | undefined;
25
- }
26
- export declare function EdificeClientProvider({ children, params }: OdeClientProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function EdificeClientProvider({ children, params, }: EdificeClientProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- export declare function useEdificeClient(): import('./EdificeClientProvider.context').OdeContextProps;
1
+ export declare function useEdificeClient(): import('./EdificeClientProvider.context').EdificeClientContextProps;
@@ -1,10 +1,2 @@
1
- import { ReactNode } from 'react';
2
- import { IOdeTheme } from '@edifice.io/ts-client';
3
- export interface EdificeThemeProps {
4
- children: ReactNode;
5
- defaultTheme?: "one" | "neo" | "none";
6
- }
7
- export interface EdificeThemeContextProps {
8
- theme: IOdeTheme | undefined;
9
- }
1
+ import { EdificeThemeProps } from './EdificeThemeProvider.context';
10
2
  export declare function EdificeThemeProvider({ defaultTheme, children, }: EdificeThemeProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,46 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useEffect, useMemo } from "react";
3
+ import { useEdificeClient } from "../EdificeClientProvider/EdificeClientProvider.hook.js";
4
+ import { EdificeThemeContext } from "./EdificeThemeProvider.context.js";
5
+ import useConf from "../../hooks/useConf/useConf.js";
6
+ function EdificeThemeProvider({
7
+ defaultTheme,
8
+ children
9
+ }) {
10
+ var _a;
11
+ const {
12
+ appCode
13
+ } = useEdificeClient(), confQuery = useConf({
14
+ appCode
15
+ });
16
+ useEffect(() => {
17
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
18
+ const favicon = document.getElementById("favicon");
19
+ favicon.href = `${(_b = (_a2 = confQuery == null ? void 0 : confQuery.data) == null ? void 0 : _a2.theme) == null ? void 0 : _b.basePath}/img/illustrations/favicon.ico`;
20
+ const bootstrapVersion = (_e = (_d = (_c = confQuery == null ? void 0 : confQuery.data) == null ? void 0 : _c.theme) == null ? void 0 : _d.bootstrapVersion) == null ? void 0 : _e.split("-"), dataProduct = bootstrapVersion ? bootstrapVersion[bootstrapVersion.length - 1] : void 0;
21
+ [{
22
+ data: "data-skin",
23
+ value: (_g = (_f = confQuery == null ? void 0 : confQuery.data) == null ? void 0 : _f.theme) == null ? void 0 : _g.skinName
24
+ }, {
25
+ data: "data-theme",
26
+ // WB2-1885, add npmTheme for dynamic theme on springboard
27
+ value: ((_i = (_h = confQuery == null ? void 0 : confQuery.data) == null ? void 0 : _h.theme) == null ? void 0 : _i.npmTheme) ?? ((_k = (_j = confQuery == null ? void 0 : confQuery.data) == null ? void 0 : _j.theme) == null ? void 0 : _k.themeName)
28
+ }, {
29
+ data: "data-product",
30
+ value: defaultTheme === "none" ? "" : defaultTheme ?? dataProduct
31
+ }].forEach((attribute) => {
32
+ var _a3;
33
+ return (_a3 = document.querySelector("html")) == null ? void 0 : _a3.setAttribute(attribute.data, attribute.value);
34
+ });
35
+ }, [confQuery == null ? void 0 : confQuery.data, defaultTheme]);
36
+ const values = useMemo(() => {
37
+ var _a2;
38
+ return {
39
+ theme: (_a2 = confQuery == null ? void 0 : confQuery.data) == null ? void 0 : _a2.theme
40
+ };
41
+ }, [(_a = confQuery == null ? void 0 : confQuery.data) == null ? void 0 : _a.theme]);
42
+ return /* @__PURE__ */ jsx(EdificeThemeContext.Provider, { value: values, children });
43
+ }
44
+ export {
45
+ EdificeThemeProvider
46
+ };
@@ -1,3 +1,6 @@
1
1
  export * from './EdificeClientProvider/EdificeClientProvider';
2
+ export * from './EdificeClientProvider/EdificeClientProvider.context';
3
+ export * from './EdificeClientProvider/EdificeClientProvider.hook';
4
+ export * from './EdificeThemeProvider/EdificeThemeProvider';
2
5
  export * from './EdificeThemeProvider/EdificeThemeProvider.context';
3
6
  export * from './EdificeThemeProvider/EdificeThemeProvider.hook';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.0.0-develop-rc.21",
3
+ "version": "2.0.0-develop-rc.22",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -118,8 +118,8 @@
118
118
  "react-slugify": "^3.0.3",
119
119
  "swiper": "^10.1.0",
120
120
  "ua-parser-js": "^1.0.36",
121
- "@edifice.io/utilities": "2.0.0-develop-rc.21",
122
- "@edifice.io/tiptap-extensions": "2.0.0-develop-rc.21"
121
+ "@edifice.io/utilities": "2.0.0-develop-rc.22",
122
+ "@edifice.io/tiptap-extensions": "2.0.0-develop-rc.22"
123
123
  },
124
124
  "optionalDependencies": {
125
125
  "@tiptap-pro/extension-mathematics": "2.2.1"
@@ -143,7 +143,7 @@
143
143
  "rollup-plugin-visualizer": "5.12.0",
144
144
  "vite": "^5.4.11",
145
145
  "vite-plugin-dts": "^4.1.0",
146
- "@edifice.io/ts-client": "2.0.0-develop-rc.21"
146
+ "@edifice.io/ts-client": "2.0.0-develop-rc.22"
147
147
  },
148
148
  "peerDependencies": {
149
149
  "@react-spring/web": "^9.7.5",