chayns-api 2.1.7 → 2.1.9-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.
package/.babelrc CHANGED
@@ -1,31 +1,31 @@
1
- {
2
- "env": {
3
- "esm": {
4
- "presets": [
5
- [
6
- "@babel/preset-env",
7
- {
8
- "targets": ">0.5%, not dead, not op_mini all, chrome 71",
9
- "modules": false
10
- }
11
- ],
12
- "@babel/preset-react",
13
- "@babel/preset-typescript"
14
- ]
15
- },
16
- "cjs": {
17
- "presets": [
18
- [
19
- "@babel/preset-env",
20
- {
21
- "targets": { "node": 12 },
22
- "modules": "commonjs"
23
- }
24
- ],
25
- "@babel/preset-react",
26
- "@babel/preset-typescript"
27
- ]
28
- }
29
- },
30
- "comments": false
31
- }
1
+ {
2
+ "env": {
3
+ "esm": {
4
+ "presets": [
5
+ [
6
+ "@babel/preset-env",
7
+ {
8
+ "targets": ">0.5%, not dead, not op_mini all, chrome 71",
9
+ "modules": false
10
+ }
11
+ ],
12
+ "@babel/preset-react",
13
+ "@babel/preset-typescript"
14
+ ]
15
+ },
16
+ "cjs": {
17
+ "presets": [
18
+ [
19
+ "@babel/preset-env",
20
+ {
21
+ "targets": { "node": 12 },
22
+ "modules": "commonjs"
23
+ }
24
+ ],
25
+ "@babel/preset-react",
26
+ "@babel/preset-typescript"
27
+ ]
28
+ }
29
+ },
30
+ "comments": false
31
+ }
package/.eslintrc CHANGED
@@ -1,17 +1,17 @@
1
- {
2
- "extends": "@chayns-toolkit",
3
- "rules": {
4
- "no-void": "off",
5
- "react/function-component-definition": [
6
- "error",
7
- {
8
- "namedComponents": "arrow-function",
9
- "unnamedComponents": "arrow-function"
10
- }
11
- ],
12
- "@typescript-eslint/require-await": "off",
13
- "@typescript-eslint/no-explicit-any": "off",
14
- "class-methods-use-this": "off",
15
- "react/jsx-props-no-spreading": "off"
16
- }
17
- }
1
+ {
2
+ "extends": "@chayns-toolkit",
3
+ "rules": {
4
+ "no-void": "off",
5
+ "react/function-component-definition": [
6
+ "error",
7
+ {
8
+ "namedComponents": "arrow-function",
9
+ "unnamedComponents": "arrow-function"
10
+ }
11
+ ],
12
+ "@typescript-eslint/require-await": "off",
13
+ "@typescript-eslint/no-explicit-any": "off",
14
+ "class-methods-use-this": "off",
15
+ "react/jsx-props-no-spreading": "off"
16
+ }
17
+ }
@@ -1,28 +1,28 @@
1
- name: Deploy Docs to GitHub Pages
2
-
3
- on:
4
- push:
5
- paths:
6
- - "website/**"
7
- workflow_dispatch:
8
-
9
- jobs:
10
- deploy:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - name: Checkout repo
14
- uses: actions/checkout@v2
15
-
16
- - name: Use Node 20
17
- uses: actions/setup-node@v1
18
- with:
19
- node-version: 20
20
-
21
- - name: Build
22
- run: npm run build-docs
23
-
24
- - name: Deploy to GitHub Pages
25
- uses: peaceiris/actions-gh-pages@v3
26
- with:
27
- github_token: ${{ secrets.GITHUB_TOKEN }}
28
- publish_dir: ./website/build
1
+ name: Deploy Docs to GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ paths:
6
+ - "website/**"
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ deploy:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout repo
14
+ uses: actions/checkout@v2
15
+
16
+ - name: Use Node 20
17
+ uses: actions/setup-node@v1
18
+ with:
19
+ node-version: 20
20
+
21
+ - name: Build
22
+ run: npm run build-docs
23
+
24
+ - name: Deploy to GitHub Pages
25
+ uses: peaceiris/actions-gh-pages@v3
26
+ with:
27
+ github_token: ${{ secrets.GITHUB_TOKEN }}
28
+ publish_dir: ./website/build
@@ -1,21 +1,21 @@
1
- name: Publish to NPM
2
-
3
- on:
4
- workflow_dispatch:
5
- push:
6
- tags:
7
- - 'v*'
8
-
9
- jobs:
10
- build:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v2
14
- - uses: actions/setup-node@v1
15
- with:
16
- node-version: '14.21.1'
17
- registry-url: https://registry.npmjs.org/
18
- - run: npm install
19
- - run: npm publish
20
- env:
21
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1
+ name: Publish to NPM
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ tags:
7
+ - 'v*'
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - uses: actions/setup-node@v1
15
+ with:
16
+ node-version: '14.21.1'
17
+ registry-url: https://registry.npmjs.org/
18
+ - run: npm install
19
+ - run: npm publish
20
+ env:
21
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Tobit.Software
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Tobit.Software
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,67 +1,67 @@
1
- # [chayns react api](https://github.com/TobitSoftware/chayns-api) · [![license](https://img.shields.io/github/license/TobitSoftware/chayns-api.svg)]() [![GitHub pull requests](https://img.shields.io/github/issues-pr/TobitSoftware/chayns-api.svg)]() [![](https://img.shields.io/github/issues-pr-closed-raw/TobitSoftware/chayns-api.svg)]()
2
-
3
- The chayns-api provides information and useful functions to your page. The information and functions are provided by react hooks and normal functions.
4
- A list of all functions and hooks can be found [here](https://tobitsoftware.github.io/chayns-api/docs).
5
-
6
- ## Installation
7
-
8
- It is recommended to setup your new chayns page with the [create-chayns-app](https://github.com/TobitSoftware/create-chayns-app).
9
-
10
-
11
- ### Migrate old project
12
- 1. Install chayns-api package
13
- ```sh
14
- # NPM
15
- $ npm install chayns-api
16
-
17
- # Yarn
18
- $ yarn add chayns-api
19
- ```
20
-
21
- 2. Wrap your App component with the "ChaynsProvider" component. In all components which are under the ChaynsProvider you can use hooks and chayns functions.
22
- ```jsx
23
- <ChaynsProvider>
24
- <App/>
25
- </ChaynsProvider>
26
- ```
27
-
28
- ## Example
29
-
30
- ```jsx
31
- import { useUser } from 'chayns-api';
32
-
33
- const FirstName = () => {
34
- const user = useUser();
35
-
36
- return (
37
- <div>{user?.firstName}</div>
38
- );
39
- }
40
- ```
41
-
42
- ## Migrate v1 to v2
43
-
44
- When updating to chayns-api@2 you should also update chayns-toolkit to 3.0.1 or higher (check migration guide [here](https://github.com/TobitSoftware/chayns-toolkit/tree/main?tab=readme-ov-file#-migration-v2-to-v3)).
45
-
46
- Check urls referencing **remoteEntry.js**. The filename has been changed to **v2.remoteEntry.js**.
47
-
48
- When your application uses ChaynsHost with module-type you might have to add a call of **initModuleFederationSharing** as early as possible in your application (e.g. index/bootstrap). Unless your application is already embedded as module somewhere else (e.g. in a dialog).
49
-
50
- ```
51
- initModuleFederationSharing({ name: 'project_name' });
52
- ```
53
-
54
-
55
- ## Getting started
56
-
57
- More information to setup chayns-api can be found in the [documentation](https://tobitsoftware.github.io/chayns-api/docs).
58
-
59
- ## Troubleshooting
60
-
61
- ```
62
- Can't resolve 'react-dom/client'
63
- ```
64
- A warning like above can be shown when you are still using react 17.
65
- This can be ignored because the react 17 api is used as fallback instead.
66
-
67
- ## License
1
+ # [chayns react api](https://github.com/TobitSoftware/chayns-api) &middot; [![license](https://img.shields.io/github/license/TobitSoftware/chayns-api.svg)]() [![GitHub pull requests](https://img.shields.io/github/issues-pr/TobitSoftware/chayns-api.svg)]() [![](https://img.shields.io/github/issues-pr-closed-raw/TobitSoftware/chayns-api.svg)]()
2
+
3
+ The chayns-api provides information and useful functions to your page. The information and functions are provided by react hooks and normal functions.
4
+ A list of all functions and hooks can be found [here](https://tobitsoftware.github.io/chayns-api/docs).
5
+
6
+ ## Installation
7
+
8
+ It is recommended to setup your new chayns page with the [create-chayns-app](https://github.com/TobitSoftware/create-chayns-app).
9
+
10
+
11
+ ### Migrate old project
12
+ 1. Install chayns-api package
13
+ ```sh
14
+ # NPM
15
+ $ npm install chayns-api
16
+
17
+ # Yarn
18
+ $ yarn add chayns-api
19
+ ```
20
+
21
+ 2. Wrap your App component with the "ChaynsProvider" component. In all components which are under the ChaynsProvider you can use hooks and chayns functions.
22
+ ```jsx
23
+ <ChaynsProvider>
24
+ <App/>
25
+ </ChaynsProvider>
26
+ ```
27
+
28
+ ## Example
29
+
30
+ ```jsx
31
+ import { useUser } from 'chayns-api';
32
+
33
+ const FirstName = () => {
34
+ const user = useUser();
35
+
36
+ return (
37
+ <div>{user?.firstName}</div>
38
+ );
39
+ }
40
+ ```
41
+
42
+ ## Migrate v1 to v2
43
+
44
+ When updating to chayns-api@2 you should also update chayns-toolkit to 3.0.1 or higher (check migration guide [here](https://github.com/TobitSoftware/chayns-toolkit/tree/main?tab=readme-ov-file#-migration-v2-to-v3)).
45
+
46
+ Check urls referencing **remoteEntry.js**. The filename has been changed to **v2.remoteEntry.js**.
47
+
48
+ When your application uses ChaynsHost with module-type you might have to add a call of **initModuleFederationSharing** as early as possible in your application (e.g. index/bootstrap). Unless your application is already embedded as module somewhere else (e.g. in a dialog).
49
+
50
+ ```
51
+ initModuleFederationSharing({ name: 'project_name' });
52
+ ```
53
+
54
+
55
+ ## Getting started
56
+
57
+ More information to setup chayns-api can be found in the [documentation](https://tobitsoftware.github.io/chayns-api/docs).
58
+
59
+ ## Troubleshooting
60
+
61
+ ```
62
+ Can't resolve 'react-dom/client'
63
+ ```
64
+ A warning like above can be shown when you are still using react 17.
65
+ This can be ignored because the react 17 api is used as fallback instead.
66
+
67
+ ## License
@@ -24,7 +24,7 @@ class AppWrapper {
24
24
  listeners = [];
25
25
  customFunctions = {};
26
26
  mapOldApiToNew(retVal) {
27
- var _window, _colorMode, _window2, _AppInfo$TappSelected;
27
+ var _window, _window2, _AppInfo$TappSelected;
28
28
  const {
29
29
  AppInfo,
30
30
  AppUser,
@@ -90,7 +90,7 @@ class AppWrapper {
90
90
  docked: false
91
91
  },
92
92
  title: AppInfo.Title,
93
- colorMode: (_colorMode = colorMode) !== null && _colorMode !== void 0 ? _colorMode : AppInfo.colorMode,
93
+ colorMode: colorMode !== null && colorMode !== void 0 ? colorMode : AppInfo.colorMode,
94
94
  color,
95
95
  domain: AppInfo.domain,
96
96
  font: {
@@ -320,6 +320,7 @@ class FrameWrapper {
320
320
  }
321
321
  }
322
322
  async init() {
323
+ var _await$exposed$_custo;
323
324
  if (this.initialized) return;
324
325
  const exposed = comlink.wrap(comlink.windowEndpoint(window.parent))[window.name];
325
326
  const dataListener = () => exposed.addDataListener(comlink.proxy(({
@@ -348,7 +349,7 @@ class FrameWrapper {
348
349
  this.values = await exposed.getInitialData();
349
350
  this.exposedFunctions = exposed.functions;
350
351
  this.exposedCustomFunctions = exposed.customFunctions;
351
- this.exposedCustomFunctionNames = await exposed._customFunctionNames;
352
+ this.exposedCustomFunctionNames = (_await$exposed$_custo = await exposed._customFunctionNames) !== null && _await$exposed$_custo !== void 0 ? _await$exposed$_custo : [];
352
353
  this.customFunctions = this.exposedCustomFunctionNames.reduce((p, e) => {
353
354
  p[e] = (...args) => this.exposedCustomFunctions[e](...args.map(a => typeof a === 'function' ? comlink.proxy(a) : a));
354
355
  return p;
@@ -14,7 +14,7 @@ import { isAppCallSupported } from '../util/is';
14
14
  let appWrapperDialogId = 0;
15
15
  export class AppWrapper {
16
16
  mapOldApiToNew(retVal) {
17
- var _window, _colorMode, _window2, _AppInfo$TappSelected;
17
+ var _window, _window2, _AppInfo$TappSelected;
18
18
  const {
19
19
  AppInfo,
20
20
  AppUser,
@@ -80,7 +80,7 @@ export class AppWrapper {
80
80
  docked: false
81
81
  },
82
82
  title: AppInfo.Title,
83
- colorMode: (_colorMode = colorMode) !== null && _colorMode !== void 0 ? _colorMode : AppInfo.colorMode,
83
+ colorMode: colorMode !== null && colorMode !== void 0 ? colorMode : AppInfo.colorMode,
84
84
  color,
85
85
  domain: AppInfo.domain,
86
86
  font: {
@@ -327,7 +327,8 @@ export class FrameWrapper {
327
327
  }
328
328
  }
329
329
  async init() {
330
- var _this2 = this;
330
+ var _await$exposed$_custo,
331
+ _this2 = this;
331
332
  if (this.initialized) return;
332
333
  const exposed = comlink.wrap(comlink.windowEndpoint(window.parent))[window.name];
333
334
  const dataListener = () => exposed.addDataListener(comlink.proxy(_ref => {
@@ -357,7 +358,7 @@ export class FrameWrapper {
357
358
  this.values = await exposed.getInitialData();
358
359
  this.exposedFunctions = exposed.functions;
359
360
  this.exposedCustomFunctions = exposed.customFunctions;
360
- this.exposedCustomFunctionNames = await exposed._customFunctionNames;
361
+ this.exposedCustomFunctionNames = (_await$exposed$_custo = await exposed._customFunctionNames) !== null && _await$exposed$_custo !== void 0 ? _await$exposed$_custo : [];
361
362
  this.customFunctions = this.exposedCustomFunctionNames.reduce((p, e) => {
362
363
  p[e] = function () {
363
364
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
@@ -4,15 +4,15 @@ import { ChaynsApiDevice, ChaynsApiSite, ChaynsReactFunctions, UserInfo } from '
4
4
  * @category Event listener
5
5
  */
6
6
  export declare const addGeoLocationListener: (value: {
7
- timeout?: number | undefined;
8
- silent?: boolean | undefined;
7
+ timeout?: number;
8
+ silent?: boolean;
9
9
  }, callback: (geoLocation: import("../types/IChaynsReact").GeoLocation) => void) => Promise<number>;
10
10
  /**
11
11
  * Adds a listener for scroll event by user.
12
12
  * @category Event listener
13
13
  */
14
14
  export declare const addScrollListener: (value: {
15
- throttle?: number | undefined;
15
+ throttle?: number;
16
16
  }, callback: (result: import("../types/IChaynsReact").ScrollListenerResult) => void) => Promise<number>;
17
17
  /**
18
18
  * This method will be executed when the page gets displayed or hidden.
@@ -45,8 +45,8 @@ export declare const getAvailableSharingServices: () => Promise<import("../types
45
45
  * This method determines your location. If you want to track a route, use addGeoLocationListener.
46
46
  */
47
47
  export declare const getGeoLocation: (value: {
48
- timeout?: number | undefined;
49
- silent?: boolean | undefined;
48
+ timeout?: number;
49
+ silent?: boolean;
50
50
  }) => Promise<import("../types/IChaynsReact").GeoLocation>;
51
51
  /**
52
52
  * This method returns user information for a specific user.
@@ -185,7 +185,7 @@ export declare const setWaitCursor: (value: import("../types/IChaynsReact").Wait
185
185
  /**
186
186
  * Retrieves the value that is assigned to the key from a storage outside the frame
187
187
  */
188
- export declare const storageGetItem: <T extends string | number | object>(key: string, accessMode?: import("../types/IChaynsReact").AccessMode | undefined) => Promise<T | undefined>;
188
+ export declare const storageGetItem: <T extends object | number | string>(key: string, accessMode?: import("../types/IChaynsReact").AccessMode | undefined) => Promise<T | undefined>;
189
189
  /**
190
190
  * Removes the value that is assigned to the key from a storage outside the frame
191
191
  */
@@ -234,13 +234,13 @@ export declare const getParameters: () => {
234
234
  export declare const getPages: () => import("../types/IChaynsReact").Page[];
235
235
  export declare const getEnvironment: () => {
236
236
  buildEnvironment: import("../types/IChaynsReact").Environment;
237
- runtimeEnvironment: string | import("../types/IChaynsReact").RuntimeEnviroment;
237
+ runtimeEnvironment: import("../types/IChaynsReact").RuntimeEnviroment | string;
238
238
  };
239
239
  /**
240
240
  * Returns the customFunction. Prefer usage via useCustomFunction when possible
241
241
  * @param key functionName
242
242
  */
243
- export declare const getCustomFunction: <A extends any[], T>(key: string) => (...args: A) => Promise<T>;
243
+ export declare const getCustomFunction: <A extends Array<any>, T>(key: string) => (...args: A) => Promise<T>;
244
244
  export declare const user: UserInfo;
245
245
  export declare const site: ChaynsApiSite;
246
246
  export declare const device: ChaynsApiDevice;
@@ -257,5 +257,5 @@ export declare const parameters: {
257
257
  export declare const pages: import("../types/IChaynsReact").Page[];
258
258
  export declare const environment: {
259
259
  buildEnvironment: import("../types/IChaynsReact").Environment;
260
- runtimeEnvironment: string | import("../types/IChaynsReact").RuntimeEnviroment;
260
+ runtimeEnvironment: import("../types/IChaynsReact").RuntimeEnviroment | string;
261
261
  };
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import { IChaynsReact } from '../types/IChaynsReact';
3
2
  export declare const ChaynsContext: import("react").Context<IChaynsReact | null>;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import React, { RefObject } from 'react';
3
2
  type Props = {
4
3
  innerRef?: RefObject<unknown>;
@@ -9,7 +8,7 @@ export declare const withCompatMode: <P extends Props>(Component: React.Componen
9
8
  new (props: P): {
10
9
  ref: RefObject<HTMLDivElement>;
11
10
  root: any;
12
- timeout?: NodeJS.Timeout | undefined;
11
+ timeout?: ReturnType<typeof setTimeout>;
13
12
  componentDidMount(): void;
14
13
  componentDidUpdate(): void;
15
14
  componentWillUnmount(): void;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @category Hooks
3
2
  * Returns customCallbackFunction
3
+ * @category Hooks
4
4
  * @deprecated Use customFunction/useCustomFunction-interface instead if possible
5
5
  */
6
6
  export declare const useCustomCallbackFunction: () => (type: string, data: unknown) => Promise<unknown>;
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Returns the customFunction
3
+ * @category Hooks
3
4
  * @param key functionName
4
5
  */
5
- export declare const useCustomFunction: <A extends any[], T>(key: string) => (...args: A) => Promise<T>;
6
+ export declare const useCustomFunction: <A extends Array<any>, T>(key: string) => (...args: A) => Promise<T>;
@@ -2,4 +2,4 @@ import { ChaynsReactValues } from '../types/IChaynsReact';
2
2
  /**
3
3
  * @category Hooks
4
4
  */
5
- export declare const useParameters: () => ChaynsReactValues['parameters'];
5
+ export declare const useParameters: () => ChaynsReactValues["parameters"];
@@ -778,7 +778,7 @@ export declare enum Language {
778
778
  export declare enum RuntimeEnviroment {
779
779
  Unknown = 0,
780
780
  ChaynsDe = 1,
781
- ChaynsWeb = 2,
781
+ ChaynsWeb = 2,// ?
782
782
  ChaynsRuntime = 3,
783
783
  IntercomPlugin = 4,
784
784
  PagemakerPlugin = 5,
@@ -1,6 +1,6 @@
1
1
  import { ChaynsApiDevice, ScreenSize } from '../types/IChaynsReact';
2
2
  declare const getDeviceInfo: (userAgent: string, acceptHeader: string, { imei }?: {
3
- imei?: string | undefined;
3
+ imei?: string;
4
4
  }) => ChaynsApiDevice;
5
5
  export declare const getClientDeviceInfo: () => {
6
6
  isTouch: boolean;
@@ -9,7 +9,6 @@ export declare class AppWrapper implements IChaynsReact {
9
9
  notImplemented(call: string): void;
10
10
  counter: number;
11
11
  appCall(action: any, value?: unknown, { callback, awaitResult }?: {
12
- callback: any;
13
12
  awaitResult?: boolean | undefined;
14
13
  }): Promise<unknown> | undefined;
15
14
  functions: ChaynsReactFunctions;
package/package.json CHANGED
@@ -1,88 +1,81 @@
1
- {
2
- "name": "chayns-api",
3
- "version": "2.1.7",
4
- "description": "new chayns api",
5
- "main": "dist/cjs/index.js",
6
- "module": "dist/esm/index.js",
7
- "types": "dist/types/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "require": "./dist/cjs/index.js",
11
- "import": "./dist/esm/index.js",
12
- "types": "./dist/types/index.d.ts"
13
- }
14
- },
15
- "keywords": [
16
- "chayns",
17
- "chayns-toolkit",
18
- "react"
19
- ],
20
- "scripts": {
21
- "start": "npm run dev",
22
- "build:umd": "chayns-toolkit build",
23
- "build:cjs": "cross-env NODE_ENV=cjs babel src --out-dir dist/cjs --extensions=.ts,.tsx",
24
- "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --extensions=.ts,.tsx",
25
- "build-docs": "npm i && cd website && npm i && npm run build",
26
- "build:typescript": "tsc",
27
- "watch:cjs": "npm run build:cjs -- --watch",
28
- "watch:esm": "npm run build:esm -- --watch",
29
- "watch:typescript": "tsc -w",
30
- "watch": "concurrently \"npm run watch:cjs\" \"npm run watch:esm\" \"npm run watch:typescript\"",
31
- "dev": "npm link && npm run watch",
32
- "format": "prettier . --write",
33
- "lint": "eslint src",
34
- "prepublishOnly": "npm run build:cjs && npm run build:esm && npm run build:typescript",
35
- "preversion": "npm run build:typescript -- --noEmit --emitDeclarationOnly false"
36
- },
37
- "prettier": {
38
- "proseWrap": "always",
39
- "singleQuote": true,
40
- "tabWidth": 4
41
- },
42
- "eslintConfig": {
43
- "extends": "@chayns-toolkit"
44
- },
45
- "dependencies": {
46
- "@module-federation/enhanced": "^0.6.10",
47
- "@module-federation/runtime": "^0.6.9",
48
- "@types/semver": "^7.5.8",
49
- "comlink": "4.3.1",
50
- "htmlescape": "^1.1.1",
51
- "lodash.throttle": "^4.1.1",
52
- "prop-types": "^15.7.2",
53
- "scheduler": "^0.23.0",
54
- "semaphore-async-await": "^1.5.1",
55
- "ua-parser-js": "^1.0.38",
56
- "use-sync-external-store": "^1.4.0",
57
- "util": "^0.12.5"
58
- },
59
- "devDependencies": {
60
- "@babel/cli": "^7.24.1",
61
- "@babel/core": "^7.24.4",
62
- "@babel/preset-env": "^7.24.4",
63
- "@babel/preset-react": "^7.24.1",
64
- "@babel/preset-typescript": "^7.24.1",
65
- "@chayns-toolkit/eslint-config": "^2.0.0",
66
- "@testing-library/react": "^16.0.1",
67
- "@types/htmlescape": "^1.1.3",
68
- "@types/lodash.throttle": "^4.1.9",
69
- "@types/prop-types": "^15.7.12",
70
- "@types/react": "^18.2.78",
71
- "@types/react-dom": "^18.2.25",
72
- "@types/ua-parser-js": "^0.7.39",
73
- "@typescript-eslint/parser": "^7.6.0",
74
- "chayns-toolkit": "^2.0.9",
75
- "concurrently": "^8.2.2",
76
- "cross-env": "^7.0.3",
77
- "postcss-prefix-selector": "^1.13.0",
78
- "prettier": "^3.2.5",
79
- "prettier-plugin-packagejson": "^2.5.0",
80
- "react": "^18.3.1",
81
- "react-dom": "^18.3.1",
82
- "typescript": "^4.9.5"
83
- },
84
- "peerDependencies": {
85
- "react": "^16.8 || ^17.0.1 || ^18.0.0 || ^19.0.0",
86
- "react-dom": "^16.8 || ^17.0.1 || ^18.0.0 || ^19.0.0"
87
- }
88
- }
1
+ {
2
+ "name": "chayns-api",
3
+ "version": "2.1.9-0",
4
+ "description": "new chayns api",
5
+ "main": "dist/cjs/index.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "require": "./dist/cjs/index.js",
11
+ "import": "./dist/esm/index.js",
12
+ "types": "./dist/types/index.d.ts"
13
+ }
14
+ },
15
+ "keywords": [
16
+ "chayns",
17
+ "chayns-toolkit",
18
+ "react"
19
+ ],
20
+ "scripts": {
21
+ "start": "npm run dev",
22
+ "build:umd": "chayns-toolkit build",
23
+ "build:cjs": "cross-env NODE_ENV=cjs babel src --out-dir dist/cjs --extensions=.ts,.tsx",
24
+ "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --extensions=.ts,.tsx",
25
+ "build-docs": "npm i && cd website && npm i && npm run build",
26
+ "build:typescript": "tsc",
27
+ "watch:cjs": "npm run build:cjs -- --watch",
28
+ "watch:esm": "npm run build:esm -- --watch",
29
+ "watch:typescript": "tsc -w",
30
+ "watch": "concurrently \"npm run watch:cjs\" \"npm run watch:esm\" \"npm run watch:typescript\"",
31
+ "dev": "npm link && npm run watch",
32
+ "format": "prettier . --write",
33
+ "lint": "eslint src",
34
+ "prepublishOnly": "npm run build:cjs && npm run build:esm && npm run build:typescript",
35
+ "preversion": "npm run build:typescript -- --noEmit"
36
+ },
37
+ "prettier": {
38
+ "proseWrap": "always",
39
+ "singleQuote": true,
40
+ "tabWidth": 4
41
+ },
42
+ "eslintConfig": {
43
+ "extends": "@chayns-toolkit"
44
+ },
45
+ "dependencies": {
46
+ "@module-federation/enhanced": "^0.8.9",
47
+ "comlink": "4.3.1",
48
+ "htmlescape": "^1.1.1",
49
+ "lodash.throttle": "^4.1.1",
50
+ "ua-parser-js": "^1.0.40",
51
+ "use-sync-external-store": "^1.4.0"
52
+ },
53
+ "devDependencies": {
54
+ "@babel/cli": "^7.26.4",
55
+ "@babel/core": "^7.26.0",
56
+ "@babel/preset-env": "^7.26.0",
57
+ "@babel/preset-react": "^7.26.3",
58
+ "@babel/preset-typescript": "^7.26.0",
59
+ "@chayns-toolkit/eslint-config": "^2.0.0",
60
+ "@types/htmlescape": "^1.1.3",
61
+ "@types/lodash.throttle": "^4.1.9",
62
+ "@types/prop-types": "^15.7.12",
63
+ "@types/react": "^18.2.78",
64
+ "@types/react-dom": "^18.2.25",
65
+ "@types/ua-parser-js": "^0.7.39",
66
+ "@types/use-sync-external-store": "^0.0.6",
67
+ "@typescript-eslint/parser": "^7.6.0",
68
+ "chayns-toolkit": "^2.0.13",
69
+ "concurrently": "^9.1.2",
70
+ "cross-env": "^7.0.3",
71
+ "prettier": "^3.4.2",
72
+ "prettier-plugin-packagejson": "^2.5.8",
73
+ "react": "^18.3.1",
74
+ "react-dom": "^18.3.1",
75
+ "typescript": "^5.7.3"
76
+ },
77
+ "peerDependencies": {
78
+ "react": "^16.8 || ^17.0.1 || ^18.0.0 || ^19.0.0",
79
+ "react-dom": "^16.8 || ^17.0.1 || ^18.0.0 || ^19.0.0"
80
+ }
81
+ }
package/toolkit.config.js CHANGED
@@ -1,20 +1,20 @@
1
- const path = require('path');
2
-
3
- module.exports = {
4
- development: {
5
- host: "0.0.0.0",
6
- port: 8081,
7
- },
8
- output: {
9
- singleBundle: true,
10
- filename: 'chayns-api.js',
11
- path: path.resolve(__dirname, 'dist'),
12
- },
13
- webpack(config) {
14
- config.output.library = {
15
- name: 'ChaynsApi',
16
- type: 'umd',
17
- }
18
- return config;
19
- }
20
- };
1
+ const path = require('path');
2
+
3
+ module.exports = {
4
+ development: {
5
+ host: "0.0.0.0",
6
+ port: 8081,
7
+ },
8
+ output: {
9
+ singleBundle: true,
10
+ filename: 'chayns-api.js',
11
+ path: path.resolve(__dirname, 'dist'),
12
+ },
13
+ webpack(config) {
14
+ config.output.library = {
15
+ name: 'ChaynsApi',
16
+ type: 'umd',
17
+ }
18
+ return config;
19
+ }
20
+ };
package/tsconfig.json CHANGED
@@ -1,56 +1,56 @@
1
- {
2
- "compilerOptions": {
3
- /* Basic Options */
4
- "target": "ES2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
5
- "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
6
- // "lib": [], /* Specify library files to be included in the compilation: */
7
- // "allowJs": true, /* Allow javascript files to be compiled. */
8
- // "checkJs": true, /* Report errors in .js files. */
9
- "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
10
- "declaration": true, /* Generates corresponding '.d.ts' file. */
11
- // "sourceMap": true, /* Generates corresponding '.map' file. */
12
- // "outFile": "./", /* Concatenate and emit output to single file. */
13
- "outDir": "dist/types", /* Redirect output structure to the directory. */
14
- // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
15
- // "removeComments": true, /* Do not emit comments to output. */
16
- "noEmit": false, /* Do not emit outputs. */
17
- "emitDeclarationOnly": true,
18
- // "importHelpers": true, /* Import emit helpers from 'tslib'. */
19
- // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
20
- // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
21
- "skipLibCheck": true,
22
-
23
- /* Strict Type-Checking Options */
24
- "strict": true, /* Enable all strict type-checking options. */
25
- "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
26
- // "strictNullChecks": true, /* Enable strict null checks. */
27
- // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
28
- // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
29
-
30
- /* Additional Checks */
31
- // "noUnusedLocals": true, /* Report errors on unused locals. */
32
- // "noUnusedParameters": true, /* Report errors on unused parameters. */
33
- // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
34
- // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
35
-
36
- /* Module Resolution Options */
37
- "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
38
- "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
39
- // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
40
- "rootDirs": ["./src"], /* List of root folders whose combined content represents the structure of the project at runtime. */
41
- // "typeRoots": [], /* List of folders to include type definitions from. */
42
- // "types": [], /* Type declaration files to be included in compilation. */
43
- "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
44
-
45
- /* Source Map Options */
46
- // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
47
- // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
48
- // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
49
- // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
50
-
51
- /* Experimental Options */
52
- // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
53
- // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
54
- },
55
- "exclude": ["node_modules", "**/*.spec.ts", "**/*.spec.tsx", "dist"]
56
- }
1
+ {
2
+ "compilerOptions": {
3
+ /* Basic Options */
4
+ "target": "ES2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
5
+ "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
6
+ // "lib": [], /* Specify library files to be included in the compilation: */
7
+ // "allowJs": true, /* Allow javascript files to be compiled. */
8
+ // "checkJs": true, /* Report errors in .js files. */
9
+ "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
10
+ "declaration": true, /* Generates corresponding '.d.ts' file. */
11
+ // "sourceMap": true, /* Generates corresponding '.map' file. */
12
+ // "outFile": "./", /* Concatenate and emit output to single file. */
13
+ "outDir": "dist/types", /* Redirect output structure to the directory. */
14
+ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
15
+ // "removeComments": true, /* Do not emit comments to output. */
16
+ "noEmit": false, /* Do not emit outputs. */
17
+ "emitDeclarationOnly": true,
18
+ // "importHelpers": true, /* Import emit helpers from 'tslib'. */
19
+ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
20
+ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
21
+ "skipLibCheck": true,
22
+
23
+ /* Strict Type-Checking Options */
24
+ "strict": true, /* Enable all strict type-checking options. */
25
+ "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
26
+ // "strictNullChecks": true, /* Enable strict null checks. */
27
+ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
28
+ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
29
+
30
+ /* Additional Checks */
31
+ // "noUnusedLocals": true, /* Report errors on unused locals. */
32
+ // "noUnusedParameters": true, /* Report errors on unused parameters. */
33
+ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
34
+ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
35
+
36
+ /* Module Resolution Options */
37
+ "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
38
+ "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
39
+ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
40
+ "rootDirs": ["./src"], /* List of root folders whose combined content represents the structure of the project at runtime. */
41
+ // "typeRoots": [], /* List of folders to include type definitions from. */
42
+ // "types": [], /* Type declaration files to be included in compilation. */
43
+ "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
44
+
45
+ /* Source Map Options */
46
+ // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
47
+ // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
48
+ // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
49
+ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
50
+
51
+ /* Experimental Options */
52
+ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
53
+ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
54
+ },
55
+ "exclude": ["node_modules", "**/*.spec.ts", "**/*.spec.tsx", "dist"]
56
+ }