@capillarytech/creatives-library 8.0.290 → 8.0.292-alpha.0
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/constants/unified.js +3 -1
- package/initialState.js +0 -2
- package/package.json +1 -1
- package/utils/common.js +5 -8
- package/utils/commonUtils.js +4 -85
- package/utils/tagValidations.js +83 -223
- package/utils/tests/commonUtil.test.js +147 -124
- package/utils/tests/tagValidations.test.js +441 -358
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +1 -33
- package/v2Components/CommonTestAndPreview/actions.js +0 -20
- package/v2Components/CommonTestAndPreview/constants.js +0 -10
- package/v2Components/CommonTestAndPreview/index.js +15 -133
- package/v2Components/CommonTestAndPreview/reducer.js +0 -47
- package/v2Components/CommonTestAndPreview/sagas.js +0 -60
- package/v2Components/CommonTestAndPreview/selectors.js +0 -51
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +0 -127
- package/v2Components/CommonTestAndPreview/tests/actions.test.js +0 -50
- package/v2Components/CommonTestAndPreview/tests/constants.test.js +0 -18
- package/v2Components/CommonTestAndPreview/tests/index.test.js +1 -214
- package/v2Components/CommonTestAndPreview/tests/reducer.test.js +0 -118
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +0 -145
- package/v2Components/CommonTestAndPreview/tests/selectors.test.js +0 -146
- package/v2Components/ErrorInfoNote/index.js +2 -5
- package/v2Components/FormBuilder/index.js +137 -203
- package/v2Components/FormBuilder/messages.js +0 -8
- package/v2Components/HtmlEditor/HTMLEditor.js +0 -5
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +0 -1
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +0 -15
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +1 -2
- package/v2Components/TestAndPreviewSlidebox/index.js +0 -14
- package/v2Containers/Cap/mockData.js +0 -14
- package/v2Containers/Cap/reducer.js +3 -55
- package/v2Containers/Cap/tests/reducer.test.js +0 -102
- package/v2Containers/CreativesContainer/SlideBoxContent.js +5 -1
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +13 -5
- package/v2Containers/CreativesContainer/index.js +38 -7
- package/v2Containers/Email/index.js +1 -5
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +23 -70
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +29 -137
- package/v2Containers/FTP/index.js +2 -51
- package/v2Containers/FTP/messages.js +0 -4
- package/v2Containers/InApp/index.js +4 -104
- package/v2Containers/InApp/tests/index.test.js +17 -6
- package/v2Containers/InappAdvance/index.js +4 -108
- package/v2Containers/InappAdvance/tests/index.test.js +2 -0
- package/v2Containers/Line/Container/Text/index.js +0 -1
- package/v2Containers/MobilePush/Create/index.js +42 -19
- package/v2Containers/MobilePush/Edit/index.js +42 -19
- package/v2Containers/MobilePushNew/index.js +12 -32
- package/v2Containers/MobilepushWrapper/index.js +3 -1
- package/v2Containers/Rcs/index.js +12 -37
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +12 -649
- package/v2Containers/Sms/Create/index.js +39 -3
- package/v2Containers/Sms/Create/messages.js +4 -0
- package/v2Containers/Sms/Edit/index.js +35 -3
- package/v2Containers/Sms/commonMethods.js +3 -6
- package/v2Containers/Sms/tests/commonMethods.test.js +122 -0
- package/v2Containers/SmsTrai/Edit/index.js +11 -47
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +6 -147
- package/v2Containers/SmsWrapper/index.js +2 -0
- package/v2Containers/Viber/index.js +0 -1
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +1 -3
- package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +0 -7
- package/v2Containers/WebPush/Create/index.js +2 -2
- package/v2Containers/WebPush/Create/utils/validation.js +17 -2
- package/v2Containers/WebPush/Create/utils/validation.test.js +59 -24
- package/v2Containers/Whatsapp/index.js +10 -18
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +4225 -26174
- package/v2Containers/Zalo/index.js +3 -11
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +0 -33
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +0 -397
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.scss +0 -35
- package/v2Components/CommonTestAndPreview/DeliverySettings/TECH_DETAILING_DELIVERY_SETTINGS.md +0 -725
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -92
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +0 -243
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -111
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +0 -91
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +0 -782
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +0 -200
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -235
|
@@ -77,7 +77,6 @@ import { getContent } from "../MobilePush/commonMethods";
|
|
|
77
77
|
import { getMessageObject } from "../../utils/messageUtils";
|
|
78
78
|
import { gtmPush } from "../../utils/gtmTrackers";
|
|
79
79
|
import mobilePushReducer from "./reducer";
|
|
80
|
-
import { hasLiquidSupportFeature } from "../../utils/common";
|
|
81
80
|
import formBuilderMessages from "../../v2Components/FormBuilder/messages";
|
|
82
81
|
import { validateMobilePushContent } from "../../utils/commonUtils";
|
|
83
82
|
import { getSingleTab } from "../InApp/utils";
|
|
@@ -803,10 +802,9 @@ const MobilePushNew = ({
|
|
|
803
802
|
(value) => {
|
|
804
803
|
let errorTemplateDescMessage = "";
|
|
805
804
|
|
|
806
|
-
const {
|
|
805
|
+
const { isBraceError } = validateTags({
|
|
807
806
|
content: value,
|
|
808
807
|
tagsParam: tags,
|
|
809
|
-
injectedTagsParams: injectedTags,
|
|
810
808
|
location,
|
|
811
809
|
tagModule: getDefaultTags,
|
|
812
810
|
isFullMode,
|
|
@@ -816,14 +814,6 @@ const MobilePushNew = ({
|
|
|
816
814
|
messages.emptyTemplateDescErrorMessage
|
|
817
815
|
);
|
|
818
816
|
}
|
|
819
|
-
if (unsupportedTags?.length > 0) {
|
|
820
|
-
errorTemplateDescMessage = formatMessage(
|
|
821
|
-
globalMessages.unsupportedTagsValidationError,
|
|
822
|
-
{
|
|
823
|
-
unsupportedTags,
|
|
824
|
-
}
|
|
825
|
-
);
|
|
826
|
-
}
|
|
827
817
|
if (isBraceError) {
|
|
828
818
|
errorTemplateDescMessage = formatMessage(
|
|
829
819
|
globalMessages.unbalanacedCurlyBraces
|
|
@@ -2659,20 +2649,6 @@ const MobilePushNew = ({
|
|
|
2659
2649
|
getLiquidTags: globalActionsProps.getLiquidTags,
|
|
2660
2650
|
formatMessage,
|
|
2661
2651
|
messages: formBuilderMessages,
|
|
2662
|
-
tagLookupMap: metaEntities?.tagLookupMap || {},
|
|
2663
|
-
eventContextTags: metaEntities?.eventContextTags || [],
|
|
2664
|
-
isLiquidFlow: hasLiquidSupportFeature(),
|
|
2665
|
-
forwardedTags: {},
|
|
2666
|
-
skipTags: (tag) => {
|
|
2667
|
-
const skipRegexes = [
|
|
2668
|
-
/dynamic_expiry_date_after_\d+_days\.FORMAT_\d/,
|
|
2669
|
-
/unsubscribe\(#[a-zA-Z\d]{6}\)/,
|
|
2670
|
-
/Link_to_[a-zA-z]/,
|
|
2671
|
-
/SURVEY.*\.TOKEN/,
|
|
2672
|
-
/^[A-Za-z].*\([a-zA-Z\d]*\)/,
|
|
2673
|
-
];
|
|
2674
|
-
return skipRegexes.some((regex) => regex.test(tag));
|
|
2675
|
-
},
|
|
2676
2652
|
singleTab: getSingleTab(accountData),
|
|
2677
2653
|
});
|
|
2678
2654
|
}, [
|
|
@@ -2681,12 +2657,9 @@ const MobilePushNew = ({
|
|
|
2681
2657
|
activeTab,
|
|
2682
2658
|
globalActionsProps,
|
|
2683
2659
|
formatMessage,
|
|
2684
|
-
metaEntities,
|
|
2685
2660
|
accountData,
|
|
2686
2661
|
]);
|
|
2687
2662
|
|
|
2688
|
-
const isLiquidFlow = hasLiquidSupportFeature();
|
|
2689
|
-
|
|
2690
2663
|
useEffect(() => {
|
|
2691
2664
|
// Always map to { label } for both platforms
|
|
2692
2665
|
const newButtons = Array.isArray(ctaData)
|
|
@@ -2933,16 +2906,22 @@ const MobilePushNew = ({
|
|
|
2933
2906
|
setShowTestAndPreviewSlidebox(false);
|
|
2934
2907
|
}, []);
|
|
2935
2908
|
|
|
2936
|
-
// Add useEffect to handle isGetFormData prop changes
|
|
2909
|
+
// Add useEffect to handle isGetFormData prop changes (e.g. Done clicked in footer)
|
|
2910
|
+
// In library mode: run liquid validation (extractTags) first; on success liquidMiddleWare calls handleSave
|
|
2911
|
+
// In full mode: call handleSave directly
|
|
2937
2912
|
useEffect(() => {
|
|
2938
2913
|
if (isGetFormData) {
|
|
2939
|
-
|
|
2914
|
+
if (!isFullMode) {
|
|
2915
|
+
liquidMiddleWare();
|
|
2916
|
+
} else {
|
|
2917
|
+
handleSave();
|
|
2918
|
+
}
|
|
2940
2919
|
// Reset the flag to prevent infinite loop
|
|
2941
2920
|
if (onValidationFail) {
|
|
2942
2921
|
onValidationFail();
|
|
2943
2922
|
}
|
|
2944
2923
|
}
|
|
2945
|
-
}, [isGetFormData, handleSave, onValidationFail]);
|
|
2924
|
+
}, [isGetFormData, handleSave, onValidationFail, isFullMode, liquidMiddleWare]);
|
|
2946
2925
|
|
|
2947
2926
|
// Add message event listener to handle parent communication (like old MobilePush components)
|
|
2948
2927
|
useEffect(() => {
|
|
@@ -3083,7 +3062,8 @@ const MobilePushNew = ({
|
|
|
3083
3062
|
<CapButton
|
|
3084
3063
|
type="primary"
|
|
3085
3064
|
onClick={() => {
|
|
3086
|
-
|
|
3065
|
+
// Liquid validation (extractTags) only in library mode
|
|
3066
|
+
if (!isFullMode) {
|
|
3087
3067
|
liquidMiddleWare();
|
|
3088
3068
|
} else {
|
|
3089
3069
|
handleSave();
|
|
@@ -72,7 +72,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
render() {
|
|
75
|
-
const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData, eventContextTags = [], showTestAndPreviewSlidebox, handleTestAndPreview, handleCloseTestAndPreview, restrictPersonalization, isAnonymousType, onPersonalizationTokensChange} = this.props;
|
|
75
|
+
const {mobilePushCreateMode, step, getFormData, getLiquidTags, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData, eventContextTags = [], showTestAndPreviewSlidebox, handleTestAndPreview, handleCloseTestAndPreview, restrictPersonalization, isAnonymousType, onPersonalizationTokensChange} = this.props;
|
|
76
76
|
const {templateName} = this.state;
|
|
77
77
|
const isShowMobilepushCreate = !isEmpty(mobilePushCreateMode);
|
|
78
78
|
return (
|
|
@@ -102,6 +102,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
102
102
|
<div>
|
|
103
103
|
{isShowMobilepushCreate && <MobilepushCreate
|
|
104
104
|
getFormLibraryData={getFormData}
|
|
105
|
+
getLiquidTags={getLiquidTags}
|
|
105
106
|
setIsLoadingContent={setIsLoadingContent}
|
|
106
107
|
defaultData={{"template-name": templateName}}
|
|
107
108
|
location={{
|
|
@@ -143,6 +144,7 @@ MobilepushWrapper.propTypes = {
|
|
|
143
144
|
mobilePushCreateMode: PropTypes.string,
|
|
144
145
|
step: PropTypes.string,
|
|
145
146
|
getFormData: PropTypes.string,
|
|
147
|
+
getLiquidTags: PropTypes.func,
|
|
146
148
|
setIsLoadingContent: PropTypes.func,
|
|
147
149
|
onEnterTemplateName: PropTypes.func,
|
|
148
150
|
onRemoveTemplateName: PropTypes.func,
|
|
@@ -394,23 +394,15 @@ export const Rcs = (props) => {
|
|
|
394
394
|
const validationResponse =
|
|
395
395
|
validateTags({
|
|
396
396
|
content: contentForValidation,
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
const errorMsg =
|
|
407
|
-
(unsupportedTagsLengthCheck &&
|
|
408
|
-
formatMessage(globalMessages.unsupportedTagsValidationError, {
|
|
409
|
-
unsupportedTags: validationResponse.unsupportedTags,
|
|
410
|
-
})) ||
|
|
411
|
-
(validationResponse.isBraceError &&
|
|
412
|
-
formatMessage(globalMessages.unbalanacedCurlyBraces)) ||
|
|
413
|
-
false;
|
|
397
|
+
tagsParam: tags,
|
|
398
|
+
location,
|
|
399
|
+
tagModule: getDefaultTags,
|
|
400
|
+
isFullMode,
|
|
401
|
+
}) || {};
|
|
402
|
+
const errorMsg =
|
|
403
|
+
(validationResponse?.isBraceError &&
|
|
404
|
+
formatMessage(globalMessages.unbalanacedCurlyBraces)) ||
|
|
405
|
+
false;
|
|
414
406
|
if (type === TITLE_TEXT) setTemplateTitleError(errorMsg);
|
|
415
407
|
if (type === MESSAGE_TEXT) setTemplateDescError(errorMsg);
|
|
416
408
|
};
|
|
@@ -835,10 +827,9 @@ export const Rcs = (props) => {
|
|
|
835
827
|
|
|
836
828
|
const templateDescErrorHandler = (value) => {
|
|
837
829
|
let errorMessage = false;
|
|
838
|
-
const {
|
|
830
|
+
const { isBraceError } = validateTags({
|
|
839
831
|
content: value,
|
|
840
832
|
tagsParam: tags,
|
|
841
|
-
injectedTagsParams: injectedTags,
|
|
842
833
|
location,
|
|
843
834
|
tagModule: getDefaultTags,
|
|
844
835
|
isFullMode,
|
|
@@ -868,26 +859,10 @@ export const Rcs = (props) => {
|
|
|
868
859
|
};
|
|
869
860
|
|
|
870
861
|
const fallbackMessageErrorHandler = (value) => {
|
|
871
|
-
let errorMessage = false;
|
|
872
|
-
const { unsupportedTags } = validateTags({
|
|
873
|
-
content: value,
|
|
874
|
-
tagsParam: tags,
|
|
875
|
-
injectedTagsParams: injectedTags,
|
|
876
|
-
location,
|
|
877
|
-
tagModule: getDefaultTags,
|
|
878
|
-
isFullMode,
|
|
879
|
-
}) || {};
|
|
880
862
|
if (value?.length > FALLBACK_MESSAGE_MAX_LENGTH) {
|
|
881
|
-
|
|
882
|
-
} else if (unsupportedTags?.length > 0) {
|
|
883
|
-
errorMessage = formatMessage(
|
|
884
|
-
globalMessages.unsupportedTagsValidationError,
|
|
885
|
-
{
|
|
886
|
-
unsupportedTags,
|
|
887
|
-
},
|
|
888
|
-
);
|
|
863
|
+
return formatMessage(messages.fallbackMsgLenError);
|
|
889
864
|
}
|
|
890
|
-
return
|
|
865
|
+
return false;
|
|
891
866
|
};
|
|
892
867
|
|
|
893
868
|
// Check for forbidden characters: square brackets [] and single curly braces {}
|