@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,80 +0,0 @@
1
- .block-colors-section {
2
- padding: 16px;
3
-
4
- .block-colors-header {
5
- margin-bottom: 20px;
6
-
7
- .title {
8
- font-size: 14px;
9
- font-weight: 600;
10
- color: var(--text-color);
11
- margin-bottom: 8px;
12
- line-height: 1.4;
13
- }
14
-
15
- .description {
16
- font-size: 12px;
17
- color: var(--text-color);
18
- opacity: 0.8;
19
- line-height: 1.4;
20
- }
21
- }
22
-
23
- .color-palette {
24
- display: grid;
25
- grid-template-columns: repeat(6, 1fr);
26
- gap: 8px;
27
- max-width: 100%;
28
-
29
- .color-swatch {
30
- width: 100%;
31
- aspect-ratio: 1;
32
- border: 1px solid #e0e0e0;
33
- border-radius: 4px;
34
- cursor: pointer;
35
- transition: all 0.2s ease;
36
- position: relative;
37
-
38
- &:hover {
39
- transform: scale(1.05);
40
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
41
- }
42
-
43
- &.selected {
44
- border: 2px solid var(--primary-color);
45
- box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
46
-
47
- &::after {
48
- content: '✓';
49
- position: absolute;
50
- top: 50%;
51
- left: 50%;
52
- transform: translate(-50%, -50%);
53
- color: #000;
54
- font-weight: bold;
55
- font-size: 12px;
56
- text-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
57
- }
58
- }
59
- }
60
- }
61
- }
62
-
63
- // Responsive adjustments
64
- @media (max-width: 768px) {
65
- .block-colors-section {
66
- .color-palette {
67
- grid-template-columns: repeat(4, 1fr);
68
- gap: 6px;
69
- }
70
- }
71
- }
72
-
73
- @media (max-width: 480px) {
74
- .block-colors-section {
75
- .color-palette {
76
- grid-template-columns: repeat(3, 1fr);
77
- gap: 4px;
78
- }
79
- }
80
- }
@@ -1,547 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
-
3
- // Polotno and thrid party libraries
4
- import { observer } from 'mobx-react-lite';
5
- import { SectionTab, } from 'polotno/side-panel';
6
- import type { StoreType } from 'polotno/model/store';
7
- import type { TemplatesSection } from 'polotno/side-panel';
8
-
9
- // Hooks
10
- import { useDispatch, useSelector } from 'react-redux';
11
- import { AppDispatch, RootState } from '../../../redux/store';
12
-
13
- // Actions
14
- import { failure, success } from '../../../redux/actions/snackbarActions';
15
- import { SET_CUSTOM_FIELDS, SET_CUSTOM_FIELDS_V2, SET_PLATFORM_FIELDS } from '../../../redux/actions/action-types';
16
-
17
- // Components
18
- import Button from '../../GenericUIBlocks/Button';
19
- import GeneralTootip from '../../GenericUIBlocks/GeneralTooltip';
20
-
21
- // Utils
22
- import { copyToClipboard } from '../../../utils/helper';
23
-
24
- // Icons
25
- import InfoIcon from '../../../assets/images/templates/info-icon';
26
- import ContentCopyIcon from '../../..//assets/images/templates/content-copy-icon';
27
- import Field from '../../../assets/images/templates/field';
28
-
29
- // Styles
30
- import './styles.scss'
31
-
32
-
33
- type SideSection = typeof TemplatesSection;
34
-
35
- const iconButtonStyles = {
36
- backgroundColor: 'transparent',
37
- }
38
-
39
- type CustomFieldsSectionProps = {
40
- store: StoreType;
41
- active: boolean;
42
- allowSenderFields?: boolean;
43
- allowPropertyFields?: boolean;
44
- excludedFields?: string[] | null;
45
- platformName?: string,
46
- onClick: () => void;
47
- onGetCustomFields?: () => Promise<any>;
48
- };
49
-
50
- const CustomFieldSection: SideSection = {
51
- name: 'Fields',
52
- Tab: observer(
53
- (props: { store: StoreType; active: boolean; onClick: () => void }) => (
54
- <SectionTab name="Fields" {...props}>
55
- <Field fill="var(--text-color)" />
56
- </SectionTab>
57
- )
58
- ) as SideSection['Tab'],
59
-
60
- Panel: observer(({ store, onGetCustomFields, allowSenderFields, excludedFields, allowPropertyFields, platformName }: CustomFieldsSectionProps) => {
61
- const [isShowDialog, setIsShowDialog] = useState(false);
62
- const [search, setSearch] = useState('');
63
- const [filteredDynamicFields, setFilteredDynamicFields] = useState([]);
64
- const [filteredCustomFields, setFilteredCustomFields] = useState([]);
65
- const [filteredMiscFields, setFilteredMiscFields] = useState([]);
66
- const [filteredPropertyFields, setFilteredPropertyFields] = useState([]);
67
- const [filteredCustomFieldsV2, setFilteredCustomFieldsV2] = useState([]);
68
- const [filteredSenderFields, setFilteredSenderFields] = useState([]);
69
- const [filteredPlatformFields, setFilteredPlatformFields] = useState([]);
70
-
71
-
72
- const dispatch = useDispatch<AppDispatch>();
73
-
74
- const customFields = useSelector(
75
- (state: RootState) => state.customFields.customFields
76
- ) as Record<string, any>;
77
-
78
- const customFieldsV2 = useSelector(
79
- (state: RootState) => state.customFields.customFieldsV2
80
- ) as Record<string, any>;
81
-
82
- const platformFields = useSelector(
83
- (state: RootState) => state.customFields.platformFields
84
- ) as Record<string, any>;
85
-
86
- const defaultDynamicFields = useSelector(
87
- (state: RootState) => state.customFields.defaultDynamicFields
88
- ) as Record<string, any>;
89
-
90
- const defaultSenderFields = useSelector(
91
- (state: RootState) => state.templates.defaultSenderFields
92
- ) as Record<string, any>;
93
-
94
- const defaultPropertyFields = useSelector(
95
- (state: RootState) => state.templates.defaultPropertyFields
96
- ) as Record<string, any>;
97
-
98
- const defaultMiscFields = useSelector(
99
- (state: RootState) => state.templates.defaultMiscFields
100
- ) as Record<string, any>;
101
-
102
- const product = useSelector((state: RootState) => state.templates.product);
103
- const currentTemplateType = product?.productType;
104
- const currentProductId = product?.id || '';
105
-
106
- const handleShowDialog = () => {
107
- setIsShowDialog((prev) => !prev);
108
- };
109
-
110
- const fetchCustomFields = async () => {
111
- if (onGetCustomFields) {
112
- const allCustomFields: any = await onGetCustomFields();
113
- const platformFields: any = [];
114
- const customFields: any = [];
115
-
116
-
117
- if (allCustomFields?.version === 'v2') {
118
- const flattenedFields = allCustomFields.customFields.flatMap((section: { fields: any; }) => section.fields);
119
-
120
- for (const field of flattenedFields) {
121
- (field.isPlatformField ? platformFields : customFields).push(field);
122
- }
123
- const filteredCustomFields = allCustomFields?.customFields
124
- .map((customField: any) => ({
125
- ...customField,
126
- fields: customField.fields.filter((field: any) => customFields.includes(field))
127
- }))
128
- .filter((section: { fields: any[] }) => section.fields.length > 0);
129
-
130
- if (allCustomFields?.customFields?.length) {
131
- dispatch({ type: SET_CUSTOM_FIELDS, payload: [] });
132
- dispatch({ type: SET_CUSTOM_FIELDS_V2, payload: filteredCustomFields });
133
- } else {
134
- dispatch({ type: SET_CUSTOM_FIELDS, payload: [] });
135
- dispatch({ type: SET_CUSTOM_FIELDS_V2, payload: [] });
136
- }
137
-
138
- if (platformFields.length) {
139
- dispatch({ type: SET_PLATFORM_FIELDS, payload: platformFields });
140
- } else {
141
- dispatch({ type: SET_PLATFORM_FIELDS, payload: [] });
142
- }
143
-
144
- } else {
145
-
146
- for (const field of allCustomFields) {
147
- (field.isPlatformField ? platformFields : customFields).push(field);
148
- }
149
-
150
- if (customFields.length) {
151
- dispatch({ type: SET_CUSTOM_FIELDS, payload: customFields });
152
- } else {
153
- dispatch({ type: SET_CUSTOM_FIELDS, payload: [] });
154
- }
155
-
156
- if (platformFields.length) {
157
- dispatch({ type: SET_PLATFORM_FIELDS, payload: platformFields });
158
- } else {
159
- dispatch({ type: SET_PLATFORM_FIELDS, payload: [] });
160
- }
161
- }
162
- }
163
- };
164
-
165
- const copyCustomFieldText = (key: string, value: string = '') => {
166
- if (currentTemplateType === 'Real Penned Letter' && +currentProductId === 16) {
167
- let modifiedString = key.replace(/{{/g, '((').replace(/}}/g, '))');
168
- copyToClipboard(modifiedString);
169
- dispatch(success(`${value} Copied`));
170
- } else {
171
- copyToClipboard(key);
172
- dispatch(success(`${value} Copied`));
173
- }
174
- };
175
-
176
- useEffect(() => {
177
- fetchCustomFields();
178
- }, []);
179
-
180
- useEffect(() => {
181
- setFilteredDynamicFields(
182
- defaultDynamicFields
183
- ?.filter(({ key }: any) => !excludedFields?.includes(key))
184
- .filter(({ value }: any) =>
185
- value?.toLowerCase().includes(search?.toLowerCase())
186
- )
187
- );
188
-
189
- setFilteredMiscFields(defaultMiscFields.filter(({ value }: any) =>
190
- value?.toLowerCase().includes(search?.toLowerCase())
191
- ))
192
-
193
- setFilteredPropertyFields(
194
- allowPropertyFields
195
- ? defaultPropertyFields
196
- ?.filter(({ key }: any) => !excludedFields?.includes(key))
197
- ?.filter(({ value }: any) =>
198
- value?.toLowerCase().includes(search?.toLowerCase())
199
- )
200
- : []
201
- );
202
-
203
- setFilteredSenderFields(
204
- allowSenderFields
205
- ? defaultSenderFields?.filter(({ key }: any) => !excludedFields?.includes(key))?.filter(({ value }: any) =>
206
- value?.toLowerCase().includes(search?.toLowerCase())
207
- )
208
- : []
209
- );
210
-
211
- setFilteredPlatformFields(platformFields
212
- ?.filter(({ key }: any) => !excludedFields?.includes(key))
213
- ?.filter(({ value }: any) =>
214
- value?.toLowerCase().includes(search?.toLowerCase())
215
- ));
216
-
217
- setFilteredCustomFields(customFields
218
- ?.filter(({ key }: any) => !excludedFields?.includes(key))
219
- ?.filter(({ value }: any) =>
220
- value?.toLowerCase().includes(search?.toLowerCase())
221
- ));
222
-
223
- if (customFieldsV2.length) {
224
- const newFilteredData = customFieldsV2
225
- .map((section: { fields: any[]; }) => ({
226
- ...section,
227
- fields: section.fields.filter((field: { value: string; }) =>
228
- field.value?.toLowerCase().includes(search?.toLowerCase())
229
- )
230
- })).filter((section: any) => section?.fields?.length > 0);
231
-
232
- setFilteredCustomFieldsV2(newFilteredData);
233
- } else {
234
- setFilteredDynamicFields(
235
- defaultDynamicFields
236
- ?.filter(({ key }: any) => !excludedFields?.includes(key))
237
- ?.filter(({ value }: any) =>
238
- value?.toLowerCase().includes(search?.toLowerCase())
239
- )
240
- );
241
- }
242
-
243
- }, [search, defaultSenderFields, platformFields, customFields, defaultDynamicFields, customFieldsV2]);
244
-
245
- return (
246
- <div style={{
247
- height: "100%",
248
- display: "flex",
249
- flexDirection: "column"
250
- }}>
251
- <div className="bp5-input-group fields-search">
252
- <span aria-hidden="true" className="bp5-icon bp5-icon-search">
253
- <svg data-icon="search" height="16" role="img" viewBox="0 0 16 16" width="16">
254
- <path d="M15.55 13.43l-2.67-2.68a6.94 6.94 0 001.11-3.76c0-3.87-3.13-7-7-7s-7 3.13-7 7 3.13 7 7 7c1.39 0 2.68-.42 3.76-1.11l2.68 2.67a1.498 1.498 0 102.12-2.12zm-8.56-1.44c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z" fillRule="evenodd"></path>
255
- </svg>
256
- </span>
257
- <input type="search" placeholder="Search..." className="bp5-input"
258
- onChange={(e) => setSearch(e.target.value)}
259
- value={search}
260
- />
261
- </div>
262
- <div className="dynamic-content">
263
- {filteredDynamicFields.length > 0 &&
264
- <>
265
- <div className="dynamic-content__top">
266
- <div>
267
- <span className="title">Contact Fields</span>
268
- <InfoIcon fill="var(--primary-color)" className="infoIcon" />
269
- <GeneralTootip
270
- anchorSelect=".infoIcon"
271
- place="bottom"
272
- className='contact-info-tooltip'
273
- title="Merge fields allow you to personalize your mailer with contact information."
274
- />
275
- </div>
276
- </div>
277
- {filteredDynamicFields
278
- ?.map(
279
- ({ key, value }: { key: string; value: string }, i: number) => (
280
- <div style={{ display: 'flex', alignItems: 'center' }} key={i + '_contact'}>
281
- <span
282
- className="contact-element"
283
- onClick={() =>
284
- copyCustomFieldText(key, value)
285
- }
286
- >
287
- {value}
288
- </span>
289
- <Button
290
- style={iconButtonStyles}
291
- onClick={() => copyCustomFieldText(key, value)}
292
- backdrop={false}
293
- >
294
- <ContentCopyIcon className="copy" />
295
- </Button>
296
- </div>
297
- )
298
- )}
299
- </>}
300
- {allowPropertyFields && filteredPropertyFields.length > 0 && <>
301
- <hr className="divider" />
302
- <div className="dynamic-content__top">
303
- <div>
304
- <span className="title">Property Address</span>
305
- <InfoIcon fill="var(--primary-color)" className="property" />
306
- <GeneralTootip
307
- anchorSelect=".property"
308
- place="bottom"
309
- title="You can add property fields to your template."
310
- />
311
- </div>
312
- </div>
313
- {filteredPropertyFields
314
- ?.map(
315
- ({ key, value }: { key: string; value: string }, i: number) => (
316
- <div style={{ display: 'flex', alignItems: 'center' }} key={i + '_property'}>
317
- <span
318
- className="contact-element"
319
- onClick={() =>
320
- copyCustomFieldText(key, value)
321
- }
322
- >
323
- {value}
324
- </span>
325
- <Button
326
- style={iconButtonStyles}
327
- onClick={() => copyCustomFieldText(key, value)}
328
- backdrop={false}
329
- >
330
- <ContentCopyIcon className="copy" />
331
- </Button>
332
- </div>
333
- )
334
- )}
335
- </>}
336
- {allowSenderFields && filteredSenderFields.length > 0 && <>
337
- <hr className="divider" />
338
- <div className="dynamic-content__top">
339
- <div>
340
- <span className="title">Sender Fields</span>
341
- <InfoIcon fill="var(--primary-color)" className="sender" />
342
- <GeneralTootip
343
- anchorSelect=".sender"
344
- place="bottom"
345
- title="You can add sender fields to your template."
346
- />
347
- </div>
348
- </div>
349
- {filteredSenderFields
350
- ?.map(
351
- ({ key, value }: { key: string; value: string }, i: number) => (
352
- <div style={{ display: 'flex', alignItems: 'center' }} key={i + '_sender'}>
353
- <span
354
- className="contact-element"
355
- onClick={() =>
356
- copyCustomFieldText(key, value)
357
- }
358
- >
359
- {value}
360
- </span>
361
- <Button
362
- style={iconButtonStyles}
363
- onClick={() => copyCustomFieldText(key, value)}
364
- backdrop={false}
365
- >
366
- <ContentCopyIcon className="copy" />
367
- </Button>
368
- </div>
369
- )
370
- )}
371
- </>}
372
- <GeneralTootip anchorSelect=".copy" place="bottom" title="Copy" />
373
- {onGetCustomFields && platformFields?.length > 0 && (
374
- <>
375
- <hr className="divider" />
376
- <div className="dynamic-content__top">
377
- <div>
378
- <span className="title">{platformName ? `${platformName} Fields` : 'OLC Fields'}</span>
379
- <InfoIcon fill="var(--primary-color)" className="platform" />
380
- <GeneralTootip
381
- anchorSelect=".platform"
382
- place="bottom"
383
- title={`You can add ${platformName ? `${platformName} Fields` : 'OLC Fields'} to your template.`}
384
- />
385
- </div>
386
- <Button onClick={handleShowDialog}></Button>
387
- </div>
388
- {filteredPlatformFields
389
- ?.map(
390
- ({ key, value }: { key: string; value: string }, i: number) => (
391
- <div style={{ display: 'flex', alignItems: 'center' }} key={i + '_platform'}>
392
- <span
393
- className="contact-element"
394
- onClick={() =>
395
- copyCustomFieldText(key, value)
396
- }
397
- >
398
- {value}
399
- </span>
400
- <Button
401
- style={iconButtonStyles}
402
- onClick={() => copyCustomFieldText(key, value)}
403
- backdrop={false}
404
- >
405
- <ContentCopyIcon className="copy" />
406
- </Button>
407
- </div>
408
- )
409
- )}
410
- </>
411
- )
412
- }
413
- {onGetCustomFields && filteredCustomFieldsV2.length > 0 ?
414
- filteredCustomFieldsV2.map((section: any, index: number): any => (
415
- <div key={index + 'custom-section'}>
416
- <hr className="divider" />
417
- <div className="dynamic-content__top">
418
- <div>
419
- <span className="title">{section?.section}</span>
420
- <InfoIcon fill="var(--primary-color)" className={section?.section
421
- ?.toLowerCase()
422
- .replace(/[^a-z0-9\s]/g, '')
423
- .trim()
424
- .replace(/\s+/g, '-')} />
425
- <GeneralTootip
426
- anchorSelect={`.${section?.section
427
- ?.toLowerCase()
428
- .replace(/[^a-z0-9\s]/g, '')
429
- .trim()
430
- .replace(/\s+/g, '-')}`}
431
- place="bottom"
432
- title={`You can add ${section?.section} to your template.`}
433
- />
434
- </div>
435
-
436
- <Button onClick={handleShowDialog}></Button>
437
- </div>
438
-
439
- {section.fields.map(({ key, value }: { key: string; value: string }, i: number) => (
440
- <div style={{ display: 'flex', alignItems: 'center' }} key={i + value}>
441
- <span
442
- className="contact-element"
443
- onClick={() =>
444
- copyCustomFieldText(key, value)
445
- }
446
- >
447
- {value}
448
- </span>
449
- <Button
450
- style={iconButtonStyles}
451
- onClick={() => copyCustomFieldText(key, value)}
452
- backdrop={false}
453
- >
454
- <ContentCopyIcon className="copy" />
455
- </Button>
456
- </div>
457
- ))}
458
- </div>
459
- ))
460
- : onGetCustomFields && customFields?.length > 0 && filteredCustomFields.length > 0 && (
461
- <>
462
- <hr className="divider" />
463
- <div className="dynamic-content__top">
464
- <div>
465
- <span className="title">Custom Fields</span>
466
- <InfoIcon fill="var(--primary-color)" className="custom" />
467
- <GeneralTootip
468
- anchorSelect=".custom"
469
- place="bottom"
470
- title="You can add custom fields to your template."
471
- />
472
- </div>
473
- <Button onClick={handleShowDialog}></Button>
474
- </div>
475
- {filteredCustomFields
476
- ?.map(
477
- ({ key, value }: { key: string; value: string }, i: number) => (
478
- <div style={{ display: 'flex', alignItems: 'center' }} key={i + '_custom'}>
479
- <span
480
- className="contact-element"
481
- onClick={() =>
482
- copyCustomFieldText(key, value)
483
- }
484
- >
485
- {value}
486
- </span>
487
- <Button
488
- style={iconButtonStyles}
489
- onClick={() => copyCustomFieldText(key, value)}
490
- backdrop={false}
491
- >
492
- <ContentCopyIcon className="copy" />
493
- </Button>
494
- </div>
495
- )
496
- )}
497
- </>
498
- )
499
- }
500
- {defaultMiscFields && filteredMiscFields.length > 0 && <>
501
- <hr className="divider" />
502
- <div className="dynamic-content__top">
503
- <div>
504
- <span className="title">Miscellaneous Fields</span>
505
- <InfoIcon fill="var(--primary-color)" className="miscellaneous" />
506
- <GeneralTootip
507
- anchorSelect=".miscellaneous"
508
- place="bottom"
509
- title="You can add miscellaneous fields to your template."
510
- />
511
- </div>
512
- </div>
513
- {filteredMiscFields
514
- ?.filter(({ key }) => !excludedFields?.includes(key))
515
- ?.map(
516
- ({ key, value }: { key: string; value: string }, i: number) => (
517
- <div style={{ display: 'flex', alignItems: 'center' }} key={i + '_property'}>
518
- <span
519
- className="contact-element"
520
- onClick={() =>
521
- copyCustomFieldText(key, value)
522
- }
523
- >
524
- {value}
525
- </span>
526
- <Button
527
- style={iconButtonStyles}
528
- onClick={() => copyCustomFieldText(key, value)}
529
- backdrop={false}
530
- >
531
- <ContentCopyIcon className="copy" />
532
- </Button>
533
- </div>
534
- )
535
- )}
536
- </>}
537
- {filteredDynamicFields.length <= 0 && filteredCustomFieldsV2.length <= 0 && filteredPropertyFields.length <= 0 && filteredSenderFields.length <= 0 && filteredPlatformFields.length <= 0 && filteredCustomFields.length <= 0 &&
538
- filteredMiscFields.length <= 0 &&
539
- <div className="no-result">No results</div>
540
- }
541
- </div >
542
- </div>
543
- );
544
- }) as unknown as SideSection['Panel'],
545
- };
546
-
547
- export default CustomFieldSection;
@@ -1,64 +0,0 @@
1
- .dynamic-content {
2
- & .dynamic-content__top {
3
- display: flex;
4
- flex-direction: row;
5
- justify-content: space-between;
6
- align-items: center;
7
- margin: 8px auto;
8
- & .title {
9
- font-weight: 600;
10
- font-size: 16px;
11
- line-height: 19.36px;
12
- color: var(--primary-color);
13
- margin-right: 5px;
14
- }
15
- & .icon {
16
- width: 12px;
17
- height: 12px;
18
- cursor: pointer;
19
- }
20
- & .contact-info-tooltip {
21
- width: 90% !important;
22
- max-width: fit-content !important;
23
- }
24
- & .custom-add-on-tooltip {
25
- width: 90% !important;
26
- max-width: fit-content !important;
27
- }
28
- svg{
29
- &:focus{
30
- outline: none !important;
31
- }
32
- }
33
- }
34
-
35
- & .divider {
36
- margin-top: 10px;
37
- color: #44424145;
38
- }
39
-
40
- & .contact-element {
41
- width: 100%;
42
- border-radius: 3px;
43
- border: 0.5px solid var(--border-color);
44
- text-align: center;
45
- height: 35px;
46
- line-height: 35px;
47
- margin: 5px auto;
48
- cursor: pointer;
49
- transition: 0.1s ease-in all;
50
-
51
- &:hover {
52
- background-color: var(--secondary-color);
53
- }
54
- }
55
- .copy {
56
- fill: #000 !important;
57
- }
58
- }
59
-
60
- .no-result {
61
- display: flex;
62
- justify-content: center;
63
- margin: 20px;
64
- }