@capillarytech/creatives-library 7.17.13 → 7.17.14
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/TagList/constants.js +0 -11
- package/package.json +1 -1
- package/utils/common.js +8 -0
- package/utils/commonUtils.js +6 -0
- package/v2Components/CapTagList/index.js +11 -21
- package/v2Containers/Cap/constants.js +3 -3
- package/v2Containers/LanguageProvider/reducer.js +3 -1
- package/v2Containers/LanguageProvider/tests/reducer.test.js +9 -0
- package/v2Containers/Line/Container/Text/index.js +1 -16
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +5 -5
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +120 -120
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +16 -16
- package/v2Containers/TagList/index.js +36 -13
- package/v2Containers/TagList/messages.js +2 -1
- package/v2Containers/TagList/tests/TagList.test.js +43 -0
- package/v2Containers/TagList/tests/mockdata.js +134 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +16 -16
- package/v2Containers/TagList/tests/utils.test.js +0 -17
- package/v2Containers/TagList/utils.js +0 -15
|
@@ -17,14 +17,3 @@ export const GET_TRANSLATION_MAPPED = {
|
|
|
17
17
|
'en-US': 'en-US',
|
|
18
18
|
'ja-JP': 'ja-JP',
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
export const JAPANESE_HIDE_DATE_ARRAY = [
|
|
22
|
-
"mm/dd/yyyy",
|
|
23
|
-
"dd/mm/yyyy",
|
|
24
|
-
"mm/dd/yy",
|
|
25
|
-
"dd Mon yyyy",
|
|
26
|
-
"Day, Mon dd, yy",
|
|
27
|
-
"dd.mm.yy",
|
|
28
|
-
"dd Mon",
|
|
29
|
-
"dd/m/yyyy",
|
|
30
|
-
];
|
package/package.json
CHANGED
package/utils/common.js
CHANGED
|
@@ -262,3 +262,11 @@ export const isTraiDLTEnable = (isFullMode, smsRegister) => {
|
|
|
262
262
|
const isTraiDltFeature = isTraiDltFeatureForOrg && isTraiEnableforLib;
|
|
263
263
|
return isTraiDltFeature;
|
|
264
264
|
};
|
|
265
|
+
|
|
266
|
+
export const intlKeyGenerator = (value = "") => {
|
|
267
|
+
if (value && value.typeOf === "string") {
|
|
268
|
+
const key = value.replace(/[^a-zA-Z0-9_]/g, "");
|
|
269
|
+
return key;
|
|
270
|
+
}
|
|
271
|
+
return value;
|
|
272
|
+
}
|
|
@@ -19,14 +19,7 @@ import { CARD_RELATED_TAGS } from '../../containers/App/constants';
|
|
|
19
19
|
import { hasCardBasedScope } from '../../utils/common';
|
|
20
20
|
import moment from 'moment';
|
|
21
21
|
import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
22
|
-
import {
|
|
23
|
-
GET_TRANSLATION_MAPPED,
|
|
24
|
-
JAPANESE_HELP_TEXT,
|
|
25
|
-
TAG_TRANSLATION_DOC,
|
|
26
|
-
} from "../../containers/TagList/constants";
|
|
27
|
-
import { HIDE_ENGAGEMENT_CHANNELS } from '../../v2Containers/App/constants';
|
|
28
|
-
import { hideDateLocale } from '../../v2Containers/TagList/utils';
|
|
29
|
-
|
|
22
|
+
import { GET_TRANSLATION_MAPPED, JAPANESE_HELP_TEXT, TAG_TRANSLATION_DOC } from '../../containers/TagList/constants';
|
|
30
23
|
|
|
31
24
|
const {Search} = CapInput;
|
|
32
25
|
const {CapTreeNode} = CapTree;
|
|
@@ -162,9 +155,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
162
155
|
};
|
|
163
156
|
|
|
164
157
|
renderTags(tags, searchString = '') {
|
|
165
|
-
const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags
|
|
166
|
-
const { accessibleFeatures = [] } = this?.props?.currentOrgDetails || {};
|
|
167
|
-
const hideDateTagsForJpLocale = accessibleFeatures.includes(HIDE_ENGAGEMENT_CHANNELS);
|
|
158
|
+
const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags} = this.props.disableTagsDetails;
|
|
168
159
|
const list = [];
|
|
169
160
|
const loyaltyAttrDisableText = <FormattedMessage {...messages.loyaltyAttributeDisable} />;
|
|
170
161
|
let clonedTags = _.cloneDeep(tags);
|
|
@@ -180,7 +171,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
180
171
|
if (_.has(val, 'subtags')) {
|
|
181
172
|
const disabled = disableRelatedTags ? parentTagstoDisable.includes(key) : false;
|
|
182
173
|
const temp = this.renderTags(val.subtags, '', disabled);
|
|
183
|
-
|
|
174
|
+
list.push((
|
|
184
175
|
<CapTreeNode
|
|
185
176
|
title={disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val.name}</CapTooltip> : val.name}
|
|
186
177
|
tag={val}
|
|
@@ -189,8 +180,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
189
180
|
>
|
|
190
181
|
{temp}
|
|
191
182
|
</CapTreeNode>
|
|
192
|
-
);
|
|
193
|
-
hideDateLocale(hideDateTagsForJpLocale, val, list, tagValue);
|
|
183
|
+
));
|
|
194
184
|
} else if (searchString === '' || !searchString || ((val.name || '').toLowerCase().indexOf(searchString.toLowerCase()) !== -1)) {
|
|
195
185
|
const childDisabled = disableRelatedTags ? childTagsToDisable.includes(key) : false;
|
|
196
186
|
const tempNode = (
|
|
@@ -202,7 +192,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
202
192
|
disabled={childDisabled}
|
|
203
193
|
>
|
|
204
194
|
</CapTreeNode>);
|
|
205
|
-
|
|
195
|
+
list.push(tempNode);
|
|
206
196
|
}
|
|
207
197
|
});
|
|
208
198
|
return list;
|
|
@@ -253,7 +243,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
253
243
|
expandedKeys={expandedKeys}
|
|
254
244
|
autoExpandParent={autoExpandParent}
|
|
255
245
|
onExpand={this.onExpand}
|
|
256
|
-
|
|
246
|
+
>
|
|
257
247
|
{this.renderTags(tg, searchValue)}
|
|
258
248
|
</CapTree>
|
|
259
249
|
{translationLang === "ja-JP" &&
|
|
@@ -261,7 +251,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
261
251
|
<CapIcon
|
|
262
252
|
type="help"
|
|
263
253
|
size="s"
|
|
264
|
-
/>
|
|
254
|
+
/>
|
|
265
255
|
<CapLink>
|
|
266
256
|
<CapButton id="translationtagfooter" type="flat" onClick={this.openTranslationLink} >
|
|
267
257
|
<div className="tag-list-footer-icon">
|
|
@@ -274,8 +264,8 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
274
264
|
</div>
|
|
275
265
|
</CapButton>
|
|
276
266
|
</CapLink>
|
|
277
|
-
|
|
278
|
-
|
|
267
|
+
</div>
|
|
268
|
+
}
|
|
279
269
|
|
|
280
270
|
</CapSpin>
|
|
281
271
|
</div>);
|
|
@@ -285,7 +275,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
285
275
|
visible={this.props.visibleTaglist}
|
|
286
276
|
footer={[]}
|
|
287
277
|
{...modalProps}
|
|
288
|
-
|
|
278
|
+
>
|
|
289
279
|
{contentSection}
|
|
290
280
|
</CapModal> :
|
|
291
281
|
<CapPopover
|
|
@@ -330,7 +320,6 @@ CapTagList.propTypes = {
|
|
|
330
320
|
hidePopover: PropTypes.bool,
|
|
331
321
|
modalProps: PropTypes.any,
|
|
332
322
|
disableTagsDetails: PropTypes.object,
|
|
333
|
-
currentOrgDetails: PropTypes.object,
|
|
334
323
|
};
|
|
335
324
|
|
|
336
325
|
CapTagList.defaultValue = {
|
|
@@ -348,3 +337,4 @@ const mapStateToProps = createStructuredSelector({
|
|
|
348
337
|
|
|
349
338
|
|
|
350
339
|
export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(CapTagList));
|
|
340
|
+
|
|
@@ -15,9 +15,9 @@ export const GET_USER_DATA_REQUEST = 'cap/GET_USER_DATA_REQUEST_V2';
|
|
|
15
15
|
export const GET_USER_DATA_SUCCESS = 'cap/GET_USER_DATA_SUCCESS_V2';
|
|
16
16
|
export const GET_USER_DATA_FAILURE = 'cap/GET_USER_DATA_FAILURE_V2';
|
|
17
17
|
|
|
18
|
-
export const GET_SCHEMA_FOR_ENTITY_FAILURE = 'cap/
|
|
19
|
-
export const GET_SCHEMA_FOR_ENTITY_REQUEST = 'cap/
|
|
20
|
-
export const GET_SCHEMA_FOR_ENTITY_SUCCESS = 'cap/
|
|
18
|
+
export const GET_SCHEMA_FOR_ENTITY_FAILURE = 'cap/GET_SCHEMA_FOR_ENTITY_FAILURE_V2';
|
|
19
|
+
export const GET_SCHEMA_FOR_ENTITY_REQUEST = 'cap/GET_SCHEMA_FOR_ENTITY_REQUEST_V2';
|
|
20
|
+
export const GET_SCHEMA_FOR_ENTITY_SUCCESS = 'cap/GET_SCHEMA_FOR_ENTITY_SUCCESS_V2';
|
|
21
21
|
export const CLEAR_META_ENTITIES = 'cap/CLEAR_META_ENTITIES';
|
|
22
22
|
export const HIDE_TAGS = 'cap/HIDE_TAGS';
|
|
23
23
|
|
|
@@ -17,7 +17,9 @@ const initialState = fromJS({
|
|
|
17
17
|
function languageProviderReducer(state = initialState, action) {
|
|
18
18
|
switch (action.type) {
|
|
19
19
|
case types.GET_LOCIZ_MESSAGE_REQUEST:
|
|
20
|
-
return state
|
|
20
|
+
return state
|
|
21
|
+
.set('localeLoading', true)
|
|
22
|
+
.set('locale', action.locale);
|
|
21
23
|
case types.GET_LOCIZ_MESSAGE_SUCCESS:
|
|
22
24
|
return state
|
|
23
25
|
.set('localeLoading', false)
|
|
@@ -3,6 +3,7 @@ import { fromJS } from 'immutable';
|
|
|
3
3
|
import languageProviderReducer from '../reducer';
|
|
4
4
|
import {
|
|
5
5
|
CHANGE_LOCALE,
|
|
6
|
+
GET_LOCIZ_MESSAGE_REQUEST,
|
|
6
7
|
} from '../constants';
|
|
7
8
|
|
|
8
9
|
describe('languageProviderReducer', () => {
|
|
@@ -21,4 +22,12 @@ describe('languageProviderReducer', () => {
|
|
|
21
22
|
messages: {},
|
|
22
23
|
});
|
|
23
24
|
});
|
|
25
|
+
|
|
26
|
+
it('make locize message request', () => {
|
|
27
|
+
expect(languageProviderReducer(undefined, { type: GET_LOCIZ_MESSAGE_REQUEST, locale: 'de' }).toJS()).toEqual({
|
|
28
|
+
locale: "de",
|
|
29
|
+
localeLoading: true,
|
|
30
|
+
messages: {},
|
|
31
|
+
});
|
|
32
|
+
});
|
|
24
33
|
});
|
|
@@ -16,8 +16,6 @@ import style from './style';
|
|
|
16
16
|
import withStyles from '../../../../hoc/withStyles';
|
|
17
17
|
import globalMessages from '../../../Cap/messages';
|
|
18
18
|
import { validateTags } from '../../../../utils/tagValidations';
|
|
19
|
-
import moment from 'moment';
|
|
20
|
-
import { GET_TRANSLATION_MAPPED } from '../../../../containers/TagList/constants';
|
|
21
19
|
|
|
22
20
|
const { TextArea } = CapInput;
|
|
23
21
|
const {CapCustomCardList} = CapCustomCard;
|
|
@@ -56,7 +54,6 @@ export const LineText = ({
|
|
|
56
54
|
const [messageTitle, updateTextMessageTitle] = useState('');
|
|
57
55
|
const [isDrawerRequired, updateDrawerRequirement] = useState(false);
|
|
58
56
|
const [selectedTemplate, updateSelectedTemplate] = useState();
|
|
59
|
-
const [translationLang, updateTranslationLang] = useState('en');
|
|
60
57
|
|
|
61
58
|
useEffect(() => {
|
|
62
59
|
const { messageTitle = '', messageContent = '', type, isInit } = content;
|
|
@@ -74,18 +71,6 @@ export const LineText = ({
|
|
|
74
71
|
}
|
|
75
72
|
}, [content]);
|
|
76
73
|
|
|
77
|
-
//To Find from which locale user is loggedin
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
const user = localStorage.getItem("user");
|
|
80
|
-
let locale = "en";
|
|
81
|
-
if (user) {
|
|
82
|
-
locale = JSON.parse(user).lang || locale;
|
|
83
|
-
}
|
|
84
|
-
locale = GET_TRANSLATION_MAPPED?.[locale];
|
|
85
|
-
moment.locale(locale);
|
|
86
|
-
updateTranslationLang(locale);
|
|
87
|
-
}, []);
|
|
88
|
-
|
|
89
74
|
useEffect(() => {
|
|
90
75
|
if (messageContent && (isFullMode ? messageTitle : true)) {
|
|
91
76
|
updateMessageState({
|
|
@@ -275,7 +260,7 @@ export const LineText = ({
|
|
|
275
260
|
injectedTags={injectedTags || {}}
|
|
276
261
|
// className={val.className ? val.className : ''}
|
|
277
262
|
id={`${id}_tags`}
|
|
278
|
-
userLocale={
|
|
263
|
+
userLocale={localStorage.getItem('jlocale') || 'en'}
|
|
279
264
|
selectedOfferDetails={selectedOfferDetails}
|
|
280
265
|
/>
|
|
281
266
|
</>
|
|
@@ -23058,7 +23058,7 @@ new message content.",
|
|
|
23058
23058
|
</div>
|
|
23059
23059
|
</ComponentWithLabelHOC__CapComponentStyled>
|
|
23060
23060
|
</_class>
|
|
23061
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
23061
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
23062
23062
|
id="undefined_tags"
|
|
23063
23063
|
injectedTags={Object {}}
|
|
23064
23064
|
key="undefined_tags"
|
|
@@ -23077,9 +23077,9 @@ new message content.",
|
|
|
23077
23077
|
onContextChange={[Function]}
|
|
23078
23078
|
onTagSelect={[Function]}
|
|
23079
23079
|
tags={Array []}
|
|
23080
|
-
userLocale="en
|
|
23080
|
+
userLocale="en"
|
|
23081
23081
|
>
|
|
23082
|
-
<UserIsAuthenticated(Connect(TagList))
|
|
23082
|
+
<UserIsAuthenticated(Connect(InjectIntl(TagList)))
|
|
23083
23083
|
authData={
|
|
23084
23084
|
Object {
|
|
23085
23085
|
"app": Object {},
|
|
@@ -23123,9 +23123,9 @@ new message content.",
|
|
|
23123
23123
|
onTagSelect={[Function]}
|
|
23124
23124
|
redirect={[Function]}
|
|
23125
23125
|
tags={Array []}
|
|
23126
|
-
userLocale="en
|
|
23126
|
+
userLocale="en"
|
|
23127
23127
|
/>
|
|
23128
|
-
</Connect(UserIsAuthenticated(Connect(TagList)))>
|
|
23128
|
+
</Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
|
|
23129
23129
|
<CapDrawer
|
|
23130
23130
|
content={
|
|
23131
23131
|
<React.Fragment>
|