@selfcommunity/react-core 0.4.50-events.41 → 0.4.50-events.44
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/lib/cjs/components/provider/SCAlertMessagesProvider/index.js +3 -4
- package/lib/cjs/components/provider/SCContextProvider/index.js +6 -5
- package/lib/cjs/components/provider/SCLocaleProvider/index.js +4 -6
- package/lib/cjs/components/provider/SCNotificationProvider/index.js +3 -2
- package/lib/cjs/components/provider/SCPreferencesProvider/index.js +3 -3
- package/lib/cjs/components/provider/SCRoutingProvider/index.js +3 -2
- package/lib/cjs/components/provider/SCThemeProvider/index.js +4 -5
- package/lib/cjs/components/provider/SCUserProvider/index.js +3 -2
- package/lib/cjs/components/provider/SCVoteProvider/index.js +3 -3
- package/lib/cjs/components/router/index.js +3 -2
- package/lib/cjs/hooks/useSCWebPushMessaging.js +3 -4
- package/lib/esm/components/provider/SCAlertMessagesProvider/index.js +3 -3
- package/lib/esm/components/provider/SCContextProvider/index.js +6 -5
- package/lib/esm/components/provider/SCLocaleProvider/index.js +4 -5
- package/lib/esm/components/provider/SCNotificationProvider/index.js +3 -2
- package/lib/esm/components/provider/SCPreferencesProvider/index.js +3 -2
- package/lib/esm/components/provider/SCRoutingProvider/index.js +3 -2
- package/lib/esm/components/provider/SCThemeProvider/index.js +4 -5
- package/lib/esm/components/provider/SCUserProvider/index.js +3 -2
- package/lib/esm/components/provider/SCVoteProvider/index.js +3 -2
- package/lib/esm/components/router/index.js +3 -2
- package/lib/esm/hooks/useSCWebPushMessaging.js +3 -4
- package/lib/umd/react-core.js +1 -1
- package/package.json +6 -6
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSCAlertMessages = exports.SCAlertMessagesContext = void 0;
|
|
4
|
-
const
|
|
5
|
-
const react_1 =
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
6
|
const notistack_1 = require("notistack");
|
|
7
7
|
/**
|
|
8
8
|
* Creates Global Context
|
|
@@ -32,8 +32,7 @@ exports.SCAlertMessagesContext = (0, react_1.createContext)({});
|
|
|
32
32
|
*/
|
|
33
33
|
function SCAlertMessagesProvider({ children = null }) {
|
|
34
34
|
const [options, setOptions] = (0, react_1.useState)({ maxSnack: 3, autoHideDuration: null });
|
|
35
|
-
return (
|
|
36
|
-
react_1.default.createElement(notistack_1.SnackbarProvider, Object.assign({}, options), children)));
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(exports.SCAlertMessagesContext.Provider, Object.assign({ value: { options, setOptions } }, { children: (0, jsx_runtime_1.jsx)(notistack_1.SnackbarProvider, Object.assign({}, options, { children: children })) })));
|
|
37
36
|
}
|
|
38
37
|
exports.default = SCAlertMessagesProvider;
|
|
39
38
|
/**
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSCContext = exports.SCContext = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
6
7
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
7
8
|
const use_deep_compare_effect_1 = require("use-deep-compare-effect");
|
|
8
9
|
const validator_1 = require("../../../utils/validator");
|
|
@@ -83,10 +84,10 @@ function SCContextProvider({ conf, children }) {
|
|
|
83
84
|
* Nesting all necessary providers
|
|
84
85
|
* All child components will use help contexts to works
|
|
85
86
|
*/
|
|
86
|
-
return (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
return ((0, jsx_runtime_1.jsx)(exports.SCContext.Provider, Object.assign({ value: { settings } }, { children: settings &&
|
|
88
|
+
settings.contextProviders.reduceRight((memo, ContextProvider) => {
|
|
89
|
+
return (0, jsx_runtime_1.jsx)(ContextProvider, { children: memo });
|
|
90
|
+
}, children) })));
|
|
90
91
|
}
|
|
91
92
|
exports.default = SCContextProvider;
|
|
92
93
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSCLocale = exports.withSCLocale = exports.SCLocaleContext = void 0;
|
|
4
|
-
const
|
|
5
|
-
const react_1 =
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
6
|
const SCContextProvider_1 = require("../SCContextProvider");
|
|
7
7
|
const locale_1 = require("../../../utils/locale");
|
|
8
8
|
const Locale_1 = require("../../../constants/Locale");
|
|
@@ -76,8 +76,7 @@ function SCLocaleProvider({ children = null }) {
|
|
|
76
76
|
}
|
|
77
77
|
throw error;
|
|
78
78
|
};
|
|
79
|
-
return (
|
|
80
|
-
react_1.default.createElement(react_intl_1.IntlProvider, { key: locale, locale: locale, messages: messages, onError: handleIntlError }, children)));
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)(exports.SCLocaleContext.Provider, Object.assign({ value: { locale, messages, selectLocale } }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.IntlProvider, Object.assign({ locale: locale, messages: messages, onError: handleIntlError }, { children: children }), locale) })));
|
|
81
80
|
}
|
|
82
81
|
exports.default = SCLocaleProvider;
|
|
83
82
|
/**
|
|
@@ -86,8 +85,7 @@ exports.default = SCLocaleProvider;
|
|
|
86
85
|
*/
|
|
87
86
|
const withSCLocale = (Component) => (props) => {
|
|
88
87
|
const scLocaleContext = (0, react_1.useContext)(exports.SCLocaleContext);
|
|
89
|
-
return (
|
|
90
|
-
react_1.default.createElement(Component, Object.assign({ setLanguage: scLocaleContext.selectLocale }, props))));
|
|
88
|
+
return ((0, jsx_runtime_1.jsx)(react_intl_1.IntlProvider, Object.assign({ locale: scLocaleContext.locale, messages: scLocaleContext.messages }, { children: (0, jsx_runtime_1.jsx)(Component, Object.assign({ setLanguage: scLocaleContext.selectLocale }, props)) })));
|
|
91
89
|
};
|
|
92
90
|
exports.withSCLocale = withSCLocale;
|
|
93
91
|
/**
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSCNotification = exports.SCNotificationContext = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
6
7
|
const useSCWebSocket_1 = tslib_1.__importDefault(require("../../../hooks/useSCWebSocket"));
|
|
7
8
|
const useSCWebPushMessaging_1 = tslib_1.__importDefault(require("../../../hooks/useSCWebPushMessaging"));
|
|
8
9
|
const useSCMobileNativePushMessaging_1 = tslib_1.__importDefault(require("../../../hooks/useSCMobileNativePushMessaging"));
|
|
@@ -36,7 +37,7 @@ function SCNotificationProvider({ children = null }) {
|
|
|
36
37
|
const { wsInstance } = (0, useSCWebSocket_1.default)();
|
|
37
38
|
const { wpSubscription } = (0, useSCWebPushMessaging_1.default)();
|
|
38
39
|
const { mnpmInstance } = (0, useSCMobileNativePushMessaging_1.default)();
|
|
39
|
-
return
|
|
40
|
+
return (0, jsx_runtime_1.jsx)(exports.SCNotificationContext.Provider, Object.assign({ value: { wsInstance, wpSubscription, mnpmInstance } }, { children: children }));
|
|
40
41
|
}
|
|
41
42
|
exports.default = SCNotificationProvider;
|
|
42
43
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSCPreferences = exports.SCPreferencesContext = void 0;
|
|
4
|
-
const
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
6
6
|
const utils_1 = require("@selfcommunity/utils");
|
|
7
|
-
const react_1 =
|
|
7
|
+
const react_1 = require("react");
|
|
8
8
|
const Errors_1 = require("../../../constants/Errors");
|
|
9
9
|
const SCContextProvider_1 = require("../SCContextProvider");
|
|
10
10
|
/**
|
|
@@ -61,7 +61,7 @@ function SCPreferencesProvider({ children = null }) {
|
|
|
61
61
|
* Nesting all necessary providers
|
|
62
62
|
* All child components will use help contexts to works
|
|
63
63
|
*/
|
|
64
|
-
return
|
|
64
|
+
return (0, jsx_runtime_1.jsx)(exports.SCPreferencesContext.Provider, Object.assign({ value: { preferences, features } }, { children: !loading && children }));
|
|
65
65
|
}
|
|
66
66
|
exports.default = SCPreferencesProvider;
|
|
67
67
|
/**
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSCRouting = exports.SCRoutingContext = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
6
7
|
const SCContextProvider_1 = require("../SCContextProvider");
|
|
7
8
|
const SCPreferencesProvider_1 = require("../SCPreferencesProvider");
|
|
8
9
|
const SCPreferences = tslib_1.__importStar(require("../../../constants/Preferences"));
|
|
@@ -104,7 +105,7 @@ function SCRoutingProvider({ children = null }) {
|
|
|
104
105
|
routes,
|
|
105
106
|
url,
|
|
106
107
|
}), [routerLink, routes]);
|
|
107
|
-
return
|
|
108
|
+
return (0, jsx_runtime_1.jsx)(exports.SCRoutingContext.Provider, Object.assign({ value: contextValue }, { children: children }));
|
|
108
109
|
}
|
|
109
110
|
exports.default = SCRoutingProvider;
|
|
110
111
|
/**
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSCTheme = exports.withSCTheme = exports.SCThemeContext = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
6
7
|
const ThemeProvider_1 = tslib_1.__importDefault(require("@mui/material/styles/ThemeProvider"));
|
|
7
8
|
const theme_1 = tslib_1.__importDefault(require("../../../themes/theme"));
|
|
8
9
|
const SCContextProvider_1 = require("../SCContextProvider");
|
|
@@ -59,8 +60,7 @@ function SCThemeProvider({ children = null }) {
|
|
|
59
60
|
(0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
|
|
60
61
|
setCustomTheme(theme);
|
|
61
62
|
}, [scContext.settings.theme]);
|
|
62
|
-
return (
|
|
63
|
-
react_1.default.createElement(ThemeProvider_1.default, { theme: theme }, children)));
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)(exports.SCThemeContext.Provider, Object.assign({ value: { theme, setTheme: setCustomTheme } }, { children: (0, jsx_runtime_1.jsx)(ThemeProvider_1.default, Object.assign({ theme: theme }, { children: children })) })));
|
|
64
64
|
}
|
|
65
65
|
exports.default = SCThemeProvider;
|
|
66
66
|
/**
|
|
@@ -69,8 +69,7 @@ exports.default = SCThemeProvider;
|
|
|
69
69
|
*/
|
|
70
70
|
const withSCTheme = (Component) => (props) => {
|
|
71
71
|
const scThemeContext = (0, react_1.useContext)(exports.SCThemeContext);
|
|
72
|
-
return (
|
|
73
|
-
react_1.default.createElement(Component, Object.assign({ setTheme: scThemeContext.setTheme }, props))));
|
|
72
|
+
return ((0, jsx_runtime_1.jsx)(ThemeProvider_1.default, Object.assign({ theme: scThemeContext.theme }, { children: (0, jsx_runtime_1.jsx)(Component, Object.assign({ setTheme: scThemeContext.setTheme }, props)) })));
|
|
74
73
|
};
|
|
75
74
|
exports.withSCTheme = withSCTheme;
|
|
76
75
|
/**
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSCUser = exports.SCUserContext = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
6
7
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
7
8
|
const SCContextProvider_1 = require("../SCContextProvider");
|
|
8
9
|
const useSCAuth_1 = tslib_1.__importStar(require("../../../hooks/useSCAuth"));
|
|
@@ -248,7 +249,7 @@ function SCUserProvider({ children }) {
|
|
|
248
249
|
* We only want to render the underlying app after we
|
|
249
250
|
* assert for the presence of a current user.
|
|
250
251
|
*/
|
|
251
|
-
return
|
|
252
|
+
return (0, jsx_runtime_1.jsx)(exports.SCUserContext.Provider, Object.assign({ value: contextValue }, { children: children }));
|
|
252
253
|
}
|
|
253
254
|
exports.default = SCUserProvider;
|
|
254
255
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSCVote = exports.SCVoteContext = void 0;
|
|
4
|
-
const
|
|
5
|
-
const react_1 =
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
6
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
7
7
|
const utils_1 = require("@selfcommunity/utils");
|
|
8
8
|
const Errors_1 = require("../../../constants/Errors");
|
|
@@ -82,7 +82,7 @@ function SCVoteProvider({ children = null }) {
|
|
|
82
82
|
* Nesting all necessary providers
|
|
83
83
|
* All child components will use help contexts to works
|
|
84
84
|
*/
|
|
85
|
-
return
|
|
85
|
+
return (0, jsx_runtime_1.jsx)(exports.SCVoteContext.Provider, Object.assign({ value: { reactions, isLoading, refreshReactions } }, { children: initialized && children }));
|
|
86
86
|
}
|
|
87
87
|
exports.default = SCVoteProvider;
|
|
88
88
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
6
|
const SCRoutingProvider_1 = require("../provider/SCRoutingProvider");
|
|
6
7
|
/**
|
|
@@ -21,10 +22,10 @@ const Link = (_a, ref) => {
|
|
|
21
22
|
const scRoutingContext = (0, react_1.useContext)(SCRoutingProvider_1.SCRoutingContext);
|
|
22
23
|
if (scRoutingContext.routerLink) {
|
|
23
24
|
const ComponentLink = scRoutingContext.routerLink;
|
|
24
|
-
return (
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(ComponentLink, Object.assign({}, other, { ref: ref }, { children: children })));
|
|
25
26
|
}
|
|
26
27
|
const { to } = other, rest = tslib_1.__rest(other, ["to"]);
|
|
27
|
-
return (
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)("a", Object.assign({ href: to }, rest, { ref: ref }, { children: children })));
|
|
28
29
|
};
|
|
29
30
|
/**
|
|
30
31
|
:::info
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SUPPORTED_BROWSER_TYPES = exports.DEFAULT_BROWSER_TYPE = exports.EDGE_BROWSER_TYPE = exports.OPERA_BROWSER_TYPE = exports.FIREFOX_BROWSER_TYPE = exports.CHROME_BROWSER_TYPE = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
6
7
|
const SCContextProvider_1 = require("../components/provider/SCContextProvider");
|
|
7
8
|
const SCUserProvider_1 = require("../components/provider/SCUserProvider");
|
|
8
9
|
const utils_1 = require("@selfcommunity/utils");
|
|
@@ -60,9 +61,7 @@ function useSCWebPushMessaging() {
|
|
|
60
61
|
const showCustomRequestNotificationSnackbar = () => {
|
|
61
62
|
if (!js_cookie_1.default.get(Notifications_1.NOTIFICATIONS_WEB_PUSH_MESSAGING_DIALOG_COOKIE)) {
|
|
62
63
|
enqueueSnackbar(intl.formatMessage({ id: 'ui.webPushNotification.requestPermission', defaultMessage: 'ui.webPushNotification.requestPermission' }), {
|
|
63
|
-
action: (snackbarId) => (
|
|
64
|
-
react_1.default.createElement(Button_1.default, { size: "small", sx: { color: '#FFF' }, onClick: () => requestNotificationPermission(snackbarId) }, intl.formatMessage({ id: 'ui.webPushNotification.allow', defaultMessage: 'ui.webPushNotification.allow' })),
|
|
65
|
-
react_1.default.createElement(Button_1.default, { size: "small", sx: { color: '#FFF' }, onClick: () => closeRequestNotificationSnackbar(snackbarId) }, intl.formatMessage({ id: 'ui.webPushNotification.block', defaultMessage: 'ui.webPushNotification.block' })))),
|
|
64
|
+
action: (snackbarId) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.default, Object.assign({ size: "small", sx: { color: '#FFF' }, onClick: () => requestNotificationPermission(snackbarId) }, { children: intl.formatMessage({ id: 'ui.webPushNotification.allow', defaultMessage: 'ui.webPushNotification.allow' }) })), (0, jsx_runtime_1.jsx)(Button_1.default, Object.assign({ size: "small", sx: { color: '#FFF' }, onClick: () => closeRequestNotificationSnackbar(snackbarId) }, { children: intl.formatMessage({ id: 'ui.webPushNotification.block', defaultMessage: 'ui.webPushNotification.block' }) }))] })),
|
|
66
65
|
variant: 'default',
|
|
67
66
|
anchorOrigin: { horizontal: 'center', vertical: 'bottom' },
|
|
68
67
|
preventDuplicate: true,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useState } from 'react';
|
|
2
3
|
import { SnackbarProvider } from 'notistack';
|
|
3
4
|
/**
|
|
4
5
|
* Creates Global Context
|
|
@@ -28,8 +29,7 @@ export const SCAlertMessagesContext = createContext({});
|
|
|
28
29
|
*/
|
|
29
30
|
export default function SCAlertMessagesProvider({ children = null }) {
|
|
30
31
|
const [options, setOptions] = useState({ maxSnack: 3, autoHideDuration: null });
|
|
31
|
-
return (
|
|
32
|
-
React.createElement(SnackbarProvider, Object.assign({}, options), children)));
|
|
32
|
+
return (_jsx(SCAlertMessagesContext.Provider, Object.assign({ value: { options, setOptions } }, { children: _jsx(SnackbarProvider, Object.assign({}, options, { children: children })) })));
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Let's only export the `useSCAlertMessages` hook instead of the context.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useMemo, useState } from 'react';
|
|
2
3
|
import { http } from '@selfcommunity/api-services';
|
|
3
4
|
import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect';
|
|
4
5
|
import { validateOptions, validOptions } from '../../../utils/validator';
|
|
@@ -79,10 +80,10 @@ export default function SCContextProvider({ conf, children }) {
|
|
|
79
80
|
* Nesting all necessary providers
|
|
80
81
|
* All child components will use help contexts to works
|
|
81
82
|
*/
|
|
82
|
-
return (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
return (_jsx(SCContext.Provider, Object.assign({ value: { settings } }, { children: settings &&
|
|
84
|
+
settings.contextProviders.reduceRight((memo, ContextProvider) => {
|
|
85
|
+
return _jsx(ContextProvider, { children: memo });
|
|
86
|
+
}, children) })));
|
|
86
87
|
}
|
|
87
88
|
/**
|
|
88
89
|
* Let's only export the `useSCContext` hook instead of the context.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useMemo, useState } from 'react';
|
|
2
3
|
import { useSCContext } from '../SCContextProvider';
|
|
3
4
|
import { loadLocaleData } from '../../../utils/locale';
|
|
4
5
|
import { DEFAULT_LANGUAGE_UI } from '../../../constants/Locale';
|
|
@@ -72,8 +73,7 @@ export default function SCLocaleProvider({ children = null }) {
|
|
|
72
73
|
}
|
|
73
74
|
throw error;
|
|
74
75
|
};
|
|
75
|
-
return (
|
|
76
|
-
React.createElement(IntlProvider, { key: locale, locale: locale, messages: messages, onError: handleIntlError }, children)));
|
|
76
|
+
return (_jsx(SCLocaleContext.Provider, Object.assign({ value: { locale, messages, selectLocale } }, { children: _jsx(IntlProvider, Object.assign({ locale: locale, messages: messages, onError: handleIntlError }, { children: children }), locale) })));
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Export hoc to inject the base theme to components
|
|
@@ -81,8 +81,7 @@ export default function SCLocaleProvider({ children = null }) {
|
|
|
81
81
|
*/
|
|
82
82
|
export const withSCLocale = (Component) => (props) => {
|
|
83
83
|
const scLocaleContext = useContext(SCLocaleContext);
|
|
84
|
-
return (
|
|
85
|
-
React.createElement(Component, Object.assign({ setLanguage: scLocaleContext.selectLocale }, props))));
|
|
84
|
+
return (_jsx(IntlProvider, Object.assign({ locale: scLocaleContext.locale, messages: scLocaleContext.messages }, { children: _jsx(Component, Object.assign({ setLanguage: scLocaleContext.selectLocale }, props)) })));
|
|
86
85
|
};
|
|
87
86
|
/**
|
|
88
87
|
* Let's only export the `useSCLocale` hook instead of the context.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
2
3
|
import useSCWebSocket from '../../../hooks/useSCWebSocket';
|
|
3
4
|
import useSCWebPushMessaging from '../../../hooks/useSCWebPushMessaging';
|
|
4
5
|
import useSCMobileNativePushMessaging from '../../../hooks/useSCMobileNativePushMessaging';
|
|
@@ -32,7 +33,7 @@ export default function SCNotificationProvider({ children = null }) {
|
|
|
32
33
|
const { wsInstance } = useSCWebSocket();
|
|
33
34
|
const { wpSubscription } = useSCWebPushMessaging();
|
|
34
35
|
const { mnpmInstance } = useSCMobileNativePushMessaging();
|
|
35
|
-
return
|
|
36
|
+
return _jsx(SCNotificationContext.Provider, Object.assign({ value: { wsInstance, wpSubscription, mnpmInstance } }, { children: children }));
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* Let's only export the `useSCNotification` hook instead of the context.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { FeatureService, PreferenceService } from '@selfcommunity/api-services';
|
|
2
3
|
import { Logger } from '@selfcommunity/utils';
|
|
3
|
-
import
|
|
4
|
+
import { createContext, useContext, useEffect, useState } from 'react';
|
|
4
5
|
import { SCOPE_SC_CORE } from '../../../constants/Errors';
|
|
5
6
|
import { useSCContext } from '../SCContextProvider';
|
|
6
7
|
/**
|
|
@@ -57,7 +58,7 @@ export default function SCPreferencesProvider({ children = null }) {
|
|
|
57
58
|
* Nesting all necessary providers
|
|
58
59
|
* All child components will use help contexts to works
|
|
59
60
|
*/
|
|
60
|
-
return
|
|
61
|
+
return _jsx(SCPreferencesContext.Provider, Object.assign({ value: { preferences, features } }, { children: !loading && children }));
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
63
64
|
* Let's only export the `useSCPreferences` hook instead of the context.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
2
3
|
import { useSCContext } from '../SCContextProvider';
|
|
3
4
|
import { SCPreferencesContext } from '../SCPreferencesProvider';
|
|
4
5
|
import * as SCPreferences from '../../../constants/Preferences';
|
|
@@ -100,7 +101,7 @@ export default function SCRoutingProvider({ children = null }) {
|
|
|
100
101
|
routes,
|
|
101
102
|
url,
|
|
102
103
|
}), [routerLink, routes]);
|
|
103
|
-
return
|
|
104
|
+
return _jsx(SCRoutingContext.Provider, Object.assign({ value: contextValue }, { children: children }));
|
|
104
105
|
}
|
|
105
106
|
/**
|
|
106
107
|
* Let's only export the `useSCTheme` hook instead of the context.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useState } from 'react';
|
|
2
3
|
import ThemeProvider from '@mui/material/styles/ThemeProvider';
|
|
3
4
|
import getTheme from '../../../themes/theme';
|
|
4
5
|
import { useSCContext } from '../SCContextProvider';
|
|
@@ -55,8 +56,7 @@ export default function SCThemeProvider({ children = null }) {
|
|
|
55
56
|
useDeepCompareEffectNoCheck(() => {
|
|
56
57
|
setCustomTheme(theme);
|
|
57
58
|
}, [scContext.settings.theme]);
|
|
58
|
-
return (
|
|
59
|
-
React.createElement(ThemeProvider, { theme: theme }, children)));
|
|
59
|
+
return (_jsx(SCThemeContext.Provider, Object.assign({ value: { theme, setTheme: setCustomTheme } }, { children: _jsx(ThemeProvider, Object.assign({ theme: theme }, { children: children })) })));
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Export hoc to inject the base theme to components
|
|
@@ -64,8 +64,7 @@ export default function SCThemeProvider({ children = null }) {
|
|
|
64
64
|
*/
|
|
65
65
|
export const withSCTheme = (Component) => (props) => {
|
|
66
66
|
const scThemeContext = useContext(SCThemeContext);
|
|
67
|
-
return (
|
|
68
|
-
React.createElement(Component, Object.assign({ setTheme: scThemeContext.setTheme }, props))));
|
|
67
|
+
return (_jsx(ThemeProvider, Object.assign({ theme: scThemeContext.theme }, { children: _jsx(Component, Object.assign({ setTheme: scThemeContext.setTheme }, props)) })));
|
|
69
68
|
};
|
|
70
69
|
/**
|
|
71
70
|
* Let's only export the `useSCTheme` hook instead of the context.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect, useMemo, useRef } from 'react';
|
|
2
3
|
import { UserService } from '@selfcommunity/api-services';
|
|
3
4
|
import { SCContext } from '../SCContextProvider';
|
|
4
5
|
import useSCAuth, { userActionTypes } from '../../../hooks/useSCAuth';
|
|
@@ -244,7 +245,7 @@ export default function SCUserProvider({ children }) {
|
|
|
244
245
|
* We only want to render the underlying app after we
|
|
245
246
|
* assert for the presence of a current user.
|
|
246
247
|
*/
|
|
247
|
-
return
|
|
248
|
+
return _jsx(SCUserContext.Provider, Object.assign({ value: contextValue }, { children: children }));
|
|
248
249
|
}
|
|
249
250
|
/**
|
|
250
251
|
* Let's only export the `useSCUser` hook instead of the context.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useState } from 'react';
|
|
2
3
|
import { ReactionService } from '@selfcommunity/api-services';
|
|
3
4
|
import { Logger } from '@selfcommunity/utils';
|
|
4
5
|
import { SCOPE_SC_CORE } from '../../../constants/Errors';
|
|
@@ -78,7 +79,7 @@ export default function SCVoteProvider({ children = null }) {
|
|
|
78
79
|
* Nesting all necessary providers
|
|
79
80
|
* All child components will use help contexts to works
|
|
80
81
|
*/
|
|
81
|
-
return
|
|
82
|
+
return _jsx(SCVoteContext.Provider, Object.assign({ value: { reactions, isLoading, refreshReactions } }, { children: initialized && children }));
|
|
82
83
|
}
|
|
83
84
|
/**
|
|
84
85
|
* Let's only export the `useSCPreferences` hook instead of the context.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import React, { useContext } from 'react';
|
|
3
4
|
import { SCRoutingContext } from '../provider/SCRoutingProvider';
|
|
4
5
|
/**
|
|
@@ -19,10 +20,10 @@ const Link = (_a, ref) => {
|
|
|
19
20
|
const scRoutingContext = useContext(SCRoutingContext);
|
|
20
21
|
if (scRoutingContext.routerLink) {
|
|
21
22
|
const ComponentLink = scRoutingContext.routerLink;
|
|
22
|
-
return (
|
|
23
|
+
return (_jsx(ComponentLink, Object.assign({}, other, { ref: ref }, { children: children })));
|
|
23
24
|
}
|
|
24
25
|
const { to } = other, rest = __rest(other, ["to"]);
|
|
25
|
-
return (
|
|
26
|
+
return (_jsx("a", Object.assign({ href: to }, rest, { ref: ref }, { children: children })));
|
|
26
27
|
};
|
|
27
28
|
/**
|
|
28
29
|
:::info
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useEffect, useRef, useState } from 'react';
|
|
2
3
|
import { useSCContext } from '../components/provider/SCContextProvider';
|
|
3
4
|
import { useSCUser } from '../components/provider/SCUserProvider';
|
|
4
5
|
import { Logger } from '@selfcommunity/utils';
|
|
@@ -56,9 +57,7 @@ export default function useSCWebPushMessaging() {
|
|
|
56
57
|
const showCustomRequestNotificationSnackbar = () => {
|
|
57
58
|
if (!Cookies.get(NOTIFICATIONS_WEB_PUSH_MESSAGING_DIALOG_COOKIE)) {
|
|
58
59
|
enqueueSnackbar(intl.formatMessage({ id: 'ui.webPushNotification.requestPermission', defaultMessage: 'ui.webPushNotification.requestPermission' }), {
|
|
59
|
-
action: (snackbarId) => (
|
|
60
|
-
React.createElement(Button, { size: "small", sx: { color: '#FFF' }, onClick: () => requestNotificationPermission(snackbarId) }, intl.formatMessage({ id: 'ui.webPushNotification.allow', defaultMessage: 'ui.webPushNotification.allow' })),
|
|
61
|
-
React.createElement(Button, { size: "small", sx: { color: '#FFF' }, onClick: () => closeRequestNotificationSnackbar(snackbarId) }, intl.formatMessage({ id: 'ui.webPushNotification.block', defaultMessage: 'ui.webPushNotification.block' })))),
|
|
60
|
+
action: (snackbarId) => (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ size: "small", sx: { color: '#FFF' }, onClick: () => requestNotificationPermission(snackbarId) }, { children: intl.formatMessage({ id: 'ui.webPushNotification.allow', defaultMessage: 'ui.webPushNotification.allow' }) })), _jsx(Button, Object.assign({ size: "small", sx: { color: '#FFF' }, onClick: () => closeRequestNotificationSnackbar(snackbarId) }, { children: intl.formatMessage({ id: 'ui.webPushNotification.block', defaultMessage: 'ui.webPushNotification.block' }) }))] })),
|
|
62
61
|
variant: 'default',
|
|
63
62
|
anchorOrigin: { horizontal: 'center', vertical: 'bottom' },
|
|
64
63
|
preventDuplicate: true,
|