@openlettermarketing/olc-react-sdk 2.1.5 → 2.1.6-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.
@@ -38,6 +38,8 @@ interface Page {
38
38
  addElement: (element: Element) => void;
39
39
  }
40
40
  interface Store {
41
+ width: number;
42
+ height: number;
41
43
  pages: Page[];
42
44
  history: {
43
45
  clear: () => void;
@@ -1 +1 @@
1
- export const SDK_VERSION: "2.1.5";
1
+ export const SDK_VERSION: "2.1.6-beta.2";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openlettermarketing/olc-react-sdk",
3
3
  "private": false,
4
- "version": "2.1.5",
4
+ "version": "2.1.6-beta.2",
5
5
  "type": "module",
6
6
  "description": "Simplify template builder integration for any product.",
7
7
  "main": "build/index.js",
@@ -407,7 +407,9 @@ const CreateTemplateV2: React.FC<CreateTemplateV2Props> = ({
407
407
  <div className='size-selection-container'>
408
408
  <Typography style={descriptionStyles}>Design Format</Typography>
409
409
  <div className='radio-buttons-container'>
410
- {product?.size?.map((type: any) => (
410
+ {product?.size
411
+ ?.filter((type: any) => !restrictedSet.has(String(type.id)))
412
+ .map((type: any) => (
411
413
  <label key={type.id} className={`radio-button-wrapper ${selectedRPLType === type.id ? 'selected' : ''}`}>
412
414
  <input type="radio" name="postcardSize" value={type.id} checked={selectedRPLType === type.id} onChange={() => handleRealPennedLetter(type, product)} className="radio-input" />
413
415
  <span className="radio-button"></span>
@@ -625,11 +625,11 @@ const CustomQRCode = {
625
625
  const handleEditQRCode = async (qrCode: any) => {
626
626
  setIsEditing(true);
627
627
  setSelectedQR(qrCode);
628
- dispatch(setQrUrl(qrCode.url));
629
- dispatch(setUtmSource(qrCode.utmSource || 'direct mail'));
630
- dispatch(setUtmMedium(qrCode.utmMedium || 'QR Code'));
631
- dispatch(setUtmCampaignName(qrCode.utm_campaign_name || ''));
632
- dispatch(setCustomUtms(qrCode.custom_utms || {}));
628
+ dispatch(setQrUrl(qrCode.url ?? ''));
629
+ dispatch(setUtmSource(qrCode.utm_source ?? ''));
630
+ dispatch(setUtmMedium(qrCode.utm_medium ?? ''));
631
+ dispatch(setUtmCampaignName(qrCode.utm_campaign_name ?? ''));
632
+ dispatch(setCustomUtms(qrCode.custom_utms ?? {}));
633
633
 
634
634
  handleDialogChange('qr-modal');
635
635
  setIsActionsOpen(null);
@@ -678,8 +678,8 @@ const CustomQRCode = {
678
678
  name: utmCampaignName,
679
679
  url: url,
680
680
  qrImagePath: uploadedFile,
681
- utm_source: utmSource,
682
- utm_medium: utmMedium,
681
+ utm_source: utmSource || null,
682
+ utm_medium: utmMedium || null,
683
683
  utm_campaign_name: utmCampaignName,
684
684
  custom_utms: customUtms,
685
685
  },
@@ -121,7 +121,7 @@ export const Products: Product[] = [
121
121
  size: [
122
122
  {
123
123
  id: "11",
124
- size: "12x9",
124
+ size: "11x8.5",
125
125
  label: "8.5x11"
126
126
  }
127
127
  ]
@@ -84,10 +84,10 @@ export const selfMailerProduct = {
84
84
  ],
85
85
  },
86
86
  {
87
- id: "11", defaultSize: "12x9", title: "Self Mailer", productType: "Tri-Fold Self-Mailers", hasEnvelope: false, paper: '80# text', label: '8.5x11',
87
+ id: "11", defaultSize: "11x8.5", title: "Self Mailer", productType: "Tri-Fold Self-Mailers", hasEnvelope: false, paper: '80# text', label: '8.5x11',
88
88
  finish: 'Glass Coated', size: [{
89
89
  id: "11",
90
- size: "12x9",
90
+ size: "11x8.5",
91
91
  label: "8.5x11"
92
92
  }]
93
93
  },
@@ -1,3 +1,5 @@
1
+ import { DPI } from "../constants";
2
+
1
3
  // Define the type for the element being added
2
4
  interface Element {
3
5
  id: string;
@@ -43,6 +45,8 @@ interface Page {
43
45
 
44
46
  // Define the type for the store
45
47
  interface Store {
48
+ width: number;
49
+ height: number;
46
50
  pages: Page[];
47
51
  history: {
48
52
  clear: () => void;
@@ -90,16 +94,30 @@ const createTextElement = (
90
94
 
91
95
  export const addIdentifierAreaToTriFold = (store: Store): void => {
92
96
  const page = store.pages[0];
97
+ const foldSectionHeight = store.height / 3;
98
+ const restrictedAreaHeight = 2.375 * DPI;
99
+ const restrictedAreaY = store.height - restrictedAreaHeight - 0.125 * DPI - foldSectionHeight;
100
+ const identifierY = restrictedAreaY + restrictedAreaHeight - 12;
101
+
102
+ // Keep the original right-side alignment behavior, but make it responsive to page width.
103
+ const contPlaceholderX = store.width - 185;
104
+ const contIdX = store.width - 177;
105
+ const sequencePlaceholderX = store.width - 149;
106
+ const sequenceX = store.width - 140;
107
+ const templatePlaceholderX = store.width - 114;
108
+ const templateIdX = store.width - 101.4;
109
+ const orderPlaceholderX = store.width - 72.4;
110
+ const orderIdX = store.width - 61.4;
93
111
 
94
112
  const elements: Element[] = [
95
- createTextElement("cont-id-placeholder", "C:", 679, 739, 11),
96
- createTextElement("contId", "0000001", 687, 739, 30),
97
- createTextElement("sequence-id-placeholder", "| S:", 715, 739, 12),
98
- createTextElement("sequence", "0000001", 724, 739, 29),
99
- createTextElement("template-id-placeholder", "| T:", 750, 739, 14),
100
- createTextElement("templateId", "0001034", 762.6, 739, 29),
101
- createTextElement("order-id-placeholder", "| O:", 791.6, 739, 11),
102
- createTextElement("orderId", "0000127", 802.6, 739, 29),
113
+ createTextElement("cont-id-placeholder", "C:", contPlaceholderX, identifierY, 11),
114
+ createTextElement("contId", "0000001", contIdX, identifierY, 30),
115
+ createTextElement("sequence-id-placeholder", "| S:", sequencePlaceholderX, identifierY, 12),
116
+ createTextElement("sequence", "0000001", sequenceX, identifierY, 29),
117
+ createTextElement("template-id-placeholder", "| T:", templatePlaceholderX, identifierY, 14),
118
+ createTextElement("templateId", "0001034", templateIdX, identifierY, 29),
119
+ createTextElement("order-id-placeholder", "| O:", orderPlaceholderX, identifierY, 11),
120
+ createTextElement("orderId", "0000127", orderIdX, identifierY, 29),
103
121
  ];
104
122
 
105
123
  elements.forEach(element => page.addElement(element));
@@ -85,6 +85,8 @@ interface Store {
85
85
 
86
86
  export const addRestrictedAreaToTriFold = (store: Store, size: [number, number], barcodeSrc: string): void => {
87
87
  const page = store.pages[0];
88
+ const foldSectionHeight = store.height / 3;
89
+ const indiciaLeftShift = 8;
88
90
 
89
91
  const elements: Element[] = [
90
92
  {
@@ -98,7 +100,7 @@ export const addRestrictedAreaToTriFold = (store: Store, size: [number, number],
98
100
  alwaysOnTop: true,
99
101
  showInExport: true,
100
102
  x: store.width - size[0] * DPI - 0.15 * DPI,
101
- y: store.height - size[1] * DPI - 0.125 * DPI - 4 * DPI,
103
+ y: store.height - size[1] * DPI - 0.125 * DPI - foldSectionHeight,
102
104
  width: size[0] * DPI,
103
105
  height: size[1] * DPI,
104
106
  rotation: 0,
@@ -137,7 +139,7 @@ export const addRestrictedAreaToTriFold = (store: Store, size: [number, number],
137
139
  alwaysOnTop: true,
138
140
  showInExport: true,
139
141
  x: store.width - size[0] * DPI - 0.15 * DPI + 5,
140
- y: store.height - size[1] * DPI - 0.125 * DPI + 20 - 4 * DPI,
142
+ y: store.height - size[1] * DPI - 0.125 * DPI + 20 - foldSectionHeight,
141
143
  width: 240,
142
144
  height: 20,
143
145
  rotation: 0,
@@ -188,8 +190,8 @@ export const addRestrictedAreaToTriFold = (store: Store, size: [number, number],
188
190
  removable: false,
189
191
  alwaysOnTop: true,
190
192
  showInExport: true,
191
- x: store.width - 111 - 0.15 * DPI,
192
- y: store.height - size[1] * DPI + 10 - 4 * DPI,
193
+ x: store.width - 111 - 0.15 * DPI - indiciaLeftShift,
194
+ y: store.height - size[1] * DPI + 10 - foldSectionHeight,
193
195
  width: 111,
194
196
  height: 40,
195
197
  rotation: 0,
@@ -240,7 +242,7 @@ export const addRestrictedAreaToTriFold = (store: Store, size: [number, number],
240
242
  removable: false,
241
243
  alwaysOnTop: true,
242
244
  showInExport: true,
243
- y: store.height - 28 - size[1] * DPI + 100 - 4 * DPI,
245
+ y: store.height - 28 - size[1] * DPI + 100 - foldSectionHeight,
244
246
  x: store.width - size[0] * DPI - 0.15 * DPI + 5,
245
247
  width: size[0] * DPI - 23,
246
248
  height: 15,
@@ -282,7 +284,7 @@ export const addRestrictedAreaToTriFold = (store: Store, size: [number, number],
282
284
  alwaysOnTop: true,
283
285
  showInExport: true,
284
286
  x: store.width - size[0] * DPI - 0.15 * DPI + 5,
285
- y: store.height - size[1] * DPI - 0.125 * DPI + 120 - 4 * DPI,
287
+ y: store.height - size[1] * DPI - 0.125 * DPI + 120 - foldSectionHeight,
286
288
  width: 240,
287
289
  height: 20,
288
290
  rotation: 0,
@@ -3,6 +3,13 @@ import { Element, Store } from "./types"
3
3
 
4
4
  export const addSafetyBordersToTriFold = (store: Store): void => {
5
5
  const randomizedId = Math.random().toString(36).substring(2, 7);
6
+ const borderWidth = store.width + 2;
7
+ const borderHeight = store.height - 52;
8
+ const foldSectionHeight = store.height / 3;
9
+ const foldLineOneY = foldSectionHeight;
10
+ const foldLineTwoY = foldSectionHeight * 2 - 5;
11
+ const borderBottomY = store.height - 28.4;
12
+ const rightBorderX = store.width - 29;
6
13
 
7
14
  const safetyBordersTextFirst = createSafetyTextElement(
8
15
  `safety-text-1-${randomizedId}`,
@@ -15,8 +22,8 @@ export const addSafetyBordersToTriFold = (store: Store): void => {
15
22
  const safetyLineTextFirst = createSafetyTextElement(
16
23
  `safety-line-1-${randomizedId}`,
17
24
  -2,
18
- 366,
19
- 866,
25
+ foldLineOneY - 18,
26
+ borderWidth,
20
27
  "Fold Line",
21
28
  0
22
29
  );
@@ -24,8 +31,8 @@ export const addSafetyBordersToTriFold = (store: Store): void => {
24
31
  const safetySecondLineTextFirst = createSafetyTextElement(
25
32
  `safety-line-2-${randomizedId}`,
26
33
  -2,
27
- 744,
28
- 866,
34
+ foldLineTwoY - 19,
35
+ borderWidth,
29
36
  "Fold Line",
30
37
  0
31
38
  );
@@ -40,12 +47,12 @@ export const addSafetyBordersToTriFold = (store: Store): void => {
40
47
  alwaysOnTop: true,
41
48
  showInExport: false,
42
49
  children: [
43
- createBorder(`top-1-${randomizedId}`, 26, 23.5, 811, 4, 0),
44
- createBorder(`bottom-1-${randomizedId}`, 26, 1123.6, 811, 4, 0),
45
- createBorder(`left-1-${randomizedId}`, 24.16, 1125, 1100, 4, -90),
46
- createBorder(`right-1-${randomizedId}`, 835, 1125, 1100, 4, -90),
47
- createBorder(`fold-line-1-${randomizedId}`, 866, 384, 866, 2, 180, 'rgba(208,2,27,1)'),
48
- createBorder(`fold-line-2-${randomizedId}`, 866, 763, 866, 2, 180, 'rgba(208,2,27,1)'),
50
+ createBorder(`top-1-${randomizedId}`, 26, 23.5, borderWidth - 55, 4, 0),
51
+ createBorder(`bottom-1-${randomizedId}`, 26, borderBottomY, borderWidth - 55, 4, 0),
52
+ createBorder(`left-1-${randomizedId}`, 24.16, borderBottomY + 1.4, borderHeight, 4, -90),
53
+ createBorder(`right-1-${randomizedId}`, rightBorderX, borderBottomY + 1.4, borderHeight, 4, -90),
54
+ createBorder(`fold-line-1-${randomizedId}`, borderWidth, foldLineOneY, borderWidth, 2, 180, 'rgba(208,2,27,1)'),
55
+ createBorder(`fold-line-2-${randomizedId}`, borderWidth, foldLineTwoY, borderWidth, 2, 180, 'rgba(208,2,27,1)'),
49
56
  ],
50
57
  };
51
58
 
@@ -60,8 +67,8 @@ export const addSafetyBordersToTriFold = (store: Store): void => {
60
67
  const safetyLineTextSecond = createSafetyTextElement(
61
68
  `safety-line-2-1-${randomizedId}`,
62
69
  -2,
63
- 366,
64
- 866,
70
+ foldLineOneY - 18,
71
+ borderWidth,
65
72
  "Fold Line",
66
73
  0
67
74
  );
@@ -69,8 +76,8 @@ export const addSafetyBordersToTriFold = (store: Store): void => {
69
76
  const safetySecondLineTextSecond = createSafetyTextElement(
70
77
  `safety-line-2-2-${randomizedId}`,
71
78
  -2,
72
- 744,
73
- 866,
79
+ foldLineTwoY - 19,
80
+ borderWidth,
74
81
  "Fold Line",
75
82
  0
76
83
  );
@@ -86,12 +93,12 @@ export const addSafetyBordersToTriFold = (store: Store): void => {
86
93
  alwaysOnTop: true,
87
94
  showInExport: false,
88
95
  children: [
89
- createBorder(`top-2-${randomizedId}`, 26, 23.5, 811, 4, 0),
90
- createBorder(`bottom-2-${randomizedId}`, 26, 1123.6, 811, 4, 0),
91
- createBorder(`left-2-${randomizedId}`, 24.16, 1125, 1100, 4, -90),
92
- createBorder(`right-2-${randomizedId}`, 835, 1125, 1100, 4, -90),
93
- createBorder(`fold-line-2-1-${randomizedId}`, 866, 384, 866, 2, 180, 'rgba(208,2,27,1)'),
94
- createBorder(`fold-line-2-2-${randomizedId}`, 866, 763, 866, 2, 180, 'rgba(208,2,27,1)'),
96
+ createBorder(`top-2-${randomizedId}`, 26, 23.5, borderWidth - 55, 4, 0),
97
+ createBorder(`bottom-2-${randomizedId}`, 26, borderBottomY, borderWidth - 55, 4, 0),
98
+ createBorder(`left-2-${randomizedId}`, 24.16, borderBottomY + 1.4, borderHeight, 4, -90),
99
+ createBorder(`right-2-${randomizedId}`, rightBorderX, borderBottomY + 1.4, borderHeight, 4, -90),
100
+ createBorder(`fold-line-2-1-${randomizedId}`, borderWidth, foldLineOneY, borderWidth, 2, 180, 'rgba(208,2,27,1)'),
101
+ createBorder(`fold-line-2-2-${randomizedId}`, borderWidth, foldLineTwoY, borderWidth, 2, 180, 'rgba(208,2,27,1)'),
95
102
  ],
96
103
  };
97
104
 
package/version.js CHANGED
@@ -1 +1 @@
1
- export const SDK_VERSION = '2.1.5';
1
+ export const SDK_VERSION = '2.1.6-beta.2';