chayns-api 2.2.0-beta.3 → 2.2.0

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.
@@ -7,7 +7,7 @@ exports.useValuesSelector = exports.useFunctionsSelector = exports.useCustomFunc
7
7
  var _react = require("react");
8
8
  var _shim = require("use-sync-external-store/shim");
9
9
  var _ChaynsContext = require("../components/ChaynsContext");
10
- const useChaynsSelector = key => selector => {
10
+ const createChaynsSelector = key => selector => {
11
11
  const store = (0, _react.useContext)(_ChaynsContext.ChaynsContext);
12
12
  if (!store) {
13
13
  throw new Error('Could not find chayns context. Did you forget to add ChaynsProvider?');
@@ -15,6 +15,6 @@ const useChaynsSelector = key => selector => {
15
15
  const getSnapshot = () => selector(store[key]);
16
16
  return (0, _shim.useSyncExternalStore)(store.subscribe, getSnapshot, getSnapshot);
17
17
  };
18
- const useValuesSelector = exports.useValuesSelector = useChaynsSelector('values');
19
- const useFunctionsSelector = exports.useFunctionsSelector = useChaynsSelector('functions');
20
- const useCustomFunctionsSelector = exports.useCustomFunctionsSelector = useChaynsSelector('customFunctions');
18
+ const useValuesSelector = exports.useValuesSelector = createChaynsSelector('values');
19
+ const useFunctionsSelector = exports.useFunctionsSelector = createChaynsSelector('functions');
20
+ const useCustomFunctionsSelector = exports.useCustomFunctionsSelector = createChaynsSelector('customFunctions');
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useParameters = void 0;
7
7
  var _context = require("./context");
8
- const useParameters = () => (0, _context.useValuesSelector)(v => v.parameters || []);
8
+ const useParameters = () => (0, _context.useValuesSelector)(v => v.parameters);
9
9
  exports.useParameters = useParameters;
package/dist/cjs/index.js CHANGED
@@ -89,17 +89,6 @@ var _ChaynsProvider = _interopRequireDefault(require("./components/ChaynsProvide
89
89
  var _deviceHelper = _interopRequireWildcard(require("./util/deviceHelper"));
90
90
  var _ChaynsHost = _interopRequireDefault(require("./host/ChaynsHost"));
91
91
  var _withCompatMode = require("./components/withCompatMode");
92
- Object.keys(_withCompatMode).forEach(function (key) {
93
- if (key === "default" || key === "__esModule") return;
94
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
95
- if (key in exports && exports[key] === _withCompatMode[key]) return;
96
- Object.defineProperty(exports, key, {
97
- enumerable: true,
98
- get: function () {
99
- return _withCompatMode[key];
100
- }
101
- });
102
- });
103
92
  var _calls = require("./calls");
104
93
  Object.keys(_calls).forEach(function (key) {
105
94
  if (key === "default" || key === "__esModule") return;
@@ -4,9 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.bindChaynsApi = void 0;
7
- var _index = require("../index");
7
+ var _StaticChaynsApi = _interopRequireDefault(require("../wrapper/StaticChaynsApi"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
9
  const bindChaynsApi = fun => (values, functions) => {
9
- new _index.StaticChaynsApi(values, functions);
10
+ new _StaticChaynsApi.default(values, functions);
10
11
  return fun;
11
12
  };
12
13
  exports.bindChaynsApi = bindChaynsApi;
@@ -1,7 +1,7 @@
1
1
  import { useContext } from 'react';
2
2
  import { useSyncExternalStore } from 'use-sync-external-store/shim';
3
3
  import { ChaynsContext } from '../components/ChaynsContext';
4
- const useChaynsSelector = key => selector => {
4
+ const createChaynsSelector = key => selector => {
5
5
  const store = useContext(ChaynsContext);
6
6
  if (!store) {
7
7
  throw new Error('Could not find chayns context. Did you forget to add ChaynsProvider?');
@@ -9,6 +9,6 @@ const useChaynsSelector = key => selector => {
9
9
  const getSnapshot = () => selector(store[key]);
10
10
  return useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
11
11
  };
12
- export const useValuesSelector = useChaynsSelector('values');
13
- export const useFunctionsSelector = useChaynsSelector('functions');
14
- export const useCustomFunctionsSelector = useChaynsSelector('customFunctions');
12
+ export const useValuesSelector = createChaynsSelector('values');
13
+ export const useFunctionsSelector = createChaynsSelector('functions');
14
+ export const useCustomFunctionsSelector = createChaynsSelector('customFunctions');
@@ -1,2 +1,2 @@
1
1
  import { useValuesSelector } from './context';
2
- export const useParameters = () => useValuesSelector(v => v.parameters || []);
2
+ export const useParameters = () => useValuesSelector(v => v.parameters);
package/dist/esm/index.js CHANGED
@@ -8,7 +8,6 @@ export * from './hooks';
8
8
  export * from './components/WaitUntil';
9
9
  export * from './types/IChaynsReact';
10
10
  export * from './util/is';
11
- export * from './components/withCompatMode';
12
11
  export * from './constants';
13
12
  export { default as withHydrationBoundary } from './components/withHydrationBoundary';
14
13
  export { default as StaticChaynsApi } from './wrapper/StaticChaynsApi';
@@ -1,4 +1,4 @@
1
- import { StaticChaynsApi } from "../index";
1
+ import StaticChaynsApi from '../wrapper/StaticChaynsApi';
2
2
  export const bindChaynsApi = fun => (values, functions) => {
3
3
  new StaticChaynsApi(values, functions);
4
4
  return fun;
@@ -11,7 +11,7 @@ type ChaynsHostType = {
11
11
  customFunctions?: IChaynsReact["customFunctions"];
12
12
  src?: string;
13
13
  iFrameRef?: React.MutableRefObject<HTMLIFrameElement | null> | undefined;
14
- loadingComponent?: JSX.Element;
14
+ loadingComponent?: React.ReactNode;
15
15
  system?: TypeSystem;
16
16
  pages: Page[];
17
17
  isAdminModeActive: boolean;
@@ -26,6 +26,16 @@ type ChaynsHostType = {
26
26
  preventStagingReplacement?: boolean;
27
27
  dialog: ChaynsReactValues["dialog"];
28
28
  styleSettings?: ChaynsReactValues["styleSettings"];
29
- };
29
+ } & ({
30
+ type: `${'client' | 'server'}-iframe`;
31
+ src: string;
32
+ iFrameProps: {
33
+ [key: string]: unknown;
34
+ name: string;
35
+ };
36
+ } | {
37
+ type: `${'client' | 'server'}-module`;
38
+ system: TypeSystem;
39
+ });
30
40
  declare const ChaynsHost: FC<ChaynsHostType>;
31
41
  export default ChaynsHost;
@@ -8,7 +8,6 @@ export * from './hooks';
8
8
  export * from './components/WaitUntil';
9
9
  export * from './types/IChaynsReact';
10
10
  export * from './util/is';
11
- export * from './components/withCompatMode';
12
11
  export * from './constants';
13
12
  export { default as withHydrationBoundary } from './components/withHydrationBoundary';
14
13
  export { default as StaticChaynsApi } from './wrapper/StaticChaynsApi';
@@ -194,7 +194,6 @@ export declare enum IconStyle {
194
194
  SHARP = 4
195
195
  }
196
196
  export interface ChaynsDesignSettings {
197
- siteId?: string;
198
197
  color: string;
199
198
  secondaryColor?: string;
200
199
  colorMode: ColorMode;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "2.2.0-beta.3",
3
+ "version": "2.2.0",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/types/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
+ "types": "./dist/types/index.d.ts",
10
11
  "require": "./dist/cjs/index.js",
11
- "import": "./dist/esm/index.js",
12
- "types": "./dist/types/index.d.ts"
12
+ "default": "./dist/esm/index.js"
13
13
  }
14
14
  },
15
15
  "keywords": [
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@babel/cli": "^7.26.4",
55
- "@babel/core": "^7.26.0",
55
+ "@babel/core": "^7.26.9",
56
56
  "@babel/preset-env": "^7.26.0",
57
57
  "@babel/preset-react": "^7.26.3",
58
58
  "@babel/preset-typescript": "^7.26.0",
@@ -60,16 +60,16 @@
60
60
  "@rsbuild/plugin-umd": "^1.0.4",
61
61
  "@types/htmlescape": "^1.1.3",
62
62
  "@types/lodash.throttle": "^4.1.9",
63
- "@types/prop-types": "^15.7.12",
64
- "@types/react": "^18.2.78",
65
- "@types/react-dom": "^18.2.25",
63
+ "@types/prop-types": "^15.7.14",
64
+ "@types/react": "^18.3.18",
65
+ "@types/react-dom": "^18.3.5",
66
66
  "@types/ua-parser-js": "^0.7.39",
67
67
  "@types/use-sync-external-store": "^0.0.6",
68
68
  "@typescript-eslint/parser": "^7.6.0",
69
- "chayns-toolkit": "^3.1.3",
69
+ "chayns-toolkit": "^3.2.0",
70
70
  "concurrently": "^9.1.2",
71
71
  "cross-env": "^7.0.3",
72
- "prettier": "^3.4.2",
72
+ "prettier": "^3.5.1",
73
73
  "prettier-plugin-packagejson": "^2.5.8",
74
74
  "react": "^18.3.1",
75
75
  "react-dom": "^18.3.1",