@capillarytech/creatives-library 7.17.14-alpha.0 → 7.17.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.14-alpha.0",
4
+ "version": "7.17.15",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/utils/common.js CHANGED
@@ -6,7 +6,6 @@ import {
6
6
  CARD_RELATED_TAGS,
7
7
  CARD_BASED_SCOPE,
8
8
  } from '../containers/App/constants';
9
- import { apiMessageFormatHandler } from './commonUtils';
10
9
 
11
10
  export function getUserNameById(userId, allUserList) {
12
11
  let userName = "";
@@ -263,61 +262,3 @@ export const isTraiDLTEnable = (isFullMode, smsRegister) => {
263
262
  const isTraiDltFeature = isTraiDltFeatureForOrg && isTraiEnableforLib;
264
263
  return isTraiDltFeature;
265
264
  };
266
-
267
- export const intlKeyGenerator = (value = "") => {
268
- if (value && typeof value === "string")
269
- return value.replace(/[^a-zA-Z0-9_]/g, "");
270
- return value.props.defaultMessage.replace(/[^a-zA-Z0-9_]/g, "");
271
- };
272
-
273
- export const handleInjectedData = (data, scope) => {
274
- let tagType;
275
- for (const tagKey in data) {
276
- if (data.hasOwnProperty(tagKey)) {
277
- const tag = data[tagKey];
278
-
279
- if (tag?.name === "Registration custom fields") {
280
- tagType = "CustomTagMessage";
281
- } else if (tag?.name === "Customer extended fields") {
282
- tagType = "ExtendedTagMessage";
283
- }
284
-
285
- if (tag?.name) {
286
- const name = tag?.name;
287
- const key = intlKeyGenerator(name);
288
- const id = tagType
289
- ? `${scope}.${key}_name.${tagType}`
290
- : `${scope}.${key}`;
291
-
292
- tag["name"] = apiMessageFormatHandler(id, name);
293
- }
294
-
295
- if (tag["subtags"]) {
296
- for (const subtagKey in tag["subtags"]) {
297
- if (tag["subtags"].hasOwnProperty(subtagKey)) {
298
- const subtag = tag["subtags"][subtagKey];
299
- if (subtag?.name) {
300
- const name = subtag?.name;
301
- const key = intlKeyGenerator(name);
302
- const id = tagType
303
- ? `${scope}.${key}_name.${tagType}`
304
- : `${scope}.${key}`;
305
-
306
- subtag["name"] = apiMessageFormatHandler(id, name);
307
- }
308
- if (subtag?.desc) {
309
- const desc = subtag?.desc;
310
- const key = intlKeyGenerator(desc);
311
- const id = tagType
312
- ? `${scope}.${key}_desc.${tagType}`
313
- : `${scope}.${key}`;
314
-
315
- subtag["desc"] = apiMessageFormatHandler(id, desc);
316
- }
317
- }
318
- }
319
- }
320
- }
321
- }
322
- return data;
323
- };
@@ -293,7 +293,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
293
293
  onVisibleChange={this.togglePopoverVisibility}
294
294
  content={contentSection}
295
295
  trigger="click"
296
- placement="rightTop"
296
+ placement="bottom"
297
297
  >
298
298
  <CapButton isAddBtn type="flat">{label || ''}</CapButton>
299
299
  </CapPopover>
@@ -52,6 +52,8 @@ import { validateIfTagClosed } from '../../utils/tagValidations';
52
52
  import globalMessages from '../../v2Containers/Cap/messages';
53
53
  import { convert } from 'html-to-text';
54
54
  import { AI_SUGGESTION_API_URL } from './constants';
55
+ import { GET_TRANSLATION_MAPPED } from '../../containers/TagList/constants';
56
+ import moment from 'moment';
55
57
  const TabPane = Tabs.TabPane;
56
58
  const {Column} = Table;
57
59
  const {TextArea} = CapInput;
@@ -94,6 +96,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
94
96
  popoverVisible: false,
95
97
  customPopoverVisible: false,
96
98
  isDrawerVisible: false,
99
+ translationLang: ''
97
100
  };
98
101
  this.renderForm = this.renderForm.bind(this);
99
102
  this.updateFormData = this.updateFormData.bind(this);
@@ -3427,6 +3430,23 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3427
3430
  return fields;
3428
3431
  }
3429
3432
 
