@capillarytech/creatives-library 7.17.22 → 7.17.24
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/containers/App/constants.js +4 -0
- package/package.json +1 -1
- package/utils/common.js +63 -0
- package/utils/commonUtils.js +6 -0
- package/utils/tests/common.test.js +81 -1
- package/v2Components/CapTagList/index.js +16 -5
- package/v2Containers/App/constants.js +1 -1
- package/v2Containers/Cap/constants.js +3 -3
- package/v2Containers/ChannelTemplates/actions.js +20 -0
- package/v2Containers/ChannelTemplates/constants.js +8 -0
- package/v2Containers/ChannelTemplates/index.js +47 -0
- package/v2Containers/ChannelTemplates/messages.js +13 -0
- package/v2Containers/ChannelTemplates/reducer.js +34 -0
- package/v2Containers/ChannelTemplates/sagas.js +32 -0
- package/v2Containers/ChannelTemplates/selectors.js +25 -0
- package/v2Containers/LanguageProvider/reducer.js +3 -1
- package/v2Containers/LanguageProvider/tests/reducer.test.js +9 -0
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +3 -3
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +120 -120
- package/v2Containers/Sms/Create/tests/sagas.test.js +82 -0
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +16 -16
- package/v2Containers/TagList/index.js +40 -22
- package/v2Containers/TagList/messages.js +2 -1
- package/v2Containers/TagList/tests/TagList.test.js +41 -0
- package/v2Containers/TagList/tests/mockdata.js +108 -0
- package/v2Containers/TemplatesV2/index.js +3 -3
- package/v2Containers/TemplatesV2/tests/mockData.js +2 -2
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +16 -16
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { expectSaga } from "redux-saga-test-plan";
|
|
2
|
+
import { take, cancel, takeLatest } from "redux-saga/effects";
|
|
3
|
+
import * as matchers from "redux-saga-test-plan/matchers";
|
|
4
|
+
import { LOCATION_CHANGE } from "react-router-redux";
|
|
5
|
+
import { throwError } from "redux-saga-test-plan/providers";
|
|
6
|
+
import { createMockTask } from "redux-saga/utils";
|
|
7
|
+
import * as types from "../constants";
|
|
8
|
+
import { watchAiSuggestions, getAiSuggestions } from "../sagas";
|
|
9
|
+
import * as Api from "../../../../services/api";
|
|
10
|
+
|
|
11
|
+
describe("getAiSuggestions saga", () => {
|
|
12
|
+
it("Should handle valid response from api", () => {
|
|
13
|
+
const successCallback = () => {};
|
|
14
|
+
const failureCallback = () => {};
|
|
15
|
+
const action = {
|
|
16
|
+
type: types.GET_AI_SUGGESTIONS,
|
|
17
|
+
prompt: {},
|
|
18
|
+
successCallback,
|
|
19
|
+
failureCallback,
|
|
20
|
+
};
|
|
21
|
+
expectSaga(getAiSuggestions, action)
|
|
22
|
+
.provide([
|
|
23
|
+
[
|
|
24
|
+
matchers.call.fn(Api.getAiSuggestions),
|
|
25
|
+
{
|
|
26
|
+
success: true,
|
|
27
|
+
status: {
|
|
28
|
+
isError: false,
|
|
29
|
+
code: 200,
|
|
30
|
+
message: "success",
|
|
31
|
+
},
|
|
32
|
+
message: "Meta data fetched successfully",
|
|
33
|
+
response: {
|
|
34
|
+
"https://response.com": 1400,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
[matchers.call.fn(successCallback)],
|
|
39
|
+
])
|
|
40
|
+
.run();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("Should handles error thrown from api", () => {
|
|
44
|
+
const successCallback = () => {};
|
|
45
|
+
const failureCallback = () => {};
|
|
46
|
+
const action = {
|
|
47
|
+
type: types.GET_AI_SUGGESTIONS,
|
|
48
|
+
prompt: {},
|
|
49
|
+
successCallback,
|
|
50
|
+
failureCallback,
|
|
51
|
+
};
|
|
52
|
+
expectSaga(getAiSuggestions, action)
|
|
53
|
+
.provide([[matchers.call.fn(Api.getAiSuggestions), throwError()]])
|
|
54
|
+
.run();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe("watchAiSuggestions saga", () => {
|
|
59
|
+
let generator = null;
|
|
60
|
+
beforeEach(() => {
|
|
61
|
+
generator = watchAiSuggestions();
|
|
62
|
+
});
|
|
63
|
+
it("Should handle valid response from api", () => {
|
|
64
|
+
const progress1 = generator.next();
|
|
65
|
+
const mockTask = takeLatest(types.GET_AI_SUGGESTIONS, getAiSuggestions);
|
|
66
|
+
expect(progress1.value).toEqual(mockTask);
|
|
67
|
+
const progress2 = generator.next();
|
|
68
|
+
expect(progress2.value).toEqual(take(LOCATION_CHANGE));
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("Should handle LOCATION_CHANGE action and cancel the watcher", () => {
|
|
72
|
+
generator = watchAiSuggestions();
|
|
73
|
+
const mockTask = createMockTask();
|
|
74
|
+
|
|
75
|
+
expect(generator.next().value).toEqual(
|
|
76
|
+
takeLatest(types.GET_AI_SUGGESTIONS, getAiSuggestions)
|
|
77
|
+
);
|
|
78
|
+
expect(generator.next(mockTask).value).toEqual(take(LOCATION_CHANGE));
|
|
79
|
+
expect(generator.next().value).toEqual(cancel(mockTask));
|
|
80
|
+
expect(generator.next().done).toEqual(true);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -3134,7 +3134,7 @@ FREE GIFTS-
|
|
|
3134
3134
|
key=".0"
|
|
3135
3135
|
size="regular"
|
|
3136
3136
|
suffix={
|
|
3137
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
3137
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
3138
3138
|
hidePopover={false}
|
|
3139
3139
|
injectedTags={Object {}}
|
|
3140
3140
|
location={
|
|
@@ -3173,7 +3173,7 @@ FREE GIFTS-
|
|
|
3173
3173
|
/>
|
|
3174
3174
|
</CapHeading>
|
|
3175
3175
|
</div>
|
|
3176
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
3176
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
3177
3177
|
hidePopover={false}
|
|
3178
3178
|
injectedTags={Object {}}
|
|
3179
3179
|
location={
|
|
@@ -3190,7 +3190,7 @@ FREE GIFTS-
|
|
|
3190
3190
|
onTagSelect={[Function]}
|
|
3191
3191
|
tags={Array []}
|
|
3192
3192
|
>
|
|
3193
|
-
<UserIsAuthenticated(Connect(TagList))
|
|
3193
|
+
<UserIsAuthenticated(Connect(InjectIntl(TagList)))
|
|
3194
3194
|
authData={
|
|
3195
3195
|
Object {
|
|
3196
3196
|
"app": Object {},
|
|
@@ -3233,7 +3233,7 @@ FREE GIFTS-
|
|
|
3233
3233
|
redirect={[Function]}
|
|
3234
3234
|
tags={Array []}
|
|
3235
3235
|
/>
|
|
3236
|
-
</Connect(UserIsAuthenticated(Connect(TagList)))>
|
|
3236
|
+
</Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
|
|
3237
3237
|
</div>
|
|
3238
3238
|
</CapHeader__Flex>
|
|
3239
3239
|
</CapHeader>
|
|
@@ -10463,7 +10463,7 @@ FREE GIFTS-
|
|
|
10463
10463
|
key=".0"
|
|
10464
10464
|
size="regular"
|
|
10465
10465
|
suffix={
|
|
10466
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
10466
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
10467
10467
|
hidePopover={false}
|
|
10468
10468
|
injectedTags={Object {}}
|
|
10469
10469
|
location={
|
|
@@ -10502,7 +10502,7 @@ FREE GIFTS-
|
|
|
10502
10502
|
/>
|
|
10503
10503
|
</CapHeading>
|
|
10504
10504
|
</div>
|
|
10505
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
10505
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
10506
10506
|
hidePopover={false}
|
|
10507
10507
|
injectedTags={Object {}}
|
|
10508
10508
|
location={
|
|
@@ -10519,7 +10519,7 @@ FREE GIFTS-
|
|
|
10519
10519
|
onTagSelect={[Function]}
|
|
10520
10520
|
tags={Array []}
|
|
10521
10521
|
>
|
|
10522
|
-
<UserIsAuthenticated(Connect(TagList))
|
|
10522
|
+
<UserIsAuthenticated(Connect(InjectIntl(TagList)))
|
|
10523
10523
|
authData={
|
|
10524
10524
|
Object {
|
|
10525
10525
|
"app": Object {},
|
|
@@ -10562,7 +10562,7 @@ FREE GIFTS-
|
|
|
10562
10562
|
redirect={[Function]}
|
|
10563
10563
|
tags={Array []}
|
|
10564
10564
|
/>
|
|
10565
|
-
</Connect(UserIsAuthenticated(Connect(TagList)))>
|
|
10565
|
+
</Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
|
|
10566
10566
|
</div>
|
|
10567
10567
|
</CapHeader__Flex>
|
|
10568
10568
|
</CapHeader>
|
|
@@ -18212,7 +18212,7 @@ FREE GIFTS-
|
|
|
18212
18212
|
key=".0"
|
|
18213
18213
|
size="regular"
|
|
18214
18214
|
suffix={
|
|
18215
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
18215
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
18216
18216
|
hidePopover={false}
|
|
18217
18217
|
injectedTags={Object {}}
|
|
18218
18218
|
location={
|
|
@@ -18251,7 +18251,7 @@ FREE GIFTS-
|
|
|
18251
18251
|
/>
|
|
18252
18252
|
</CapHeading>
|
|
18253
18253
|
</div>
|
|
18254
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
18254
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
18255
18255
|
hidePopover={false}
|
|
18256
18256
|
injectedTags={Object {}}
|
|
18257
18257
|
location={
|
|
@@ -18268,7 +18268,7 @@ FREE GIFTS-
|
|
|
18268
18268
|
onTagSelect={[Function]}
|
|
18269
18269
|
tags={Array []}
|
|
18270
18270
|
>
|
|
18271
|
-
<UserIsAuthenticated(Connect(TagList))
|
|
18271
|
+
<UserIsAuthenticated(Connect(InjectIntl(TagList)))
|
|
18272
18272
|
authData={
|
|
18273
18273
|
Object {
|
|
18274
18274
|
"app": Object {},
|
|
@@ -18311,7 +18311,7 @@ FREE GIFTS-
|
|
|
18311
18311
|
redirect={[Function]}
|
|
18312
18312
|
tags={Array []}
|
|
18313
18313
|
/>
|
|
18314
|
-
</Connect(UserIsAuthenticated(Connect(TagList)))>
|
|
18314
|
+
</Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
|
|
18315
18315
|
</div>
|
|
18316
18316
|
</CapHeader__Flex>
|
|
18317
18317
|
</CapHeader>
|
|
@@ -26070,7 +26070,7 @@ FREE GIFTS-
|
|
|
26070
26070
|
key=".0"
|
|
26071
26071
|
size="regular"
|
|
26072
26072
|
suffix={
|
|
26073
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
26073
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
26074
26074
|
hidePopover={false}
|
|
26075
26075
|
injectedTags={Object {}}
|
|
26076
26076
|
location={
|
|
@@ -26109,7 +26109,7 @@ FREE GIFTS-
|
|
|
26109
26109
|
/>
|
|
26110
26110
|
</CapHeading>
|
|
26111
26111
|
</div>
|
|
26112
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
26112
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
26113
26113
|
hidePopover={false}
|
|
26114
26114
|
injectedTags={Object {}}
|
|
26115
26115
|
location={
|
|
@@ -26126,7 +26126,7 @@ FREE GIFTS-
|
|
|
26126
26126
|
onTagSelect={[Function]}
|
|
26127
26127
|
tags={Array []}
|
|
26128
26128
|
>
|
|
26129
|
-
<UserIsAuthenticated(Connect(TagList))
|
|
26129
|
+
<UserIsAuthenticated(Connect(InjectIntl(TagList)))
|
|
26130
26130
|
authData={
|
|
26131
26131
|
Object {
|
|
26132
26132
|
"app": Object {},
|
|
@@ -26169,7 +26169,7 @@ FREE GIFTS-
|
|
|
26169
26169
|
redirect={[Function]}
|
|
26170
26170
|
tags={Array []}
|
|
26171
26171
|
/>
|
|
26172
|
-
</Connect(UserIsAuthenticated(Connect(TagList)))>
|
|
26172
|
+
</Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
|
|
26173
26173
|
</div>
|
|
26174
26174
|
</CapHeader__Flex>
|
|
26175
26175
|
</CapHeader>
|
|
@@ -21,12 +21,16 @@ import CapTagList from '../../v2Components/CapTagList';
|
|
|
21
21
|
import './_tagList.scss';
|
|
22
22
|
import { selectCurrentOrgDetails } from '../Cap/selectors';
|
|
23
23
|
const TreeNode = Tree.TreeNode;
|
|
24
|
+
import { injectIntl } from 'react-intl';
|
|
25
|
+
import { scope } from './messages';
|
|
26
|
+
import { handleInjectedData } from '../../utils/common';
|
|
24
27
|
|
|
25
28
|
export class TagList extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
26
29
|
constructor(props) {
|
|
27
30
|
super(props);
|
|
28
31
|
this.state = {
|
|
29
32
|
loading: false,
|
|
33
|
+
tags: []
|
|
30
34
|
};
|
|
31
35
|
this.renderTags = this.renderTags.bind(this);
|
|
32
36
|
this.populateTags = this.populateTags.bind(this);
|
|
@@ -39,6 +43,34 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
39
43
|
|
|
40
44
|
}
|
|
41
45
|
|
|
46
|
+
componentDidUpdate(prevProps) {
|
|
47
|
+
if (this.props.tags !== prevProps.tags || this.props.injectedTags !== prevProps.injectedTags || this.props.selectedOfferDetails !== prevProps.selectedOfferDetails) {
|
|
48
|
+
this.setState({
|
|
49
|
+
tags: this.generateTags(this.props),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
generateTags(props) {
|
|
55
|
+
let tags = {};
|
|
56
|
+
let injectedTags = {};
|
|
57
|
+
if (props.injectedTags && !_.isEmpty(props.injectedTags)) {
|
|
58
|
+
const formattedInjectedTags = handleInjectedData(
|
|
59
|
+
props.injectedTags,
|
|
60
|
+
scope
|
|
61
|
+
);
|
|
62
|
+
injectedTags = this.transformInjectedTags(formattedInjectedTags);
|
|
63
|
+
}
|
|
64
|
+
if (props.tags && props.tags.length > 0) {
|
|
65
|
+
tags = this.populateTags(props.tags);
|
|
66
|
+
console.log('populating tags', Object.keys(tags || {}).length);
|
|
67
|
+
}
|
|
68
|
+
if (props.selectedOfferDetails && !_.isEmpty(props.selectedOfferDetails) && (tags && tags.coupon)) {
|
|
69
|
+
this.transformCouponTags(props.selectedOfferDetails, tags);
|
|
70
|
+
}
|
|
71
|
+
return _.merge( {}, tags, injectedTags);
|
|
72
|
+
}
|
|
73
|
+
|
|
42
74
|
componentWillReceiveProps(nextProps) {
|
|
43
75
|
if (_.isEmpty(this.props.injectedTags) && _.isEmpty(this.props.tags)) {
|
|
44
76
|
this.setState({loading: true});
|
|
@@ -51,6 +83,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
51
83
|
|
|
52
84
|
this.setState({loading: false});
|
|
53
85
|
}
|
|
86
|
+
|
|
54
87
|
}
|
|
55
88
|
|
|
56
89
|
onSelect = (selectedKeys) => {
|
|
@@ -73,11 +106,11 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
73
106
|
//Form tags object with tag headers
|
|
74
107
|
_.forEach(tagsList, (temp) => {
|
|
75
108
|
const tag = temp.definition;
|
|
76
|
-
const { userLocale } = this.props;
|
|
109
|
+
const { locale : userLocale } = this.props.intl;
|
|
77
110
|
if (!tag['tag-header']) {
|
|
78
111
|
mainTags[tag.value] = {
|
|
79
|
-
name: tag
|
|
80
|
-
desc: tag
|
|
112
|
+
"name": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
|
|
113
|
+
"desc": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
|
|
81
114
|
};
|
|
82
115
|
} else if (tag['tag-header'] && mainTags[tag.value]) {
|
|
83
116
|
mainTags[tag.value].subtags = _.concat(mainTags[tag.value].subtags, tag.subtags);
|
|
@@ -85,8 +118,8 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
85
118
|
//
|
|
86
119
|
mainTags[tag.value] = {
|
|
87
120
|
'tag-header': true,
|
|
88
|
-
"name": tag
|
|
89
|
-
"desc": tag
|
|
121
|
+
"name": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
|
|
122
|
+
"desc": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
|
|
90
123
|
"subtags": tag.subtags,
|
|
91
124
|
};
|
|
92
125
|
}
|
|
@@ -222,26 +255,11 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
222
255
|
}
|
|
223
256
|
|
|
224
257
|
render() {
|
|
225
|
-
let tags = {};
|
|
226
|
-
let injectedTags = {};
|
|
227
|
-
if (this.props.injectedTags && !_.isEmpty(this.props.injectedTags)) {
|
|
228
|
-
injectedTags = this.transformInjectedTags(this.props.injectedTags);
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
if (this.props.tags && this.props.tags.length > 0) {
|
|
232
|
-
tags = this.populateTags(this.props.tags);
|
|
233
|
-
console.log('populating tags', Object.keys(tags || {}).length);
|
|
234
|
-
}
|
|
235
|
-
if (this.props.selectedOfferDetails && !_.isEmpty(this.props.selectedOfferDetails) && (tags && tags.coupon)) {
|
|
236
|
-
this.transformCouponTags(this.props.selectedOfferDetails, tags);
|
|
237
|
-
}
|
|
238
|
-
tags = _.merge( {}, tags, injectedTags);
|
|
239
|
-
console.log('merged tags', Object.keys(tags || {}).length);
|
|
240
258
|
return (
|
|
241
259
|
<div className={this.props.className ? this.props.className : ''}>
|
|
242
260
|
<CapTagList
|
|
243
261
|
loading={this.state.loading}
|
|
244
|
-
tags={tags}
|
|
262
|
+
tags={this.state.tags}
|
|
245
263
|
onSelect={this.onSelect}
|
|
246
264
|
label={this.props.label}
|
|
247
265
|
visibleTaglist={this.props.visibleTaglist}
|
|
@@ -291,4 +309,4 @@ function mapDispatchToProps(dispatch) {
|
|
|
291
309
|
};
|
|
292
310
|
}
|
|
293
311
|
|
|
294
|
-
export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(TagList));
|
|
312
|
+
export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(TagList)));
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* This contains all the text for the TagList component.
|
|
5
5
|
*/
|
|
6
6
|
import { defineMessages } from 'react-intl';
|
|
7
|
+
export const scope = `creatives.containersV2.TagList`;
|
|
7
8
|
|
|
8
9
|
export default defineMessages({
|
|
9
10
|
header: {
|
|
10
|
-
id:
|
|
11
|
+
id: `${scope}.header`,
|
|
11
12
|
defaultMessage: 'This is TagList container !',
|
|
12
13
|
},
|
|
13
14
|
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import "@testing-library/jest-dom";
|
|
3
|
+
import configureStore from "../../../store";
|
|
4
|
+
import { injectIntl } from "react-intl";
|
|
5
|
+
import { fireEvent } from "@testing-library/react";
|
|
6
|
+
import { TagList } from '../index';
|
|
7
|
+
import { TagListData } from './mockdata';
|
|
8
|
+
import { Provider } from 'react-redux';
|
|
9
|
+
import { screen, render } from '../../../utils/test-utils';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const initializeTagList = (props) => {
|
|
13
|
+
const store = configureStore({}, null);
|
|
14
|
+
const Component = injectIntl(TagList);
|
|
15
|
+
|
|
16
|
+
const propsObj = {
|
|
17
|
+
...TagListData,
|
|
18
|
+
onTagSelect: jest.fn(),
|
|
19
|
+
...props,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return render(
|
|
23
|
+
<Provider store={store}>
|
|
24
|
+
<Component {...propsObj} />
|
|
25
|
+
</Provider>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
describe("TagList test : UNIT", () => {
|
|
31
|
+
it("should render the TagList component with default props amd addLabel Button", async () => {
|
|
32
|
+
initializeTagList();
|
|
33
|
+
|
|
34
|
+
const addLabelButton = screen.getByRole('button', {
|
|
35
|
+
name: /add label/i
|
|
36
|
+
})
|
|
37
|
+
expect(addLabelButton).toBeInTheDocument();
|
|
38
|
+
|
|
39
|
+
fireEvent.click(addLabelButton);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export const TagListData = {
|
|
2
|
+
tags : [
|
|
3
|
+
{
|
|
4
|
+
"_id": "5a291cdd85c3db29a2041e5a",
|
|
5
|
+
"type": "TAG",
|
|
6
|
+
"definition": {
|
|
7
|
+
"label": {
|
|
8
|
+
"en": "Optout",
|
|
9
|
+
"ja-JP": "撤回"
|
|
10
|
+
},
|
|
11
|
+
"value": "optout",
|
|
12
|
+
"subtags": [],
|
|
13
|
+
"tag-header": false,
|
|
14
|
+
"supportedModules": [
|
|
15
|
+
{
|
|
16
|
+
"context": "journey",
|
|
17
|
+
"layout": "sms",
|
|
18
|
+
"mandatory": false
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"context": "outbound",
|
|
22
|
+
"layout": "sms",
|
|
23
|
+
"mandatory": false
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"context": "default",
|
|
27
|
+
"layout": "sms",
|
|
28
|
+
"mandatory": false
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"context": "coupon_expiry",
|
|
32
|
+
"layout": "sms",
|
|
33
|
+
"mandatory": false
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"context": "coupons",
|
|
37
|
+
"layout": "sms",
|
|
38
|
+
"mandatory": false
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"scope": {
|
|
43
|
+
"tag": "STANDARD",
|
|
44
|
+
"orgId": -1,
|
|
45
|
+
"verticals": []
|
|
46
|
+
},
|
|
47
|
+
"isActive": true,
|
|
48
|
+
"createdBy": 4,
|
|
49
|
+
"updatedBy": 15000449,
|
|
50
|
+
"createdAt": "2017-12-07T10:50:05.800Z",
|
|
51
|
+
"updatedAt": "2018-01-22T11:43:05.611Z"
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
injectedTags : {
|
|
55
|
+
"dummys": {
|
|
56
|
+
"name": "dummys",
|
|
57
|
+
"subtags": {
|
|
58
|
+
"custom_field.age_group": {
|
|
59
|
+
"name": "age_group",
|
|
60
|
+
"desc": "age_group"
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
"tag-header": true
|
|
64
|
+
},
|
|
65
|
+
"Registration custom fields": {
|
|
66
|
+
"name": "Registration custom fields",
|
|
67
|
+
"subtags": {
|
|
68
|
+
"custom_field.age_group": {
|
|
69
|
+
"name": "age_group",
|
|
70
|
+
"desc": "age_group"
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
"tag-header": true
|
|
74
|
+
},
|
|
75
|
+
"Customer extended fields": {
|
|
76
|
+
"name": "Customer extended fields",
|
|
77
|
+
"subtags": {
|
|
78
|
+
"extended_field.gender": {
|
|
79
|
+
"name": "gender",
|
|
80
|
+
"desc": "Gender"
|
|
81
|
+
},
|
|
82
|
+
"extended_field.marital_status": {
|
|
83
|
+
"name": "marital_status",
|
|
84
|
+
"desc": "Marital Status",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
"tag-header": true
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"authData": {},
|
|
91
|
+
"moduleFilterEnabled": true,
|
|
92
|
+
"label": "Add label",
|
|
93
|
+
"location": {
|
|
94
|
+
"pathname": "/sms/edit",
|
|
95
|
+
"query": {
|
|
96
|
+
"type": false,
|
|
97
|
+
"module": "default"
|
|
98
|
+
},
|
|
99
|
+
"search": ""
|
|
100
|
+
},
|
|
101
|
+
"className": "add-label",
|
|
102
|
+
"id": "tagList",
|
|
103
|
+
"userLocale": "en",
|
|
104
|
+
"TagList": {},
|
|
105
|
+
"actions": {},
|
|
106
|
+
"globalActions": {},
|
|
107
|
+
"isNewVersionFlow": false,
|
|
108
|
+
}
|
|
@@ -29,7 +29,7 @@ import FTP from '../FTP';
|
|
|
29
29
|
import Gallery from '../Assets/Gallery';
|
|
30
30
|
import withStyles from '../../hoc/withStyles';
|
|
31
31
|
import styles, { CapTabStyle } from './TemplatesV2.style';
|
|
32
|
-
import { CREATIVES_UI_VIEW, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS,
|
|
32
|
+
import { CREATIVES_UI_VIEW, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, HIDE_ENGAGEMENT_CHANNELS } from '../App/constants';
|
|
33
33
|
import AccessForbidden from '../../v2Components/AccessForbidden';
|
|
34
34
|
import { getObjFromQueryParams } from '../../utils/v2common';
|
|
35
35
|
import { selectCurrentOrgDetails } from "../../v2Containers/Cap/selectors";
|
|
@@ -119,8 +119,8 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
119
119
|
const { accessibleFeatures = [] } = currentOrgDetails || {};
|
|
120
120
|
// This data will be available when it will be accessed in library mode
|
|
121
121
|
const { currentOrgDetails: { accessibleFeatures: libModeAccessibleFeatures = [] } = {} } = cap || {};
|
|
122
|
-
const hideEngagementChannel = accessibleFeatures.includes(
|
|
123
|
-
// Show only line and email channel content with both channel tabs if the
|
|
122
|
+
const hideEngagementChannel = accessibleFeatures.includes(HIDE_ENGAGEMENT_CHANNELS) || libModeAccessibleFeatures.includes(HIDE_ENGAGEMENT_CHANNELS);
|
|
123
|
+
// Show only line and email channel content with both channel tabs if the HIDE_ENGAGEMENT_CHANNELS feature is enabled;
|
|
124
124
|
filteredPanes = hideEngagementChannel ? filteredPanes?.filter((pane) => [EMAIL, LINE, ASSETS].includes(pane?.key) && pane) : filteredPanes;
|
|
125
125
|
defaultChannel = hideEngagementChannel ? EMAIL : defaultChannel;
|
|
126
126
|
|
|
@@ -599,7 +599,7 @@ export const authData = {
|
|
|
599
599
|
"ENABLE_PRODUCT_SUPPORT_VIDEOS",
|
|
600
600
|
"ENABLE_RANDOM_COUPON_CODE",
|
|
601
601
|
"HIDE_DEFAULT_EMAIL_TEMPLATES",
|
|
602
|
-
"
|
|
602
|
+
"HIDE_ENGAGEMENT_CHANNELS",
|
|
603
603
|
],
|
|
604
604
|
org_loyalty_v2_status: true,
|
|
605
605
|
module_details: [
|
|
@@ -680,6 +680,6 @@ export const currentOrgDetails = {
|
|
|
680
680
|
"JOURNEY_UI",
|
|
681
681
|
"LOYALTY_PROMOTION_ENABLED",
|
|
682
682
|
"HIDE_DEFAULT_EMAIL_TEMPLATES",
|
|
683
|
-
"
|
|
683
|
+
"HIDE_ENGAGEMENT_CHANNELS",
|
|
684
684
|
],
|
|
685
685
|
};
|