@openlettermarketing/olc-react-sdk 0.0.8 → 0.0.10

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 (135) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.cjs +18 -0
  3. package/.eslintrc.yml +47 -0
  4. package/.prettierignore +3 -0
  5. package/.prettierrc.yml +5 -0
  6. package/CHANGELOG.md +4 -0
  7. package/babel.config.json +10 -0
  8. package/build/index.js +2 -2
  9. package/build/index.js.map +1 -1
  10. package/examples/.eslintrc.yml +4 -0
  11. package/index.html +18 -0
  12. package/package.json +6 -6
  13. package/public/vite.svg +1 -0
  14. package/src/App.tsx +76 -0
  15. package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
  16. package/src/assets/images/input/cancel.tsx +20 -0
  17. package/src/assets/images/input/search.tsx +20 -0
  18. package/src/assets/images/modal-icons/cancelIcon.png +0 -0
  19. package/src/assets/images/modal-icons/del.tsx +19 -0
  20. package/src/assets/images/modal-icons/delete.svg +3 -0
  21. package/src/assets/images/modal-icons/modal-cross.tsx +23 -0
  22. package/src/assets/images/modal-icons/save.tsx +23 -0
  23. package/src/assets/images/templates/add-icon.svg +5 -0
  24. package/src/assets/images/templates/back-arrow.tsx +19 -0
  25. package/src/assets/images/templates/back-dialog-icon.png +0 -0
  26. package/src/assets/images/templates/back-dialog-icon.svg +3 -0
  27. package/src/assets/images/templates/barcode.png +0 -0
  28. package/src/assets/images/templates/bi-fold-self-mailers.tsx +28 -0
  29. package/src/assets/images/templates/black-trash-icon.svg +3 -0
  30. package/src/assets/images/templates/cancel.svg +4 -0
  31. package/src/assets/images/templates/cancelIcon.png +0 -0
  32. package/src/assets/images/templates/clipboard.svg +3 -0
  33. package/src/assets/images/templates/contact-search.svg +3 -0
  34. package/src/assets/images/templates/content-copy-icon.tsx +24 -0
  35. package/src/assets/images/templates/cross.svg +3 -0
  36. package/src/assets/images/templates/custom-template-icon-black.svg +3 -0
  37. package/src/assets/images/templates/custom-template-icon.svg +3 -0
  38. package/src/assets/images/templates/custom-template.tsx +23 -0
  39. package/src/assets/images/templates/dummy-template.svg +21 -0
  40. package/src/assets/images/templates/dynamic-field.tsx +119 -0
  41. package/src/assets/images/templates/edit-pencil-icon.tsx +21 -0
  42. package/src/assets/images/templates/filter-2.svg +13 -0
  43. package/src/assets/images/templates/info-icon.svg +12 -0
  44. package/src/assets/images/templates/info-icon.tsx +37 -0
  45. package/src/assets/images/templates/one-barcode.png +0 -0
  46. package/src/assets/images/templates/personal-letter.tsx +53 -0
  47. package/src/assets/images/templates/plus-icon.svg +5 -0
  48. package/src/assets/images/templates/postcard.tsx +32 -0
  49. package/src/assets/images/templates/professional-letter.tsx +53 -0
  50. package/src/assets/images/templates/real-penned-letters.tsx +57 -0
  51. package/src/assets/images/templates/search.svg +3 -0
  52. package/src/assets/images/templates/size-image-lg.tsx +20 -0
  53. package/src/assets/images/templates/size-image-mid.tsx +20 -0
  54. package/src/assets/images/templates/size-image.tsx +20 -0
  55. package/src/assets/images/templates/template-copy.svg +3 -0
  56. package/src/assets/images/templates/template-default-design.tsx +21 -0
  57. package/src/assets/images/templates/template-delete.svg +3 -0
  58. package/src/assets/images/templates/template-edit.svg +4 -0
  59. package/src/assets/images/templates/template-save-icon.svg +3 -0
  60. package/src/assets/images/templates/template-search-2.svg +9 -0
  61. package/src/assets/images/templates/template-search.svg +4 -0
  62. package/src/assets/images/templates/thumbnail.svg +10 -0
  63. package/src/assets/images/templates/trash-icon.svg +13 -0
  64. package/src/assets/images/templates/tri-fold-self-mailers.tsx +93 -0
  65. package/src/components/CreateTemplate/index.tsx +377 -0
  66. package/src/components/CreateTemplate/styles.scss +363 -0
  67. package/src/components/GenericUIBlocks/Button/index.tsx +21 -0
  68. package/src/components/GenericUIBlocks/Button/styles.scss +15 -0
  69. package/src/components/GenericUIBlocks/CircularProgress/index.tsx +18 -0
  70. package/src/components/GenericUIBlocks/CircularProgress/styles.scss +98 -0
  71. package/src/components/GenericUIBlocks/Dialog/index.tsx +127 -0
  72. package/src/components/GenericUIBlocks/Dialog/styles.scss +106 -0
  73. package/src/components/GenericUIBlocks/Divider/index.tsx +12 -0
  74. package/src/components/GenericUIBlocks/Divider/styles.scss +7 -0
  75. package/src/components/GenericUIBlocks/GeneralSelect/index.tsx +86 -0
  76. package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +77 -0
  77. package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +24 -0
  78. package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +9 -0
  79. package/src/components/GenericUIBlocks/GenericSnackbar/index.tsx +53 -0
  80. package/src/components/GenericUIBlocks/GenericSnackbar/styles.scss +34 -0
  81. package/src/components/GenericUIBlocks/Grid/index.tsx +82 -0
  82. package/src/components/GenericUIBlocks/Input/index.tsx +89 -0
  83. package/src/components/GenericUIBlocks/Input/styles.scss +80 -0
  84. package/src/components/GenericUIBlocks/Snackbar/index.tsx +66 -0
  85. package/src/components/GenericUIBlocks/Typography/index.tsx +18 -0
  86. package/src/components/GenericUIBlocks/Typography/styles.scss +27 -0
  87. package/src/components/SidePanel/customFields/customFieldSection.tsx +162 -0
  88. package/src/components/SidePanel/customFields/styles.scss +47 -0
  89. package/src/components/SidePanel/index.tsx +30 -0
  90. package/src/components/SidePanel/templates/customTemplateSection.tsx +505 -0
  91. package/src/components/SidePanel/templates/styles.scss +151 -0
  92. package/src/components/TemplateBuilder/index.tsx +295 -0
  93. package/src/components/TemplateBuilder/styles.scss +66 -0
  94. package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +58 -0
  95. package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +123 -0
  96. package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +98 -0
  97. package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +88 -0
  98. package/src/components/TopNavigation/SaveTemplateModel/index.tsx +60 -0
  99. package/src/components/TopNavigation/SaveTemplateModel/styles.scss +128 -0
  100. package/src/components/TopNavigation/index.tsx +388 -0
  101. package/src/components/TopNavigation/styles.scss +83 -0
  102. package/src/importMeta.d.ts +9 -0
  103. package/src/index.scss +130 -0
  104. package/src/index.tsx +82 -0
  105. package/src/libs/test.ts +7 -0
  106. package/src/redux/actions/action-types.ts +42 -0
  107. package/src/redux/actions/customFieldAction.ts +28 -0
  108. package/src/redux/actions/snackbarActions.ts +16 -0
  109. package/src/redux/actions/templateActions.ts +456 -0
  110. package/src/redux/reducers/customFieldReducer.ts +97 -0
  111. package/src/redux/reducers/index.ts +14 -0
  112. package/src/redux/reducers/snackbarReducer.ts +41 -0
  113. package/src/redux/reducers/templateReducer.ts +353 -0
  114. package/src/redux/store.ts +18 -0
  115. package/src/styles/colors.scss +61 -0
  116. package/src/test/mocks.js +89 -0
  117. package/src/test/setupJest.js +1 -0
  118. package/src/utils/api.ts +36 -0
  119. package/src/utils/constants.ts +40 -0
  120. package/src/utils/customStyles.ts +135 -0
  121. package/src/utils/fetchWrapper.ts +68 -0
  122. package/src/utils/fonts.json +1597 -0
  123. package/src/utils/helper.ts +19 -0
  124. package/src/utils/local-storage.ts +15 -0
  125. package/src/utils/message.ts +71 -0
  126. package/src/utils/template-builder.ts +147 -0
  127. package/src/utils/templateRestrictedArea/biFold.ts +433 -0
  128. package/src/utils/templateRestrictedArea/postCard.ts +439 -0
  129. package/src/utils/templateRestrictedArea/professional.ts +422 -0
  130. package/src/utils/templateRestrictedArea/realPenned.ts +283 -0
  131. package/src/utils/templateRestrictedArea/triFold.ts +434 -0
  132. package/tsconfig.json +29 -0
  133. package/tsconfig.node.json +12 -0
  134. package/vite.config.ts +8 -0
  135. package/webpack.config.js +80 -0
