@openlettermarketing/olc-react-sdk 2.1.6-beta.1 → 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.
- package/build/index.js +77 -77
- package/build/index.js.map +1 -1
- package/build/types/src/components/GenericUIBlocks/Dialog/V2/index.d.ts +0 -1
- package/build/types/src/utils/message.d.ts +0 -7
- package/build/types/src/utils/template-builder.d.ts +0 -16
- package/build/types/src/utils/templateIdentifierArea/triFold.d.ts +2 -0
- package/build/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/GenericUIBlocks/Dialog/V2/index.tsx +2 -4
- package/src/components/GenericUIBlocks/Dialog/V2/styles.scss +0 -4
- package/src/components/TopNavigation/index.tsx +0 -44
- package/src/utils/message.ts +1 -8
- package/src/utils/products.ts +1 -1
- package/src/utils/template-builder.ts +3 -66
- package/src/utils/templateIdentifierArea/triFold.ts +26 -8
- package/src/utils/templateRestrictedArea/triFold.ts +8 -6
- package/src/utils/templateSafetyBorders/triFold.ts +27 -20
- package/version.js +1 -1
- package/build/types/src/assets/images/modal-icons/warning.d.ts +0 -3
- package/build/types/src/components/TopNavigation/FieldValidationModal/index.d.ts +0 -11
- package/src/assets/images/modal-icons/warning.tsx +0 -15
- package/src/components/TopNavigation/FieldValidationModal/index.tsx +0 -73
- package/src/components/TopNavigation/FieldValidationModal/styles.scss +0 -39
|
@@ -136,13 +136,6 @@ export declare const MESSAGES: {
|
|
|
136
136
|
readonly DOWNLOAD_ENVELOPE_BUTTON: "Download Envelope Proof";
|
|
137
137
|
readonly CANCEL_BUTTON: "Cancel";
|
|
138
138
|
readonly SUBMIT_BUTTON: "Save";
|
|
139
|
-
readonly FIELD_VALIDATION: {
|
|
140
|
-
readonly TITLE: "Invalid Fields";
|
|
141
|
-
readonly HEADING: "Please fix the following field errors";
|
|
142
|
-
readonly DESCRIPTION: (fieldNames: string) => string;
|
|
143
|
-
readonly INVALID_FORMAT: "is incorrect";
|
|
144
|
-
readonly NOT_UPPERCASE: "is incorrect";
|
|
145
|
-
};
|
|
146
139
|
};
|
|
147
140
|
readonly QR_CODE_MODAL: {
|
|
148
141
|
readonly CREATE_TITLE: "Create New QR Code";
|
|
@@ -72,19 +72,3 @@ export declare const extractCustomRistrictedBoxColor: (jsonData: any) => null;
|
|
|
72
72
|
export declare const validateGSV: (pages: any) => boolean;
|
|
73
73
|
export declare const validateEmoji: (pages: any) => boolean;
|
|
74
74
|
export declare const isValidQR: (pages: any) => boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Interface for invalid field validation results
|
|
77
|
-
*/
|
|
78
|
-
export interface InvalidField {
|
|
79
|
-
field: string;
|
|
80
|
-
issue: 'INVALID_FORMAT' | 'NOT_UPPERCASE';
|
|
81
|
-
pageIndex: number;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Validates template fields for correct format and capitalization
|
|
85
|
-
* Returns array of invalid fields found in the template
|
|
86
|
-
*
|
|
87
|
-
* @param pages - Template pages array from store.toJSON()
|
|
88
|
-
* @returns Array of objects containing invalid fields and their issues
|
|
89
|
-
*/
|
|
90
|
-
export declare const validateTemplateFields: (pages: any) => InvalidField[];
|
package/build/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION: "2.1.6-beta.
|
|
1
|
+
export const SDK_VERSION: "2.1.6-beta.2";
|
package/package.json
CHANGED
|
@@ -27,7 +27,6 @@ interface DialogProps {
|
|
|
27
27
|
isGallery?: boolean;
|
|
28
28
|
currentTheme?: string | null | undefined;
|
|
29
29
|
isQRCode?: boolean;
|
|
30
|
-
hideButtons?: boolean;
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
const buttonStyles: CSSProperties = {
|
|
@@ -81,8 +80,7 @@ const DialogV2: React.FC<DialogProps> = ({
|
|
|
81
80
|
children = [],
|
|
82
81
|
isGallery = false,
|
|
83
82
|
currentTheme = "default",
|
|
84
|
-
isQRCode = false
|
|
85
|
-
hideButtons = false
|
|
83
|
+
isQRCode = false
|
|
86
84
|
}) => {
|
|
87
85
|
const contentAdjust = submitText.length > 6 ? "fit-content" : "100px";
|
|
88
86
|
|
|
@@ -206,7 +204,7 @@ const DialogV2: React.FC<DialogProps> = ({
|
|
|
206
204
|
)}
|
|
207
205
|
{children}
|
|
208
206
|
<div className="confirm-modal-footer">
|
|
209
|
-
{!isGallery &&
|
|
207
|
+
{!isGallery &&
|
|
210
208
|
<>
|
|
211
209
|
<button onClick={onSubmit} disabled={loading}>
|
|
212
210
|
{loading ? <CircularProgress style={progressStyles} /> : submitText}
|
|
@@ -20,7 +20,6 @@ import { searchAndAdvanceChange } from '../../redux/actions/templateActions';
|
|
|
20
20
|
import SaveTemplateModel from './SaveTemplateModel';
|
|
21
21
|
import ConfirmNavigateDialog from './ConfirmNavigateDialog';
|
|
22
22
|
import EditTemplateNameModel from './EditTemplateNameModel';
|
|
23
|
-
import FieldValidationModal from './FieldValidationModal';
|
|
24
23
|
|
|
25
24
|
// Utils
|
|
26
25
|
import {
|
|
@@ -32,8 +31,6 @@ import {
|
|
|
32
31
|
removeBracketsFromRPL,
|
|
33
32
|
validateEmoji,
|
|
34
33
|
validateGSV,
|
|
35
|
-
validateTemplateFields,
|
|
36
|
-
InvalidField,
|
|
37
34
|
} from '../../utils/template-builder';
|
|
38
35
|
import { addSafetyBordersToNonWindowProfessioanl } from '../../utils/templateSafetyBorders/professional';
|
|
39
36
|
import { addIdentifierAreaToProfessionalNonWindow } from '../../utils/templateIdentifierArea/professional';
|
|
@@ -145,7 +142,6 @@ const TopNavigation: React.FC<TopNavigationProps> = ({
|
|
|
145
142
|
const [downloadingProof, setDownloaingProof] = useState<boolean>(false);
|
|
146
143
|
const [downloadingEnvelope, setDownloaingEnvelope] = useState<boolean>(false);
|
|
147
144
|
const [templateTitle, setTemplateTitle] = useState('');
|
|
148
|
-
const [invalidFields, setInvalidFields] = useState<InvalidField[]>([]);
|
|
149
145
|
|
|
150
146
|
const { id } = useParams<{ id: string }>();
|
|
151
147
|
|
|
@@ -451,19 +447,6 @@ const TopNavigation: React.FC<TopNavigationProps> = ({
|
|
|
451
447
|
return;
|
|
452
448
|
}
|
|
453
449
|
|
|
454
|
-
// Validate fields FIRST - before other validations
|
|
455
|
-
const fieldValidationResult = validateTemplateFields(jsonData.pages);
|
|
456
|
-
|
|
457
|
-
if (fieldValidationResult.length > 0) {
|
|
458
|
-
setInvalidFields(fieldValidationResult);
|
|
459
|
-
setIsShowModel((prev) => ({
|
|
460
|
-
...prev,
|
|
461
|
-
open: true,
|
|
462
|
-
model: 'field-validation'
|
|
463
|
-
}));
|
|
464
|
-
return; // Stop save process
|
|
465
|
-
}
|
|
466
|
-
|
|
467
450
|
const hasEmoji = validateEmoji(jsonData.pages);
|
|
468
451
|
|
|
469
452
|
if (hasEmoji) {
|
|
@@ -593,24 +576,6 @@ const TopNavigation: React.FC<TopNavigationProps> = ({
|
|
|
593
576
|
model: string = '',
|
|
594
577
|
loading: string | null = null
|
|
595
578
|
) => {
|
|
596
|
-
// If trying to open save modal, validate fields first
|
|
597
|
-
if (model === 'save' && templateType === 'json') {
|
|
598
|
-
const jsonData = store.toJSON();
|
|
599
|
-
const fieldValidationResult = validateTemplateFields(jsonData.pages);
|
|
600
|
-
|
|
601
|
-
if (fieldValidationResult.length > 0) {
|
|
602
|
-
// Show validation modal instead of save modal
|
|
603
|
-
setInvalidFields(fieldValidationResult);
|
|
604
|
-
setIsShowModel({
|
|
605
|
-
open: true,
|
|
606
|
-
model: 'field-validation',
|
|
607
|
-
loading: false
|
|
608
|
-
});
|
|
609
|
-
return; // Don't open save modal
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
// If validation passed or not save modal, proceed normally
|
|
614
579
|
setIsShowModel((prev) => ({
|
|
615
580
|
...prev,
|
|
616
581
|
open: !prev.open,
|
|
@@ -948,15 +913,6 @@ const TopNavigation: React.FC<TopNavigationProps> = ({
|
|
|
948
913
|
currentTheme={currentTheme}
|
|
949
914
|
/>
|
|
950
915
|
)}
|
|
951
|
-
{/* Field Validation Modal */}
|
|
952
|
-
{isShowModel.open && isShowModel.model === 'field-validation' && (
|
|
953
|
-
<FieldValidationModal
|
|
954
|
-
open={isShowModel.open}
|
|
955
|
-
invalidFields={invalidFields}
|
|
956
|
-
currentTheme={currentTheme}
|
|
957
|
-
handleClose={() => handleChangeModel()}
|
|
958
|
-
/>
|
|
959
|
-
)}
|
|
960
916
|
{/* Duplicate Template Modal */}
|
|
961
917
|
<DuplicateTemplateModal
|
|
962
918
|
open={isShowModel.open && isShowModel.model === 'duplicate'}
|
package/src/utils/message.ts
CHANGED
|
@@ -142,14 +142,7 @@ export const MESSAGES = {
|
|
|
142
142
|
DOWNLOAD_PROOF_BUTTON: "Download Mailer Proof",
|
|
143
143
|
DOWNLOAD_ENVELOPE_BUTTON: "Download Envelope Proof",
|
|
144
144
|
CANCEL_BUTTON: "Cancel",
|
|
145
|
-
SUBMIT_BUTTON: "Save"
|
|
146
|
-
FIELD_VALIDATION: {
|
|
147
|
-
TITLE: "Invalid Fields",
|
|
148
|
-
HEADING: "Please fix the following field errors",
|
|
149
|
-
DESCRIPTION: (fieldNames: string) => `Following fields ${fieldNames} are incorrect to proceed further. You need to fix those`,
|
|
150
|
-
INVALID_FORMAT: "is incorrect",
|
|
151
|
-
NOT_UPPERCASE: "is incorrect",
|
|
152
|
-
},
|
|
145
|
+
SUBMIT_BUTTON: "Save"
|
|
153
146
|
},
|
|
154
147
|
QR_CODE_MODAL: {
|
|
155
148
|
CREATE_TITLE: "Create New QR Code",
|
package/src/utils/products.ts
CHANGED
|
@@ -84,10 +84,10 @@ export const selfMailerProduct = {
|
|
|
84
84
|
],
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
|
-
id: "11", defaultSize: "
|
|
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: "
|
|
90
|
+
size: "11x8.5",
|
|
91
91
|
label: "8.5x11"
|
|
92
92
|
}]
|
|
93
93
|
},
|
|
@@ -325,67 +325,4 @@ export const isValidQR = (pages: any) => {
|
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
return true;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Interface for invalid field validation results
|
|
332
|
-
*/
|
|
333
|
-
export interface InvalidField {
|
|
334
|
-
field: string;
|
|
335
|
-
issue: 'INVALID_FORMAT' | 'NOT_UPPERCASE';
|
|
336
|
-
pageIndex: number;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Validates template fields for correct format and capitalization
|
|
341
|
-
* Returns array of invalid fields found in the template
|
|
342
|
-
*
|
|
343
|
-
* @param pages - Template pages array from store.toJSON()
|
|
344
|
-
* @returns Array of objects containing invalid fields and their issues
|
|
345
|
-
*/
|
|
346
|
-
export const validateTemplateFields = (pages: any): InvalidField[] => {
|
|
347
|
-
const invalidFields: InvalidField[] = [];
|
|
348
|
-
|
|
349
|
-
pages.forEach((page: any, pageIndex: number) => {
|
|
350
|
-
page.children?.forEach((child: any) => {
|
|
351
|
-
if (child.type === 'text' && child.text) {
|
|
352
|
-
const text = child.text;
|
|
353
|
-
|
|
354
|
-
// Find all potential field tokens/fields in the text.
|
|
355
|
-
// A tokentokens/fields is any sequence that contains at least one brace character.
|
|
356
|
-
const tokens = text.split(/\s+/);
|
|
357
|
-
|
|
358
|
-
tokens.forEach((token: string) => {
|
|
359
|
-
if (!token) return;
|
|
360
|
-
|
|
361
|
-
// Only process tokens that contain at least one brace
|
|
362
|
-
if (!token.includes('{') && !token.includes('}')) return;
|
|
363
|
-
|
|
364
|
-
// Valid format: must be EXACTLY {{UPPERCASE_CONTENT}} with no extra chars
|
|
365
|
-
const isValidFormat = /^\{\{[A-Z0-9._]+\}\}$/.test(token);
|
|
366
|
-
|
|
367
|
-
if (!isValidFormat) {
|
|
368
|
-
const content = token.replace(/^\{+|\}+$/g, '');
|
|
369
|
-
const isDoubleBrace = /^\{\{.+\}\}$/.test(token);
|
|
370
|
-
const hasOnlyValidChars = /^[A-Za-z0-9._]+$/.test(content);
|
|
371
|
-
|
|
372
|
-
if (isDoubleBrace && hasOnlyValidChars && content !== content.toUpperCase()) {
|
|
373
|
-
// Double brace but lowercase content
|
|
374
|
-
invalidFields.push({ field: token, issue: 'NOT_UPPERCASE', pageIndex });
|
|
375
|
-
} else {
|
|
376
|
-
// Any other invalid format
|
|
377
|
-
invalidFields.push({ field: token, issue: 'INVALID_FORMAT', pageIndex });
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
});
|
|
383
|
-
});
|
|
384
|
-
|
|
385
|
-
// Remove duplicates
|
|
386
|
-
const uniqueFields = invalidFields.filter((item: InvalidField, index: number, self: InvalidField[]) =>
|
|
387
|
-
index === self.findIndex((t: InvalidField) => t.field === item.field && t.issue === item.issue)
|
|
388
|
-
);
|
|
389
|
-
|
|
390
|
-
return uniqueFields;
|
|
391
|
-
};
|
|
328
|
+
}
|
|
@@ -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:",
|
|
96
|
-
createTextElement("contId", "0000001",
|
|
97
|
-
createTextElement("sequence-id-placeholder", "| S:",
|
|
98
|
-
createTextElement("sequence", "0000001",
|
|
99
|
-
createTextElement("template-id-placeholder", "| T:",
|
|
100
|
-
createTextElement("templateId", "0001034",
|
|
101
|
-
createTextElement("order-id-placeholder", "| O:",
|
|
102
|
-
createTextElement("orderId", "0000127",
|
|
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 -
|
|
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 -
|
|
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 -
|
|
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 -
|
|
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 -
|
|
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
|
-
|
|
19
|
-
|
|
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
|
-
|
|
28
|
-
|
|
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,
|
|
44
|
-
createBorder(`bottom-1-${randomizedId}`, 26,
|
|
45
|
-
createBorder(`left-1-${randomizedId}`, 24.16,
|
|
46
|
-
createBorder(`right-1-${randomizedId}`,
|
|
47
|
-
createBorder(`fold-line-1-${randomizedId}`,
|
|
48
|
-
createBorder(`fold-line-2-${randomizedId}`,
|
|
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
|
-
|
|
64
|
-
|
|
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
|
-
|
|
73
|
-
|
|
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,
|
|
90
|
-
createBorder(`bottom-2-${randomizedId}`, 26,
|
|
91
|
-
createBorder(`left-2-${randomizedId}`, 24.16,
|
|
92
|
-
createBorder(`right-2-${randomizedId}`,
|
|
93
|
-
createBorder(`fold-line-2-1-${randomizedId}`,
|
|
94
|
-
createBorder(`fold-line-2-2-${randomizedId}`,
|
|
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.6-beta.
|
|
1
|
+
export const SDK_VERSION = '2.1.6-beta.2';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { InvalidField } from '../../../utils/template-builder';
|
|
3
|
-
import './styles.scss';
|
|
4
|
-
interface FieldValidationModalProps {
|
|
5
|
-
open: boolean;
|
|
6
|
-
invalidFields: InvalidField[];
|
|
7
|
-
currentTheme?: string | null | undefined;
|
|
8
|
-
handleClose: () => void;
|
|
9
|
-
}
|
|
10
|
-
declare const FieldValidationModal: React.FC<FieldValidationModalProps>;
|
|
11
|
-
export default FieldValidationModal;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
const WarningIcon = (props: any) => {
|
|
4
|
-
const { fill = 'var(--primary-color)' } = props;
|
|
5
|
-
|
|
6
|
-
return (
|
|
7
|
-
<svg width="34" height="34" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8
|
-
<path d="M24 4L4 44H44L24 4Z" stroke={fill} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
9
|
-
<path d="M24 18V28" stroke={fill} strokeWidth="2" strokeLinecap="round"/>
|
|
10
|
-
<circle cx="24" cy="36" r="2" fill={fill}/>
|
|
11
|
-
</svg>
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default WarningIcon;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
// Utils
|
|
4
|
-
import { MESSAGES } from '../../../utils/message';
|
|
5
|
-
|
|
6
|
-
// Components
|
|
7
|
-
import Dialog from '../../GenericUIBlocks/Dialog';
|
|
8
|
-
import DialogV2 from '../../GenericUIBlocks/Dialog/V2';
|
|
9
|
-
|
|
10
|
-
// Icons
|
|
11
|
-
import Warning from '../../../assets/images/modal-icons/warning';
|
|
12
|
-
|
|
13
|
-
// Types
|
|
14
|
-
import { InvalidField } from '../../../utils/template-builder';
|
|
15
|
-
|
|
16
|
-
// Styles
|
|
17
|
-
import './styles.scss';
|
|
18
|
-
|
|
19
|
-
interface FieldValidationModalProps {
|
|
20
|
-
open: boolean;
|
|
21
|
-
invalidFields: InvalidField[];
|
|
22
|
-
currentTheme?: string | null | undefined;
|
|
23
|
-
handleClose: () => void;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const modalStyles = {
|
|
27
|
-
maxWidth: '600px',
|
|
28
|
-
minHeight: '300px',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const modalStylesV2 = {
|
|
32
|
-
maxWidth: '600px',
|
|
33
|
-
minHeight: '300px',
|
|
34
|
-
padding: '40px',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const FieldValidationModal: React.FC<FieldValidationModalProps> = ({
|
|
38
|
-
open,
|
|
39
|
-
invalidFields,
|
|
40
|
-
currentTheme,
|
|
41
|
-
handleClose,
|
|
42
|
-
}) => {
|
|
43
|
-
// Build the description with all field names (reversed so UI order matches template order)
|
|
44
|
-
const fieldNames = [...invalidFields].reverse().map(item => `"${item.field}"`).join(', ');
|
|
45
|
-
const description = MESSAGES.TEMPLATE.FIELD_VALIDATION.DESCRIPTION(fieldNames);
|
|
46
|
-
|
|
47
|
-
return currentTheme === 'v2' ? (
|
|
48
|
-
<DialogV2
|
|
49
|
-
icon={<Warning fill="var(--primary-color)" />}
|
|
50
|
-
customStyles={modalStylesV2}
|
|
51
|
-
open={open}
|
|
52
|
-
handleClose={handleClose}
|
|
53
|
-
title={MESSAGES.TEMPLATE.FIELD_VALIDATION.TITLE}
|
|
54
|
-
subHeading=""
|
|
55
|
-
description={description}
|
|
56
|
-
currentTheme="v2"
|
|
57
|
-
isGallery={false}
|
|
58
|
-
hideButtons={true}
|
|
59
|
-
/>
|
|
60
|
-
) : (
|
|
61
|
-
<Dialog
|
|
62
|
-
icon={<Warning fill="var(--primary-color)" />}
|
|
63
|
-
customStyles={modalStyles}
|
|
64
|
-
open={open}
|
|
65
|
-
handleClose={handleClose}
|
|
66
|
-
title={MESSAGES.TEMPLATE.FIELD_VALIDATION.TITLE}
|
|
67
|
-
subHeading=""
|
|
68
|
-
description={description}
|
|
69
|
-
/>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export default FieldValidationModal;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
.field-validation-content {
|
|
2
|
-
margin-top: 20px;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.field-validation-list {
|
|
6
|
-
max-height: 300px;
|
|
7
|
-
overflow-y: auto;
|
|
8
|
-
padding: 10px;
|
|
9
|
-
background-color: #f9f9f9;
|
|
10
|
-
border-radius: 4px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.field-validation-item {
|
|
14
|
-
margin-bottom: 15px;
|
|
15
|
-
padding: 12px;
|
|
16
|
-
background-color: #fff;
|
|
17
|
-
border-left: 3px solid #ff9800;
|
|
18
|
-
border-radius: 4px;
|
|
19
|
-
|
|
20
|
-
.field-name {
|
|
21
|
-
font-weight: 600;
|
|
22
|
-
color: #333;
|
|
23
|
-
margin-bottom: 5px;
|
|
24
|
-
font-family: 'Courier New', monospace;
|
|
25
|
-
font-size: 14px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.field-error {
|
|
29
|
-
color: #666;
|
|
30
|
-
font-size: 13px;
|
|
31
|
-
margin-bottom: 4px;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.field-location {
|
|
35
|
-
color: #999;
|
|
36
|
-
font-size: 12px;
|
|
37
|
-
font-style: italic;
|
|
38
|
-
}
|
|
39
|
-
}
|