@openlettermarketing/olc-react-sdk 2.1.4 → 2.1.5-beta.2

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/.eslintignore +1 -0
  2. package/.eslintrc.cjs +18 -0
  3. package/.eslintrc.yml +47 -0
  4. package/.github/workflows/publish-beta.yml +154 -0
  5. package/.github/workflows/publish-production.yml +143 -0
  6. package/.prettierignore +3 -0
  7. package/.prettierrc.yml +5 -0
  8. package/CHANGELOG.md +4 -0
  9. package/babel.config.json +10 -0
  10. package/build/index.js +82 -82
  11. package/build/index.js.map +1 -1
  12. package/build/types/version.d.ts +1 -1
  13. package/examples/.eslintrc.yml +4 -0
  14. package/index.html +18 -0
  15. package/package.json +1 -1
  16. package/public/vite.svg +1 -0
  17. package/src/App.tsx +209 -0
  18. package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
  19. package/src/assets/images/create-template/prebuilt.svg +13 -0
  20. package/src/assets/images/create-template/scratch.svg +4 -0
  21. package/src/assets/images/input/cancel.tsx +20 -0
  22. package/src/assets/images/input/search.tsx +20 -0
  23. package/src/assets/images/input/select-cancel.tsx +17 -0
  24. package/src/assets/images/modal-icons/add.tsx +36 -0
  25. package/src/assets/images/modal-icons/cancel-file.tsx +12 -0
  26. package/src/assets/images/modal-icons/cancel-input.tsx +13 -0
  27. package/src/assets/images/modal-icons/cancel.tsx +35 -0
  28. package/src/assets/images/modal-icons/close-new.svg +3 -0
  29. package/src/assets/images/modal-icons/confirm-close-icon.tsx +14 -0
  30. package/src/assets/images/modal-icons/confirm-new.tsx +22 -0
  31. package/src/assets/images/modal-icons/confirm.svg +12 -0
  32. package/src/assets/images/modal-icons/cross.tsx +23 -0
  33. package/src/assets/images/modal-icons/del.tsx +19 -0
  34. package/src/assets/images/modal-icons/design-icon.tsx +22 -0
  35. package/src/assets/images/modal-icons/doc.tsx +43 -0
  36. package/src/assets/images/modal-icons/docx.tsx +43 -0
  37. package/src/assets/images/modal-icons/envelope-icon.tsx +26 -0
  38. package/src/assets/images/modal-icons/info.tsx +19 -0
  39. package/src/assets/images/modal-icons/jpeg.tsx +43 -0
  40. package/src/assets/images/modal-icons/jpg.tsx +43 -0
  41. package/src/assets/images/modal-icons/modal-cros.svg +4 -0
  42. package/src/assets/images/modal-icons/modal-cross.tsx +37 -0
  43. package/src/assets/images/modal-icons/new-cancel.tsx +11 -0
  44. package/src/assets/images/modal-icons/order-download.tsx +42 -0
  45. package/src/assets/images/modal-icons/pdf.tsx +51 -0
  46. package/src/assets/images/modal-icons/png.tsx +43 -0
  47. package/src/assets/images/modal-icons/save.tsx +23 -0
  48. package/src/assets/images/modal-icons/template-copy.tsx +25 -0
  49. package/src/assets/images/modal-icons/tool-cancel.tsx +25 -0
  50. package/src/assets/images/products/bi-new.svg +23 -0
  51. package/src/assets/images/products/left-arrow.svg +17 -0
  52. package/src/assets/images/products/personal-new.tsx +31 -0
  53. package/src/assets/images/products/postcard-new.tsx +27 -0
  54. package/src/assets/images/products/professional-new.tsx +24 -0
  55. package/src/assets/images/products/real-new.tsx +30 -0
  56. package/src/assets/images/products/right-arrow.svg +17 -0
  57. package/src/assets/images/products/snap-new.svg +31 -0
  58. package/src/assets/images/templates/actions.svg +3 -0
  59. package/src/assets/images/templates/address-block-icon.tsx +62 -0
  60. package/src/assets/images/templates/archive.svg +3 -0
  61. package/src/assets/images/templates/arrow-down.tsx +27 -0
  62. package/src/assets/images/templates/back-arrow.tsx +19 -0
  63. package/src/assets/images/templates/bi-fold-self-mailers.tsx +28 -0
  64. package/src/assets/images/templates/check.svg +3 -0
  65. package/src/assets/images/templates/code.svg +10 -0
  66. package/src/assets/images/templates/content-copy-icon.tsx +24 -0
  67. package/src/assets/images/templates/custom-add-on-icon.tsx +18 -0
  68. package/src/assets/images/templates/custom-qr-section-icon.tsx +9 -0
  69. package/src/assets/images/templates/custom-template.tsx +23 -0
  70. package/src/assets/images/templates/designer.tsx +43 -0
  71. package/src/assets/images/templates/dot.tsx +22 -0
  72. package/src/assets/images/templates/download-v2.svg +4 -0
  73. package/src/assets/images/templates/download.svg +4 -0
  74. package/src/assets/images/templates/dummy-template.tsx +76 -0
  75. package/src/assets/images/templates/dynamic-field.tsx +119 -0
  76. package/src/assets/images/templates/edit-pencil-icon.tsx +21 -0
  77. package/src/assets/images/templates/edit.svg +3 -0
  78. package/src/assets/images/templates/epo-icon.tsx +16 -0
  79. package/src/assets/images/templates/field.tsx +29 -0
  80. package/src/assets/images/templates/gsv-icon.tsx +31 -0
  81. package/src/assets/images/templates/info-icon.tsx +37 -0
  82. package/src/assets/images/templates/left-arrow.svg +17 -0
  83. package/src/assets/images/templates/pencil.svg +3 -0
  84. package/src/assets/images/templates/personal-letter.tsx +53 -0
  85. package/src/assets/images/templates/postcard.tsx +32 -0
  86. package/src/assets/images/templates/professional-letter.tsx +53 -0
  87. package/src/assets/images/templates/qr-code.tsx +13 -0
  88. package/src/assets/images/templates/real-penned-letters.tsx +57 -0
  89. package/src/assets/images/templates/right-arrow.svg +17 -0
  90. package/src/assets/images/templates/size-image-lg.tsx +20 -0
  91. package/src/assets/images/templates/size-image-mid.tsx +20 -0
  92. package/src/assets/images/templates/size-image-xl.tsx +20 -0
  93. package/src/assets/images/templates/size-image.tsx +20 -0
  94. package/src/assets/images/templates/snap-pack.tsx +67 -0
  95. package/src/assets/images/templates/template-default-design.tsx +21 -0
  96. package/src/assets/images/templates/trash-upload.svg +3 -0
  97. package/src/assets/images/templates/trash.svg +3 -0
  98. package/src/assets/images/templates/tri-fold-self-mailers.tsx +93 -0
  99. package/src/assets/images/templates/upload-image.svg +10 -0
  100. package/src/assets/images/templates/x.svg +3 -0
  101. package/src/assets/images/thumbnails/one.svg +9 -0
  102. package/src/assets/images/tooltip/tool-arrow.tsx +25 -0
  103. package/src/components/CreateTemplate/V2/index.tsx +525 -0
  104. package/src/components/CreateTemplate/V2/styles.scss +372 -0
  105. package/src/components/CreateTemplate/index.tsx +508 -0
  106. package/src/components/CreateTemplate/styles.scss +404 -0
  107. package/src/components/GenericUIBlocks/Button/index.tsx +54 -0
  108. package/src/components/GenericUIBlocks/Button/styles.scss +43 -0
  109. package/src/components/GenericUIBlocks/CircularProgress/index.tsx +18 -0
  110. package/src/components/GenericUIBlocks/CircularProgress/styles.scss +93 -0
  111. package/src/components/GenericUIBlocks/CustomTooltip/index.tsx +88 -0
  112. package/src/components/GenericUIBlocks/CustomTooltip/styles.scss +19 -0
  113. package/src/components/GenericUIBlocks/Dialog/V2/index.tsx +227 -0
  114. package/src/components/GenericUIBlocks/Dialog/V2/styles.scss +289 -0
  115. package/src/components/GenericUIBlocks/Dialog/index.tsx +185 -0
  116. package/src/components/GenericUIBlocks/Dialog/styles.scss +227 -0
  117. package/src/components/GenericUIBlocks/Divider/index.tsx +12 -0
  118. package/src/components/GenericUIBlocks/Divider/styles.scss +7 -0
  119. package/src/components/GenericUIBlocks/GeneralSelect/index.tsx +114 -0
  120. package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +406 -0
  121. package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +25 -0
  122. package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +20 -0
  123. package/src/components/GenericUIBlocks/GenericSnackbar/Toast/index.tsx +91 -0
  124. package/src/components/GenericUIBlocks/GenericSnackbar/Toast/styles.scss +92 -0
  125. package/src/components/GenericUIBlocks/Grid/index.tsx +82 -0
  126. package/src/components/GenericUIBlocks/Input/index.tsx +269 -0
  127. package/src/components/GenericUIBlocks/Input/styles.scss +332 -0
  128. package/src/components/GenericUIBlocks/Tabs/index.tsx +71 -0
  129. package/src/components/GenericUIBlocks/Tabs/styles.scss +42 -0
  130. package/src/components/GenericUIBlocks/Typography/index.tsx +18 -0
  131. package/src/components/GenericUIBlocks/Typography/styles.scss +27 -0
  132. package/src/components/SidePanel/CustomAddOns/index.tsx +342 -0
  133. package/src/components/SidePanel/CustomAddOns/styles.scss +86 -0
  134. package/src/components/SidePanel/CustomBlockColors/index.tsx +211 -0
  135. package/src/components/SidePanel/CustomBlockColors/styles.scss +80 -0
  136. package/src/components/SidePanel/CustomFields/customFieldSection.tsx +547 -0
  137. package/src/components/SidePanel/CustomFields/styles.scss +64 -0
  138. package/src/components/SidePanel/CustomQRCode/V2/QRCodeModal/index.tsx +172 -0
  139. package/src/components/SidePanel/CustomQRCode/V2/QRCodeModal/styles.scss +46 -0
  140. package/src/components/SidePanel/CustomQRCode/index.tsx +1070 -0
  141. package/src/components/SidePanel/CustomQRCode/styles.scss +149 -0
  142. package/src/components/SidePanel/CustomUploads/V2/index.tsx +542 -0
  143. package/src/components/SidePanel/CustomUploads/V2/styles.scss +267 -0
  144. package/src/components/SidePanel/CustomUploads/index.tsx +301 -0
  145. package/src/components/SidePanel/Templates/ModalGallery/HireDesigner/index.tsx +424 -0
  146. package/src/components/SidePanel/Templates/ModalGallery/HireDesigner/styles.scss +180 -0
  147. package/src/components/SidePanel/Templates/ModalGallery/V2/index.tsx +235 -0
  148. package/src/components/SidePanel/Templates/ModalGallery/V2/styles.scss +244 -0
  149. package/src/components/SidePanel/Templates/ModalGallery/index.tsx +231 -0
  150. package/src/components/SidePanel/Templates/SideBarGallery/index.tsx +233 -0
  151. package/src/components/SidePanel/Templates/SideBarGallery/styles.scss +152 -0
  152. package/src/components/SidePanel/Templates/TemplatesCard/V2/index.tsx +149 -0
  153. package/src/components/SidePanel/Templates/TemplatesCard/V2/styles.scss +156 -0
  154. package/src/components/SidePanel/Templates/TemplatesCard/index.tsx +160 -0
  155. package/src/components/SidePanel/Templates/TemplatesCard/styles.scss +98 -0
  156. package/src/components/SidePanel/Templates/customTemplateSection.tsx +793 -0
  157. package/src/components/SidePanel/Templates/styles.scss +244 -0
  158. package/src/components/SidePanel/index.tsx +160 -0
  159. package/src/components/TemplateBuilder/index.tsx +585 -0
  160. package/src/components/TemplateBuilder/styles.scss +100 -0
  161. package/src/components/TemplateTypes/index.tsx +96 -0
  162. package/src/components/TemplateTypes/styles.scss +91 -0
  163. package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +81 -0
  164. package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +123 -0
  165. package/src/components/TopNavigation/DuplicateTemplateModal.tsx +103 -0
  166. package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +71 -0
  167. package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +88 -0
  168. package/src/components/TopNavigation/SaveTemplateModel/index.tsx +201 -0
  169. package/src/components/TopNavigation/SaveTemplateModel/styles.scss +128 -0
  170. package/src/components/TopNavigation/index.tsx +938 -0
  171. package/src/components/TopNavigation/styles.scss +303 -0
  172. package/src/importMeta.d.ts +31 -0
  173. package/src/index.scss +131 -0
  174. package/src/index.tsx +238 -0
  175. package/src/libs/test.ts +7 -0
  176. package/src/redux/actions/action-types.ts +52 -0
  177. package/src/redux/actions/customQRCodeActions.ts +54 -0
  178. package/src/redux/actions/snackbarActions.ts +16 -0
  179. package/src/redux/actions/templateActions.ts +236 -0
  180. package/src/redux/reducers/customFieldReducer.ts +99 -0
  181. package/src/redux/reducers/customQRCodeReducer.ts +58 -0
  182. package/src/redux/reducers/index.ts +15 -0
  183. package/src/redux/reducers/snackbarReducer.ts +40 -0
  184. package/src/redux/reducers/templateReducer.ts +485 -0
  185. package/src/redux/store.ts +18 -0
  186. package/src/styles/colors.scss +61 -0
  187. package/src/test/mocks.js +89 -0
  188. package/src/test/setupJest.js +1 -0
  189. package/src/utils/api.ts +36 -0
  190. package/src/utils/constants.ts +182 -0
  191. package/src/utils/customStyles.ts +45 -0
  192. package/src/utils/fetchWrapper.ts +73 -0
  193. package/src/utils/fonts.json +1597 -0
  194. package/src/utils/helper.ts +205 -0
  195. package/src/utils/local-storage.ts +15 -0
  196. package/src/utils/message.ts +162 -0
  197. package/src/utils/products.ts +186 -0
  198. package/src/utils/template-builder.ts +328 -0
  199. package/src/utils/templateIdentifierArea/biFold.ts +107 -0
  200. package/src/utils/templateIdentifierArea/index.ts +35 -0
  201. package/src/utils/templateIdentifierArea/personal.ts +107 -0
  202. package/src/utils/templateIdentifierArea/postCards.ts +163 -0
  203. package/src/utils/templateIdentifierArea/professional.ts +125 -0
  204. package/src/utils/templateIdentifierArea/snapPack.ts +107 -0
  205. package/src/utils/templateIdentifierArea/triFold.ts +107 -0
  206. package/src/utils/templateRestrictedArea/biFold.ts +329 -0
  207. package/src/utils/templateRestrictedArea/nonWindowProfessional.ts +90 -0
  208. package/src/utils/templateRestrictedArea/personal.ts +90 -0
  209. package/src/utils/templateRestrictedArea/postCard.ts +334 -0
  210. package/src/utils/templateRestrictedArea/postCardJumbo.tsx +408 -0
  211. package/src/utils/templateRestrictedArea/professional.ts +318 -0
  212. package/src/utils/templateRestrictedArea/realPenned.ts +233 -0
  213. package/src/utils/templateRestrictedArea/snapPack.ts +1009 -0
  214. package/src/utils/templateRestrictedArea/triFold.ts +330 -0
  215. package/src/utils/templateSafetyBorders/biFold.ts +91 -0
  216. package/src/utils/templateSafetyBorders/index.ts +43 -0
  217. package/src/utils/templateSafetyBorders/personal.ts +41 -0
  218. package/src/utils/templateSafetyBorders/postCards.ts +259 -0
  219. package/src/utils/templateSafetyBorders/professional.ts +78 -0
  220. package/src/utils/templateSafetyBorders/snapPack.ts +165 -0
  221. package/src/utils/templateSafetyBorders/triFold.ts +114 -0
  222. package/src/utils/templateSafetyBorders/types.d.ts +68 -0
  223. package/src/utils/types.ts +12 -0
  224. package/src/v2Theme.scss +142 -0
  225. package/tsconfig.json +29 -0
  226. package/tsconfig.node.json +12 -0
  227. package/update-version.js +23 -0
  228. package/version.js +1 -0
  229. package/vite.config.ts +8 -0
  230. package/webpack.config.js +80 -0
