@openlettermarketing/olc-react-sdk 2.1.6 → 2.1.8

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 (230) hide show
  1. package/build/index.js +1 -1
  2. package/build/index.js.map +1 -1
  3. package/build/types/version.d.ts +1 -1
  4. package/package.json +7 -6
  5. package/.eslintignore +0 -1
  6. package/.eslintrc.cjs +0 -18
  7. package/.eslintrc.yml +0 -47
  8. package/.github/workflows/publish-beta.yml +0 -154
  9. package/.github/workflows/publish-production.yml +0 -143
  10. package/.prettierignore +0 -3
  11. package/.prettierrc.yml +0 -5
  12. package/CHANGELOG.md +0 -4
  13. package/babel.config.json +0 -10
  14. package/examples/.eslintrc.yml +0 -4
  15. package/index.html +0 -18
  16. package/public/vite.svg +0 -1
  17. package/src/App.tsx +0 -209
  18. package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
  19. package/src/assets/images/create-template/prebuilt.svg +0 -13
  20. package/src/assets/images/create-template/scratch.svg +0 -4
  21. package/src/assets/images/input/cancel.tsx +0 -20
  22. package/src/assets/images/input/search.tsx +0 -20
  23. package/src/assets/images/input/select-cancel.tsx +0 -17
  24. package/src/assets/images/modal-icons/add.tsx +0 -36
  25. package/src/assets/images/modal-icons/cancel-file.tsx +0 -12
  26. package/src/assets/images/modal-icons/cancel-input.tsx +0 -13
  27. package/src/assets/images/modal-icons/cancel.tsx +0 -35
  28. package/src/assets/images/modal-icons/close-new.svg +0 -3
  29. package/src/assets/images/modal-icons/confirm-close-icon.tsx +0 -14
  30. package/src/assets/images/modal-icons/confirm-new.tsx +0 -22
  31. package/src/assets/images/modal-icons/confirm.svg +0 -12
  32. package/src/assets/images/modal-icons/cross.tsx +0 -23
  33. package/src/assets/images/modal-icons/del.tsx +0 -19
  34. package/src/assets/images/modal-icons/design-icon.tsx +0 -22
  35. package/src/assets/images/modal-icons/doc.tsx +0 -43
  36. package/src/assets/images/modal-icons/docx.tsx +0 -43
  37. package/src/assets/images/modal-icons/envelope-icon.tsx +0 -26
  38. package/src/assets/images/modal-icons/info.tsx +0 -19
  39. package/src/assets/images/modal-icons/jpeg.tsx +0 -43
  40. package/src/assets/images/modal-icons/jpg.tsx +0 -43
  41. package/src/assets/images/modal-icons/modal-cros.svg +0 -4
  42. package/src/assets/images/modal-icons/modal-cross.tsx +0 -37
  43. package/src/assets/images/modal-icons/new-cancel.tsx +0 -11
  44. package/src/assets/images/modal-icons/order-download.tsx +0 -42
  45. package/src/assets/images/modal-icons/pdf.tsx +0 -51
  46. package/src/assets/images/modal-icons/png.tsx +0 -43
  47. package/src/assets/images/modal-icons/save.tsx +0 -23
  48. package/src/assets/images/modal-icons/template-copy.tsx +0 -25
  49. package/src/assets/images/modal-icons/tool-cancel.tsx +0 -25
  50. package/src/assets/images/products/bi-new.svg +0 -23
  51. package/src/assets/images/products/left-arrow.svg +0 -17
  52. package/src/assets/images/products/personal-new.tsx +0 -31
  53. package/src/assets/images/products/postcard-new.tsx +0 -27
  54. package/src/assets/images/products/professional-new.tsx +0 -24
  55. package/src/assets/images/products/real-new.tsx +0 -30
  56. package/src/assets/images/products/right-arrow.svg +0 -17
  57. package/src/assets/images/products/snap-new.svg +0 -31
  58. package/src/assets/images/templates/actions.svg +0 -3
  59. package/src/assets/images/templates/address-block-icon.tsx +0 -62
  60. package/src/assets/images/templates/archive.svg +0 -3
  61. package/src/assets/images/templates/arrow-down.tsx +0 -27
  62. package/src/assets/images/templates/back-arrow.tsx +0 -19
  63. package/src/assets/images/templates/bi-fold-self-mailers.tsx +0 -28
  64. package/src/assets/images/templates/check.svg +0 -3
  65. package/src/assets/images/templates/code.svg +0 -10
  66. package/src/assets/images/templates/content-copy-icon.tsx +0 -24
  67. package/src/assets/images/templates/custom-add-on-icon.tsx +0 -18
  68. package/src/assets/images/templates/custom-qr-section-icon.tsx +0 -9
  69. package/src/assets/images/templates/custom-template.tsx +0 -23
  70. package/src/assets/images/templates/designer.tsx +0 -43
  71. package/src/assets/images/templates/dot.tsx +0 -22
  72. package/src/assets/images/templates/download-v2.svg +0 -4
  73. package/src/assets/images/templates/download.svg +0 -4
  74. package/src/assets/images/templates/dummy-template.tsx +0 -76
  75. package/src/assets/images/templates/dynamic-field.tsx +0 -119
  76. package/src/assets/images/templates/edit-pencil-icon.tsx +0 -21
  77. package/src/assets/images/templates/edit.svg +0 -3
  78. package/src/assets/images/templates/epo-icon.tsx +0 -16
  79. package/src/assets/images/templates/field.tsx +0 -29
  80. package/src/assets/images/templates/gsv-icon.tsx +0 -31
  81. package/src/assets/images/templates/info-icon.tsx +0 -37
  82. package/src/assets/images/templates/left-arrow.svg +0 -17
  83. package/src/assets/images/templates/pencil.svg +0 -3
  84. package/src/assets/images/templates/personal-letter.tsx +0 -53
  85. package/src/assets/images/templates/postcard.tsx +0 -32
  86. package/src/assets/images/templates/professional-letter.tsx +0 -53
  87. package/src/assets/images/templates/qr-code.tsx +0 -13
  88. package/src/assets/images/templates/real-penned-letters.tsx +0 -57
  89. package/src/assets/images/templates/right-arrow.svg +0 -17
  90. package/src/assets/images/templates/size-image-lg.tsx +0 -20
  91. package/src/assets/images/templates/size-image-mid.tsx +0 -20
  92. package/src/assets/images/templates/size-image-xl.tsx +0 -20
  93. package/src/assets/images/templates/size-image.tsx +0 -20
  94. package/src/assets/images/templates/snap-pack.tsx +0 -67
  95. package/src/assets/images/templates/template-default-design.tsx +0 -21
  96. package/src/assets/images/templates/trash-upload.svg +0 -3
  97. package/src/assets/images/templates/trash.svg +0 -3
  98. package/src/assets/images/templates/tri-fold-self-mailers.tsx +0 -93
  99. package/src/assets/images/templates/upload-image.svg +0 -10
  100. package/src/assets/images/templates/x.svg +0 -3
  101. package/src/assets/images/thumbnails/one.svg +0 -9
  102. package/src/assets/images/tooltip/tool-arrow.tsx +0 -25
  103. package/src/components/CreateTemplate/V2/index.tsx +0 -527
  104. package/src/components/CreateTemplate/V2/styles.scss +0 -372
  105. package/src/components/CreateTemplate/index.tsx +0 -508
  106. package/src/components/CreateTemplate/styles.scss +0 -404
  107. package/src/components/GenericUIBlocks/Button/index.tsx +0 -54
  108. package/src/components/GenericUIBlocks/Button/styles.scss +0 -43
  109. package/src/components/GenericUIBlocks/CircularProgress/index.tsx +0 -18
  110. package/src/components/GenericUIBlocks/CircularProgress/styles.scss +0 -93
  111. package/src/components/GenericUIBlocks/CustomTooltip/index.tsx +0 -88
  112. package/src/components/GenericUIBlocks/CustomTooltip/styles.scss +0 -19
  113. package/src/components/GenericUIBlocks/Dialog/V2/index.tsx +0 -227
  114. package/src/components/GenericUIBlocks/Dialog/V2/styles.scss +0 -289
  115. package/src/components/GenericUIBlocks/Dialog/index.tsx +0 -185
  116. package/src/components/GenericUIBlocks/Dialog/styles.scss +0 -227
  117. package/src/components/GenericUIBlocks/Divider/index.tsx +0 -12
  118. package/src/components/GenericUIBlocks/Divider/styles.scss +0 -7
  119. package/src/components/GenericUIBlocks/GeneralSelect/index.tsx +0 -114
  120. package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +0 -406
  121. package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +0 -25
  122. package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +0 -20
  123. package/src/components/GenericUIBlocks/GenericSnackbar/Toast/index.tsx +0 -91
  124. package/src/components/GenericUIBlocks/GenericSnackbar/Toast/styles.scss +0 -92
  125. package/src/components/GenericUIBlocks/Grid/index.tsx +0 -82
  126. package/src/components/GenericUIBlocks/Input/index.tsx +0 -269
  127. package/src/components/GenericUIBlocks/Input/styles.scss +0 -332
  128. package/src/components/GenericUIBlocks/Tabs/index.tsx +0 -71
  129. package/src/components/GenericUIBlocks/Tabs/styles.scss +0 -42
  130. package/src/components/GenericUIBlocks/Typography/index.tsx +0 -18
  131. package/src/components/GenericUIBlocks/Typography/styles.scss +0 -27
  132. package/src/components/SidePanel/CustomAddOns/index.tsx +0 -342
  133. package/src/components/SidePanel/CustomAddOns/styles.scss +0 -86
  134. package/src/components/SidePanel/CustomBlockColors/index.tsx +0 -211
  135. package/src/components/SidePanel/CustomBlockColors/styles.scss +0 -80
  136. package/src/components/SidePanel/CustomFields/customFieldSection.tsx +0 -547
  137. package/src/components/SidePanel/CustomFields/styles.scss +0 -64
  138. package/src/components/SidePanel/CustomQRCode/V2/QRCodeModal/index.tsx +0 -172
  139. package/src/components/SidePanel/CustomQRCode/V2/QRCodeModal/styles.scss +0 -46
  140. package/src/components/SidePanel/CustomQRCode/index.tsx +0 -1070
  141. package/src/components/SidePanel/CustomQRCode/styles.scss +0 -149
  142. package/src/components/SidePanel/CustomUploads/V2/index.tsx +0 -542
  143. package/src/components/SidePanel/CustomUploads/V2/styles.scss +0 -267
  144. package/src/components/SidePanel/CustomUploads/index.tsx +0 -301
  145. package/src/components/SidePanel/Templates/ModalGallery/HireDesigner/index.tsx +0 -424
  146. package/src/components/SidePanel/Templates/ModalGallery/HireDesigner/styles.scss +0 -180
  147. package/src/components/SidePanel/Templates/ModalGallery/V2/index.tsx +0 -235
  148. package/src/components/SidePanel/Templates/ModalGallery/V2/styles.scss +0 -244
  149. package/src/components/SidePanel/Templates/ModalGallery/index.tsx +0 -231
  150. package/src/components/SidePanel/Templates/SideBarGallery/index.tsx +0 -233
  151. package/src/components/SidePanel/Templates/SideBarGallery/styles.scss +0 -152
  152. package/src/components/SidePanel/Templates/TemplatesCard/V2/index.tsx +0 -149
  153. package/src/components/SidePanel/Templates/TemplatesCard/V2/styles.scss +0 -156
  154. package/src/components/SidePanel/Templates/TemplatesCard/index.tsx +0 -160
  155. package/src/components/SidePanel/Templates/TemplatesCard/styles.scss +0 -98
  156. package/src/components/SidePanel/Templates/customTemplateSection.tsx +0 -793
  157. package/src/components/SidePanel/Templates/styles.scss +0 -244
  158. package/src/components/SidePanel/index.tsx +0 -160
  159. package/src/components/TemplateBuilder/index.tsx +0 -585
  160. package/src/components/TemplateBuilder/styles.scss +0 -100
  161. package/src/components/TemplateTypes/index.tsx +0 -96
  162. package/src/components/TemplateTypes/styles.scss +0 -91
  163. package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +0 -81
  164. package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +0 -123
  165. package/src/components/TopNavigation/DuplicateTemplateModal.tsx +0 -103
  166. package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +0 -71
  167. package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +0 -88
  168. package/src/components/TopNavigation/SaveTemplateModel/index.tsx +0 -201
  169. package/src/components/TopNavigation/SaveTemplateModel/styles.scss +0 -128
  170. package/src/components/TopNavigation/index.tsx +0 -938
  171. package/src/components/TopNavigation/styles.scss +0 -303
  172. package/src/importMeta.d.ts +0 -31
  173. package/src/index.scss +0 -131
  174. package/src/index.tsx +0 -238
  175. package/src/libs/test.ts +0 -7
  176. package/src/redux/actions/action-types.ts +0 -52
  177. package/src/redux/actions/customQRCodeActions.ts +0 -54
  178. package/src/redux/actions/snackbarActions.ts +0 -16
  179. package/src/redux/actions/templateActions.ts +0 -236
  180. package/src/redux/reducers/customFieldReducer.ts +0 -99
  181. package/src/redux/reducers/customQRCodeReducer.ts +0 -58
  182. package/src/redux/reducers/index.ts +0 -15
  183. package/src/redux/reducers/snackbarReducer.ts +0 -40
  184. package/src/redux/reducers/templateReducer.ts +0 -485
  185. package/src/redux/store.ts +0 -18
  186. package/src/styles/colors.scss +0 -61
  187. package/src/test/mocks.js +0 -89
  188. package/src/test/setupJest.js +0 -1
  189. package/src/utils/api.ts +0 -36
  190. package/src/utils/constants.ts +0 -182
  191. package/src/utils/customStyles.ts +0 -45
  192. package/src/utils/fetchWrapper.ts +0 -73
  193. package/src/utils/fonts.json +0 -1597
  194. package/src/utils/helper.ts +0 -205
  195. package/src/utils/local-storage.ts +0 -15
  196. package/src/utils/message.ts +0 -162
  197. package/src/utils/products.ts +0 -186
  198. package/src/utils/template-builder.ts +0 -328
  199. package/src/utils/templateIdentifierArea/biFold.ts +0 -107
  200. package/src/utils/templateIdentifierArea/index.ts +0 -35
  201. package/src/utils/templateIdentifierArea/personal.ts +0 -107
  202. package/src/utils/templateIdentifierArea/postCards.ts +0 -163
  203. package/src/utils/templateIdentifierArea/professional.ts +0 -125
  204. package/src/utils/templateIdentifierArea/snapPack.ts +0 -107
  205. package/src/utils/templateIdentifierArea/triFold.ts +0 -107
  206. package/src/utils/templateRestrictedArea/biFold.ts +0 -329
  207. package/src/utils/templateRestrictedArea/nonWindowProfessional.ts +0 -90
  208. package/src/utils/templateRestrictedArea/personal.ts +0 -90
  209. package/src/utils/templateRestrictedArea/postCard.ts +0 -334
  210. package/src/utils/templateRestrictedArea/postCardJumbo.tsx +0 -408
  211. package/src/utils/templateRestrictedArea/professional.ts +0 -318
  212. package/src/utils/templateRestrictedArea/realPenned.ts +0 -233
  213. package/src/utils/templateRestrictedArea/snapPack.ts +0 -1009
  214. package/src/utils/templateRestrictedArea/triFold.ts +0 -330
  215. package/src/utils/templateSafetyBorders/biFold.ts +0 -91
  216. package/src/utils/templateSafetyBorders/index.ts +0 -43
  217. package/src/utils/templateSafetyBorders/personal.ts +0 -41
  218. package/src/utils/templateSafetyBorders/postCards.ts +0 -259
  219. package/src/utils/templateSafetyBorders/professional.ts +0 -78
  220. package/src/utils/templateSafetyBorders/snapPack.ts +0 -165
  221. package/src/utils/templateSafetyBorders/triFold.ts +0 -114
  222. package/src/utils/templateSafetyBorders/types.d.ts +0 -68
  223. package/src/utils/types.ts +0 -12
  224. package/src/v2Theme.scss +0 -142
  225. package/tsconfig.json +0 -29
  226. package/tsconfig.node.json +0 -12
  227. package/update-version.js +0 -23
  228. package/version.js +0 -1
  229. package/vite.config.ts +0 -8
  230. package/webpack.config.js +0 -80
