chayns-api 1.0.0 → 1.0.1
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/dist/cjs/bootstrap.js +11 -0
- package/dist/cjs/calls/abstractApiListener.js +40 -0
- package/dist/cjs/calls/apiEventListener.js +40 -0
- package/dist/cjs/calls/dialogs/alert.js +2 -0
- package/dist/cjs/calls/dialogs/chaynsDialog.js +8 -2
- package/dist/cjs/calls/dialogs/close.js +2 -0
- package/dist/cjs/calls/dialogs/communication.js +16 -1
- package/dist/cjs/calls/dialogs/confirm.js +4 -0
- package/dist/cjs/calls/dialogs/date.js +53 -36
- package/dist/cjs/calls/dialogs/dropUpAlert.js +3 -0
- package/dist/cjs/calls/dialogs/fileSelect.js +10 -0
- package/dist/cjs/calls/dialogs/iFrame.js +8 -0
- package/dist/cjs/calls/dialogs/index.js +27 -0
- package/dist/cjs/calls/dialogs/input.js +6 -0
- package/dist/cjs/calls/dialogs/mediaSelect.js +7 -0
- package/dist/cjs/calls/dialogs/open.js +2 -0
- package/dist/cjs/calls/dialogs/select.js +9 -0
- package/dist/cjs/calls/dialogs/signature.js +5 -0
- package/dist/cjs/calls/dialogs/toast.js +3 -0
- package/dist/cjs/calls/dialogs/utils/callback.js +2 -0
- package/dist/cjs/calls/dialogs/utils/is.js +4 -0
- package/dist/cjs/calls/getUserInfo.js +11 -0
- package/dist/cjs/calls/index.js +155 -3
- package/dist/cjs/calls/sendMessage.js +26 -0
- package/dist/cjs/calls/setVisibilityChangeListener.js +1 -0
- package/dist/cjs/calls/visibilityChangeListener.js +12 -1
- package/dist/cjs/calls/windowMetricsListener.js +18 -0
- package/dist/cjs/components/App.js +32 -0
- package/dist/cjs/components/App.spec.js +16 -0
- package/dist/cjs/components/Button.js +32 -0
- package/dist/cjs/components/ChaynsContext.js +4 -2
- package/dist/cjs/components/ChaynsProvider.js +28 -6
- package/dist/cjs/components/ChaynsProviderExposed.js +16 -0
- package/dist/cjs/components/TestProvider.js +236 -0
- package/dist/cjs/components/Title.js +162 -0
- package/dist/cjs/components/WaitUntil.js +5 -0
- package/dist/cjs/components/withCompatMode.js +16 -1
- package/dist/cjs/functions/addApiListener.js +37 -0
- package/dist/cjs/functions/addGeoLocationListener.js +26 -0
- package/dist/cjs/functions/addScrollListener.js +26 -0
- package/dist/cjs/functions/addWindowMetricsListener.js +37 -0
- package/dist/cjs/helper/apiListenerHelper.js +9 -0
- package/dist/cjs/helper/cssLoader.js +28 -0
- package/dist/cjs/hooks/addGeoLocationListener.js +26 -0
- package/dist/cjs/hooks/addScrollListener.js +26 -0
- package/dist/cjs/hooks/addWindowMetricsListener.js +37 -0
- package/dist/cjs/hooks/geoLocation.js +48 -0
- package/dist/cjs/hooks/geoLocationListener.js +11 -2
- package/dist/cjs/hooks/index.js +16 -0
- package/dist/cjs/hooks/scrollListener.js +23 -4
- package/dist/cjs/hooks/useAccessToken.js +5 -0
- package/dist/cjs/hooks/useAddGeoLocationListener.js +26 -0
- package/dist/cjs/hooks/useAddScrollListener.js +48 -0
- package/dist/cjs/hooks/useAddWindowMetricsListener.js +45 -0
- package/dist/cjs/hooks/useAdddScrollListener.js +26 -0
- package/dist/cjs/hooks/useCurrentPage.js +4 -0
- package/dist/cjs/hooks/useCustomData.js +4 -0
- package/dist/cjs/hooks/useDevice.js +4 -0
- package/dist/cjs/hooks/useEnvironment.js +4 -0
- package/dist/cjs/hooks/useFunctions.js +4 -0
- package/dist/cjs/hooks/useIsAdminMode.js +5 -0
- package/dist/cjs/hooks/useLanguage.js +4 -0
- package/dist/cjs/hooks/usePages.js +12 -0
- package/dist/cjs/hooks/useParameters.js +4 -0
- package/dist/cjs/hooks/useSite.js +4 -0
- package/dist/cjs/hooks/useUser.js +4 -0
- package/dist/cjs/hooks/useValues.js +4 -0
- package/dist/cjs/hooks/windowMetrics.js +45 -0
- package/dist/cjs/hooks/windowMetricsListener.js +12 -2
- package/dist/cjs/host/ChaynsHost.js +12 -0
- package/dist/cjs/host/{module/PagemakerFrame.js → HostIframe.js} +75 -23
- package/dist/cjs/host/ModuleHost.js +11 -0
- package/dist/cjs/host/iframe/HostIframe.js +30 -23
- package/dist/cjs/host/iframe/utils/useUpdateData.js +3 -0
- package/dist/cjs/host/module/ModuleHost.js +13 -3
- package/dist/cjs/host/module/utils/loadComponent.js +18 -1
- package/dist/cjs/host/module/utils/useDynamicScript.js +18 -0
- package/dist/cjs/host/module/utils.js +25 -0
- package/dist/cjs/index.example.js +7 -0
- package/dist/cjs/index.js +19 -0
- package/dist/cjs/index2.js +64 -0
- package/dist/cjs/types/DynamicImport.d.js +5 -0
- package/dist/cjs/types/IChaynsReact.js +47 -0
- package/dist/cjs/types/chayns-components.d.js +1 -0
- package/dist/cjs/types/chayns-logger.d.js +1 -0
- package/dist/cjs/types/chayns.d.js +1 -0
- package/dist/cjs/types/tobit-websocket-service-client.d.js +1 -0
- package/dist/cjs/types/toolkit-types.d.js +1 -0
- package/dist/cjs/util/appCall.js +4 -1
- package/dist/cjs/util/deviceHelper.js +17 -2
- package/dist/cjs/util/heightHelper.js +9 -0
- package/dist/cjs/util/postIframeForm.js +5 -0
- package/dist/cjs/util/useFunctionsContext.js +16 -0
- package/dist/cjs/util/useIsAdminMode.js +18 -0
- package/dist/cjs/util/useUser.js +16 -0
- package/dist/cjs/wrapper/AppWrapper.js +144 -119
- package/dist/cjs/wrapper/FrameWrapper.js +248 -215
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +27 -2
- package/dist/cjs/wrapper/SsrWrapper.js +8 -0
- package/dist/esm/bootstrap.js +4 -0
- package/dist/esm/calls/dialogs/alert.js +4 -4
- package/dist/esm/calls/dialogs/chaynsDialog.js +11 -7
- package/dist/esm/calls/dialogs/communication.js +26 -15
- package/dist/esm/calls/dialogs/confirm.js +8 -5
- package/dist/esm/calls/dialogs/date.js +94 -85
- package/dist/esm/calls/dialogs/dropUpAlert.js +1 -1
- package/dist/esm/calls/dialogs/fileSelect.js +62 -23
- package/dist/esm/calls/dialogs/iFrame.js +10 -7
- package/dist/esm/calls/dialogs/input.js +5 -2
- package/dist/esm/calls/dialogs/mediaSelect.js +55 -18
- package/dist/esm/calls/dialogs/open.js +2 -2
- package/dist/esm/calls/dialogs/select.js +9 -5
- package/dist/esm/calls/dialogs/signature.js +2 -0
- package/dist/esm/calls/dialogs/toast.js +11 -6
- package/dist/esm/calls/dialogs/utils/callback.js +5 -3
- package/dist/esm/calls/dialogs/utils/is.js +3 -1
- package/dist/esm/calls/getUserInfo.js +92 -32
- package/dist/esm/calls/index.js +276 -124
- package/dist/esm/calls/sendMessage.js +221 -91
- package/dist/esm/calls/visibilityChangeListener.js +15 -10
- package/dist/esm/components/App.js +35 -0
- package/dist/esm/components/App.spec.js +9 -0
- package/dist/esm/components/Button.js +34 -0
- package/dist/esm/components/ChaynsContext.js +3 -3
- package/dist/esm/components/ChaynsProvider.js +86 -45
- package/dist/esm/components/ChaynsProviderExposed.js +3 -0
- package/dist/esm/components/TestProvider.js +308 -0
- package/dist/esm/components/Title.js +210 -0
- package/dist/esm/components/WaitUntil.js +86 -21
- package/dist/esm/components/withCompatMode.js +77 -35
- package/dist/esm/helper/apiListenerHelper.js +15 -10
- package/dist/esm/helper/cssLoader.js +21 -0
- package/dist/esm/hooks/geoLocationListener.js +46 -20
- package/dist/esm/hooks/scrollListener.js +86 -50
- package/dist/esm/hooks/useAccessToken.js +28 -6
- package/dist/esm/hooks/useAddGeoLocationListener.js +18 -0
- package/dist/esm/hooks/useAddScrollListener.js +18 -0
- package/dist/esm/hooks/useAddWindowMetricsListener.js +18 -0
- package/dist/esm/hooks/useCurrentPage.js +6 -2
- package/dist/esm/hooks/useCustomData.js +6 -2
- package/dist/esm/hooks/useDevice.js +6 -1
- package/dist/esm/hooks/useEnvironment.js +6 -1
- package/dist/esm/hooks/useFunctions.js +5 -2
- package/dist/esm/hooks/useIsAdminMode.js +6 -2
- package/dist/esm/hooks/useLanguage.js +6 -1
- package/dist/esm/hooks/usePages.js +27 -14
- package/dist/esm/hooks/useParameters.js +6 -1
- package/dist/esm/hooks/useSite.js +6 -1
- package/dist/esm/hooks/useUser.js +6 -1
- package/dist/esm/hooks/useValues.js +5 -2
- package/dist/esm/hooks/windowMetricsListener.js +44 -18
- package/dist/esm/host/ChaynsHost.js +30 -21
- package/dist/esm/host/HostIframe.js +153 -0
- package/dist/esm/host/iframe/HostIframe.js +142 -86
- package/dist/esm/host/iframe/utils/useUpdateData.js +6 -4
- package/dist/esm/host/module/ModuleHost.js +49 -42
- package/dist/esm/host/module/utils/loadComponent.js +85 -47
- package/dist/esm/host/module/utils/useDynamicScript.js +74 -27
- package/dist/esm/index.example.js +1 -0
- package/dist/esm/index2.js +5 -0
- package/dist/esm/types/DynamicImport.d.js +1 -0
- package/dist/esm/types/IChaynsReact.js +61 -14
- package/dist/esm/types/chayns-components.d.js +0 -0
- package/dist/esm/types/chayns-logger.d.js +0 -0
- package/dist/esm/types/chayns.d.js +0 -0
- package/dist/esm/types/tobit-websocket-service-client.d.js +0 -0
- package/dist/esm/types/toolkit-types.d.js +0 -0
- package/dist/esm/util/appCall.js +4 -2
- package/dist/esm/util/deviceHelper.js +33 -11
- package/dist/esm/util/heightHelper.js +13 -10
- package/dist/esm/util/postIframeForm.js +57 -25
- package/dist/esm/util/useIsAdminMode.js +9 -0
- package/dist/esm/util/useUser.js +7 -0
- package/dist/esm/wrapper/AppWrapper.js +762 -179
- package/dist/esm/wrapper/FrameWrapper.js +1509 -258
- package/dist/esm/wrapper/ModuleFederationWrapper.js +284 -47
- package/dist/esm/wrapper/SsrWrapper.js +65 -19
- package/dist/types/bootstrap.d.ts +1 -0
- package/dist/types/calls/dialogs/confirm.d.ts +1 -1
- package/dist/types/calls/dialogs/date.d.ts +4 -4
- package/dist/types/calls/dialogs/dropUpAlert.d.ts +1 -1
- package/dist/types/calls/dialogs/fileSelect.d.ts +1 -1
- package/dist/types/calls/dialogs/iFrame.d.ts +1 -1
- package/dist/types/calls/dialogs/input.d.ts +1 -1
- package/dist/types/calls/dialogs/mediaSelect.d.ts +1 -1
- package/dist/types/calls/dialogs/signature.d.ts +1 -1
- package/dist/types/components/App.d.ts +5 -0
- package/dist/types/components/Button.d.ts +8 -0
- package/dist/types/components/ChaynsProvider.d.ts +1 -1
- package/dist/types/components/ChaynsProviderExposed.d.ts +13 -0
- package/dist/types/components/Title.d.ts +3 -0
- package/dist/types/components/WaitUntil.d.ts +1 -1
- package/dist/types/components/withCompatMode.d.ts +1 -1
- package/dist/types/hooks/useAccessToken.d.ts +1 -1
- package/dist/types/host/ChaynsHost.d.ts +2 -1
- package/dist/types/host/{module/PagemakerFrame.d.ts → HostIframe.d.ts} +5 -7
- package/dist/types/host/iframe/HostIframe.d.ts +1 -1
- package/dist/types/host/module/ModuleHost.d.ts +2 -2
- package/dist/types/index.example.d.ts +0 -0
- package/dist/types/types/IChaynsReact.d.ts +14 -14
- package/package.json +1 -1
- package/dist/cjs/calls/dialogs/utils/environment.js +0 -10
- package/dist/esm/calls/dialogs/utils/environment.js +0 -3
- package/dist/esm/host/module/PagemakerFrame.js +0 -97
- package/dist/types/calls/dialogs/utils/environment.d.ts +0 -3
|
@@ -1,43 +1,85 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
+
|
|
7
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
8
|
+
|
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
10
|
+
|
|
11
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
12
|
+
|
|
13
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
+
|
|
15
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
16
|
+
|
|
17
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
18
|
+
|
|
19
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
20
|
+
|
|
21
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
22
|
+
|
|
23
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
3
24
|
|
|
25
|
+
/* eslint-disable react/jsx-props-no-spreading */
|
|
4
26
|
import React, { PureComponent } from 'react';
|
|
5
27
|
import ReactDOM from 'react-dom';
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
componentDidUpdate() {
|
|
21
|
-
const {
|
|
22
|
-
innerRef
|
|
23
|
-
} = this.props;
|
|
24
|
-
ReactDOM.render( /*#__PURE__*/React.createElement(Component, _extends({}, this.props, {
|
|
25
|
-
ref: innerRef
|
|
26
|
-
})), this.ref.current);
|
|
27
|
-
}
|
|
28
|
-
render() {
|
|
29
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
30
|
-
ref: this.ref
|
|
31
|
-
});
|
|
28
|
+
export var withCompatMode = function withCompatMode(Component) {
|
|
29
|
+
var CompatComponent = /*#__PURE__*/function (_PureComponent) {
|
|
30
|
+
_inherits(CompatComponent, _PureComponent);
|
|
31
|
+
|
|
32
|
+
var _super = _createSuper(CompatComponent);
|
|
33
|
+
|
|
34
|
+
function CompatComponent(props) {
|
|
35
|
+
var _this;
|
|
36
|
+
|
|
37
|
+
_classCallCheck(this, CompatComponent);
|
|
38
|
+
|
|
39
|
+
_this = _super.call(this, props);
|
|
40
|
+
_this.ref = /*#__PURE__*/React.createRef();
|
|
41
|
+
return _this;
|
|
32
42
|
}
|
|
33
|
-
|
|
43
|
+
|
|
44
|
+
_createClass(CompatComponent, [{
|
|
45
|
+
key: "componentDidMount",
|
|
46
|
+
value: function componentDidMount() {
|
|
47
|
+
var innerRef = this.props.innerRef;
|
|
48
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(Component, _extends({}, this.props, {
|
|
49
|
+
ref: innerRef
|
|
50
|
+
})), this.ref.current);
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "componentDidUpdate",
|
|
54
|
+
value: function componentDidUpdate() {
|
|
55
|
+
var innerRef = this.props.innerRef;
|
|
56
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(Component, _extends({}, this.props, {
|
|
57
|
+
ref: innerRef
|
|
58
|
+
})), this.ref.current);
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "render",
|
|
62
|
+
value: function render() {
|
|
63
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
ref: this.ref
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}]);
|
|
68
|
+
|
|
69
|
+
return CompatComponent;
|
|
70
|
+
}(PureComponent);
|
|
71
|
+
|
|
34
72
|
return {
|
|
35
|
-
Component: /*#__PURE__*/React.forwardRef((props, ref)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
73
|
+
Component: /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
74
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
75
|
+
innerRef: ref
|
|
76
|
+
})));
|
|
77
|
+
}),
|
|
78
|
+
CompatComponent: /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
79
|
+
return /*#__PURE__*/React.createElement(CompatComponent, _extends({}, props, {
|
|
80
|
+
innerRef: ref
|
|
81
|
+
}));
|
|
82
|
+
}),
|
|
41
83
|
// @ts-expect-error will be set by chayns-toolkit via DefinePlugin
|
|
42
84
|
requiredVersion: __REQUIRED_REACT_VERSION__,
|
|
43
85
|
environment: process.env.NODE_ENV,
|
|
@@ -1,25 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
1
|
+
var listenerMapping = {};
|
|
2
|
+
var counter = 0;
|
|
3
|
+
export var addApiListener = function addApiListener(key, callback) {
|
|
4
|
+
var id = ++counter;
|
|
5
|
+
|
|
5
6
|
if (!listenerMapping[key]) {
|
|
6
7
|
listenerMapping[key] = {};
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
var shouldInitialize = Object.keys(listenerMapping[key]).length === 0;
|
|
9
11
|
listenerMapping[key][counter] = callback;
|
|
10
12
|
return {
|
|
11
|
-
id,
|
|
12
|
-
shouldInitialize
|
|
13
|
+
id: id,
|
|
14
|
+
shouldInitialize: shouldInitialize
|
|
13
15
|
};
|
|
14
16
|
};
|
|
15
|
-
export
|
|
17
|
+
export var removeApiListener = function removeApiListener(key, id) {
|
|
16
18
|
if (listenerMapping[key]) {
|
|
17
19
|
delete listenerMapping[key][id];
|
|
18
20
|
}
|
|
21
|
+
|
|
19
22
|
return Object.keys(listenerMapping[key]).length === 0;
|
|
20
23
|
};
|
|
21
|
-
export
|
|
24
|
+
export var dispatchApiEvent = function dispatchApiEvent(key, value) {
|
|
22
25
|
if (listenerMapping[key]) {
|
|
23
|
-
Object.values(listenerMapping[key]).forEach(
|
|
26
|
+
Object.values(listenerMapping[key]).forEach(function (l) {
|
|
27
|
+
return l(value);
|
|
28
|
+
});
|
|
24
29
|
}
|
|
25
30
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function loadCss() {
|
|
2
|
+
var apiUrl = 'https://api.chayns.net/css/';
|
|
3
|
+
var parameters = new URLSearchParams(window.location.search.toLowerCase());
|
|
4
|
+
document.documentElement.style.visibility = 'hidden';
|
|
5
|
+
document.documentElement.style.overflow = 'hidden';
|
|
6
|
+
var head = document.getElementsByTagName('HEAD')[0];
|
|
7
|
+
var link = document.createElement('link');
|
|
8
|
+
link.rel = 'stylesheet';
|
|
9
|
+
link.type = 'text/css';
|
|
10
|
+
link.href = apiUrl + (parameters.get('siteid') || "");
|
|
11
|
+
|
|
12
|
+
link.onload = function () {
|
|
13
|
+
document.documentElement.style.visibility = 'visible';
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
link.onerror = function () {
|
|
17
|
+
document.documentElement.style.visibility = 'visible';
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
head.appendChild(link);
|
|
21
|
+
}
|
|
@@ -1,43 +1,69 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
1
13
|
import { useContextSelector } from 'use-context-selector';
|
|
2
14
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
15
|
import { ChaynsFunctionsContext } from '../components/ChaynsContext';
|
|
16
|
+
|
|
4
17
|
/**
|
|
5
18
|
* @category Hooks
|
|
6
19
|
*/
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
export var useGeoLocationListener = function useGeoLocationListener() {
|
|
21
|
+
var addListener = useContextSelector(ChaynsFunctionsContext, function (v) {
|
|
22
|
+
return v.addGeoLocationListener;
|
|
23
|
+
});
|
|
24
|
+
var removeListener = useContextSelector(ChaynsFunctionsContext, function (v) {
|
|
25
|
+
return v.removeGeoLocationListener;
|
|
26
|
+
});
|
|
27
|
+
var promiseRef = useRef();
|
|
28
|
+
return useCallback(function (value, callback) {
|
|
12
29
|
promiseRef.current = addListener(value, callback);
|
|
13
|
-
return ()
|
|
30
|
+
return function () {
|
|
14
31
|
var _promiseRef$current;
|
|
32
|
+
|
|
15
33
|
void ((_promiseRef$current = promiseRef.current) === null || _promiseRef$current === void 0 ? void 0 : _promiseRef$current.then(removeListener));
|
|
16
|
-
};
|
|
17
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
35
|
}, []);
|
|
19
36
|
};
|
|
20
37
|
/**
|
|
21
38
|
* @category Hooks
|
|
22
39
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
|
|
41
|
+
export var useGeoLocation = function useGeoLocation() {
|
|
42
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
43
|
+
_ref$enabled = _ref.enabled,
|
|
44
|
+
enabled = _ref$enabled === void 0 ? true : _ref$enabled,
|
|
45
|
+
_ref$timeout = _ref.timeout,
|
|
46
|
+
timeout = _ref$timeout === void 0 ? 0 : _ref$timeout,
|
|
47
|
+
_ref$silent = _ref.silent,
|
|
48
|
+
silent = _ref$silent === void 0 ? false : _ref$silent;
|
|
49
|
+
|
|
50
|
+
var _useState = useState(null),
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
value = _useState2[0],
|
|
53
|
+
setValue = _useState2[1];
|
|
54
|
+
|
|
55
|
+
var addListener = useGeoLocationListener();
|
|
56
|
+
useEffect(function () {
|
|
32
57
|
if (enabled) {
|
|
33
58
|
return addListener({
|
|
34
|
-
timeout,
|
|
35
|
-
silent
|
|
59
|
+
timeout: timeout,
|
|
60
|
+
silent: silent
|
|
36
61
|
}, setValue);
|
|
37
62
|
}
|
|
63
|
+
|
|
38
64
|
return undefined;
|
|
39
65
|
}, [enabled, timeout, addListener, silent]);
|
|
40
66
|
return {
|
|
41
|
-
value
|
|
67
|
+
value: value
|
|
42
68
|
};
|
|
43
69
|
};
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
1
13
|
import { useContextSelector } from 'use-context-selector';
|
|
2
14
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
15
|
import { ChaynsFunctionsContext } from '../components/ChaynsContext';
|
|
@@ -5,43 +17,57 @@ import { useWindowMetrics } from './windowMetricsListener';
|
|
|
5
17
|
/**
|
|
6
18
|
* @category Hooks
|
|
7
19
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
|
|
21
|
+
export var useScrollListener = function useScrollListener() {
|
|
22
|
+
var addListener = useContextSelector(ChaynsFunctionsContext, function (v) {
|
|
23
|
+
return v.addScrollListener;
|
|
24
|
+
});
|
|
25
|
+
var removeListener = useContextSelector(ChaynsFunctionsContext, function (v) {
|
|
26
|
+
return v.removeScrollListener;
|
|
27
|
+
});
|
|
28
|
+
var promiseRef = useRef();
|
|
29
|
+
return useCallback(function (value, callback) {
|
|
13
30
|
promiseRef.current = addListener(value, callback);
|
|
14
|
-
return ()
|
|
31
|
+
return function () {
|
|
15
32
|
var _promiseRef$current;
|
|
33
|
+
|
|
16
34
|
void ((_promiseRef$current = promiseRef.current) === null || _promiseRef$current === void 0 ? void 0 : _promiseRef$current.then(removeListener));
|
|
17
|
-
};
|
|
18
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
36
|
}, []);
|
|
20
37
|
};
|
|
21
38
|
/**
|
|
22
39
|
* @category Hooks
|
|
23
40
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
41
|
+
|
|
42
|
+
export var useScrollPosition = function useScrollPosition() {
|
|
43
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
44
|
+
_ref$enabled = _ref.enabled,
|
|
45
|
+
enabled = _ref$enabled === void 0 ? true : _ref$enabled,
|
|
46
|
+
_ref$throttle = _ref.throttle,
|
|
47
|
+
throttle = _ref$throttle === void 0 ? 200 : _ref$throttle;
|
|
48
|
+
|
|
49
|
+
var _useState = useState({
|
|
30
50
|
scrollY: null,
|
|
31
51
|
scrollX: null
|
|
52
|
+
}),
|
|
53
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
54
|
+
value = _useState2[0],
|
|
55
|
+
setValue = _useState2[1];
|
|
56
|
+
|
|
57
|
+
var addListener = useScrollListener();
|
|
58
|
+
var getScrollPosition = useContextSelector(ChaynsFunctionsContext, function (v) {
|
|
59
|
+
return v.getScrollPosition;
|
|
32
60
|
});
|
|
33
|
-
|
|
34
|
-
const getScrollPosition = useContextSelector(ChaynsFunctionsContext, v => v.getScrollPosition);
|
|
35
|
-
useEffect(() => {
|
|
61
|
+
useEffect(function () {
|
|
36
62
|
if (enabled) {
|
|
37
63
|
return addListener({
|
|
38
|
-
throttle
|
|
64
|
+
throttle: throttle
|
|
39
65
|
}, setValue);
|
|
40
66
|
}
|
|
41
|
-
|
|
42
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
|
+
|
|
68
|
+
return undefined; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
69
|
}, [enabled, throttle, addListener]);
|
|
44
|
-
useEffect(()
|
|
70
|
+
useEffect(function () {
|
|
45
71
|
void getScrollPosition().then(setValue);
|
|
46
72
|
}, [getScrollPosition]);
|
|
47
73
|
return value;
|
|
@@ -49,47 +75,57 @@ export const useScrollPosition = function () {
|
|
|
49
75
|
/**
|
|
50
76
|
* @category Hooks
|
|
51
77
|
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
topBarHeight
|
|
64
|
-
} = useWindowMetrics({
|
|
65
|
-
enabled
|
|
78
|
+
|
|
79
|
+
export var useScrollOffsetTop = function useScrollOffsetTop() {
|
|
80
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
81
|
+
_ref2$enabled = _ref2.enabled,
|
|
82
|
+
enabled = _ref2$enabled === void 0 ? true : _ref2$enabled,
|
|
83
|
+
_ref2$throttle = _ref2.throttle,
|
|
84
|
+
throttle = _ref2$throttle === void 0 ? 200 : _ref2$throttle;
|
|
85
|
+
|
|
86
|
+
var scrollPosition = useScrollPosition({
|
|
87
|
+
enabled: enabled,
|
|
88
|
+
throttle: throttle
|
|
66
89
|
});
|
|
90
|
+
|
|
91
|
+
var _useWindowMetrics = useWindowMetrics({
|
|
92
|
+
enabled: enabled
|
|
93
|
+
}),
|
|
94
|
+
offsetTop = _useWindowMetrics.offsetTop,
|
|
95
|
+
topBarHeight = _useWindowMetrics.topBarHeight;
|
|
96
|
+
|
|
67
97
|
if (typeof (scrollPosition === null || scrollPosition === void 0 ? void 0 : scrollPosition.scrollY) === 'number') {
|
|
68
98
|
return Math.max(0, scrollPosition.scrollY - (offsetTop - topBarHeight));
|
|
69
99
|
}
|
|
100
|
+
|
|
70
101
|
return 0;
|
|
71
102
|
};
|
|
72
103
|
/**
|
|
73
104
|
* @category Hooks
|
|
74
105
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
windowHeight,
|
|
87
|
-
bottomBarHeight
|
|
88
|
-
} = useWindowMetrics({
|
|
89
|
-
enabled
|
|
106
|
+
|
|
107
|
+
export var useScrollOffsetBottom = function useScrollOffsetBottom() {
|
|
108
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
109
|
+
_ref3$enabled = _ref3.enabled,
|
|
110
|
+
enabled = _ref3$enabled === void 0 ? true : _ref3$enabled,
|
|
111
|
+
_ref3$throttle = _ref3.throttle,
|
|
112
|
+
throttle = _ref3$throttle === void 0 ? 200 : _ref3$throttle;
|
|
113
|
+
|
|
114
|
+
var scrollPosition = useScrollPosition({
|
|
115
|
+
enabled: enabled,
|
|
116
|
+
throttle: throttle
|
|
90
117
|
});
|
|
118
|
+
|
|
119
|
+
var _useWindowMetrics2 = useWindowMetrics({
|
|
120
|
+
enabled: enabled
|
|
121
|
+
}),
|
|
122
|
+
offsetTop = _useWindowMetrics2.offsetTop,
|
|
123
|
+
windowHeight = _useWindowMetrics2.windowHeight,
|
|
124
|
+
bottomBarHeight = _useWindowMetrics2.bottomBarHeight;
|
|
125
|
+
|
|
91
126
|
if (typeof (scrollPosition === null || scrollPosition === void 0 ? void 0 : scrollPosition.scrollY) === 'number') {
|
|
92
127
|
return windowHeight - Math.max(0, offsetTop - scrollPosition.scrollY + bottomBarHeight);
|
|
93
128
|
}
|
|
129
|
+
|
|
94
130
|
return 0;
|
|
95
131
|
};
|
|
@@ -1,15 +1,37 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
1
13
|
import { useEffect, useState } from "react";
|
|
2
14
|
import { useContextSelector } from "use-context-selector";
|
|
3
15
|
import { ChaynsFunctionsContext } from "../components/ChaynsContext";
|
|
4
|
-
|
|
5
16
|
/**
|
|
6
17
|
* @category Hooks
|
|
7
18
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
|
|
20
|
+
export var useAccessToken = function useAccessToken(accessToken) {
|
|
21
|
+
var _useState = useState(null),
|
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
+
token = _useState2[0],
|
|
24
|
+
setToken = _useState2[1];
|
|
25
|
+
|
|
26
|
+
var _useState3 = useState(null),
|
|
27
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
28
|
+
externalToken = _useState4[0],
|
|
29
|
+
setExternalToken = _useState4[1];
|
|
30
|
+
|
|
31
|
+
var getAccessToken = useContextSelector(ChaynsFunctionsContext, function (s) {
|
|
32
|
+
return s.getAccessToken;
|
|
33
|
+
});
|
|
34
|
+
useEffect(function () {
|
|
13
35
|
if (accessToken !== null && accessToken !== void 0 && accessToken.external) {
|
|
14
36
|
void getAccessToken({
|
|
15
37
|
external: true
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useContextSelector } from 'use-context-selector';
|
|
2
|
+
import { ChaynsFunctionsContext } from '../components/ChaynsContext';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
export var useAddGeoLocationListener = function useAddGeoLocationListener() {
|
|
5
|
+
var addGeoLocationListener = useContextSelector(ChaynsFunctionsContext, function (v) {
|
|
6
|
+
return v === null || v === void 0 ? void 0 : v.addGeoLocationListener;
|
|
7
|
+
});
|
|
8
|
+
var removeGeoLocationListener = useContextSelector(ChaynsFunctionsContext, function (v) {
|
|
9
|
+
return v === null || v === void 0 ? void 0 : v.removeGeoLocationListener;
|
|
10
|
+
});
|
|
11
|
+
var promise;
|
|
12
|
+
return useCallback(function (value, callback) {
|
|
13
|
+
promise = addGeoLocationListener(value, callback);
|
|
14
|
+
return function () {
|
|
15
|
+
promise.then(removeGeoLocationListener);
|
|
16
|
+
};
|
|
17
|
+
}, []);
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useContextSelector } from 'use-context-selector';
|
|
2
|
+
import { ChaynsFunctionsContext } from '../components/ChaynsContext';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
export var useAddScrollListener = function useAddScrollListener() {
|
|
5
|
+
var addScrollListener = useContextSelector(ChaynsFunctionsContext, function (v) {
|
|
6
|
+
return v === null || v === void 0 ? void 0 : v.addScrollListener;
|
|
7
|
+
});
|
|
8
|
+
var removeScrollListener = useContextSelector(ChaynsFunctionsContext, function (v) {
|
|
9
|
+
return v === null || v === void 0 ? void 0 : v.removeScrollListener;
|
|
10
|
+
});
|
|
11
|
+
var promise;
|
|
12
|
+
return useCallback(function (value, callback) {
|
|
13
|
+
promise = addScrollListener(value, callback);
|
|
14
|
+
return function () {
|
|
15
|
+
promise.then(removeScrollListener);
|
|
16
|
+
};
|
|
17
|
+
}, []);
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useContextSelector } from 'use-context-selector';
|
|
2
|
+
import { ChaynsFunctionsContext } from '../components/ChaynsContext';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
export var useAddWindowMetricsListener = function useAddWindowMetricsListener() {
|
|
5
|
+
var addListener = useContextSelector(ChaynsFunctionsContext, function (v) {
|
|
6
|
+
return v === null || v === void 0 ? void 0 : v.addWindowMetricsListener;
|
|
7
|
+
});
|
|
8
|
+
var removeListener = useContextSelector(ChaynsFunctionsContext, function (v) {
|
|
9
|
+
return v === null || v === void 0 ? void 0 : v.removeWindowMetricsListener;
|
|
10
|
+
});
|
|
11
|
+
var promise;
|
|
12
|
+
return useCallback(function (callback) {
|
|
13
|
+
promise = addListener(callback);
|
|
14
|
+
return function () {
|
|
15
|
+
promise.then(removeListener);
|
|
16
|
+
};
|
|
17
|
+
}, []);
|
|
18
|
+
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { useContextSelector } from 'use-context-selector';
|
|
2
2
|
import { ChaynsContext } from '../components/ChaynsContext';
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* @category Hooks
|
|
6
5
|
*/
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
export var useCurrentPage = function useCurrentPage() {
|
|
8
|
+
return useContextSelector(ChaynsContext, function (v) {
|
|
9
|
+
return v === null || v === void 0 ? void 0 : v.currentPage;
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { useContextSelector } from 'use-context-selector';
|
|
2
2
|
import { ChaynsContext } from '../components/ChaynsContext';
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* @category Hooks
|
|
6
5
|
*/
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
export var useCustomData = function useCustomData() {
|
|
8
|
+
return useContextSelector(ChaynsContext, function (v) {
|
|
9
|
+
return v === null || v === void 0 ? void 0 : v.customData;
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { useContextSelector } from 'use-context-selector';
|
|
2
2
|
import { ChaynsContext } from '../components/ChaynsContext';
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* @category Hooks
|
|
5
6
|
*/
|
|
6
|
-
export
|
|
7
|
+
export var useDevice = function useDevice() {
|
|
8
|
+
return useContextSelector(ChaynsContext, function (v) {
|
|
9
|
+
return v === null || v === void 0 ? void 0 : v.device;
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { useContextSelector } from 'use-context-selector';
|
|
2
2
|
import { ChaynsContext } from '../components/ChaynsContext';
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* @category Hooks
|
|
5
6
|
*/
|
|
6
|
-
export
|
|
7
|
+
export var useEnvironment = function useEnvironment() {
|
|
8
|
+
return useContextSelector(ChaynsContext, function (v) {
|
|
9
|
+
return v === null || v === void 0 ? void 0 : v.environment;
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { useContextSelector } from "use-context-selector";
|
|
2
2
|
import { ChaynsFunctionsContext } from "../components/ChaynsContext";
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* @category Hooks
|
|
5
6
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
7
|
+
export var useFunctions = function useFunctions() {
|
|
8
|
+
var t = useContextSelector(ChaynsFunctionsContext, function (f) {
|
|
9
|
+
return f || {};
|
|
10
|
+
});
|
|
8
11
|
return t;
|
|
9
12
|
};
|