chayns-api 1.0.9 → 1.0.10

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.
@@ -32,6 +32,9 @@ const withCompatMode = Component => {
32
32
  ref: innerRef
33
33
  })), this.ref.current);
34
34
  }
35
+ componentWillUnmount() {
36
+ _reactDom.default.render( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null), this.ref.current);
37
+ }
35
38
  render() {
36
39
  return /*#__PURE__*/_react.default.createElement("div", {
37
40
  ref: this.ref
@@ -68,7 +68,7 @@ const HostIframe = ({
68
68
  if (postForm) {
69
69
  var _await$functions$getA;
70
70
  const accessToken = (_await$functions$getA = await functions.getAccessToken()) !== null && _await$functions$getA !== void 0 ? _await$functions$getA : {};
71
- void (0, _postIframeForm.default)((0, _url.replaceStagingUrl)(preventStagingReplacement, src, environment.runtimeEnvironment), JSON.stringify({
71
+ void (0, _postIframeForm.default)((0, _url.replaceStagingUrl)(preventStagingReplacement, src, environment.buildEnvironment), JSON.stringify({
72
72
  ...initialData,
73
73
  pages: undefined,
74
74
  ...accessToken
@@ -128,7 +128,7 @@ const HostIframe = ({
128
128
  },
129
129
  title: " "
130
130
  }, iFrameProps, {
131
- src: postForm ? undefined : (0, _url.replaceStagingUrl)(preventStagingReplacement, src, environment.runtimeEnvironment)
131
+ src: postForm ? undefined : (0, _url.replaceStagingUrl)(preventStagingReplacement, src, environment.buildEnvironment)
132
132
  }));
133
133
  };
134
134
  var _default = HostIframe;
@@ -75,7 +75,7 @@ const ModuleHost = ({
75
75
  }), /*#__PURE__*/_react.default.createElement(System, {
76
76
  system: {
77
77
  scope: system.scope,
78
- url: (0, _url.replaceStagingUrl)(preventStagingReplacement, system.url, environment.runtimeEnvironment),
78
+ url: (0, _url.replaceStagingUrl)(preventStagingReplacement, system.url, environment.buildEnvironment),
79
79
  module: system.module
80
80
  },
81
81
  data: initialData,
@@ -25,6 +25,9 @@ export const withCompatMode = Component => {
25
25
  ref: innerRef
26
26
  })), this.ref.current);
27
27
  }
28
+ componentWillUnmount() {
29
+ ReactDOM.render( /*#__PURE__*/React.createElement(React.Fragment, null), this.ref.current);
30
+ }
28
31
  render() {
29
32
  return /*#__PURE__*/React.createElement("div", {
30
33
  ref: this.ref
@@ -60,7 +60,7 @@ const HostIframe = _ref => {
60
60
  if (postForm) {
61
61
  var _await$functions$getA;
62
62
  const accessToken = (_await$functions$getA = await functions.getAccessToken()) !== null && _await$functions$getA !== void 0 ? _await$functions$getA : {};
63
- void postIframeForm(replaceStagingUrl(preventStagingReplacement, src, environment.runtimeEnvironment), JSON.stringify({
63
+ void postIframeForm(replaceStagingUrl(preventStagingReplacement, src, environment.buildEnvironment), JSON.stringify({
64
64
  ...initialData,
65
65
  pages: undefined,
66
66
  ...accessToken
@@ -120,7 +120,7 @@ const HostIframe = _ref => {
120
120
  },
121
121
  title: " "
122
122
  }, iFrameProps, {
123
- src: postForm ? undefined : replaceStagingUrl(preventStagingReplacement, src, environment.runtimeEnvironment)
123
+ src: postForm ? undefined : replaceStagingUrl(preventStagingReplacement, src, environment.buildEnvironment)
124
124
  }));
125
125
  };
126
126
  export default HostIframe;
@@ -68,7 +68,7 @@ const ModuleHost = _ref2 => {
68
68
  }), /*#__PURE__*/React.createElement(System, {
69
69
  system: {
70
70
  scope: system.scope,
71
- url: replaceStagingUrl(preventStagingReplacement, system.url, environment.runtimeEnvironment),
71
+ url: replaceStagingUrl(preventStagingReplacement, system.url, environment.buildEnvironment),
72
72
  module: system.module
73
73
  },
74
74
  data: initialData,
@@ -1,4 +1,6 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2
4
  /* eslint-disable */
3
5
  // @ts-nocheck
4
6
 
@@ -1,4 +1,6 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2
4
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
3
5
  import * as comlink from 'comlink';
4
6
  import { addVisibilityChangeListener, removeVisibilityChangeListener } from '../calls/visibilityChangeListener';
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { ChaynsReactFunctions, ChaynsReactValues, IChaynsReact } from '../types/IChaynsReact';
3
3
  export declare const moduleWrapper: {
4
4
  current: IChaynsReact;
@@ -8,6 +8,7 @@ type ChaynsProviderProps = {
8
8
  functions?: ChaynsReactFunctions;
9
9
  renderedByServer?: boolean;
10
10
  isModule?: boolean;
11
+ children?: ReactNode;
11
12
  };
12
13
  declare const ChaynsProvider: React.FC<ChaynsProviderProps>;
13
14
  export default ChaynsProvider;
@@ -2,6 +2,7 @@ import { FC, ReactNode } from "react";
2
2
  type TaskList = (TaskList | Promise<unknown> | (() => Promise<unknown>))[];
3
3
  export declare const WaitUntil: FC<{
4
4
  tasks: TaskList;
5
+ children?: ReactNode;
5
6
  loadingComponent?: ReactNode;
6
7
  }>;
7
8
  export {};
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import { FC, ReactNode } from 'react';
2
2
  import { ChaynsApiDevice, ChaynsApiSite, ChaynsApiUser, ChaynsReactFunctions, ChaynsReactValues, Page } from '../../types/IChaynsReact';
3
3
  export type TypeSystem = {
4
4
  scope: string;
@@ -19,6 +19,7 @@ type ModulePropTypes = {
19
19
  customData: any;
20
20
  environment: ChaynsReactValues["environment"];
21
21
  preventStagingReplacement?: boolean;
22
+ children?: ReactNode;
22
23
  };
23
24
  declare const ModuleHost: FC<ModulePropTypes>;
24
25
  export default ModuleHost;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@types/semver": "^7.3.9",
38
- "comlink": "^4.3.1",
38
+ "comlink": "^4.4.1",
39
39
  "detect-browser": "^5.2.1",
40
40
  "htmlescape": "^1.1.1",
41
41
  "lodash.throttle": "^4.1.1",
@@ -46,8 +46,8 @@
46
46
  "use-context-selector": "^1.3.9"
47
47
  },
48
48
  "devDependencies": {
49
- "@babel/cli": "^7.16.0",
50
- "@babel/core": "^7.16.0",
49
+ "@babel/cli": "^7.20.7",
50
+ "@babel/core": "^7.20.12",
51
51
  "@babel/preset-env": "^7.16.4",
52
52
  "@babel/preset-react": "^7.16.0",
53
53
  "@babel/preset-typescript": "^7.16.0",
@@ -56,18 +56,17 @@
56
56
  "@types/htmlescape": "^1.1.1",
57
57
  "@types/lodash.throttle": "^4.1.6",
58
58
  "@types/prop-types": "^15.7.3",
59
- "@types/react": "^17.0.37",
59
+ "@types/react": "^17.0.53",
60
60
  "@types/react-dom": "^17.0.11",
61
- "@typescript-eslint/parser": "^5.4.0",
62
- "chayns-toolkit": "^2.0.0-beta.21",
63
- "concurrently": "^6.5.1",
61
+ "@typescript-eslint/parser": "^5.50.0",
62
+ "concurrently": "^7.6.0",
64
63
  "cross-env": "^7.0.3",
65
64
  "postcss-prefix-selector": "^1.13.0",
66
65
  "prettier": "^2.5.0",
67
66
  "prettier-plugin-packagejson": "^2.2.15",
68
67
  "react": "^17.0.2",
69
68
  "react-dom": "^17.0.2",
70
- "typescript": "^4.5.2"
69
+ "typescript": "^4.9.5"
71
70
  },
72
71
  "peerDependencies": {
73
72
  "react": "^16.8 || ^17.0.1",
package/toolkit.config.js DELETED
@@ -1,52 +0,0 @@
1
- /* eslint-disable import/no-extraneous-dependencies */
2
- const packageJson = require('./package.json');
3
- const webpack = require('webpack');
4
- const { ModuleFederationPlugin } = webpack.container;
5
- const path = require('path');
6
-
7
- /**
8
- * Your `chayns-toolkit.json`-file was automatically converted into this
9
- * JavaScript configuration file, which will be the configuration format going
10
- * forward.
11
- */
12
-
13
- module.exports = {
14
- development: {
15
- host: '0.0.0.0',
16
- port: parseInt(process.env.DEV_PORT, 10) || 8083,
17
- cert: '//fs1/ssl/tobitag.crt',
18
- key: '//fs1/ssl/tobitag.key',
19
- },
20
- webpack(config, { dev }) {
21
- config.output.uniqueName = `module-chayns-api`;
22
-
23
- config.plugins.push(
24
- new ModuleFederationPlugin({
25
- name: 'chayns_api_module2',
26
- filename: 'remoteEntry.js',
27
- exposes: {
28
- './index': './src/index',
29
- './ChaynsProvider': './src/components/ChaynsProvider'
30
- },
31
- shared: {
32
- react: {
33
- requiredVersion: packageJson.peerDependencies?.react || packageJson.dependencies?.react
34
- },
35
- 'react-dom': {
36
- requiredVersion: packageJson.peerDependencies?.["react-dom"] || packageJson.dependencies?.["react-dom"]
37
- }
38
- }
39
- })
40
- )
41
- config.output.chunkLoadingGlobal = `webpackChunkchayns_api__${process.env.BUILD_ENV || process.env.NODE_ENV}__${process.env.VERSION}`;
42
-
43
- config.resolve.alias = {
44
- react: path.resolve('./node_modules/react'),
45
- //'react-dom': path.resolve('./node_modules/react-dom')
46
- };
47
-
48
- delete config.optimization.splitChunks;
49
-
50
- return config;
51
- }
52
- };