@capillarytech/creatives-library 8.0.320 → 8.0.322
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 +34 -0
- package/v2Components/CapTagList/index.js +15 -22
- package/v2Components/CapTagList/style.scss +48 -0
- package/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +63 -0
- package/v2Components/CapTagListWithInput/index.js +4 -0
- package/v2Components/CapWhatsappCTA/index.js +2 -0
- package/v2Components/FormBuilder/index.js +7 -0
- package/v2Components/HtmlEditor/HTMLEditor.js +6 -1
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -0
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +927 -2
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +3 -0
- package/v2Containers/BeeEditor/index.js +3 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +28 -1
- package/v2Containers/CreativesContainer/index.js +9 -7
- package/v2Containers/Email/index.js +1 -0
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +7 -1
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +3 -0
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +20 -2
- package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +16 -1
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +3 -0
- package/v2Containers/EmailWrapper/index.js +4 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +1 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +9 -0
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +19 -0
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +3 -0
- package/v2Containers/InAppWrapper/index.js +3 -0
- package/v2Containers/MobilePush/Create/index.js +2 -0
- package/v2Containers/MobilePush/Edit/index.js +2 -0
- package/v2Containers/MobilepushWrapper/index.js +3 -1
- package/v2Containers/Rcs/index.js +2 -8
- package/v2Containers/Sms/Create/index.js +2 -0
- package/v2Containers/Sms/Edit/index.js +2 -0
- package/v2Containers/SmsTrai/Edit/index.js +2 -0
- package/v2Containers/SmsWrapper/index.js +2 -0
- package/v2Containers/TagList/index.js +41 -2
- package/v2Containers/TagList/messages.js +4 -0
- package/v2Containers/TagList/tests/TagList.test.js +122 -20
- package/v2Containers/TagList/tests/mockdata.js +17 -0
- package/v2Containers/Viber/index.js +5 -0
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +0 -2
- package/v2Containers/WebPush/Create/index.js +9 -1
- package/v2Containers/Whatsapp/index.js +5 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +20 -0
- package/v2Containers/Zalo/index.js +2 -0
|
@@ -36,6 +36,7 @@ const InAppWrapper = (props) => {
|
|
|
36
36
|
onPreviewContentClicked,
|
|
37
37
|
onTestContentClicked,
|
|
38
38
|
eventContextTags,
|
|
39
|
+
waitEventContextTags,
|
|
39
40
|
onCreateComplete,
|
|
40
41
|
handleClose,
|
|
41
42
|
templateData,
|
|
@@ -78,6 +79,7 @@ const InAppWrapper = (props) => {
|
|
|
78
79
|
onPreviewContentClicked,
|
|
79
80
|
onTestContentClicked,
|
|
80
81
|
eventContextTags,
|
|
82
|
+
waitEventContextTags,
|
|
81
83
|
onCreateComplete,
|
|
82
84
|
handleClose,
|
|
83
85
|
templateData,
|
|
@@ -124,6 +126,7 @@ InAppWrapper.propTypes = {
|
|
|
124
126
|
onPreviewContentClicked: PropTypes.func,
|
|
125
127
|
onTestContentClicked: PropTypes.func,
|
|
126
128
|
eventContextTags: PropTypes.array,
|
|
129
|
+
waitEventContextTags: PropTypes.object,
|
|
127
130
|
onCreateComplete: PropTypes.func,
|
|
128
131
|
handleClose: PropTypes.func,
|
|
129
132
|
templateData: PropTypes.object,
|
|
@@ -1966,6 +1966,7 @@ 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}
|
|
1969
1970
|
messageDetails={this.props?.messageDetails}
|
|
1970
1971
|
restrictPersonalization={this.props.restrictPersonalization}
|
|
1971
1972
|
/>
|
|
@@ -2068,6 +2069,7 @@ Create.propTypes = {
|
|
|
2068
2069
|
onPreviewContentClicked: PropTypes.func,
|
|
2069
2070
|
onTestContentClicked: PropTypes.func,
|
|
2070
2071
|
eventContextTags: PropTypes.array,
|
|
2072
|
+
waitEventContextTags: PropTypes.object,
|
|
2071
2073
|
getLiquidTags: PropTypes.func,
|
|
2072
2074
|
showLiquidErrorInFooter: PropTypes.func,
|
|
2073
2075
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
@@ -2233,6 +2233,7 @@ 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}
|
|
2236
2237
|
restrictPersonalization={this.props.restrictPersonalization}
|
|
2237
2238
|
/>;
|
|
2238
2239
|
})()}
|
|
@@ -2339,6 +2340,7 @@ Edit.propTypes = {
|
|
|
2339
2340
|
onTestContentClicked: PropTypes.func,
|
|
2340
2341
|
creativesMode: PropTypes.string,
|
|
2341
2342
|
eventContextTags: PropTypes.array,
|
|
2343
|
+
waitEventContextTags: PropTypes.object,
|
|
2342
2344
|
getLiquidTags: PropTypes.func,
|
|
2343
2345
|
showLiquidErrorInFooter: PropTypes.func,
|
|
2344
2346
|
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 = [], 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 = [], waitEventContextTags = {},showTestAndPreviewSlidebox, handleTestAndPreview, handleCloseTestAndPreview, restrictPersonalization, isAnonymousType, onPersonalizationTokensChange} = this.props;
|
|
76
76
|
const {templateName} = this.state;
|
|
77
77
|
const isShowMobilepushCreate = !isEmpty(mobilePushCreateMode);
|
|
78
78
|
return (
|
|
@@ -121,6 +121,7 @@ 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}
|
|
124
125
|
showLiquidErrorInFooter={this.props.showLiquidErrorInFooter}
|
|
125
126
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
126
127
|
handleTestAndPreview={handleTestAndPreview}
|
|
@@ -155,6 +156,7 @@ MobilepushWrapper.propTypes = {
|
|
|
155
156
|
type: PropTypes.string,
|
|
156
157
|
onValidationFail: PropTypes.func,
|
|
157
158
|
eventContextTags: PropTypes.array,
|
|
159
|
+
waitEventContextTags: PropTypes.object,
|
|
158
160
|
showLiquidErrorInFooter: PropTypes.func,
|
|
159
161
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
160
162
|
handleTestAndPreview: PropTypes.func,
|
|
@@ -144,6 +144,7 @@ export const Rcs = (props) => {
|
|
|
144
144
|
orgUnitId,
|
|
145
145
|
selectedOfferDetails,
|
|
146
146
|
eventContextTags,
|
|
147
|
+
waitEventContextTags,
|
|
147
148
|
accountData = {},
|
|
148
149
|
// TestAndPreviewSlidebox props
|
|
149
150
|
showTestAndPreviewSlidebox: propsShowTestAndPreviewSlidebox,
|
|
@@ -256,7 +257,6 @@ export const Rcs = (props) => {
|
|
|
256
257
|
const [accessToken, setAccessToken] = useState('');
|
|
257
258
|
const [hostName, setHostName] = useState('');
|
|
258
259
|
const [accountName, setAccountName] = useState('');
|
|
259
|
-
const [rcsAccount, setRcsAccount] = useState('');
|
|
260
260
|
useEffect(() => {
|
|
261
261
|
const accountObj = accountData.selectedRcsAccount || {};
|
|
262
262
|
if (!isEmpty(accountObj)) {
|
|
@@ -272,14 +272,12 @@ export const Rcs = (props) => {
|
|
|
272
272
|
setAccessToken(configs.accessToken || '');
|
|
273
273
|
setHostName(accountObj.hostName || '');
|
|
274
274
|
setAccountName(accountObj.name || '');
|
|
275
|
-
setRcsAccount(accountObj.id || '');
|
|
276
275
|
} else {
|
|
277
276
|
setAccountId('');
|
|
278
277
|
setWecrmAccountId('');
|
|
279
278
|
setAccessToken('');
|
|
280
279
|
setHostName('');
|
|
281
280
|
setAccountName('');
|
|
282
|
-
setRcsAccount('');
|
|
283
281
|
}
|
|
284
282
|
}, [accountData.selectedRcsAccount]);
|
|
285
283
|
|
|
@@ -747,10 +745,7 @@ export const Rcs = (props) => {
|
|
|
747
745
|
get(details, 'versions.base.content.RCS.rcsContent.cardSettings', '')
|
|
748
746
|
|| get(details, 'rcsContent.cardSettings', '');
|
|
749
747
|
setMediaData(mediaData, mediaType, cardSettings);
|
|
750
|
-
|
|
751
|
-
const rcsAccountId = get(details, 'versions.base.content.RCS.rcsContent.accountId', '');
|
|
752
|
-
setRcsAccount(rcsAccountId);
|
|
753
|
-
}
|
|
748
|
+
|
|
754
749
|
const smsFallbackContent = mergeRcsSmsFallBackContentFromDetails(details);
|
|
755
750
|
const base = get(smsFallbackContent, 'versions.base', {});
|
|
756
751
|
const updatedEditor = base['updated-sms-editor'] ?? base['sms-editor'];
|
|
@@ -1933,7 +1928,6 @@ const onTitleAddVar = () => {
|
|
|
1933
1928
|
content: {
|
|
1934
1929
|
RCS: {
|
|
1935
1930
|
rcsContent: {
|
|
1936
|
-
...(rcsAccount && !isFullMode && { accountId: rcsAccount }),
|
|
1937
1931
|
cardType: STANDALONE,
|
|
1938
1932
|
cardSettings: {
|
|
1939
1933
|
cardOrientation: isMediaTypeImage ? RCS_IMAGE_DIMENSIONS[selectedDimension]?.orientation || VERTICAL : RCS_VIDEO_THUMBNAIL_DIMENSIONS[selectedDimension]?.orientation || VERTICAL,
|
|
@@ -1130,6 +1130,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1130
1130
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
1131
1131
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
1132
1132
|
eventContextTags={this.props?.eventContextTags}
|
|
1133
|
+
waitEventContextTags={this.props?.waitEventContextTags}
|
|
1133
1134
|
tagListGetPopupContainer={this.props.tagListGetPopupContainer}
|
|
1134
1135
|
tagListPopoverOverlayStyle={this.props.tagListPopoverOverlayStyle}
|
|
1135
1136
|
tagListPopoverOverlayClassName={this.props.tagListPopoverOverlayClassName}
|
|
@@ -1170,6 +1171,7 @@ Create.propTypes = {
|
|
|
1170
1171
|
isLoadingMetaEntities: PropTypes.bool,
|
|
1171
1172
|
selectedOfferDetails: PropTypes.array,
|
|
1172
1173
|
eventContextTags: PropTypes.array,
|
|
1174
|
+
waitEventContextTags: PropTypes.object,
|
|
1173
1175
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
1174
1176
|
handleTestAndPreview: PropTypes.func,
|
|
1175
1177
|
handleCloseTestAndPreview: PropTypes.func,
|
|
@@ -1091,6 +1091,7 @@ 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}
|
|
1094
1095
|
messageDetails={this.props?.messageDetails}
|
|
1095
1096
|
/>
|
|
1096
1097
|
</CapColumn>
|
|
@@ -1131,6 +1132,7 @@ Edit.propTypes = {
|
|
|
1131
1132
|
injectedTags: PropTypes.object,
|
|
1132
1133
|
selectedOfferDetails: PropTypes.array,
|
|
1133
1134
|
eventContextTags: PropTypes.array,
|
|
1135
|
+
waitEventContextTags: PropTypes.object,
|
|
1134
1136
|
messageDetails: PropTypes.object,
|
|
1135
1137
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
1136
1138
|
handleTestAndPreview: PropTypes.func,
|
|
@@ -100,6 +100,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
100
100
|
templateData = {},
|
|
101
101
|
selectedOfferDetails,
|
|
102
102
|
eventContextTags,
|
|
103
|
+
waitEventContextTags,
|
|
103
104
|
fetchingLiquidTags,
|
|
104
105
|
getLiquidTags,
|
|
105
106
|
showLiquidErrorInFooter,
|
|
@@ -1120,6 +1121,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
1120
1121
|
disabled={!isRcsSmsFallback && disablehandler()}
|
|
1121
1122
|
selectedOfferDetails={selectedOfferDetails}
|
|
1122
1123
|
eventContextTags={eventContextTags}
|
|
1124
|
+
waitEventContextTags={waitEventContextTags}
|
|
1123
1125
|
popoverOverlayStyle={isRcsSmsFallback ? { zIndex: 10020 } : undefined}
|
|
1124
1126
|
popoverOverlayClassName={isRcsSmsFallback ? 'sms-fallback-taglist-popover rcs-sms-fallback-taglist-popover' : undefined}
|
|
1125
1127
|
/>
|
|
@@ -32,6 +32,7 @@ const SmsWrapper = (props) => {
|
|
|
32
32
|
smsRegister,
|
|
33
33
|
onShowTemplates,
|
|
34
34
|
eventContextTags,
|
|
35
|
+
waitEventContextTags,
|
|
35
36
|
showLiquidErrorInFooter,
|
|
36
37
|
getLiquidTags,
|
|
37
38
|
showTestAndPreviewSlidebox,
|
|
@@ -73,6 +74,7 @@ const SmsWrapper = (props) => {
|
|
|
73
74
|
onPreviewContentClicked,
|
|
74
75
|
onTestContentClicked,
|
|
75
76
|
eventContextTags,
|
|
77
|
+
waitEventContextTags,
|
|
76
78
|
showLiquidErrorInFooter,
|
|
77
79
|
getLiquidTags,
|
|
78
80
|
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 } = props;
|
|
170
|
+
const {selectedOfferDetails, eventContextTags, waitEventContextTags } = props;
|
|
171
171
|
if (props.injectedTags && !_.isEmpty(props.injectedTags)) {
|
|
172
172
|
const formattedInjectedTags = handleInjectedData(
|
|
173
173
|
props.injectedTags,
|
|
@@ -219,6 +219,43 @@ 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
|
+
}
|
|
222
259
|
this.setState({tags: _.merge( {}, tags, injectedTags, eventContextTagsObj )});
|
|
223
260
|
}
|
|
224
261
|
|
|
@@ -406,7 +443,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
406
443
|
isDisabled = true;
|
|
407
444
|
tooltipMsg = intl.formatMessage(messages.personalizationNotSupportedAnonymous);
|
|
408
445
|
}
|
|
409
|
-
|
|
446
|
+
|
|
410
447
|
return (
|
|
411
448
|
<div className={this.props.className ? this.props.className : ''}>
|
|
412
449
|
<CapTagList
|
|
@@ -440,6 +477,7 @@ TagList.defaultProps = {
|
|
|
440
477
|
isNewVersionFlow: false,
|
|
441
478
|
userLocale: 'en',
|
|
442
479
|
eventContextTags: [],
|
|
480
|
+
waitEventContextTags: {},
|
|
443
481
|
};
|
|
444
482
|
|
|
445
483
|
TagList.propTypes = {
|
|
@@ -460,6 +498,7 @@ TagList.propTypes = {
|
|
|
460
498
|
disabled: PropTypes.bool,
|
|
461
499
|
fetchingSchemaError: PropTypes.bool,
|
|
462
500
|
eventContextTags: PropTypes.array,
|
|
501
|
+
waitEventContextTags: PropTypes.object,
|
|
463
502
|
popoverPlacement: PropTypes.string,
|
|
464
503
|
// message to show when Add Label button is disabled (e.g. personalization restriction)
|
|
465
504
|
disableTooltipMsg: PropTypes.string,
|
|
@@ -19,4 +19,8 @@ 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
|
+
},
|
|
22
26
|
});
|
|
@@ -5,28 +5,34 @@ 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 } from './mockdata';
|
|
8
|
+
import { TagListData, eventContextTags, waitEventContextTags } from './mockdata';
|
|
9
|
+
import { OfferTag, badgesTags, offer } from '../../../utils/tests/common.mockdata';
|
|
10
|
+
import * as commonUtils from "../../../utils/common";
|
|
9
11
|
import { Provider } from 'react-redux';
|
|
10
12
|
import { screen, render } from '../../../utils/test-utils';
|
|
11
13
|
import history from '../../../utils/history';
|
|
12
14
|
const { getByText, queryByText } = screen;
|
|
13
15
|
|
|
16
|
+
const buildProps = (props = {}) => ({
|
|
17
|
+
...TagListData,
|
|
18
|
+
onTagSelect: jest.fn(),
|
|
19
|
+
...props,
|
|
20
|
+
});
|
|
14
21
|
|
|
15
|
-
const initializeTagList = (props) => {
|
|
22
|
+
const initializeTagList = (props = {}) => {
|
|
16
23
|
const store = configureStore({}, initialReducer, history);
|
|
17
24
|
const Component = injectIntl(TagList);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
...
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
const propsObj = buildProps(props);
|
|
26
|
+
return {
|
|
27
|
+
...render(
|
|
28
|
+
<Provider store={store}>
|
|
29
|
+
<Component {...propsObj} />
|
|
30
|
+
</Provider>
|
|
31
|
+
),
|
|
32
|
+
store,
|
|
33
|
+
Component,
|
|
34
|
+
propsObj,
|
|
23
35
|
};
|
|
24
|
-
|
|
25
|
-
return render(
|
|
26
|
-
<Provider store={store}>
|
|
27
|
-
<Component {...propsObj} />
|
|
28
|
-
</Provider>
|
|
29
|
-
);
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
const addLabelBtnAssertion = () => {
|
|
@@ -41,19 +47,115 @@ describe("TagList test : UNIT", () => {
|
|
|
41
47
|
addLabelBtnAssertion();
|
|
42
48
|
});
|
|
43
49
|
|
|
44
|
-
it('should render event context
|
|
45
|
-
initializeTagList({eventContextTags});
|
|
50
|
+
it('should render event context tag section from generateTags', () => {
|
|
51
|
+
initializeTagList({ eventContextTags, moduleFilterEnabled: false });
|
|
46
52
|
addLabelBtnAssertion();
|
|
47
53
|
const EVENT_CONTEXT_TAG_HEADER = getByText(/Entry event/i);
|
|
48
54
|
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();
|
|
54
55
|
|
|
55
56
|
// Behavioural event profile tags should not be visible as label and profile name is not present
|
|
56
57
|
const BEHAVIOURAL_EVENT_PROFILE = queryByText(/Behavioural event/i);
|
|
57
58
|
expect(BEHAVIOURAL_EVENT_PROFILE).not.toBeInTheDocument();
|
|
58
59
|
});
|
|
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
|
+
});
|
|
59
161
|
});
|
|
@@ -149,3 +149,20 @@ 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,6 +82,7 @@ export const Viber = (props) => {
|
|
|
82
82
|
viberData = {},
|
|
83
83
|
selectedOfferDetails = [],
|
|
84
84
|
eventContextTags,
|
|
85
|
+
waitEventContextTags,
|
|
85
86
|
// TestAndPreviewSlidebox props
|
|
86
87
|
showTestAndPreviewSlidebox: propsShowTestAndPreviewSlidebox,
|
|
87
88
|
handleTestAndPreview: propsHandleTestAndPreview,
|
|
@@ -232,6 +233,8 @@ export const Viber = (props) => {
|
|
|
232
233
|
tagsParam: tags,
|
|
233
234
|
location,
|
|
234
235
|
tagModule: 'outbound',
|
|
236
|
+
eventContextTags,
|
|
237
|
+
waitEventContextTags,
|
|
235
238
|
isFullMode,
|
|
236
239
|
}) || {};
|
|
237
240
|
if (value.trim() === '') {
|
|
@@ -287,6 +290,7 @@ export const Viber = (props) => {
|
|
|
287
290
|
userLocale={localStorage.getItem("jlocale") || "en"}
|
|
288
291
|
selectedOfferDetails={selectedOfferDetails}
|
|
289
292
|
eventContextTags={eventContextTags}
|
|
293
|
+
waitEventContextTags={waitEventContextTags}
|
|
290
294
|
/>
|
|
291
295
|
</CapColumn>
|
|
292
296
|
<div className="viber-textarea-wrapper">
|
|
@@ -592,6 +596,7 @@ export const Viber = (props) => {
|
|
|
592
596
|
userLocale={localStorage.getItem("jlocale") || "en"}
|
|
593
597
|
selectedOfferDetails={selectedOfferDetails}
|
|
594
598
|
eventContextTags={eventContextTags}
|
|
599
|
+
waitEventContextTags={waitEventContextTags}
|
|
595
600
|
/>
|
|
596
601
|
<CapColumn className="cta-actions">
|
|
597
602
|
<CapButton
|
|
@@ -84,6 +84,7 @@ const MemoizedTagList = memo(({
|
|
|
84
84
|
injectedTags,
|
|
85
85
|
selectedOfferDetails,
|
|
86
86
|
eventContextTags,
|
|
87
|
+
waitEventContextTags,
|
|
87
88
|
forwardedTags,
|
|
88
89
|
onTagSelect,
|
|
89
90
|
restrictPersonalization = false,
|
|
@@ -99,6 +100,7 @@ const MemoizedTagList = memo(({
|
|
|
99
100
|
injectedTags={injectedTags}
|
|
100
101
|
selectedOfferDetails={selectedOfferDetails}
|
|
101
102
|
eventContextTags={eventContextTags}
|
|
103
|
+
waitEventContextTags={waitEventContextTags}
|
|
102
104
|
forwardedTags={forwardedTags}
|
|
103
105
|
onTagSelect={onTagSelect}
|
|
104
106
|
restrictPersonalization={restrictPersonalization}
|
|
@@ -116,6 +118,7 @@ const MemoizedTagList = memo(({
|
|
|
116
118
|
&& prevProps.injectedTags === nextProps.injectedTags
|
|
117
119
|
&& prevProps.selectedOfferDetails === nextProps.selectedOfferDetails
|
|
118
120
|
&& prevProps.eventContextTags === nextProps.eventContextTags
|
|
121
|
+
&& prevProps.waitEventContextTags === nextProps.waitEventContextTags
|
|
119
122
|
&& prevProps.forwardedTags === nextProps.forwardedTags
|
|
120
123
|
&& prevProps.onTagSelect === nextProps.onTagSelect
|
|
121
124
|
&& prevProps.restrictPersonalization === nextProps.restrictPersonalization
|
|
@@ -152,6 +155,7 @@ const WebPushCreate = ({
|
|
|
152
155
|
forwardedTags,
|
|
153
156
|
selectedOfferDetails = [],
|
|
154
157
|
eventContextTags = [],
|
|
158
|
+
waitEventContextTags = {},
|
|
155
159
|
templateActions: templateActionsProps,
|
|
156
160
|
Templates,
|
|
157
161
|
restrictPersonalization = false,
|
|
@@ -232,6 +236,7 @@ const WebPushCreate = ({
|
|
|
232
236
|
supportedTags: memoizedSupportedTags,
|
|
233
237
|
injectedTags,
|
|
234
238
|
eventContextTags,
|
|
239
|
+
waitEventContextTags,
|
|
235
240
|
});
|
|
236
241
|
const { tags, handleOnTagsContextChange, validationConfig } = tagState;
|
|
237
242
|
const { weCrmAccounts } = Templates;
|
|
@@ -837,12 +842,13 @@ const WebPushCreate = ({
|
|
|
837
842
|
injectedTags,
|
|
838
843
|
selectedOfferDetails,
|
|
839
844
|
eventContextTags,
|
|
845
|
+
waitEventContextTags,
|
|
840
846
|
forwardedTags,
|
|
841
847
|
restrictPersonalization,
|
|
842
848
|
disabled: restrictPersonalization,
|
|
843
849
|
disableTooltipMsg: restrictPersonalization ? formatMessage(messages.personalizationNotSupportedAnonymous) : undefined,
|
|
844
850
|
}),
|
|
845
|
-
[tags, injectedTags, selectedOfferDetails, eventContextTags, forwardedTags, restrictPersonalization, formatMessage],
|
|
851
|
+
[tags, injectedTags, selectedOfferDetails, eventContextTags, waitEventContextTags, forwardedTags, restrictPersonalization, formatMessage],
|
|
846
852
|
);
|
|
847
853
|
|
|
848
854
|
// Memoized TagList components with optimized props
|
|
@@ -1083,6 +1089,7 @@ WebPushCreate.propTypes = {
|
|
|
1083
1089
|
forwardedTags: PropTypes.object,
|
|
1084
1090
|
selectedOfferDetails: PropTypes.array,
|
|
1085
1091
|
eventContextTags: PropTypes.array,
|
|
1092
|
+
waitEventContextTags: PropTypes.object,
|
|
1086
1093
|
templateActions: PropTypes.object,
|
|
1087
1094
|
restrictPersonalization: PropTypes.bool,
|
|
1088
1095
|
};
|
|
@@ -1111,6 +1118,7 @@ WebPushCreate.defaultProps = {
|
|
|
1111
1118
|
forwardedTags: {},
|
|
1112
1119
|
selectedOfferDetails: [],
|
|
1113
1120
|
eventContextTags: [],
|
|
1121
|
+
waitEventContextTags: {},
|
|
1114
1122
|
templateActions: {},
|
|
1115
1123
|
Templates: {},
|
|
1116
1124
|
restrictPersonalization: false,
|
|
@@ -181,6 +181,7 @@ export const Whatsapp = (props) => {
|
|
|
181
181
|
getFormData,
|
|
182
182
|
selectedOfferDetails,
|
|
183
183
|
eventContextTags,
|
|
184
|
+
waitEventContextTags = {},
|
|
184
185
|
metaDataStatus = "",
|
|
185
186
|
showTestAndPreviewSlidebox: propsShowTestAndPreviewSlidebox,
|
|
186
187
|
handleTestAndPreview: propsHandleTestAndPreview,
|
|
@@ -933,6 +934,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
933
934
|
injectedTags={injectedTags || {}}
|
|
934
935
|
selectedOfferDetails={selectedOfferDetails}
|
|
935
936
|
eventContextTags={eventContextTags}
|
|
937
|
+
waitEventContextTags={waitEventContextTags}
|
|
936
938
|
/>
|
|
937
939
|
)}
|
|
938
940
|
</>
|
|
@@ -1934,6 +1936,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1934
1936
|
injectedTags={injectedTags || {}}
|
|
1935
1937
|
selectedOfferDetails={selectedOfferDetails}
|
|
1936
1938
|
eventContextTags={eventContextTags}
|
|
1939
|
+
waitEventContextTags={waitEventContextTags}
|
|
1937
1940
|
/>
|
|
1938
1941
|
)
|
|
1939
1942
|
: !isAuthenticationTemplate && (
|
|
@@ -2740,6 +2743,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2740
2743
|
injectedTags={injectedTags || {}}
|
|
2741
2744
|
selectedOfferDetails={selectedOfferDetails}
|
|
2742
2745
|
eventContextTags={eventContextTags}
|
|
2746
|
+
waitEventContextTags={waitEventContextTags}
|
|
2743
2747
|
/>
|
|
2744
2748
|
)
|
|
2745
2749
|
}
|
|
@@ -2858,6 +2862,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2858
2862
|
injectedTags={injectedTags || {}}
|
|
2859
2863
|
selectedOfferDetails={selectedOfferDetails}
|
|
2860
2864
|
eventContextTags={eventContextTags}
|
|
2865
|
+
waitEventContextTags={waitEventContextTags}
|
|
2861
2866
|
/>
|
|
2862
2867
|
)}
|
|
2863
2868
|
{isBtnTypeQuickReply && (
|