@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,408 @@
1
+ import { DPI } from "../constants";
2
+
3
+ // Define the type for the element being added
4
+ interface Element {
5
+ id: string;
6
+ type: string;
7
+ name: string;
8
+ opacity: number;
9
+ visible: boolean;
10
+ selectable: boolean;
11
+ removable: boolean;
12
+ alwaysOnTop: boolean;
13
+ showInExport: boolean;
14
+ x: number;
15
+ y: number;
16
+ width: number;
17
+ height: number;
18
+ rotation: number;
19
+ animations?: any[];
20
+ blurEnabled?: boolean;
21
+ blurRadius?: number;
22
+ brightnessEnabled?: boolean;
23
+ brightness?: number;
24
+ sepiaEnabled?: boolean;
25
+ grayscaleEnabled?: boolean;
26
+ shadowEnabled?: boolean;
27
+ shadowBlur?: number;
28
+ shadowOffsetX?: number;
29
+ shadowOffsetY?: number;
30
+ shadowColor?: string;
31
+ shadowOpacity?: number;
32
+ draggable?: boolean;
33
+ resizable?: boolean;
34
+ contentEditable: boolean;
35
+ styleEditable: boolean;
36
+ subType?: string;
37
+ fill?: string;
38
+ dash?: any[];
39
+ strokeWidth?: number;
40
+ stroke?: string;
41
+ cornerRadius?: number;
42
+ text?: string;
43
+ placeholder?: string;
44
+ fontSize?: number;
45
+ fontFamily?: string;
46
+ fontStyle?: string;
47
+ fontWeight?: string;
48
+ textDecoration?: string;
49
+ align?: string;
50
+ verticalAlign?: string;
51
+ lineHeight?: number;
52
+ letterSpacing?: number;
53
+ backgroundEnabled?: boolean;
54
+ backgroundColor?: string;
55
+ backgroundOpacity?: number;
56
+ backgroundCornerRadius?: number;
57
+ backgroundPadding?: number;
58
+ src?: string;
59
+ cropX?: number;
60
+ cropY?: number;
61
+ cropWidth?: number;
62
+ cropHeight?: number;
63
+ flipX?: boolean;
64
+ flipY?: boolean;
65
+ clipSrc?: string;
66
+ borderSize?: number;
67
+ keepRatio?: boolean;
68
+ }
69
+
70
+ // Define the type for the page
71
+ interface Page {
72
+ addElement: (element: Element) => void;
73
+ }
74
+
75
+ // Define the type for the store
76
+ interface Store {
77
+ width: number;
78
+ height: number;
79
+ pages: Page[];
80
+ history: {
81
+ clear: () => void;
82
+ };
83
+ }
84
+
85
+
86
+ export const addRestrictedAreaToPostCardJumbo = (store: Store, barcodeSrc: string): void => {
87
+ const page = store.pages[1];
88
+
89
+ const elements: Element[] = [
90
+ {
91
+ id: 'figure-1',
92
+ type: 'figure',
93
+ name: '',
94
+ opacity: 1,
95
+ visible: true,
96
+ selectable: false,
97
+ removable: false,
98
+ alwaysOnTop: true,
99
+ showInExport: true,
100
+ x: 40,
101
+ y: 50,
102
+ width: 180,
103
+ height: 75,
104
+ rotation: 0,
105
+ animations: [],
106
+ blurEnabled: false,
107
+ blurRadius: 10,
108
+ brightnessEnabled: false,
109
+ brightness: 0,
110
+ sepiaEnabled: false,
111
+ grayscaleEnabled: false,
112
+ shadowEnabled: false,
113
+ shadowBlur: 5,
114
+ shadowOffsetX: 0,
115
+ shadowOffsetY: 0,
116
+ shadowColor: 'black',
117
+ shadowOpacity: 1,
118
+ draggable: false,
119
+ resizable: false,
120
+ contentEditable: false,
121
+ styleEditable: false,
122
+ subType: 'rect',
123
+ fill: 'white',
124
+ dash: [],
125
+ strokeWidth: 0,
126
+ stroke: '#0c0c0c',
127
+ cornerRadius: 0,
128
+ },
129
+ {
130
+ id: 'return-address',
131
+ type: 'text',
132
+ name: '',
133
+ opacity: 1,
134
+ visible: true,
135
+ selectable: false,
136
+ removable: false,
137
+ alwaysOnTop: true,
138
+ showInExport: true,
139
+ x: 50,
140
+ y: 70,
141
+ width: 160,
142
+ height: 50,
143
+ rotation: 0,
144
+ animations: [],
145
+ blurEnabled: false,
146
+ blurRadius: 10,
147
+ brightnessEnabled: false,
148
+ brightness: 0,
149
+ sepiaEnabled: false,
150
+ grayscaleEnabled: false,
151
+ shadowEnabled: false,
152
+ shadowBlur: 5,
153
+ shadowOffsetX: 0,
154
+ shadowOffsetY: 0,
155
+ shadowColor: 'black',
156
+ shadowOpacity: 1,
157
+ draggable: false,
158
+ resizable: false,
159
+ contentEditable: false,
160
+ styleEditable: false,
161
+ text: 'YOUR RETURN ADDRESS \nWILL AUTOMATICALLY \nBE PRINTED IN THIS \nPOSITION',
162
+ placeholder: '',
163
+ fontSize: 8,
164
+ fontFamily: 'Roboto',
165
+ fontStyle: 'normal',
166
+ fontWeight: 'normal',
167
+ textDecoration: '',
168
+ fill: 'black',
169
+ align: 'start',
170
+ verticalAlign: 'top',
171
+ strokeWidth: 0,
172
+ stroke: 'black',
173
+ lineHeight: 1.2,
174
+ letterSpacing: 0,
175
+ backgroundEnabled: false,
176
+ backgroundColor: '#7ED321',
177
+ backgroundOpacity: 1,
178
+ backgroundCornerRadius: 0.5,
179
+ backgroundPadding: 0.5,
180
+ },
181
+ {
182
+ id: 'figure-2',
183
+ type: 'figure',
184
+ name: '',
185
+ opacity: 1,
186
+ visible: true,
187
+ selectable: false,
188
+ removable: false,
189
+ alwaysOnTop: true,
190
+ showInExport: true,
191
+ x: 695,
192
+ y: 52,
193
+ width: 135,
194
+ height: 75,
195
+ rotation: 0,
196
+ animations: [],
197
+ blurEnabled: false,
198
+ blurRadius: 10,
199
+ brightnessEnabled: false,
200
+ brightness: 0,
201
+ sepiaEnabled: false,
202
+ grayscaleEnabled: false,
203
+ shadowEnabled: false,
204
+ shadowBlur: 5,
205
+ shadowOffsetX: 0,
206
+ shadowOffsetY: 0,
207
+ shadowColor: 'black',
208
+ shadowOpacity: 1,
209
+ draggable: false,
210
+ resizable: false,
211
+ contentEditable: false,
212
+ styleEditable: false,
213
+ subType: 'rect',
214
+ fill: 'white',
215
+ dash: [],
216
+ strokeWidth: 0,
217
+ stroke: '#0c0c0c',
218
+ cornerRadius: 0,
219
+ },
220
+ {
221
+ id: 'indicia',
222
+ type: 'text',
223
+ name: '',
224
+ opacity: 1,
225
+ visible: true,
226
+ selectable: false,
227
+ removable: false,
228
+ alwaysOnTop: true,
229
+ showInExport: true,
230
+ x: 710,
231
+ y: 69,
232
+ width: 110,
233
+ height: 30,
234
+ rotation: 0,
235
+ animations: [],
236
+ blurEnabled: false,
237
+ blurRadius: 10,
238
+ brightnessEnabled: false,
239
+ brightness: 0,
240
+ sepiaEnabled: false,
241
+ grayscaleEnabled: false,
242
+ shadowEnabled: false,
243
+ shadowBlur: 5,
244
+ shadowOffsetX: 0,
245
+ shadowOffsetY: 0,
246
+ shadowColor: 'black',
247
+ shadowOpacity: 1,
248
+ draggable: false,
249
+ resizable: false,
250
+ contentEditable: false,
251
+ styleEditable: false,
252
+ text: `POSTAGE\nINDICIA`,
253
+ placeholder: '',
254
+ fontSize: 18,
255
+ fontFamily: 'Roboto',
256
+ fontStyle: 'normal',
257
+ fontWeight: 'normal',
258
+ textDecoration: '',
259
+ fill: 'black',
260
+ align: 'center',
261
+ verticalAlign: 'top',
262
+ strokeWidth: 0,
263
+ stroke: 'black',
264
+ lineHeight: 1.2,
265
+ letterSpacing: 0,
266
+ backgroundEnabled: false,
267
+ backgroundColor: '#7ED321',
268
+ backgroundOpacity: 1,
269
+ backgroundCornerRadius: 0.5,
270
+ backgroundPadding: 0.5,
271
+ },
272
+ {
273
+ id: 'figure-3',
274
+ type: 'figure',
275
+ name: '',
276
+ opacity: 1,
277
+ visible: true,
278
+ selectable: false,
279
+ removable: false,
280
+ alwaysOnTop: true,
281
+ showInExport: true,
282
+ x: 410,
283
+ y: 180,
284
+ width: 380,
285
+ height: 160,
286
+ rotation: 0,
287
+ animations: [],
288
+ blurEnabled: false,
289
+ blurRadius: 10,
290
+ brightnessEnabled: false,
291
+ brightness: 0,
292
+ sepiaEnabled: false,
293
+ grayscaleEnabled: false,
294
+ shadowEnabled: false,
295
+ shadowBlur: 5,
296
+ shadowOffsetX: 0,
297
+ shadowOffsetY: 0,
298
+ shadowColor: 'black',
299
+ shadowOpacity: 1,
300
+ draggable: false,
301
+ resizable: false,
302
+ contentEditable: false,
303
+ styleEditable: false,
304
+ subType: 'rect',
305
+ fill: 'white',
306
+ dash: [],
307
+ strokeWidth: 0,
308
+ stroke: '#0c0c0c',
309
+ cornerRadius: 0,
310
+ },
311
+ {
312
+ id: 'barcode',
313
+ type: 'image',
314
+ name: '',
315
+ opacity: 1,
316
+ visible: true,
317
+ selectable: false,
318
+ removable: false,
319
+ alwaysOnTop: true,
320
+ showInExport: true,
321
+ x: 430,
322
+ y: 220,
323
+ width: 3.2835 * DPI - 23,
324
+ height: 15,
325
+ rotation: 0,
326
+ animations: [],
327
+ blurEnabled: false,
328
+ brightnessEnabled: false,
329
+ brightness: 0,
330
+ sepiaEnabled: false,
331
+ grayscaleEnabled: false,
332
+ shadowEnabled: false,
333
+ shadowOffsetX: 0,
334
+ shadowOffsetY: 0,
335
+ shadowOpacity: 1,
336
+ draggable: false,
337
+ resizable: false,
338
+ contentEditable: false,
339
+ styleEditable: false,
340
+ src: barcodeSrc,
341
+ cropX: 0,
342
+ cropY: 0,
343
+ cropWidth: 1,
344
+ cropHeight: 1,
345
+ cornerRadius: 0,
346
+ flipX: false,
347
+ flipY: false,
348
+ clipSrc: '',
349
+ borderSize: 0,
350
+ keepRatio: false,
351
+ },
352
+ {
353
+ id: 'recipient-address',
354
+ type: 'text',
355
+ name: '',
356
+ opacity: 1,
357
+ visible: true,
358
+ selectable: false,
359
+ removable: false,
360
+ alwaysOnTop: true,
361
+ showInExport: true,
362
+ x: 430,
363
+ y: 250,
364
+ width: 240,
365
+ height: 65,
366
+ rotation: 0,
367
+ animations: [],
368
+ blurEnabled: false,
369
+ blurRadius: 10,
370
+ brightnessEnabled: false,
371
+ brightness: 0,
372
+ sepiaEnabled: false,
373
+ grayscaleEnabled: false,
374
+ shadowEnabled: false,
375
+ shadowBlur: 5,
376
+ shadowOffsetX: 0,
377
+ shadowOffsetY: 0,
378
+ shadowColor: 'black',
379
+ shadowOpacity: 1,
380
+ draggable: false,
381
+ resizable: false,
382
+ contentEditable: false,
383
+ styleEditable: false,
384
+ text: 'RECIPIENT ADDRESS \nWILL AUTOMATICALLY \nBE PRINTED IN THIS \nPOSITION',
385
+ placeholder: '',
386
+ fontSize: 13,
387
+ fontFamily: 'Roboto',
388
+ fontStyle: 'normal',
389
+ fontWeight: 'normal',
390
+ textDecoration: '',
391
+ fill: 'black',
392
+ align: 'start',
393
+ verticalAlign: 'top',
394
+ strokeWidth: 0,
395
+ stroke: 'black',
396
+ lineHeight: 1.2,
397
+ letterSpacing: 0,
398
+ backgroundEnabled: false,
399
+ backgroundColor: '#7ED321',
400
+ backgroundOpacity: 1,
401
+ backgroundCornerRadius: 0.5,
402
+ backgroundPadding: 0.5,
403
+ },
404
+ ];
405
+
406
+ elements.forEach(element => page.addElement(element));
407
+ store.history.clear();
408
+ };
@@ -0,0 +1,318 @@
1
+ import { DPI } from "../constants";
2
+
3
+ // Define the type for the element being added
4
+ interface Element {
5
+ id: string;
6
+ type: string;
7
+ name: string;
8
+ opacity: number;
9
+ visible: boolean;
10
+ selectable: boolean;
11
+ removable: boolean;
12
+ alwaysOnTop: boolean;
13
+ showInExport: boolean;
14
+ x: number;
15
+ y: number;
16
+ width: number;
17
+ height: number;
18
+ rotation: number;
19
+ animations?: any[];
20
+ blurEnabled?: boolean;
21
+ blurRadius?: number;
22
+ brightnessEnabled?: boolean;
23
+ brightness?: number;
24
+ sepiaEnabled?: boolean;
25
+ grayscaleEnabled?: boolean;
26
+ shadowEnabled?: boolean;
27
+ shadowBlur?: number;
28
+ shadowOffsetX?: number;
29
+ shadowOffsetY?: number;
30
+ shadowColor?: string;
31
+ shadowOpacity?: number;
32
+ draggable?: boolean;
33
+ resizable?: boolean;
34
+ contentEditable: boolean;
35
+ styleEditable: boolean;
36
+ subType?: string;
37
+ fill?: string;
38
+ dash?: any[];
39
+ strokeWidth?: number;
40
+ stroke?: string;
41
+ cornerRadius?: number;
42
+ text?: string;
43
+ placeholder?: string;
44
+ fontSize?: number;
45
+ fontFamily?: string;
46
+ fontStyle?: string;
47
+ fontWeight?: string;
48
+ textDecoration?: string;
49
+ align?: string;
50
+ verticalAlign?: string;
51
+ lineHeight?: number;
52
+ letterSpacing?: number;
53
+ backgroundEnabled?: boolean;
54
+ backgroundColor?: string;
55
+ backgroundOpacity?: number;
56
+ backgroundCornerRadius?: number;
57
+ backgroundPadding?: number;
58
+ src?: string;
59
+ cropX?: number;
60
+ cropY?: number;
61
+ cropWidth?: number;
62
+ cropHeight?: number;
63
+ flipX?: boolean;
64
+ flipY?: boolean;
65
+ clipSrc?: string;
66
+ borderSize?: number;
67
+ keepRatio?: boolean;
68
+ }
69
+
70
+ // Define the type for the page
71
+ interface Page {
72
+ addElement: (element: Element) => void;
73
+ }
74
+
75
+ // Define the type for the store
76
+ interface Store {
77
+ width: number;
78
+ height: number;
79
+ pages: Page[];
80
+ history: {
81
+ clear: () => void;
82
+ };
83
+ }
84
+
85
+ export const addAreaToProfessionalLetters = (store: Store, barcodeSrc: string): void => {
86
+ const page = store.pages[0];
87
+ const position = [0.6, 0.84];
88
+ const position1 = [0.63, 1.71];
89
+
90
+ const elements: Element[] = [
91
+ {
92
+ id: 'figure-2',
93
+ type: 'figure',
94
+ name: '',
95
+ opacity: 1,
96
+ visible: true,
97
+ selectable: false,
98
+ removable: false,
99
+ alwaysOnTop: true,
100
+ showInExport: true,
101
+ x: 0.63 * DPI,
102
+ y: 0.5 * DPI,
103
+ width: 3.25 * DPI,
104
+ height: 0.875 * DPI,
105
+ rotation: 0,
106
+ animations: [],
107
+ blurEnabled: false,
108
+ blurRadius: 10,
109
+ brightnessEnabled: false,
110
+ brightness: 0,
111
+ sepiaEnabled: false,
112
+ grayscaleEnabled: false,
113
+ shadowEnabled: false,
114
+ shadowBlur: 5,
115
+ shadowOffsetX: 0,
116
+ shadowOffsetY: 0,
117
+ shadowColor: 'black',
118
+ shadowOpacity: 1,
119
+ draggable: false,
120
+ resizable: false,
121
+ contentEditable: false,
122
+ styleEditable: false,
123
+ subType: 'rect',
124
+ fill: 'white',
125
+ dash: [],
126
+ strokeWidth: 0,
127
+ stroke: '#0c0c0c',
128
+ cornerRadius: 0,
129
+ },
130
+ {
131
+ id: 'figure-3',
132
+ type: 'figure',
133
+ name: '',
134
+ opacity: 1,
135
+ visible: true,
136
+ selectable: false,
137
+ removable: false,
138
+ alwaysOnTop: true,
139
+ showInExport: true,
140
+ x: 0.63 * DPI,
141
+ y: 1.71 * DPI,
142
+ width: 4 * DPI,
143
+ height: 1 * DPI,
144
+ rotation: 0,
145
+ animations: [],
146
+ blurEnabled: false,
147
+ blurRadius: 10,
148
+ brightnessEnabled: false,
149
+ brightness: 0,
150
+ sepiaEnabled: false,
151
+ grayscaleEnabled: false,
152
+ shadowEnabled: false,
153
+ shadowBlur: 5,
154
+ shadowOffsetX: 0,
155
+ shadowOffsetY: 0,
156
+ shadowColor: 'black',
157
+ shadowOpacity: 1,
158
+ draggable: false,
159
+ resizable: false,
160
+ contentEditable: false,
161
+ styleEditable: false,
162
+ subType: 'rect',
163
+ fill: 'white',
164
+ dash: [],
165
+ strokeWidth: 0,
166
+ stroke: '#0c0c0c',
167
+ cornerRadius: 0,
168
+ },
169
+ {
170
+ id: 'return-address',
171
+ type: 'text',
172
+ name: '',
173
+ opacity: 1,
174
+ visible: true,
175
+ selectable: false,
176
+ removable: false,
177
+ alwaysOnTop: true,
178
+ showInExport: true,
179
+ x: position[0] * DPI + 10,
180
+ y: position[1] * DPI - 10,
181
+ width: 200,
182
+ height: 18,
183
+ rotation: 0,
184
+ animations: [],
185
+ blurEnabled: false,
186
+ blurRadius: 10,
187
+ brightnessEnabled: false,
188
+ brightness: 0,
189
+ sepiaEnabled: false,
190
+ grayscaleEnabled: false,
191
+ shadowEnabled: false,
192
+ shadowBlur: 5,
193
+ shadowOffsetX: 0,
194
+ shadowOffsetY: 0,
195
+ shadowColor: 'black',
196
+ shadowOpacity: 1,
197
+ draggable: false,
198
+ resizable: false,
199
+ contentEditable: false,
200
+ styleEditable: false,
201
+ text: 'YOUR RETURN ADDRESS \nWILL AUTOMATICALLY \nBE PRINTED IN THIS \nPOSITION',
202
+ placeholder: '',
203
+ fontSize: 12,
204
+ fontFamily: 'Roboto',
205
+ fontStyle: 'normal',
206
+ fontWeight: 'normal',
207
+ textDecoration: '',
208
+ fill: 'black',
209
+ align: 'start',
210
+ verticalAlign: 'top',
211
+ strokeWidth: 0,
212
+ stroke: 'black',
213
+ lineHeight: 1.2,
214
+ letterSpacing: 0,
215
+ backgroundEnabled: false,
216
+ backgroundColor: '#7ED321',
217
+ backgroundOpacity: 1,
218
+ backgroundCornerRadius: 0.5,
219
+ backgroundPadding: 0.5,
220
+ },
221
+ {
222
+ id: 'barcode',
223
+ type: 'image',
224
+ name: '',
225
+ opacity: 1,
226
+ visible: true,
227
+ selectable: false,
228
+ removable: false,
229
+ alwaysOnTop: true,
230
+ showInExport: true,
231
+ x: position1[0] * DPI + 10,
232
+ y: position1[1] * DPI + 70,
233
+ width: 230,
234
+ height: 15,
235
+ rotation: 0,
236
+ animations: [],
237
+ blurEnabled: false,
238
+ brightnessEnabled: false,
239
+ brightness: 0,
240
+ sepiaEnabled: false,
241
+ grayscaleEnabled: false,
242
+ shadowEnabled: false,
243
+ shadowOffsetX: 0,
244
+ shadowOffsetY: 0,
245
+ shadowOpacity: 1,
246
+ draggable: false,
247
+ resizable: false,
248
+ contentEditable: false,
249
+ styleEditable: false,
250
+ src: barcodeSrc,
251
+ cropX: 0,
252
+ cropY: 0,
253
+ cropWidth: 1,
254
+ cropHeight: 1,
255
+ cornerRadius: 0,
256
+ flipX: false,
257
+ flipY: false,
258
+ clipSrc: '',
259
+ borderSize: 0,
260
+ keepRatio: false,
261
+ },
262
+ {
263
+ id: 'recipient-address',
264
+ type: 'text',
265
+ name: '',
266
+ opacity: 1,
267
+ visible: true,
268
+ selectable: false,
269
+ removable: false,
270
+ alwaysOnTop: true,
271
+ showInExport: true,
272
+ x: position1[0] * DPI + 10,
273
+ y: position1[1] * DPI + 10,
274
+ width: 165,
275
+ height: 21,
276
+ rotation: 0,
277
+ animations: [],
278
+ blurEnabled: false,
279
+ blurRadius: 10,
280
+ brightnessEnabled: false,
281
+ brightness: 0,
282
+ sepiaEnabled: false,
283
+ grayscaleEnabled: false,
284
+ shadowEnabled: false,
285
+ shadowBlur: 5,
286
+ shadowOffsetX: 0,
287
+ shadowOffsetY: 0,
288
+ shadowColor: 'black',
289
+ shadowOpacity: 1,
290
+ draggable: false,
291
+ resizable: false,
292
+ contentEditable: false,
293
+ styleEditable: false,
294
+ text: 'RECIPIENT ADDRESS \nWILL AUTOMATICALLY \nBE PRINTED IN THIS \nPOSITION',
295
+ placeholder: '',
296
+ fontSize: 12,
297
+ fontFamily: 'Roboto',
298
+ fontStyle: 'normal',
299
+ fontWeight: 'normal',
300
+ textDecoration: '',
301
+ fill: 'black',
302
+ align: 'start',
303
+ verticalAlign: 'top',
304
+ strokeWidth: 0,
305
+ stroke: 'black',
306
+ lineHeight: 1.2,
307
+ letterSpacing: 0,
308
+ backgroundEnabled: false,
309
+ backgroundColor: '#7ED321',
310
+ backgroundOpacity: 1,
311
+ backgroundCornerRadius: 0.5,
312
+ backgroundPadding: 0.5,
313
+ },
314
+ ];
315
+
316
+ elements.forEach(element => page.addElement(element));
317
+ store.history.clear();
318
+ };