@flozy/editor 3.8.9 → 3.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. package/dist/Editor/ChatEditor.js +55 -45
  2. package/dist/Editor/CommonEditor.js +175 -168
  3. package/dist/Editor/DialogWrapper.js +3 -4
  4. package/dist/Editor/Editor.css +7 -4
  5. package/dist/Editor/Elements/AI/AIInput.js +17 -18
  6. package/dist/Editor/Elements/AI/CustomSelect.js +19 -12
  7. package/dist/Editor/Elements/AI/PopoverAIInput.js +58 -74
  8. package/dist/Editor/Elements/AI/Styles.js +2 -1
  9. package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +73 -0
  10. package/dist/Editor/Elements/AI/VoiceToText/index.js +177 -0
  11. package/dist/Editor/Elements/AI/VoiceToText/style.js +40 -0
  12. package/dist/Editor/Elements/AppHeader/AppHeader.js +49 -40
  13. package/dist/Editor/Elements/Button/EditorButton.js +38 -33
  14. package/dist/Editor/Elements/Color Picker/ColorButtons.js +60 -17
  15. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  16. package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
  17. package/dist/Editor/Elements/Color Picker/Styles.js +2 -1
  18. package/dist/Editor/Elements/Embed/Image.js +14 -15
  19. package/dist/Editor/Elements/Embed/Video.js +8 -12
  20. package/dist/Editor/Elements/Emoji/EmojiButton.js +7 -11
  21. package/dist/Editor/Elements/Emoji/EmojiPicker.js +4 -2
  22. package/dist/Editor/Elements/Form/Form.js +1 -1
  23. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -3
  24. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -1
  25. package/dist/Editor/Elements/Grid/Grid.js +34 -14
  26. package/dist/Editor/Elements/Grid/GridItem.js +23 -31
  27. package/dist/Editor/Elements/Link/Link.js +6 -1
  28. package/dist/Editor/Elements/Link/LinkButton.js +4 -2
  29. package/dist/Editor/Elements/Link/LinkPopup.js +10 -3
  30. package/dist/Editor/Elements/Link/LinkPopupStyles.js +28 -0
  31. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +8 -4
  32. package/dist/Editor/Elements/Redo/RedoButton.js +14 -0
  33. package/dist/Editor/Elements/Signature/SignaturePopup.js +14 -3
  34. package/dist/Editor/Elements/SimpleText/index.js +8 -9
  35. package/dist/Editor/Elements/SimpleText/style.js +0 -37
  36. package/dist/Editor/Elements/Table/Styles.js +23 -1
  37. package/dist/Editor/Elements/Table/Table.js +2 -1
  38. package/dist/Editor/Elements/Table/TableCell.js +69 -7
  39. package/dist/Editor/Elements/TableContextMenu/TableContextMenu.js +1 -0
  40. package/dist/Editor/Elements/Undo/UndoButton.js +14 -0
  41. package/dist/Editor/MiniEditor.js +3 -1
  42. package/dist/Editor/Styles/EditorStyles.js +1 -24
  43. package/dist/Editor/Toolbar/Basic/index.js +4 -2
  44. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +26 -2
  45. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  46. package/dist/Editor/Toolbar/FormatTools/TextSize.js +29 -18
  47. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +29 -3
  48. package/dist/Editor/Toolbar/Mini/Options/Options.js +10 -0
  49. package/dist/Editor/Toolbar/Mini/Styles.js +7 -0
  50. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +4 -11
  51. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +213 -86
  52. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
  53. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +22 -16
  54. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +52 -8
  55. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
  56. package/dist/Editor/Toolbar/PopupTool/index.js +7 -25
  57. package/dist/Editor/Toolbar/Toolbar.js +0 -7
  58. package/dist/Editor/Toolbar/toolbarGroups.js +48 -11
  59. package/dist/Editor/assets/svg/AIIcons.js +153 -1
  60. package/dist/Editor/assets/svg/AddTemplateIcon.js +13 -10
  61. package/dist/Editor/assets/svg/RedoIcon.js +27 -0
  62. package/dist/Editor/assets/svg/SettingsIcon.js +28 -0
  63. package/dist/Editor/assets/svg/TextIcon.js +8 -5
  64. package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
  65. package/dist/Editor/assets/svg/UndoIcon.js +27 -0
  66. package/dist/Editor/common/ColorPickerButton.js +25 -9
  67. package/dist/Editor/common/CustomColorPicker/index.js +106 -0
  68. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  69. package/dist/Editor/common/CustomDialog/index.js +94 -0
  70. package/dist/Editor/common/CustomDialog/style.js +67 -0
  71. package/dist/Editor/common/CustomSelect.js +33 -0
  72. package/dist/Editor/common/DnD/DragHandleButton.js +56 -47
  73. package/dist/Editor/common/Icon.js +41 -8
  74. package/dist/Editor/common/LinkSettings/NavComponents.js +5 -2
  75. package/dist/Editor/common/LinkSettings/index.js +4 -2
  76. package/dist/Editor/common/LinkSettings/navOptions.js +7 -2
  77. package/dist/Editor/common/LinkSettings/style.js +11 -8
  78. package/dist/Editor/common/MentionsPopup/MentionsListCard.js +6 -1
  79. package/dist/Editor/common/MentionsPopup/index.js +8 -12
  80. package/dist/Editor/common/Section/index.js +69 -28
  81. package/dist/Editor/common/Section/styles.js +12 -6
  82. package/dist/Editor/common/Shorthands/elements.js +54 -12
  83. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  84. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +19 -16
  85. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  86. package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
  87. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +31 -7
  88. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
  89. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +14 -3
  90. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +2 -4
  91. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +14 -4
  92. package/dist/Editor/common/StyleBuilder/index.js +1 -1
  93. package/dist/Editor/common/StyleBuilder/sectionStyle.js +2 -13
  94. package/dist/Editor/common/iconslist.js +0 -31
  95. package/dist/Editor/helper/index.js +0 -139
  96. package/dist/Editor/helper/theme.js +185 -48
  97. package/dist/Editor/hooks/useEditorTheme.js +139 -0
  98. package/dist/Editor/hooks/useMouseMove.js +12 -37
  99. package/dist/Editor/hooks/useWindowMessage.js +10 -7
  100. package/dist/Editor/hooks/withCommon.js +1 -2
  101. package/dist/Editor/plugins/withEmbeds.js +1 -1
  102. package/dist/Editor/plugins/withHTML.js +1 -1
  103. package/dist/Editor/plugins/withTable.js +1 -1
  104. package/dist/Editor/theme/ThemeList.js +50 -173
  105. package/dist/Editor/theme/index.js +144 -0
  106. package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
  107. package/dist/Editor/themeSettings/buttons/index.js +290 -0
  108. package/dist/Editor/themeSettings/buttons/style.js +21 -0
  109. package/dist/Editor/themeSettings/colorTheme/index.js +290 -0
  110. package/dist/Editor/themeSettings/colorTheme/style.js +77 -0
  111. package/dist/Editor/themeSettings/fonts/PreviewElement.js +123 -0
  112. package/dist/Editor/themeSettings/fonts/index.js +213 -0
  113. package/dist/Editor/themeSettings/fonts/style.js +44 -0
  114. package/dist/Editor/themeSettings/icons.js +60 -0
  115. package/dist/Editor/themeSettings/index.js +320 -0
  116. package/dist/Editor/themeSettings/style.js +152 -0
  117. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  118. package/dist/Editor/themeSettingsAI/index.js +356 -0
  119. package/dist/Editor/themeSettingsAI/saveTheme.js +190 -0
  120. package/dist/Editor/themeSettingsAI/style.js +247 -0
  121. package/dist/Editor/utils/SlateUtilityFunctions.js +163 -47
  122. package/dist/Editor/utils/button.js +1 -17
  123. package/dist/Editor/utils/draftToSlate.js +1 -1
  124. package/dist/Editor/utils/events.js +54 -7
  125. package/dist/Editor/utils/font.js +40 -37
  126. package/dist/Editor/utils/helper.js +31 -31
  127. package/dist/Editor/utils/table.js +51 -43
  128. package/package.json +4 -6
  129. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +0 -391
  130. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +0 -193
  131. package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +0 -23
  132. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +0 -184
  133. package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +0 -36
  134. package/dist/Editor/Elements/FreeGrid/Options/More.js +0 -24
  135. package/dist/Editor/Elements/FreeGrid/Options/SectionSettings.js +0 -47
  136. package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +0 -11
  137. package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +0 -75
  138. package/dist/Editor/Elements/FreeGrid/styles.js +0 -159
  139. package/dist/Editor/ErrorBoundary.js +0 -30
  140. package/dist/Editor/common/RnD/ContextMenu/CMenus.js +0 -105
  141. package/dist/Editor/common/RnD/ContextMenu/index.js +0 -38
  142. package/dist/Editor/common/RnD/ContextMenu/styles.js +0 -21
  143. package/dist/Editor/common/RnD/DragInfo/index.js +0 -31
  144. package/dist/Editor/common/RnD/DragInfo/styles.js +0 -15
  145. package/dist/Editor/common/RnD/DragOver/index.js +0 -46
  146. package/dist/Editor/common/RnD/DragOver/styles.js +0 -23
  147. package/dist/Editor/common/RnD/ElementOptions/Actions.js +0 -82
  148. package/dist/Editor/common/RnD/ElementOptions/Icons/LinkIcon.js +0 -26
  149. package/dist/Editor/common/RnD/ElementOptions/index.js +0 -93
  150. package/dist/Editor/common/RnD/ElementOptions/styles.js +0 -41
  151. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Link.js +0 -153
  152. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +0 -58
  153. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +0 -7
  154. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +0 -46
  155. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +0 -46
  156. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +0 -46
  157. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +0 -30
  158. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +0 -46
  159. package/dist/Editor/common/RnD/ElementSettings/Settings/index.js +0 -13
  160. package/dist/Editor/common/RnD/ElementSettings/index.js +0 -17
  161. package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +0 -14
  162. package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -76
  163. package/dist/Editor/common/RnD/GuideLines/BoundaryLine.js +0 -52
  164. package/dist/Editor/common/RnD/GuideLines/index.js +0 -33
  165. package/dist/Editor/common/RnD/GuideLines/styles.js +0 -60
  166. package/dist/Editor/common/RnD/OptionsPopup/index.js +0 -50
  167. package/dist/Editor/common/RnD/OptionsPopup/style.js +0 -36
  168. package/dist/Editor/common/RnD/RnDCopy.js +0 -23
  169. package/dist/Editor/common/RnD/ShadowElement.js +0 -34
  170. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +0 -40
  171. package/dist/Editor/common/RnD/SwitchViewport/styles.js +0 -24
  172. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +0 -63
  173. package/dist/Editor/common/RnD/TransformHandles/CornerHandle.js +0 -19
  174. package/dist/Editor/common/RnD/TransformHandles/Icons/BottomRightIcon.js +0 -13
  175. package/dist/Editor/common/RnD/TransformHandles/SizeHandle.js +0 -18
  176. package/dist/Editor/common/RnD/TransformHandles/index.js +0 -62
  177. package/dist/Editor/common/RnD/Utils/alignmentDetection.js +0 -26
  178. package/dist/Editor/common/RnD/Utils/calculateDropItem.js +0 -98
  179. package/dist/Editor/common/RnD/Utils/collisionDetection.js +0 -52
  180. package/dist/Editor/common/RnD/Utils/gridDropItem.js +0 -148
  181. package/dist/Editor/common/RnD/Utils/index.js +0 -251
  182. package/dist/Editor/common/RnD/VirtualElement/index.js +0 -76
  183. package/dist/Editor/common/RnD/VirtualElement/styles.js +0 -27
  184. package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +0 -28
  185. package/dist/Editor/common/RnD/index.js +0 -503
  186. package/dist/Editor/common/RnD/styles.js +0 -4
  187. package/dist/Editor/common/StyleBuilder/boxStyle.js +0 -30
  188. package/dist/Editor/helper/RnD/focusOnNewItem.js +0 -39
  189. package/dist/Editor/helper/RnD/scrollToNewSection.js +0 -24
  190. package/dist/Editor/helper/breakpoint.js +0 -5
  191. package/dist/Editor/hooks/useBreakpoints.js +0 -34
  192. package/dist/Editor/hooks/withErrorHandling.js +0 -14
  193. package/dist/Editor/utils/RnD/RnDCtrlCmds.js +0 -168
  194. package/dist/Editor/utils/freegrid.js +0 -49
