chayns-api 1.2.0-8 → 2.0.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 +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 +3 -3
- 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 +1 -1
- package/dist/cjs/host/iframe/HostIframe.js +2 -2
- package/dist/cjs/host/module/ModuleHost.js +1 -1
- package/dist/cjs/host/module/utils/loadComponent.js +2 -3
- package/dist/cjs/index.js +13 -1
- package/dist/cjs/types/IChaynsReact.js +11 -5
- package/dist/cjs/util/bindChaynsApi.js +12 -0
- package/dist/cjs/util/heightHelper.js +1 -1
- package/dist/cjs/util/initModuleFederationSharing.js +32 -32
- package/dist/cjs/wrapper/AppWrapper.js +1 -1
- package/dist/cjs/wrapper/FrameWrapper.js +1 -1
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +1 -1
- package/dist/cjs/wrapper/StaticChaynsApi.js +6 -3
- 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 +2 -2
- 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/iframe/HostIframe.js +1 -1
- package/dist/esm/host/module/utils/loadComponent.js +1 -2
- package/dist/esm/index.js +2 -1
- package/dist/esm/types/IChaynsReact.js +10 -4
- package/dist/esm/util/bindChaynsApi.js +5 -0
- package/dist/esm/util/initModuleFederationSharing.js +32 -31
- package/dist/esm/wrapper/AppWrapper.js +1 -1
- package/dist/esm/wrapper/FrameWrapper.js +1 -1
- package/dist/esm/wrapper/StaticChaynsApi.js +6 -3
- 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 +255 -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 +14 -14
- package/dist/types/components/withHydrationBoundary.d.ts +17 -17
- package/dist/types/constants/hydrationContext.d.ts +9 -9
- package/dist/types/constants/index.d.ts +1 -1
- package/dist/types/constants/languages.d.ts +12 -12
- package/dist/types/handler/DialogHandler.d.ts +24 -24
- 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 +7 -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 +29 -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 +28 -28
- package/dist/types/host/module/utils/loadComponent.d.ts +3 -3
- package/dist/types/index.d.ts +20 -19
- package/dist/types/types/IChaynsReact.d.ts +896 -890
- package/dist/types/types/dialog.d.ts +41 -41
- package/dist/types/util/appCall.d.ts +2 -2
- package/dist/types/util/bindChaynsApi.d.ts +1 -0
- package/dist/types/util/deviceHelper.d.ts +9 -9
- package/dist/types/util/heightHelper.d.ts +1 -1
- package/dist/types/util/initModuleFederationSharing.d.ts +3 -1
- package/dist/types/util/is.d.ts +5 -5
- 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 +19 -19
- 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 +88 -88
- package/toolkit.config.js +20 -20
- package/tsconfig.json +56 -56
- package/dist/cjs/host/module/utils/useDynamicScript.js +0 -59
- package/dist/esm/host/module/utils/useDynamicScript.js +0 -50
- package/dist/types/host/module/utils/useDynamicScript.d.ts +0 -9
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.semaphore = exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _semaphoreAsyncAwait = _interopRequireDefault(require("semaphore-async-await"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
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); }
|
|
11
|
-
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; }
|
|
12
|
-
const semaphore = exports.semaphore = {};
|
|
13
|
-
const useDynamicScript = args => {
|
|
14
|
-
const [ready, setReady] = _react.default.useState(false);
|
|
15
|
-
const [failed, setFailed] = _react.default.useState(false);
|
|
16
|
-
(0, _react.useEffect)(() => {
|
|
17
|
-
if (!args.url) {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
const element = document.createElement('script');
|
|
21
|
-
element.src = args.url;
|
|
22
|
-
element.type = 'text/javascript';
|
|
23
|
-
element.async = true;
|
|
24
|
-
setReady(false);
|
|
25
|
-
setFailed(false);
|
|
26
|
-
if (!(args.scope in semaphore)) {
|
|
27
|
-
semaphore[args.scope] = new _semaphoreAsyncAwait.default(1);
|
|
28
|
-
}
|
|
29
|
-
(async () => {
|
|
30
|
-
await semaphore[args.scope].acquire();
|
|
31
|
-
element.onload = () => {
|
|
32
|
-
setReady(true);
|
|
33
|
-
const listKey = args.scope + "_list";
|
|
34
|
-
if (!window[listKey]) window[listKey] = [];
|
|
35
|
-
window[listKey].push({
|
|
36
|
-
url: args.url,
|
|
37
|
-
container: window[args.scope]
|
|
38
|
-
});
|
|
39
|
-
window[args.scope] = null;
|
|
40
|
-
};
|
|
41
|
-
element.onerror = () => {
|
|
42
|
-
setReady(false);
|
|
43
|
-
setFailed(true);
|
|
44
|
-
};
|
|
45
|
-
document.head.appendChild(element);
|
|
46
|
-
})();
|
|
47
|
-
return () => {
|
|
48
|
-
semaphore[args.scope].release();
|
|
49
|
-
if (document.head.contains(element)) {
|
|
50
|
-
document.head.removeChild(element);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}, [args.url]);
|
|
54
|
-
return {
|
|
55
|
-
ready,
|
|
56
|
-
failed
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
var _default = exports.default = useDynamicScript;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import Semaphore from 'semaphore-async-await';
|
|
3
|
-
export const semaphore = {};
|
|
4
|
-
const useDynamicScript = args => {
|
|
5
|
-
const [ready, setReady] = React.useState(false);
|
|
6
|
-
const [failed, setFailed] = React.useState(false);
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
if (!args.url) {
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
const element = document.createElement('script');
|
|
12
|
-
element.src = args.url;
|
|
13
|
-
element.type = 'text/javascript';
|
|
14
|
-
element.async = true;
|
|
15
|
-
setReady(false);
|
|
16
|
-
setFailed(false);
|
|
17
|
-
if (!(args.scope in semaphore)) {
|
|
18
|
-
semaphore[args.scope] = new Semaphore(1);
|
|
19
|
-
}
|
|
20
|
-
(async () => {
|
|
21
|
-
await semaphore[args.scope].acquire();
|
|
22
|
-
element.onload = () => {
|
|
23
|
-
setReady(true);
|
|
24
|
-
const listKey = args.scope + "_list";
|
|
25
|
-
if (!window[listKey]) window[listKey] = [];
|
|
26
|
-
window[listKey].push({
|
|
27
|
-
url: args.url,
|
|
28
|
-
container: window[args.scope]
|
|
29
|
-
});
|
|
30
|
-
window[args.scope] = null;
|
|
31
|
-
};
|
|
32
|
-
element.onerror = () => {
|
|
33
|
-
setReady(false);
|
|
34
|
-
setFailed(true);
|
|
35
|
-
};
|
|
36
|
-
document.head.appendChild(element);
|
|
37
|
-
})();
|
|
38
|
-
return () => {
|
|
39
|
-
semaphore[args.scope].release();
|
|
40
|
-
if (document.head.contains(element)) {
|
|
41
|
-
document.head.removeChild(element);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}, [args.url]);
|
|
45
|
-
return {
|
|
46
|
-
ready,
|
|
47
|
-
failed
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
export default useDynamicScript;
|