@capillarytech/creatives-library 8.0.26 → 8.0.28
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/Cap/tests/selectors.test.js +28 -0
- package/containers/TagList/constants.js +2 -0
- package/containers/TestPage/constants.js +7 -0
- package/containers/TestPage/index.js +31 -0
- package/containers/TestPage/messages.js +13 -0
- package/containers/TestPage/reducer.js +21 -0
- package/containers/TestPage/sagas.js +11 -0
- package/containers/Testv2/actions.js +15 -0
- package/containers/Testv2/constants.js +7 -0
- package/containers/Testv2/index.js +47 -0
- package/containers/Testv2/messages.js +21 -0
- package/containers/Testv2/reducer.js +23 -0
- package/containers/Testv2/sagas.js +11 -0
- package/containers/Testv2/selectors.js +25 -0
- package/package.json +1 -1
- package/reducers.js +77 -0
- package/store.js +61 -0
- package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +20 -15
- package/tests/integration/TemplateCreation/api-response.js +18748 -0
- package/tests/integration/TemplateCreation/msw-handler.js +27 -2
- package/utils/tests/asyncInjectors.test.js +173 -0
- package/v2Components/CapTagList/index.js +116 -30
- package/v2Containers/Cap/index.js +0 -5
- package/v2Containers/Cap/tests/Cap.test.js +4 -8
- package/v2Containers/CreativesContainer/index.js +1 -1
- package/v2Containers/MobilePush/Edit/index.js +7 -8
- package/v2Containers/TemplatesV2/index.js +4 -4
- package/v2Containers/TestPage/constants.js +7 -0
- package/v2Containers/TestPage/index.js +31 -0
- package/v2Containers/TestPage/messages.js +13 -0
- package/v2Containers/TestPage/reducer.js +21 -0
- package/v2Containers/TestPage/sagas.js +11 -0
- package/v2Containers/Testv2/actions.js +15 -0
- package/v2Containers/Testv2/constants.js +7 -0
- package/v2Containers/Testv2/index.js +47 -0
- package/v2Containers/Testv2/messages.js +21 -0
- package/v2Containers/Testv2/reducer.js +23 -0
- package/v2Containers/Testv2/sagas.js +11 -0
- package/v2Containers/Testv2/selectors.js +25 -0
|
@@ -6,6 +6,7 @@ import * as apiResponse from './api-response';
|
|
|
6
6
|
import config from '../../../config/app';
|
|
7
7
|
const API_ENDPOINT = config.development.api_endpoint;
|
|
8
8
|
const AUTH_ENDPOINT = config.development.auth_endpoint;
|
|
9
|
+
const CAMPAIGNS_API_ENDPOINT = config.development.campaigns_api_org_endpoint;
|
|
9
10
|
|
|
10
11
|
export const server = setupServer(
|
|
11
12
|
rest.options('*', (req, res, ctx) =>
|
|
@@ -26,23 +27,47 @@ export const server = setupServer(
|
|
|
26
27
|
}
|
|
27
28
|
}),
|
|
28
29
|
|
|
29
|
-
rest.get(`${AUTH_ENDPOINT}/
|
|
30
|
+
rest.get(`${AUTH_ENDPOINT}/user`, (req, res, ctx) =>
|
|
30
31
|
res(ctx.status(200), ctx.json(apiResponse.authUserReonData)),
|
|
31
32
|
),
|
|
32
33
|
|
|
33
|
-
rest.get(`${AUTH_ENDPOINT}/
|
|
34
|
+
rest.get(`${AUTH_ENDPOINT}/org/users`, (req, res, ctx) =>
|
|
34
35
|
res(ctx.status(200), ctx.json(apiResponse.authOrgUsersReonData)),
|
|
35
36
|
),
|
|
36
37
|
rest.get(`${API_ENDPOINT}/templates/Sms`, (req, res, ctx) =>
|
|
37
38
|
res(ctx.status(200), ctx.json(apiResponse.smsTemplates)),
|
|
38
39
|
),
|
|
40
|
+
rest.get(`${API_ENDPOINT}/templates/v1/Sms`, (req, res, ctx) =>
|
|
41
|
+
res(ctx.status(200), ctx.json(apiResponse.smsTemplates)),
|
|
42
|
+
),
|
|
39
43
|
rest.get(`${API_ENDPOINT}/templates/Rcs`, (req, res, ctx) =>
|
|
40
44
|
res(ctx.status(200), ctx.json(apiResponse.rcsTemplates)),
|
|
41
45
|
),
|
|
46
|
+
rest.get(`${API_ENDPOINT}/templates/v1/Rcs`, (req, res, ctx) =>
|
|
47
|
+
res(ctx.status(200), ctx.json(apiResponse.rcsTemplates)),
|
|
48
|
+
),
|
|
42
49
|
rest.get(`${API_ENDPOINT}/meta/wecrm`, (req, res, ctx) =>
|
|
43
50
|
res(ctx.status(200), ctx.json(apiResponse.viberAccount)),
|
|
44
51
|
),
|
|
52
|
+
rest.get(`${API_ENDPOINT}/meta/wecrm`, (req, res, ctx) =>
|
|
53
|
+
res(ctx.status(200), ctx.json(apiResponse.whatsappAccount)),
|
|
54
|
+
),
|
|
55
|
+
rest.get(`${API_ENDPOINT}/meta/wecrm`, (req, res, ctx) =>
|
|
56
|
+
res(ctx.status(200), ctx.json(apiResponse.mpushAccount)),
|
|
57
|
+
),
|
|
45
58
|
rest.get(`${API_ENDPOINT}/assets/image`, (req, res, ctx) =>
|
|
46
59
|
res(ctx.status(200), ctx.json(apiResponse.gallery)),
|
|
47
60
|
),
|
|
61
|
+
rest.get(`${API_ENDPOINT}/templates/v1/Line`, (req, res, ctx) =>
|
|
62
|
+
res(ctx.status(200), ctx.json(apiResponse.lineTemplates)),
|
|
63
|
+
),
|
|
64
|
+
rest.get(`${API_ENDPOINT}/templates/v1/Email`, (req, res, ctx) =>
|
|
65
|
+
res(ctx.status(200), ctx.json(apiResponse.emailTemplates)),
|
|
66
|
+
),
|
|
67
|
+
rest.get(`${API_ENDPOINT}/meta/TAG`, (req, res, ctx) =>
|
|
68
|
+
res(ctx.status(200), ctx.json(apiResponse.tag)),
|
|
69
|
+
),
|
|
70
|
+
rest.get(`${CAMPAIGNS_API_ENDPOINT}/meta/domainProperties`, (req, res, ctx) =>
|
|
71
|
+
res(ctx.status(200), ctx.json(apiResponse.domainProperties)),
|
|
72
|
+
),
|
|
48
73
|
);
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test async injectors
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { memoryHistory } from 'react-router';
|
|
6
|
+
import { put } from 'redux-saga/effects';
|
|
7
|
+
import { fromJS } from 'immutable';
|
|
8
|
+
|
|
9
|
+
import configureStore from 'store';
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
injectAsyncReducer,
|
|
13
|
+
injectAsyncSagas,
|
|
14
|
+
getAsyncInjectors,
|
|
15
|
+
} from '../asyncInjectors';
|
|
16
|
+
|
|
17
|
+
// Fixtures
|
|
18
|
+
|
|
19
|
+
const initialState = fromJS({ reduced: 'soon' });
|
|
20
|
+
|
|
21
|
+
const reducer = (state = initialState, action) => {
|
|
22
|
+
switch (action.type) {
|
|
23
|
+
case 'TEST':
|
|
24
|
+
return state.set('reduced', action.payload);
|
|
25
|
+
default:
|
|
26
|
+
return state;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function* testSaga() {
|
|
31
|
+
yield put({ type: 'TEST', payload: 'yup' });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const sagas = [
|
|
35
|
+
testSaga,
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
describe('asyncInjectors', () => {
|
|
39
|
+
let store;
|
|
40
|
+
|
|
41
|
+
describe('getAsyncInjectors', () => {
|
|
42
|
+
beforeAll(() => {
|
|
43
|
+
store = configureStore({}, memoryHistory);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('given a store, should return all async injectors', () => {
|
|
47
|
+
const { injectReducer, injectSagas } = getAsyncInjectors(store);
|
|
48
|
+
|
|
49
|
+
injectReducer('test', reducer);
|
|
50
|
+
injectSagas(sagas);
|
|
51
|
+
|
|
52
|
+
const actual = store.getState().get('test');
|
|
53
|
+
const expected = initialState.merge({ reduced: 'yup' });
|
|
54
|
+
|
|
55
|
+
expect(actual.toJS()).toEqual(expected.toJS());
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should throw if passed invalid store shape', () => {
|
|
59
|
+
let result = false;
|
|
60
|
+
|
|
61
|
+
Reflect.deleteProperty(store, 'dispatch');
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
getAsyncInjectors(store);
|
|
65
|
+
} catch (err) {
|
|
66
|
+
result = err.name === 'Invariant Violation';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
expect(result).toEqual(true);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe('helpers', () => {
|
|
74
|
+
beforeAll(() => {
|
|
75
|
+
store = configureStore({}, memoryHistory);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe('injectAsyncReducer', () => {
|
|
79
|
+
it('given a store, it should provide a function to inject a reducer', () => {
|
|
80
|
+
const injectReducer = injectAsyncReducer(store);
|
|
81
|
+
|
|
82
|
+
injectReducer('test', reducer);
|
|
83
|
+
|
|
84
|
+
const actual = store.getState().get('test');
|
|
85
|
+
const expected = initialState;
|
|
86
|
+
|
|
87
|
+
expect(actual.toJS()).toEqual(expected.toJS());
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('should not assign reducer if already existing', () => {
|
|
91
|
+
const injectReducer = injectAsyncReducer(store);
|
|
92
|
+
|
|
93
|
+
injectReducer('test', reducer);
|
|
94
|
+
injectReducer('test', () => {});
|
|
95
|
+
|
|
96
|
+
expect(store.asyncReducers.test.toString()).toEqual(reducer.toString());
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should throw if passed invalid name', () => {
|
|
100
|
+
let result = false;
|
|
101
|
+
|
|
102
|
+
const injectReducer = injectAsyncReducer(store);
|
|
103
|
+
|
|
104
|
+
try {
|
|
105
|
+
injectReducer('', reducer);
|
|
106
|
+
} catch (err) {
|
|
107
|
+
result = err.name === 'Invariant Violation';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
injectReducer(999, reducer);
|
|
112
|
+
} catch (err) {
|
|
113
|
+
result = err.name === 'Invariant Violation';
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
expect(result).toEqual(true);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('should throw if passed invalid reducer', () => {
|
|
120
|
+
let result = false;
|
|
121
|
+
|
|
122
|
+
const injectReducer = injectAsyncReducer(store);
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
injectReducer('bad', 'nope');
|
|
126
|
+
} catch (err) {
|
|
127
|
+
result = err.name === 'Invariant Violation';
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
try {
|
|
131
|
+
injectReducer('coolio', 12345);
|
|
132
|
+
} catch (err) {
|
|
133
|
+
result = err.name === 'Invariant Violation';
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
expect(result).toEqual(true);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
describe('injectAsyncSagas', () => {
|
|
141
|
+
it('given a store, it should provide a function to inject a saga', () => {
|
|
142
|
+
const injectSagas = injectAsyncSagas(store);
|
|
143
|
+
|
|
144
|
+
injectSagas(sagas);
|
|
145
|
+
|
|
146
|
+
const actual = store.getState().get('test');
|
|
147
|
+
const expected = initialState.merge({ reduced: 'yup' });
|
|
148
|
+
|
|
149
|
+
expect(actual.toJS()).toEqual(expected.toJS());
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('should throw if passed invalid saga', () => {
|
|
153
|
+
let result = false;
|
|
154
|
+
|
|
155
|
+
const injectSagas = injectAsyncSagas(store);
|
|
156
|
+
|
|
157
|
+
try {
|
|
158
|
+
injectSagas({ testSaga });
|
|
159
|
+
} catch (err) {
|
|
160
|
+
result = err.name === 'Invariant Violation';
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
try {
|
|
164
|
+
injectSagas(testSaga);
|
|
165
|
+
} catch (err) {
|
|
166
|
+
result = err.name === 'Invariant Violation';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
expect(result).toEqual(true);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
});
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
GET_TRANSLATION_MAPPED,
|
|
38
38
|
JAPANESE_HELP_TEXT,
|
|
39
39
|
TAG_TRANSLATION_DOC,
|
|
40
|
+
STRING,
|
|
40
41
|
} from "../../containers/TagList/constants";
|
|
41
42
|
import { EMAIL, JP_LOCALE_HIDE_FEATURE } from '../../v2Containers/App/constants';
|
|
42
43
|
import { hidingDateTagsForJpLocale } from '../../v2Containers/TagList/utils';
|
|
@@ -106,13 +107,27 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
106
107
|
getSearchedExpandedKeys(tags, value = '') {
|
|
107
108
|
let list = [];
|
|
108
109
|
_.forEach(tags, (val = {}, key) => {
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
const tagName =
|
|
111
|
+
typeof val?.name === STRING
|
|
112
|
+
? _.toLower(_.get(val, "name", ""))
|
|
113
|
+
: _.toLower(_.get(val, "name.props.defaultMessage", ""));
|
|
114
|
+
const tagNameWithoutUnderscore = tagName.replace(/_/g, " ");
|
|
115
|
+
const searchStringLower = _.toLower(value);
|
|
116
|
+
if (_.has(val, "subtags")) {
|
|
117
|
+
if (
|
|
118
|
+
val?.name &&
|
|
119
|
+
(tagName.includes(searchStringLower) ||
|
|
120
|
+
tagNameWithoutUnderscore.includes(searchStringLower))
|
|
121
|
+
) {
|
|
111
122
|
list.push(key);
|
|
112
123
|
}
|
|
113
|
-
const temp = this.getSearchedExpandedKeys(val
|
|
124
|
+
const temp = this.getSearchedExpandedKeys(val?.subtags, value);
|
|
114
125
|
list = list.concat(temp);
|
|
115
|
-
} else if (
|
|
126
|
+
} else if (
|
|
127
|
+
val?.name &&
|
|
128
|
+
(tagName.includes(searchStringLower) ||
|
|
129
|
+
tagNameWithoutUnderscore.includes(searchStringLower))
|
|
130
|
+
) {
|
|
116
131
|
list.push(key);
|
|
117
132
|
}
|
|
118
133
|
});
|
|
@@ -185,7 +200,8 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
185
200
|
this.setState({showModal: true, visible: false});
|
|
186
201
|
};
|
|
187
202
|
|
|
188
|
-
renderTags(tags
|
|
203
|
+
renderTags(tags) {
|
|
204
|
+
const searchString = this.state.searchValue || '';
|
|
189
205
|
const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags } = this?.props?.disableTagsDetails;
|
|
190
206
|
const { accessibleFeatures = [] } = this?.props?.currentOrgDetails || {};
|
|
191
207
|
const hideDateTagsForJpLocale = accessibleFeatures.includes(JP_LOCALE_HIDE_FEATURE);
|
|
@@ -210,40 +226,110 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
210
226
|
supportedTagsString += `${supportedTag} ,`;
|
|
211
227
|
});
|
|
212
228
|
supportedTagsString = supportedTagsString.replace(/,\s*$/, "");
|
|
213
|
-
const
|
|
229
|
+
const tagName =
|
|
230
|
+
typeof val?.name === STRING
|
|
231
|
+
? _.toLower(_.get(val, "name", ""))
|
|
232
|
+
: _.toLower(_.get(val, "name.props.defaultMessage", ""));
|
|
233
|
+
const tagNameWithoutUnderscore = tagName.replace(/_/g, " ");
|
|
214
234
|
const searchStringLower = _.toLower(searchString);
|
|
215
|
-
const tagContainsSearchedString =
|
|
235
|
+
const tagContainsSearchedString =
|
|
236
|
+
searchStringLower &&
|
|
237
|
+
(tagName.includes(searchStringLower) ||
|
|
238
|
+
tagNameWithoutUnderscore.includes(searchStringLower));
|
|
216
239
|
if (_.has(val, 'subtags')) {
|
|
217
240
|
const disabled = disableRelatedTags ? parentTagstoDisable.includes(key) : false;
|
|
218
|
-
const temp = this.renderTags(val
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
241
|
+
const temp = this.renderTags(val?.subtags);
|
|
242
|
+
if (temp?.length) {
|
|
243
|
+
const tagValue = (
|
|
244
|
+
<CapTreeNode
|
|
245
|
+
title={disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val?.name}</CapTooltip> : val?.name}
|
|
246
|
+
tag={val}
|
|
247
|
+
key={val?.incentiveSeriesId ? `${key}(${val?.incentiveSeriesId})` : `${key}`}
|
|
248
|
+
disabled={disabled}
|
|
249
|
+
>
|
|
250
|
+
{temp}
|
|
251
|
+
</CapTreeNode>
|
|
252
|
+
);
|
|
253
|
+
hidingDateTagsForJpLocale(hideDateTagsForJpLocale, val, list, tagValue);
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
231
256
|
let childDisabled = true;
|
|
232
257
|
if (key === CUSTOMER_BARCODE_TAG && !hasCustomerBarcodeFeatureEnabled()) {
|
|
233
258
|
childDisabled = true;
|
|
234
259
|
} else {
|
|
235
260
|
childDisabled = disableRelatedTags ? childTagsToDisable.includes(key) : false;
|
|
236
261
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
262
|
+
if (searchString) {
|
|
263
|
+
if (tagContainsSearchedString) {
|
|
264
|
+
const tempNode = (
|
|
265
|
+
<CapTreeNode
|
|
266
|
+
title={
|
|
267
|
+
childDisabled ? (
|
|
268
|
+
<CapTooltip
|
|
269
|
+
title={
|
|
270
|
+
key === CUSTOMER_BARCODE_TAG
|
|
271
|
+
? customerBarcodeDisableText
|
|
272
|
+
: loyaltyAttrDisableText
|
|
273
|
+
}
|
|
274
|
+
>
|
|
275
|
+
{val?.desc || val?.name}
|
|
276
|
+
</CapTooltip>
|
|
277
|
+
) : (
|
|
278
|
+
val?.desc || val?.name
|
|
279
|
+
)
|
|
280
|
+
}
|
|
281
|
+
tag={val}
|
|
282
|
+
isLeaf
|
|
283
|
+
key={
|
|
284
|
+
val?.incentiveSeriesId
|
|
285
|
+
? `${key}(${val?.incentiveSeriesId})`
|
|
286
|
+
: `${key}`
|
|
287
|
+
}
|
|
288
|
+
disabled={childDisabled}
|
|
289
|
+
></CapTreeNode>
|
|
290
|
+
);
|
|
291
|
+
hidingDateTagsForJpLocale(
|
|
292
|
+
hideDateTagsForJpLocale,
|
|
293
|
+
val,
|
|
294
|
+
list,
|
|
295
|
+
tempNode
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
} else {
|
|
299
|
+
const tempNode = (
|
|
300
|
+
<CapTreeNode
|
|
301
|
+
title={
|
|
302
|
+
childDisabled ? (
|
|
303
|
+
<CapTooltip
|
|
304
|
+
title={
|
|
305
|
+
key === CUSTOMER_BARCODE_TAG
|
|
306
|
+
? customerBarcodeDisableText
|
|
307
|
+
: loyaltyAttrDisableText
|
|
308
|
+
}
|
|
309
|
+
>
|
|
310
|
+
{val?.desc || val?.name}
|
|
311
|
+
</CapTooltip>
|
|
312
|
+
) : (
|
|
313
|
+
val?.desc || val?.name
|
|
314
|
+
)
|
|
315
|
+
}
|
|
316
|
+
tag={val}
|
|
317
|
+
isLeaf
|
|
318
|
+
key={
|
|
319
|
+
val?.incentiveSeriesId
|
|
320
|
+
? `${key}(${val?.incentiveSeriesId})`
|
|
321
|
+
: `${key}`
|
|
322
|
+
}
|
|
323
|
+
disabled={childDisabled}
|
|
324
|
+
></CapTreeNode>
|
|
325
|
+
);
|
|
326
|
+
hidingDateTagsForJpLocale(
|
|
327
|
+
hideDateTagsForJpLocale,
|
|
328
|
+
val,
|
|
329
|
+
list,
|
|
330
|
+
tempNode
|
|
331
|
+
);
|
|
332
|
+
}
|
|
247
333
|
}
|
|
248
334
|
});
|
|
249
335
|
return list;
|
|
@@ -52,8 +52,6 @@ import { v2RcsSagas } from '../Rcs/sagas';
|
|
|
52
52
|
import { v2InAppSagas } from '../InApp/sagas';
|
|
53
53
|
import { v2ViberSagas } from '../Viber/sagas';
|
|
54
54
|
import { v2FacebookSagas } from '../Facebook/sagas';
|
|
55
|
-
import { Router } from 'react-router-dom';
|
|
56
|
-
import history from '../../utils/history';
|
|
57
55
|
|
|
58
56
|
const gtm = window.dataLayer || [];
|
|
59
57
|
const {
|
|
@@ -543,8 +541,6 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
543
541
|
handleLeftNavBarExpanded={this.handleLeftNavBarExpanded}
|
|
544
542
|
leftNavbarExpandedProp={this.state.leftNavbarExpanded}
|
|
545
543
|
/>) : ''}
|
|
546
|
-
|
|
547
|
-
<Router history={history}>
|
|
548
544
|
<MainWrapper isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled} className="main">
|
|
549
545
|
|
|
550
546
|
<ContentWrapper
|
|
@@ -565,7 +561,6 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
565
561
|
</Switch>
|
|
566
562
|
</ContentWrapper>
|
|
567
563
|
</MainWrapper>
|
|
568
|
-
</Router>
|
|
569
564
|
</div>
|
|
570
565
|
{(toastMessages && toastMessages.length > 0) &&
|
|
571
566
|
toastMessages.map((message) => {
|
|
@@ -11,6 +11,7 @@ import { initialReducer } from '../../../initialReducer';
|
|
|
11
11
|
import { render } from '../../../utils/test-utils';
|
|
12
12
|
import { Cap } from '../index';
|
|
13
13
|
import mockData from '../../mockdata';
|
|
14
|
+
import { Router } from 'react-router';
|
|
14
15
|
const {
|
|
15
16
|
demoVideoAndLinkJSONData,
|
|
16
17
|
// history,
|
|
@@ -25,7 +26,9 @@ const renderComponent = (props) => {
|
|
|
25
26
|
const store = configureStore({}, initialReducer, history);
|
|
26
27
|
return render(
|
|
27
28
|
<Provider store={store}>
|
|
29
|
+
<Router history={history}>
|
|
28
30
|
<ComponentToRender {...props} />
|
|
31
|
+
</Router>
|
|
29
32
|
|
|
30
33
|
</Provider>,
|
|
31
34
|
);
|
|
@@ -33,14 +36,7 @@ return render(
|
|
|
33
36
|
|
|
34
37
|
jest.setTimeout(15000);
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
__esModule: true,
|
|
38
|
-
default: (props) => (
|
|
39
|
-
<div className="tag-mock" {...props}>
|
|
40
|
-
TagList
|
|
41
|
-
</div>
|
|
42
|
-
),
|
|
43
|
-
}));
|
|
39
|
+
|
|
44
40
|
jest.mock('@capillarytech/cap-ui-utils', () => ({
|
|
45
41
|
...jest.requireActual('@capillarytech/cap-ui-utils'),
|
|
46
42
|
GA: {
|
|
@@ -448,7 +448,7 @@ export class Creatives extends React.Component {
|
|
|
448
448
|
} = {},
|
|
449
449
|
} = templateData;
|
|
450
450
|
const mediaParams = {};
|
|
451
|
-
const { url = '', previewUrl = '', docParams = {}, footer = '', headerVarMapped = {}, headerTemplate = ''} = whatsappMedia;
|
|
451
|
+
const { url = '', previewUrl = '', docParams = {}, footer = '', headerVarMapped = {}, headerTemplate = ''} = whatsappMedia || {};
|
|
452
452
|
switch (mediaType) {
|
|
453
453
|
case (WHATSAPP_MEDIA_TYPES.IMAGE):
|
|
454
454
|
mediaParams.imageUrl = url;
|
|
@@ -122,11 +122,11 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
122
122
|
const { id: selectedWeChatAccountId } = editSelectedWeChatAccount || {};
|
|
123
123
|
const { definition } = templateDetails || {};
|
|
124
124
|
const { accountId: templateAccountId } = definition || {};
|
|
125
|
-
const { Edit: nextEdit } = nextProps || {};
|
|
125
|
+
const { Templates: nextTemplates, Edit: nextEdit } = nextProps || {};
|
|
126
126
|
if (isEmbeddedEditOrPreview(queryType, creativesMode)) {
|
|
127
127
|
selectedWeChatAccount = !_.isEmpty(editSelectedWeChatAccount)
|
|
128
128
|
? editSelectedWeChatAccount
|
|
129
|
-
:
|
|
129
|
+
: nextTemplates?.selectedWeChatAccount;
|
|
130
130
|
} else if (!_.isEmpty(Templates?.selectedWeChatAccount)) {
|
|
131
131
|
selectedWeChatAccount = Templates?.selectedWeChatAccount;
|
|
132
132
|
}
|
|
@@ -159,11 +159,11 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
159
159
|
) {
|
|
160
160
|
this.setMobilePushAccountOptions(nextEdit?.weCrmAccounts, templateAccountId);
|
|
161
161
|
}
|
|
162
|
-
if (!_.isEmpty(
|
|
162
|
+
if (!_.isEmpty(nextTemplates?.selectedWeChatAccount) && !_.isEqual(editSelectedWeChatAccount, nextEdit?.selectedWeChatAccount) && (queryType === EMBEDDED) && this.props.location.query.module === "loyalty") {
|
|
163
163
|
const params = {
|
|
164
164
|
name: '',
|
|
165
165
|
sortBy: 'Most Recent',
|
|
166
|
-
accountId:
|
|
166
|
+
accountId: nextTemplates?.selectedWeChatAccount?.id,
|
|
167
167
|
};
|
|
168
168
|
this.props.actions.getMobilepushTemplatesList('mobilepush', params);
|
|
169
169
|
}
|
|
@@ -174,8 +174,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
174
174
|
if (nextProps.location.query.module !== 'loyalty' && templateId && templateId !== 'temp') {
|
|
175
175
|
this.props.actions.getTemplateDetails(templateId);
|
|
176
176
|
}
|
|
177
|
-
|
|
178
|
-
if (type === 'embedded' && templateId === 'temp' && _.isEmpty(this.state.formData)) { // when his.props.params.id is temp that means mobile push template content will be passed from post message from parent with startTemplateCreation action
|
|
177
|
+
if (queryType === EMBEDDED && templateId === 'temp' && _.isEmpty(this.state.formData)) { // when his.props.params.id is temp that means mobile push template content will be passed from post message from parent with startTemplateCreation action
|
|
179
178
|
const response = {
|
|
180
179
|
action: 'startTemplateCreation',
|
|
181
180
|
};
|
|
@@ -183,12 +182,12 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
183
182
|
this.getTags();
|
|
184
183
|
}
|
|
185
184
|
});
|
|
186
|
-
if (
|
|
185
|
+
if (queryType === EMBEDDED) {
|
|
187
186
|
this.showNext();
|
|
188
187
|
}
|
|
189
188
|
}
|
|
190
189
|
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && nextProps.Edit.mobilepushTemplates && !_.isEqual(nextProps.Edit.mobilepushTemplates, this.props.Edit.mobilepushTemplates)) { //used inloyalty
|
|
191
|
-
if (nextProps.location.query.type ===
|
|
190
|
+
if (nextProps.location.query.type === EMBEDDED && nextProps.location.query.module === 'loyalty') {
|
|
192
191
|
this.setTemplateOptions(nextProps.Edit.mobilepushTemplates);
|
|
193
192
|
}
|
|
194
193
|
}
|
|
@@ -75,9 +75,9 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
75
75
|
mPush: {content: <></>, tab: intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
|
|
76
76
|
inApp: { content: <div></div>, tab: intl.formatMessage(messages.inapp), key: INAPP },
|
|
77
77
|
line: {content: <></>, tab: intl.formatMessage(messages.line), key: 'line'},
|
|
78
|
-
viber: {content: <></>, tab: intl.formatMessage(messages.viber), key: 'viber'},
|
|
79
|
-
facebook: {content: <div></div>, tab: intl.formatMessage(messages.facebook), key: 'facebook'},
|
|
80
78
|
whatsapp: { content: <></>, tab: intl.formatMessage(messages.whatsapp), key: WHATSAPP },
|
|
79
|
+
facebook: {content: <div></div>, tab: intl.formatMessage(messages.facebook), key: 'facebook'},
|
|
80
|
+
viber: {content: <></>, tab: intl.formatMessage(messages.viber), key: 'viber'},
|
|
81
81
|
zalo: { content: <div></div>, tab: intl.formatMessage(messages.zalo), key: ZALO },
|
|
82
82
|
};
|
|
83
83
|
//Hiding we chat for all orgs across UI for now and enabling it based on feature 'ENABLE_WECHAT'
|
|
@@ -339,9 +339,9 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
339
339
|
|
|
340
340
|
render() {
|
|
341
341
|
const {
|
|
342
|
-
isFullMode, className, cap = {}, authData = {},
|
|
342
|
+
isFullMode, className, cap = {}, authData = {},
|
|
343
343
|
} = this.props;
|
|
344
|
-
const { accessiblePermissions = []} = cap.user || authData.user ||
|
|
344
|
+
const { accessiblePermissions = []} = cap.user || authData.user || {};
|
|
345
345
|
let isCreativeAccessible = true;
|
|
346
346
|
if (!accessiblePermissions.includes(CREATIVES_UI_VIEW)) {
|
|
347
347
|
isCreativeAccessible = false;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import React from "react";
|
|
3
|
+
import SmsTest from '../../v2Components/SmsTest';
|
|
4
|
+
|
|
5
|
+
export default class TestPage extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
|
|
6
|
+
render() {
|
|
7
|
+
return (
|
|
8
|
+
<SmsTest />
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// const schema = {
|
|
14
|
+
// title: "Todo",
|
|
15
|
+
// type: "object",
|
|
16
|
+
// required: ["title"],
|
|
17
|
+
// properties: {
|
|
18
|
+
// title: {type: "string", title: "Title", default: "A new task"},
|
|
19
|
+
// done: {type: "boolean", title: "Done?", default: false},
|
|
20
|
+
// },
|
|
21
|
+
// };
|
|
22
|
+
|
|
23
|
+
// const log = (type) => console.log.bind(console, type);
|
|
24
|
+
|
|
25
|
+
// render((
|
|
26
|
+
// <div>
|
|
27
|
+
// <SmsTest
|
|
28
|
+
// />
|
|
29
|
+
// </div>
|
|
30
|
+
// ), document.getElementById("app"));
|
|
31
|
+
//export default TestPage;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* NotFoundPage Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the NotFoundPage component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'creatives.containersV2.TestPage.header',
|
|
11
|
+
defaultMessage: 'Looks like youas are lost!',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* Dashboard reducer
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { fromJS } from 'immutable';
|
|
8
|
+
import { DEFAULT_ACTION } from './constants';
|
|
9
|
+
|
|
10
|
+
const initialState = fromJS({});
|
|
11
|
+
|
|
12
|
+
function TestPageReducer(state = initialState, action) {
|
|
13
|
+
switch (action.type) {
|
|
14
|
+
case DEFAULT_ACTION:
|
|
15
|
+
return state;
|
|
16
|
+
default:
|
|
17
|
+
return state;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default TestPageReducer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// import { take, call, put, select } from 'redux-saga/effects';
|
|
2
|
+
|
|
3
|
+
// Individual exports for testing
|
|
4
|
+
export function* defaultSaga() {
|
|
5
|
+
// See example in v2Containers/HomePage/sagas.js
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// All sagas to be loaded
|
|
9
|
+
export default [
|
|
10
|
+
defaultSaga,
|
|
11
|
+
];
|