@@ -0,0 +1,356 @@
1
+ import React, { useState } from "react";
2
+ import { Button, Checkbox, CircularProgress, Divider, Drawer, FormControlLabel, Grid, IconButton, InputAdornment, Tab, Tabs, TextField, TextareaAutosize, Typography, styled } from "@mui/material";
3
+
4
+ // Style
5
+ import Style from "./style";
6
+
7
+ // icons
8
+ import { CloseIcon } from "../common/iconslist";
9
+ import { CloudIcon } from "./icons";
10
+ import { TickIcon } from "./icons";
11
+ import { ResetIcon } from "./icons";
12
+ import { useEditorTheme } from "../hooks/useEditorTheme";
13
+ import ActiveTheme from "../themeSettings/ActiveTheme";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ import { jsxs as _jsxs } from "react/jsx-runtime";
16
+ import { Fragment as _Fragment } from "react/jsx-runtime";
17
+ function generateUniqueId() {
18
+ const timestamp = Date.now(); // current timestamp in milliseconds
19
+ const randomNum = Math.floor(Math.random() * 1000000); // random number for uniqueness
20
+ return `id_${timestamp}_${randomNum}`;
21
+ }
22
+ async function getTheme(fileInputRef, onThemeChange, setLoading) {
23
+ const file = fileInputRef.current?.files[0];
24
+ if (file) {
25
+ setLoading(true);
26
+ // Create a FormData object to hold the file
27
+ const formData = new FormData();
28
+ formData.append("file", file); // 'image' is the key that your backend will use to access the file
29
+
30
+ try {
31
+ // Send the file using the fetch API
32
+ const response = await fetch("https://aicheck.agenciflow.com/create", {
33
+ method: "POST",
34
+ body: formData
35
+ });
36
+
37
+ // Handle the response
38
+ if (response.ok) {
39
+ const data = await response.json(); // Assuming the response is JSON
40
+ const theme = JSON.parse(data?.response || "{}");
41
+ onThemeChange({
42
+ id: generateUniqueId(),
43
+ name: "AI Generated",
44
+ theme: theme
45
+ });
46
+ } else {
47
+ console.error("Error:", response.statusText);
48
+ }
49
+ } catch (error) {
50
+ console.error("Fetch error:", error);
51
+ }
52
+ setLoading(false);
53
+ } else {
54
+ console.log("No file selected");
55
+ }
56
+ }
57
+ const ThemeSettingsAI = props => {
58
+ const {
59
+ className,
60
+ openAITheme,
61
+ setOpenAITheme
62
+ } = props;
63
+
64
+ // State
65
+ // const [themeDrawer, setThemeDrawer] = useState(true);
66
+ const [themeTabType, setThemeTabType] = React.useState(0);
67
+ const [enableGenerateTheme, setEnableGenerateTheme] = React.useState(false);
68
+ const [generateTheme] = React.useState(false);
69
+ const [loading, setLoading] = React.useState(false);
70
+ const [imageSrc, setImageSrc] = useState(null);
71
+ const {
72
+ updateTheme
73
+ } = useEditorTheme();
74
+ const onThemeChange = theme => {
75
+ updateTheme(theme, {
76
+ action: "THEME_CHANGE"
77
+ });
78
+ };
79
+
80
+ // image upload
81
+ const fileInputRef = React.useRef(null);
82
+ const handleDivClick = () => {
83
+ // Trigger the click event on the hidden file input element
84
+ fileInputRef.current.click();
85
+ };
86
+ const handleImageUpload = event => {
87
+ const file = event.target.files[0];
88
+ if (file) {
89
+ const reader = new FileReader();
90
+ reader.onload = () => {
91
+ setImageSrc(reader.result);
92
+ };
93
+ reader.readAsDataURL(file);
94
+ setEnableGenerateTheme(true);
95
+ }
96
+ };
97
+ const handleTabChange = (event, newValue) => {
98
+ setThemeTabType(newValue);
99
+ };
100
+ const handleClose = () => {
101
+ setOpenAITheme(false);
102
+ };
103
+
104
+ // themeCard
105
+ // const ThemeCard = () => {
106
+ // return (
107
+ // <Grid className="themeCardWrapper">
108
+ // {/* remove selected based on condition */}
109
+ // <Grid
110
+ // container
111
+ // justifyContent={"space-between"}
112
+ // className="themeCard selected"
113
+ // >
114
+ // <TickIcon />
115
+ // <Grid>
116
+ // <Typography variant="body1" className="fs-14 fw-500">
117
+ // Slate Gray
118
+ // </Typography>
119
+ // <Typography
120
+ // variant="body2"
121
+ // color={"textSecondary"}
122
+ // className="fs-12"
123
+ // >
124
+ // Muted Elegance
125
+ // </Typography>
126
+ // </Grid>
127
+ // <Grid className="flexAlign" sx={{ gap: "5px" }}>
128
+ // <Grid className="primaryCard"></Grid>
129
+ // <Grid className="secondaryCard"></Grid>
130
+ // <Grid className="otherColors" sx={{ gap: "5px" }}>
131
+ // <Grid className="smallCard"></Grid>
132
+ // <Grid className="smallCard"></Grid>
133
+ // <Grid className="smallCard"></Grid>
134
+ // <Grid className="smallCard"></Grid>
135
+ // </Grid>
136
+ // </Grid>
137
+ // </Grid>
138
+ // </Grid>
139
+ // );
140
+ // };
141
+
142
+ return /*#__PURE__*/_jsx(Grid, {
143
+ className: className,
144
+ children: /*#__PURE__*/_jsx(Drawer, {
145
+ className: className,
146
+ open: openAITheme,
147
+ onClose: handleClose,
148
+ anchor: "right",
149
+ children: /*#__PURE__*/_jsxs(Grid, {
150
+ className: "settingsContainer",
151
+ children: [/*#__PURE__*/_jsxs(Grid, {
152
+ container: true,
153
+ justifyContent: "space-between",
154
+ wrap: "nowrap",
155
+ className: "header",
156
+ children: [/*#__PURE__*/_jsx(Grid, {
157
+ children: /*#__PURE__*/_jsx(Typography, {
158
+ variant: "body1",
159
+ className: "title",
160
+ children: "Create theme with AI"
161
+ })
162
+ }), /*#__PURE__*/_jsx(IconButton, {
163
+ className: "closeBtn",
164
+ onClick: handleClose,
165
+ children: /*#__PURE__*/_jsx(CloseIcon, {})
166
+ })]
167
+ }), /*#__PURE__*/_jsxs(Tabs, {
168
+ value: themeTabType,
169
+ onChange: handleTabChange,
170
+ variant: "scrollable",
171
+ scrollButtons: false,
172
+ "aria-label": "scrollable prevent tabs example",
173
+ sx: {
174
+ mb: 2
175
+ },
176
+ children: [/*#__PURE__*/_jsx(Tab, {
177
+ label: /*#__PURE__*/_jsx(Typography, {
178
+ variant: "body1",
179
+ className: "fs-14 fw-500 transformNone",
180
+ children: "Image"
181
+ })
182
+ }), /*#__PURE__*/_jsx(Tab, {
183
+ label: /*#__PURE__*/_jsx(Typography, {
184
+ variant: "body1",
185
+ className: "fs-14 fw-500 transformNone",
186
+ children: "Text"
187
+ })
188
+ }), /*#__PURE__*/_jsx(Tab, {
189
+ label: /*#__PURE__*/_jsx(Typography, {
190
+ variant: "body1",
191
+ className: "fs-14 fw-500 transformNone",
192
+ children: "Image link"
193
+ })
194
+ })]
195
+ }), themeTabType === 0 && /*#__PURE__*/_jsx(Grid, {
196
+ className: "imageUpload",
197
+ children: /*#__PURE__*/_jsxs(Grid, {
198
+ container: true,
199
+ justifyContent: "center",
200
+ alignItems: "center",
201
+ className: "imgUploadInner",
202
+ onClick: handleDivClick,
203
+ children: [/*#__PURE__*/_jsx("input", {
204
+ type: "file",
205
+ accept: ".png",
206
+ ref: fileInputRef,
207
+ onChange: handleImageUpload,
208
+ style: {
209
+ display: "none"
210
+ }
211
+ }), imageSrc ? /*#__PURE__*/_jsxs(_Fragment, {
212
+ children: [/*#__PURE__*/_jsx(IconButton, {
213
+ className: "resetIcon",
214
+ onClick: () => setImageSrc(null),
215
+ children: /*#__PURE__*/_jsx(ResetIcon, {})
216
+ }), /*#__PURE__*/_jsx(Grid, {
217
+ className: "changeImgText",
218
+ children: "Change Image"
219
+ }), /*#__PURE__*/_jsx("img", {
220
+ src: imageSrc,
221
+ alt: "Uploaded Preview",
222
+ className: "uploadedImage"
223
+ })]
224
+ }) : /*#__PURE__*/_jsxs(Grid, {
225
+ container: true,
226
+ justifyContent: "center",
227
+ alignItems: "center",
228
+ direction: "column",
229
+ children: [/*#__PURE__*/_jsx(CloudIcon, {}), /*#__PURE__*/_jsx(Typography, {
230
+ variant: "body1",
231
+ className: "fw-600",
232
+ sx: {
233
+ pb: 0.5
234
+ },
235
+ children: "Upload a logo or image"
236
+ }), /*#__PURE__*/_jsx(Typography, {
237
+ variant: "body2",
238
+ className: "fs-12",
239
+ color: "textSecondary",
240
+ children: "Click here to upload PDF, PPT, and image files."
241
+ })]
242
+ })]
243
+ })
244
+ }), themeTabType === 1 && /*#__PURE__*/_jsx(Grid, {
245
+ className: "textArea",
246
+ children: /*#__PURE__*/_jsx(TextareaAutosize, {
247
+ placeholder: "Describe the theme you are interested in..."
248
+ })
249
+ }), themeTabType === 2 && /*#__PURE__*/_jsxs(_Fragment, {
250
+ children: [/*#__PURE__*/_jsx(Grid, {
251
+ className: "textArea imageUrl invalidUrl",
252
+ children: /*#__PURE__*/_jsx(TextField, {
253
+ fullWidth: true,
254
+ placeholder: "Add Image URL",
255
+ size: "small"
256
+ // value={imageUrl}
257
+ ,
258
+ id: "outlined-basic",
259
+ variant: "outlined",
260
+ InputProps: {
261
+ endAdornment: /*#__PURE__*/_jsx(InputAdornment, {
262
+ position: "end",
263
+ children: /*#__PURE__*/_jsx(TickIcon, {})
264
+ })
265
+ }
266
+ })
267
+ }), /*#__PURE__*/_jsx(Grid, {
268
+ className: "imageUpload",
269
+ children: /*#__PURE__*/_jsx(Grid, {
270
+ container: true,
271
+ justifyContent: "center",
272
+ justifyItems: "center",
273
+ className: "imgUploadInner",
274
+ children: /*#__PURE__*/_jsx(Grid, {
275
+ container: true,
276
+ justifyContent: "center",
277
+ alignItems: "center",
278
+ direction: "column",
279
+ children: /*#__PURE__*/_jsx("img", {
280
+ src: "",
281
+ alt: ""
282
+ })
283
+ })
284
+ })
285
+ })]
286
+ }), /*#__PURE__*/_jsxs(Grid, {
287
+ children: [/*#__PURE__*/_jsx(FormControlLabel, {
288
+ sx: {
289
+ mb: 1,
290
+ mt: 1
291
+ },
292
+ control: /*#__PURE__*/_jsx(Checkbox, {
293
+ checked: enableGenerateTheme,
294
+ onChange: event => setEnableGenerateTheme(event.target.checked),
295
+ size: "small"
296
+ }),
297
+ label: /*#__PURE__*/_jsx(Typography, {
298
+ variant: "body2",
299
+ className: "fs-12",
300
+ children: "a generated theme is used, the site text style will also change."
301
+ })
302
+ }), /*#__PURE__*/_jsxs(Grid, {
303
+ container: true,
304
+ justifyContent: generateTheme ? "space-between" : "flex-end",
305
+ children: [generateTheme && /*#__PURE__*/_jsx(Button, {
306
+ className: "outlineBtn",
307
+ variant: "outlined",
308
+ size: "small",
309
+ color: "primary",
310
+ children: "Regenerate theme"
311
+ }), /*#__PURE__*/_jsxs(Button, {
312
+ variant: "contained",
313
+ size: "small",
314
+ className: `blueBtn ${enableGenerateTheme ? "eanbled" : "disabled"}`,
315
+ disabled: loading,
316
+ onClick: () => {
317
+ // setGenerateTheme(true);
318
+ getTheme(fileInputRef, onThemeChange, setLoading);
319
+ },
320
+ children: [loading ? /*#__PURE__*/_jsx(CircularProgress, {
321
+ size: 18,
322
+ style: {
323
+ marginRight: "10px"
324
+ }
325
+ }) : null, loading ? "Generating..." : "Generate Theme"]
326
+ })]
327
+ })]
328
+ }), /*#__PURE__*/_jsx(Divider, {
329
+ sx: {
330
+ mt: 2,
331
+ mb: 2
332
+ }
333
+ }), /*#__PURE__*/_jsx(Typography, {
334
+ variant: "body1",
335
+ className: "fs-14 fw-600",
336
+ sx: {
337
+ mt: 1,
338
+ mb: 1
339
+ },
340
+ children: "Active Theme"
341
+ }), /*#__PURE__*/_jsx(Grid, {
342
+ className: "themeCardWrapper",
343
+ children: /*#__PURE__*/_jsxs(Grid, {
344
+ container: true,
345
+ justifyContent: "space-between",
346
+ className: "themeCard selected",
347
+ children: [/*#__PURE__*/_jsx(TickIcon, {}), /*#__PURE__*/_jsx(ActiveTheme, {
348
+ explore: false
349
+ })]
350
+ })
351
+ })]
352
+ })
353
+ })
354
+ });
355
+ };
356
+ export default styled(ThemeSettingsAI)(Style);
@@ -0,0 +1,190 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import { Button, CircularProgress, Dialog, Divider, Grid, IconButton, TextField, Typography, styled } from "@mui/material";
3
+
4
+ // Style
5
+ import Style from "./style";
6
+
7
+ // icons
8
+ import { CloseIcon } from "../common/iconslist";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ import { Fragment as _Fragment } from "react/jsx-runtime";
12
+ const SaveTheme = props => {
13
+ const {
14
+ className,
15
+ enableGenerateTheme,
16
+ saveBtnLabel,
17
+ loading,
18
+ onSave,
19
+ defaultFormData = {}
20
+ } = props;
21
+
22
+ // State
23
+ const [saveTheme, setSaveTheme] = useState(false);
24
+ const [error, setError] = useState({});
25
+ const [form, setForm] = useState(defaultFormData);
26
+ const {
27
+ name,
28
+ mood_name
29
+ } = form;
30
+ const updateForm = update => {
31
+ setForm(prev => ({
32
+ ...prev,
33
+ ...update
34
+ }));
35
+ };
36
+ useEffect(() => {
37
+ setForm(defaultFormData);
38
+ }, [defaultFormData]);
39
+ const onClose = () => {
40
+ setSaveTheme(false);
41
+ setError({});
42
+ setForm({});
43
+ };
44
+ const validate = () => {
45
+ let err = {};
46
+ if (!name) {
47
+ err.name = "This field is required!";
48
+ }
49
+ if (!mood_name) {
50
+ err.mood_name = "This field is required!";
51
+ }
52
+ return err;
53
+ };
54
+ return /*#__PURE__*/_jsxs(_Fragment, {
55
+ children: [/*#__PURE__*/_jsx(Button, {
56
+ variant: "contained",
57
+ size: "small",
58
+ className: `blueBtn ${enableGenerateTheme ? "eanbled" : "disabled"}`
59
+ // disabled={!enableGenerateTheme}
60
+ ,
61
+ onClick: () => setSaveTheme(true),
62
+ children: saveBtnLabel
63
+ }), /*#__PURE__*/_jsx(Dialog, {
64
+ fullWidth: true,
65
+ maxWidth: "sm",
66
+ open: saveTheme,
67
+ onClose: onClose,
68
+ className: className,
69
+ children: /*#__PURE__*/_jsxs(Grid, {
70
+ className: "saveThemeContainer",
71
+ sx: {
72
+ p: 2
73
+ },
74
+ children: [/*#__PURE__*/_jsxs(Grid, {
75
+ container: true,
76
+ justifyContent: "space-between",
77
+ children: [/*#__PURE__*/_jsx(Typography, {
78
+ variant: "h4",
79
+ sx: {
80
+ fontSize: "20px"
81
+ },
82
+ className: "fw-600",
83
+ children: "Save Your theme"
84
+ }), /*#__PURE__*/_jsx(IconButton, {
85
+ onClick: onClose,
86
+ className: "closeBtn",
87
+ children: /*#__PURE__*/_jsx(CloseIcon, {})
88
+ })]
89
+ }), /*#__PURE__*/_jsx(Divider, {
90
+ sx: {
91
+ mt: 1,
92
+ mb: 1
93
+ }
94
+ }), /*#__PURE__*/_jsx(Typography, {
95
+ variant: "body1",
96
+ className: "fw-500",
97
+ sx: {
98
+ pb: 0.5
99
+ },
100
+ children: "Theme name"
101
+ }), /*#__PURE__*/_jsx(TextField, {
102
+ variant: "outlined",
103
+ fullWidth: true,
104
+ size: "small",
105
+ placeholder: "Ex : Forest green",
106
+ onChange: e => updateForm({
107
+ name: e.target.value
108
+ }),
109
+ value: name
110
+ }), /*#__PURE__*/_jsx(Error, {
111
+ error: error?.name
112
+ }), /*#__PURE__*/_jsx(Typography, {
113
+ variant: "body1",
114
+ className: "fw-500",
115
+ sx: {
116
+ pt: 1,
117
+ pb: 0.5
118
+ },
119
+ children: "Category"
120
+ }), /*#__PURE__*/_jsx(TextField, {
121
+ variant: "outlined",
122
+ size: "small",
123
+ placeholder: "Ex : Nature and Calm",
124
+ fullWidth: true,
125
+ onChange: e => updateForm({
126
+ mood_name: e.target.value
127
+ }),
128
+ value: mood_name
129
+ }), /*#__PURE__*/_jsx(Error, {
130
+ error: error?.mood_name
131
+ }), /*#__PURE__*/_jsxs(Grid, {
132
+ container: true,
133
+ justifyContent: "flex-end",
134
+ sx: {
135
+ mt: 3
136
+ },
137
+ children: [/*#__PURE__*/_jsx(Button, {
138
+ variant: "outlined",
139
+ className: "seondaryOutlineBtn",
140
+ color: "secondary",
141
+ onClick: onClose,
142
+ children: "Cancel"
143
+ }), /*#__PURE__*/_jsxs(Button, {
144
+ variant: "contained",
145
+ color: "primary",
146
+ className: "blueBtn",
147
+ sx: {
148
+ ml: 1
149
+ },
150
+ disabled: loading,
151
+ onClick: async () => {
152
+ const err = validate();
153
+ setError(err);
154
+ if (Object.keys(err)?.length) {
155
+ return;
156
+ }
157
+ await onSave({
158
+ ...form
159
+ });
160
+ onClose();
161
+ },
162
+ children: [loading ? /*#__PURE__*/_jsx(CircularProgress, {
163
+ size: 14,
164
+ style: {
165
+ marginRight: "10px"
166
+ }
167
+ }) : null, saveBtnLabel]
168
+ })]
169
+ })]
170
+ })
171
+ })]
172
+ });
173
+ };
174
+ export default styled(SaveTheme)(Style);
175
+ function Error({
176
+ error = ""
177
+ }) {
178
+ if (error) {
179
+ return /*#__PURE__*/_jsx(Typography, {
180
+ variant: "body1",
181
+ sx: {
182
+ color: "red",
183
+ mt: 1
184
+ },
185
+ children: error
186
+ });
187
+ } else {
188
+ return /*#__PURE__*/_jsx(_Fragment, {});
189
+ }
190
+ }