@selfcommunity/react-ui 0.7.50-events.71 → 0.7.50-events.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/lib/cjs/assets/onBoarding/Android.d.ts +1 -0
  2. package/lib/cjs/assets/onBoarding/Android.js +7 -0
  3. package/lib/cjs/assets/onBoarding/CategoryA.d.ts +1 -0
  4. package/lib/cjs/assets/onBoarding/CategoryA.js +7 -0
  5. package/lib/cjs/assets/onBoarding/CategoryB.d.ts +1 -0
  6. package/lib/cjs/assets/onBoarding/CategoryB.js +7 -0
  7. package/lib/cjs/assets/onBoarding/Header.d.ts +1 -0
  8. package/lib/cjs/assets/onBoarding/Header.js +7 -0
  9. package/lib/cjs/assets/onBoarding/Ios.d.ts +1 -0
  10. package/lib/cjs/assets/onBoarding/Ios.js +7 -0
  11. package/lib/cjs/components/Feed/Feed.d.ts +1 -0
  12. package/lib/cjs/components/Feed/Feed.js +3 -0
  13. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.d.ts +19 -0
  14. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +209 -0
  15. package/lib/cjs/components/OnBoardingWidget/Skeleton.d.ts +1 -0
  16. package/lib/cjs/components/OnBoardingWidget/Skeleton.js +24 -0
  17. package/lib/cjs/components/OnBoardingWidget/Steps/App/App.d.ts +18 -0
  18. package/lib/cjs/components/OnBoardingWidget/Steps/App/App.js +74 -0
  19. package/lib/cjs/components/OnBoardingWidget/Steps/App/index.d.ts +3 -0
  20. package/lib/cjs/components/OnBoardingWidget/Steps/App/index.js +5 -0
  21. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.d.ts +13 -0
  22. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.js +226 -0
  23. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/index.d.ts +3 -0
  24. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/index.js +5 -0
  25. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/reducer.d.ts +15 -0
  26. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/reducer.js +42 -0
  27. package/lib/cjs/components/OnBoardingWidget/Steps/Category/Category.d.ts +18 -0
  28. package/lib/cjs/components/OnBoardingWidget/Steps/Category/Category.js +81 -0
  29. package/lib/cjs/components/OnBoardingWidget/Steps/Category/index.d.ts +3 -0
  30. package/lib/cjs/components/OnBoardingWidget/Steps/Category/index.js +5 -0
  31. package/lib/cjs/components/OnBoardingWidget/Steps/Content/Content.d.ts +18 -0
  32. package/lib/cjs/components/OnBoardingWidget/Steps/Content/Content.js +51 -0
  33. package/lib/cjs/components/OnBoardingWidget/Steps/Content/index.d.ts +3 -0
  34. package/lib/cjs/components/OnBoardingWidget/Steps/Content/index.js +5 -0
  35. package/lib/cjs/components/OnBoardingWidget/Steps/Invite/Invite.d.ts +13 -0
  36. package/lib/cjs/components/OnBoardingWidget/Steps/Invite/Invite.js +54 -0
  37. package/lib/cjs/components/OnBoardingWidget/Steps/Invite/index.d.ts +3 -0
  38. package/lib/cjs/components/OnBoardingWidget/Steps/Invite/index.js +5 -0
  39. package/lib/cjs/components/OnBoardingWidget/Steps/Profile/Profile.d.ts +25 -0
  40. package/lib/cjs/components/OnBoardingWidget/Steps/Profile/Profile.js +94 -0
  41. package/lib/cjs/components/OnBoardingWidget/Steps/Profile/index.d.ts +3 -0
  42. package/lib/cjs/components/OnBoardingWidget/Steps/Profile/index.js +5 -0
  43. package/lib/cjs/components/OnBoardingWidget/constants.d.ts +1 -0
  44. package/lib/cjs/components/OnBoardingWidget/constants.js +4 -0
  45. package/lib/cjs/components/OnBoardingWidget/index.d.ts +4 -0
  46. package/lib/cjs/components/OnBoardingWidget/index.js +8 -0
  47. package/lib/cjs/components/PlatformWidget/constants.d.ts +4 -0
  48. package/lib/cjs/components/PlatformWidget/constants.js +5 -1
  49. package/lib/cjs/index.d.ts +3 -1
  50. package/lib/cjs/index.js +8 -3
  51. package/lib/cjs/shared/ProgressBar/index.d.ts +23 -0
  52. package/lib/cjs/shared/ProgressBar/index.js +25 -0
  53. package/lib/cjs/utils/onBoarding.d.ts +2 -0
  54. package/lib/cjs/utils/onBoarding.js +20 -0
  55. package/lib/esm/assets/onBoarding/Android.d.ts +1 -0
  56. package/lib/esm/assets/onBoarding/Android.js +4 -0
  57. package/lib/esm/assets/onBoarding/CategoryA.d.ts +1 -0
  58. package/lib/esm/assets/onBoarding/CategoryA.js +4 -0
  59. package/lib/esm/assets/onBoarding/CategoryB.d.ts +1 -0
  60. package/lib/esm/assets/onBoarding/CategoryB.js +4 -0
  61. package/lib/esm/assets/onBoarding/Header.d.ts +1 -0
  62. package/lib/esm/assets/onBoarding/Header.js +4 -0
  63. package/lib/esm/assets/onBoarding/Ios.d.ts +1 -0
  64. package/lib/esm/assets/onBoarding/Ios.js +4 -0
  65. package/lib/esm/components/Feed/Feed.d.ts +1 -0
  66. package/lib/esm/components/Feed/Feed.js +3 -0
  67. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.d.ts +19 -0
  68. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +207 -0
  69. package/lib/esm/components/OnBoardingWidget/Skeleton.d.ts +1 -0
  70. package/lib/esm/components/OnBoardingWidget/Skeleton.js +20 -0
  71. package/lib/esm/components/OnBoardingWidget/Steps/App/App.d.ts +18 -0
  72. package/lib/esm/components/OnBoardingWidget/Steps/App/App.js +70 -0
  73. package/lib/esm/components/OnBoardingWidget/Steps/App/index.d.ts +3 -0
  74. package/lib/esm/components/OnBoardingWidget/Steps/App/index.js +2 -0
  75. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.d.ts +13 -0
  76. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.js +223 -0
  77. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/index.d.ts +3 -0
  78. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/index.js +2 -0
  79. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/reducer.d.ts +15 -0
  80. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/reducer.js +37 -0
  81. package/lib/esm/components/OnBoardingWidget/Steps/Category/Category.d.ts +18 -0
  82. package/lib/esm/components/OnBoardingWidget/Steps/Category/Category.js +77 -0
  83. package/lib/esm/components/OnBoardingWidget/Steps/Category/index.d.ts +3 -0
  84. package/lib/esm/components/OnBoardingWidget/Steps/Category/index.js +2 -0
  85. package/lib/esm/components/OnBoardingWidget/Steps/Content/Content.d.ts +18 -0
  86. package/lib/esm/components/OnBoardingWidget/Steps/Content/Content.js +47 -0
  87. package/lib/esm/components/OnBoardingWidget/Steps/Content/index.d.ts +3 -0
  88. package/lib/esm/components/OnBoardingWidget/Steps/Content/index.js +2 -0
  89. package/lib/esm/components/OnBoardingWidget/Steps/Invite/Invite.d.ts +13 -0
  90. package/lib/esm/components/OnBoardingWidget/Steps/Invite/Invite.js +50 -0
  91. package/lib/esm/components/OnBoardingWidget/Steps/Invite/index.d.ts +3 -0
  92. package/lib/esm/components/OnBoardingWidget/Steps/Invite/index.js +2 -0
  93. package/lib/esm/components/OnBoardingWidget/Steps/Profile/Profile.d.ts +25 -0
  94. package/lib/esm/components/OnBoardingWidget/Steps/Profile/Profile.js +91 -0
  95. package/lib/esm/components/OnBoardingWidget/Steps/Profile/index.d.ts +3 -0
  96. package/lib/esm/components/OnBoardingWidget/Steps/Profile/index.js +2 -0
  97. package/lib/esm/components/OnBoardingWidget/constants.d.ts +1 -0
  98. package/lib/esm/components/OnBoardingWidget/constants.js +1 -0
  99. package/lib/esm/components/OnBoardingWidget/index.d.ts +4 -0
  100. package/lib/esm/components/OnBoardingWidget/index.js +4 -0
  101. package/lib/esm/components/PlatformWidget/constants.d.ts +4 -0
  102. package/lib/esm/components/PlatformWidget/constants.js +4 -0
  103. package/lib/esm/index.d.ts +3 -1
  104. package/lib/esm/index.js +5 -3
  105. package/lib/esm/shared/ProgressBar/index.d.ts +23 -0
  106. package/lib/esm/shared/ProgressBar/index.js +22 -0
  107. package/lib/esm/utils/onBoarding.d.ts +2 -0
  108. package/lib/esm/utils/onBoarding.js +15 -0
  109. package/lib/umd/920.js +2 -0
  110. package/lib/umd/react-ui.js +1 -1
  111. package/package.json +181 -180
  112. package/lib/umd/224.js +0 -2
  113. /package/lib/umd/{224.js.LICENSE.txt → 920.js.LICENSE.txt} +0 -0
