@capillarytech/creatives-library 8.0.287-alpha.2 → 8.0.287-alpha.3
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/package.json
CHANGED
|
@@ -712,7 +712,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
712
712
|
if (channel && channel.toUpperCase() === SMS) {
|
|
713
713
|
for (let count = 0; count < this.state.tabCount; count += 1) {
|
|
714
714
|
if (_.isEmpty(errorData[count])) {
|
|
715
|
-
return
|
|
715
|
+
// Do not return early. An empty tab object can appear transiently and returning here
|
|
716
|
+
// prevents onFormValidityChange from firing, which makes Done appear unresponsive.
|
|
717
|
+
errorData[count] = {};
|
|
716
718
|
}
|
|
717
719
|
const index = count + 1;
|
|
718
720
|
if (!this.state.formData[count]) {
|
|
@@ -49,6 +49,7 @@ function SlideBoxFooter(props) {
|
|
|
49
49
|
// Only apply validation state checks for EMAIL channel in HTML Editor mode (not BEE/DragDrop)
|
|
50
50
|
// For other channels, BEE editor, or when htmlEditorValidationState is not provided, don't disable based on validation
|
|
51
51
|
const isEmailChannel = currentChannel?.toUpperCase() === 'EMAIL';
|
|
52
|
+
const isSmsChannel = currentChannel?.toUpperCase() === 'SMS';
|
|
52
53
|
const isEditMode = slidBoxContent === 'editTemplate';
|
|
53
54
|
|
|
54
55
|
// Use selectedEmailCreateMode for accurate mode detection in create mode (emailCreateMode is mapped for backwards compatibility)
|
|
@@ -125,8 +126,9 @@ function SlideBoxFooter(props) {
|
|
|
125
126
|
const isBEEEditorModeInCreate = !isHTMLEditorMode && !isEditMode;
|
|
126
127
|
const isBEEEditorMode = isBEEEditorModeInEdit || isBEEEditorModeInCreate;
|
|
127
128
|
const hasBEEEditorErrors = isEmailChannel && isBEEEditorMode && (hasStandardErrors || hasLiquidErrors) && (!htmlEditorValidationState || !htmlEditorHasErrors);
|
|
129
|
+
const hasSmsValidationErrors = isSmsChannel && hasStandardErrors;
|
|
128
130
|
|
|
129
|
-
const shouldShowErrorInfoNote = hasBEEEditorErrors || isSupportCKEditor;
|
|
131
|
+
const shouldShowErrorInfoNote = hasBEEEditorErrors || hasSmsValidationErrors || isSupportCKEditor;
|
|
130
132
|
return (
|
|
131
133
|
<div className="template-footer-width">
|
|
132
134
|
{shouldShowErrorInfoNote && (
|
|
@@ -674,25 +674,14 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
674
674
|
let tab = this.state.currentTab;
|
|
675
675
|
const isAndroidInvalid = Object.values(errorData[0]).includes(true);
|
|
676
676
|
const isIosInvalid = Object.values(errorData[1]).includes(true);
|
|
677
|
-
let isTagErrorExist = false;
|
|
678
677
|
if (isAndroidInvalid) {
|
|
679
678
|
tab = 1;
|
|
680
679
|
errorMessage.description = intl.formatMessage(messages.invalidAndroidMessage);
|
|
681
|
-
const invalidTags = errorData[0]['invalid-tags'];
|
|
682
|
-
if (!isEmpty(invalidTags)) {
|
|
683
|
-
isTagErrorExist = true;
|
|
684
|
-
errorMessage.description = `${intl.formatMessage(messages.invalidAndroidMessage)} ${intl.formatMessage(messages.invalidTags)}: ${invalidTags.join(',')} `;
|
|
685
|
-
}
|
|
686
680
|
} else if (isIosInvalid) {
|
|
687
681
|
tab = 2;
|
|
688
682
|
errorMessage.description = intl.formatMessage(messages.invalidIosMessage);
|
|
689
|
-
const invalidTags = errorData[1]['invalid-tags'];
|
|
690
|
-
if (!isEmpty(invalidTags)) {
|
|
691
|
-
isTagErrorExist = true;
|
|
692
|
-
errorMessage.description = `${intl.formatMessage(messages.invalidIosMessage)} ${intl.formatMessage(messages.invalidTags)}: ${invalidTags.join(',')} `;
|
|
693
|
-
}
|
|
694
683
|
}
|
|
695
|
-
if (tab !== this.state.currentTab
|
|
684
|
+
if (tab !== this.state.currentTab) {
|
|
696
685
|
CapNotification.error(errorMessage);
|
|
697
686
|
}
|
|
698
687
|
}
|
|
@@ -698,7 +698,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
698
698
|
const {intl} = this.props;
|
|
699
699
|
const {errorData} = this.state;
|
|
700
700
|
const errorMessage = {key: 'validation-error', message: intl.formatMessage(messages.validationError)};
|
|
701
|
-
let isTagErrorExist = false;
|
|
702
701
|
if (!_.isEmpty(this.state.formData) && !this.state.isFormValid) {
|
|
703
702
|
let tab = this.state.currentTab;
|
|
704
703
|
const isAndroidInvalid = Object.values(errorData[0]).includes(true);
|
|
@@ -706,22 +705,12 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
706
705
|
if (isAndroidInvalid) {
|
|
707
706
|
tab = 1;
|
|
708
707
|
errorMessage.description = intl.formatMessage(messages.invalidAndroidMessage);
|
|
709
|
-
const invalidTags = errorData[0]['invalid-tags'];
|
|
710
|
-
if (!_.isEmpty(invalidTags)) {
|
|
711
|
-
isTagErrorExist = true;
|
|
712
|
-
errorMessage.description = `${intl.formatMessage(messages.invalidAndroidMessage)} ${intl.formatMessage(messages.invalidTags)}: ${invalidTags.join(',')} `;
|
|
713
|
-
}
|
|
714
708
|
} else if (isIosInvalid) {
|
|
715
709
|
tab = 2;
|
|
716
710
|
errorMessage.description = intl.formatMessage(messages.invalidIosMessage);
|
|
717
|
-
const invalidTags = errorData[1]['invalid-tags'];
|
|
718
|
-
if (!_.isEmpty(invalidTags)) {
|
|
719
|
-
isTagErrorExist = true;
|
|
720
|
-
errorMessage.description = `${intl.formatMessage(messages.invalidIosMessage)} ${intl.formatMessage(messages.invalidTags)}: ${invalidTags.join(',')} `;
|
|
721
|
-
}
|
|
722
711
|
}
|
|
723
712
|
|
|
724
|
-
if (tab !== this.state.currentTab
|
|
713
|
+
if (tab !== this.state.currentTab) {
|
|
725
714
|
CapNotification.error(errorMessage);
|
|
726
715
|
}
|
|
727
716
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import isEmpty from 'lodash/isEmpty';
|
|
2
|
-
import
|
|
2
|
+
import CapNotification from '@capillarytech/cap-ui-library/CapNotification';
|
|
3
3
|
import messages from './Create/messages';
|
|
4
4
|
export function showError() {
|
|
5
5
|
const {intl} = this.props;
|
|
@@ -10,14 +10,9 @@ export function showError() {
|
|
|
10
10
|
const isSmsInvalid = Object.values(err0).includes(true);
|
|
11
11
|
const isBraceError = Boolean(err0['bracket-error']);
|
|
12
12
|
if (isSmsInvalid) {
|
|
13
|
-
const invalidTags = err0['invalid-tags'];
|
|
14
|
-
if (!isEmpty(invalidTags)) {
|
|
15
|
-
errorMessage.description = `${intl.formatMessage(messages.invalidTags)}: ${invalidTags.join(',')} `;
|
|
16
|
-
}
|
|
17
13
|
CapNotification.error(errorMessage);
|
|
18
14
|
} else if (isBraceError) {
|
|
19
|
-
|
|
20
|
-
CapNotification.error(errorMessage);
|
|
15
|
+
// Do not trigger toast for this path; footer error is the reliable UX in SMS library flow.
|
|
21
16
|
}
|
|
22
17
|
}
|
|
23
18
|
}
|