@selfcommunity/react-ui 0.8.0-embeds.16 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/Composer/Composer.js +2 -0
- package/lib/cjs/components/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.js +1 -1
- package/lib/cjs/components/Events/Events.js +15 -5
- package/lib/cjs/components/Events/LocationEventsFilter.d.ts +14 -0
- package/lib/cjs/components/Events/LocationEventsFilter.js +45 -0
- package/lib/cjs/components/Events/PastEventsFilter.js +1 -2
- package/lib/cjs/components/Feed/Feed.js +12 -3
- package/lib/cjs/components/GroupActionsMenu/index.d.ts +57 -0
- package/lib/cjs/components/GroupActionsMenu/index.js +157 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +6 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.js +8 -4
- package/lib/cjs/components/Groups/Groups.js +26 -0
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +31 -0
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +35 -0
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.d.ts +9 -20
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.js +4 -20
- package/lib/cjs/components/NavigationMenuIconButton/index.d.ts +2 -1
- package/lib/cjs/components/NavigationMenuIconButton/index.js +3 -1
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +5 -0
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +3 -3
- package/lib/cjs/components/Notification/Event/Event.js +4 -0
- package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.d.ts +10 -1
- package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +47 -12
- package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.js +8 -4
- package/lib/cjs/components/OnBoardingWidget/Steps/Invite/Invite.js +56 -12
- package/lib/cjs/components/PlatformWidget/constants.d.ts +0 -4
- package/lib/cjs/components/PlatformWidget/constants.js +1 -5
- package/lib/cjs/constants/GroupActionsMenu.d.ts +5 -0
- package/lib/cjs/constants/GroupActionsMenu.js +8 -0
- package/lib/cjs/index.d.ts +4 -2
- package/lib/cjs/index.js +11 -5
- package/lib/cjs/shared/EventInfoDetails/index.js +3 -3
- package/lib/cjs/shared/InfiniteScroll/index.js +3 -3
- package/lib/cjs/shared/Media/Link/DisplayComponent.js +5 -5
- package/lib/cjs/utils/formatRelativeTime.js +2 -2
- package/lib/esm/components/Composer/Composer.js +2 -0
- package/lib/esm/components/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.js +2 -2
- package/lib/esm/components/Events/Events.js +16 -6
- package/lib/esm/components/Events/LocationEventsFilter.d.ts +14 -0
- package/lib/esm/components/Events/LocationEventsFilter.js +41 -0
- package/lib/esm/components/Events/PastEventsFilter.js +1 -2
- package/lib/esm/components/Feed/Feed.js +14 -5
- package/lib/esm/components/GroupActionsMenu/index.d.ts +57 -0
- package/lib/esm/components/GroupActionsMenu/index.js +154 -0
- package/lib/esm/components/GroupHeader/GroupHeader.d.ts +6 -0
- package/lib/esm/components/GroupHeader/GroupHeader.js +9 -5
- package/lib/esm/components/Groups/Groups.js +27 -1
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +31 -0
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +32 -0
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.d.ts +9 -20
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.js +6 -22
- package/lib/esm/components/NavigationMenuIconButton/index.d.ts +2 -1
- package/lib/esm/components/NavigationMenuIconButton/index.js +2 -1
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +5 -0
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +3 -3
- package/lib/esm/components/Notification/Event/Event.js +4 -0
- package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.d.ts +10 -1
- package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +48 -13
- package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.js +9 -5
- package/lib/esm/components/OnBoardingWidget/Steps/Invite/Invite.js +59 -14
- package/lib/esm/components/PlatformWidget/constants.d.ts +0 -4
- package/lib/esm/components/PlatformWidget/constants.js +0 -4
- package/lib/esm/constants/GroupActionsMenu.d.ts +5 -0
- package/lib/esm/constants/GroupActionsMenu.js +5 -0
- package/lib/esm/index.d.ts +4 -2
- package/lib/esm/index.js +5 -3
- package/lib/esm/shared/EventInfoDetails/index.js +3 -3
- package/lib/esm/shared/InfiniteScroll/index.js +3 -3
- package/lib/esm/shared/Media/Link/DisplayComponent.js +5 -5
- package/lib/esm/utils/formatRelativeTime.js +2 -2
- package/lib/umd/148.js +2 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +9 -9
- package/lib/umd/99.js +0 -2
- /package/lib/umd/{99.js.LICENSE.txt → 148.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
8
|
+
const system_1 = require("@mui/system");
|
|
9
|
+
const ScrollContainer_1 = tslib_1.__importDefault(require("../../shared/ScrollContainer"));
|
|
10
|
+
const DefaultDrawerContent_1 = tslib_1.__importDefault(require("./DefaultDrawerContent"));
|
|
11
|
+
const DefaultHeaderContent_1 = tslib_1.__importDefault(require("./DefaultHeaderContent"));
|
|
12
|
+
const PREFIX = 'SCNavigationMenuDrawer';
|
|
13
|
+
const classes = {
|
|
14
|
+
root: `${PREFIX}-root`,
|
|
15
|
+
logo: `${PREFIX}-logo`,
|
|
16
|
+
drawerRoot: `${PREFIX}-drawer-root`,
|
|
17
|
+
drawerHeader: `${PREFIX}-drawer-header`,
|
|
18
|
+
drawerHeaderAction: `${PREFIX}-drawer-header-action`,
|
|
19
|
+
drawerContent: `${PREFIX}-drawer-content`
|
|
20
|
+
};
|
|
21
|
+
const Root = (0, styles_1.styled)(material_1.Drawer, {
|
|
22
|
+
name: PREFIX,
|
|
23
|
+
slot: 'Root',
|
|
24
|
+
overridesResolver: (props, styles) => styles.root
|
|
25
|
+
})(({ theme }) => ({}));
|
|
26
|
+
function NavigationMenuDrawer(inProps) {
|
|
27
|
+
// PROPS
|
|
28
|
+
const props = (0, system_1.useThemeProps)({
|
|
29
|
+
props: inProps,
|
|
30
|
+
name: PREFIX
|
|
31
|
+
});
|
|
32
|
+
const { className = null, showDrawerHeader = true, drawerHeaderContent = (0, jsx_runtime_1.jsx)(DefaultHeaderContent_1.default, {}), drawerContent = (0, jsx_runtime_1.jsx)(DefaultDrawerContent_1.default, {}), ScrollContainerProps = {}, open, onClose } = props, rest = tslib_1.__rest(props, ["className", "showDrawerHeader", "drawerHeaderContent", "drawerContent", "ScrollContainerProps", "open", "onClose"]);
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ anchor: "left", className: (0, classnames_1.default)(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Divider, {})] })), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, Object.assign({}, ScrollContainerProps, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) }))] })));
|
|
34
|
+
}
|
|
35
|
+
exports.default = NavigationMenuDrawer;
|
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { IconButtonProps } from '@mui/material';
|
|
2
|
+
import { NavigationMenuDrawerProps } from './NavigationMenuDrawer';
|
|
3
3
|
export interface NavigationMenuIconButtonProps extends IconButtonProps {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @default
|
|
5
|
+
* Prop to show/hide the default drawer component
|
|
6
|
+
* @default true
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
showDrawer?: boolean;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Callback triggered on menu click
|
|
11
11
|
* @default null
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
onMenuIconClick?: () => void;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @default null
|
|
17
|
-
*/
|
|
18
|
-
drawerContent?: React.ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* Props to spread to ScrollContainer component
|
|
21
|
-
* This lib use 'react-custom-scrollbars' component to perform scrollbars
|
|
22
|
-
* For more info: https://github.com/malte-wessel/react-custom-scrollbars/blob/master/docs/API.md
|
|
15
|
+
* Props to spread to default drawer root
|
|
23
16
|
* @default {}
|
|
24
17
|
*/
|
|
25
|
-
|
|
18
|
+
DrawerProps?: NavigationMenuDrawerProps;
|
|
26
19
|
}
|
|
27
20
|
/**
|
|
28
21
|
* > API documentation for the Community-JS Navigation Menu Icon Button component. Learn about the available props and the CSS API.
|
|
@@ -43,10 +36,6 @@ export interface NavigationMenuIconButtonProps extends IconButtonProps {
|
|
|
43
36
|
|Rule Name|Global class|Description|
|
|
44
37
|
|---|---|---|
|
|
45
38
|
|root|.SCNavigationMenuIconButton-root|Styles applied to the root element.|
|
|
46
|
-
|drawerRoot|.SCNavigationMenuIconButton-drawer-root|Styles applied to the drawer root element.|
|
|
47
|
-
|drawerHeader|.SCNavigationMenuIconButton-drawer-header|Styles applied to the drawer header.|
|
|
48
|
-
|drawerHeaderAction|.SCNavigationMenuIconButton-drawer-header-action|Styles applied to the drawer header action element.|
|
|
49
|
-
|drawerContent|.SCNavigationMenuIconButton-drawer-content|Styles applied to the drawer content.|
|
|
50
39
|
|
|
51
40
|
* @param inProps
|
|
52
41
|
*/
|
|
@@ -7,29 +7,17 @@ const styles_1 = require("@mui/material/styles");
|
|
|
7
7
|
const material_1 = require("@mui/material");
|
|
8
8
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
9
9
|
const system_1 = require("@mui/system");
|
|
10
|
-
const ScrollContainer_1 = tslib_1.__importDefault(require("../../shared/ScrollContainer"));
|
|
11
|
-
const DefaultDrawerContent_1 = tslib_1.__importDefault(require("./DefaultDrawerContent"));
|
|
12
|
-
const DefaultHeaderContent_1 = tslib_1.__importDefault(require("./DefaultHeaderContent"));
|
|
13
10
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
11
|
+
const NavigationMenuDrawer_1 = tslib_1.__importDefault(require("./NavigationMenuDrawer"));
|
|
14
12
|
const PREFIX = 'SCNavigationMenuIconButton';
|
|
15
13
|
const classes = {
|
|
16
|
-
root: `${PREFIX}-root
|
|
17
|
-
logo: `${PREFIX}-logo`,
|
|
18
|
-
drawerRoot: `${PREFIX}-drawer-root`,
|
|
19
|
-
drawerHeader: `${PREFIX}-drawer-header`,
|
|
20
|
-
drawerHeaderAction: `${PREFIX}-drawer-header-action`,
|
|
21
|
-
drawerContent: `${PREFIX}-drawer-content`
|
|
14
|
+
root: `${PREFIX}-root`
|
|
22
15
|
};
|
|
23
16
|
const Root = (0, styles_1.styled)(material_1.IconButton, {
|
|
24
17
|
name: PREFIX,
|
|
25
18
|
slot: 'Root',
|
|
26
19
|
overridesResolver: (props, styles) => styles.root
|
|
27
20
|
})(({ theme }) => ({}));
|
|
28
|
-
const DrawerRoot = (0, styles_1.styled)(material_1.Drawer, {
|
|
29
|
-
name: PREFIX,
|
|
30
|
-
slot: 'Root',
|
|
31
|
-
overridesResolver: (props, styles) => styles.drawerRoot
|
|
32
|
-
})(({ theme }) => ({}));
|
|
33
21
|
/**
|
|
34
22
|
* > API documentation for the Community-JS Navigation Menu Icon Button component. Learn about the available props and the CSS API.
|
|
35
23
|
|
|
@@ -49,10 +37,6 @@ const DrawerRoot = (0, styles_1.styled)(material_1.Drawer, {
|
|
|
49
37
|
|Rule Name|Global class|Description|
|
|
50
38
|
|---|---|---|
|
|
51
39
|
|root|.SCNavigationMenuIconButton-root|Styles applied to the root element.|
|
|
52
|
-
|drawerRoot|.SCNavigationMenuIconButton-drawer-root|Styles applied to the drawer root element.|
|
|
53
|
-
|drawerHeader|.SCNavigationMenuIconButton-drawer-header|Styles applied to the drawer header.|
|
|
54
|
-
|drawerHeaderAction|.SCNavigationMenuIconButton-drawer-header-action|Styles applied to the drawer header action element.|
|
|
55
|
-
|drawerContent|.SCNavigationMenuIconButton-drawer-content|Styles applied to the drawer content.|
|
|
56
40
|
|
|
57
41
|
* @param inProps
|
|
58
42
|
*/
|
|
@@ -63,7 +47,7 @@ function NavigationMenuIconButton(inProps) {
|
|
|
63
47
|
props: inProps,
|
|
64
48
|
name: PREFIX
|
|
65
49
|
});
|
|
66
|
-
const { className = null, DrawerProps = {
|
|
50
|
+
const { className = null, DrawerProps = {}, onMenuIconClick = null, showDrawer = true } = props, rest = tslib_1.__rest(props, ["className", "DrawerProps", "onMenuIconClick", "showDrawer"]);
|
|
67
51
|
// STATE
|
|
68
52
|
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
69
53
|
// CONTEXT
|
|
@@ -79,6 +63,6 @@ function NavigationMenuIconButton(inProps) {
|
|
|
79
63
|
if (!preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value && !((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
80
64
|
return null;
|
|
81
65
|
}
|
|
82
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick:
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick: onMenuIconClick !== null && onMenuIconClick !== void 0 ? onMenuIconClick : handleOpen }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "menu" }) })), showDrawer && (0, jsx_runtime_1.jsx)(NavigationMenuDrawer_1.default, Object.assign({ open: Boolean(anchorEl), onClose: handleClose }, DrawerProps))] }));
|
|
83
67
|
}
|
|
84
68
|
exports.default = NavigationMenuIconButton;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import NavigationMenuIconButton, { NavigationMenuIconButtonProps } from './NavigationMenuIconButton';
|
|
2
2
|
import DefaultHeaderContent from './DefaultHeaderContent';
|
|
3
3
|
import DefaultDrawerContent from './DefaultDrawerContent';
|
|
4
|
+
import NavigationMenuDrawer, { NavigationMenuDrawerProps } from './NavigationMenuDrawer';
|
|
4
5
|
export default NavigationMenuIconButton;
|
|
5
|
-
export { NavigationMenuIconButtonProps, DefaultDrawerContent as NavigationMenuContent, DefaultHeaderContent as NavigationMenuHeader };
|
|
6
|
+
export { NavigationMenuIconButtonProps, DefaultDrawerContent as NavigationMenuContent, DefaultHeaderContent as NavigationMenuHeader, NavigationMenuDrawer, NavigationMenuDrawerProps };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NavigationMenuHeader = exports.NavigationMenuContent = void 0;
|
|
3
|
+
exports.NavigationMenuDrawer = exports.NavigationMenuHeader = exports.NavigationMenuContent = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const NavigationMenuIconButton_1 = tslib_1.__importDefault(require("./NavigationMenuIconButton"));
|
|
6
6
|
const DefaultHeaderContent_1 = tslib_1.__importDefault(require("./DefaultHeaderContent"));
|
|
7
7
|
exports.NavigationMenuHeader = DefaultHeaderContent_1.default;
|
|
8
8
|
const DefaultDrawerContent_1 = tslib_1.__importDefault(require("./DefaultDrawerContent"));
|
|
9
9
|
exports.NavigationMenuContent = DefaultDrawerContent_1.default;
|
|
10
|
+
const NavigationMenuDrawer_1 = tslib_1.__importDefault(require("./NavigationMenuDrawer"));
|
|
11
|
+
exports.NavigationMenuDrawer = NavigationMenuDrawer_1.default;
|
|
10
12
|
exports.default = NavigationMenuIconButton_1.default;
|
|
@@ -34,6 +34,11 @@ export interface NavigationToolbarProps extends ToolbarProps {
|
|
|
34
34
|
* Component for Navigation Menu Icon Button
|
|
35
35
|
*/
|
|
36
36
|
NavigationMenuIconButtonComponent?: (inProps: NavigationMenuIconButtonProps) => JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* Props to spread to the NavigationMenuIconButtonComponent
|
|
39
|
+
* @default {}
|
|
40
|
+
*/
|
|
41
|
+
NavigationMenuIconButtonComponentProps?: NavigationMenuIconButtonProps;
|
|
37
42
|
/**
|
|
38
43
|
* Component for Navigation Settings
|
|
39
44
|
*/
|
|
@@ -98,7 +98,7 @@ function NavigationToolbar(inProps) {
|
|
|
98
98
|
props: inProps,
|
|
99
99
|
name: constants_1.PREFIX
|
|
100
100
|
});
|
|
101
|
-
const { value = '', className = '', disableSearch = false, disableComposer = false, SearchAutocompleteProps = {}, startActions = null, endActions = null, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton_1.default, NavigationMenuIconButtonComponent = NavigationMenuIconButton_1.default, children = null, NotificationMenuProps = {}, ComposerIconButtonProps = {}, onOpenNotificationMenu, onCloseNotificationMenu } = props, rest = tslib_1.__rest(props, ["value", "className", "disableSearch", "disableComposer", "SearchAutocompleteProps", "startActions", "endActions", "NavigationSettingsIconButtonComponent", "NavigationMenuIconButtonComponent", "children", "NotificationMenuProps", "ComposerIconButtonProps", "onOpenNotificationMenu", "onCloseNotificationMenu"]);
|
|
101
|
+
const { value = '', className = '', disableSearch = false, disableComposer = false, SearchAutocompleteProps = {}, startActions = null, endActions = null, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton_1.default, NavigationMenuIconButtonComponentProps = {}, NavigationMenuIconButtonComponent = NavigationMenuIconButton_1.default, children = null, NotificationMenuProps = {}, ComposerIconButtonProps = {}, onOpenNotificationMenu, onCloseNotificationMenu } = props, rest = tslib_1.__rest(props, ["value", "className", "disableSearch", "disableComposer", "SearchAutocompleteProps", "startActions", "endActions", "NavigationSettingsIconButtonComponent", "NavigationMenuIconButtonComponentProps", "NavigationMenuIconButtonComponent", "children", "NotificationMenuProps", "ComposerIconButtonProps", "onOpenNotificationMenu", "onCloseNotificationMenu"]);
|
|
102
102
|
// CONTEXT
|
|
103
103
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
104
104
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
@@ -119,7 +119,7 @@ function NavigationToolbar(inProps) {
|
|
|
119
119
|
const eventsEnabled = (0, react_1.useMemo)(() => scPreferences.preferences &&
|
|
120
120
|
scPreferences.features &&
|
|
121
121
|
scPreferences.features.includes(types_1.SCFeatureName.TAGGING) &&
|
|
122
|
-
react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
|
|
122
|
+
react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in scPreferences.preferences &&
|
|
123
123
|
scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [scPreferences.preferences, scPreferences.features]);
|
|
124
124
|
const showComposer = (0, react_1.useMemo)(() => {
|
|
125
125
|
return (!disableComposer &&
|
|
@@ -147,7 +147,7 @@ function NavigationToolbar(inProps) {
|
|
|
147
147
|
}), "aria-label": "Groups", to: scRoutingContext.url(react_core_1.SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {}), component: react_core_1.Link }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "groups" }) }))), eventsEnabled && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.events, {
|
|
148
148
|
[classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.EVENTS_ROUTE_NAME, {}))
|
|
149
149
|
}), "aria-label": "Groups", to: scRoutingContext.url(react_core_1.SCRoutes.EVENTS_ROUTE_NAME, {}), component: react_core_1.Link }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "CalendarIcon" }) })))] })));
|
|
150
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root) }, rest, { children: [(0, jsx_runtime_1.jsx)(NavigationMenuIconButtonComponent, {}), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.LOGO_NAVBAR_LOGO], alt: "logo" }) })), !scUserContext.user && !preferences[react_core_1.SCPreferences.ADDONS_CLOSED_COMMUNITY] && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "inherit", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.SIGNUP_ROUTE_NAME, {}), className: classes.register }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.register", defaultMessage: "ui.appBar.navigation.register" }) }))), preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED] && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "blank", to: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) })) }))) : ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "blank", to: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) }))) })), _children, (preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && !disableSearch ? ((0, jsx_runtime_1.jsx)(SearchAutocomplete_1.default, Object.assign({ className: classes.search, blurOnSelect: true }, SearchAutocompleteProps))) : ((0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.search })), startActions, scUserContext.user ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showComposer && (0, jsx_runtime_1.jsx)(ComposerIconButton_1.default, Object.assign({ className: classes.composer }, ComposerIconButtonProps)), (0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: scUserContext.user.username }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user), "aria-label": "Profile", className: classes.profile }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scUserContext.user.username, src: scUserContext.user.avatar }) })) })), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.notification, {
|
|
150
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root) }, rest, { children: [(0, jsx_runtime_1.jsx)(NavigationMenuIconButtonComponent, Object.assign({}, NavigationMenuIconButtonComponentProps)), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.LOGO_NAVBAR_LOGO], alt: "logo" }) })), !scUserContext.user && !preferences[react_core_1.SCPreferences.ADDONS_CLOSED_COMMUNITY] && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "inherit", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.SIGNUP_ROUTE_NAME, {}), className: classes.register }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.register", defaultMessage: "ui.appBar.navigation.register" }) }))), preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED] && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "blank", to: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) })) }))) : ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "blank", to: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) }))) })), _children, (preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && !disableSearch ? ((0, jsx_runtime_1.jsx)(SearchAutocomplete_1.default, Object.assign({ className: classes.search, blurOnSelect: true }, SearchAutocompleteProps))) : ((0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.search })), startActions, scUserContext.user ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showComposer && (0, jsx_runtime_1.jsx)(ComposerIconButton_1.default, Object.assign({ className: classes.composer }, ComposerIconButtonProps)), (0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: scUserContext.user.username }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user), "aria-label": "Profile", className: classes.profile }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scUserContext.user.username, src: scUserContext.user.avatar }) })) })), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.notification, {
|
|
151
151
|
[classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}))
|
|
152
152
|
}), "aria-label": "Notification", onClick: handleOpenNotificationMenu }, { children: (0, jsx_runtime_1.jsx)(material_1.Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "notifications_active" }) })) })), (0, jsx_runtime_1.jsx)(NotificationMenu_1.default, Object.assign({ className: classes.notificationsMenu, id: "notification-menu", anchorEl: anchorNotification, open: Boolean(anchorNotification), onClose: handleCloseNotificationMenu, onClick: handleCloseNotificationMenu, transformOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'bottom' } }, NotificationMenuProps))] }), privateMessagingEnabled && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.messages, {
|
|
153
153
|
[classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}))
|
|
@@ -53,6 +53,8 @@ function EventNotification(props) {
|
|
|
53
53
|
}), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !notificationObject.user.community_badge, smaller: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: notificationObject.user.username, variant: "circular", src: notificationObject.user.avatar, classes: { root: classes.avatar } }) })) })), primary: (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!notificationObject.user.deleted && {
|
|
54
54
|
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
|
|
55
55
|
}), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: notificationObject.user.username })), ' ', (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.notification.event.${notificationObject.type}`, defaultMessage: `ui.notification.event.${notificationObject.type}`, values: {
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
57
|
+
// @ts-ignore
|
|
56
58
|
icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, { children: chunks }),
|
|
57
59
|
event: notificationObject.event.name,
|
|
58
60
|
link: (...chunks) => (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: chunks }))
|
|
@@ -71,6 +73,8 @@ function EventNotification(props) {
|
|
|
71
73
|
}), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !notificationObject.user.community_badge, smaller: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { className: classes.avatar, alt: notificationObject.user.username, variant: "circular", src: notificationObject.user.avatar }) })) })), primary: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!notificationObject.user.deleted && {
|
|
72
74
|
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
|
|
73
75
|
}), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: notificationObject.user.username })), ' ', (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.notification.${notificationObject.type}`, defaultMessage: `ui.notification.${notificationObject.type}`, values: {
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
77
|
+
// @ts-ignore
|
|
74
78
|
icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, { children: chunks }),
|
|
75
79
|
event: notificationObject.event.name,
|
|
76
80
|
link: (...chunks) => (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: chunks }))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StartStepParams } from '@selfcommunity/api-services';
|
|
2
|
-
import { SCFeedObjectType } from '@selfcommunity/types';
|
|
2
|
+
import { SCFeedObjectType, SCOnBoardingStepType } from '@selfcommunity/types';
|
|
3
3
|
import { VirtualScrollerItemProps } from '../../types/virtualScroller';
|
|
4
4
|
export interface OnBoardingWidgetProps extends VirtualScrollerItemProps {
|
|
5
5
|
/**
|
|
@@ -18,6 +18,15 @@ export interface OnBoardingWidgetProps extends VirtualScrollerItemProps {
|
|
|
18
18
|
* @default null
|
|
19
19
|
*/
|
|
20
20
|
onGeneratedContent?: (feedObjs: SCFeedObjectType[]) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Force widget expanded
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
forceExpanded?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The initial step to display
|
|
28
|
+
*/
|
|
29
|
+
initialStep?: SCOnBoardingStepType;
|
|
21
30
|
}
|
|
22
31
|
declare const OnBoardingWidget: (inProps: OnBoardingWidgetProps) => JSX.Element;
|
|
23
32
|
export default OnBoardingWidget;
|
|
@@ -24,7 +24,6 @@ const utils_1 = require("@selfcommunity/utils");
|
|
|
24
24
|
const types_1 = require("@selfcommunity/types");
|
|
25
25
|
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
26
26
|
const notistack_1 = require("notistack");
|
|
27
|
-
const constants_2 = require("../PlatformWidget/constants");
|
|
28
27
|
const header_1 = tslib_1.__importDefault(require("../../assets/onBoarding/header"));
|
|
29
28
|
const BaseDialog_1 = tslib_1.__importDefault(require("../../shared/BaseDialog"));
|
|
30
29
|
const classes = {
|
|
@@ -53,19 +52,19 @@ const OnBoardingWidget = (inProps) => {
|
|
|
53
52
|
props: inProps,
|
|
54
53
|
name: constants_1.PREFIX
|
|
55
54
|
});
|
|
56
|
-
const { className, GenerateContentsParams = {}, onGeneratedContent = null, onHeightChange } = props, rest = tslib_1.__rest(props, ["className", "GenerateContentsParams", "onGeneratedContent", "onHeightChange"]);
|
|
55
|
+
const { className, GenerateContentsParams = {}, onGeneratedContent = null, onHeightChange, onStateChange, forceExpanded = false, initialStep } = props, rest = tslib_1.__rest(props, ["className", "GenerateContentsParams", "onGeneratedContent", "onHeightChange", "onStateChange", "forceExpanded", "initialStep"]);
|
|
57
56
|
// STATE
|
|
58
57
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
59
58
|
const [initialized, setInitialized] = (0, react_1.useState)(false);
|
|
60
59
|
const [steps, setSteps] = (0, react_1.useState)([]);
|
|
61
60
|
const nextStep = (0, react_1.useMemo)(() => {
|
|
62
|
-
const step = steps === null || steps === void 0 ? void 0 : steps.find((step) => step.status === 'in_progress' || step.status === 'not_started');
|
|
61
|
+
const step = steps === null || steps === void 0 ? void 0 : steps.find((step) => (initialStep ? step.step === initialStep : step.status === 'in_progress' || step.status === 'not_started'));
|
|
63
62
|
return step || (steps === null || steps === void 0 ? void 0 : steps[0]);
|
|
64
63
|
}, [steps]);
|
|
65
64
|
const allStepsDone = (0, react_1.useMemo)(() => {
|
|
66
65
|
return steps === null || steps === void 0 ? void 0 : steps.every((step) => step.status === types_1.SCOnBoardingStepStatusType.COMPLETED);
|
|
67
66
|
}, [steps]);
|
|
68
|
-
const [expanded, setExpanded] = (0, react_1.useState)(!allStepsDone);
|
|
67
|
+
const [expanded, setExpanded] = (0, react_1.useState)(!allStepsDone || forceExpanded);
|
|
69
68
|
const [_step, setStep] = (0, react_1.useState)(nextStep);
|
|
70
69
|
const currentContentsStep = steps === null || steps === void 0 ? void 0 : steps.find((s) => s.step === types_1.SCOnBoardingStepType.CONTENTS);
|
|
71
70
|
const prevContentsStep = (0, react_core_1.usePreviousValue)(currentContentsStep);
|
|
@@ -79,13 +78,21 @@ const OnBoardingWidget = (inProps) => {
|
|
|
79
78
|
const scPreferencesContext = (0, react_core_1.useSCPreferences)();
|
|
80
79
|
const scThemeContext = (0, react_core_1.useSCTheme)();
|
|
81
80
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
82
|
-
const isStage = scContext.settings.portal.includes('stage');
|
|
83
81
|
const [isGenerating, setIsGenerating] = (0, react_1.useState)(false);
|
|
84
82
|
// HOOKS
|
|
85
83
|
const theme = (0, material_1.useTheme)();
|
|
86
84
|
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
87
85
|
const { categories, isLoading } = (0, react_core_1.useSCFetchCategories)();
|
|
88
86
|
// HANDLERS
|
|
87
|
+
/**
|
|
88
|
+
* Notify changes to Feed if the Widget is contained
|
|
89
|
+
*/
|
|
90
|
+
const notifyLayoutChanges = (0, react_1.useMemo)(() => (state) => {
|
|
91
|
+
if (onStateChange && state) {
|
|
92
|
+
onStateChange(state);
|
|
93
|
+
}
|
|
94
|
+
onHeightChange && onHeightChange();
|
|
95
|
+
}, [onStateChange, onHeightChange]);
|
|
89
96
|
const completeStep = (s) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
90
97
|
if (s.status !== types_1.SCOnBoardingStepStatusType.COMPLETED) {
|
|
91
98
|
yield api_services_1.OnBoardingService.completeAStep(s.id)
|
|
@@ -103,10 +110,30 @@ const OnBoardingWidget = (inProps) => {
|
|
|
103
110
|
}
|
|
104
111
|
s.step === types_1.SCOnBoardingStepType.APPEARANCE && handlePreferencesUpdate();
|
|
105
112
|
});
|
|
113
|
+
/**
|
|
114
|
+
* Fetches platform url
|
|
115
|
+
*/
|
|
116
|
+
function fetchPlatform(query) {
|
|
117
|
+
api_services_1.http
|
|
118
|
+
.request({
|
|
119
|
+
url: api_services_1.Endpoints.Platform.url(),
|
|
120
|
+
method: api_services_1.Endpoints.Platform.method,
|
|
121
|
+
params: {
|
|
122
|
+
next: query
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
.then((res) => {
|
|
126
|
+
const platformUrl = res.data.platform_url;
|
|
127
|
+
window.open(platformUrl, '_blank').focus();
|
|
128
|
+
})
|
|
129
|
+
.catch((error) => {
|
|
130
|
+
console.log(error);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
106
133
|
const showSuccessAlert = (step) => {
|
|
107
134
|
setIsGenerating(false);
|
|
108
135
|
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.onBoardingWidget.step.${step.step}.success`, defaultMessage: `ui.onBoardingWidget.step.${step.step}.success` }), {
|
|
109
|
-
action: (snackbarId) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [step.step === types_1.SCOnBoardingStepType.CATEGORIES && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ sx: { textTransform: 'uppercase', color: 'white' }, size: "small", variant: "text",
|
|
136
|
+
action: (snackbarId) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [step.step === types_1.SCOnBoardingStepType.CATEGORIES && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ sx: { textTransform: 'uppercase', color: 'white' }, size: "small", variant: "text", onClick: () => fetchPlatform('/contents/interests/') }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.categories.success.link", defaultMessage: "ui.onBoardingWidget.step.categories.success.link" }) }))), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ sx: { color: 'white' }, onClick: () => (0, notistack_1.closeSnackbar)(snackbarId) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })),
|
|
110
137
|
variant: 'success',
|
|
111
138
|
autoHideDuration: 7000
|
|
112
139
|
});
|
|
@@ -131,8 +158,9 @@ const OnBoardingWidget = (inProps) => {
|
|
|
131
158
|
setStep(newStep);
|
|
132
159
|
};
|
|
133
160
|
const handleExpand = () => {
|
|
134
|
-
|
|
135
|
-
|
|
161
|
+
const _expanded = !expanded;
|
|
162
|
+
setExpanded(_expanded);
|
|
163
|
+
notifyLayoutChanges({ forceExpanded: _expanded });
|
|
136
164
|
};
|
|
137
165
|
const generateContent = (stepId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
138
166
|
if (!isLoading && !categories.length) {
|
|
@@ -159,6 +187,10 @@ const OnBoardingWidget = (inProps) => {
|
|
|
159
187
|
scThemeContext.setTheme((0, react_core_1.getTheme)(scContext.settings.theme, prefs));
|
|
160
188
|
});
|
|
161
189
|
};
|
|
190
|
+
const handleCategoriesClick = () => {
|
|
191
|
+
fetchPlatform('/contents/interests/');
|
|
192
|
+
setShowCategoriesModal(false);
|
|
193
|
+
};
|
|
162
194
|
// EFFECTS
|
|
163
195
|
(0, react_1.useEffect)(() => {
|
|
164
196
|
if (prevContentsStep &&
|
|
@@ -178,11 +210,13 @@ const OnBoardingWidget = (inProps) => {
|
|
|
178
210
|
if (!initialized && nextStep) {
|
|
179
211
|
setStep(nextStep);
|
|
180
212
|
setInitialized(true);
|
|
213
|
+
notifyLayoutChanges({ forceExpanded: expanded });
|
|
181
214
|
}
|
|
182
215
|
}, [initialized, nextStep]);
|
|
183
216
|
(0, react_1.useEffect)(() => {
|
|
184
|
-
|
|
185
|
-
|
|
217
|
+
const _expanded = !allStepsDone;
|
|
218
|
+
setExpanded(_expanded);
|
|
219
|
+
notifyLayoutChanges({ forceExpanded: _expanded });
|
|
186
220
|
}, [allStepsDone]);
|
|
187
221
|
(0, react_1.useEffect)(() => {
|
|
188
222
|
if (isAdmin) {
|
|
@@ -242,7 +276,8 @@ const OnBoardingWidget = (inProps) => {
|
|
|
242
276
|
b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks }),
|
|
243
277
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
244
278
|
// @ts-ignore
|
|
245
|
-
|
|
246
|
-
|
|
279
|
+
// eslint-disable-next-line prettier/prettier
|
|
280
|
+
icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks }))
|
|
281
|
+
} }) }))) }) })), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: (0, jsx_runtime_1.jsx)(Widget_1.default, Object.assign({ className: classes.content, elevation: 0 }, { children: loading ? ((0, jsx_runtime_1.jsx)(Skeleton_1.default, {})) : ((0, jsx_runtime_1.jsxs)(material_1.CardContent, { children: [(0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ className: isMobile ? classes.stepsMobile : classes.steps }, { children: steps === null || steps === void 0 ? void 0 : steps.map((step) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: isMobile ? ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", label: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }), ' ', step.status === types_1.SCOnBoardingStepStatusType.COMPLETED && ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: (step === null || step === void 0 ? void 0 : step.status) === types_1.SCOnBoardingStepStatusType.COMPLETED && (step === null || step === void 0 ? void 0 : step.step) !== (_step === null || _step === void 0 ? void 0 : _step.step) ? 'success' : 'inherit' }, { children: "check" })))] }), onClick: () => handleChange(step), variant: step.step === (_step === null || _step === void 0 ? void 0 : _step.step) ? 'filled' : 'outlined', color: step.status === types_1.SCOnBoardingStepStatusType.COMPLETED ? 'success' : 'default' })) : ((0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ onClick: () => handleChange(step), selected: (step === null || step === void 0 ? void 0 : step.step) === (_step === null || _step === void 0 ? void 0 : _step.step) }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { edge: "start", checked: step.status === types_1.SCOnBoardingStepStatusType.COMPLETED, tabIndex: -1, disableRipple: true, inputProps: { 'aria-labelledby': step.step }, size: 'small' }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }) })] }))) }, step.id))) })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.stepContent }, { children: [(0, jsx_runtime_1.jsx)(material_1.Fade, Object.assign({ in: true, timeout: 2400 }, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { children: getStepContent() }) })), showCategoriesModal && ((0, jsx_runtime_1.jsx)(BaseDialog_1.default, Object.assign({ title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.no.categories", defaultMessage: "ui.onBoardingWidget.ai.no.categories" }), DialogContentProps: { dividers: false }, open: showCategoriesModal, onClose: () => setShowCategoriesModal(false), actions: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "secondary", onClick: () => setShowCategoriesModal(false) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.no.categories.cancel", defaultMessage: "ui.onBoardingWidget.ai.no.categories.cancel" }) })) }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "primary", onClick: handleCategoriesClick, startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: "edit" })) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.no.categories.link", defaultMessage: "ui.onBoardingWidget.ai.no.categories.link" }) })) })))] }))] })) })) })] })) })));
|
|
247
282
|
};
|
|
248
283
|
exports.default = OnBoardingWidget;
|
|
@@ -35,7 +35,9 @@ const classes = {
|
|
|
35
35
|
root: `${constants_1.PREFIX}-appearance-root`,
|
|
36
36
|
title: `${constants_1.PREFIX}-appearance-title`,
|
|
37
37
|
summary: `${constants_1.PREFIX}-appearance-summary`,
|
|
38
|
+
colorContainer: `${constants_1.PREFIX}-appearance-color-container`,
|
|
38
39
|
color: `${constants_1.PREFIX}-appearance-color`,
|
|
40
|
+
colorProgress: `${constants_1.PREFIX}-appearance-color-progress`,
|
|
39
41
|
logoContainer: `${constants_1.PREFIX}-appearance-logo-container`,
|
|
40
42
|
logo: `${constants_1.PREFIX}-appearance-logo`,
|
|
41
43
|
uploadButton: `${constants_1.PREFIX}-appearance-upload-button`,
|
|
@@ -68,6 +70,7 @@ function Appearance(inProps) {
|
|
|
68
70
|
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
69
71
|
const [tab, setTab] = (0, react_1.useState)(0);
|
|
70
72
|
const [updating, setUpdating] = (0, react_1.useState)(false);
|
|
73
|
+
const [updatingColor, setUpdatingColor] = (0, react_1.useState)('');
|
|
71
74
|
// INTL
|
|
72
75
|
const intl = (0, react_intl_1.useIntl)();
|
|
73
76
|
// HANDLERS
|
|
@@ -140,6 +143,7 @@ function Appearance(inProps) {
|
|
|
140
143
|
}
|
|
141
144
|
finally {
|
|
142
145
|
setUpdating(false);
|
|
146
|
+
setUpdatingColor('');
|
|
143
147
|
onCompleteAction();
|
|
144
148
|
}
|
|
145
149
|
});
|
|
@@ -195,15 +199,15 @@ function Appearance(inProps) {
|
|
|
195
199
|
}, []);
|
|
196
200
|
// HANDLERS
|
|
197
201
|
const handleColorChange = (color, name) => {
|
|
202
|
+
setUpdatingColor(name);
|
|
198
203
|
const currentColor = state.colors.find((col) => col.name === name);
|
|
199
204
|
if (currentColor && currentColor.value !== color) {
|
|
205
|
+
setUpdating(true);
|
|
200
206
|
dispatch({
|
|
201
207
|
type: reducer_1.actionTypes.SET_COLORS,
|
|
202
208
|
payload: { colors: state.colors.map((col) => (col.name === name ? Object.assign(Object.assign({}, col), { value: color }) : col)) }
|
|
203
209
|
});
|
|
204
|
-
|
|
205
|
-
updatePreference({ [`${name}`]: color });
|
|
206
|
-
}, 2000);
|
|
210
|
+
updatePreference({ [`${name}`]: color });
|
|
207
211
|
}
|
|
208
212
|
};
|
|
209
213
|
const handleChange = (event) => {
|
|
@@ -213,7 +217,7 @@ function Appearance(inProps) {
|
|
|
213
217
|
payload: { slogans: state.slogans.map((s) => (s.name === name ? Object.assign(Object.assign({}, s), { value: value }) : s)) }
|
|
214
218
|
});
|
|
215
219
|
};
|
|
216
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.title, alignSelf: "self-start" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.appearance", defaultMessage: "ui.onBoardingWidget.appearance" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.summary", defaultMessage: "ui.onBoardingWidget.step.appearance.summary" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", size: "small", color: "primary", onClick: handleOpen }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.button", defaultMessage: "ui.onBoardingWidget.step.appearance.button" }) })), (0, jsx_runtime_1.jsxs)(DrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "right", open: Boolean(anchorEl), onClose: handleClose }, { children: [(0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.drawerHeader }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.header.title", defaultMessage: "ui.onBoardingWidget.step.appearance.header.title" }) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: handleClose }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "close" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ value: tab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", "aria-label": "scrollable-tabs" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.colors.title", defaultMessage: "ui.onBoardingWidget.step.appearance.colors.title" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.logo.title", defaultMessage: "ui.onBoardingWidget.step.appearance.logo.title" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.title", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.title" }) })] })), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, { children: (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.drawerContent }, { children: [tab === 0 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: state.colors.map((color) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, onBoarding_1.formatColorLabel)(color) })), (0, jsx_runtime_1.jsx)(mui_color_input_1.MuiColorInput, { className: classes.color, format: "hex", value: color.value, onChange: (newColor) => handleColorChange(newColor, color.name) })] }, color.id))) })), tab === 1 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: state.logos.map((logo) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, onBoarding_1.formatLogoLabel)(logo.name) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.logoContainer }, { children: [(0, jsx_runtime_1.jsx)("img", { src: logo.value, className: classes.logo }), (0, jsx_runtime_1.jsx)("input", { type: "file", onChange: (event) => handleUpload(event, logo.name), ref: fileInput, hidden: true, accept: ".gif,.png,.jpg,.jpeg" }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ className: classes.uploadButton, onClick: () => fileInput.current.click(), loading: loadingLogo, disabled: loadingLogo }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "upload" }) }))] }))] }, logo.id))) })), tab === 2 && ((0, jsx_runtime_1.jsxs)(Box_1.default, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, fullWidth: true,
|
|
220
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.title, alignSelf: "self-start" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.appearance", defaultMessage: "ui.onBoardingWidget.appearance" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.summary", defaultMessage: "ui.onBoardingWidget.step.appearance.summary" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", size: "small", color: "primary", onClick: handleOpen }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.button", defaultMessage: "ui.onBoardingWidget.step.appearance.button" }) })), (0, jsx_runtime_1.jsxs)(DrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "right", open: Boolean(anchorEl), onClose: handleClose }, { children: [(0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.drawerHeader }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.header.title", defaultMessage: "ui.onBoardingWidget.step.appearance.header.title" }) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: handleClose }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "close" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ value: tab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", "aria-label": "scrollable-tabs" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.colors.title", defaultMessage: "ui.onBoardingWidget.step.appearance.colors.title" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.logo.title", defaultMessage: "ui.onBoardingWidget.step.appearance.logo.title" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.title", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.title" }) })] })), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, { children: (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.drawerContent }, { children: [tab === 0 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: state.colors.map((color) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, onBoarding_1.formatColorLabel)(color) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.colorContainer }, { children: [(0, jsx_runtime_1.jsx)(mui_color_input_1.MuiColorInput, { className: classes.color, format: "hex", value: color.value, onChange: (newColor) => handleColorChange(newColor, color.name), isAlphaHidden: true }), updatingColor && updatingColor === color.name && ((0, jsx_runtime_1.jsx)(material_1.CircularProgress, { className: classes.colorProgress, color: "secondary", size: 24 }))] }))] }, color.id))) })), tab === 1 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: state.logos.map((logo) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, onBoarding_1.formatLogoLabel)(logo.name) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.logoContainer }, { children: [(0, jsx_runtime_1.jsx)("img", { src: logo.value, className: classes.logo }), (0, jsx_runtime_1.jsx)("input", { type: "file", onChange: (event) => handleUpload(event, logo.name), ref: fileInput, hidden: true, accept: ".gif,.png,.jpg,.jpeg" }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ className: classes.uploadButton, onClick: () => fileInput.current.click(), loading: loadingLogo, disabled: loadingLogo }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "upload" }) }))] }))] }, logo.id))) })), tab === 2 && ((0, jsx_runtime_1.jsxs)(Box_1.default, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, fullWidth: true,
|
|
217
221
|
//className={classes.field}
|
|
218
222
|
label: `${intl.formatMessage(messages.titleField)}`, margin: "normal", value: (_a = state === null || state === void 0 ? void 0 : state.slogans[0]) === null || _a === void 0 ? void 0 : _a.value, name: "application_slogan1", onChange: handleChange, InputProps: {
|
|
219
223
|
endAdornment: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_b = state.slogans[0].value) === null || _b === void 0 ? void 0 : _b.length) ? 50 - ((_c = state.slogans[0].value) === null || _c === void 0 ? void 0 : _c.length) : 50 }))
|
|
@@ -12,7 +12,10 @@ const material_1 = require("@mui/material");
|
|
|
12
12
|
const react_intl_1 = require("react-intl");
|
|
13
13
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
14
14
|
const SocialShare_1 = require("../../../../constants/SocialShare");
|
|
15
|
-
const
|
|
15
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
16
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
17
|
+
const Errors_1 = require("../../../../constants/Errors");
|
|
18
|
+
const types_1 = require("@selfcommunity/types");
|
|
16
19
|
const classes = {
|
|
17
20
|
root: `${constants_1.PREFIX}-invite-root`,
|
|
18
21
|
title: `${constants_1.PREFIX}-invite-title`,
|
|
@@ -26,6 +29,7 @@ const Root = (0, styles_1.styled)(Box_1.default, {
|
|
|
26
29
|
name: constants_1.PREFIX,
|
|
27
30
|
slot: 'InviteRoot'
|
|
28
31
|
})(() => ({}));
|
|
32
|
+
const META_ROBOTS_ENABLE_DEFAULT = 'index,follow';
|
|
29
33
|
function Invite(inProps) {
|
|
30
34
|
// PROPS
|
|
31
35
|
const props = (0, system_1.useThemeProps)({
|
|
@@ -33,22 +37,62 @@ function Invite(inProps) {
|
|
|
33
37
|
name: constants_1.PREFIX
|
|
34
38
|
});
|
|
35
39
|
const { className, onCompleteAction = null } = props;
|
|
40
|
+
// STATUS
|
|
41
|
+
const [isMetaRobotsUpdating, setMetaRobotsUpdating] = (0, react_1.useState)(false);
|
|
36
42
|
// CONTEXT
|
|
37
|
-
const scContext = (0, react_core_1.useSCContext)();
|
|
38
43
|
const scPreferencesContext = (0, react_1.useContext)(react_core_1.SCPreferencesContext);
|
|
39
|
-
const
|
|
40
|
-
scPreferencesContext.preferences
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const metaRobots = (0, react_1.useMemo)(() => {
|
|
45
|
+
return scPreferencesContext.preferences && react_core_1.SCPreferences.WEBMASTER_META_ROBOTS in scPreferencesContext.preferences
|
|
46
|
+
? scPreferencesContext.preferences[react_core_1.SCPreferences.WEBMASTER_META_ROBOTS].value
|
|
47
|
+
: null;
|
|
48
|
+
}, [scPreferencesContext.preferences]);
|
|
49
|
+
const url = (0, react_1.useMemo)(() => scPreferencesContext.preferences &&
|
|
50
|
+
react_core_1.SCPreferences.CONFIGURATIONS_GROUPS_ENABLED in scPreferencesContext.preferences &&
|
|
51
|
+
scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_APP_URL].value, [scPreferencesContext.preferences]);
|
|
47
52
|
// HANDLERS
|
|
48
|
-
const handleShare = (shareUrl, shareType) => {
|
|
53
|
+
const handleShare = (shareUrl, shareType) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
if (metaRobots.toLowerCase().replace(/\s+/g, '') !== META_ROBOTS_ENABLE_DEFAULT) {
|
|
55
|
+
yield enableSeo();
|
|
56
|
+
}
|
|
49
57
|
window.open(shareUrl, `${shareType}-share-dialog`, 'width=626,height=436');
|
|
50
58
|
onCompleteAction();
|
|
59
|
+
});
|
|
60
|
+
const enableSeo = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
try {
|
|
62
|
+
setMetaRobotsUpdating(true);
|
|
63
|
+
yield api_services_1.PreferenceService.updatePreferences({ [types_1.SCPreferenceName.META_ROBOTS]: 'index, follow' });
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, e);
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
setMetaRobotsUpdating(false);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* Fetches platform url
|
|
74
|
+
*/
|
|
75
|
+
function fetchPlatform(query) {
|
|
76
|
+
api_services_1.http
|
|
77
|
+
.request({
|
|
78
|
+
url: api_services_1.Endpoints.Platform.url(),
|
|
79
|
+
method: api_services_1.Endpoints.Platform.method,
|
|
80
|
+
params: {
|
|
81
|
+
next: query
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
.then((res) => {
|
|
85
|
+
const platformUrl = res.data.platform_url;
|
|
86
|
+
window.open(platformUrl, '_blank').focus();
|
|
87
|
+
})
|
|
88
|
+
.catch((error) => {
|
|
89
|
+
console.log(error);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const handleCompleteAction = () => {
|
|
93
|
+
onCompleteAction();
|
|
94
|
+
fetchPlatform('/marketing/invitation');
|
|
51
95
|
};
|
|
52
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.title }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.invite", defaultMessage: "ui.onBoardingWidget.invite" }) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.social }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.title, variant: "h4" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.invite.social.title", defaultMessage: "ui.onBoardingWidget.step.invite.social.title" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.invite.social.subtitle", defaultMessage: "ui.onBoardingWidget.step.invite.social.subtitle" }) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.iconContainer }, { children: [
|
|
96
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.title }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.invite", defaultMessage: "ui.onBoardingWidget.invite" }) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.social }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.title, variant: "h4" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.invite.social.title", defaultMessage: "ui.onBoardingWidget.step.invite.social.title" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.invite.social.subtitle", defaultMessage: "ui.onBoardingWidget.step.invite.social.subtitle" }) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.iconContainer }, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: () => handleShare(SocialShare_1.FACEBOOK_SHARE + url, 'facebook'), disabled: !url || isMetaRobotsUpdating }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ classes: { root: classes.icon } }, { children: "facebook" })) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: () => handleShare(SocialShare_1.X_SHARE + url, 'x'), disabled: !url || isMetaRobotsUpdating }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ classes: { root: classes.icon } }, { children: "twitter" })) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: () => handleShare(SocialShare_1.LINKEDIN_SHARE + url, 'linkedin'), disabled: !url || isMetaRobotsUpdating }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ classes: { root: classes.icon } }, { children: "linkedin" })) }))] }))] })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.email }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.title, variant: "h4" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.invite.email.title", defaultMessage: "ui.onBoardingWidget.step.invite.email.title" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.invite.email.subtitle", defaultMessage: "ui.onBoardingWidget.step.invite.email.subtitle" }) }))] })), (0, jsx_runtime_1.jsx)(Box_1.default, Object.assign({ component: "span", className: classes.action }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", size: "small", onClick: handleCompleteAction }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.onBoardingWidget.step.invite.button", id: "ui.onBoardingWidget.step.invite.button" }) })) }))] })));
|
|
53
97
|
}
|
|
54
98
|
exports.default = Invite;
|