@elice/material-shared-utils 1.260128.0-rc.0 → 1.260129.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.
Files changed (46) hide show
  1. package/cjs/hooks/useHelpyLogo.js +2 -2
  2. package/es/hooks/useCallbackProp.js +3 -3
  3. package/es/hooks/useDeepClonedCompareEffect.js +2 -2
  4. package/es/hooks/useHelpyLogo.js +1 -1
  5. package/es/material-config/MaterialConfigProvider.js +5 -5
  6. package/package.json +5 -3
  7. package/cjs/_virtual/index.js +0 -5
  8. package/cjs/_virtual/use-sync-external-store-shim.production.js +0 -5
  9. package/cjs/node_modules/@tanstack/query-core/build/lib/focusManager.js +0 -93
  10. package/cjs/node_modules/@tanstack/query-core/build/lib/notifyManager.js +0 -101
  11. package/cjs/node_modules/@tanstack/query-core/build/lib/onlineManager.js +0 -95
  12. package/cjs/node_modules/@tanstack/query-core/build/lib/queryObserver.js +0 -571
  13. package/cjs/node_modules/@tanstack/query-core/build/lib/retryer.js +0 -21
  14. package/cjs/node_modules/@tanstack/query-core/build/lib/subscribable.js +0 -33
  15. package/cjs/node_modules/@tanstack/query-core/build/lib/utils.js +0 -154
  16. package/cjs/node_modules/@tanstack/react-query/build/lib/QueryClientProvider.js +0 -65
  17. package/cjs/node_modules/@tanstack/react-query/build/lib/QueryErrorResetBoundary.js +0 -46
  18. package/cjs/node_modules/@tanstack/react-query/build/lib/errorBoundaryUtils.js +0 -52
  19. package/cjs/node_modules/@tanstack/react-query/build/lib/isRestoring.js +0 -31
  20. package/cjs/node_modules/@tanstack/react-query/build/lib/suspense.js +0 -39
  21. package/cjs/node_modules/@tanstack/react-query/build/lib/useBaseQuery.js +0 -94
  22. package/cjs/node_modules/@tanstack/react-query/build/lib/useQuery.js +0 -14
  23. package/cjs/node_modules/@tanstack/react-query/build/lib/useSyncExternalStore.js +0 -9
  24. package/cjs/node_modules/@tanstack/react-query/build/lib/utils.js +0 -12
  25. package/cjs/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -77
  26. package/cjs/node_modules/use-sync-external-store/shim/index.js +0 -13
  27. package/es/_virtual/index.js +0 -3
  28. package/es/_virtual/use-sync-external-store-shim.production.js +0 -3
  29. package/es/node_modules/@tanstack/query-core/build/lib/focusManager.js +0 -90
  30. package/es/node_modules/@tanstack/query-core/build/lib/notifyManager.js +0 -98
  31. package/es/node_modules/@tanstack/query-core/build/lib/onlineManager.js +0 -92
  32. package/es/node_modules/@tanstack/query-core/build/lib/queryObserver.js +0 -569
  33. package/es/node_modules/@tanstack/query-core/build/lib/retryer.js +0 -17
  34. package/es/node_modules/@tanstack/query-core/build/lib/subscribable.js +0 -31
  35. package/es/node_modules/@tanstack/query-core/build/lib/utils.js +0 -140
  36. package/es/node_modules/@tanstack/react-query/build/lib/QueryClientProvider.js +0 -42
  37. package/es/node_modules/@tanstack/react-query/build/lib/QueryErrorResetBoundary.js +0 -24
  38. package/es/node_modules/@tanstack/react-query/build/lib/errorBoundaryUtils.js +0 -28
  39. package/es/node_modules/@tanstack/react-query/build/lib/isRestoring.js +0 -9
  40. package/es/node_modules/@tanstack/react-query/build/lib/suspense.js +0 -34
  41. package/es/node_modules/@tanstack/react-query/build/lib/useBaseQuery.js +0 -72
  42. package/es/node_modules/@tanstack/react-query/build/lib/useQuery.js +0 -12
  43. package/es/node_modules/@tanstack/react-query/build/lib/useSyncExternalStore.js +0 -7
  44. package/es/node_modules/@tanstack/react-query/build/lib/utils.js +0 -10
  45. package/es/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -69
  46. package/es/node_modules/use-sync-external-store/shim/index.js +0 -11
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var apiClient = require('@elice/api-client');
4
+ var reactQuery = require('@tanstack/react-query');
4
5
  var ai_helpy = require('../assets/ai_helpy.png.js');
