@openlettermarketing/olc-react-sdk 2.1.6-beta.3 → 2.1.6-beta.4
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 +4 -4
- package/build/index.js.map +1 -1
- package/build/types/src/assets/images/modal-icons/checkbox-checked.d.ts +3 -0
- package/build/types/src/assets/images/modal-icons/checkbox-unchecked.d.ts +3 -0
- package/build/types/src/components/GenericUIBlocks/Dialog/V2/index.d.ts +1 -0
- package/build/types/src/components/GenericUIBlocks/Dialog/index.d.ts +1 -0
- package/build/types/src/components/TopNavigation/FieldValidationModal/index.d.ts +1 -1
- package/build/types/src/utils/message.d.ts +2 -1
- package/build/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/assets/images/modal-icons/checkbox-checked.tsx +24 -0
- package/src/assets/images/modal-icons/checkbox-unchecked.tsx +13 -0
- package/src/components/GenericUIBlocks/Dialog/V2/index.tsx +5 -3
- package/src/components/GenericUIBlocks/Dialog/V2/styles.scss +6 -1
- package/src/components/GenericUIBlocks/Dialog/index.tsx +4 -2
- package/src/components/TopNavigation/FieldValidationModal/index.tsx +44 -10
- package/src/components/TopNavigation/FieldValidationModal/styles.scss +40 -31
- package/src/components/TopNavigation/index.tsx +4 -3
- package/src/utils/message.ts +2 -1
- package/version.js +1 -1
|
@@ -6,7 +6,7 @@ interface FieldValidationModalProps {
|
|
|
6
6
|
currentTheme?: string | null | undefined;
|
|
7
7
|
loading?: boolean;
|
|
8
8
|
handleClose: () => void;
|
|
9
|
-
handleContinue: () => void;
|
|
9
|
+
handleContinue: (acknowledged: boolean) => void;
|
|
10
10
|
}
|
|
11
11
|
declare const FieldValidationModal: React.FC<FieldValidationModalProps>;
|
|
12
12
|
export default FieldValidationModal;
|
|
@@ -139,7 +139,8 @@ export declare const MESSAGES: {
|
|
|
139
139
|
readonly FIELD_VALIDATION: {
|
|
140
140
|
readonly TITLE: "Invalid Fields";
|
|
141
141
|
readonly HEADING: "The following fields are not recognized";
|
|
142
|
-
readonly DESCRIPTION: (
|
|
142
|
+
readonly DESCRIPTION: "The following field(s) used in this template are not recognized by the system. You can save the template as is, but these fields will not populate with data. To resolve this, remove or replace them with valid field names.";
|
|
143
|
+
readonly ACKNOWLEDGE_LABEL: "I understand that saving now will preserve these invalid fields, but they will not be populated with data.";
|
|
143
144
|
readonly CONTINUE_BUTTON: "Continue Saving";
|
|
144
145
|
readonly CANCEL_BUTTON: "Cancel";
|
|
145
146
|
};
|
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.4";
|
package/package.json
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const CheckboxChecked = (props: any) => {
|
|
4
|
+
const { fill = 'var(--primary-color)' } = props;
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<svg width="18" height="18" viewBox="0 0 14 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8
|
+
<rect y="0.5" width="14" height="14" rx="2" fill={fill} />
|
|
9
|
+
<g clipPath="url(#clip0_checkbox_checked)">
|
|
10
|
+
<path
|
|
11
|
+
d="M11.7909 4.97078C11.5124 4.69194 11.0602 4.69212 10.7814 4.97078L6.23808 9.51428L4.21877 7.49498C3.93994 7.21615 3.48796 7.21615 3.20912 7.49498C2.93029 7.77381 2.93029 8.2258 3.20912 8.50463L5.73315 11.0287C5.87248 11.168 6.05518 11.2378 6.23789 11.2378C6.4206 11.2378 6.60347 11.1682 6.7428 11.0287L11.7909 5.98041C12.0697 5.70177 12.0697 5.24959 11.7909 4.97078Z"
|
|
12
|
+
fill="white"
|
|
13
|
+
/>
|
|
14
|
+
</g>
|
|
15
|
+
<defs>
|
|
16
|
+
<clipPath id="clip0_checkbox_checked">
|
|
17
|
+
<rect width="9" height="9" fill="white" transform="translate(3 3.5)" />
|
|
18
|
+
</clipPath>
|
|
19
|
+
</defs>
|
|
20
|
+
</svg>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default CheckboxChecked;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const CheckboxUnchecked = (props: any) => {
|
|
4
|
+
const { stroke = '#303030' } = props;
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<svg width="18" height="18" viewBox="0 0 14 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8
|
+
<rect x="0.25" y="0.75" width="13.5" height="13.5" rx="1.75" stroke={stroke} strokeWidth="0.5" />
|
|
9
|
+
</svg>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default CheckboxUnchecked;
|
|
@@ -28,6 +28,7 @@ interface DialogProps {
|
|
|
28
28
|
currentTheme?: string | null | undefined;
|
|
29
29
|
isQRCode?: boolean;
|
|
30
30
|
hideButtons?: boolean;
|
|
31
|
+
submitDisabled?: boolean;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
const buttonStyles: CSSProperties = {
|
|
@@ -82,7 +83,8 @@ const DialogV2: React.FC<DialogProps> = ({
|
|
|
82
83
|
isGallery = false,
|
|
83
84
|
currentTheme = "default",
|
|
84
85
|
isQRCode = false,
|
|
85
|
-
hideButtons = false
|
|
86
|
+
hideButtons = false,
|
|
87
|
+
submitDisabled = false,
|
|
86
88
|
}) => {
|
|
87
89
|
const contentAdjust = submitText.length > 6 ? "fit-content" : "100px";
|
|
88
90
|
|
|
@@ -164,7 +166,7 @@ const DialogV2: React.FC<DialogProps> = ({
|
|
|
164
166
|
<div className="modal-footer">
|
|
165
167
|
{(!isGallery || isQRCode) &&
|
|
166
168
|
<>
|
|
167
|
-
<button onClick={onSubmit} disabled={loading}>
|
|
169
|
+
<button onClick={onSubmit} disabled={loading || submitDisabled}>
|
|
168
170
|
{loading ? <CircularProgress style={progressStyles} /> : submitText}
|
|
169
171
|
</button>
|
|
170
172
|
<button onClick={onCancel}>
|
|
@@ -208,7 +210,7 @@ const DialogV2: React.FC<DialogProps> = ({
|
|
|
208
210
|
<div className="confirm-modal-footer">
|
|
209
211
|
{!isGallery && !hideButtons &&
|
|
210
212
|
<>
|
|
211
|
-
<button onClick={onSubmit} disabled={loading}>
|
|
213
|
+
<button onClick={onSubmit} disabled={loading || submitDisabled}>
|
|
212
214
|
{loading ? <CircularProgress style={progressStyles} /> : submitText}
|
|
213
215
|
</button>
|
|
214
216
|
<button onClick={onCancel}>
|
|
@@ -249,9 +249,14 @@
|
|
|
249
249
|
justify-content: center;
|
|
250
250
|
align-items: center;
|
|
251
251
|
|
|
252
|
-
&:hover{
|
|
252
|
+
&:hover:not(:disabled){
|
|
253
253
|
background-color: var(--primary-color-btn-hover);
|
|
254
254
|
}
|
|
255
|
+
|
|
256
|
+
&:disabled{
|
|
257
|
+
opacity: 0.45;
|
|
258
|
+
cursor: not-allowed;
|
|
259
|
+
}
|
|
255
260
|
}
|
|
256
261
|
|
|
257
262
|
&:last-child{
|
|
@@ -28,6 +28,7 @@ interface DialogProps {
|
|
|
28
28
|
children?: ReactNode;
|
|
29
29
|
isGallery?: boolean;
|
|
30
30
|
currentTheme?: string | null | undefined;
|
|
31
|
+
submitDisabled?: boolean;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
const buttonStyles: CSSProperties = {
|
|
@@ -73,7 +74,8 @@ const Dialog: React.FC<DialogProps> = ({
|
|
|
73
74
|
submitText = "",
|
|
74
75
|
children = [],
|
|
75
76
|
isGallery = false,
|
|
76
|
-
currentTheme = "default"
|
|
77
|
+
currentTheme = "default",
|
|
78
|
+
submitDisabled = false,
|
|
77
79
|
}) => {
|
|
78
80
|
const contentAdjust = submitText.length > 6 ? "fit-content" : "100px";
|
|
79
81
|
|
|
@@ -170,7 +172,7 @@ const Dialog: React.FC<DialogProps> = ({
|
|
|
170
172
|
<Button
|
|
171
173
|
style={{ ...buttonStyles, border: 'none', maxWidth: contentAdjust }}
|
|
172
174
|
onClick={onSubmit}
|
|
173
|
-
disabled={loading}
|
|
175
|
+
disabled={loading || submitDisabled}
|
|
174
176
|
>
|
|
175
177
|
{loading ? <CircularProgress style={progressStyles} /> : submitText}
|
|
176
178
|
</Button>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
// Utils
|
|
4
4
|
import { MESSAGES } from '../../../utils/message';
|
|
@@ -9,6 +9,10 @@ import DialogV2 from '../../GenericUIBlocks/Dialog/V2';
|
|
|
9
9
|
|
|
10
10
|
// Icons
|
|
11
11
|
import Warning from '../../../assets/images/modal-icons/warning';
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
import CheckboxChecked from '../../../assets/images/modal-icons/checkbox-checked';
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
import CheckboxUnchecked from '../../../assets/images/modal-icons/checkbox-unchecked';
|
|
12
16
|
|
|
13
17
|
// Styles
|
|
14
18
|
import './styles.scss';
|
|
@@ -19,7 +23,7 @@ interface FieldValidationModalProps {
|
|
|
19
23
|
currentTheme?: string | null | undefined;
|
|
20
24
|
loading?: boolean;
|
|
21
25
|
handleClose: () => void;
|
|
22
|
-
handleContinue: () => void;
|
|
26
|
+
handleContinue: (acknowledged: boolean) => void;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
const modalStyles = {
|
|
@@ -41,8 +45,34 @@ const FieldValidationModal: React.FC<FieldValidationModalProps> = ({
|
|
|
41
45
|
handleClose,
|
|
42
46
|
handleContinue,
|
|
43
47
|
}) => {
|
|
44
|
-
const
|
|
45
|
-
|
|
48
|
+
const [acknowledged, setAcknowledged] = useState(false);
|
|
49
|
+
|
|
50
|
+
// Reset checkbox whenever the modal opens with a new set of fields
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (open) {
|
|
53
|
+
setAcknowledged(false);
|
|
54
|
+
}
|
|
55
|
+
}, [open]);
|
|
56
|
+
|
|
57
|
+
const content = (
|
|
58
|
+
<div className="field-validation-content">
|
|
59
|
+
<p className="field-validation-description">
|
|
60
|
+
{MESSAGES.TEMPLATE.FIELD_VALIDATION.DESCRIPTION}
|
|
61
|
+
</p>
|
|
62
|
+
<ol className="field-validation-list">
|
|
63
|
+
{invalidFields.map((field, index) => (
|
|
64
|
+
<li key={index}>{field}</li>
|
|
65
|
+
))}
|
|
66
|
+
</ol>
|
|
67
|
+
<label
|
|
68
|
+
className="field-validation-acknowledge"
|
|
69
|
+
onClick={() => setAcknowledged((prev) => !prev)}
|
|
70
|
+
>
|
|
71
|
+
{acknowledged ? <CheckboxChecked /> : <CheckboxUnchecked />}
|
|
72
|
+
{MESSAGES.TEMPLATE.FIELD_VALIDATION.ACKNOWLEDGE_LABEL}
|
|
73
|
+
</label>
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
46
76
|
|
|
47
77
|
return currentTheme === 'v2' ? (
|
|
48
78
|
<DialogV2
|
|
@@ -53,14 +83,16 @@ const FieldValidationModal: React.FC<FieldValidationModalProps> = ({
|
|
|
53
83
|
handleClose={handleClose}
|
|
54
84
|
title={MESSAGES.TEMPLATE.FIELD_VALIDATION.TITLE}
|
|
55
85
|
subHeading=""
|
|
56
|
-
description={description}
|
|
57
86
|
currentTheme="v2"
|
|
58
87
|
isGallery={false}
|
|
59
|
-
onSubmit={handleContinue}
|
|
88
|
+
onSubmit={() => handleContinue(acknowledged)}
|
|
60
89
|
submitText={MESSAGES.TEMPLATE.FIELD_VALIDATION.CONTINUE_BUTTON}
|
|
90
|
+
submitDisabled={!acknowledged}
|
|
61
91
|
onCancel={handleClose}
|
|
62
92
|
cancelText={MESSAGES.TEMPLATE.FIELD_VALIDATION.CANCEL_BUTTON}
|
|
63
|
-
|
|
93
|
+
>
|
|
94
|
+
{content}
|
|
95
|
+
</DialogV2>
|
|
64
96
|
) : (
|
|
65
97
|
<Dialog
|
|
66
98
|
icon={<Warning fill="var(--primary-color)" />}
|
|
@@ -70,12 +102,14 @@ const FieldValidationModal: React.FC<FieldValidationModalProps> = ({
|
|
|
70
102
|
handleClose={handleClose}
|
|
71
103
|
title={MESSAGES.TEMPLATE.FIELD_VALIDATION.TITLE}
|
|
72
104
|
subHeading=""
|
|
73
|
-
|
|
74
|
-
onSubmit={handleContinue}
|
|
105
|
+
onSubmit={() => handleContinue(acknowledged)}
|
|
75
106
|
submitText={MESSAGES.TEMPLATE.FIELD_VALIDATION.CONTINUE_BUTTON}
|
|
107
|
+
submitDisabled={!acknowledged}
|
|
76
108
|
onCancel={handleClose}
|
|
77
109
|
cancelText={MESSAGES.TEMPLATE.FIELD_VALIDATION.CANCEL_BUTTON}
|
|
78
|
-
|
|
110
|
+
>
|
|
111
|
+
{content}
|
|
112
|
+
</Dialog>
|
|
79
113
|
);
|
|
80
114
|
};
|
|
81
115
|
|
|
@@ -1,39 +1,48 @@
|
|
|
1
1
|
.field-validation-content {
|
|
2
|
-
|
|
2
|
+
width: 100%;
|
|
3
|
+
margin-top: 12px;
|
|
4
|
+
text-align: left;
|
|
3
5
|
}
|
|
4
6
|
|
|
5
|
-
.field-validation-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
.field-validation-description {
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
font-weight: 400;
|
|
10
|
+
color: var(--text-color);
|
|
11
|
+
line-height: 20px;
|
|
12
|
+
font-family: var(--font-family);
|
|
13
|
+
margin: 0 0 12px 0;
|
|
14
|
+
padding: 0;
|
|
11
15
|
}
|
|
12
16
|
|
|
13
|
-
.field-validation-
|
|
14
|
-
margin
|
|
15
|
-
padding:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
font-family:
|
|
25
|
-
font-size: 14px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.field-error {
|
|
29
|
-
color: #666;
|
|
30
|
-
font-size: 13px;
|
|
31
|
-
margin-bottom: 4px;
|
|
17
|
+
.field-validation-list {
|
|
18
|
+
margin: 0 0 16px 0;
|
|
19
|
+
padding-left: 20px;
|
|
20
|
+
|
|
21
|
+
li {
|
|
22
|
+
font-size: 16px;
|
|
23
|
+
font-weight: 400;
|
|
24
|
+
color: var(--text-color);
|
|
25
|
+
line-height: 20px;
|
|
26
|
+
margin-bottom: 6px;
|
|
27
|
+
word-break: break-all;
|
|
28
|
+
font-family: var(--font-family);
|
|
32
29
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.field-validation-acknowledge {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: flex-start;
|
|
35
|
+
gap: 8px;
|
|
36
|
+
font-size: 16px;
|
|
37
|
+
font-weight: 400;
|
|
38
|
+
color: var(--text-color);
|
|
39
|
+
line-height: 20px;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
user-select: none;
|
|
42
|
+
font-family: var(--font-family);
|
|
43
|
+
|
|
44
|
+
svg {
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
margin-top: 1px;
|
|
38
47
|
}
|
|
39
48
|
}
|
|
@@ -430,9 +430,10 @@ const TopNavigation: React.FC<TopNavigationProps> = ({
|
|
|
430
430
|
}
|
|
431
431
|
};
|
|
432
432
|
|
|
433
|
-
const handleSave = async () => {
|
|
433
|
+
const handleSave = async (invalidFieldsAcknowledged: boolean = false) => {
|
|
434
434
|
try {
|
|
435
435
|
const formData = new FormData();
|
|
436
|
+
formData.append('invalidFieldsAcknowledged', String(invalidFieldsAcknowledged));
|
|
436
437
|
const allFields = [
|
|
437
438
|
...defaultFields,
|
|
438
439
|
...customFields,
|
|
@@ -576,9 +577,9 @@ const TopNavigation: React.FC<TopNavigationProps> = ({
|
|
|
576
577
|
}
|
|
577
578
|
};
|
|
578
579
|
|
|
579
|
-
const handleContinueAnyway = () => {
|
|
580
|
+
const handleContinueAnyway = (acknowledged: boolean) => {
|
|
580
581
|
setIsShowModel((prev) => ({ ...prev, loading: true }));
|
|
581
|
-
handleSave();
|
|
582
|
+
handleSave(acknowledged);
|
|
582
583
|
};
|
|
583
584
|
|
|
584
585
|
const handleChangeModel = (
|
package/src/utils/message.ts
CHANGED
|
@@ -146,7 +146,8 @@ export const MESSAGES = {
|
|
|
146
146
|
FIELD_VALIDATION: {
|
|
147
147
|
TITLE: "Invalid Fields",
|
|
148
148
|
HEADING: "The following fields are not recognized",
|
|
149
|
-
DESCRIPTION:
|
|
149
|
+
DESCRIPTION: "The following field(s) used in this template are not recognized by the system. You can save the template as is, but these fields will not populate with data. To resolve this, remove or replace them with valid field names.",
|
|
150
|
+
ACKNOWLEDGE_LABEL: "I understand that saving now will preserve these invalid fields, but they will not be populated with data.",
|
|
150
151
|
CONTINUE_BUTTON: "Continue Saving",
|
|
151
152
|
CANCEL_BUTTON: "Cancel",
|
|
152
153
|
},
|
package/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = '2.1.6-beta.
|
|
1
|
+
export const SDK_VERSION = '2.1.6-beta.4';
|