@@ -16,6 +16,7 @@ export declare type FeedSidebarProps = StickyBoxProps;
16
16
  export declare type FeedRef = {
17
17
  addFeedData: (obj: any, syncPagination?: boolean) => void;
18
18
  refresh: () => void;
19
+ getCurrentFeedObjectIds: () => number[];
19
20
  };
20
21
  export interface FeedProps {
21
22
  /**
@@ -389,6 +389,9 @@ const Feed = (inProps, ref) => {
389
389
  },
390
390
  refresh: () => {
391
391
  refresh();
392
+ },
393
+ getCurrentFeedObjectIds: () => {
394
+ return feedDataObject.results.map((o) => o[o.type].id);
392
395
  }
393
396
  }));
394
397
  const InnerItem = useMemo(() => ({ state: savedState, onHeightChange, onStateChange, children: item }) => {
@@ -0,0 +1,19 @@
1
+ import { CategoryProps } from './Steps/Category';
2
+ import { AppearanceProps } from './Steps/Appearance';
3
+ import { ProfileProps } from './Steps/Profile';
4
+ import { InviteProps } from './Steps/Invite';
5
+ import { AppProps } from './Steps/App';
6
+ import { ContentProps } from './Steps/Content';
7
+ import { StartStepParams } from '@selfcommunity/api-services';
8
+ export interface OnBoardingWidgetProps {
9
+ className?: string;
10
+ CategoryProps?: CategoryProps;
11
+ ContentProps?: ContentProps;
12
+ AppearanceProps?: AppearanceProps;
13
+ ProfileProps?: ProfileProps;
14
+ InviteProps?: InviteProps;
15
+ AppProps: AppProps;
16
+ generateContentsParams?: StartStepParams;
17
+ }
18
+ declare const OnBoardingWidget: (inProps: OnBoardingWidgetProps) => JSX.Element;
19
+ export default OnBoardingWidget;
@@ -0,0 +1,207 @@
1
+ import { __awaiter, __rest } from "tslib";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useMemo, useState } from 'react';
4
+ import { Accordion, AccordionDetails, AccordionSummary, Box, Button, CardContent, CardMedia, Checkbox, Chip, Fade, Icon, IconButton, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Typography, useMediaQuery, useTheme } from '@mui/material';
5
+ import { FormattedMessage } from 'react-intl';
6
+ import { styled } from '@mui/material/styles';
7
+ import classNames from 'classnames';
8
+ import { useThemeProps } from '@mui/system';
9
+ import Category from './Steps/Category';
10
+ import { PREFIX } from './constants';
11
+ import { usePreviousValue, useSCContext, useSCUser } from '@selfcommunity/react-core';
12
+ import Appearance from './Steps/Appearance';
13
+ import Profile from './Steps/Profile';
14
+ import Invite from './Steps/Invite';
15
+ import App from './Steps/App';
16
+ import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
17
+ import Widget from '../Widget';
18
+ import Content from './Steps/Content';
19
+ import Header from '../../assets/onBoarding/Header';
20
+ import { SCOPE_SC_UI } from '../../constants/Errors';
21
+ import { OnBoardingService } from '@selfcommunity/api-services';
22
+ import { Logger } from '@selfcommunity/utils';
23
+ import { SCOnBoardingStepStatusType, SCOnBoardingStepType } from '@selfcommunity/types';
24
+ import OnBoardingWidgetSkeleton from './Skeleton';
25
+ import { closeSnackbar, useSnackbar } from 'notistack';
26
+ import { CONSOLE_PROD, CONSOLE_STAGE } from '../PlatformWidget/constants';
27
+ const classes = {
28
+ root: `${PREFIX}-root`,
29
+ accordionRoot: `${PREFIX}-accordion-root`,
30
+ logo: `${PREFIX}-logo`,
31
+ intro: `${PREFIX}-intro`,
32
+ steps: `${PREFIX}-steps`,
33
+ stepsMobile: `${PREFIX}-steps-mobile`,
34
+ stepContent: `${PREFIX}-step-content`
35
+ };
36
+ const Root = styled(Widget, {
37
+ name: PREFIX,
38
+ slot: 'Root',
39
+ overridesResolver: (props, styles) => styles.root
40
+ })(() => ({}));
41
+ const AccordionRoot = styled(Accordion, {
42
+ name: PREFIX,
43
+ slot: 'AccordionRoot',
44
+ overridesResolver: (props, styles) => styles.accordionRoot
45
+ })(() => ({}));
46
+ const OnBoardingWidget = (inProps) => {
47
+ // PROPS
48
+ const props = useThemeProps({
49
+ props: inProps,
50
+ name: PREFIX
51
+ });
52
+ const { className, AppearanceProps = {}, ProfileProps = {}, CategoryProps = {}, InviteProps = {}, AppProps = {}, ContentProps = {}, generateContentsParams = {} } = props, rest = __rest(props, ["className", "AppearanceProps", "ProfileProps", "CategoryProps", "InviteProps", "AppProps", "ContentProps", "generateContentsParams"]);
53
+ // STATE
54
+ const [isLoading, setIsLoading] = useState(true);
55
+ const [steps, setSteps] = useState([]);
56
+ const currentStep = useMemo(() => {
57
+ const step = steps === null || steps === void 0 ? void 0 : steps.find((step) => step.status === 'in_progress' || step.status === 'not_started');
58
+ return step || (steps === null || steps === void 0 ? void 0 : steps[0]);
59
+ }, [steps]);
60
+ const allStepsDone = useMemo(() => {
61
+ return steps === null || steps === void 0 ? void 0 : steps.every((step) => step.status === SCOnBoardingStepStatusType.COMPLETED);
62
+ }, [steps]);
63
+ const [expanded, setExpanded] = useState(!allStepsDone);
64
+ const [_step, setStep] = useState(currentStep);
65
+ const prevStep = usePreviousValue(_step);
66
+ // CONTEXT
67
+ const scUserContext = useSCUser();
68
+ const scContext = useSCContext();
69
+ const { enqueueSnackbar } = useSnackbar();
70
+ const isStage = scContext.settings.portal.includes('stage');
71
+ const [isGenerating, setIsGenerating] = useState(false);
72
+ // HOOKS
73
+ const theme = useTheme();
74
+ const isMobile = useMediaQuery(theme.breakpoints.down('md'));
75
+ // HANDLERS
76
+ const completeStep = (s) => __awaiter(void 0, void 0, void 0, function* () {
77
+ if (s.status !== SCOnBoardingStepStatusType.COMPLETED) {
78
+ yield OnBoardingService.completeAStep(s.id)
79
+ .then(() => {
80
+ setSteps((prev) => prev.map((item) => {
81
+ if (item.id === s.id) {
82
+ return Object.assign(Object.assign({}, item), { status: SCOnBoardingStepStatusType.COMPLETED, completion_percentage: 100 });
83
+ }
84
+ return item;
85
+ }));
86
+ })
87
+ .catch((error) => {
88
+ Logger.error(SCOPE_SC_UI, error);
89
+ });
90
+ }
91
+ });
92
+ const showSuccessAlert = (step) => {
93
+ setIsGenerating(false);
94
+ enqueueSnackbar(_jsx(FormattedMessage, { id: `ui.onBoardingWidget.step.${step.step}.success`, defaultMessage: `ui.onBoardingWidget.step.${step.step}.success` }), {
95
+ action: (snackbarId) => (_jsxs(_Fragment, { children: [step.step === SCOnBoardingStepType.CATEGORIES && (_jsx(Button, Object.assign({ sx: { textTransform: 'uppercase', color: 'white' }, size: "small", variant: "text", href: isStage ? CONSOLE_STAGE : CONSOLE_PROD, target: "_blank" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.categories.success.link", defaultMessage: "ui.onBoardingWidget.step.categories.success.link" }) }))), _jsx(IconButton, Object.assign({ sx: { color: 'white' }, onClick: () => closeSnackbar(snackbarId) }, { children: _jsx(Icon, { children: "close" }) }))] })),
96
+ variant: 'success',
97
+ autoHideDuration: 7000
98
+ });
99
+ };
100
+ const getSteps = () => __awaiter(void 0, void 0, void 0, function* () {
101
+ yield OnBoardingService.getAllSteps()
102
+ .then((res) => {
103
+ setIsGenerating(res.results.some((step) => step.status === 'in_progress'));
104
+ setSteps(res.results);
105
+ setIsLoading(false);
106
+ })
107
+ .catch((error) => {
108
+ Logger.error(SCOPE_SC_UI, error);
109
+ setIsLoading(false);
110
+ });
111
+ });
112
+ const handleChange = (newStep) => {
113
+ setStep(newStep);
114
+ };
115
+ const handleExpand = () => {
116
+ setExpanded(!expanded);
117
+ };
118
+ const generateContent = (stepId) => __awaiter(void 0, void 0, void 0, function* () {
119
+ yield OnBoardingService.startAStep(stepId, generateContentsParams)
120
+ .then(() => {
121
+ setIsGenerating(true);
122
+ })
123
+ .catch((error) => {
124
+ Logger.error(SCOPE_SC_UI, error);
125
+ enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
126
+ variant: 'error',
127
+ autoHideDuration: 3000
128
+ });
129
+ });
130
+ });
131
+ // EFFECTS
132
+ useEffect(() => {
133
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
134
+ // @ts-ignore
135
+ if ((prevStep === null || prevStep === void 0 ? void 0 : prevStep.status) === SCOnBoardingStepStatusType.IN_PROGRESS && (_step === null || _step === void 0 ? void 0 : _step.status) === SCOnBoardingStepStatusType.NOT_STARTED) {
136
+ showSuccessAlert(prevStep);
137
+ }
138
+ }, [_step, prevStep]);
139
+ useEffect(() => {
140
+ setStep(currentStep);
141
+ }, [currentStep, steps]);
142
+ useEffect(() => {
143
+ setExpanded(!allStepsDone);
144
+ }, [allStepsDone]);
145
+ useEffect(() => {
146
+ getSteps();
147
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
148
+ const intervalId = setInterval(getSteps, isGenerating ? 3000 : 3 * 60 * 1000);
149
+ return () => clearInterval(intervalId);
150
+ }, [scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user, isGenerating]);
151
+ /**
152
+ * Render _step content section
153
+ */
154
+ const getStepContent = () => {
155
+ const stepObj = _step;
156
+ let content;
157
+ switch (stepObj === null || stepObj === void 0 ? void 0 : stepObj.step) {
158
+ case SCOnBoardingStepType.CONTENTS:
159
+ content = _jsx(Content, Object.assign({ step: stepObj, handleContentCreation: () => generateContent(stepObj.id) }, ContentProps));
160
+ break;
161
+ case SCOnBoardingStepType.CATEGORIES:
162
+ content = _jsx(Category, Object.assign({ step: stepObj, handleCategoriesCreation: () => generateContent(stepObj.id) }, CategoryProps));
163
+ break;
164
+ case SCOnBoardingStepType.APPEARANCE:
165
+ content = _jsx(Appearance, Object.assign({ onCompleteAction: () => completeStep(stepObj) }, AppearanceProps));
166
+ break;
167
+ case SCOnBoardingStepType.PROFILE:
168
+ content = _jsx(Profile, Object.assign({ onCompleteAction: () => completeStep(stepObj) }, ProfileProps));
169
+ break;
170
+ case SCOnBoardingStepType.INVITE:
171
+ content = _jsx(Invite, Object.assign({ onCompleteAction: () => completeStep(stepObj) }, InviteProps));
172
+ break;
173
+ case SCOnBoardingStepType.APP:
174
+ content = _jsx(App, Object.assign({ step: stepObj, onCompleteAction: () => completeStep(stepObj) }, AppProps));
175
+ break;
176
+ default:
177
+ break;
178
+ }
179
+ return content;
180
+ };
181
+ if (!(scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user)) {
182
+ return _jsx(HiddenPlaceholder, {});
183
+ }
184
+ return (_jsxs(AccordionRoot, Object.assign({ defaultExpanded: true, onChange: handleExpand, className: classes.accordionRoot, expanded: expanded }, { children: [_jsx(AccordionSummary, Object.assign({ expandIcon: _jsx(Icon, Object.assign({ fontSize: "medium" }, { children: "expand_more" })), "aria-controls": "accordion", id: "onBoarding-accordion" }, { children: _jsx(_Fragment, { children: expanded ? (_jsxs(_Fragment, { children: [!isMobile ? (_jsx(CardMedia, Object.assign({ className: classes.logo, component: "div" }, { children: _jsx(Header, {}) }))) : (_jsx(Typography, Object.assign({ variant: "h4", textAlign: "center" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.title.mobile", defaultMessage: "ui.onBoardingWidget.accordion.expanded.title.mobile", values: {
185
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
186
+ // @ts-ignore
187
+ b: (chunks) => _jsx("strong", { children: chunks }),
188
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
189
+ // @ts-ignore
190
+ icon: (...chunks) => (_jsx(Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks })))
191
+ } }) }))), _jsxs(Box, Object.assign({ className: classes.intro }, { children: [!isMobile && (_jsx(Typography, Object.assign({ variant: "h4" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.title", defaultMessage: "ui.onBoardingWidget.accordion.expanded.title" }) }))), _jsx(Typography, Object.assign({ variant: !isMobile ? 'h5' : 'subtitle1' }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.subtitle", defaultMessage: "ui.onBoardingWidget.accordion.expanded.subtitle" }) })), _jsx(Typography, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.summary", defaultMessage: "ui.onBoardingWidget.accordion.expanded.summary", values: {
192
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
193
+ // @ts-ignore
194
+ b: (chunks) => _jsx("strong", { children: chunks }),
195
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
196
+ // @ts-ignore
197
+ icon: (...chunks) => _jsx(Icon, { children: chunks })
198
+ } }) })] }))] })) : (_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.collapsed", defaultMessage: "ui.onBoardingWidget.accordion.collapsed", values: {
199
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
200
+ // @ts-ignore
201
+ b: (chunks) => _jsx("strong", { children: chunks }),
202
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
203
+ // @ts-ignore
204
+ icon: (...chunks) => (_jsx(Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks })))
205
+ } }) }))) }) })), _jsx(AccordionDetails, { children: _jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { elevation: 0 }, { children: isLoading ? (_jsx(OnBoardingWidgetSkeleton, {})) : (_jsxs(CardContent, { children: [_jsx(List, Object.assign({ className: isMobile ? classes.stepsMobile : classes.steps }, { children: steps === null || steps === void 0 ? void 0 : steps.map((step) => (_jsx(ListItem, { children: isMobile ? (_jsx(Chip, { size: "small", disabled: isGenerating && ((_step === null || _step === void 0 ? void 0 : _step.step) === SCOnBoardingStepType.CATEGORIES || (_step === null || _step === void 0 ? void 0 : _step.step) === SCOnBoardingStepType.CONTENTS), label: _jsxs(_Fragment, { children: [_jsx(FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }), ' ', step.status === SCOnBoardingStepStatusType.COMPLETED && (_jsx(Icon, Object.assign({ color: step.status === SCOnBoardingStepStatusType.COMPLETED && step.step !== _step.step ? 'success' : 'inherit' }, { children: "check" })))] }), onClick: () => handleChange(step), variant: step.step === _step.step ? 'filled' : 'outlined', color: step.status === SCOnBoardingStepStatusType.COMPLETED ? 'success' : 'default' })) : (_jsxs(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), disabled: isGenerating && ((_step === null || _step === void 0 ? void 0 : _step.step) === SCOnBoardingStepType.CATEGORIES || (_step === null || _step === void 0 ? void 0 : _step.step) === SCOnBoardingStepType.CONTENTS) }, { children: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { edge: "start", checked: step.status === SCOnBoardingStepStatusType.COMPLETED, tabIndex: -1, disableRipple: true, inputProps: { 'aria-labelledby': step.step }, size: 'small' }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }) })] }))) }, step.id))) })), _jsx(Box, Object.assign({ className: classes.stepContent }, { children: _jsx(Fade, Object.assign({ in: true, timeout: 2400 }, { children: _jsx(Box, { children: getStepContent() }) })) }))] })) })) })] })));
206
+ };
207
+ export default OnBoardingWidget;
@@ -0,0 +1 @@
1
+ export default function OnBoardingWidgetSkeleton(): JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Chip, List, ListItem, ListItemButton, ListItemIcon, ListItemText, useMediaQuery, useTheme } from '@mui/material';
3
+ import { styled } from '@mui/material/styles';
4
+ import Skeleton from '@mui/material/Skeleton';
5
+ import { PREFIX } from './constants';
6
+ const classes = {
7
+ root: `${PREFIX}-skeleton-root`,
8
+ menu: `${PREFIX}-skeleton-menu`,
9
+ content: `${PREFIX}-skeleton-content`
10
+ };
11
+ const Root = styled(Box, {
12
+ name: PREFIX,
13
+ slot: 'SkeletonRoot'
14
+ })(() => ({}));
15
+ export default function OnBoardingWidgetSkeleton() {
16
+ const theme = useTheme();
17
+ const isMobile = useMediaQuery(theme.breakpoints.down('md'));
18
+ const steps = Array(isMobile ? 3 : 5).fill(null);
19
+ return (_jsxs(Root, Object.assign({ className: classes.root }, { children: [_jsx(Box, Object.assign({ className: classes.menu }, { children: isMobile ? (_jsx(Box, Object.assign({ sx: { display: 'flex', justifyContent: 'space-evenly' } }, { children: steps.map((_, index) => (_jsx(Chip, { label: _jsx(Skeleton, { variant: "text", width: 80 }), variant: "outlined" }, index))) }))) : (_jsx(List, { children: steps.map((_, index) => (_jsx(ListItem, { children: _jsxs(ListItemButton, { children: [_jsx(ListItemIcon, { children: _jsx(Skeleton, { variant: "rectangular", width: 20, height: 20 }) }), _jsx(ListItemText, { primary: _jsx(Skeleton, { variant: "text", width: 100 }) })] }) }, index))) })) })), _jsxs(Box, Object.assign({ className: classes.content }, { children: [_jsx(Skeleton, { variant: "text", width: '20%', height: 40 }), _jsx(Skeleton, { variant: "text", width: '80%', height: 20 }), _jsx(Skeleton, { variant: "text", width: '70%', height: 20 }), _jsx(Skeleton, { variant: "text", width: '60%', height: 20 }), _jsx(Skeleton, { variant: "rectangular", width: 100, height: 36, style: { borderRadius: '20px', alignSelf: 'center', marginTop: 24 } })] }))] })));
20
+ }
@@ -0,0 +1,18 @@
1
+ import { SCStepType } from '@selfcommunity/types';
2
+ export interface AppProps {
3
+ /**
4
+ * The content step
5
+ */
6
+ step: SCStepType;
7
+ /**
8
+ * Overrides or extends the styles applied to the component.
9
+ * @default null
10
+ */
11
+ className?: string;
12
+ /**
13
+ * Callback triggered on complete action click
14
+ * @default null
15
+ */
16
+ onCompleteAction: () => void;
17
+ }
18
+ export default function App(inProps: AppProps): JSX.Element;
@@ -0,0 +1,70 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { styled } from '@mui/material/styles';
4
+ import Box from '@mui/material/Box';
5
+ import { useThemeProps } from '@mui/system';
6
+ import classNames from 'classnames';
7
+ import { PREFIX } from '../../constants';
8
+ import { Button, CardMedia, Icon, Tab, Tabs, Typography } from '@mui/material';
9
+ import { FormattedMessage } from 'react-intl';
10
+ import Ios from '../../../../assets/onBoarding/Ios';
11
+ import Android from '../../../../assets/onBoarding/Android';
12
+ import { SCOnBoardingStepStatusType } from '@selfcommunity/types';
13
+ const classes = {
14
+ root: `${PREFIX}-app-root`,
15
+ title: `${PREFIX}-app-title`,
16
+ tabs: `${PREFIX}-app-tabs`,
17
+ tabContent: `${PREFIX}-app-tab-content`,
18
+ summary: `${PREFIX}-app-summary`,
19
+ image: `${PREFIX}-app-image`,
20
+ action: `${PREFIX}-app-action`,
21
+ button: `${PREFIX}-app-button`
22
+ };
23
+ const Root = styled(Box, {
24
+ name: PREFIX,
25
+ slot: 'AppRoot'
26
+ })(() => ({}));
27
+ export default function App(inProps) {
28
+ // PROPS
29
+ const props = useThemeProps({
30
+ props: inProps,
31
+ name: PREFIX
32
+ });
33
+ //PROPS
34
+ const { className, step, onCompleteAction } = props;
35
+ // STATE
36
+ const [tab, setTab] = useState(0);
37
+ // HANDLERS
38
+ const handleChange = (event, newValue) => {
39
+ setTab(newValue);
40
+ };
41
+ return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.title", defaultMessage: "ui.onBoardingWidget.step.app.title" }) })), _jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.summary", defaultMessage: "ui.onBoardingWidget.step.app.summary" }) })), _jsxs(Tabs, Object.assign({ className: classes.tabs, value: tab, onChange: handleChange, centered: true, variant: "fullWidth", indicatorColor: "primary" }, { children: [_jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.tab.ios", defaultMessage: "ui.onBoardingWidget.step.app.tab.ios" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.tab.android", defaultMessage: "ui.onBoardingWidget.step.app.tab.android" }) })] })), _jsxs(Box, Object.assign({ className: classes.tabContent }, { children: [tab === 0 && (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios", defaultMessage: "ui.onBoardingWidget.step.app.ios" }) })), _jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios.a", defaultMessage: "ui.onBoardingWidget.step.app.ios.a", values: {
42
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
43
+ // @ts-ignore
44
+ icon: (...chunks) => _jsx(Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
45
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
46
+ // @ts-ignore
47
+ b: (...chunks) => _jsx("strong", { children: chunks })
48
+ } }) })), _jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios.b", defaultMessage: "ui.onBoardingWidget.step.app.ios.b", values: {
49
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
50
+ // @ts-ignore
51
+ icon: (...chunks) => _jsx(Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
52
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
53
+ // @ts-ignore
54
+ b: (...chunks) => _jsx("strong", { children: chunks })
55
+ } }) })), _jsx(CardMedia, Object.assign({ className: classes.image, component: "div" }, { children: _jsx(Ios, {}) }))] })), tab === 1 && (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.android", defaultMessage: "ui.onBoardingWidget.step.app.android" }) })), _jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.android.a", defaultMessage: "ui.onBoardingWidget.step.app.android.a", values: {
56
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
57
+ // @ts-ignore
58
+ icon: (...chunks) => _jsx(Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
59
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
60
+ // @ts-ignore
61
+ b: (...chunks) => _jsx("strong", { children: chunks })
62
+ } }) })), _jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.android.b", defaultMessage: "ui.onBoardingWidget.step.app.android.b", values: {
63
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
64
+ // @ts-ignore
65
+ icon: (...chunks) => _jsx(Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
66
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
67
+ // @ts-ignore
68
+ b: (...chunks) => _jsx("strong", { children: chunks })
69
+ } }) })), _jsx(CardMedia, Object.assign({ className: classes.image, component: "div" }, { children: _jsx(Android, {}) }))] })), _jsx(Button, Object.assign({ className: classes.button, size: "small", variant: "outlined", color: "secondary", onClick: onCompleteAction, disabled: (step === null || step === void 0 ? void 0 : step.status) === SCOnBoardingStepStatusType.COMPLETED || (step === null || step === void 0 ? void 0 : step.status) === SCOnBoardingStepStatusType.IN_PROGRESS }, { children: "Ok!" }))] }))] })));
70
+ }
@@ -0,0 +1,3 @@
1
+ import App, { AppProps } from './App';
2
+ export default App;
3
+ export { AppProps };
@@ -0,0 +1,2 @@
1
+ import App from './App';
2
+ export default App;
@@ -0,0 +1,13 @@
1
+ export interface AppearanceProps {
2
+ /**
3
+ * Overrides or extends the styles applied to the component.
4
+ * @default null
5
+ */
6
+ className?: string;
7
+ /**
8
+ * Callback triggered on complete action click
9
+ * @default null
10
+ */
11
+ onCompleteAction: () => void;
12
+ }
13
+ export default function Appearance(inProps: AppearanceProps): JSX.Element;
@@ -0,0 +1,223 @@
1
+ import { __awaiter } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import React, { useCallback, useEffect, useReducer, useRef, useState } from 'react';
4
+ import { styled } from '@mui/material/styles';
5
+ import Box from '@mui/material/Box';
6
+ import { useThemeProps } from '@mui/system';
7
+ import classNames from 'classnames';
8
+ import { Preferences } from '@selfcommunity/react-core';
9
+ import { PREFIX } from '../../constants';
10
+ import { Button, Drawer, IconButton, Tab, Tabs, TextField, Typography } from '@mui/material';
11
+ import { MuiColorInput } from 'mui-color-input';
12
+ import { actionTypes } from './reducer';
13
+ import { getInitialState, reducer } from './reducer';
14
+ import { PreferenceService } from '@selfcommunity/api-services';
15
+ import { formatColorLabel, formatLogoLabel } from '../../../../utils/onBoarding';
16
+ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
17
+ import Icon from '@mui/material/Icon';
18
+ import { SCOPE_SC_UI } from '../../../../constants/Errors';
19
+ import { Logger } from '@selfcommunity/utils';
20
+ import { LoadingButton } from '@mui/lab';
21
+ import ScrollContainer from '../../../../shared/ScrollContainer';
22
+ const messages = defineMessages({
23
+ titleField: {
24
+ id: 'ui.onBoardingWidget.step.appearance.titleSlogan.field.title',
25
+ defaultMessage: 'ui.onBoardingWidget.step.appearance.titleSlogan.field.title'
26
+ },
27
+ sloganField: {
28
+ id: 'ui.onBoardingWidget.step.appearance.titleSlogan.field.slogan',
29
+ defaultMessage: 'ui.onBoardingWidget.step.appearance.titleSlogan.field.slogan'
30
+ }
31
+ });
32
+ const classes = {
33
+ root: `${PREFIX}-appearance-root`,
34
+ title: `${PREFIX}-appearance-title`,
35
+ summary: `${PREFIX}-appearance-summary`,
36
+ color: `${PREFIX}-appearance-color`,
37
+ logoContainer: `${PREFIX}-appearance-logo-container`,
38
+ logo: `${PREFIX}-appearance-logo`,
39
+ uploadButton: `${PREFIX}-appearance-upload-button`,
40
+ drawerRoot: `${PREFIX}-appearance-drawer-root`,
41
+ drawerHeader: `${PREFIX}-appearance-drawer-header`,
42
+ drawerHeaderAction: `${PREFIX}-appearance-drawer-header-action`,
43
+ drawerContent: `${PREFIX}-appearance-drawer-content`
44
+ };
45
+ const Root = styled(Box, {
46
+ name: PREFIX,
47
+ slot: 'AppearanceRoot'
48
+ })(() => ({}));
49
+ const DrawerRoot = styled(Drawer, {
50
+ name: PREFIX,
51
+ slot: 'AppearanceDrawerRoot',
52
+ overridesResolver: (props, styles) => styles.appearanceDrawerRoot
53
+ })(({ theme }) => ({}));
54
+ export default function Appearance(inProps) {
55
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
56
+ // PROPS
57
+ const props = useThemeProps({
58
+ props: inProps,
59
+ name: PREFIX
60
+ });
61
+ const { className, onCompleteAction } = props;
62
+ // STATE
63
+ const [state, dispatch] = useReducer(reducer, getInitialState(null));
64
+ let fileInput = useRef(null);
65
+ const [loadingLogo, setLoadingLogo] = useState(false);
66
+ const [anchorEl, setAnchorEl] = useState(null);
67
+ const [tab, setTab] = useState(0);
68
+ const [updating, setUpdating] = useState(false);
69
+ // INTL
70
+ const intl = useIntl();
71
+ // HANDLERS
72
+ const handleTabChange = (event, newValue) => {
73
+ setTab(newValue);
74
+ };
75
+ const handleOpen = useCallback((event) => {
76
+ setAnchorEl(event.currentTarget);
77
+ }, []);
78
+ const handleClose = useCallback(() => {
79
+ setAnchorEl(null);
80
+ }, []);
81
+ const fetchColors = () => {
82
+ dispatch({ type: actionTypes.LOADING, payload: { loading: true } });
83
+ PreferenceService.searchPreferences('', '', `${Preferences.COLORS_COLORBACK},${Preferences.COLORS_COLORPRIMARY},${Preferences.COLORS_COLORSECONDARY},${Preferences.COLORS_NAVBARBACK},${Preferences.COLORS_COLORFONT},${Preferences.COLORS_COLORFONTSECONDARY}`)
84
+ .then((res) => {
85
+ dispatch({
86
+ type: actionTypes.SET_COLORS,
87
+ payload: {
88
+ loading: false,
89
+ colors: res.results
90
+ }
91
+ });
92
+ })
93
+ .catch((e) => {
94
+ Logger.error(SCOPE_SC_UI, e);
95
+ dispatch({ type: actionTypes.SET_COLORS, payload: { loading: false, colors: [] } });
96
+ });
97
+ };
98
+ const fetchLogos = () => {
99
+ dispatch({ type: actionTypes.LOADING, payload: { loading: true } });
100
+ PreferenceService.searchPreferences('', '', `${Preferences.LOGO_NAVBAR_LOGO},${Preferences.LOGO_NAVBAR_LOGO_MOBILE}`)
101
+ .then((res) => {
102
+ dispatch({
103
+ type: actionTypes.SET_LOGOS,
104
+ payload: {
105
+ loading: false,
106
+ logos: res.results
107
+ }
108
+ });
109
+ })
110
+ .catch((e) => {
111
+ Logger.error(SCOPE_SC_UI, e);
112
+ dispatch({ type: actionTypes.SET_LOGOS, payload: { loading: false, logos: [] } });
113
+ });
114
+ };
115
+ const fetchSlogans = () => {
116
+ dispatch({ type: actionTypes.LOADING, payload: { loading: true } });
117
+ PreferenceService.searchPreferences('', '', `${Preferences.TEXT_APPLICATION_SLOGAN1},${Preferences.TEXT_APPLICATION_SLOGAN2}`)
118
+ .then((res) => {
119
+ dispatch({
120
+ type: actionTypes.SET_SLOGANS,
121
+ payload: {
122
+ loading: false,
123
+ slogans: res.results
124
+ }
125
+ });
126
+ })
127
+ .catch((e) => {
128
+ Logger.error(SCOPE_SC_UI, e);
129
+ dispatch({ type: actionTypes.SET_SLOGANS, payload: { loading: false, slogans: [] } });
130
+ });
131
+ };
132
+ const updatePreference = (preference) => __awaiter(this, void 0, void 0, function* () {
133
+ try {
134
+ yield PreferenceService.updatePreferences(preference);
135
+ }
136
+ catch (e) {
137
+ Logger.error(SCOPE_SC_UI, e);
138
+ }
139
+ finally {
140
+ setUpdating(false);
141
+ onCompleteAction();
142
+ }
143
+ });
144
+ const updateSlogans = () => __awaiter(this, void 0, void 0, function* () {
145
+ setUpdating(true);
146
+ try {
147
+ yield Promise.all(state.slogans.map(({ name, value }) => {
148
+ return updatePreference({ [name]: value });
149
+ }));
150
+ }
151
+ catch (e) {
152
+ Logger.error(SCOPE_SC_UI, e);
153
+ }
154
+ finally {
155
+ setUpdating(false);
156
+ }
157
+ });
158
+ const updateLogoPreference = (name) => __awaiter(this, void 0, void 0, function* () {
159
+ setLoadingLogo(true);
160
+ const formData = new FormData();
161
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
162
+ // @ts-ignore
163
+ formData.append(name, fileInput);
164
+ yield PreferenceService.updatePreferences(formData)
165
+ .then((preference) => {
166
+ setLoadingLogo(false);
167
+ dispatch({
168
+ type: actionTypes.SET_LOGOS,
169
+ payload: { logos: state.logos.map((l) => (l.name === name ? Object.assign(Object.assign({}, l), { value: preference[name].value }) : l)) }
170
+ });
171
+ onCompleteAction();
172
+ })
173
+ .catch((e) => {
174
+ setLoadingLogo(false);
175
+ Logger.error(SCOPE_SC_UI, e);
176
+ });
177
+ });
178
+ /**
179
+ * Handles logo upload
180
+ * @param event
181
+ * @param name
182
+ */
183
+ const handleUpload = (event, name) => {
184
+ fileInput = event.target.files[0];
185
+ if (fileInput) {
186
+ updateLogoPreference(name);
187
+ }
188
+ };
189
+ useEffect(() => {
190
+ fetchColors();
191
+ fetchLogos();
192
+ fetchSlogans();
193
+ }, []);
194
+ // HANDLERS
195
+ const handleColorChange = (color, name) => {
196
+ const currentColor = state.colors.find((col) => col.name === name);
197
+ if (currentColor && currentColor.value !== color) {
198
+ dispatch({
199
+ type: actionTypes.SET_COLORS,
200
+ payload: { colors: state.colors.map((col) => (col.name === name ? Object.assign(Object.assign({}, col), { value: color }) : col)) }
201
+ });
202
+ setTimeout(() => {
203
+ updatePreference({ [`${name}`]: color });
204
+ }, 2000);
205
+ }
206
+ };
207
+ const handleChange = (event) => {
208
+ const { name, value } = event.target;
209
+ dispatch({
210
+ type: actionTypes.SET_SLOGANS,
211
+ payload: { slogans: state.slogans.map((s) => (s.name === name ? Object.assign(Object.assign({}, s), { value: value }) : s)) }
212
+ });
213
+ };
214
+ return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title, alignSelf: "self-start" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.appearance", defaultMessage: "ui.onBoardingWidget.appearance" }) })), _jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.summary", defaultMessage: "ui.onBoardingWidget.step.appearance.summary" }) })), _jsx(Button, Object.assign({ variant: "outlined", size: "small", color: "primary", onClick: handleOpen }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.button", defaultMessage: "ui.onBoardingWidget.step.appearance.button" }) })), _jsxs(DrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "right", open: Boolean(anchorEl), onClose: handleClose }, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [_jsx(Typography, Object.assign({ variant: "h4", color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.header.title", defaultMessage: "ui.onBoardingWidget.step.appearance.header.title" }) })), _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: handleClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsxs(Tabs, Object.assign({ value: tab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", "aria-label": "scrollable-tabs" }, { children: [_jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.colors.title", defaultMessage: "ui.onBoardingWidget.step.appearance.colors.title" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.logo.title", defaultMessage: "ui.onBoardingWidget.step.appearance.logo.title" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.title", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.title" }) })] })), _jsx(ScrollContainer, { children: _jsxs(Box, Object.assign({ className: classes.drawerContent }, { children: [tab === 0 && (_jsx(_Fragment, { children: state.colors.map((color) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatColorLabel(color) })), _jsx(MuiColorInput, { className: classes.color, format: "hex", value: color.value, onChange: (newColor) => handleColorChange(newColor, color.name) })] }, color.id))) })), tab === 1 && (_jsx(_Fragment, { children: state.logos.map((logo) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatLogoLabel(logo.name) })), _jsxs(Box, Object.assign({ className: classes.logoContainer }, { children: [_jsx("img", { src: logo.value, className: classes.logo }), _jsx("input", { type: "file", onChange: (event) => handleUpload(event, logo.name), ref: fileInput, hidden: true, accept: ".gif,.png,.jpg,.jpeg" }), _jsx(LoadingButton, Object.assign({ className: classes.uploadButton, onClick: () => fileInput.current.click(), loading: loadingLogo, disabled: loadingLogo }, { children: _jsx(Icon, { children: "upload" }) }))] }))] }, logo.id))) })), tab === 2 && (_jsxs(Box, { children: [_jsx(TextField, { multiline: true, fullWidth: true,
215
+ //className={classes.field}
216
+ 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: {
217
+ endAdornment: _jsx(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 }))
218
+ }, error: Boolean(((_e = (_d = state === null || state === void 0 ? void 0 : state.slogans[0]) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.length) > 50) }), _jsx(TextField, { multiline: true, fullWidth: true,
219
+ //className={classes.field}
220
+ label: `${intl.formatMessage(messages.sloganField)}`, margin: "normal", value: (_f = state === null || state === void 0 ? void 0 : state.slogans[1]) === null || _f === void 0 ? void 0 : _f.value, name: "application_slogan2", onChange: handleChange, InputProps: {
221
+ endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_g = state.slogans[1].value) === null || _g === void 0 ? void 0 : _g.length) ? 150 - ((_h = state.slogans[1].value) === null || _h === void 0 ? void 0 : _h.length) : 150 })))
222
+ }, error: Boolean(((_k = (_j = state === null || state === void 0 ? void 0 : state.slogans[1]) === null || _j === void 0 ? void 0 : _j.value) === null || _k === void 0 ? void 0 : _k.length) > 150) }), _jsx(LoadingButton, Object.assign({ loading: updating, disabled: updating, variant: "outlined", size: "small", color: "primary", onClick: updateSlogans }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.button", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.button" }) }))] }))] })) })] }))] })));
223
+ }
@@ -0,0 +1,3 @@
1
+ import Appearance, { AppearanceProps } from './Appearance';
2
+ export { AppearanceProps };
3
+ export default Appearance;
@@ -0,0 +1,2 @@
1
+ import Appearance from './Appearance';
2
+ export default Appearance;