@capillarytech/creatives-library 8.0.309 → 8.0.310
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 +1 -5
- package/initialState.js +2 -0
- package/package.json +1 -1
- package/services/api.js +0 -17
- package/services/tests/api.test.js +0 -85
- package/utils/common.js +8 -5
- package/utils/commonUtils.js +93 -46
- package/utils/tagValidations.js +223 -83
- package/utils/tests/commonUtil.test.js +124 -316
- package/utils/tests/tagValidations.test.js +358 -441
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +49 -78
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +34 -134
- package/v2Components/CommonTestAndPreview/actions.js +0 -10
- package/v2Components/CommonTestAndPreview/constants.js +1 -15
- package/v2Components/CommonTestAndPreview/index.js +19 -80
- package/v2Components/CommonTestAndPreview/messages.js +0 -94
- package/v2Components/CommonTestAndPreview/reducer.js +0 -10
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +0 -53
- package/v2Components/CommonTestAndPreview/tests/constants.test.js +1 -31
- package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -36
- package/v2Components/CommonTestAndPreview/tests/reducer.test.js +0 -71
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +0 -377
- package/v2Components/CommonTestAndPreview/tests/selectors.test.js +0 -17
- package/v2Components/ErrorInfoNote/index.js +5 -2
- package/v2Components/FormBuilder/index.js +203 -137
- package/v2Components/FormBuilder/messages.js +8 -0
- package/v2Components/HtmlEditor/HTMLEditor.js +5 -0
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -0
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +15 -0
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +2 -1
- package/v2Containers/Cap/mockData.js +14 -0
- package/v2Containers/Cap/reducer.js +55 -3
- package/v2Containers/Cap/tests/reducer.test.js +102 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -5
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +5 -13
- package/v2Containers/CreativesContainer/constants.js +0 -6
- package/v2Containers/CreativesContainer/index.js +7 -47
- package/v2Containers/Email/index.js +5 -1
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +70 -23
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +120 -20
- package/v2Containers/FTP/index.js +51 -2
- package/v2Containers/FTP/messages.js +4 -0
- package/v2Containers/InApp/index.js +107 -35
- package/v2Containers/InApp/tests/index.test.js +6 -17
- package/v2Containers/InappAdvance/index.js +112 -4
- package/v2Containers/InappAdvance/tests/index.test.js +0 -2
- package/v2Containers/Line/Container/Text/index.js +1 -0
- package/v2Containers/MobilePush/Create/index.js +19 -59
- package/v2Containers/MobilePush/Edit/index.js +20 -48
- package/v2Containers/MobilePushNew/index.js +32 -12
- package/v2Containers/MobilepushWrapper/index.js +1 -3
- package/v2Containers/Rcs/index.js +37 -12
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +1276 -1408
- package/v2Containers/Sms/Create/index.js +3 -39
- package/v2Containers/Sms/Create/messages.js +0 -4
- package/v2Containers/Sms/Edit/index.js +3 -35
- package/v2Containers/Sms/commonMethods.js +6 -3
- package/v2Containers/SmsTrai/Edit/index.js +47 -11
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +294 -327
- package/v2Containers/SmsWrapper/index.js +0 -2
- package/v2Containers/TemplatesV2/index.js +13 -28
- package/v2Containers/Viber/index.js +1 -0
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +3 -1
- package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +7 -0
- package/v2Containers/WebPush/Create/index.js +2 -2
- package/v2Containers/WebPush/Create/utils/validation.js +8 -17
- package/v2Containers/WebPush/Create/utils/validation.test.js +24 -44
- package/v2Containers/Whatsapp/index.js +17 -9
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +4872 -5246
- package/v2Containers/Zalo/index.js +11 -3
- package/v2Components/CommonTestAndPreview/AddTestCustomer.js +0 -42
- package/v2Components/CommonTestAndPreview/CustomerCreationModal.js +0 -284
- package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +0 -72
- package/v2Components/CommonTestAndPreview/tests/AddTestCustomer.test.js +0 -66
- package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -657
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +0 -172
- package/v2Components/CommonTestAndPreview/tests/CustomerCreationModal.test.js +0 -466
- package/v2Components/CommonTestAndPreview/tests/ExistingCustomerModal.test.js +0 -114
- package/v2Containers/Sms/tests/commonMethods.test.js +0 -122
|
@@ -77,6 +77,7 @@ 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";
|
|
80
81
|
import formBuilderMessages from "../../v2Components/FormBuilder/messages";
|
|
81
82
|
import { validateMobilePushContent } from "../../utils/commonUtils";
|
|
82
83
|
import { getSingleTab } from "../InApp/utils";
|
|
@@ -802,9 +803,10 @@ const MobilePushNew = ({
|
|
|
802
803
|
(value) => {
|
|
803
804
|
let errorTemplateDescMessage = "";
|
|
804
805
|
|
|
805
|
-
const { isBraceError } = validateTags({
|
|
806
|
+
const { unsupportedTags, isBraceError } = validateTags({
|
|
806
807
|
content: value,
|
|
807
808
|
tagsParam: tags,
|
|
809
|
+
injectedTagsParams: injectedTags,
|
|
808
810
|
location,
|
|
809
811
|
tagModule: getDefaultTags,
|
|
810
812
|
isFullMode,
|
|
@@ -814,6 +816,14 @@ const MobilePushNew = ({
|
|
|
814
816
|
messages.emptyTemplateDescErrorMessage
|
|
815
817
|
);
|
|
816
818
|
}
|
|
819
|
+
if (unsupportedTags?.length > 0) {
|
|
820
|
+
errorTemplateDescMessage = formatMessage(
|
|
821
|
+
globalMessages.unsupportedTagsValidationError,
|
|
822
|
+
{
|
|
823
|
+
unsupportedTags,
|
|
824
|
+
}
|
|
825
|
+
);
|
|
826
|
+
}
|
|
817
827
|
if (isBraceError) {
|
|
818
828
|
errorTemplateDescMessage = formatMessage(
|
|
819
829
|
globalMessages.unbalanacedCurlyBraces
|
|
@@ -2655,6 +2665,20 @@ const MobilePushNew = ({
|
|
|
2655
2665
|
getLiquidTags: globalActionsProps.getLiquidTags,
|
|
2656
2666
|
formatMessage,
|
|
2657
2667
|
messages: formBuilderMessages,
|
|
2668
|
+
tagLookupMap: metaEntities?.tagLookupMap || {},
|
|
2669
|
+
eventContextTags: metaEntities?.eventContextTags || [],
|
|
2670
|
+
isLiquidFlow: hasLiquidSupportFeature(),
|
|
2671
|
+
forwardedTags: {},
|
|
2672
|
+
skipTags: (tag) => {
|
|
2673
|
+
const skipRegexes = [
|
|
2674
|
+
/dynamic_expiry_date_after_\d+_days\.FORMAT_\d/,
|
|
2675
|
+
/unsubscribe\(#[a-zA-Z\d]{6}\)/,
|
|
2676
|
+
/Link_to_[a-zA-z]/,
|
|
2677
|
+
/SURVEY.*\.TOKEN/,
|
|
2678
|
+
/^[A-Za-z].*\([a-zA-Z\d]*\)/,
|
|
2679
|
+
];
|
|
2680
|
+
return skipRegexes.some((regex) => regex.test(tag));
|
|
2681
|
+
},
|
|
2658
2682
|
singleTab: getSingleTab(accountData),
|
|
2659
2683
|
});
|
|
2660
2684
|
}, [
|
|
@@ -2663,10 +2687,13 @@ const MobilePushNew = ({
|
|
|
2663
2687
|
activeTab,
|
|
2664
2688
|
globalActionsProps,
|
|
2665
2689
|
formatMessage,
|
|
2690
|
+
metaEntities,
|
|
2666
2691
|
accountData,
|
|
2667
2692
|
isFullMode,
|
|
2668
2693
|
]);
|
|
2669
2694
|
|
|
2695
|
+
const isLiquidFlow = hasLiquidSupportFeature();
|
|
2696
|
+
|
|
2670
2697
|
useEffect(() => {
|
|
2671
2698
|
// Always map to { label } for both platforms
|
|
2672
2699
|
const newButtons = Array.isArray(ctaData)
|
|
@@ -2913,22 +2940,16 @@ const MobilePushNew = ({
|
|
|
2913
2940
|
setShowTestAndPreviewSlidebox(false);
|
|
2914
2941
|
}, []);
|
|
2915
2942
|
|
|
2916
|
-
// Add useEffect to handle isGetFormData prop changes
|
|
2917
|
-
// In library mode: run liquid validation (extractTags) first; on success liquidMiddleWare calls handleSave
|
|
2918
|
-
// In full mode: call handleSave directly
|
|
2943
|
+
// Add useEffect to handle isGetFormData prop changes
|
|
2919
2944
|
useEffect(() => {
|
|
2920
2945
|
if (isGetFormData) {
|
|
2921
|
-
|
|
2922
|
-
liquidMiddleWare();
|
|
2923
|
-
} else {
|
|
2924
|
-
handleSave();
|
|
2925
|
-
}
|
|
2946
|
+
handleSave();
|
|
2926
2947
|
// Reset the flag to prevent infinite loop
|
|
2927
2948
|
if (onValidationFail) {
|
|
2928
2949
|
onValidationFail();
|
|
2929
2950
|
}
|
|
2930
2951
|
}
|
|
2931
|
-
}, [isGetFormData, handleSave, onValidationFail
|
|
2952
|
+
}, [isGetFormData, handleSave, onValidationFail]);
|
|
2932
2953
|
|
|
2933
2954
|
// Add message event listener to handle parent communication (like old MobilePush components)
|
|
2934
2955
|
useEffect(() => {
|
|
@@ -3069,8 +3090,7 @@ const MobilePushNew = ({
|
|
|
3069
3090
|
<CapButton
|
|
3070
3091
|
type="primary"
|
|
3071
3092
|
onClick={() => {
|
|
3072
|
-
|
|
3073
|
-
if (!isFullMode) {
|
|
3093
|
+
if (isLiquidFlow) {
|
|
3074
3094
|
liquidMiddleWare();
|
|
3075
3095
|
} else {
|
|
3076
3096
|
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,
|
|
75
|
+
const {mobilePushCreateMode, step, getFormData, 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,7 +102,6 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
102
102
|
<div>
|
|
103
103
|
{isShowMobilepushCreate && <MobilepushCreate
|
|
104
104
|
getFormLibraryData={getFormData}
|
|
105
|
-
getLiquidTags={getLiquidTags}
|
|
106
105
|
setIsLoadingContent={setIsLoadingContent}
|
|
107
106
|
defaultData={{"template-name": templateName}}
|
|
108
107
|
location={{
|
|
@@ -144,7 +143,6 @@ MobilepushWrapper.propTypes = {
|
|
|
144
143
|
mobilePushCreateMode: PropTypes.string,
|
|
145
144
|
step: PropTypes.string,
|
|
146
145
|
getFormData: PropTypes.string,
|
|
147
|
-
getLiquidTags: PropTypes.func,
|
|
148
146
|
setIsLoadingContent: PropTypes.func,
|
|
149
147
|
onEnterTemplateName: PropTypes.func,
|
|
150
148
|
onRemoveTemplateName: PropTypes.func,
|
|
@@ -394,15 +394,23 @@ export const Rcs = (props) => {
|
|
|
394
394
|
const validationResponse =
|
|
395
395
|
validateTags({
|
|
396
396
|
content: contentForValidation,
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
397
|
+
tagsParam: tags,
|
|
398
|
+
injectedTagsParams: injectedTags,
|
|
399
|
+
location,
|
|
400
|
+
tagModule: getDefaultTags,
|
|
401
|
+
eventContextTags,
|
|
402
|
+
isFullMode,
|
|
403
|
+
}) || {};
|
|
404
|
+
const unsupportedTagsLengthCheck =
|
|
405
|
+
validationResponse?.unsupportedTags?.length > 0;
|
|
406
|
+
const errorMsg =
|
|
407
|
+
(unsupportedTagsLengthCheck &&
|
|
408
|
+
formatMessage(globalMessages.unsupportedTagsValidationError, {
|
|
409
|
+
unsupportedTags: validationResponse.unsupportedTags,
|
|
410
|
+
})) ||
|
|
411
|
+
(validationResponse.isBraceError &&
|
|
412
|
+
formatMessage(globalMessages.unbalanacedCurlyBraces)) ||
|
|
413
|
+
false;
|
|
406
414
|
if (type === TITLE_TEXT) setTemplateTitleError(errorMsg);
|
|
407
415
|
if (type === MESSAGE_TEXT) setTemplateDescError(errorMsg);
|
|
408
416
|
};
|
|
@@ -827,9 +835,10 @@ export const Rcs = (props) => {
|
|
|
827
835
|
|
|
828
836
|
const templateDescErrorHandler = (value) => {
|
|
829
837
|
let errorMessage = false;
|
|
830
|
-
const { isBraceError } = validateTags({
|
|
838
|
+
const { unsupportedTags, isBraceError } = validateTags({
|
|
831
839
|
content: value,
|
|
832
840
|
tagsParam: tags,
|
|
841
|
+
injectedTagsParams: injectedTags,
|
|
833
842
|
location,
|
|
834
843
|
tagModule: getDefaultTags,
|
|
835
844
|
isFullMode,
|
|
@@ -859,10 +868,26 @@ export const Rcs = (props) => {
|
|
|
859
868
|
};
|
|
860
869
|
|
|
861
870
|
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
|
+
}) || {};
|
|
862
880
|
if (value?.length > FALLBACK_MESSAGE_MAX_LENGTH) {
|
|
863
|
-
|
|
881
|
+
errorMessage = formatMessage(messages.fallbackMsgLenError);
|
|
882
|
+
} else if (unsupportedTags?.length > 0) {
|
|
883
|
+
errorMessage = formatMessage(
|
|
884
|
+
globalMessages.unsupportedTagsValidationError,
|
|
885
|
+
{
|
|
886
|
+
unsupportedTags,
|
|
887
|
+
},
|
|
888
|
+
);
|
|
864
889
|
}
|
|
865
|
-
return
|
|
890
|
+
return errorMessage;
|
|
866
891
|
};
|
|
867
892
|
|
|
868
893
|
// Check for forbidden characters: square brackets [] and single curly braces {}
|