chayns-api 2.2.4 → 2.2.6

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.
@@ -83,11 +83,9 @@ const ChaynsProvider = ({
83
83
  })();
84
84
  }, []);
85
85
  (0, _react.useEffect)(() => {
86
- if (isModule) {
87
- if (data) {
88
- customWrapper.current.values = data;
89
- customWrapper.current.emitChange();
90
- }
86
+ if (isModule && data) {
87
+ customWrapper.current.values = data;
88
+ customWrapper.current.emitChange();
91
89
  }
92
90
  }, [data, isModule]);
93
91
  (0, _react.useEffect)(() => {
@@ -39,24 +39,27 @@ const ModuleHost = ({
39
39
  preventStagingReplacement,
40
40
  styleSettings
41
41
  }) => {
42
- const initialData = {
43
- site,
44
- isAdminModeActive,
45
- pages,
46
- currentPage,
47
- device,
48
- language,
49
- parameters,
50
- customData,
51
- environment,
52
- styleSettings
53
- };
54
- if (user) {
55
- initialData.user = user;
56
- }
57
- if (dialog) {
58
- initialData.dialog = dialog;
59
- }
42
+ const data = (0, _react.useMemo)(() => {
43
+ const result = {
44
+ site,
45
+ isAdminModeActive,
46
+ pages,
47
+ currentPage,
48
+ device,
49
+ language,
50
+ parameters,
51
+ customData,
52
+ environment,
53
+ styleSettings
54
+ };
55
+ if (user) {
56
+ result.user = user;
57
+ }
58
+ if (dialog) {
59
+ result.dialog = dialog;
60
+ }
61
+ return result;
62
+ }, [site, isAdminModeActive, pages, currentPage, device, language, parameters, customData, environment, styleSettings, user, dialog]);
60
63
  return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("div", {
61
64
  className: "module-css"
62
65
  }), _react.default.createElement(System, {
@@ -67,7 +70,7 @@ const ModuleHost = ({
67
70
  module: system.module,
68
71
  preventSingleton: system.preventSingleton
69
72
  },
70
- data: initialData,
73
+ data: data,
71
74
  functions: functions,
72
75
  customFunctions: customFunctions,
73
76
  fallback: children,
@@ -77,11 +77,9 @@ const ChaynsProvider = _ref2 => {
77
77
  })();
78
78
  }, []);
79
79
  useEffect(() => {
80
- if (isModule) {
81
- if (data) {
82
- customWrapper.current.values = data;
83
- customWrapper.current.emitChange();
84
- }
80
+ if (isModule && data) {
81
+ customWrapper.current.values = data;
82
+ customWrapper.current.emitChange();
85
83
  }
86
84
  }, [data, isModule]);
87
85
  useEffect(() => {
@@ -32,24 +32,27 @@ const ModuleHost = _ref2 => {
32
32
  preventStagingReplacement,
33
33
  styleSettings
34
34
  } = _ref2;
35
- const initialData = {
36
- site,
37
- isAdminModeActive,
38
- pages,
39
- currentPage,
40
- device,
41
- language,
42
- parameters,
43
- customData,
44
- environment,
45
- styleSettings
46
- };
47
- if (user) {
48
- initialData.user = user;
49
- }
50
- if (dialog) {
51
- initialData.dialog = dialog;
52
- }
35
+ const data = useMemo(() => {
36
+ const result = {
37
+ site,
38
+ isAdminModeActive,
39
+ pages,
40
+ currentPage,
41
+ device,
42
+ language,
43
+ parameters,
44
+ customData,
45
+ environment,
46
+ styleSettings
47
+ };
48
+ if (user) {
49
+ result.user = user;
50
+ }
51
+ if (dialog) {
52
+ result.dialog = dialog;
53
+ }
54
+ return result;
55
+ }, [site, isAdminModeActive, pages, currentPage, device, language, parameters, customData, environment, styleSettings, user, dialog]);
53
56
  return React.createElement(React.Fragment, null, React.createElement("div", {
54
57
  className: "module-css"
55
58
  }), React.createElement(System, {
@@ -60,7 +63,7 @@ const ModuleHost = _ref2 => {
60
63
  module: system.module,
61
64
  preventSingleton: system.preventSingleton
62
65
  },
63
- data: initialData,
66
+ data: data,
64
67
  functions: functions,
65
68
  customFunctions: customFunctions,
66
69
  fallback: children,
@@ -197,7 +197,7 @@ export interface ChaynsDesignSettings {
197
197
  color: string;
198
198
  secondaryColor?: string;
199
199
  colorMode: ColorMode;
200
- fontSize: number;
200
+ fontSizePx: number;
201
201
  iconStyle: IconStyle;
202
202
  headlineFontId?: number;
203
203
  backgroundType?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "2.2.4",
3
+ "version": "2.2.6",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -8,6 +8,7 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/types/index.d.ts",
11
+ "node": "./dist/cjs/index.js",
11
12
  "require": "./dist/cjs/index.js",
12
13
  "default": "./dist/esm/index.js"
13
14
  }