@@ -0,0 +1,235 @@
1
+ import React from 'react';
2
+
3
+ // Utils
4
+ import {
5
+ TemplateCategory,
6
+ TemplateRecord,
7
+ TemplateType,
8
+ } from '../../customTemplateSection';
9
+ import {hexToRgba, removeSThroughOne} from '../../../../../utils/helper';
10
+ import {Products} from '../../../../../utils/products';
11
+
12
+ // Components
13
+ import TempCard from '../../TemplatesCard/V2';
14
+ import GeneralSelect from '../../../../GenericUIBlocks/GeneralSelect';
15
+ import Input from '../../../../GenericUIBlocks/Input';
16
+ import Dialog from '../../../../GenericUIBlocks/Dialog/V2';
17
+
18
+ // styles
19
+ import './styles.scss';
20
+
21
+ const galleryDialogStyles = {
22
+ maxWidth: '1025px',
23
+ minHeight: 'calc(100% - 50px)',
24
+ backgroundColor: '#fff',
25
+ padding: '40px 0 40px 40px',
26
+ };
27
+
28
+ type CustomTemplateSectionProps = {
29
+ product: any;
30
+ openGalleryModal: boolean;
31
+ selectedCategory: TemplateCategory | null;
32
+ templateCategories: TemplateCategory[];
33
+ currentTemplateType: TemplateType | undefined;
34
+ templateTypes: TemplateType[] | null | undefined;
35
+ designerQueryAmount?: string | number;
36
+ search: any;
37
+ searchApplied: boolean;
38
+ loader: boolean;
39
+ platformName: any;
40
+ myTemplates: TemplateRecord[];
41
+ teamTemplates: TemplateRecord[];
42
+ olcTemplates: TemplateRecord[];
43
+ pagination: any;
44
+ setSearch: any;
45
+ handleSearch: any;
46
+ removeSearchInput: any;
47
+ searchKeyDown: any;
48
+ currentTemplateTypeRef: any;
49
+ setCurrentTemplateType: any;
50
+ setSelectedCategory: any;
51
+ handleLoadTemplateModel: any;
52
+ handleTabChange: any;
53
+ handleDialogChange: any;
54
+ closeGalleryModal: any;
55
+ setOpenGalleryModal: any;
56
+ setHireDesignerModal: any;
57
+ currentTheme?: string | null | undefined;
58
+ };
59
+
60
+ const ModalGalleryV2 = (props: CustomTemplateSectionProps) => {
61
+ const {
62
+ product,
63
+ openGalleryModal,
64
+ selectedCategory,
65
+ templateCategories,
66
+ currentTemplateType,
67
+ templateTypes,
68
+ designerQueryAmount,
69
+ search,
70
+ searchApplied,
71
+ loader,
72
+ platformName,
73
+ myTemplates,
74
+ teamTemplates,
75
+ olcTemplates,
76
+ pagination,
77
+ setSearch,
78
+ handleSearch,
79
+ removeSearchInput,
80
+ searchKeyDown,
81
+ currentTemplateTypeRef,
82
+ setCurrentTemplateType,
83
+ setSelectedCategory,
84
+ handleLoadTemplateModel,
85
+ handleTabChange,
86
+ handleDialogChange,
87
+ closeGalleryModal,
88
+ setOpenGalleryModal,
89
+ setHireDesignerModal,
90
+ currentTheme,
91
+ } = props;
92
+
93
+ const primaryColorExtract = getComputedStyle(document.documentElement)
94
+ .getPropertyValue('--primary-color')
95
+ .trim();
96
+
97
+ const primaryColorRGBA = hexToRgba(primaryColorExtract, 0.5);
98
+
99
+ const currentTemplates =
100
+ currentTemplateType?.id === '1'
101
+ ? myTemplates
102
+ : currentTemplateType?.id === '2'
103
+ ? teamTemplates
104
+ : currentTemplateType?.id === '3'
105
+ ? olcTemplates
106
+ : [];
107
+
108
+ const uniqueCurrentTemplates = Array.from(
109
+ new Map(currentTemplates.map((item) => [item.id, item])).values()
110
+ );
111
+
112
+ const ModalTitle = ({title}: {title: string}) => {
113
+ return (
114
+ <>
115
+ {`${title}`}
116
+ <span
117
+ style={{
118
+ fontSize: '16px',
119
+ fontWeight: '400',
120
+ color: '#00000099',
121
+ marginLeft: '12px',
122
+ fontFamily: 'var(--font-family)',
123
+ }}
124
+ >{`(${removeSThroughOne(`${currentTemplates.length > 0 ? pagination.total : 0} templates`)})`}</span>
125
+ </>
126
+ );
127
+ };
128
+
129
+ return (
130
+ <>
131
+ <Dialog
132
+ customStyles={galleryDialogStyles}
133
+ open={openGalleryModal}
134
+ handleClose={closeGalleryModal}
135
+ isGallery={true}
136
+ currentTheme="v2"
137
+ title={
138
+ <ModalTitle
139
+ title={
140
+ product?.productType === 'Postcards'
141
+ ? `${product?.productType} (${product?.selectedSize || product?.paperSize}) `
142
+ : product?.productType === 'Real Penned Letter'
143
+ ? 'Real Penned ' +
144
+ product?.size.find(
145
+ (item: {id: any}) => item?.id === product?.id
146
+ )?.title
147
+ : Products?.find((item) => item?.id === product?.id)?.title ||
148
+ product?.productType
149
+ }
150
+ />
151
+ }
152
+ >
153
+ <div className="topBar-v2">
154
+ <div className="filters-container">
155
+ {currentTemplateType?.id === '3' &&
156
+ templateCategories?.length > 1 && (
157
+ <div className="filter-select" style={{minWidth: '200px'}}>
158
+ <>
159
+ <GeneralSelect
160
+ placeholder="Industry/Theme"
161
+ options={templateCategories as any}
162
+ setSelectedValue={setSelectedCategory as any}
163
+ selectedValue={selectedCategory as any}
164
+ builderSelect={false}
165
+ gallerySelect={true}
166
+ clearField={true}
167
+ search={false}
168
+ isError={false}
169
+ currentTheme="v2"
170
+ />
171
+ </>
172
+ </div>
173
+ )}
174
+ <div className="filter-select" style={{minWidth: '180px'}}>
175
+ <GeneralSelect
176
+ placeholder="All Templates"
177
+ options={templateTypes || []}
178
+ setSelectedValue={setCurrentTemplateType as any}
179
+ selectedValue={currentTemplateType as any}
180
+ builderSelect={false}
181
+ gallerySelect={true}
182
+ clearField={false}
183
+ search={false}
184
+ isError={false}
185
+ currentTheme="v2"
186
+ />
187
+ </div>
188
+ </div>
189
+ <Input
190
+ type="text"
191
+ value={search}
192
+ // @ts-ignore
193
+ onKeyDown={searchKeyDown}
194
+ onChange={(e: any) => setSearch(e.target.value.trimStart())}
195
+ placeholder="Search templates"
196
+ onClick={handleSearch}
197
+ searchApplied={searchApplied}
198
+ removeSearchInput={removeSearchInput}
199
+ inputIcon={true}
200
+ gellerySearch={true}
201
+ currentTheme="v2"
202
+ className="searchInput-v2"
203
+ />
204
+ </div>
205
+ <div
206
+ className={`templatesContent-v2 ${currentTemplateType?.id === '3' && 'heightOLC-v2'}`}
207
+ style={{
208
+ justifyContent: 'flex-start',
209
+ alignItems: 'center',
210
+ overflowY:
211
+ product?.productType === 'Personal Letters' &&
212
+ currentTemplates.length === 0
213
+ ? 'hidden'
214
+ : 'scroll',
215
+ }}
216
+ >
217
+ <TempCard
218
+ templates={uniqueCurrentTemplates}
219
+ handleLoadTemplateModel={handleLoadTemplateModel}
220
+ loading={loader}
221
+ platformName={platformName}
222
+ currentTemplateType={currentTemplateType}
223
+ product={product}
224
+ searchApplied={searchApplied}
225
+ primaryColorRGBA={primaryColorRGBA}
226
+ designerQueryAmount={designerQueryAmount}
227
+ currentTheme="v2"
228
+ />
229
+ </div>
230
+ </Dialog>
231
+ </>
232
+ );
233
+ };
234
+
235
+ export default ModalGalleryV2;
@@ -0,0 +1,244 @@
1
+ .polotno-panel-container {
2
+ overflow-y: auto;
3
+
4
+ & .custom-template-section {
5
+ display: 'flex';
6
+ flex-wrap: 'wrap';
7
+ overflow-y: 'scroll';
8
+
9
+ & .title {
10
+ & span {
11
+ font-size: 16px;
12
+ font-weight: 600;
13
+ color: #ed5c2f;
14
+ }
15
+ }
16
+ @mixin designCommonStyles {
17
+ width: 320px;
18
+ height: 224px;
19
+ border-radius: 3px;
20
+ border: 0.5px solid var(--border-color);
21
+ margin: 10px auto;
22
+ cursor: pointer;
23
+ }
24
+ & .default-design {
25
+ @include designCommonStyles;
26
+ display: flex;
27
+ flex-direction: column;
28
+ align-items: center;
29
+ justify-content: center;
30
+ & p {
31
+ color: #303030;
32
+ font-weight: 600;
33
+ font-size: 12px;
34
+ line-height: 14.52px;
35
+ margin-top: 5px;
36
+ }
37
+ }
38
+ & .design-template {
39
+ @include designCommonStyles;
40
+ & img {
41
+ width: 100%;
42
+ height: 100%;
43
+ object-fit: cover;
44
+ }
45
+ }
46
+ }
47
+
48
+ .dummy-image {
49
+ padding: 85px;
50
+ object-fit: fill !important;
51
+ }
52
+
53
+ .MuiTabs-indicator {
54
+ background-color: #ed5c2f !important;
55
+ }
56
+
57
+ .templateTabsWrapper {
58
+ width: 100%;
59
+ max-width: 480px;
60
+
61
+ @media (width <= 800px) {
62
+ max-width: none !important;
63
+ }
64
+
65
+ .templateTabs {
66
+ .MuiTabScrollButton-root {
67
+ width: 15px;
68
+ opacity: 1 !important;
69
+ &:hover {
70
+ svg {
71
+ color: #ed5c2f !important;
72
+ }
73
+ }
74
+ .Mui-disabled {
75
+ opacity: 1 !important;
76
+ }
77
+ }
78
+ }
79
+ }
80
+
81
+ .noTemplateText {
82
+ height: 100%;
83
+ min-height: 200px;
84
+ display: flex;
85
+ justify-content: center;
86
+ align-items: center;
87
+ width: 100%;
88
+ p {
89
+ color: var(--text-color);
90
+ font-size: 18px;
91
+ font-style: normal;
92
+ font-weight: 400;
93
+ line-height: normal;
94
+ }
95
+ }
96
+
97
+ .searchWrapper {
98
+ margin: 16px 0;
99
+ }
100
+ }
101
+
102
+ .topBar-v2 {
103
+ display: flex;
104
+ justify-content: space-between;
105
+ gap: 16px;
106
+ align-items: center;
107
+ flex-wrap: wrap;
108
+ width: 100%;
109
+ position: relative;
110
+ gap: 10px;
111
+ margin: 24px 0 10px;
112
+ padding-right: 40px;
113
+
114
+ @media (width <= 930px){
115
+ flex-direction: column-reverse;
116
+ justify-content: center;
117
+ }
118
+
119
+ @media (width <= 768px){
120
+ padding: 0 15px 20px;
121
+ }
122
+
123
+ .filters-container {
124
+ display: flex;
125
+ gap: 16px;
126
+ align-items: center;
127
+ flex-wrap: wrap;
128
+
129
+ @media (width <= 768px){
130
+ gap: 10px;
131
+ }
132
+
133
+ .filter-select {
134
+
135
+ @media (width <= 768px){
136
+ min-width: 100%;
137
+ }
138
+
139
+ .select-layout-v2 {
140
+ margin: 0;
141
+ gap: 0;
142
+ }
143
+ }
144
+ }
145
+ }
146
+ .selectBar {
147
+ display: flex;
148
+ justify-content: space-between;
149
+ align-items: center;
150
+ width: 100%;
151
+ margin-top: 25px;
152
+ padding: 0 35px;
153
+
154
+ p {
155
+ color: #6A6565 !important;
156
+ font-weight: 400 !important;
157
+ font-size: 14px !important;
158
+ margin: 0;
159
+ width: 100%;
160
+ text-align: end;
161
+ }
162
+ }
163
+
164
+ .templatesContent-v2 {
165
+ display: flex;
166
+ justify-content: flex-start;
167
+ align-items: flex-start;
168
+ flex-direction: row;
169
+ flex-wrap: wrap;
170
+ // padding: 15px 35px 0;
171
+ gap: 16px;
172
+ height: 100%;
173
+ max-height: calc(100vh - 248px);
174
+ overflow-y: scroll;
175
+ margin-top: 10px;
176
+ width: 100%;
177
+ padding-right: 30px;
178
+
179
+ @media (width <= 1340px){
180
+ justify-content: center !important;
181
+ }
182
+
183
+ @media (width <= 1125px){
184
+ max-height: calc(100vh - 320px);
185
+ }
186
+
187
+ &::-webkit-scrollbar {
188
+ width: 8px;
189
+ }
190
+
191
+ &::-webkit-scrollbar-track {
192
+ background: transparent !important;
193
+ border-radius: 1px;
194
+ }
195
+
196
+ &::-webkit-scrollbar-thumb {
197
+ background: var(--scrollbar-thumb-color) !important;
198
+ border-radius: 10px;
199
+ }
200
+
201
+ @supports not selector(::-webkit-scrollbar) {
202
+ body {
203
+ scrollbar-color: var(--scrollbar-thumb-color) var(--scrollbar-track-color);
204
+ }
205
+ }
206
+
207
+ .defaultDesign {
208
+ display: flex;
209
+ flex-direction: column;
210
+ align-items: center;
211
+ justify-content: center;
212
+ width: 100%;
213
+ min-width: 440px;
214
+ height: 100%;
215
+ min-height: 358px;
216
+ flex: 0 440px;
217
+ cursor: pointer;
218
+ border: 0.36px solid #00000066;
219
+ padding: 20px;
220
+ border-radius: 12px;
221
+ padding: 1.5px;
222
+ position: relative;
223
+
224
+ p {
225
+ color: var(--text-color);
226
+ font-weight: 600;
227
+ font-size: 12px;
228
+ line-height: 14.52px;
229
+ margin-top: 5px;
230
+ }
231
+
232
+ .ownHeading-v2{
233
+ color: var(--text-color);
234
+ font-weight: 400 !important;
235
+ font-size: 18px !important;
236
+ line-height: 14.52px;
237
+ position: absolute;
238
+ bottom: 20px;
239
+ left: 20px;
240
+ }
241
+
242
+ }
243
+ }
244
+
@@ -0,0 +1,231 @@
1
+ import React from 'react';
2
+
3
+ // Utils
4
+ import { TemplateCategory, TemplateRecord, TemplateType } from '../customTemplateSection';
5
+ import { hexToRgba, removeSThroughOne } from '../../../../utils/helper';
6
+ import { Products } from '../../../../utils/products';
7
+
8
+ // Components
9
+ import TempCard from '../TemplatesCard';
10
+ import Tabs from '../../../GenericUIBlocks/Tabs';
11
+ import Typography from '../../../GenericUIBlocks/Typography';
12
+ import GeneralSelect from '../../../GenericUIBlocks/GeneralSelect';
13
+ import Input from '../../../GenericUIBlocks/Input';
14
+ import Dialog from '../../../GenericUIBlocks/Dialog';
15
+
16
+ // Icons
17
+ import DesignIcon from '../../../../assets/images/templates/template-default-design';
18
+ import Designer from '../../../../assets/images/templates/designer';
19
+
20
+ const galleryDialogStyles = {
21
+ maxWidth: '1090px',
22
+ minHeight: 'calc(100% - 50px)',
23
+ };
24
+
25
+ type CustomTemplateSectionProps = {
26
+ product: any,
27
+ openGalleryModal: boolean,
28
+ selectedCategory: TemplateCategory | null,
29
+ templateCategories: TemplateCategory[],
30
+ currentTemplateType: TemplateType | undefined,
31
+ templateTypes: TemplateType[] | null | undefined,
32
+ designerQueryAmount?: string | number;
33
+ search: any,
34
+ searchApplied: boolean,
35
+ loader: boolean,
36
+ platformName: any,
37
+ myTemplates: TemplateRecord[],
38
+ teamTemplates: TemplateRecord[],
39
+ olcTemplates: TemplateRecord[],
40
+ pagination: any,
41
+ setSearch: any,
42
+ handleSearch: any,
43
+ removeSearchInput: any,
44
+ searchKeyDown: any,
45
+ currentTemplateTypeRef: any,
46
+ setCurrentTemplateType: any,
47
+ setSelectedCategory: any,
48
+ handleLoadTemplateModel: any,
49
+ handleTabChange: any,
50
+ handleDialogChange: any,
51
+ closeGalleryModal: any,
52
+ setOpenGalleryModal: any
53
+ setHireDesignerModal: any;
54
+ };
55
+
56
+
57
+ const ModalGallery = (props: CustomTemplateSectionProps) => {
58
+
59
+ const {
60
+ product,
61
+ openGalleryModal,
62
+ selectedCategory,
63
+ templateCategories,
64
+ currentTemplateType,
65
+ templateTypes,
66
+ designerQueryAmount,
67
+ search,
68
+ searchApplied,
69
+ loader,
70
+ platformName,
71
+ myTemplates,
72
+ teamTemplates,
73
+ olcTemplates,
74
+ pagination,
75
+ setSearch,
76
+ handleSearch,
77
+ removeSearchInput,
78
+ searchKeyDown,
79
+ currentTemplateTypeRef,
80
+ setSelectedCategory,
81
+ handleLoadTemplateModel,
82
+ handleTabChange,
83
+ handleDialogChange,
84
+ closeGalleryModal,
85
+ setOpenGalleryModal,
86
+ setHireDesignerModal,
87
+ } = props;
88
+
89
+ const primaryColorExtract = getComputedStyle(document.documentElement).getPropertyValue('--primary-color').trim();
90
+
91
+ const primaryColorRGBA = hexToRgba(primaryColorExtract, 0.5);
92
+
93
+ const currentTemplates = currentTemplateType?.id === '1'
94
+ ? myTemplates
95
+ : currentTemplateType?.id === '2'
96
+ ? teamTemplates
97
+ : currentTemplateType?.id === '3'
98
+ ? olcTemplates
99
+ : []
100
+
101
+ const uniqueCurrentTemplates = Array.from(
102
+ new Map(currentTemplates.map((item) => [item.id, item])).values()
103
+ );
104
+
105
+ return (
106
+ <>
107
+ <Dialog
108
+ customStyles={galleryDialogStyles}
109
+ open={openGalleryModal}
110
+ handleClose={closeGalleryModal}
111
+ title={
112
+ product?.productType === 'Postcards'
113
+ ? `${product?.productType} (${product?.label || product?.paperSize || product?.selectedSize})`
114
+ : product?.productType === 'Real Penned Letter' ? product.id == '16' ? "Real Penned Personal Letter" : "Real Penned Professional Letter"
115
+ : Products?.find(item => item?.id === product?.id)?.title || product?.productType
116
+ }
117
+ isGallery={true}
118
+ >
119
+ <div className="topBar">
120
+ <div>
121
+ <Tabs
122
+ value={currentTemplateType || {}}
123
+ onChange={handleTabChange}
124
+ tabs={templateTypes || []}
125
+ className="myCustomTabs"
126
+ tabClassName="myTab"
127
+ indicatorClassName="myIndicator"
128
+ />
129
+ </div>
130
+ <div>
131
+ <Input
132
+ type="text"
133
+ value={search}
134
+ // @ts-ignore
135
+ onKeyDown={searchKeyDown}
136
+ onChange={(e: any) => setSearch(e.target.value.trimStart())}
137
+ placeholder="Search templates by name or ID"
138
+ onClick={handleSearch}
139
+ searchApplied={searchApplied}
140
+ removeSearchInput={removeSearchInput}
141
+ inputIcon={true}
142
+ gellerySearch={true}
143
+ />
144
+ </div>
145
+ </div>
146
+ <div className="selectBar">
147
+ {currentTemplateType?.id === '3' &&
148
+ templateCategories?.length > 1 && (
149
+ <div>
150
+ <GeneralSelect
151
+ placeholder="Select Category"
152
+ options={templateCategories as any}
153
+ setSelectedValue={setSelectedCategory as any}
154
+ selectedValue={selectedCategory as any}
155
+ builderSelect={true}
156
+ gallerySelect={true}
157
+ clearField={true}
158
+ search={false}
159
+ isError={false}
160
+ />
161
+ </div>
162
+ )}
163
+ <Typography>{removeSThroughOne(`${currentTemplates.length > 0 ? pagination.total : 0} templates`)}</Typography>
164
+ </div>
165
+ <div className={`templatesContent ${currentTemplateType?.id === '3' && "heightOLC"}`} style={{
166
+ justifyContent: loader || searchApplied ? "center" : "flex-start",
167
+ alignItems: searchApplied ? "center" : "flex-start",
168
+ height: searchApplied ? "calc(100vh - 300px)" : "auto",
169
+ overflowY: product?.productType === "Personal Letters" && currentTemplates.length === 0 ? "hidden" : "scroll"
170
+ }}>
171
+ {!loader && !searchApplied && currentTemplateTypeRef.current?.id === '1' && (
172
+ <div>
173
+ <div
174
+ className={`defaultDesign
175
+ ${product?.id === '13' &&
176
+ product?.size?.find((product: any) => product?.size === "4x6") || product?.paperSize === "4x6" ? "postcard-4x6"
177
+ : product?.id === '15' && product?.size?.find((product: any) => product?.size === "6x11") || product?.paperSize === "6x11" ? "postcard-6x11"
178
+ : product?.id === '14' && product?.size?.find((product: any) => product?.size === "6x9") || product?.paperSize === "6x9" ? "postcard-6x9"
179
+ : product?.id === '5' || product?.id === '16' ? 'personalLetter' : product?.id === '2' || product?.id === '4' || product?.id === '18' || product?.id === '38' ? 'professionalLetter' : product?.id === '9' ? 'biFold' : product?.id === '11' || product?.id === "21" ? 'triFold' : null}`}
180
+ onClick={() => handleDialogChange('design-own')}
181
+ style={{
182
+ boxShadow: `inset 0 0 0 2px ${primaryColorRGBA}`
183
+ }}
184
+ >
185
+ <DesignIcon fill="var(--primary-color)" />
186
+ <Typography>Design Your Own</Typography>
187
+ </div>
188
+ <Typography className='ownHeading'>Design Your Own</Typography>
189
+ </div>
190
+ )}
191
+ {!loader && !searchApplied && currentTemplateTypeRef.current?.id !== '2' && designerQueryAmount && (
192
+ <div>
193
+ <div
194
+ className={`defaultDesign
195
+ ${product?.id === '13' &&
196
+ product?.size?.find((product: any) => product?.size === "4x6") || product?.paperSize === "4x6" ? "postcard-4x6"
197
+ : product?.id === '15' && product?.size?.find((product: any) => product?.size === "6x11") || product?.paperSize === "6x11" ? "postcard-6x11"
198
+ : product?.id === '14' && product?.size?.find((product: any) => product?.size === "6x9") || product?.paperSize === "6x9" ? "postcard-6x9"
199
+ : product?.id === '5' || product?.id === '16' ? 'personalLetter' : product?.id === '2' || product?.id === '4' || product?.id === '18' || product?.id === '38' ? 'professionalLetter' : product?.id === '9' ? 'biFold' : product?.id === '11' || product?.id === "21" ? 'triFold' : null}`}
200
+ onClick={() => {
201
+ setOpenGalleryModal(false);
202
+ setHireDesignerModal(true);
203
+ }}
204
+ style={{
205
+ boxShadow: `inset 0 0 0 2px ${primaryColorRGBA}`
206
+ }}
207
+ >
208
+ <Designer fill="var(--primary-color)" />
209
+ <Typography>Hire a Designer</Typography>
210
+ </div>
211
+ <Typography className='ownHeading'>Hire a Designer +${designerQueryAmount}</Typography>
212
+ </div>
213
+ )}
214
+ <TempCard
215
+ templates={uniqueCurrentTemplates}
216
+ handleLoadTemplateModel={handleLoadTemplateModel}
217
+ loading={loader}
218
+ platformName={platformName}
219
+ currentTemplateType={currentTemplateType}
220
+ product={product}
221
+ searchApplied={searchApplied}
222
+ primaryColorRGBA={primaryColorRGBA}
223
+ designerQueryAmount={designerQueryAmount}
224
+ />
225
+ </div>
226
+ </Dialog>
227
+ </>
228
+ );
229
+ }
230
+
231
+ export default ModalGallery;