3433
+ //To Find from which locale user is loggedin
3434
+ getTranslationMappedLocale(locale) {
3435
+ return GET_TRANSLATION_MAPPED?.[locale];
3436
+ }
3437
+ componentDidMount() {
3438
+ const user = localStorage.getItem('user');
3439
+ let locale = 'en';
3440
+ moment.locale(locale);
3441
+ if (user) {
3442
+ locale = JSON.parse(user).lang || locale;
3443
+ }
3444
+ locale = this.getTranslationMappedLocale(locale);
3445
+ this.setState({
3446
+ translationLang: locale,
3447
+ });
3448
+ }
3449
+
3430
3450
  renderContainer(container) {
3431
3451
  const containerType = container.type;
3432
3452
  const renderedPanes = [];
@@ -3473,13 +3493,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3473
3493
  forceRender
3474
3494
  tab={
3475
3495
  <div className="form-tab-header" onInput={(e) => e.stopPropagation()}>
3476
- {
3496
+ { this.state.translationLang !== 'ja-JP' && (
3477
3497
  _.forEach(renderedContentSections, (value) => {
3478
3498
  if (value) {
3479
3499
  return value;
3480
3500
  }
3481
3501
  return value;
3482
- })
3502
+ }))
3483
3503
  }
3484
3504
  </div>
3485
3505
  }
@@ -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/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';
18
+ export const GET_SCHEMA_FOR_ENTITY_FAILURE = 'cap/GET_SCHEMA_FOR_ENTITY_FAILURE';
19
+ export const GET_SCHEMA_FOR_ENTITY_REQUEST = 'cap/GET_SCHEMA_FOR_ENTITY_REQUEST';
20
+ export const GET_SCHEMA_FOR_ENTITY_SUCCESS = 'cap/GET_SCHEMA_FOR_ENTITY_SUCCESS';
21
21
  export const CLEAR_META_ENTITIES = 'cap/CLEAR_META_ENTITIES';
22
22
  export const HIDE_TAGS = 'cap/HIDE_TAGS';
23
23
 
@@ -56,7 +56,7 @@ export function SlideBoxHeader(props) {
56
56
  const getChannelLabel = (currentChannel = '') => {
57
57
  const labels = {
58
58
  sms: 'SMS',
59
- email: 'Email',
59
+ email: <FormattedMessage {...messages.emailHeader} />,
60
60
  mobilepush: 'Push notification',
61
61
  wechat: 'Wechat',
62
62
  no_communication: 'NO_COMMUNICATION',
@@ -17,9 +17,7 @@ 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
21
- .set('localeLoading', true)
22
- .set('locale', action.locale);
20
+ return state.set('localeLoading', true);
23
21
  case types.GET_LOCIZ_MESSAGE_SUCCESS:
24
22
  return state
25
23
  .set('localeLoading', false)
@@ -3,7 +3,6 @@ import { fromJS } from 'immutable';
3
3
  import languageProviderReducer from '../reducer';
4
4
  import {
5
5
  CHANGE_LOCALE,
6
- GET_LOCIZ_MESSAGE_REQUEST,
7
6
  } from '../constants';
8
7
 
9
8
  describe('languageProviderReducer', () => {
@@ -22,12 +21,4 @@ describe('languageProviderReducer', () => {
22
21
  messages: {},
23
22
  });
24
23
  });
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
- });
33
24
  });
@@ -23058,7 +23058,7 @@ new message content.",
23058
23058
  </div>
23059
23059
  </ComponentWithLabelHOC__CapComponentStyled>
23060
23060
  </_class>
23061
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
23061
+ <Connect(UserIsAuthenticated(Connect(TagList)))
23062
23062
  id="undefined_tags"
23063
23063
  injectedTags={Object {}}
23064
23064
  key="undefined_tags"
@@ -23079,7 +23079,7 @@ new message content.",
23079
23079
  tags={Array []}
23080
23080
  userLocale="en-US"
23081
23081
  >
23082
- <UserIsAuthenticated(Connect(InjectIntl(TagList)))
23082
+ <UserIsAuthenticated(Connect(TagList))
23083
23083
  authData={
23084
23084
  Object {
23085
23085
  "app": Object {},
@@ -23125,7 +23125,7 @@ new message content.",
23125
23125
  tags={Array []}
23126
23126
  userLocale="en-US"
23127
23127
  />
23128
- </Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
23128
+ </Connect(UserIsAuthenticated(Connect(TagList)))>
23129
23129
  <CapDrawer
23130
23130
  content={
23131
23131
  <React.Fragment>