@@ -0,0 +1,19 @@
1
+ export let apiKey: string | null = null;
2
+ export let appMode: string = 'test';
3
+
4
+ export const copyToClipboard = (text: string): void => {
5
+ navigator.clipboard
6
+ .writeText(text)
7
+ .then(() => { })
8
+ .catch((err) => {
9
+ console.error('Failed to copy text: ', err);
10
+ });
11
+ };
12
+
13
+ export const setApiKey = (key: string) => {
14
+ apiKey = key
15
+ };
16
+
17
+ export const setMode = (mode: string) => {
18
+ appMode = mode
19
+ };
@@ -0,0 +1,15 @@
1
+ export const setItem = (key: string, value: string): void => {
2
+ localStorage.setItem(key, value);
3
+ };
4
+
5
+ export const getItem = (key: string): string | null => {
6
+ return localStorage.getItem(key);
7
+ };
8
+
9
+ export const removeItem = (key: string): void => {
10
+ localStorage.removeItem(key);
11
+ };
12
+
13
+ export const clearStorage = (): void => {
14
+ localStorage.clear();
15
+ };
@@ -0,0 +1,71 @@
1
+ // Default messages and Typography
2
+
3
+ export const MESSAGES = {
4
+ GENERAL_ERROR: "Internal Server Error",
5
+ TEMPLATE: {
6
+ SEARCH_PLACE_HOLDER: "Search by template name or template ID",
7
+ NAME_REQUIRED: "Template Name is required",
8
+ TYPE_REQUIRED: "Template Type is required",
9
+ PRODUCT_TYPE_REQUIRED: "Product Type is required",
10
+ ENVELOPE_TYPE_REQUIRED: "Envelope Type is required",
11
+ POSTCARD_SIZE_REQUIRED: "Postcard Size is required",
12
+ NAME_LESS_50: "Template Name should be less than or equal to 50 characters",
13
+ CREATE: {
14
+ TITLE: 'Create New Template',
15
+ TEMPLATE_LABEL: 'Template Name*',
16
+ PRODUCT_LABEL : 'Product Type*',
17
+ LEARN_TEXT: 'Learn More',
18
+ CANCEL_BUTTON: "Cancel",
19
+ SUBMIT_BUTTON: "Next",
20
+ },
21
+ LIMIT_MODAL: {
22
+ TITLE: "Limit Reached",
23
+ HEADING: "You've reached your template limit",
24
+ SUB_HEADING: "Please Upgrade your subscription to add more templates",
25
+ CANCEL_BUTTON: "Cancel",
26
+ SUBMIT_BUTTON: "View Plans",
27
+ },
28
+ DELETE: {
29
+ TITLE: "Delete Template",
30
+ HEADING: "Are you sure you want to delete this Template?",
31
+ PARAGRAPH:
32
+ "This template will be deleted from your Templates list but will still be included in associated orders.",
33
+ },
34
+ SAVE: {
35
+ TITLE: "Confirm Save Template",
36
+ HEADING: "Are you sure you want to save this template?",
37
+ PARAGRAPH:
38
+ "The updates provided will be used right away for any orders referencing this template.",
39
+ CANCEL_BUTTON: "Cancel",
40
+ SUBMIT_BUTTON: "Save"
41
+ },
42
+ CANCEL: {
43
+ TITLE: "Confirm Cancel Template",
44
+ HEADING: "Are you sure you want to cancel this Template?",
45
+ PARAGRAPH: "You will lose your changes after canceling.",
46
+ BACK_BUTTON: "Go Back",
47
+ CANCEL_BUTTON: "Cancel Template",
48
+ },
49
+ DESIGN_YOUR_OWN: {
50
+ TITLE: "Confirm",
51
+ HEADING: "Are you sure you want to discard these changes?",
52
+ PARAGRAPH:
53
+ "You will lose your changes. Please save your changes or click ok to proceed.",
54
+ },
55
+ SELECT_TEMPLATE: {
56
+ TITLE: "Confirm",
57
+ HEADING:
58
+ "Are you sure you want to change current template with this one?",
59
+ PARAGRAPH:
60
+ "You will lose your changes. Please save your changes or click ok to proceed.",
61
+ SUBMIT_BUTTON: "OK",
62
+ CANCEL_BUTTON: "Cancel",
63
+ },
64
+ DOWNLOAD_PROOF_BUTTON: "Download Proof",
65
+ CANCEL_BUTTON: "Cancel",
66
+ SUBMIT_BUTTON: "Save"
67
+ },
68
+ SNACKBAR: {
69
+ HEADING: "Notifications",
70
+ },
71
+ } as const;
@@ -0,0 +1,147 @@
1
+ /* eslint-disable no-useless-catch */
2
+ import { get } from '../utils/api';
3
+
4
+ // Utils
5
+ import { multiPageLetters, Barcode } from './constants';
6
+
7
+ // Restricted Area Files
8
+ import { addRestrictedAreaToBiFold } from './templateRestrictedArea/biFold';
9
+ import { addRestrictedAreaToPostCard } from './templateRestrictedArea/postCard';
10
+ import { addAreaToProfessionalLetters } from './templateRestrictedArea/professional';
11
+ import { addRestrictedAreaToTriFold } from './templateRestrictedArea/triFold';
12
+
13
+
14
+ export const addressPrinting: { [key: string]: boolean } = {
15
+ 'Postcards-': true,
16
+ 'Tri-Fold Self-Mailers-': true,
17
+ 'Bi-Fold Self-Mailers-': true,
18
+ 'Professional Letters-#10 Double-Window': true,
19
+ };
20
+
21
+ export const multiPageTemplates: string[] = [
22
+ 'Postcards',
23
+ 'Tri-Fold Self-Mailers',
24
+ 'Bi-Fold Self-Mailers',
25
+ ];
26
+
27
+ export interface EnvelopeType {
28
+ id: number,
29
+ label: string,
30
+ type: string
31
+ }
32
+
33
+ export const envelopeTypes: EnvelopeType[] = [
34
+ { id: 1, label: 'Windowed Envelope', type: '#10 Double-Window' },
35
+ { id: 2, label: 'Non-Windowed Envelope', type: '#10 Grey' },
36
+ ];
37
+
38
+ export const getFileAsBlob = async (url: string, returnType: string = 'json'): Promise<any> => {
39
+ try {
40
+ const response = await fetch(url);
41
+ const blob = await response.blob();
42
+ return returnType === 'json'
43
+ ? blobToJSON(blob)
44
+ : blobToString(blob);
45
+ } catch (error) {
46
+ throw error; // Optionally rethrow the error for further handling
47
+ }
48
+ };
49
+
50
+ const blobToJSON = (jsonBlob: Blob): Promise<any> => {
51
+ return new Promise((resolve, reject) => {
52
+ const reader = new FileReader();
53
+
54
+ reader.onload = function () {
55
+ try {
56
+ // Parse the result as JSON
57
+ const parsedData = JSON.parse(reader.result as string);
58
+
59
+ // Resolve the promise with the parsed JSON data
60
+ resolve(parsedData);
61
+ } catch (error) {
62
+ reject(error);
63
+ }
64
+ };
65
+
66
+ reader.onerror = function (error) {
67
+ reject(error);
68
+ };
69
+
70
+ reader.readAsText(jsonBlob);
71
+ });
72
+ };
73
+
74
+ export const blobToString = (blob: Blob): Promise<string> => {
75
+ return new Promise((resolve, reject) => {
76
+ const reader = new FileReader();
77
+
78
+ reader.onloadend = function () {
79
+ // The result property contains the data as a string
80
+ const blobString = reader.result as string;
81
+
82
+ // Resolve the Promise with the blobString
83
+ resolve(blobString);
84
+ };
85
+
86
+ reader.onerror = function (error) {
87
+ reject(error);
88
+ };
89
+
90
+ reader.readAsText(blob);
91
+ });
92
+ };
93
+
94
+ export const downloadPDF = (title: string, url: string): void => {
95
+ const link = document.createElement('a');
96
+ link.href = url;
97
+ link.download = title + '.pdf';
98
+
99
+ // Append the link to the document
100
+ document.body.appendChild(link);
101
+
102
+ // Trigger a click on the link
103
+ link.click();
104
+
105
+ // Remove the link from the document
106
+ document.body.removeChild(link);
107
+ };
108
+
109
+ export interface Product {
110
+ productType: string;
111
+ }
112
+
113
+ export const drawRestrictedAreaOnPage = (store: any, product: Product, envelopeType: string) => {
114
+ if (addressPrinting[`${product.productType}-${envelopeType}`]) {
115
+ if (product.productType === 'Professional Letters') {
116
+ addAreaToProfessionalLetters(store, Barcode);
117
+ } else if (product.productType === multiPageLetters[0]) {
118
+ addRestrictedAreaToPostCard(
119
+ store,
120
+ [3.2835, 2.375],
121
+ Barcode
122
+ );
123
+ } else if (product.productType === multiPageLetters[1]) {
124
+ addRestrictedAreaToTriFold(store, [3.2835, 2.375], Barcode);
125
+ } else if (product.productType === multiPageLetters[2]) {
126
+ addRestrictedAreaToBiFold(store, [3.2835, 2.375], Barcode);
127
+ }
128
+ }
129
+ };
130
+
131
+ export const extractFontFamilies = (jsonData: any[]): string[] => {
132
+ const fontFamilies: string[] = [];
133
+
134
+ // Iterate through each object in the JSON data
135
+ jsonData.forEach((obj) => {
136
+ if (obj.children) {
137
+ // Iterate through each child object
138
+ obj.children.forEach((child: any) => {
139
+ if (child.type === 'text' && child.fontFamily) {
140
+ // Extract font family from text objects
141
+ fontFamilies.push(child.fontFamily);
142
+ }
143
+ });
144
+ }
145
+ });
146
+ return fontFamilies;
147
+ };
@@ -0,0 +1,433 @@
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 addRestrictedAreaToBiFold = (store: Store, size: [number, number], barcodeSrc: string) : void => {
86
+ const page = store.pages[0];
87
+
88
+ const elements: Element[] = [
89
+ {
90
+ id: 'figure-1',
91
+ type: 'figure',
92
+ name: '',
93
+ opacity: 1,
94
+ visible: true,
95
+ selectable: false,
96
+ removable: false,
97
+ alwaysOnTop: true,
98
+ showInExport: true,
99
+ x: store.width - size[0] * DPI - 0.15 * DPI - 9 * DPI,
100
+ y: store.height - size[1] * DPI - 0.125 * DPI,
101
+ width: size[0] * DPI,
102
+ height: size[1] * DPI,
103
+ rotation: 0,
104
+ animations: [],
105
+ blurEnabled: false,
106
+ blurRadius: 10,
107
+ brightnessEnabled: false,
108
+ brightness: 0,
109
+ sepiaEnabled: false,
110
+ grayscaleEnabled: false,
111
+ shadowEnabled: false,
112
+ shadowBlur: 5,
113
+ shadowOffsetX: 0,
114
+ shadowOffsetY: 0,
115
+ shadowColor: 'black',
116
+ shadowOpacity: 1,
117
+ draggable: false,
118
+ resizable: false,
119
+ contentEditable: false,
120
+ styleEditable: false,
121
+ subType: 'rect',
122
+ fill: 'white',
123
+ dash: [],
124
+ strokeWidth: 0,
125
+ stroke: '#0c0c0c',
126
+ cornerRadius: 0,
127
+ },
128
+ {
129
+ id: 'return-address',
130
+ type: 'text',
131
+ name: '',
132
+ opacity: 1,
133
+ visible: true,
134
+ selectable: false,
135
+ removable: false,
136
+ alwaysOnTop: true,
137
+ showInExport: true,
138
+ x: store.width - size[0] * DPI - 0.15 * DPI + 10 - 9 * DPI,
139
+ y: store.height - size[1] * DPI - 0.125 * DPI + 20,
140
+ width: 240,
141
+ height: 20,
142
+ rotation: 0,
143
+ animations: [],
144
+ blurEnabled: false,
145
+ blurRadius: 10,
146
+ brightnessEnabled: false,
147
+ brightness: 0,
148
+ sepiaEnabled: false,
149
+ grayscaleEnabled: false,
150
+ shadowEnabled: false,
151
+ shadowBlur: 5,
152
+ shadowOffsetX: 0,
153
+ shadowOffsetY: 0,
154
+ shadowColor: 'black',
155
+ shadowOpacity: 1,
156
+ draggable: false,
157
+ resizable: false,
158
+ contentEditable: false,
159
+ styleEditable: false,
160
+ text: 'YOUR RETURN ADDRESS \nWILL AUTOMATICALLY \nBE PRINTED IN THIS \nPOSITION',
161
+ placeholder: '',
162
+ fontSize: 12,
163
+ fontFamily: 'Roboto',
164
+ fontStyle: 'normal',
165
+ fontWeight: 'normal',
166
+ textDecoration: '',
167
+ fill: 'black',
168
+ align: 'start',
169
+ verticalAlign: 'top',
170
+ strokeWidth: 0,
171
+ stroke: 'black',
172
+ lineHeight: 1.2,
173
+ letterSpacing: 0,
174
+ backgroundEnabled: false,
175
+ backgroundColor: '#7ED321',
176
+ backgroundOpacity: 1,
177
+ backgroundCornerRadius: 0.5,
178
+ backgroundPadding: 0.5,
179
+ },
180
+ {
181
+ id: 'indicia',
182
+ type: 'text',
183
+ name: '',
184
+ opacity: 1,
185
+ visible: true,
186
+ selectable: false,
187
+ removable: false,
188
+ alwaysOnTop: true,
189
+ showInExport: true,
190
+ x: store.width - 111 - 0.15 * DPI - 9 * DPI,
191
+ y: store.height - size[1] * DPI + 10,
192
+ width: 111,
193
+ height: 40,
194
+ rotation: 0,
195
+ animations: [],
196
+ blurEnabled: false,
197
+ blurRadius: 10,
198
+ brightnessEnabled: false,
199
+ brightness: 0,
200
+ sepiaEnabled: false,
201
+ grayscaleEnabled: false,
202
+ shadowEnabled: false,
203
+ shadowBlur: 5,
204
+ shadowOffsetX: 0,
205
+ shadowOffsetY: 0,
206
+ shadowColor: 'black',
207
+ shadowOpacity: 1,
208
+ draggable: false,
209
+ resizable: false,
210
+ contentEditable: false,
211
+ styleEditable: false,
212
+ text: `POSTAGE\nINDICIA`,
213
+ placeholder: '',
214
+ fontSize: 12,
215
+ fontFamily: 'Roboto',
216
+ fontStyle: 'normal',
217
+ fontWeight: 'normal',
218
+ textDecoration: '',
219
+ fill: 'black',
220
+ align: 'center',
221
+ verticalAlign: 'top',
222
+ strokeWidth: 0,
223
+ stroke: 'black',
224
+ lineHeight: 1.2,
225
+ letterSpacing: 0,
226
+ backgroundEnabled: false,
227
+ backgroundColor: '#7ED321',
228
+ backgroundOpacity: 1,
229
+ backgroundCornerRadius: 0.5,
230
+ backgroundPadding: 0.5,
231
+ },
232
+ {
233
+ id: 'barcode',
234
+ type: 'image',
235
+ name: '',
236
+ opacity: 1,
237
+ visible: true,
238
+ selectable: false,
239
+ removable: false,
240
+ alwaysOnTop: true,
241
+ showInExport: true,
242
+ y: store.height - 12 - size[1] * DPI + 110,
243
+ x: store.width - size[0] * DPI - 0.15 * DPI - 9 * DPI + 40,
244
+ width: size[0] * DPI - 80,
245
+ height: 12,
246
+ rotation: 0,
247
+ animations: [],
248
+ blurEnabled: false,
249
+ brightnessEnabled: false,
250
+ brightness: 0,
251
+ sepiaEnabled: false,
252
+ grayscaleEnabled: false,
253
+ shadowEnabled: false,
254
+ shadowOffsetX: 0,
255
+ shadowOffsetY: 0,
256
+ shadowOpacity: 1,
257
+ draggable: false,
258
+ resizable: false,
259
+ contentEditable: false,
260
+ styleEditable: false,
261
+ src: barcodeSrc,
262
+ cropX: 0,
263
+ cropY: 0,
264
+ cropWidth: 1,
265
+ cropHeight: 1,
266
+ cornerRadius: 0,
267
+ flipX: false,
268
+ flipY: false,
269
+ clipSrc: '',
270
+ borderSize: 0,
271
+ keepRatio: false,
272
+ },
273
+ {
274
+ id: 'recipient-address',
275
+ type: 'text',
276
+ name: '',
277
+ opacity: 1,
278
+ visible: true,
279
+ selectable: false,
280
+ removable: false,
281
+ alwaysOnTop: true,
282
+ showInExport: true,
283
+ x: store.width - size[0] * DPI - 0.15 * DPI + 10 - 9 * DPI,
284
+ y: store.height - size[1] * DPI - 0.125 * DPI + 150,
285
+ width: 240,
286
+ height: 20,
287
+ rotation: 0,
288
+ animations: [],
289
+ blurEnabled: false,
290
+ blurRadius: 10,
291
+ brightnessEnabled: false,
292
+ brightness: 0,
293
+ sepiaEnabled: false,
294
+ grayscaleEnabled: false,
295
+ shadowEnabled: false,
296
+ shadowBlur: 5,
297
+ shadowOffsetX: 0,
298
+ shadowOffsetY: 0,
299
+ shadowColor: 'black',
300
+ shadowOpacity: 1,
301
+ draggable: false,
302
+ resizable: false,
303
+ contentEditable: false,
304
+ styleEditable: false,
305
+ text: 'RECIPIENT ADDRESS \nWILL AUTOMATICALLY \nBE PRINTED IN THIS \nPOSITION',
306
+ placeholder: '',
307
+ fontSize: 12,
308
+ fontFamily: 'Roboto',
309
+ fontStyle: 'normal',
310
+ fontWeight: 'normal',
311
+ textDecoration: '',
312
+ fill: 'black',
313
+ align: 'start',
314
+ verticalAlign: 'top',
315
+ strokeWidth: 0,
316
+ stroke: 'black',
317
+ lineHeight: 1.2,
318
+ letterSpacing: 0,
319
+ backgroundEnabled: false,
320
+ backgroundColor: '#7ED321',
321
+ backgroundOpacity: 1,
322
+ backgroundCornerRadius: 0.5,
323
+ backgroundPadding: 0.5,
324
+ },
325
+ {
326
+ id: 'sequence',
327
+ type: 'text',
328
+ name: '',
329
+ opacity: 1,
330
+ visible: true,
331
+ selectable: false,
332
+ removable: false,
333
+ alwaysOnTop: true,
334
+ showInExport: true,
335
+ x: store.width - 111 - 0.15 * DPI - 9 * DPI,
336
+ y: store.height - size[1] * DPI + 170,
337
+ width: 111,
338
+ height: 40,
339
+ rotation: 0,
340
+ animations: [],
341
+ blurEnabled: false,
342
+ blurRadius: 10,
343
+ brightnessEnabled: false,
344
+ brightness: 0,
345
+ sepiaEnabled: false,
346
+ grayscaleEnabled: false,
347
+ shadowEnabled: false,
348
+ shadowBlur: 5,
349
+ shadowOffsetX: 0,
350
+ shadowOffsetY: 0,
351
+ shadowColor: 'black',
352
+ shadowOpacity: 1,
353
+ draggable: false,
354
+ resizable: false,
355
+ contentEditable: false,
356
+ styleEditable: false,
357
+ text: `Sequence`,
358
+ placeholder: '',
359
+ fontSize: 8,
360
+ fontFamily: 'Roboto',
361
+ fontStyle: 'normal',
362
+ fontWeight: 'normal',
363
+ textDecoration: '',
364
+ fill: 'black',
365
+ align: 'center',
366
+ verticalAlign: 'top',
367
+ strokeWidth: 0,
368
+ stroke: 'black',
369
+ lineHeight: 1.2,
370
+ letterSpacing: 0,
371
+ backgroundEnabled: false,
372
+ backgroundColor: '#7ED321',
373
+ backgroundOpacity: 1,
374
+ backgroundCornerRadius: 0.5,
375
+ backgroundPadding: 0.5,
376
+ },
377
+ {
378
+ id: 'contId',
379
+ type: 'text',
380
+ name: '',
381
+ opacity: 1,
382
+ visible: true,
383
+ selectable: false,
384
+ removable: false,
385
+ alwaysOnTop: true,
386
+ showInExport: true,
387
+ x: store.width - 111 - 0.15 * DPI - 9 * DPI,
388
+ y: store.height - size[1] * DPI + 180,
389
+ width: 111,
390
+ height: 40,
391
+ rotation: 0,
392
+ animations: [],
393
+ blurEnabled: false,
394
+ blurRadius: 10,
395
+ brightnessEnabled: false,
396
+ brightness: 0,
397
+ sepiaEnabled: false,
398
+ grayscaleEnabled: false,
399
+ shadowEnabled: false,
400
+ shadowBlur: 5,
401
+ shadowOffsetX: 0,
402
+ shadowOffsetY: 0,
403
+ shadowColor: 'black',
404
+ shadowOpacity: 1,
405
+ draggable: false,
406
+ resizable: false,
407
+ contentEditable: false,
408
+ styleEditable: false,
409
+ text: `Cont ID`,
410
+ placeholder: '',
411
+ fontSize: 8,
412
+ fontFamily: 'Roboto',
413
+ fontStyle: 'normal',
414
+ fontWeight: 'normal',
415
+ textDecoration: '',
416
+ fill: 'black',
417
+ align: 'center',
418
+ verticalAlign: 'top',
419
+ strokeWidth: 0,
420
+ stroke: 'black',
421
+ lineHeight: 1.2,
422
+ letterSpacing: 0,
423
+ backgroundEnabled: false,
424
+ backgroundColor: '#7ED321',
425
+ backgroundOpacity: 1,
426
+ backgroundCornerRadius: 0.5,
427
+ backgroundPadding: 0.5,
428
+ }
429
+ ]
430
+
431
+ elements.forEach(element => page.addElement(element));
432
+ store.history.clear();
433
+ };