chayns-api 3.0.0-beta.0 → 3.0.0-beta.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/.babelrc +14 -6
- package/dist/cjs/components/ChaynsProvider.js +38 -11
- package/dist/cjs/hooks/geoLocationListener.js +53 -17
- package/dist/cjs/hooks/scrollListener.js +151 -45
- package/dist/cjs/hooks/useAccessToken.js +35 -11
- package/dist/cjs/hooks/useChaynsApiId.js +5 -2
- package/dist/cjs/hooks/useCurrentPage.js +7 -2
- package/dist/cjs/hooks/useCustomCallbackFunction.js +7 -2
- package/dist/cjs/hooks/useCustomData.js +7 -2
- package/dist/cjs/hooks/useCustomFunction.js +13 -1
- package/dist/cjs/hooks/useDevice.js +7 -2
- package/dist/cjs/hooks/useDialogState.js +42 -18
- package/dist/cjs/hooks/useEnvironment.js +7 -2
- package/dist/cjs/hooks/useFunctions.js +7 -2
- package/dist/cjs/hooks/useIsAdminMode.js +6 -3
- package/dist/cjs/hooks/useLanguage.js +7 -2
- package/dist/cjs/hooks/usePages.js +34 -14
- package/dist/cjs/hooks/useParameters.js +7 -2
- package/dist/cjs/hooks/useSite.js +7 -2
- package/dist/cjs/hooks/useStyleSettings.js +7 -2
- package/dist/cjs/hooks/useUser.js +7 -2
- package/dist/cjs/hooks/useValues.js +7 -2
- package/dist/cjs/hooks/windowMetricsListener.js +71 -25
- package/dist/cjs/host/ChaynsHost.js +157 -78
- package/dist/cjs/host/iframe/utils/useUpdateData.js +26 -10
- package/dist/cjs/host/module/ModuleHost.js +109 -37
- package/dist/cjs/types/IChaynsReact.js +4 -1
- package/dist/cjs/types/dialog.js +1 -5
- package/dist/esm/components/ChaynsProvider.js +38 -11
- package/dist/esm/components/withCompatMode.js +6 -0
- package/dist/esm/handler/DialogHandler.js +7 -0
- package/dist/esm/hooks/geoLocationListener.js +53 -17
- package/dist/esm/hooks/scrollListener.js +151 -45
- package/dist/esm/hooks/useAccessToken.js +35 -11
- package/dist/esm/hooks/useChaynsApiId.js +5 -2
- package/dist/esm/hooks/useCurrentPage.js +6 -1
- package/dist/esm/hooks/useCustomCallbackFunction.js +6 -1
- package/dist/esm/hooks/useCustomData.js +6 -1
- package/dist/esm/hooks/useCustomFunction.js +13 -1
- package/dist/esm/hooks/useDevice.js +6 -1
- package/dist/esm/hooks/useDialogState.js +42 -18
- package/dist/esm/hooks/useEnvironment.js +6 -1
- package/dist/esm/hooks/useFunctions.js +6 -1
- package/dist/esm/hooks/useIsAdminMode.js +5 -2
- package/dist/esm/hooks/useLanguage.js +6 -1
- package/dist/esm/hooks/usePages.js +34 -14
- package/dist/esm/hooks/useParameters.js +6 -1
- package/dist/esm/hooks/useSite.js +6 -1
- package/dist/esm/hooks/useStyleSettings.js +6 -1
- package/dist/esm/hooks/useUser.js +6 -1
- package/dist/esm/hooks/useValues.js +6 -1
- package/dist/esm/hooks/windowMetricsListener.js +71 -25
- package/dist/esm/host/ChaynsHost.js +157 -78
- package/dist/esm/host/iframe/utils/useUpdateData.js +26 -10
- package/dist/esm/host/module/ModuleHost.js +109 -37
- package/dist/esm/host/module/utils/loadComponent.js +4 -0
- package/dist/esm/types/IChaynsReact.js +4 -1
- package/dist/esm/wrapper/AppWrapper.js +1 -0
- package/dist/esm/wrapper/ModuleFederationWrapper.js +2 -0
- package/dist/esm/wrapper/SsrWrapper.js +4 -0
- package/dist/esm/wrapper/StaticChaynsApi.js +67 -0
- package/dist/types/types/IChaynsReact.d.ts +8 -2
- package/eslint.config.mjs +6 -0
- package/package.json +3 -1
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _reactCompilerRuntime = require("react-compiler-runtime");
|
|
7
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _moduleContext = require("../../constants/moduleContext");
|
|
9
10
|
var _loadComponent = _interopRequireDefault(require("./utils/loadComponent"));
|
|
@@ -30,27 +31,31 @@ const System = ({
|
|
|
30
31
|
fallback: fallback || ''
|
|
31
32
|
}, _react.default.createElement(Component, props));
|
|
32
33
|
};
|
|
33
|
-
const ModuleHost =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
34
|
+
const ModuleHost = t0 => {
|
|
35
|
+
const $ = (0, _reactCompilerRuntime.c)(34);
|
|
36
|
+
const {
|
|
37
|
+
system,
|
|
38
|
+
children: t1,
|
|
39
|
+
functions,
|
|
40
|
+
customFunctions,
|
|
41
|
+
pages,
|
|
42
|
+
isAdminModeActive,
|
|
43
|
+
site,
|
|
44
|
+
user,
|
|
45
|
+
currentPage,
|
|
46
|
+
device,
|
|
47
|
+
language,
|
|
48
|
+
parameters,
|
|
49
|
+
customData,
|
|
50
|
+
dialog,
|
|
51
|
+
environment,
|
|
52
|
+
preventStagingReplacement,
|
|
53
|
+
styleSettings
|
|
54
|
+
} = t0;
|
|
55
|
+
const children = t1 === undefined ? null : t1;
|
|
56
|
+
let result;
|
|
57
|
+
if ($[0] !== currentPage || $[1] !== customData || $[2] !== device || $[3] !== dialog || $[4] !== environment || $[5] !== isAdminModeActive || $[6] !== language || $[7] !== pages || $[8] !== parameters || $[9] !== site || $[10] !== styleSettings || $[11] !== user) {
|
|
58
|
+
result = {
|
|
54
59
|
site,
|
|
55
60
|
isAdminModeActive,
|
|
56
61
|
pages,
|
|
@@ -68,23 +73,90 @@ const ModuleHost = ({
|
|
|
68
73
|
if (dialog) {
|
|
69
74
|
result.dialog = dialog;
|
|
70
75
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
$[0] = currentPage;
|
|
77
|
+
$[1] = customData;
|
|
78
|
+
$[2] = device;
|
|
79
|
+
$[3] = dialog;
|
|
80
|
+
$[4] = environment;
|
|
81
|
+
$[5] = isAdminModeActive;
|
|
82
|
+
$[6] = language;
|
|
83
|
+
$[7] = pages;
|
|
84
|
+
$[8] = parameters;
|
|
85
|
+
$[9] = site;
|
|
86
|
+
$[10] = styleSettings;
|
|
87
|
+
$[11] = user;
|
|
88
|
+
$[12] = result;
|
|
89
|
+
} else {
|
|
90
|
+
result = $[12];
|
|
91
|
+
}
|
|
92
|
+
const data = result;
|
|
93
|
+
let t2;
|
|
94
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
95
|
+
t2 = _react.default.createElement("div", {
|
|
96
|
+
className: "module-css"
|
|
97
|
+
});
|
|
98
|
+
$[13] = t2;
|
|
99
|
+
} else {
|
|
100
|
+
t2 = $[13];
|
|
101
|
+
}
|
|
102
|
+
const t3 = system.scope;
|
|
103
|
+
let t4;
|
|
104
|
+
if ($[14] !== environment.buildEnvironment || $[15] !== preventStagingReplacement || $[16] !== system.url) {
|
|
105
|
+
t4 = (0, _url.replaceStagingUrl)(preventStagingReplacement, system.url, environment.buildEnvironment);
|
|
106
|
+
$[14] = environment.buildEnvironment;
|
|
107
|
+
$[15] = preventStagingReplacement;
|
|
108
|
+
$[16] = system.url;
|
|
109
|
+
$[17] = t4;
|
|
110
|
+
} else {
|
|
111
|
+
t4 = $[17];
|
|
112
|
+
}
|
|
113
|
+
let t5;
|
|
114
|
+
if ($[18] !== environment.buildEnvironment || $[19] !== preventStagingReplacement || $[20] !== system.serverUrl) {
|
|
115
|
+
t5 = (0, _url.replaceStagingUrl)(preventStagingReplacement, system.serverUrl, environment.buildEnvironment);
|
|
116
|
+
$[18] = environment.buildEnvironment;
|
|
117
|
+
$[19] = preventStagingReplacement;
|
|
118
|
+
$[20] = system.serverUrl;
|
|
119
|
+
$[21] = t5;
|
|
120
|
+
} else {
|
|
121
|
+
t5 = $[21];
|
|
122
|
+
}
|
|
123
|
+
let t6;
|
|
124
|
+
if ($[22] !== system.module || $[23] !== system.preventSingleton || $[24] !== system.scope || $[25] !== t4 || $[26] !== t5) {
|
|
125
|
+
t6 = {
|
|
126
|
+
scope: t3,
|
|
127
|
+
url: t4,
|
|
128
|
+
serverUrl: t5,
|
|
80
129
|
module: system.module,
|
|
81
130
|
preventSingleton: system.preventSingleton
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
131
|
+
};
|
|
132
|
+
$[22] = system.module;
|
|
133
|
+
$[23] = system.preventSingleton;
|
|
134
|
+
$[24] = system.scope;
|
|
135
|
+
$[25] = t4;
|
|
136
|
+
$[26] = t5;
|
|
137
|
+
$[27] = t6;
|
|
138
|
+
} else {
|
|
139
|
+
t6 = $[27];
|
|
140
|
+
}
|
|
141
|
+
let t7;
|
|
142
|
+
if ($[28] !== children || $[29] !== customFunctions || $[30] !== data || $[31] !== functions || $[32] !== t6) {
|
|
143
|
+
t7 = _react.default.createElement(_react.default.Fragment, null, t2, _react.default.createElement(System, {
|
|
144
|
+
system: t6,
|
|
145
|
+
data: data,
|
|
146
|
+
functions: functions,
|
|
147
|
+
customFunctions: customFunctions,
|
|
148
|
+
fallback: children,
|
|
149
|
+
isModule: true
|
|
150
|
+
}));
|
|
151
|
+
$[28] = children;
|
|
152
|
+
$[29] = customFunctions;
|
|
153
|
+
$[30] = data;
|
|
154
|
+
$[31] = functions;
|
|
155
|
+
$[32] = t6;
|
|
156
|
+
$[33] = t7;
|
|
157
|
+
} else {
|
|
158
|
+
t7 = $[33];
|
|
159
|
+
}
|
|
160
|
+
return t7;
|
|
89
161
|
};
|
|
90
162
|
var _default = exports.default = ModuleHost;
|
|
@@ -77,8 +77,11 @@ let AccessMode = exports.AccessMode = function (AccessMode) {
|
|
|
77
77
|
}({});
|
|
78
78
|
let ScanQrCodeCodeType = exports.ScanQrCodeCodeType = function (ScanQrCodeCodeType) {
|
|
79
79
|
ScanQrCodeCodeType[ScanQrCodeCodeType["QR"] = 0] = "QR";
|
|
80
|
-
ScanQrCodeCodeType[ScanQrCodeCodeType["BARCODE"] =
|
|
80
|
+
ScanQrCodeCodeType[ScanQrCodeCodeType["BARCODE"] = 1] = "BARCODE";
|
|
81
81
|
ScanQrCodeCodeType[ScanQrCodeCodeType["ALL"] = 2] = "ALL";
|
|
82
|
+
ScanQrCodeCodeType[ScanQrCodeCodeType["CASH"] = 3] = "CASH";
|
|
83
|
+
ScanQrCodeCodeType[ScanQrCodeCodeType["DATA_MATRIX"] = 4] = "DATA_MATRIX";
|
|
84
|
+
ScanQrCodeCodeType[ScanQrCodeCodeType["PDF417"] = 5] = "PDF417";
|
|
82
85
|
return ScanQrCodeCodeType;
|
|
83
86
|
}({});
|
|
84
87
|
let ScanQrCodeCameraTypes = exports.ScanQrCodeCameraTypes = function (ScanQrCodeCameraTypes) {
|
package/dist/cjs/types/dialog.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c as _c } from "react-compiler-runtime";
|
|
1
2
|
import htmlEscape from 'htmlescape';
|
|
2
3
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
4
|
import { useIsomorphicLayoutEffect } from '../hooks/useIsomorphicLayoutEffect';
|
|
@@ -10,20 +11,46 @@ import { SsrWrapper } from '../wrapper/SsrWrapper';
|
|
|
10
11
|
import { ChaynsContext } from './ChaynsContext';
|
|
11
12
|
import { addModuleWrapper, moduleWrapper, removeModuleWrapper } from './moduleWrapper';
|
|
12
13
|
const isServer = typeof window === 'undefined';
|
|
13
|
-
const InitialDataProvider = React.memo(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const InitialDataProvider = React.memo(t0 => {
|
|
15
|
+
const $ = _c(6);
|
|
16
|
+
const {
|
|
17
|
+
data,
|
|
18
|
+
renderedByServer
|
|
19
|
+
} = t0;
|
|
17
20
|
if (!renderedByServer) {
|
|
18
21
|
return null;
|
|
19
22
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
let t1;
|
|
24
|
+
if ($[0] !== data) {
|
|
25
|
+
t1 = data || {};
|
|
26
|
+
$[0] = data;
|
|
27
|
+
$[1] = t1;
|
|
28
|
+
} else {
|
|
29
|
+
t1 = $[1];
|
|
30
|
+
}
|
|
31
|
+
let t2;
|
|
32
|
+
if ($[2] !== t1) {
|
|
33
|
+
t2 = htmlEscape(t1);
|
|
34
|
+
$[2] = t1;
|
|
35
|
+
$[3] = t2;
|
|
36
|
+
} else {
|
|
37
|
+
t2 = $[3];
|
|
38
|
+
}
|
|
39
|
+
let t3;
|
|
40
|
+
if ($[4] !== t2) {
|
|
41
|
+
t3 = React.createElement("script", {
|
|
42
|
+
id: "__CHAYNS_DATA__",
|
|
43
|
+
type: "application/json",
|
|
44
|
+
dangerouslySetInnerHTML: {
|
|
45
|
+
__html: t2
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
$[4] = t2;
|
|
49
|
+
$[5] = t3;
|
|
50
|
+
} else {
|
|
51
|
+
t3 = $[5];
|
|
52
|
+
}
|
|
53
|
+
return t3;
|
|
27
54
|
}, () => true);
|
|
28
55
|
const ChaynsProvider = ({
|
|
29
56
|
children,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
4
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
2
5
|
import React, { PureComponent } from 'react';
|
|
3
6
|
import ReactDOM from 'react-dom';
|
|
4
7
|
import ErrorBoundary from './ErrorBoundary';
|
|
@@ -7,6 +10,9 @@ export const withCompatMode = Component => {
|
|
|
7
10
|
class CompatComponent extends PureComponent {
|
|
8
11
|
constructor(props) {
|
|
9
12
|
super(props);
|
|
13
|
+
_defineProperty(this, "ref", void 0);
|
|
14
|
+
_defineProperty(this, "root", void 0);
|
|
15
|
+
_defineProperty(this, "timeout", void 0);
|
|
10
16
|
this.ref = React.createRef();
|
|
11
17
|
}
|
|
12
18
|
componentDidMount() {
|
|
@@ -3,7 +3,14 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
4
|
export default class DialogHandler {
|
|
5
5
|
constructor(config, open, close, dispatchEvent, addDataListener) {
|
|
6
|
+
_defineProperty(this, "dialogId", void 0);
|
|
6
7
|
_defineProperty(this, "isOpen", false);
|
|
8
|
+
_defineProperty(this, "result", void 0);
|
|
9
|
+
_defineProperty(this, "_open", void 0);
|
|
10
|
+
_defineProperty(this, "_close", void 0);
|
|
11
|
+
_defineProperty(this, "_config", void 0);
|
|
12
|
+
_defineProperty(this, "_dispatchEvent", void 0);
|
|
13
|
+
_defineProperty(this, "_addDataListener", void 0);
|
|
7
14
|
_defineProperty(this, "listeners", []);
|
|
8
15
|
this._open = open;
|
|
9
16
|
this._close = close;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c as _c } from "react-compiler-runtime";
|
|
1
2
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
3
|
import { useFunctionsSelector } from './context';
|
|
3
4
|
export const useGeoLocationListener = () => {
|
|
@@ -12,23 +13,58 @@ export const useGeoLocationListener = () => {
|
|
|
12
13
|
};
|
|
13
14
|
}, []);
|
|
14
15
|
};
|
|
15
|
-
export const useGeoLocation =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
export const useGeoLocation = t0 => {
|
|
17
|
+
const $ = _c(10);
|
|
18
|
+
let t1;
|
|
19
|
+
if ($[0] !== t0) {
|
|
20
|
+
t1 = t0 === undefined ? {} : t0;
|
|
21
|
+
$[0] = t0;
|
|
22
|
+
$[1] = t1;
|
|
23
|
+
} else {
|
|
24
|
+
t1 = $[1];
|
|
25
|
+
}
|
|
26
|
+
const {
|
|
27
|
+
enabled: t2,
|
|
28
|
+
timeout: t3,
|
|
29
|
+
silent: t4
|
|
30
|
+
} = t1;
|
|
31
|
+
const enabled = t2 === undefined ? true : t2;
|
|
32
|
+
const timeout = t3 === undefined ? 0 : t3;
|
|
33
|
+
const silent = t4 === undefined ? false : t4;
|
|
20
34
|
const [value, setValue] = useState(null);
|
|
21
35
|
const addListener = useGeoLocationListener();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
let t5;
|
|
37
|
+
let t6;
|
|
38
|
+
if ($[2] !== addListener || $[3] !== enabled || $[4] !== silent || $[5] !== timeout) {
|
|
39
|
+
t5 = () => {
|
|
40
|
+
if (enabled) {
|
|
41
|
+
return addListener({
|
|
42
|
+
timeout,
|
|
43
|
+
silent
|
|
44
|
+
}, setValue);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
t6 = [enabled, timeout, addListener, silent];
|
|
48
|
+
$[2] = addListener;
|
|
49
|
+
$[3] = enabled;
|
|
50
|
+
$[4] = silent;
|
|
51
|
+
$[5] = timeout;
|
|
52
|
+
$[6] = t5;
|
|
53
|
+
$[7] = t6;
|
|
54
|
+
} else {
|
|
55
|
+
t5 = $[6];
|
|
56
|
+
t6 = $[7];
|
|
57
|
+
}
|
|
58
|
+
useEffect(t5, t6);
|
|
59
|
+
let t7;
|
|
60
|
+
if ($[8] !== value) {
|
|
61
|
+
t7 = {
|
|
62
|
+
value
|
|
63
|
+
};
|
|
64
|
+
$[8] = value;
|
|
65
|
+
$[9] = t7;
|
|
66
|
+
} else {
|
|
67
|
+
t7 = $[9];
|
|
68
|
+
}
|
|
69
|
+
return t7;
|
|
34
70
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c as _c } from "react-compiler-runtime";
|
|
1
2
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
3
|
import { useWindowMetrics } from './windowMetricsListener';
|
|
3
4
|
import { useFunctionsSelector } from './context';
|
|
@@ -13,65 +14,170 @@ export const useScrollListener = () => {
|
|
|
13
14
|
};
|
|
14
15
|
}, []);
|
|
15
16
|
};
|
|
16
|
-
export const useScrollPosition =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
17
|
+
export const useScrollPosition = t0 => {
|
|
18
|
+
const $ = _c(11);
|
|
19
|
+
let t1;
|
|
20
|
+
if ($[0] !== t0) {
|
|
21
|
+
t1 = t0 === undefined ? {} : t0;
|
|
22
|
+
$[0] = t0;
|
|
23
|
+
$[1] = t1;
|
|
24
|
+
} else {
|
|
25
|
+
t1 = $[1];
|
|
26
|
+
}
|
|
27
|
+
const {
|
|
28
|
+
enabled: t2,
|
|
29
|
+
throttle: t3
|
|
30
|
+
} = t1;
|
|
31
|
+
const enabled = t2 === undefined ? true : t2;
|
|
32
|
+
const throttle = t3 === undefined ? 200 : t3;
|
|
33
|
+
let t4;
|
|
34
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
35
|
+
t4 = {
|
|
36
|
+
scrollY: null,
|
|
37
|
+
scrollX: null
|
|
38
|
+
};
|
|
39
|
+
$[2] = t4;
|
|
40
|
+
} else {
|
|
41
|
+
t4 = $[2];
|
|
42
|
+
}
|
|
43
|
+
const [value, setValue] = useState(t4);
|
|
24
44
|
const addListener = useScrollListener();
|
|
25
|
-
const getScrollPosition = useFunctionsSelector(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
const getScrollPosition = useFunctionsSelector(_temp);
|
|
46
|
+
let t5;
|
|
47
|
+
let t6;
|
|
48
|
+
if ($[3] !== addListener || $[4] !== enabled || $[5] !== throttle) {
|
|
49
|
+
t5 = () => {
|
|
50
|
+
if (enabled) {
|
|
51
|
+
return addListener({
|
|
52
|
+
throttle
|
|
53
|
+
}, setValue);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
t6 = [enabled, throttle, addListener];
|
|
57
|
+
$[3] = addListener;
|
|
58
|
+
$[4] = enabled;
|
|
59
|
+
$[5] = throttle;
|
|
60
|
+
$[6] = t5;
|
|
61
|
+
$[7] = t6;
|
|
62
|
+
} else {
|
|
63
|
+
t5 = $[6];
|
|
64
|
+
t6 = $[7];
|
|
65
|
+
}
|
|
66
|
+
useEffect(t5, t6);
|
|
67
|
+
let t7;
|
|
68
|
+
let t8;
|
|
69
|
+
if ($[8] !== getScrollPosition) {
|
|
70
|
+
t7 = () => {
|
|
71
|
+
getScrollPosition().then(setValue);
|
|
72
|
+
};
|
|
73
|
+
t8 = [getScrollPosition];
|
|
74
|
+
$[8] = getScrollPosition;
|
|
75
|
+
$[9] = t7;
|
|
76
|
+
$[10] = t8;
|
|
77
|
+
} else {
|
|
78
|
+
t7 = $[9];
|
|
79
|
+
t8 = $[10];
|
|
80
|
+
}
|
|
81
|
+
useEffect(t7, t8);
|
|
37
82
|
return value;
|
|
38
83
|
};
|
|
39
|
-
export const useScrollOffsetTop =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
84
|
+
export const useScrollOffsetTop = t0 => {
|
|
85
|
+
const $ = _c(7);
|
|
86
|
+
let t1;
|
|
87
|
+
if ($[0] !== t0) {
|
|
88
|
+
t1 = t0 === undefined ? {} : t0;
|
|
89
|
+
$[0] = t0;
|
|
90
|
+
$[1] = t1;
|
|
91
|
+
} else {
|
|
92
|
+
t1 = $[1];
|
|
93
|
+
}
|
|
94
|
+
const {
|
|
95
|
+
enabled: t2,
|
|
96
|
+
throttle: t3
|
|
97
|
+
} = t1;
|
|
98
|
+
const enabled = t2 === undefined ? true : t2;
|
|
99
|
+
const throttle = t3 === undefined ? 200 : t3;
|
|
100
|
+
let t4;
|
|
101
|
+
if ($[2] !== enabled || $[3] !== throttle) {
|
|
102
|
+
t4 = {
|
|
103
|
+
enabled,
|
|
104
|
+
throttle
|
|
105
|
+
};
|
|
106
|
+
$[2] = enabled;
|
|
107
|
+
$[3] = throttle;
|
|
108
|
+
$[4] = t4;
|
|
109
|
+
} else {
|
|
110
|
+
t4 = $[4];
|
|
111
|
+
}
|
|
112
|
+
const scrollPosition = useScrollPosition(t4);
|
|
113
|
+
let t5;
|
|
114
|
+
if ($[5] !== enabled) {
|
|
115
|
+
t5 = {
|
|
116
|
+
enabled
|
|
117
|
+
};
|
|
118
|
+
$[5] = enabled;
|
|
119
|
+
$[6] = t5;
|
|
120
|
+
} else {
|
|
121
|
+
t5 = $[6];
|
|
122
|
+
}
|
|
47
123
|
const {
|
|
48
124
|
offsetTop,
|
|
49
125
|
topBarHeight
|
|
50
|
-
} = useWindowMetrics(
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
if (typeof (scrollPosition === null || scrollPosition === void 0 ? void 0 : scrollPosition.scrollY) === 'number') {
|
|
126
|
+
} = useWindowMetrics(t5);
|
|
127
|
+
if (typeof (scrollPosition === null || scrollPosition === void 0 ? void 0 : scrollPosition.scrollY) === "number") {
|
|
54
128
|
return Math.max(0, scrollPosition.scrollY - (offsetTop - topBarHeight));
|
|
55
129
|
}
|
|
56
130
|
return 0;
|
|
57
131
|
};
|
|
58
|
-
export const useScrollOffsetBottom =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
132
|
+
export const useScrollOffsetBottom = t0 => {
|
|
133
|
+
const $ = _c(7);
|
|
134
|
+
let t1;
|
|
135
|
+
if ($[0] !== t0) {
|
|
136
|
+
t1 = t0 === undefined ? {} : t0;
|
|
137
|
+
$[0] = t0;
|
|
138
|
+
$[1] = t1;
|
|
139
|
+
} else {
|
|
140
|
+
t1 = $[1];
|
|
141
|
+
}
|
|
142
|
+
const {
|
|
143
|
+
enabled: t2,
|
|
144
|
+
throttle: t3
|
|
145
|
+
} = t1;
|
|
146
|
+
const enabled = t2 === undefined ? true : t2;
|
|
147
|
+
const throttle = t3 === undefined ? 200 : t3;
|
|
148
|
+
let t4;
|
|
149
|
+
if ($[2] !== enabled || $[3] !== throttle) {
|
|
150
|
+
t4 = {
|
|
151
|
+
enabled,
|
|
152
|
+
throttle
|
|
153
|
+
};
|
|
154
|
+
$[2] = enabled;
|
|
155
|
+
$[3] = throttle;
|
|
156
|
+
$[4] = t4;
|
|
157
|
+
} else {
|
|
158
|
+
t4 = $[4];
|
|
159
|
+
}
|
|
160
|
+
const scrollPosition = useScrollPosition(t4);
|
|
161
|
+
let t5;
|
|
162
|
+
if ($[5] !== enabled) {
|
|
163
|
+
t5 = {
|
|
164
|
+
enabled
|
|
165
|
+
};
|
|
166
|
+
$[5] = enabled;
|
|
167
|
+
$[6] = t5;
|
|
168
|
+
} else {
|
|
169
|
+
t5 = $[6];
|
|
170
|
+
}
|
|
66
171
|
const {
|
|
67
172
|
offsetTop,
|
|
68
173
|
windowHeight,
|
|
69
174
|
bottomBarHeight
|
|
70
|
-
} = useWindowMetrics(
|
|
71
|
-
|
|
72
|
-
});
|
|
73
|
-
if (typeof (scrollPosition === null || scrollPosition === void 0 ? void 0 : scrollPosition.scrollY) === 'number') {
|
|
175
|
+
} = useWindowMetrics(t5);
|
|
176
|
+
if (typeof (scrollPosition === null || scrollPosition === void 0 ? void 0 : scrollPosition.scrollY) === "number") {
|
|
74
177
|
return windowHeight - Math.max(0, offsetTop - scrollPosition.scrollY + bottomBarHeight);
|
|
75
178
|
}
|
|
76
179
|
return 0;
|
|
77
|
-
};
|
|
180
|
+
};
|
|
181
|
+
function _temp(f) {
|
|
182
|
+
return f.getScrollPosition;
|
|
183
|
+
}
|
|
@@ -1,17 +1,41 @@
|
|
|
1
|
+
import { c as _c } from "react-compiler-runtime";
|
|
1
2
|
import { useEffect, useState } from 'react';
|
|
2
3
|
import { useFunctionsSelector } from './context';
|
|
3
4
|
export const useAccessToken = accessToken => {
|
|
5
|
+
const $ = _c(6);
|
|
4
6
|
const [token, setToken] = useState(null);
|
|
5
7
|
const [externalToken, setExternalToken] = useState(null);
|
|
6
|
-
const getAccessToken = useFunctionsSelector(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
const getAccessToken = useFunctionsSelector(_temp);
|
|
9
|
+
let t0;
|
|
10
|
+
if ($[0] !== (accessToken === null || accessToken === void 0 ? void 0 : accessToken.external) || $[1] !== getAccessToken) {
|
|
11
|
+
t0 = () => {
|
|
12
|
+
if (accessToken !== null && accessToken !== void 0 && accessToken.external) {
|
|
13
|
+
getAccessToken({
|
|
14
|
+
external: true
|
|
15
|
+
}).then(setExternalToken);
|
|
16
|
+
} else {
|
|
17
|
+
getAccessToken().then(setToken);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
$[0] = accessToken === null || accessToken === void 0 ? void 0 : accessToken.external;
|
|
21
|
+
$[1] = getAccessToken;
|
|
22
|
+
$[2] = t0;
|
|
23
|
+
} else {
|
|
24
|
+
t0 = $[2];
|
|
25
|
+
}
|
|
26
|
+
const t1 = accessToken === null || accessToken === void 0 ? void 0 : accessToken.external;
|
|
27
|
+
let t2;
|
|
28
|
+
if ($[3] !== getAccessToken || $[4] !== t1) {
|
|
29
|
+
t2 = [t1, getAccessToken];
|
|
30
|
+
$[3] = getAccessToken;
|
|
31
|
+
$[4] = t1;
|
|
32
|
+
$[5] = t2;
|
|
33
|
+
} else {
|
|
34
|
+
t2 = $[5];
|
|
35
|
+
}
|
|
36
|
+
useEffect(t0, t2);
|
|
16
37
|
return accessToken !== null && accessToken !== void 0 && accessToken.external ? externalToken === null || externalToken === void 0 ? void 0 : externalToken.accessToken : token === null || token === void 0 ? void 0 : token.accessToken;
|
|
17
|
-
};
|
|
38
|
+
};
|
|
39
|
+
function _temp(f) {
|
|
40
|
+
return f.getAccessToken;
|
|
41
|
+
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { useFunctionsSelector } from './context';
|
|
2
|
-
export const useCustomCallbackFunction = () =>
|
|
2
|
+
export const useCustomCallbackFunction = () => {
|
|
3
|
+
return useFunctionsSelector(_temp);
|
|
4
|
+
};
|
|
5
|
+
function _temp(f) {
|
|
6
|
+
return f.customCallbackFunction;
|
|
7
|
+
}
|