chayns-api 1.0.68-0 → 1.0.69
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 +30 -30
- package/.eslintrc +17 -17
- package/.github/workflows/deploy_docs.yml +28 -28
- package/.github/workflows/publish.yml +21 -21
- package/LICENSE +21 -21
- package/README.md +54 -54
- package/dist/cjs/calls/dialogs/date.js +34 -34
- package/dist/cjs/calls/index.js +108 -108
- package/dist/cjs/calls/sendMessage.js +8 -8
- package/dist/cjs/calls/visibilityChangeListener.js +4 -4
- package/dist/cjs/components/AppDialogWrapper.js +2 -2
- package/dist/cjs/components/ChaynsProvider.js +1 -1
- package/dist/cjs/components/ErrorBoundary.js +1 -1
- package/dist/cjs/components/withCompatMode.js +2 -2
- package/dist/cjs/hooks/geoLocationListener.js +4 -4
- package/dist/cjs/hooks/scrollListener.js +8 -8
- package/dist/cjs/hooks/useAccessToken.js +3 -3
- package/dist/cjs/hooks/useCurrentPage.js +2 -2
- package/dist/cjs/hooks/useCustomData.js +2 -2
- package/dist/cjs/hooks/useDevice.js +2 -2
- package/dist/cjs/hooks/useDialogState.js +4 -4
- package/dist/cjs/hooks/useEnvironment.js +2 -2
- package/dist/cjs/hooks/useFunctions.js +2 -2
- package/dist/cjs/hooks/useIsAdminMode.js +2 -2
- package/dist/cjs/hooks/useLanguage.js +2 -2
- package/dist/cjs/hooks/usePages.js +4 -4
- package/dist/cjs/hooks/useParameters.js +2 -2
- package/dist/cjs/hooks/useSite.js +2 -2
- package/dist/cjs/hooks/useUser.js +2 -2
- package/dist/cjs/hooks/useValues.js +2 -2
- package/dist/cjs/hooks/windowMetricsListener.js +4 -4
- package/dist/cjs/host/ChaynsHost.js +40 -21
- package/dist/cjs/host/iframe/HostIframe.js +2 -2
- package/dist/cjs/host/module/ModuleHost.js +20 -5
- package/dist/cjs/host/module/utils/loadComponent.js +53 -98
- package/dist/cjs/host/module/utils/useDynamicScript.js +59 -0
- package/dist/cjs/index.js +1 -36
- package/dist/cjs/types/IChaynsReact.js +4 -4
- package/dist/cjs/util/heightHelper.js +1 -1
- package/dist/cjs/util/url.js +1 -1
- package/dist/cjs/wrapper/AppWrapper.js +6 -6
- package/dist/cjs/wrapper/FrameWrapper.js +1 -1
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +1 -1
- package/dist/esm/calls/dialogs/date.js +34 -34
- package/dist/esm/calls/index.js +108 -108
- package/dist/esm/calls/sendMessage.js +8 -8
- package/dist/esm/calls/visibilityChangeListener.js +4 -4
- package/dist/esm/components/AppDialogWrapper.js +1 -1
- package/dist/esm/components/withCompatMode.js +1 -1
- package/dist/esm/handler/DialogHandler.js +1 -1
- package/dist/esm/hooks/geoLocationListener.js +4 -4
- package/dist/esm/hooks/scrollListener.js +8 -8
- package/dist/esm/hooks/useAccessToken.js +3 -3
- package/dist/esm/hooks/useCurrentPage.js +2 -2
- package/dist/esm/hooks/useCustomData.js +2 -2
- package/dist/esm/hooks/useDevice.js +2 -2
- package/dist/esm/hooks/useDialogState.js +4 -4
- package/dist/esm/hooks/useEnvironment.js +2 -2
- package/dist/esm/hooks/useFunctions.js +2 -2
- package/dist/esm/hooks/useIsAdminMode.js +2 -2
- package/dist/esm/hooks/useLanguage.js +2 -2
- package/dist/esm/hooks/usePages.js +4 -4
- package/dist/esm/hooks/useParameters.js +2 -2
- package/dist/esm/hooks/useSite.js +2 -2
- package/dist/esm/hooks/useUser.js +2 -2
- package/dist/esm/hooks/useValues.js +2 -2
- package/dist/esm/hooks/windowMetricsListener.js +4 -4
- package/dist/esm/host/ChaynsHost.js +39 -18
- package/dist/esm/host/iframe/HostIframe.js +1 -1
- package/dist/esm/host/module/ModuleHost.js +19 -4
- package/dist/esm/host/module/utils/loadComponent.js +53 -99
- package/dist/esm/host/module/utils/useDynamicScript.js +50 -0
- package/dist/esm/index.js +0 -3
- package/dist/esm/types/IChaynsReact.js +4 -4
- package/dist/esm/util/url.js +2 -2
- package/dist/esm/wrapper/AppWrapper.js +6 -6
- package/dist/esm/wrapper/FrameWrapper.js +1 -1
- package/dist/esm/wrapper/StaticChaynsApi.js +1 -1
- package/dist/types/calls/dialogs/alert.d.ts +1 -1
- package/dist/types/calls/dialogs/chaynsDialog.d.ts +24 -24
- package/dist/types/calls/dialogs/close.d.ts +1 -1
- package/dist/types/calls/dialogs/communication.d.ts +3 -3
- package/dist/types/calls/dialogs/confirm.d.ts +13 -13
- package/dist/types/calls/dialogs/date.d.ts +96 -96
- package/dist/types/calls/dialogs/dropUpAlert.d.ts +5 -5
- package/dist/types/calls/dialogs/fileSelect.d.ts +16 -16
- package/dist/types/calls/dialogs/iFrame.d.ts +10 -10
- package/dist/types/calls/dialogs/index.d.ts +14 -14
- package/dist/types/calls/dialogs/input.d.ts +15 -15
- package/dist/types/calls/dialogs/mediaSelect.d.ts +8 -8
- package/dist/types/calls/dialogs/open.d.ts +1 -1
- package/dist/types/calls/dialogs/select.d.ts +6 -6
- package/dist/types/calls/dialogs/signature.d.ts +7 -7
- package/dist/types/calls/dialogs/toast.d.ts +1 -1
- package/dist/types/calls/dialogs/utils/callback.d.ts +1 -1
- package/dist/types/calls/dialogs/utils/is.d.ts +4 -4
- package/dist/types/calls/getUserInfo.d.ts +9 -9
- package/dist/types/calls/index.d.ts +259 -255
- package/dist/types/calls/sendMessage.d.ts +13 -13
- package/dist/types/calls/visibilityChangeListener.d.ts +9 -9
- package/dist/types/components/AppDialogWrapper.d.ts +5 -5
- package/dist/types/components/ChaynsContext.d.ts +3 -3
- package/dist/types/components/ChaynsProvider.d.ts +11 -11
- package/dist/types/components/ErrorBoundary.d.ts +13 -13
- package/dist/types/components/WaitUntil.d.ts +7 -7
- package/dist/types/components/moduleWrapper.d.ts +4 -4
- package/dist/types/components/withCompatMode.d.ts +13 -13
- package/dist/types/constants/languages.d.ts +12 -12
- package/dist/types/handler/DialogHandler.d.ts +18 -18
- package/dist/types/helper/apiListenerHelper.d.ts +6 -6
- package/dist/types/hooks/geoLocationListener.d.ts +18 -18
- package/dist/types/hooks/index.d.ts +17 -17
- package/dist/types/hooks/scrollListener.d.ts +28 -28
- package/dist/types/hooks/useAccessToken.d.ts +6 -6
- package/dist/types/hooks/useCurrentPage.d.ts +4 -7
- package/dist/types/hooks/useCustomData.d.ts +4 -4
- package/dist/types/hooks/useDevice.d.ts +5 -5
- package/dist/types/hooks/useDialogState.d.ts +9 -9
- package/dist/types/hooks/useEnvironment.d.ts +5 -5
- package/dist/types/hooks/useFunctions.d.ts +5 -5
- package/dist/types/hooks/useIsAdminMode.d.ts +4 -4
- package/dist/types/hooks/useLanguage.d.ts +5 -5
- package/dist/types/hooks/usePages.d.ts +18 -18
- package/dist/types/hooks/useParameters.d.ts +5 -5
- package/dist/types/hooks/useSite.d.ts +5 -5
- package/dist/types/hooks/useUser.d.ts +5 -5
- package/dist/types/hooks/useValues.d.ts +5 -5
- package/dist/types/hooks/windowMetricsListener.d.ts +11 -11
- package/dist/types/host/ChaynsHost.d.ts +30 -29
- package/dist/types/host/iframe/HostIframe.d.ts +26 -26
- package/dist/types/host/iframe/utils/useUpdateData.d.ts +3 -3
- package/dist/types/host/module/ModuleHost.d.ts +27 -28
- package/dist/types/host/module/utils/loadComponent.d.ts +1 -3
- package/dist/types/host/module/utils/useDynamicScript.d.ts +9 -0
- package/dist/types/index.d.ts +19 -22
- package/dist/types/types/IChaynsReact.d.ts +820 -820
- package/dist/types/types/dialog.d.ts +41 -41
- package/dist/types/util/appCall.d.ts +2 -2
- package/dist/types/util/deviceHelper.d.ts +7 -7
- package/dist/types/util/heightHelper.d.ts +1 -1
- package/dist/types/util/postIframeForm.d.ts +1 -1
- package/dist/types/util/transferNestedFunctions.d.ts +1 -1
- package/dist/types/util/url.d.ts +1 -1
- package/dist/types/wrapper/AppWrapper.d.ts +22 -22
- package/dist/types/wrapper/FrameWrapper.d.ts +15 -15
- package/dist/types/wrapper/ModuleFederationWrapper.d.ts +10 -10
- package/dist/types/wrapper/SsrWrapper.d.ts +11 -11
- package/dist/types/wrapper/StaticChaynsApi.d.ts +16 -16
- package/package.json +78 -86
- package/toolkit.config.js +20 -20
- package/tsconfig.json +56 -56
- package/dist/chayns-api.js +0 -2
- package/dist/chayns-api.js.LICENSE.txt +0 -51
- package/dist/cjs/components/withHydrationBoundary.js +0 -54
- package/dist/cjs/constants/hydrationContext.js +0 -16
- package/dist/cjs/constants/index.js +0 -16
- package/dist/esm/components/withHydrationBoundary.js +0 -47
- package/dist/esm/constants/hydrationContext.js +0 -10
- package/dist/esm/constants/index.js +0 -1
- package/dist/types/components/withHydrationBoundary.d.ts +0 -17
- package/dist/types/constants/hydrationContext.d.ts +0 -9
- package/dist/types/constants/index.d.ts +0 -1
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
object-assign
|
|
3
|
-
(c) Sindre Sorhus
|
|
4
|
-
@license MIT
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @license React
|
|
9
|
-
* scheduler.production.min.js
|
|
10
|
-
*
|
|
11
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
12
|
-
*
|
|
13
|
-
* This source code is licensed under the MIT license found in the
|
|
14
|
-
* LICENSE file in the root directory of this source tree.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/** @license React v0.20.2
|
|
18
|
-
* scheduler.production.min.js
|
|
19
|
-
*
|
|
20
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
21
|
-
*
|
|
22
|
-
* This source code is licensed under the MIT license found in the
|
|
23
|
-
* LICENSE file in the root directory of this source tree.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/** @license React v17.0.2
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
/** @license React v17.0.2
|
|
36
|
-
* react-jsx-runtime.production.min.js
|
|
37
|
-
*
|
|
38
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the MIT license found in the
|
|
41
|
-
* LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
/** @license React v17.0.2
|
|
45
|
-
* react.production.min.js
|
|
46
|
-
*
|
|
47
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the MIT license found in the
|
|
50
|
-
* LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _constants = require("../constants");
|
|
9
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
-
const withHydrationBoundary = (Component, initializer, useHydrationId) => {
|
|
12
|
-
return ({
|
|
13
|
-
id: idProp,
|
|
14
|
-
children
|
|
15
|
-
}) => {
|
|
16
|
-
let value;
|
|
17
|
-
if (!globalThis.window) {
|
|
18
|
-
value = (0, _react.useContext)(_constants.HydrationContext);
|
|
19
|
-
}
|
|
20
|
-
const id = useHydrationId ? useHydrationId() : idProp;
|
|
21
|
-
if (!id) {
|
|
22
|
-
throw new Error('hydration boundary was not given a id which is required');
|
|
23
|
-
}
|
|
24
|
-
const [store] = (0, _react.useState)(() => {
|
|
25
|
-
if (!globalThis.window && id in value) {
|
|
26
|
-
return value[id];
|
|
27
|
-
}
|
|
28
|
-
let initialValue = undefined;
|
|
29
|
-
if (globalThis.window) {
|
|
30
|
-
const htmlId = `__INITIAL_DATA_${id}__`;
|
|
31
|
-
const $elem = document.getElementById(htmlId);
|
|
32
|
-
if ($elem) {
|
|
33
|
-
initialValue = JSON.parse($elem.innerHTML);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const s = initializer(initialValue);
|
|
37
|
-
if (!globalThis.window) {
|
|
38
|
-
value[id] = s;
|
|
39
|
-
}
|
|
40
|
-
return s;
|
|
41
|
-
});
|
|
42
|
-
(0, _react.useEffect)(() => {
|
|
43
|
-
const htmlId = `__INITIAL_DATA_${id}__`;
|
|
44
|
-
const $elem = document.getElementById(htmlId);
|
|
45
|
-
if ($elem) {
|
|
46
|
-
$elem.remove();
|
|
47
|
-
}
|
|
48
|
-
}, []);
|
|
49
|
-
return /*#__PURE__*/_react.default.createElement(Component, {
|
|
50
|
-
value: store
|
|
51
|
-
}, children);
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
var _default = exports.default = withHydrationBoundary;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.HydrationContext = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
let HydrationContext = exports.HydrationContext = void 0;
|
|
9
|
-
|
|
10
|
-
// force single context on server-side (fake sharing)
|
|
11
|
-
if (!globalThis.window && globalThis._hydrationContext) {
|
|
12
|
-
exports.HydrationContext = HydrationContext = globalThis._hydrationContext;
|
|
13
|
-
} else {
|
|
14
|
-
exports.HydrationContext = HydrationContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
15
|
-
globalThis._hydrationContext = HydrationContext;
|
|
16
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _hydrationContext = require("./hydrationContext");
|
|
7
|
-
Object.keys(_hydrationContext).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _hydrationContext[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _hydrationContext[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useEffect, useState } from 'react';
|
|
2
|
-
import { HydrationContext } from '../constants';
|
|
3
|
-
const withHydrationBoundary = (Component, initializer, useHydrationId) => {
|
|
4
|
-
return _ref => {
|
|
5
|
-
let {
|
|
6
|
-
id: idProp,
|
|
7
|
-
children
|
|
8
|
-
} = _ref;
|
|
9
|
-
let value;
|
|
10
|
-
if (!globalThis.window) {
|
|
11
|
-
value = useContext(HydrationContext);
|
|
12
|
-
}
|
|
13
|
-
const id = useHydrationId ? useHydrationId() : idProp;
|
|
14
|
-
if (!id) {
|
|
15
|
-
throw new Error('hydration boundary was not given a id which is required');
|
|
16
|
-
}
|
|
17
|
-
const [store] = useState(() => {
|
|
18
|
-
if (!globalThis.window && id in value) {
|
|
19
|
-
return value[id];
|
|
20
|
-
}
|
|
21
|
-
let initialValue = undefined;
|
|
22
|
-
if (globalThis.window) {
|
|
23
|
-
const htmlId = `__INITIAL_DATA_${id}__`;
|
|
24
|
-
const $elem = document.getElementById(htmlId);
|
|
25
|
-
if ($elem) {
|
|
26
|
-
initialValue = JSON.parse($elem.innerHTML);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
const s = initializer(initialValue);
|
|
30
|
-
if (!globalThis.window) {
|
|
31
|
-
value[id] = s;
|
|
32
|
-
}
|
|
33
|
-
return s;
|
|
34
|
-
});
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
const htmlId = `__INITIAL_DATA_${id}__`;
|
|
37
|
-
const $elem = document.getElementById(htmlId);
|
|
38
|
-
if ($elem) {
|
|
39
|
-
$elem.remove();
|
|
40
|
-
}
|
|
41
|
-
}, []);
|
|
42
|
-
return /*#__PURE__*/React.createElement(Component, {
|
|
43
|
-
value: store
|
|
44
|
-
}, children);
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
export default withHydrationBoundary;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createContext } from 'react';
|
|
2
|
-
export let HydrationContext;
|
|
3
|
-
|
|
4
|
-
// force single context on server-side (fake sharing)
|
|
5
|
-
if (!globalThis.window && globalThis._hydrationContext) {
|
|
6
|
-
HydrationContext = globalThis._hydrationContext;
|
|
7
|
-
} else {
|
|
8
|
-
HydrationContext = /*#__PURE__*/createContext({});
|
|
9
|
-
globalThis._hydrationContext = HydrationContext;
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './hydrationContext';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type StoreLikeValue = object & {
|
|
3
|
-
getState: () => object;
|
|
4
|
-
abort?: () => Promise<void>;
|
|
5
|
-
type?: 'raw' | 'json';
|
|
6
|
-
};
|
|
7
|
-
type HydrationComponent = React.FC<{
|
|
8
|
-
value: StoreLikeValue;
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
}>;
|
|
11
|
-
type Initializer = (initialValue: object | undefined) => StoreLikeValue;
|
|
12
|
-
type HydrationBoundary = React.FC<{
|
|
13
|
-
id?: string;
|
|
14
|
-
children?: React.ReactNode;
|
|
15
|
-
}>;
|
|
16
|
-
declare const withHydrationBoundary: (Component: HydrationComponent, initializer: Initializer, useHydrationId: undefined | (() => string)) => HydrationBoundary;
|
|
17
|
-
export default withHydrationBoundary;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './hydrationContext';
|