@capillarytech/creatives-library 7.17.47-alpha.0 → 7.17.47
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 +1 -2
- package/package.json +1 -1
- package/v2Components/CapTagList/index.js +2 -2
- package/v2Components/FormBuilder/index.js +2 -2
- package/v2Containers/Email/index.js +1 -1
- package/v2Containers/Templates/actions.js +2 -2
- package/v2Containers/Templates/constants.js +0 -2
- package/v2Containers/Templates/index.js +5 -6
- package/v2Containers/Templates/sagas.js +5 -8
- package/v2Containers/Templates/tests/actions.test.js +1 -2
- package/v2Containers/Templates/tests/mockData.js +0 -4
- package/v2Containers/Templates/tests/sagas.test.js +3 -25
- package/v2Components/CapTagList/style.scss +0 -5
- package/v2Containers/Zalo/tests/selectors.test.js +0 -52
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ import moment from 'moment';
|
|
|
11
11
|
import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
12
12
|
// import styled from 'styled-components';
|
|
13
13
|
import { CapSpin, CapModal, CapButton, CapPopover, CapInput, CapTree, CapSelect, CapTooltip, CapLink, CapIcon } from '@capillarytech/cap-ui-library';
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
import _ from 'lodash';
|
|
16
16
|
import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
|
|
17
17
|
import { createStructuredSelector } from 'reselect';
|
|
@@ -287,7 +287,6 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
287
287
|
<CapIcon
|
|
288
288
|
type="help"
|
|
289
289
|
size="s"
|
|
290
|
-
svgProps={{ color: FONT_COLOR_05 }}
|
|
291
290
|
/>
|
|
292
291
|
<CapLink>
|
|
293
292
|
<CapButton id="translationtagfooter" type="flat" onClick={this.openTranslationLink} >
|
|
@@ -296,6 +295,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
296
295
|
<CapIcon
|
|
297
296
|
type="open-in-new-light"
|
|
298
297
|
size="s"
|
|
298
|
+
svgProps={{ color: FONT_COLOR_05 }}
|
|
299
299
|
/>
|
|
300
300
|
</div>
|
|
301
301
|
</CapButton>
|
|
@@ -54,7 +54,7 @@ import { convert } from 'html-to-text';
|
|
|
54
54
|
import { AI_SUGGESTION_API_URL } from './constants';
|
|
55
55
|
import { GET_TRANSLATION_MAPPED } from '../../containers/TagList/constants';
|
|
56
56
|
import moment from 'moment';
|
|
57
|
-
import { CUSTOMER_BARCODE_TAG
|
|
57
|
+
import { CUSTOMER_BARCODE_TAG } from '../../containers/App/constants';
|
|
58
58
|
const TabPane = Tabs.TabPane;
|
|
59
59
|
const {Column} = Table;
|
|
60
60
|
const {TextArea} = CapInput;
|
|
@@ -1669,7 +1669,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1669
1669
|
} else {
|
|
1670
1670
|
const tempTab = ifError ? currentTab : this.state.currentTab;
|
|
1671
1671
|
const version = `Version ${this.state.currentTab}`;
|
|
1672
|
-
formData[tabCount].name = `${
|
|
1672
|
+
formData[tabCount].name = `${this.props?.intl?.formatMessage(globalMessages.copyOf)} ${formData[tempTab - 1].name ? formData[tempTab - 1].name : version}`;
|
|
1673
1673
|
formData[tabCount].base = false;
|
|
1674
1674
|
const initialTab = this.state.currentTab;
|
|
1675
1675
|
this.setState({formData, tabCount: tabCount + 1, currentTab: tabCount + 1, tabKey: formData[tabCount].tabKey}, () => {
|
|
@@ -2554,7 +2554,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2554
2554
|
<CapInput
|
|
2555
2555
|
className="search-text"
|
|
2556
2556
|
style={{width: '210px'}}
|
|
2557
|
-
placeholder=
|
|
2557
|
+
placeholder="Search"
|
|
2558
2558
|
prefix={<i className="material-icons" style={{color: '#707070', fontSize: '16px'}}>search</i>}
|
|
2559
2559
|
value={this.state.searchText}
|
|
2560
2560
|
onChange={(e) => this.searchAsset(e.target.value)}
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
import * as types from './constants';
|
|
8
8
|
import { LINE, WHATSAPP, RCS, ZALO } from '../CreativesContainer/constants';
|
|
9
9
|
|
|
10
|
-
export function getAllTemplates(channel, queryParams
|
|
10
|
+
export function getAllTemplates(channel, queryParams) {
|
|
11
11
|
return {
|
|
12
|
-
type: types.GET_ALL_TEMPLATES_REQUEST, channel, queryParams,
|
|
12
|
+
type: types.GET_ALL_TEMPLATES_REQUEST, channel, queryParams,
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -73,5 +73,3 @@ export const GET_SENDER_DETAILS_FAILURE =
|
|
|
73
73
|
export const GET_CDN_TRANSFORMATION_CONFIG_REQUEST = 'app/v2Containers/Templates/GET_CDN_TRANSFORMATION_CONFIG_REQUEST';
|
|
74
74
|
export const GET_CDN_TRANSFORMATION_CONFIG_SUCCESS = 'app/v2Containers/Templates/GET_CDN_TRANSFORMATION_CONFIG_SUCCESS';
|
|
75
75
|
export const GET_CDN_TRANSFORMATION_CONFIG_FAILURE = 'app/v2Containers/Templates/GET_CDN_TRANSFORMATION_CONFIG_FAILURE';
|
|
76
|
-
|
|
77
|
-
export const COPY_OF = 'Copy of';
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
FACEBOOK as FACEBOOK_CHANNEL,
|
|
94
94
|
CREATE,
|
|
95
95
|
} from '../App/constants';
|
|
96
|
-
import {
|
|
96
|
+
import { MAX_WHATSAPP_TEMPLATES, WARNING_WHATSAPP_TEMPLATES } from './constants';
|
|
97
97
|
import {
|
|
98
98
|
TWILIO_CATEGORY_OPTIONS,
|
|
99
99
|
KARIX_GUPSHUP_CATEGORY_OPTIONS,
|
|
@@ -309,7 +309,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
componentDidMount() {
|
|
312
|
-
const {formatMessage} =this.props?.intl || {};
|
|
313
312
|
if (this.props.location.query.type === 'embedded' && this.isEnabledInLibraryModule("setLocale")) {
|
|
314
313
|
this.setLocale();
|
|
315
314
|
}
|
|
@@ -335,7 +334,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
335
334
|
if ((this.state.channel || '').toLowerCase() === "sms" && isTraiDltFeature) {
|
|
336
335
|
queryParams.traiEnable = true;
|
|
337
336
|
}
|
|
338
|
-
this.props.actions.getAllTemplates(channel, queryParams
|
|
337
|
+
this.props.actions.getAllTemplates(channel, queryParams);
|
|
339
338
|
}
|
|
340
339
|
|
|
341
340
|
window.addEventListener("message", this.handleFrameTasks);
|
|
@@ -771,7 +770,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
771
770
|
queryParams.originalId = this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier;
|
|
772
771
|
}
|
|
773
772
|
const channel = this.state.channel;
|
|
774
|
-
this.props.actions.getAllTemplates(channel, queryParams
|
|
773
|
+
this.props.actions.getAllTemplates(channel, queryParams);
|
|
775
774
|
} else if ((resetPage || (page === 1 && this.state.templatesCount === 0) || page <= (this.state.templatesCount / this.state.perPageLimit))) {
|
|
776
775
|
if (getNextPage) {
|
|
777
776
|
page += 1;
|
|
@@ -813,7 +812,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
813
812
|
queryParams.page = page;
|
|
814
813
|
queryParams.perPage = this.state.perPageLimit;
|
|
815
814
|
const channel = this.state.channel;
|
|
816
|
-
this.props.actions.getAllTemplates(channel, queryParams
|
|
815
|
+
this.props.actions.getAllTemplates(channel, queryParams);
|
|
817
816
|
});
|
|
818
817
|
}
|
|
819
818
|
};
|
|
@@ -1757,7 +1756,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1757
1756
|
|
|
1758
1757
|
duplicateTemplate(template) {
|
|
1759
1758
|
const duplicateObj = cloneDeep(template);
|
|
1760
|
-
duplicateObj.name = `${
|
|
1759
|
+
duplicateObj.name = `${this.props.intl.formatMessage(globalMessages.copyOf)} ${template?.name} ${moment().format('MM-DD-YYYY HH:mm:ss')}`;
|
|
1761
1760
|
delete duplicateObj._id;
|
|
1762
1761
|
|
|
1763
1762
|
if (this.state.channel.toLowerCase() === "mobilepush") {
|
|
@@ -4,6 +4,7 @@ import { LOCATION_CHANGE } from 'react-router-redux';
|
|
|
4
4
|
import * as Api from '../../services/api';
|
|
5
5
|
import * as types from './constants';
|
|
6
6
|
import { saveCdnConfigs, removeAllCdnLocalStorageItems } from '../../utils/cdnTransformation';
|
|
7
|
+
|
|
7
8
|
// Individual exports for testing
|
|
8
9
|
export function* getAllTemplates(channel, queryParams) {
|
|
9
10
|
try {
|
|
@@ -19,13 +20,6 @@ export function* getAllTemplates(channel, queryParams) {
|
|
|
19
20
|
} else if (channel.channel === 'wechat' && channel.queryParams && channel.queryParams.sortBy && channel.queryParams.sortBy.toLocaleLowerCase() === ("Alphabetically").toLocaleLowerCase()) {
|
|
20
21
|
channelTemplates.templates.sort((a, b) => b.name - a.name);
|
|
21
22
|
}
|
|
22
|
-
// Update the "name" property in each template
|
|
23
|
-
if (channel.intlCopyOf && channelTemplates?.templates) {
|
|
24
|
-
channelTemplates.templates = channelTemplates.templates.map((template) => ({
|
|
25
|
-
...template,
|
|
26
|
-
name: template.name.replace(new RegExp(types.COPY_OF, 'g'), channel.intlCopyOf),
|
|
27
|
-
}));
|
|
28
|
-
}
|
|
29
23
|
yield put({ type: types.GET_ALL_TEMPLATES_SUCCESS, data: channelTemplates, weCRMTemplate: result.response.unMapped, isReset: channel.queryParams.page === 1 });
|
|
30
24
|
} catch (error) {
|
|
31
25
|
yield put({ type: types.GET_ALL_TEMPLATES_FAILURE, error });
|
|
@@ -128,7 +122,7 @@ export function* sendZippedFile({selectedFile, errorHandler, successHandler}) {
|
|
|
128
122
|
yield errorHandler(errorMessage);
|
|
129
123
|
}
|
|
130
124
|
|
|
131
|
-
|
|
125
|
+
|
|
132
126
|
console.log("Got decoded result", decodeURIComponent(result.response.metaEntity.htmlContent));
|
|
133
127
|
yield [
|
|
134
128
|
put({
|
|
@@ -150,6 +144,7 @@ export function* sendZippedFile({selectedFile, errorHandler, successHandler}) {
|
|
|
150
144
|
|
|
151
145
|
export function* getDefaultBeeTemplates() {
|
|
152
146
|
try {
|
|
147
|
+
|
|
153
148
|
const result = yield call(Api.getDefaultBeeTemplates);
|
|
154
149
|
const edmTemplates = result.response;
|
|
155
150
|
yield put({ type: types.GET_DEAFULT_BEE_TEMPLATES_SUCCESS, data: edmTemplates });
|
|
@@ -160,6 +155,7 @@ export function* getDefaultBeeTemplates() {
|
|
|
160
155
|
|
|
161
156
|
export function* getTemplateDetails(id, channel) {
|
|
162
157
|
try {
|
|
158
|
+
|
|
163
159
|
const result = yield call(Api.getTemplateDetails, id, channel);
|
|
164
160
|
// const sidebar = result.response.sidebar;
|
|
165
161
|
yield put({ type: types.GET_TEMPLATE_DETAILS_SUCCESS, data: result.response });
|
|
@@ -212,6 +208,7 @@ function* watchGetUserList() {
|
|
|
212
208
|
}
|
|
213
209
|
|
|
214
210
|
function* watchFetchWeCrmAccounts() {
|
|
211
|
+
|
|
215
212
|
const watcher = yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
|
|
216
213
|
yield take(LOCATION_CHANGE);
|
|
217
214
|
yield cancel(watcher);
|
|
@@ -11,9 +11,8 @@ describe("Test zalo list actions", () => {
|
|
|
11
11
|
const expected = {
|
|
12
12
|
type: types.GET_ALL_TEMPLATES_REQUEST,
|
|
13
13
|
channel,
|
|
14
|
-
intlCopyOf: "test",
|
|
15
14
|
queryParams,
|
|
16
15
|
};
|
|
17
|
-
expect(getAllTemplates(channel, queryParams
|
|
16
|
+
expect(getAllTemplates(channel, queryParams)).toEqual(expected);
|
|
18
17
|
});
|
|
19
18
|
});
|
|
@@ -80,36 +80,14 @@ describe('watchForGetJourneyList saga', () => {
|
|
|
80
80
|
describe('templateList saga', () => {
|
|
81
81
|
it('handle valid response from api', () => {
|
|
82
82
|
expectSaga(getAllTemplates, mockData.getAllTemplatesListSuccess)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
matchers.call.fn(api.getAllTemplates),
|
|
86
|
-
mockData.getAllTemplatesListSuccess,
|
|
87
|
-
],
|
|
88
|
-
]).put({
|
|
83
|
+
.provide([[matchers.call.fn(api.getAllTemplates, mockData.getAllTemplatesListSuccess)]])
|
|
84
|
+
.put({
|
|
89
85
|
type: types.GET_ALL_TEMPLATES_SUCCESS,
|
|
90
|
-
|
|
91
|
-
weCRMTemplate: mockData.getAllTemplatesListSuccess,
|
|
92
|
-
isReset: mockData.getAllTemplatesListSuccess?.queryParams?.page === 1,
|
|
86
|
+
res: mockData.getAllTemplatesListSuccess,
|
|
93
87
|
})
|
|
94
88
|
.run();
|
|
95
89
|
});
|
|
96
90
|
|
|
97
|
-
it('handle valid response from api', () => {
|
|
98
|
-
mockData.getAllTemplatesListSuccess.intlCopyOf = '';
|
|
99
|
-
expectSaga(getAllTemplates, mockData.getAllTemplatesListSuccess)
|
|
100
|
-
.provide([
|
|
101
|
-
[
|
|
102
|
-
matchers.call.fn(api.getAllTemplates),
|
|
103
|
-
mockData.getAllTemplatesListSuccess,
|
|
104
|
-
],
|
|
105
|
-
]).put({
|
|
106
|
-
type: types.GET_ALL_TEMPLATES_SUCCESS,
|
|
107
|
-
data: mockData.getAllTemplatesListSuccess,
|
|
108
|
-
weCRMTemplate: mockData.getAllTemplatesListSuccess,
|
|
109
|
-
isReset: mockData.getAllTemplatesListSuccess?.queryParams?.page === 1,
|
|
110
|
-
})
|
|
111
|
-
.run();
|
|
112
|
-
});
|
|
113
91
|
it('handles error thrown from api', () => {
|
|
114
92
|
expectSaga(getAllTemplates, mockData.getAllTemplatesListFailure)
|
|
115
93
|
.provide([
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { fromJS } from "immutable";
|
|
2
|
-
import { makeSelectZalo, selectZaloDomain } from "../selectors";
|
|
3
|
-
import { zaloTemplateInfoData } from "./mockData";
|
|
4
|
-
|
|
5
|
-
describe("makeSelectZalo", () => {
|
|
6
|
-
it("returns the expected object with default values when substate is empty", () => {
|
|
7
|
-
// Arrange
|
|
8
|
-
const state = fromJS({ zalo: {} });
|
|
9
|
-
const expected = {
|
|
10
|
-
zaloTemplateInfoStatus: undefined,
|
|
11
|
-
zaloTemplateInfoValue: undefined,
|
|
12
|
-
zaloTemplateInfoError: undefined,
|
|
13
|
-
zaloTemplatePreviewData: undefined,
|
|
14
|
-
};
|
|
15
|
-
const selector = makeSelectZalo();
|
|
16
|
-
|
|
17
|
-
// Act
|
|
18
|
-
const result = selector(state);
|
|
19
|
-
|
|
20
|
-
// Assert
|
|
21
|
-
expect(result).toEqual(expected);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("returns the expected object when substate has values", () => {
|
|
25
|
-
// Arrange
|
|
26
|
-
const state = fromJS({
|
|
27
|
-
zalo: zaloTemplateInfoData,
|
|
28
|
-
});
|
|
29
|
-
const expected = {
|
|
30
|
-
zaloTemplateInfoStatus: "success",
|
|
31
|
-
zaloTemplateInfoValue: fromJS(zaloTemplateInfoData.zaloTemplateInfoValue),
|
|
32
|
-
zaloTemplateInfoError: null,
|
|
33
|
-
zaloTemplatePreviewData: undefined,
|
|
34
|
-
};
|
|
35
|
-
const selector = makeSelectZalo();
|
|
36
|
-
|
|
37
|
-
// Act
|
|
38
|
-
const result = selector(state);
|
|
39
|
-
|
|
40
|
-
// Assert
|
|
41
|
-
expect(result).toEqual(expected);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("returns the expected object with default values when substate is empty", () => {
|
|
45
|
-
// Arrange
|
|
46
|
-
const state = fromJS({ zalo: {} });
|
|
47
|
-
const expected = fromJS({});
|
|
48
|
-
const result = selectZaloDomain(state);
|
|
49
|
-
// Assert
|
|
50
|
-
expect(result).toEqual(expected);
|
|
51
|
-
});
|
|
52
|
-
});
|