@@ -1,424 +0,0 @@
1
- import React, {useEffect, useState} from 'react';
2
-
3
- // Hooks
4
- import {useDispatch, useSelector} from 'react-redux';
5
- import { RootState } from '../../../../../redux/reducers';
6
- import {AppDispatch} from '../../../../../redux/store';
7
-
8
- // Actions
9
- import {success} from '../../../../../redux/actions/snackbarActions';
10
-
11
- // Utils
12
- import {post} from '../../../../../utils/api';
13
- import { getItem, removeItem, setItem } from '../../../../../utils/local-storage';
14
- import { dataURLtoBlob } from '../../../../../utils/helper';
15
- import {EMAIL_REGEX, VIDEO_URL_REGEX} from '../../../../../utils/constants';
16
- import { MESSAGES } from '../../../../../utils/message';
17
-
18
- // Components
19
- import Dialog from '../../../../GenericUIBlocks/Dialog';
20
- import Input from '../../../../GenericUIBlocks/Input';
21
- import Typography from '../../../../GenericUIBlocks/Typography';
22
- import Button from '../../../../GenericUIBlocks/Button';
23
-
24
- // Icons
25
- import PDF from '../../../../../assets/images/modal-icons/pdf';
26
- import PNG from '../../../../../assets/images/modal-icons/png';
27
- import DOC from '../../../../../assets/images/modal-icons/doc';
28
- import DOCX from '../../../../../assets/images/modal-icons/docx';
29
- import JPG from '../../../../../assets/images/modal-icons/jpg';
30
- import JPEG from '../../../../../assets/images/modal-icons/jpeg';
31
- import CancelFile from '../../../../../assets/images/modal-icons/cancel-file';
32
- import Add from '../../../../../assets/images/modal-icons/add';
33
-
34
- // Styles
35
- import './styles.scss';
36
-
37
-
38
- const hireModalStyles = {
39
- maxWidth: '725px',
40
- minHeight: '760px',
41
- };
42
-
43
- const hireModalButtonStyles = {
44
- fontWeight: '600',
45
- fontSize: '18px',
46
- maxWidth: '643px',
47
- minHeight: '55px',
48
- };
49
-
50
- const errorStyles = {
51
- color: 'var(--error-color)',
52
- fontWeight: '400',
53
- fontSize: '14px',
54
- margin: '0',
55
- };
56
-
57
- const HireDesigner = (props: any) => {
58
- const { open, onClose, onCreateCustomTemplateQuery, productId } = props;
59
-
60
- const [queryTitle, setQueryTitle] = useState('');
61
- const [queryEmail, setQueryEmail] = useState('');
62
- const [queryFile, setQueryFile] = useState([]);
63
- const [queryVideoUrl, setQueryVideoUrl] = useState('');
64
- const [queryComments, setQueryComments] = useState('');
65
- const [isLoading, setIsLoading] = useState(false);
66
- const [formErrors, setFormErrors] = useState({
67
- title: '',
68
- email: '',
69
- files: '',
70
- videoUrl: '',
71
- comments: '',
72
- });
73
-
74
- const dispatch: AppDispatch = useDispatch();
75
-
76
- const designerFormStates = useSelector((state: RootState) => state.templates.hireDesignerForm);
77
-
78
- const handleTitleChange = (event: any) => {
79
- const newTitle = event.target.value;
80
- setQueryTitle(newTitle);
81
- setFormErrors((prevErrors) => ({
82
- ...prevErrors,
83
- title: newTitle.trim() && '',
84
- }));
85
- dispatch({type: 'SET_HIRE_DESIGNER_FORM_FIELDS', payload: { queryTitle: newTitle }});
86
- };
87
-
88
- const handleEmailChange = (event: any) => {
89
- const newEmail = event.target.value;
90
- setQueryEmail(newEmail);
91
- setFormErrors((prevErrors) => ({
92
- ...prevErrors,
93
- email: newEmail.trim() && '',
94
- }));
95
- dispatch({type: 'SET_HIRE_DESIGNER_FORM_FIELDS', payload: { queryEmail: newEmail }});
96
- };
97
-
98
- const handleVideoUrlChange = (event: any) => {
99
- const newVideoUrl = event.target.value;
100
- setQueryVideoUrl(newVideoUrl);
101
- setFormErrors((prevErrors) => ({
102
- ...prevErrors,
103
- videoUrl: newVideoUrl.trim() && '',
104
- }));
105
- dispatch({type: 'SET_HIRE_DESIGNER_FORM_FIELDS', payload: { queryVideoUrl: newVideoUrl }});
106
- };
107
-
108
- const handleCommentsChange = (event: any) => {
109
- const newComments = event.target.value;
110
- setQueryComments(newComments);
111
- setFormErrors((prevErrors: any) => ({
112
- ...prevErrors,
113
- comments: newComments.trim() && '',
114
- }));
115
- dispatch({type: 'SET_HIRE_DESIGNER_FORM_FIELDS', payload: { queryComments: newComments }})
116
- };
117
-
118
- const saveFilesToLocalStorage = (files: File[]) => {
119
- const fileData = files.map((file) => ({
120
- name: file.name,
121
- type: file.type,
122
- size: file.size,
123
- content: "",
124
- }));
125
-
126
- files.forEach((file, index) => {
127
- const reader = new FileReader();
128
- reader.onload = () => {
129
- fileData[index].content = reader.result as string;
130
- if (index === files.length - 1) {
131
- dispatch({type: 'SET_HIRE_DESIGNER_FORM_FIELDS', payload: { queryFiles: fileData }});
132
- }
133
- };
134
- reader.readAsDataURL(file);
135
- });
136
- };
137
-
138
- // Retrieve files from localStorage
139
- const getFilesFromLocalStorage = () => {
140
- const savedFiles = designerFormStates.queryFiles;
141
- if (!savedFiles) return [];
142
- const fileData = savedFiles;
143
-
144
- return fileData.map((file: any) => {
145
- const blob = dataURLtoBlob(file.content, file.type);
146
- return new File([blob], file.name, { type: file.type });
147
- });
148
- };
149
-
150
- const handleFileChange = (event: any) => {
151
- const newFilesArray = Array.from(event.target.files);
152
- const acceptableTypes = ['image/png', 'image/jpeg', 'image/jpg', 'application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];
153
-
154
- const validFiles = newFilesArray.filter((file: any) => acceptableTypes.includes(file.type));
155
- const invalidFiles = newFilesArray.filter((file: any) => !acceptableTypes.includes(file.type));
156
-
157
- if (invalidFiles.length > 0) {
158
- setFormErrors((prevErrors) => ({
159
- ...prevErrors,
160
- files: MESSAGES.TEMPLATE.HIRE_DESIGNER.FILE_VALLIDATION,
161
- }));
162
- setTimeout(() => {
163
- setFormErrors((prevErrors) => ({
164
- ...prevErrors,
165
- files: '',
166
- }));
167
- }, 6000);
168
- } else {
169
- setFormErrors((prevErrors) => ({
170
- ...prevErrors,
171
- files: '',
172
- }));
173
- }
174
-
175
- if (validFiles.length > 0) {
176
- setQueryFile((prevFiles: any) => [...prevFiles, ...validFiles] as never[]);
177
- saveFilesToLocalStorage([...queryFile, ...validFiles] as never[]);
178
- }
179
- event.target.value = null;
180
- };
181
-
182
- const handleFileRemove = (file: any) => {
183
- const updatedFiles = queryFile.filter((f: any) => f.name !== file.name);
184
- setQueryFile(updatedFiles);
185
- updatedFiles.length ?
186
- saveFilesToLocalStorage([...updatedFiles] as never[])
187
- : dispatch({ type: 'SET_HIRE_DESIGNER_FORM_FIELDS', payload: { queryFiles: [] as never[] } });
188
- };
189
-
190
- const validateForm = (formData: any, setFormErrors: any) => {
191
- const errors: any = {};
192
-
193
- if (!formData.queryTitle.trim()) {
194
- errors.title = MESSAGES.TEMPLATE.HIRE_DESIGNER.TITLE_REQUIRED;
195
- }
196
-
197
- if (!formData.queryVideoUrl.trim()) {
198
- errors.videoUrl = MESSAGES.TEMPLATE.HIRE_DESIGNER.URL_REQUIRED;
199
- } else if (!VIDEO_URL_REGEX.test(formData.queryVideoUrl.trim())) {
200
- errors.videoUrl = MESSAGES.TEMPLATE.HIRE_DESIGNER.URL_VAIDATION;
201
- }
202
-
203
- if (!formData.queryComments.trim()) {
204
- errors.comments = MESSAGES.TEMPLATE.HIRE_DESIGNER.COMMENT_REQUIRED;
205
- }
206
-
207
- if (!formData.queryEmail.trim()) {
208
- errors.email = MESSAGES.TEMPLATE.HIRE_DESIGNER.EMAIL_REQUIRED;
209
- } else if (!EMAIL_REGEX.test(formData.queryEmail.trim())) {
210
- errors.email = MESSAGES.TEMPLATE.HIRE_DESIGNER.EMAIL_VALIDATION;
211
- }
212
-
213
- setFormErrors(errors);
214
-
215
- return Object.keys(errors).length === 0;
216
- };
217
-
218
- const resetForm = () => {
219
- setQueryTitle('');
220
- setQueryEmail('');
221
- setQueryVideoUrl('');
222
- setQueryFile([]);
223
- setQueryComments('');
224
- setFormErrors({
225
- title: '',
226
- email: '',
227
- files: '',
228
- videoUrl: '',
229
- comments: '',
230
- });
231
- removeItem('hireDesignerFormState');
232
- removeItem('queryFiles');
233
- dispatch({type: 'CLEAR_HIRE_DESIGNER_FORM_FIELDS'});
234
- };
235
-
236
- const handleSubmit = async (event: any) => {
237
- try {
238
- event.preventDefault();
239
-
240
- const formData = {
241
- queryTitle,
242
- queryVideoUrl,
243
- queryComments,
244
- queryFile,
245
- queryEmail,
246
- };
247
-
248
- const isValid = validateForm(formData, setFormErrors);
249
- if (!isValid) return;
250
- setIsLoading(true);
251
-
252
- const form = new FormData();
253
- form.append('title', queryTitle);
254
- form.append('comments', queryComments);
255
- form.append('email', queryEmail);
256
- form.append('productId', productId);
257
- form.append('url', queryVideoUrl);
258
-
259
- queryFile.forEach((file: any) => {
260
- form.append('files', file);
261
- });
262
-
263
- const response: any = await post('/custom-template-queries/create', form);
264
- if (response && response.status === 200) {
265
- setIsLoading(false);
266
- closeHireModal();
267
- dispatch(success(response.data.message));
268
- onCreateCustomTemplateQuery(response.data);
269
- } else {
270
- throw new Error(`HTTP error! status: ${response.status}`);
271
- }
272
- } catch (error) {
273
- return error;
274
- } finally {
275
- setIsLoading(false);
276
- }
277
- };
278
-
279
- const closeHireModal = () => {
280
- onClose();
281
- resetForm();
282
- }
283
-
284
- useEffect(() => {
285
- setQueryTitle(designerFormStates.queryTitle);
286
- setQueryEmail(designerFormStates.queryEmail);
287
- setQueryVideoUrl(designerFormStates.queryVideoUrl);
288
- setQueryComments(designerFormStates.queryComments);
289
- const savedFiles: any = getFilesFromLocalStorage();
290
- setQueryFile(savedFiles);
291
- }, [open])
292
-
293
- return (
294
- <Dialog
295
- open={open}
296
- customStyles={hireModalStyles}
297
- handleClose={closeHireModal}
298
- isGallery={true}
299
- submitText="Next"
300
- >
301
- <div className="designerFormWrapper">
302
- <Typography variant="h2">{MESSAGES.TEMPLATE.HIRE_DESIGNER.TITLE}</Typography>
303
- <form className="designerForm">
304
- <Input
305
- type="text"
306
- placeholder="Template Name"
307
- label="Template Name*"
308
- value={queryTitle}
309
- onChange={handleTitleChange}
310
- error={formErrors.title}
311
- />
312
- <div className={`input-layout`}>
313
- <label className="basic-label">{MESSAGES.TEMPLATE.HIRE_DESIGNER.UPLOAD_HEADING}</label>
314
- <div className="file-upload-wrapper">
315
- <input
316
- type="file"
317
- onChange={handleFileChange}
318
- multiple
319
- accept=".png, .jpg, .jpeg, .pdf, .doc, .docx"
320
- className="file-input"
321
- />
322
- <div className="upload-area">
323
- <div className="upload-icon">
324
- <Add />
325
- </div>
326
- <label htmlFor="fileInput" className="upload-text">
327
- Upload a File
328
- </label>{' '}
329
- or drag and drop
330
- <div className="upload-info">
331
- Supported formats: .png, .jpg, .jpeg, .pdf, .doc, .docx
332
- </div>
333
- </div>
334
- </div>
335
- {formErrors.files && (
336
- <Typography variant="p" style={errorStyles}>
337
- {formErrors.files}
338
- </Typography>
339
- )}
340
- {queryFile.length > 0 && (
341
- <div className="uploaded-files">
342
- <h3>{MESSAGES.TEMPLATE.HIRE_DESIGNER.UPLOADED_TEXT}</h3>
343
- {queryFile.map((file: File, index: number) => (
344
- <div className="file-item" key={index}>
345
- <div className="file-icon">
346
- {file.type === 'application/pdf' ? (
347
- <PDF />
348
- ) : file.type === 'image/jpeg' ? (
349
- <JPEG />
350
- ) : file.type === 'image/png' ? (
351
- <PNG />
352
- ) : file.type === 'image/jpg' ? (
353
- <JPG />
354
- ) : file.type === 'application/msword' ? (
355
- <DOC />
356
- ) : file.type ===
357
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ? (
358
- <DOCX />
359
- ) : null}
360
- </div>
361
- <div className="file-details">
362
- <p className="file-name">{file.name}</p>
363
- <p className="file-size">
364
- {(file.size / (1024 * 1024)).toFixed(2)} MB
365
- </p>
366
- </div>
367
- <div
368
- className="file-remove"
369
- onClick={() => handleFileRemove(file)}
370
- >
371
- <CancelFile />
372
- </div>
373
- </div>
374
- ))}
375
- </div>
376
- )}
377
- </div>
378
- <Input
379
- type="text"
380
- placeholder="https://www.example.com"
381
- label="Video URL*"
382
- videoTooltip={true}
383
- value={queryVideoUrl}
384
- onChange={handleVideoUrlChange}
385
- error={formErrors.videoUrl}
386
- />
387
- <Input
388
- type="email"
389
- placeholder="Email"
390
- label="Email*"
391
- value={queryEmail}
392
- onChange={handleEmailChange}
393
- error={formErrors.email}
394
- />
395
- <Input
396
- type="textarea"
397
- placeholder="Comments"
398
- label="Comments*"
399
- value={queryComments}
400
- onChange={handleCommentsChange}
401
- error={formErrors.comments}
402
- />
403
- </form>
404
- <div className="button-container">
405
- <Button
406
- onClick={handleSubmit}
407
- disabled={isLoading}
408
- style={hireModalButtonStyles}
409
- >
410
- {isLoading ? (
411
- <div className="loading-container">
412
- <div className="loading-icon" />
413
- </div>
414
- ) : (
415
- 'Next'
416
- )}
417
- </Button>
418
- </div>
419
- </div>
420
- </Dialog>
421
- );
422
- };
423
-
424
- export default HireDesigner;
@@ -1,180 +0,0 @@
1
- .designerFormWrapper {
2
- width: 100%;
3
- display: flex;
4
- flex-direction: column;
5
- align-items: center;
6
- h2 {
7
- color: var(--primary-color);
8
- font-weight: 600;
9
- font-size: 18px;
10
- margin: 0;
11
- }
12
- .designerForm {
13
- width: 100%;
14
- display: flex;
15
- flex-direction: column;
16
- gap: 20px;
17
- height: 635px;
18
- overflow-y: auto;
19
- padding: 20px 40px 24px;
20
- &::-webkit-scrollbar {
21
- width: 8px;
22
- }
23
-
24
- &::-webkit-scrollbar-thumb {
25
- background: var(--scrollbar-thumb-color) !important;
26
- border-radius: 3px;
27
- }
28
-
29
- @supports not selector(::-webkit-scrollbar) {
30
- body {
31
- scrollbar-color: var(--scrollbar-thumb-color)
32
- var(--scrollbar-track-color);
33
- }
34
- }
35
- }
36
-
37
- .file-upload-wrapper {
38
- display: flex;
39
- justify-content: center;
40
- align-items: center;
41
- border: 0.5px solid var(--border-color);
42
- border-radius: 8px;
43
- padding: 20px;
44
- background-color: #fff;
45
- width: 100%;
46
- height: 135px;
47
- position: relative;
48
-
49
-
50
- .file-input {
51
- position: absolute;
52
- width: 100%;
53
- height: 100%;
54
- opacity: 0;
55
- cursor: pointer;
56
- }
57
-
58
-
59
- .upload-area {
60
- text-align: center;
61
-
62
-
63
- .upload-icon {
64
- font-size: 32px;
65
- color: var(--svg-color); /* Customize color */
66
- margin-bottom: 10px;
67
- }
68
-
69
-
70
- .upload-text {
71
- color: var(--primary-color); /* Customize color */
72
- font-weight: 400;
73
- text-decoration: underline;
74
- cursor: pointer;
75
- }
76
-
77
-
78
- .upload-info {
79
- margin-top: 10px;
80
- color: #545454;
81
- font-size: 12px;
82
- }
83
- }
84
- }
85
-
86
- .uploaded-files {
87
- width: 100%;
88
- }
89
-
90
-
91
- h3 {
92
- font-size: 14px;
93
- font-weight: 400;
94
- color: var(--text-color);
95
- margin-bottom: 10px;
96
- }
97
-
98
- .file-item {
99
- display: flex;
100
- align-items: center;
101
- border: 1px solid #ddd;
102
- border-radius: 8px;
103
- padding: 10px;
104
- margin-bottom: 10px;
105
- background-color: #fff;
106
-
107
-
108
- .file-icon {
109
- display: flex;
110
- align-items: center;
111
- justify-content: center;
112
- padding: 5px;
113
- border-radius: 4px;
114
- margin-right: 10px;
115
- width: 50px;
116
- }
117
-
118
-
119
- .file-details {
120
- flex-grow: 1;
121
-
122
-
123
- .file-name {
124
- font-size: 14px !important;
125
- margin: 0;
126
- font-weight: 500;
127
- color: #303030 !important;
128
- }
129
-
130
-
131
- .file-size {
132
- font-size: 12px !important;
133
- color: #b3b3b3 !important;
134
- font-weight: 300 !important;
135
- margin: 0 !important;
136
- }
137
- }
138
-
139
-
140
- .file-remove {
141
- display: flex;
142
- align-items: center;
143
- cursor: pointer;
144
- }
145
- }
146
-
147
- .loading-container {
148
- display: flex;
149
- justify-content: center;
150
- align-items: center;
151
- width: 100%;
152
- height: 100%;
153
- .loading-icon {
154
- width: 20px;
155
- height: 20px;
156
- border-radius: 50%;
157
- border: 2px solid white;
158
- border-top-color: transparent;
159
- animation: spin 1s linear infinite;
160
- }
161
- }
162
-
163
- .button-container {
164
- width: 100%;
165
- display: flex;
166
- justify-content: center;
167
- align-items: center;
168
- gap: 10px;
169
- padding: 0 40px;
170
- }
171
- }
172
-
173
- @keyframes spin {
174
- 0% {
175
- transform: rotate(0deg);
176
- }
177
- 100% {
178
- transform: rotate(360deg);
179
- }
180
- }