@capillarytech/creatives-library 8.0.292-alpha.0 → 8.0.293
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 -3
- package/initialState.js +2 -0
- package/package.json +1 -1
- package/utils/common.js +8 -5
- package/utils/commonUtils.js +85 -4
- package/utils/tagValidations.js +223 -83
- package/utils/tests/commonUtil.test.js +124 -147
- package/utils/tests/tagValidations.test.js +358 -441
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +33 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +422 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.scss +35 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/TECH_DETAILING_DELIVERY_SETTINGS.md +725 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +92 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +251 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +111 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +91 -0
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +51 -1
- package/v2Components/CommonTestAndPreview/actions.js +20 -0
- package/v2Components/CommonTestAndPreview/constants.js +10 -0
- package/v2Components/CommonTestAndPreview/index.js +148 -15
- package/v2Components/CommonTestAndPreview/reducer.js +47 -0
- package/v2Components/CommonTestAndPreview/sagas.js +60 -0
- package/v2Components/CommonTestAndPreview/selectors.js +51 -0
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +889 -0
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +222 -0
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +235 -0
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +135 -0
- package/v2Components/CommonTestAndPreview/tests/actions.test.js +50 -0
- package/v2Components/CommonTestAndPreview/tests/constants.test.js +18 -0
- package/v2Components/CommonTestAndPreview/tests/index.test.js +342 -1
- package/v2Components/CommonTestAndPreview/tests/reducer.test.js +118 -0
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +145 -0
- package/v2Components/CommonTestAndPreview/tests/selectors.test.js +146 -0
- 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/v2Components/TestAndPreviewSlidebox/index.js +14 -0
- 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/index.js +7 -30
- package/v2Containers/Email/index.js +5 -1
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +70 -23
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +137 -29
- package/v2Containers/FTP/index.js +51 -2
- package/v2Containers/FTP/messages.js +4 -0
- package/v2Containers/InApp/index.js +104 -4
- package/v2Containers/InApp/tests/index.test.js +6 -17
- package/v2Containers/InappAdvance/index.js +108 -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 -42
- package/v2Containers/MobilePush/Edit/index.js +19 -42
- 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 +697 -12
- 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 +52 -12
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +207 -6
- package/v2Containers/SmsWrapper/index.js +0 -2
- 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 +2 -17
- package/v2Containers/WebPush/Create/utils/validation.test.js +24 -59
- package/v2Containers/Whatsapp/index.js +18 -10
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +26242 -4225
- package/v2Containers/Zalo/index.js +11 -3
- 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
|
|
@@ -2649,6 +2659,20 @@ const MobilePushNew = ({
|
|
|
2649
2659
|
getLiquidTags: globalActionsProps.getLiquidTags,
|
|
2650
2660
|
formatMessage,
|
|
2651
2661
|
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
|
+
},
|
|
2652
2676
|
singleTab: getSingleTab(accountData),
|
|
2653
2677
|
});
|
|
2654
2678
|
}, [
|
|
@@ -2657,9 +2681,12 @@ const MobilePushNew = ({
|
|
|
2657
2681
|
activeTab,
|
|
2658
2682
|
globalActionsProps,
|
|
2659
2683
|
formatMessage,
|
|
2684
|
+
metaEntities,
|
|
2660
2685
|
accountData,
|
|
2661
2686
|
]);
|
|
2662
2687
|
|
|
2688
|
+
const isLiquidFlow = hasLiquidSupportFeature();
|
|
2689
|
+
|
|
2663
2690
|
useEffect(() => {
|
|
2664
2691
|
// Always map to { label } for both platforms
|
|
2665
2692
|
const newButtons = Array.isArray(ctaData)
|
|
@@ -2906,22 +2933,16 @@ const MobilePushNew = ({
|
|
|
2906
2933
|
setShowTestAndPreviewSlidebox(false);
|
|
2907
2934
|
}, []);
|
|
2908
2935
|
|
|
2909
|
-
// Add useEffect to handle isGetFormData prop changes
|
|
2910
|
-
// In library mode: run liquid validation (extractTags) first; on success liquidMiddleWare calls handleSave
|
|
2911
|
-
// In full mode: call handleSave directly
|
|
2936
|
+
// Add useEffect to handle isGetFormData prop changes
|
|
2912
2937
|
useEffect(() => {
|
|
2913
2938
|
if (isGetFormData) {
|
|
2914
|
-
|
|
2915
|
-
liquidMiddleWare();
|
|
2916
|
-
} else {
|
|
2917
|
-
handleSave();
|
|
2918
|
-
}
|
|
2939
|
+
handleSave();
|
|
2919
2940
|
// Reset the flag to prevent infinite loop
|
|
2920
2941
|
if (onValidationFail) {
|
|
2921
2942
|
onValidationFail();
|
|
2922
2943
|
}
|
|
2923
2944
|
}
|
|
2924
|
-
}, [isGetFormData, handleSave, onValidationFail
|
|
2945
|
+
}, [isGetFormData, handleSave, onValidationFail]);
|
|
2925
2946
|
|
|
2926
2947
|
// Add message event listener to handle parent communication (like old MobilePush components)
|
|
2927
2948
|
useEffect(() => {
|
|
@@ -3062,8 +3083,7 @@ const MobilePushNew = ({
|
|
|
3062
3083
|
<CapButton
|
|
3063
3084
|
type="primary"
|
|
3064
3085
|
onClick={() => {
|
|
3065
|
-
|
|
3066
|
-
if (!isFullMode) {
|
|
3086
|
+
if (isLiquidFlow) {
|
|
3067
3087
|
liquidMiddleWare();
|
|
3068
3088
|
} else {
|
|
3069
3089
|
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 {}
|