5
6
  var helpyLogoNoBrand = require('../assets/helpy-logo-no-brand.png.js');
6
7
  var useMaterialConfig = require('../material-config/useMaterialConfig.js');
7
- var useQuery = require('../node_modules/@tanstack/react-query/build/lib/useQuery.js');
8
8
 
9
9
  //
10
10
  //
@@ -13,7 +13,7 @@ var useHelpyLogo = function useHelpyLogo() {
13
13
  var _a;
14
14
  var _useMaterialConfig = useMaterialConfig.useMaterialConfig(),
15
15
  orgNameShort = _useMaterialConfig.orgNameShort;
16
- var _useQuery = useQuery.useQuery({
16
+ var _useQuery = reactQuery.useQuery({
17
17
  queryKey: ['getGlobalOrganizationGet', orgNameShort],
18
18
  queryFn: function queryFn(_ref) {
19
19
  var signal = _ref.signal;
@@ -1,8 +1,8 @@
1
- import React__default from 'react';
1
+ import React from 'react';
2
2
 
3
3
  var useCallbackProp = function useCallbackProp(cb) {
4
- var cbRef = React__default.useRef(cb);
5
- React__default.useEffect(function () {
4
+ var cbRef = React.useRef(cb);
5
+ React.useEffect(function () {
6
6
  cbRef.current = cb;
7
7
  }, [cb]);
8
8
  return cbRef;
@@ -1,10 +1,10 @@
1
- import React__default from 'react';
1
+ import React from 'react';
2
2
  import { useDebounce } from 'react-use';
3
3
  import { isEqual, cloneDeep } from 'lodash-es';
4
4
 
5
5
  var DEBOUNCE_TIME = 10;
6
6
  var useDeepClonedCompareEffect = function useDeepClonedCompareEffect(effect, deps) {
7
- var _ref = React__default.useRef();
7
+ var _ref = React.useRef();
8
8
  useDebounce(function () {
9
9
  if (!_ref.current || !isEqual(deps, _ref.current)) {
10
10
  _ref.current = cloneDeep(deps);
@@ -1,8 +1,8 @@
1
1
  import { getGlobalOrganizationGet } from '@elice/api-client';
2
+ import { useQuery } from '@tanstack/react-query';
2
3
  import img$1 from '../assets/ai_helpy.png.js';
3
4
  import img from '../assets/helpy-logo-no-brand.png.js';
4
5
  import { useMaterialConfig } from '../material-config/useMaterialConfig.js';
5
- import { useQuery } from '../node_modules/@tanstack/react-query/build/lib/useQuery.js';
6
6
 
7
7
  //
8
8
  //
@@ -1,6 +1,6 @@
1
1
  import { slicedToArray as _slicedToArray } from '../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import React__default from 'react';
3
+ import React from 'react';
4
4
  import { sessionKeySubject$, MaterialConfigContext } from './MaterialConfigContext.js';
5
5
 
6
6
  var MaterialConfigProvider = function MaterialConfigProvider(_ref) {
@@ -9,24 +9,24 @@ var MaterialConfigProvider = function MaterialConfigProvider(_ref) {
9
9
  apiWsOriginUrl = _ref.apiWsOriginUrl,
10
10
  _ref$orgNameShort = _ref.orgNameShort,
11
11
  orgNameShortProp = _ref$orgNameShort === void 0 ? 'academy' : _ref$orgNameShort;
12
- var _React$useState = React__default.useState(orgNameShortProp),
12
+ var _React$useState = React.useState(orgNameShortProp),
13
13
  _React$useState2 = _slicedToArray(_React$useState, 2),
14
14
  orgNameShort = _React$useState2[0],
15
15
  setOrgNameShort = _React$useState2[1];
16
- var _React$useState3 = React__default.useState(null),
16
+ var _React$useState3 = React.useState(null),
17
17
  _React$useState4 = _slicedToArray(_React$useState3, 2),
18
18
  sessionKey = _React$useState4[0],
19
19
  setSessionKey = _React$useState4[1];
20
20
  //
21
21
  // Update org name short.
22
22
  //
23
- React__default.useEffect(function () {
23
+ React.useEffect(function () {
24
24
  return setOrgNameShort(orgNameShortProp);
25
25
  }, [orgNameShortProp]);
26
26
  //
27
27
  // Update session key when session key subject emits.
28
28
  //
29
- React__default.useEffect(function () {
29
+ React.useEffect(function () {
30
30
  var sub = sessionKeySubject$.subscribe(setSessionKey);
31
31
  return function () {
32
32
  sub.unsubscribe();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-shared-utils",
3
- "version": "1.260128.0-rc.0",
3
+ "version": "1.260129.0",
4
4
  "description": "Shared typings for elice material projects",
5
5
  "repository": "https://git.elicer.io/elice/frontend/library/elice-material",
6
6
  "license": "UNLICENSED",
@@ -25,7 +25,8 @@
25
25
  "peerDependencies": {
26
26
  "@elice/api-client": "^1",
27
27
  "@elice/blocks": "^1",
28
- "@elice/material-shared-types": "1.260128.0-rc.0",
28
+ "@elice/material-shared-types": "1.260129.0",
29
+ "@tanstack/react-query": "^4",
29
30
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
30
31
  "react-use": "^17.0.0",
31
32
  "recoil": "^0"
@@ -37,8 +38,9 @@
37
38
  "devDependencies": {
38
39
  "@elice/api-client": "^1.250702.0",
39
40
  "@elice/blocks": "1.241007.0",
40
- "@elice/material-shared-types": "1.260128.0-rc.0",
41
+ "@elice/material-shared-types": "1.260129.0",
41
42
  "@elice/types": "^1.251229.0",
43
+ "@tanstack/react-query": "^4.29.3",
42
44
  "@types/lodash-es": "^4.17.6",
43
45
  "@types/react": "~17.0.9",
44
46
  "react-use": "^17.2.4",
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- var shim = {exports: {}};
4
-
5
- exports.__module = shim;
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- var useSyncExternalStoreShim_production = {};
4
-
5
- exports.__exports = useSyncExternalStoreShim_production;
@@ -1,93 +0,0 @@
1
- 'use strict';
2
-
3
- var subscribable = require('./subscribable.js');
4
- var utils = require('./utils.js');
5
-
6
- class FocusManager extends subscribable.Subscribable {
7
- constructor() {
8
- super();
9
-
10
- this.setup = onFocus => {
11
- // addEventListener does not exist in React Native, but window does
12
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
13
- if (!utils.isServer && window.addEventListener) {
14
- const listener = () => onFocus(); // Listen to visibillitychange and focus
15
-
16
-
17
- window.addEventListener('visibilitychange', listener, false);
18
- window.addEventListener('focus', listener, false);
19
- return () => {
20
- // Be sure to unsubscribe if a new handler is set
21
- window.removeEventListener('visibilitychange', listener);
22
- window.removeEventListener('focus', listener);
23
- };
24
- }
25
-
26
- return;
27
- };
28
- }
29
-
30
- onSubscribe() {
31
- if (!this.cleanup) {
32
- this.setEventListener(this.setup);
33
- }
34
- }
35
-
36
- onUnsubscribe() {
37
- if (!this.hasListeners()) {
38
- var _this$cleanup;
39
-
40
- (_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);
41
- this.cleanup = undefined;
42
- }
43
- }
44
-
45
- setEventListener(setup) {
46
- var _this$cleanup2;
47
-
48
- this.setup = setup;
49
- (_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);
50
- this.cleanup = setup(focused => {
51
- if (typeof focused === 'boolean') {
52
- this.setFocused(focused);
53
- } else {
54
- this.onFocus();
55
- }
56
- });
57
- }
58
-
59
- setFocused(focused) {
60
- const changed = this.focused !== focused;
61
-
62
- if (changed) {
63
- this.focused = focused;
64
- this.onFocus();
65
- }
66
- }
67
-
68
- onFocus() {
69
- this.listeners.forEach(({
70
- listener
71
- }) => {
72
- listener();
73
- });
74
- }
75
-
76
- isFocused() {
77
- if (typeof this.focused === 'boolean') {
78
- return this.focused;
79
- } // document global can be unavailable in react native
80
-
81
-
82
- if (typeof document === 'undefined') {
83
- return true;
84
- }
85
-
86
- return [undefined, 'visible', 'prerender'].includes(document.visibilityState);
87
- }
88
-
89
- }
90
- const focusManager = new FocusManager();
91
-
92
- exports.FocusManager = FocusManager;
93
- exports.focusManager = focusManager;
@@ -1,101 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('./utils.js');
4
-
5
- function createNotifyManager() {
6
- let queue = [];
7
- let transactions = 0;
8
-
9
- let notifyFn = callback => {
10
- callback();
11
- };
12
-
13
- let batchNotifyFn = callback => {
14
- callback();
15
- };
16
-
17
- const batch = callback => {
18
- let result;
19
- transactions++;
20
-
21
- try {
22
- result = callback();
23
- } finally {
24
- transactions--;
25
-
26
- if (!transactions) {
27
- flush();
28
- }
29
- }
30
-
31
- return result;
32
- };
33
-
34
- const schedule = callback => {
35
- if (transactions) {
36
- queue.push(callback);
37
- } else {
38
- utils.scheduleMicrotask(() => {
39
- notifyFn(callback);
40
- });
41
- }
42
- };
43
- /**
44
- * All calls to the wrapped function will be batched.
45
- */
46
-
47
-
48
- const batchCalls = callback => {
49
- return (...args) => {
50
- schedule(() => {
51
- callback(...args);
52
- });
53
- };
54
- };
55
-
56
- const flush = () => {
57
- const originalQueue = queue;
58
- queue = [];
59
-
60
- if (originalQueue.length) {
61
- utils.scheduleMicrotask(() => {
62
- batchNotifyFn(() => {
63
- originalQueue.forEach(callback => {
64
- notifyFn(callback);
65
- });
66
- });
67
- });
68
- }
69
- };
70
- /**
71
- * Use this method to set a custom notify function.
72
- * This can be used to for example wrap notifications with `React.act` while running tests.
73
- */
74
-
75
-
76
- const setNotifyFunction = fn => {
77
- notifyFn = fn;
78
- };
79
- /**
80
- * Use this method to set a custom function to batch notifications together into a single tick.
81
- * By default React Query will use the batch function provided by ReactDOM or React Native.
82
- */
83
-
84
-
85
- const setBatchNotifyFunction = fn => {
86
- batchNotifyFn = fn;
87
- };
88
-
89
- return {
90
- batch,
91
- batchCalls,
92
- schedule,
93
- setNotifyFunction,
94
- setBatchNotifyFunction
95
- };
96
- } // SINGLETON
97
-
98
- const notifyManager = createNotifyManager();
99
-
100
- exports.createNotifyManager = createNotifyManager;
101
- exports.notifyManager = notifyManager;
@@ -1,95 +0,0 @@
1
- 'use strict';
2
-
3
- var subscribable = require('./subscribable.js');
4
- var utils = require('./utils.js');
5
-
6
- const onlineEvents = ['online', 'offline'];
7
- class OnlineManager extends subscribable.Subscribable {
8
- constructor() {
9
- super();
10
-
11
- this.setup = onOnline => {
12
- // addEventListener does not exist in React Native, but window does
13
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
14
- if (!utils.isServer && window.addEventListener) {
15
- const listener = () => onOnline(); // Listen to online
16
-
17
-
18
- onlineEvents.forEach(event => {
19
- window.addEventListener(event, listener, false);
20
- });
21
- return () => {
22
- // Be sure to unsubscribe if a new handler is set
23
- onlineEvents.forEach(event => {
24
- window.removeEventListener(event, listener);
25
- });
26
- };
27
- }
28
-
29
- return;
30
- };
31
- }
32
-
33
- onSubscribe() {
34
- if (!this.cleanup) {
35
- this.setEventListener(this.setup);
36
- }
37
- }
38
-
39
- onUnsubscribe() {
40
- if (!this.hasListeners()) {
41
- var _this$cleanup;
42
-
43
- (_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);
44
- this.cleanup = undefined;
45
- }
46
- }
47
-
48
- setEventListener(setup) {
49
- var _this$cleanup2;
50
-
51
- this.setup = setup;
52
- (_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);
53
- this.cleanup = setup(online => {
54
- if (typeof online === 'boolean') {
55
- this.setOnline(online);
56
- } else {
57
- this.onOnline();
58
- }
59
- });
60
- }
61
-
62
- setOnline(online) {
63
- const changed = this.online !== online;
64
-
65
- if (changed) {
66
- this.online = online;
67
- this.onOnline();
68
- }
69
- }
70
-
71
- onOnline() {
72
- this.listeners.forEach(({
73
- listener
74
- }) => {
75
- listener();
76
- });
77
- }
78
-
79
- isOnline() {
80
- if (typeof this.online === 'boolean') {
81
- return this.online;
82
- }
83
-
84
- if (typeof navigator === 'undefined' || typeof navigator.onLine === 'undefined') {
85
- return true;
86
- }
87
-
88
- return navigator.onLine;
89
- }
90
-
91
- }
92
- const onlineManager = new OnlineManager();
93
-
94
- exports.OnlineManager = OnlineManager;
95
- exports.onlineManager = onlineManager;