@capillarytech/creatives-library 8.0.325 → 8.0.326
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 +1 -1
- package/utils/tests/tagValidations.test.js +0 -34
- package/v2Components/CapTagList/index.js +22 -14
- package/v2Components/CapTagList/style.scss +0 -48
- package/v2Components/CapTagListWithInput/index.js +0 -4
- package/v2Components/CapWhatsappCTA/index.js +0 -2
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +1 -2
- package/v2Components/FormBuilder/index.js +0 -7
- package/v2Components/HtmlEditor/HTMLEditor.js +1 -6
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +0 -1
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +2 -927
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +0 -3
- package/v2Containers/BeeEditor/index.js +0 -3
- package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -28
- package/v2Containers/CreativesContainer/index.js +6 -10
- package/v2Containers/Email/index.js +0 -1
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1 -7
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +0 -3
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +2 -20
- package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +1 -16
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +0 -3
- package/v2Containers/EmailWrapper/index.js +0 -4
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +0 -1
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +0 -9
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +0 -19
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +0 -3
- package/v2Containers/InAppWrapper/index.js +0 -3
- package/v2Containers/MobilePush/Create/index.js +0 -2
- package/v2Containers/MobilePush/Edit/index.js +0 -2
- package/v2Containers/MobilepushWrapper/index.js +1 -3
- package/v2Containers/Rcs/index.js +1 -9
- package/v2Containers/Sms/Create/index.js +0 -2
- package/v2Containers/Sms/Edit/index.js +0 -2
- package/v2Containers/SmsTrai/Edit/index.js +0 -2
- package/v2Containers/SmsWrapper/index.js +0 -2
- package/v2Containers/TagList/index.js +2 -41
- package/v2Containers/TagList/messages.js +0 -4
- package/v2Containers/TagList/tests/TagList.test.js +20 -122
- package/v2Containers/TagList/tests/mockdata.js +0 -17
- package/v2Containers/Viber/index.js +0 -5
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +2 -0
- package/v2Containers/WebPush/Create/index.js +1 -9
- package/v2Containers/Whatsapp/index.js +0 -5
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +0 -20
- package/v2Containers/Zalo/index.js +0 -2
- package/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +0 -63
|
@@ -36,7 +36,6 @@ const InAppWrapper = (props) => {
|
|
|
36
36
|
onPreviewContentClicked,
|
|
37
37
|
onTestContentClicked,
|
|
38
38
|
eventContextTags,
|
|
39
|
-
waitEventContextTags,
|
|
40
39
|
onCreateComplete,
|
|
41
40
|
handleClose,
|
|
42
41
|
templateData,
|
|
@@ -79,7 +78,6 @@ const InAppWrapper = (props) => {
|
|
|
79
78
|
onPreviewContentClicked,
|
|
80
79
|
onTestContentClicked,
|
|
81
80
|
eventContextTags,
|
|
82
|
-
waitEventContextTags,
|
|
83
81
|
onCreateComplete,
|
|
84
82
|
handleClose,
|
|
85
83
|
templateData,
|
|
@@ -126,7 +124,6 @@ InAppWrapper.propTypes = {
|
|
|
126
124
|
onPreviewContentClicked: PropTypes.func,
|
|
127
125
|
onTestContentClicked: PropTypes.func,
|
|
128
126
|
eventContextTags: PropTypes.array,
|
|
129
|
-
waitEventContextTags: PropTypes.object,
|
|
130
127
|
onCreateComplete: PropTypes.func,
|
|
131
128
|
handleClose: PropTypes.func,
|
|
132
129
|
templateData: PropTypes.object,
|
|
@@ -1966,7 +1966,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1966
1966
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
1967
1967
|
isFullMode={this.props.isFullMode}
|
|
1968
1968
|
eventContextTags={this.props?.eventContextTags}
|
|
1969
|
-
waitEventContextTags={this.props?.waitEventContextTags}
|
|
1970
1969
|
messageDetails={this.props?.messageDetails}
|
|
1971
1970
|
restrictPersonalization={this.props.restrictPersonalization}
|
|
1972
1971
|
/>
|
|
@@ -2069,7 +2068,6 @@ Create.propTypes = {
|
|
|
2069
2068
|
onPreviewContentClicked: PropTypes.func,
|
|
2070
2069
|
onTestContentClicked: PropTypes.func,
|
|
2071
2070
|
eventContextTags: PropTypes.array,
|
|
2072
|
-
waitEventContextTags: PropTypes.object,
|
|
2073
2071
|
getLiquidTags: PropTypes.func,
|
|
2074
2072
|
showLiquidErrorInFooter: PropTypes.func,
|
|
2075
2073
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
@@ -2233,7 +2233,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2233
2233
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
2234
2234
|
isFullMode={this.props.isFullMode}
|
|
2235
2235
|
eventContextTags={this.props?.eventContextTags}
|
|
2236
|
-
waitEventContextTags={this.props?.waitEventContextTags}
|
|
2237
2236
|
restrictPersonalization={this.props.restrictPersonalization}
|
|
2238
2237
|
/>;
|
|
2239
2238
|
})()}
|
|
@@ -2340,7 +2339,6 @@ Edit.propTypes = {
|
|
|
2340
2339
|
onTestContentClicked: PropTypes.func,
|
|
2341
2340
|
creativesMode: PropTypes.string,
|
|
2342
2341
|
eventContextTags: PropTypes.array,
|
|
2343
|
-
waitEventContextTags: PropTypes.object,
|
|
2344
2342
|
getLiquidTags: PropTypes.func,
|
|
2345
2343
|
showLiquidErrorInFooter: PropTypes.func,
|
|
2346
2344
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
@@ -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, getLiquidTags, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData, eventContextTags = [],
|
|
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 (
|
|
@@ -121,7 +121,6 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
121
121
|
templateData={templateData}
|
|
122
122
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
123
123
|
eventContextTags={eventContextTags}
|
|
124
|
-
waitEventContextTags={waitEventContextTags}
|
|
125
124
|
showLiquidErrorInFooter={this.props.showLiquidErrorInFooter}
|
|
126
125
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
127
126
|
handleTestAndPreview={handleTestAndPreview}
|
|
@@ -156,7 +155,6 @@ MobilepushWrapper.propTypes = {
|
|
|
156
155
|
type: PropTypes.string,
|
|
157
156
|
onValidationFail: PropTypes.func,
|
|
158
157
|
eventContextTags: PropTypes.array,
|
|
159
|
-
waitEventContextTags: PropTypes.object,
|
|
160
158
|
showLiquidErrorInFooter: PropTypes.func,
|
|
161
159
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
162
160
|
handleTestAndPreview: PropTypes.func,
|
|
@@ -145,7 +145,6 @@ export const Rcs = (props) => {
|
|
|
145
145
|
orgUnitId,
|
|
146
146
|
selectedOfferDetails,
|
|
147
147
|
eventContextTags,
|
|
148
|
-
waitEventContextTags,
|
|
149
148
|
accountData = {},
|
|
150
149
|
// TestAndPreviewSlidebox props
|
|
151
150
|
showTestAndPreviewSlidebox: propsShowTestAndPreviewSlidebox,
|
|
@@ -262,7 +261,6 @@ export const Rcs = (props) => {
|
|
|
262
261
|
const [accessToken, setAccessToken] = useState('');
|
|
263
262
|
const [hostName, setHostName] = useState('');
|
|
264
263
|
const [accountName, setAccountName] = useState('');
|
|
265
|
-
const [rcsAccount, setRcsAccount] = useState('');
|
|
266
264
|
useEffect(() => {
|
|
267
265
|
const accountObj = accountData.selectedRcsAccount || {};
|
|
268
266
|
if (!isEmpty(accountObj)) {
|
|
@@ -278,14 +276,12 @@ export const Rcs = (props) => {
|
|
|
278
276
|
setAccessToken(configs.accessToken || '');
|
|
279
277
|
setHostName(accountObj.hostName || '');
|
|
280
278
|
setAccountName(accountObj.name || '');
|
|
281
|
-
setRcsAccount(accountObj.id || '');
|
|
282
279
|
} else {
|
|
283
280
|
setAccountId('');
|
|
284
281
|
setWecrmAccountId('');
|
|
285
282
|
setAccessToken('');
|
|
286
283
|
setHostName('');
|
|
287
284
|
setAccountName('');
|
|
288
|
-
setRcsAccount('');
|
|
289
285
|
}
|
|
290
286
|
}, [accountData.selectedRcsAccount]);
|
|
291
287
|
|
|
@@ -753,10 +749,7 @@ export const Rcs = (props) => {
|
|
|
753
749
|
get(details, 'versions.base.content.RCS.rcsContent.cardSettings', '')
|
|
754
750
|
|| get(details, 'rcsContent.cardSettings', '');
|
|
755
751
|
setMediaData(mediaData, mediaType, cardSettings);
|
|
756
|
-
|
|
757
|
-
const rcsAccountId = get(details, 'versions.base.content.RCS.rcsContent.accountId', '');
|
|
758
|
-
setRcsAccount(rcsAccountId);
|
|
759
|
-
}
|
|
752
|
+
|
|
760
753
|
const smsFallbackContent = mergeRcsSmsFallBackContentFromDetails(details);
|
|
761
754
|
const base = get(smsFallbackContent, 'versions.base', {});
|
|
762
755
|
const updatedEditor = base['updated-sms-editor'] ?? base['sms-editor'];
|
|
@@ -1972,7 +1965,6 @@ const onTitleAddVar = () => {
|
|
|
1972
1965
|
content: {
|
|
1973
1966
|
RCS: {
|
|
1974
1967
|
rcsContent: {
|
|
1975
|
-
...(rcsAccount && !isFullMode && { accountId: rcsAccount }),
|
|
1976
1968
|
cardType: STANDALONE,
|
|
1977
1969
|
cardSettings: {
|
|
1978
1970
|
cardOrientation: isMediaTypeImage ? RCS_IMAGE_DIMENSIONS[selectedDimension]?.orientation || VERTICAL : RCS_VIDEO_THUMBNAIL_DIMENSIONS[selectedDimension]?.orientation || VERTICAL,
|
|
@@ -1147,7 +1147,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1147
1147
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
1148
1148
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
1149
1149
|
eventContextTags={this.props?.eventContextTags}
|
|
1150
|
-
waitEventContextTags={this.props?.waitEventContextTags}
|
|
1151
1150
|
tagListGetPopupContainer={this.props.tagListGetPopupContainer}
|
|
1152
1151
|
tagListPopoverOverlayStyle={this.props.tagListPopoverOverlayStyle}
|
|
1153
1152
|
tagListPopoverOverlayClassName={this.props.tagListPopoverOverlayClassName}
|
|
@@ -1188,7 +1187,6 @@ Create.propTypes = {
|
|
|
1188
1187
|
isLoadingMetaEntities: PropTypes.bool,
|
|
1189
1188
|
selectedOfferDetails: PropTypes.array,
|
|
1190
1189
|
eventContextTags: PropTypes.array,
|
|
1191
|
-
waitEventContextTags: PropTypes.object,
|
|
1192
1190
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
1193
1191
|
handleTestAndPreview: PropTypes.func,
|
|
1194
1192
|
handleCloseTestAndPreview: PropTypes.func,
|
|
@@ -1091,7 +1091,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1091
1091
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
1092
1092
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
1093
1093
|
eventContextTags={this.props?.eventContextTags}
|
|
1094
|
-
waitEventContextTags={this.props?.waitEventContextTags}
|
|
1095
1094
|
messageDetails={this.props?.messageDetails}
|
|
1096
1095
|
/>
|
|
1097
1096
|
</CapColumn>
|
|
@@ -1132,7 +1131,6 @@ Edit.propTypes = {
|
|
|
1132
1131
|
injectedTags: PropTypes.object,
|
|
1133
1132
|
selectedOfferDetails: PropTypes.array,
|
|
1134
1133
|
eventContextTags: PropTypes.array,
|
|
1135
|
-
waitEventContextTags: PropTypes.object,
|
|
1136
1134
|
messageDetails: PropTypes.object,
|
|
1137
1135
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
1138
1136
|
handleTestAndPreview: PropTypes.func,
|
|
@@ -100,7 +100,6 @@ export const SmsTraiEdit = (props) => {
|
|
|
100
100
|
templateData = {},
|
|
101
101
|
selectedOfferDetails,
|
|
102
102
|
eventContextTags,
|
|
103
|
-
waitEventContextTags,
|
|
104
103
|
fetchingLiquidTags,
|
|
105
104
|
getLiquidTags,
|
|
106
105
|
showLiquidErrorInFooter,
|
|
@@ -1121,7 +1120,6 @@ export const SmsTraiEdit = (props) => {
|
|
|
1121
1120
|
disabled={!isRcsSmsFallback && disablehandler()}
|
|
1122
1121
|
selectedOfferDetails={selectedOfferDetails}
|
|
1123
1122
|
eventContextTags={eventContextTags}
|
|
1124
|
-
waitEventContextTags={waitEventContextTags}
|
|
1125
1123
|
popoverOverlayStyle={isRcsSmsFallback ? { zIndex: 10020 } : undefined}
|
|
1126
1124
|
popoverOverlayClassName={isRcsSmsFallback ? 'sms-fallback-taglist-popover rcs-sms-fallback-taglist-popover' : undefined}
|
|
1127
1125
|
/>
|
|
@@ -32,7 +32,6 @@ const SmsWrapper = (props) => {
|
|
|
32
32
|
smsRegister,
|
|
33
33
|
onShowTemplates,
|
|
34
34
|
eventContextTags,
|
|
35
|
-
waitEventContextTags,
|
|
36
35
|
showLiquidErrorInFooter,
|
|
37
36
|
getLiquidTags,
|
|
38
37
|
showTestAndPreviewSlidebox,
|
|
@@ -74,7 +73,6 @@ const SmsWrapper = (props) => {
|
|
|
74
73
|
onPreviewContentClicked,
|
|
75
74
|
onTestContentClicked,
|
|
76
75
|
eventContextTags,
|
|
77
|
-
waitEventContextTags,
|
|
78
76
|
showLiquidErrorInFooter,
|
|
79
77
|
getLiquidTags,
|
|
80
78
|
showTestAndPreviewSlidebox,
|
|
@@ -167,7 +167,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
167
167
|
let injectedTags = {};
|
|
168
168
|
const eventContextTagsObj = {};
|
|
169
169
|
|
|
170
|
-
const {selectedOfferDetails, eventContextTags
|
|
170
|
+
const {selectedOfferDetails, eventContextTags } = props;
|
|
171
171
|
if (props.injectedTags && !_.isEmpty(props.injectedTags)) {
|
|
172
172
|
const formattedInjectedTags = handleInjectedData(
|
|
173
173
|
props.injectedTags,
|
|
@@ -219,43 +219,6 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
219
219
|
};
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
|
-
// Wait event context tags should be displayed in the Add Labels when node is next to Event based wait node.
|
|
223
|
-
if (waitEventContextTags && Object.keys(waitEventContextTags)?.length) {
|
|
224
|
-
|
|
225
|
-
Object.keys(waitEventContextTags).forEach((blockId) => {
|
|
226
|
-
const WAIT_EVENT_HEADER_MSG_LABEL = `${waitEventContextTags[blockId].eventName} (${waitEventContextTags[blockId].blockName})`;
|
|
227
|
-
eventContextTagsObj[blockId] = {
|
|
228
|
-
"name": WAIT_EVENT_HEADER_MSG_LABEL,
|
|
229
|
-
"desc": WAIT_EVENT_HEADER_MSG_LABEL,
|
|
230
|
-
"resolved": true,
|
|
231
|
-
'tag-header': true,
|
|
232
|
-
"subtags": {},
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
waitEventContextTags?.[blockId]?.tags?.forEach((tag) => {
|
|
236
|
-
const {
|
|
237
|
-
tagName, label, profileId, profileName, blockName, eventName
|
|
238
|
-
} = tag || {};
|
|
239
|
-
if (!profileId || !tagName || !label || !profileName) return;
|
|
240
|
-
// Initializing the tags profile if it doesn't exist
|
|
241
|
-
if (!eventContextTagsObj?.[blockId]?.subtags?.[profileId]) {
|
|
242
|
-
eventContextTagsObj[blockId].subtags[profileId] = {
|
|
243
|
-
"name": profileName,
|
|
244
|
-
"desc": profileName,
|
|
245
|
-
"resolved": true,
|
|
246
|
-
'tag-header': true,
|
|
247
|
-
"subtags": {},
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
// Adding the current tag to the profile group
|
|
251
|
-
eventContextTagsObj[blockId].subtags[profileId].subtags[tagName] = {
|
|
252
|
-
name: label,
|
|
253
|
-
desc: label,
|
|
254
|
-
resolved: true,
|
|
255
|
-
};
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
222
|
this.setState({tags: _.merge( {}, tags, injectedTags, eventContextTagsObj )});
|
|
260
223
|
}
|
|
261
224
|
|
|
@@ -443,7 +406,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
443
406
|
isDisabled = true;
|
|
444
407
|
tooltipMsg = intl.formatMessage(messages.personalizationNotSupportedAnonymous);
|
|
445
408
|
}
|
|
446
|
-
|
|
409
|
+
|
|
447
410
|
return (
|
|
448
411
|
<div className={this.props.className ? this.props.className : ''}>
|
|
449
412
|
<CapTagList
|
|
@@ -477,7 +440,6 @@ TagList.defaultProps = {
|
|
|
477
440
|
isNewVersionFlow: false,
|
|
478
441
|
userLocale: 'en',
|
|
479
442
|
eventContextTags: [],
|
|
480
|
-
waitEventContextTags: {},
|
|
481
443
|
};
|
|
482
444
|
|
|
483
445
|
TagList.propTypes = {
|
|
@@ -498,7 +460,6 @@ TagList.propTypes = {
|
|
|
498
460
|
disabled: PropTypes.bool,
|
|
499
461
|
fetchingSchemaError: PropTypes.bool,
|
|
500
462
|
eventContextTags: PropTypes.array,
|
|
501
|
-
waitEventContextTags: PropTypes.object,
|
|
502
463
|
popoverPlacement: PropTypes.string,
|
|
503
464
|
// message to show when Add Label button is disabled (e.g. personalization restriction)
|
|
504
465
|
disableTooltipMsg: PropTypes.string,
|
|
@@ -19,8 +19,4 @@ export default defineMessages({
|
|
|
19
19
|
id: `${scope}.personalizationNotSupportedAnonymous`,
|
|
20
20
|
defaultMessage: 'Personalization tags are not supported for anonymous customers',
|
|
21
21
|
},
|
|
22
|
-
waitEvent: {
|
|
23
|
-
id: `${scope}.waitEvent`,
|
|
24
|
-
defaultMessage: 'Wait Event',
|
|
25
|
-
},
|
|
26
22
|
});
|
|
@@ -5,34 +5,28 @@ import { initialReducer } from '../../../initialReducer';
|
|
|
5
5
|
import { injectIntl } from "react-intl";
|
|
6
6
|
import { fireEvent } from "@testing-library/react";
|
|
7
7
|
import { TagList } from '../index';
|
|
8
|
-
import { TagListData, eventContextTags
|
|
9
|
-
import { OfferTag, badgesTags, offer } from '../../../utils/tests/common.mockdata';
|
|
10
|
-
import * as commonUtils from "../../../utils/common";
|
|
8
|
+
import { TagListData, eventContextTags } from './mockdata';
|
|
11
9
|
import { Provider } from 'react-redux';
|
|
12
10
|
import { screen, render } from '../../../utils/test-utils';
|
|
13
11
|
import history from '../../../utils/history';
|
|
14
12
|
const { getByText, queryByText } = screen;
|
|
15
13
|
|
|
16
|
-
const buildProps = (props = {}) => ({
|
|
17
|
-
...TagListData,
|
|
18
|
-
onTagSelect: jest.fn(),
|
|
19
|
-
...props,
|
|
20
|
-
});
|
|
21
14
|
|
|
22
|
-
const initializeTagList = (props
|
|
15
|
+
const initializeTagList = (props) => {
|
|
23
16
|
const store = configureStore({}, initialReducer, history);
|
|
24
17
|
const Component = injectIntl(TagList);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
...
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
</Provider>
|
|
31
|
-
),
|
|
32
|
-
store,
|
|
33
|
-
Component,
|
|
34
|
-
propsObj,
|
|
18
|
+
|
|
19
|
+
const propsObj = {
|
|
20
|
+
...TagListData,
|
|
21
|
+
onTagSelect: jest.fn(),
|
|
22
|
+
...props,
|
|
35
23
|
};
|
|
24
|
+
|
|
25
|
+
return render(
|
|
26
|
+
<Provider store={store}>
|
|
27
|
+
<Component {...propsObj} />
|
|
28
|
+
</Provider>
|
|
29
|
+
);
|
|
36
30
|
};
|
|
37
31
|
|
|
38
32
|
const addLabelBtnAssertion = () => {
|
|
@@ -47,115 +41,19 @@ describe("TagList test : UNIT", () => {
|
|
|
47
41
|
addLabelBtnAssertion();
|
|
48
42
|
});
|
|
49
43
|
|
|
50
|
-
it('should render event context
|
|
51
|
-
initializeTagList({
|
|
44
|
+
it('should render event context tags correctly from generateTags and show tags under profile', () => {
|
|
45
|
+
initializeTagList({eventContextTags});
|
|
52
46
|
addLabelBtnAssertion();
|
|
53
47
|
const EVENT_CONTEXT_TAG_HEADER = getByText(/Entry event/i);
|
|
54
48
|
expect(EVENT_CONTEXT_TAG_HEADER).toBeInTheDocument();
|
|
49
|
+
fireEvent.click(EVENT_CONTEXT_TAG_HEADER);
|
|
50
|
+
// Customer profile tags
|
|
51
|
+
const CUSTOMER_PROFILE = getByText(/Current Customer/i);
|
|
52
|
+
fireEvent.click(CUSTOMER_PROFILE);
|
|
53
|
+
expect(getByText(/lifetimePurchases/i)).toBeInTheDocument();
|
|
55
54
|
|
|
56
55
|
// Behavioural event profile tags should not be visible as label and profile name is not present
|
|
57
56
|
const BEHAVIOURAL_EVENT_PROFILE = queryByText(/Behavioural event/i);
|
|
58
57
|
expect(BEHAVIOURAL_EVENT_PROFILE).not.toBeInTheDocument();
|
|
59
58
|
});
|
|
60
|
-
|
|
61
|
-
it('should render wait event context section when waitEventContextTags is provided', () => {
|
|
62
|
-
initializeTagList({ waitEventContextTags, moduleFilterEnabled: false });
|
|
63
|
-
addLabelBtnAssertion();
|
|
64
|
-
const WAIT_EVENT_HEADER = getByText(/Order Placed \(Wait Block\)/i);
|
|
65
|
-
expect(WAIT_EVENT_HEADER).toBeInTheDocument();
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('should merge empty waitEventContextTags with entry event tags', () => {
|
|
69
|
-
initializeTagList({ eventContextTags, waitEventContextTags: {}, moduleFilterEnabled: false });
|
|
70
|
-
addLabelBtnAssertion();
|
|
71
|
-
expect(getByText(/Entry event/i)).toBeInTheDocument();
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('calls parent onContextChange with Outbound when tags and injectedTags are empty on mount', () => {
|
|
75
|
-
const onContextChange = jest.fn();
|
|
76
|
-
initializeTagList({
|
|
77
|
-
tags: [],
|
|
78
|
-
injectedTags: {},
|
|
79
|
-
onContextChange,
|
|
80
|
-
onTagSelect: jest.fn(),
|
|
81
|
-
});
|
|
82
|
-
expect(onContextChange).toHaveBeenCalledWith('Outbound');
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('applies fetchingSchemaError from props via componentWillReceiveProps', () => {
|
|
86
|
-
const { rerender, Component, propsObj, store } = initializeTagList({ fetchingSchemaError: false });
|
|
87
|
-
addLabelBtnAssertion();
|
|
88
|
-
rerender(
|
|
89
|
-
<Provider store={store}>
|
|
90
|
-
<Component {...propsObj} fetchingSchemaError />
|
|
91
|
-
</Provider>
|
|
92
|
-
);
|
|
93
|
-
expect(screen.getByText(/add label/i)).toBeInTheDocument();
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('disables Add label when restrictPersonalization is true', () => {
|
|
97
|
-
initializeTagList({
|
|
98
|
-
restrictPersonalization: true,
|
|
99
|
-
disabled: false,
|
|
100
|
-
moduleFilterEnabled: false,
|
|
101
|
-
});
|
|
102
|
-
const btn = screen.getByText(/add label/i).closest('button');
|
|
103
|
-
expect(btn).toBeDisabled();
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('calls transformCouponTags when selectedOfferDetails and coupon tags are present', () => {
|
|
107
|
-
const spy = jest.spyOn(TagList.prototype, 'transformCouponTags');
|
|
108
|
-
initializeTagList({
|
|
109
|
-
tags: OfferTag,
|
|
110
|
-
injectedTags: {},
|
|
111
|
-
selectedOfferDetails: [{ id: 'c1', couponName: 'Promo Coupon', couponSeriesId: 'c1' }],
|
|
112
|
-
moduleFilterEnabled: false,
|
|
113
|
-
});
|
|
114
|
-
expect(spy).toHaveBeenCalled();
|
|
115
|
-
spy.mockRestore();
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it('calls transformBadgeTags from common when badge offer and Badge tags are present', () => {
|
|
119
|
-
const spy = jest.spyOn(commonUtils, 'transformBadgeTags');
|
|
120
|
-
initializeTagList({
|
|
121
|
-
tags: badgesTags,
|
|
122
|
-
injectedTags: {},
|
|
123
|
-
selectedOfferDetails: offer,
|
|
124
|
-
moduleFilterEnabled: false,
|
|
125
|
-
});
|
|
126
|
-
expect(spy).toHaveBeenCalled();
|
|
127
|
-
spy.mockRestore();
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it('unmounts without throwing', () => {
|
|
131
|
-
const { unmount } = initializeTagList();
|
|
132
|
-
expect(() => unmount()).not.toThrow();
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('regenerates tags when props.tags change (componentDidUpdate)', () => {
|
|
136
|
-
const { rerender, Component, store } = initializeTagList({ tags: TagListData.tags });
|
|
137
|
-
const extra = [
|
|
138
|
-
...TagListData.tags,
|
|
139
|
-
{
|
|
140
|
-
_id: 'extra-tag',
|
|
141
|
-
type: 'TAG',
|
|
142
|
-
definition: {
|
|
143
|
-
label: { en: 'Extra' },
|
|
144
|
-
value: 'extra_value',
|
|
145
|
-
subtags: [],
|
|
146
|
-
'tag-header': false,
|
|
147
|
-
supportedModules: [{ context: 'default', layout: 'sms', mandatory: false }],
|
|
148
|
-
},
|
|
149
|
-
scope: { tag: 'STANDARD', orgId: -1, verticals: [] },
|
|
150
|
-
isActive: true,
|
|
151
|
-
},
|
|
152
|
-
];
|
|
153
|
-
rerender(
|
|
154
|
-
<Provider store={store}>
|
|
155
|
-
<Component {...buildProps({ tags: extra })} />
|
|
156
|
-
</Provider>
|
|
157
|
-
);
|
|
158
|
-
addLabelBtnAssertion();
|
|
159
|
-
expect(screen.getByText(/add label/i)).toBeInTheDocument();
|
|
160
|
-
});
|
|
161
59
|
});
|
|
@@ -149,20 +149,3 @@ export const eventContextTags = [
|
|
|
149
149
|
"isDynamicFact": false
|
|
150
150
|
}
|
|
151
151
|
];
|
|
152
|
-
|
|
153
|
-
export const waitEventContextTags = {
|
|
154
|
-
block1: {
|
|
155
|
-
eventName: 'Order Placed',
|
|
156
|
-
blockName: 'Wait Block',
|
|
157
|
-
tags: [
|
|
158
|
-
{
|
|
159
|
-
tagName: 'waitEvent.orderId',
|
|
160
|
-
label: 'Order ID',
|
|
161
|
-
profileId: 'ORDER_PROFILE',
|
|
162
|
-
profileName: 'Order Profile',
|
|
163
|
-
blockName: 'Wait Block',
|
|
164
|
-
eventName: 'Order Placed',
|
|
165
|
-
},
|
|
166
|
-
],
|
|
167
|
-
},
|
|
168
|
-
};
|
|
@@ -82,7 +82,6 @@ export const Viber = (props) => {
|
|
|
82
82
|
viberData = {},
|
|
83
83
|
selectedOfferDetails = [],
|
|
84
84
|
eventContextTags,
|
|
85
|
-
waitEventContextTags,
|
|
86
85
|
// TestAndPreviewSlidebox props
|
|
87
86
|
showTestAndPreviewSlidebox: propsShowTestAndPreviewSlidebox,
|
|
88
87
|
handleTestAndPreview: propsHandleTestAndPreview,
|
|
@@ -233,8 +232,6 @@ export const Viber = (props) => {
|
|
|
233
232
|
tagsParam: tags,
|
|
234
233
|
location,
|
|
235
234
|
tagModule: 'outbound',
|
|
236
|
-
eventContextTags,
|
|
237
|
-
waitEventContextTags,
|
|
238
235
|
isFullMode,
|
|
239
236
|
}) || {};
|
|
240
237
|
if (value.trim() === '') {
|
|
@@ -290,7 +287,6 @@ export const Viber = (props) => {
|
|
|
290
287
|
userLocale={localStorage.getItem("jlocale") || "en"}
|
|
291
288
|
selectedOfferDetails={selectedOfferDetails}
|
|
292
289
|
eventContextTags={eventContextTags}
|
|
293
|
-
waitEventContextTags={waitEventContextTags}
|
|
294
290
|
/>
|
|
295
291
|
</CapColumn>
|
|
296
292
|
<div className="viber-textarea-wrapper">
|
|
@@ -596,7 +592,6 @@ export const Viber = (props) => {
|
|
|
596
592
|
userLocale={localStorage.getItem("jlocale") || "en"}
|
|
597
593
|
selectedOfferDetails={selectedOfferDetails}
|
|
598
594
|
eventContextTags={eventContextTags}
|
|
599
|
-
waitEventContextTags={waitEventContextTags}
|
|
600
595
|
/>
|
|
601
596
|
<CapColumn className="cta-actions">
|
|
602
597
|
<CapButton
|
|
@@ -84,7 +84,6 @@ const MemoizedTagList = memo(({
|
|
|
84
84
|
injectedTags,
|
|
85
85
|
selectedOfferDetails,
|
|
86
86
|
eventContextTags,
|
|
87
|
-
waitEventContextTags,
|
|
88
87
|
forwardedTags,
|
|
89
88
|
onTagSelect,
|
|
90
89
|
restrictPersonalization = false,
|
|
@@ -100,7 +99,6 @@ const MemoizedTagList = memo(({
|
|
|
100
99
|
injectedTags={injectedTags}
|
|
101
100
|
selectedOfferDetails={selectedOfferDetails}
|
|
102
101
|
eventContextTags={eventContextTags}
|
|
103
|
-
waitEventContextTags={waitEventContextTags}
|
|
104
102
|
forwardedTags={forwardedTags}
|
|
105
103
|
onTagSelect={onTagSelect}
|
|
106
104
|
restrictPersonalization={restrictPersonalization}
|
|
@@ -118,7 +116,6 @@ const MemoizedTagList = memo(({
|
|
|
118
116
|
&& prevProps.injectedTags === nextProps.injectedTags
|
|
119
117
|
&& prevProps.selectedOfferDetails === nextProps.selectedOfferDetails
|
|
120
118
|
&& prevProps.eventContextTags === nextProps.eventContextTags
|
|
121
|
-
&& prevProps.waitEventContextTags === nextProps.waitEventContextTags
|
|
122
119
|
&& prevProps.forwardedTags === nextProps.forwardedTags
|
|
123
120
|
&& prevProps.onTagSelect === nextProps.onTagSelect
|
|
124
121
|
&& prevProps.restrictPersonalization === nextProps.restrictPersonalization
|
|
@@ -155,7 +152,6 @@ const WebPushCreate = ({
|
|
|
155
152
|
forwardedTags,
|
|
156
153
|
selectedOfferDetails = [],
|
|
157
154
|
eventContextTags = [],
|
|
158
|
-
waitEventContextTags = {},
|
|
159
155
|
templateActions: templateActionsProps,
|
|
160
156
|
Templates,
|
|
161
157
|
restrictPersonalization = false,
|
|
@@ -236,7 +232,6 @@ const WebPushCreate = ({
|
|
|
236
232
|
supportedTags: memoizedSupportedTags,
|
|
237
233
|
injectedTags,
|
|
238
234
|
eventContextTags,
|
|
239
|
-
waitEventContextTags,
|
|
240
235
|
});
|
|
241
236
|
const { tags, handleOnTagsContextChange, validationConfig } = tagState;
|
|
242
237
|
const { weCrmAccounts } = Templates;
|
|
@@ -842,13 +837,12 @@ const WebPushCreate = ({
|
|
|
842
837
|
injectedTags,
|
|
843
838
|
selectedOfferDetails,
|
|
844
839
|
eventContextTags,
|
|
845
|
-
waitEventContextTags,
|
|
846
840
|
forwardedTags,
|
|
847
841
|
restrictPersonalization,
|
|
848
842
|
disabled: restrictPersonalization,
|
|
849
843
|
disableTooltipMsg: restrictPersonalization ? formatMessage(messages.personalizationNotSupportedAnonymous) : undefined,
|
|
850
844
|
}),
|
|
851
|
-
[tags, injectedTags, selectedOfferDetails, eventContextTags,
|
|
845
|
+
[tags, injectedTags, selectedOfferDetails, eventContextTags, forwardedTags, restrictPersonalization, formatMessage],
|
|
852
846
|
);
|
|
853
847
|
|
|
854
848
|
// Memoized TagList components with optimized props
|
|
@@ -1089,7 +1083,6 @@ WebPushCreate.propTypes = {
|
|
|
1089
1083
|
forwardedTags: PropTypes.object,
|
|
1090
1084
|
selectedOfferDetails: PropTypes.array,
|
|
1091
1085
|
eventContextTags: PropTypes.array,
|
|
1092
|
-
waitEventContextTags: PropTypes.object,
|
|
1093
1086
|
templateActions: PropTypes.object,
|
|
1094
1087
|
restrictPersonalization: PropTypes.bool,
|
|
1095
1088
|
};
|
|
@@ -1118,7 +1111,6 @@ WebPushCreate.defaultProps = {
|
|
|
1118
1111
|
forwardedTags: {},
|
|
1119
1112
|
selectedOfferDetails: [],
|
|
1120
1113
|
eventContextTags: [],
|
|
1121
|
-
waitEventContextTags: {},
|
|
1122
1114
|
templateActions: {},
|
|
1123
1115
|
Templates: {},
|
|
1124
1116
|
restrictPersonalization: false,
|
|
@@ -181,7 +181,6 @@ export const Whatsapp = (props) => {
|
|
|
181
181
|
getFormData,
|
|
182
182
|
selectedOfferDetails,
|
|
183
183
|
eventContextTags,
|
|
184
|
-
waitEventContextTags = {},
|
|
185
184
|
metaDataStatus = "",
|
|
186
185
|
showTestAndPreviewSlidebox: propsShowTestAndPreviewSlidebox,
|
|
187
186
|
handleTestAndPreview: propsHandleTestAndPreview,
|
|
@@ -934,7 +933,6 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
934
933
|
injectedTags={injectedTags || {}}
|
|
935
934
|
selectedOfferDetails={selectedOfferDetails}
|
|
936
935
|
eventContextTags={eventContextTags}
|
|
937
|
-
waitEventContextTags={waitEventContextTags}
|
|
938
936
|
/>
|
|
939
937
|
)}
|
|
940
938
|
</>
|
|
@@ -1936,7 +1934,6 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1936
1934
|
injectedTags={injectedTags || {}}
|
|
1937
1935
|
selectedOfferDetails={selectedOfferDetails}
|
|
1938
1936
|
eventContextTags={eventContextTags}
|
|
1939
|
-
waitEventContextTags={waitEventContextTags}
|
|
1940
1937
|
/>
|
|
1941
1938
|
)
|
|
1942
1939
|
: !isAuthenticationTemplate && (
|
|
@@ -2743,7 +2740,6 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2743
2740
|
injectedTags={injectedTags || {}}
|
|
2744
2741
|
selectedOfferDetails={selectedOfferDetails}
|
|
2745
2742
|
eventContextTags={eventContextTags}
|
|
2746
|
-
waitEventContextTags={waitEventContextTags}
|
|
2747
2743
|
/>
|
|
2748
2744
|
)
|
|
2749
2745
|
}
|
|
@@ -2862,7 +2858,6 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2862
2858
|
injectedTags={injectedTags || {}}
|
|
2863
2859
|
selectedOfferDetails={selectedOfferDetails}
|
|
2864
2860
|
eventContextTags={eventContextTags}
|
|
2865
|
-
waitEventContextTags={waitEventContextTags}
|
|
2866
2861
|
/>
|
|
2867
2862
|
)}
|
|
2868
2863
|
{isBtnTypeQuickReply && (
|