@capillarytech/creatives-library 8.0.53 → 8.0.55

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.
Files changed (32) hide show
  1. package/components/FormBuilder/index.js +2 -2
  2. package/components/Sidebar/index.js +22 -16
  3. package/containers/Cap/index.js +6 -1
  4. package/containers/Cap/tests/__snapshots__/index.test.js.snap +1 -0
  5. package/containers/Ebill/index.js +3 -2
  6. package/containers/Email/index.js +3 -2
  7. package/containers/Line/Create/index.js +4 -3
  8. package/containers/Line/Edit/index.js +4 -3
  9. package/containers/MobilePush/Create/index.js +4 -3
  10. package/containers/MobilePush/Edit/index.js +4 -3
  11. package/containers/Sms/Create/index.js +3 -2
  12. package/containers/Sms/Edit/index.js +2 -1
  13. package/containers/Templates/index.js +27 -19
  14. package/containers/WeChat/MapTemplates/index.js +4 -3
  15. package/containers/WeChat/RichmediaTemplates/Create/index.js +3 -3
  16. package/containers/WeChat/RichmediaTemplates/Edit/index.js +2 -1
  17. package/package.json +1 -1
  18. package/routes.js +6 -0
  19. package/translations/en.json +1 -0
  20. package/utils/common.js +12 -0
  21. package/utils/tests/common.test.js +48 -2
  22. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +1 -0
  23. package/v2Containers/EmailWrapper/index.js +13 -2
  24. package/v2Containers/EmailWrapper/messages.js +4 -0
  25. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -0
  26. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -0
  27. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +25 -0
  28. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +18 -0
  29. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +111 -0
  30. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +4 -0
  31. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +8 -0
  32. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +120 -0
@@ -26,6 +26,7 @@ import './_formBuilder.scss';
26
26
  import {updateCharCount, checkUnicode} from "../../utils/smsCharCountV2";
27
27
  import globalMessages from '../../v2Containers/Cap/messages';
28
28
  import messages from './messages';
29
+ import { createQueryString } from '../../utils/common';
29
30
  const TabPane = Tabs.TabPane;
30
31
  const {Column} = Table;
31
32
 
@@ -2001,8 +2002,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2001
2002
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
2002
2003
  this.props.router.push({
2003
2004
  pathname: `/${(this.props.schema.channel || '').toLowerCase()}/`,
2004
- query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module, isLanguageSupport, isEdmSupport},
2005
- });
2005
+ search: createQueryString(type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module, isLanguageSupport, isEdmSupport})})
2006
2006
  } else if (id === "email-language-delete-modal") {
2007
2007
  this.deleteLanguage();
2008
2008
  this.props.handleCancelModal();
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  // import styled from 'styled-components';
4
- import { Accordion, Icon, Input, Button } from 'semantic-ui-react';
4
+ import { Icon, Input, Button, Accordion, AccordionTitle, AccordionContent } from 'semantic-ui-react';
5
5
  import { FormattedMessage } from 'react-intl';
6
6
  import _ from 'lodash';
7
7
  import { Link } from 'react-router-dom';
@@ -41,16 +41,20 @@ class Sidebar extends React.Component { // eslint-disable-line react/prefer-stat
41
41
  return (<Accordion key={keyValue}>{content}</Accordion>);
42
42
  }
43
43
 
44
- getAccordionTitle(title) {
45
- return (<Accordion.Title>
44
+ getAccordionTitle(title,index) {
45
+ return (
46
+ <AccordionTitle
47
+ index={index}
48
+ active={this.state.activeIndex == index}
49
+ onClick={this.handleTitleClick}>
46
50
  <div className="header item">
47
51
  <Icon name="dropdown" /> {title}
48
52
  </div>
49
- </Accordion.Title>);
53
+ </AccordionTitle>);
50
54
  }
51
55
 
52
- getAccordionContent(links, keyValue) {
53
- return (<Accordion.Content key={keyValue}>{links}</Accordion.Content>);
56
+ getAccordionContent(links, index, keyValue) {
57
+ return (<AccordionContent key={keyValue} active={this.state.activeIndex == index}>{links}</AccordionContent>);
54
58
  }
55
59
 
56
60
  getLinkElement(to, text = '', value, isExternal) {
@@ -89,7 +93,10 @@ class Sidebar extends React.Component { // eslint-disable-line react/prefer-stat
89
93
  selectedItem = activeRouteName.toLowerCase();
90
94
  }
91
95
  });
92
- this.setState({ activeIndex: selectedIndex, activeItem: selectedItem });
96
+ this.setState({
97
+ activeIndex: typeof selectedIndex === 'object' ? selectedIndex?.index : selectedIndex,
98
+ activeItem: selectedItem
99
+ });
93
100
  }
94
101
 
95
102
  toggleSideNav(e) {
@@ -104,13 +111,13 @@ class Sidebar extends React.Component { // eslint-disable-line react/prefer-stat
104
111
  });
105
112
  }
106
113
 
107
- createAccordianElements(title, contentItems) {
114
+ createAccordianElements(title, contentItems, index) {
108
115
  const accordian = [];
109
- accordian.push(this.getAccordionTitle(title));
116
+ accordian.push(this.getAccordionTitle(title, index));
110
117
  const contentLink = contentItems.map((key) =>
111
118
  this.getLinkElement(key.link, key.text, key.value, key.external),
112
119
  );
113
- accordian.push(this.getAccordionContent(contentLink));
120
+ accordian.push(this.getAccordionContent(contentLink, index));
114
121
  return accordian;
115
122
  }
116
123
 
@@ -122,14 +129,14 @@ class Sidebar extends React.Component { // eslint-disable-line react/prefer-stat
122
129
  if (isCategory) { // attach nested Accordion
123
130
  const accordian = [];
124
131
  const nestedAcordian = [];
125
- accordian.push(this.getAccordionTitle(headerTitle));
132
+ accordian.push(this.getAccordionTitle(headerTitle, index));
126
133
  const contentAccordian = this.getAccordian(this.createNavigationElement(key.categories), `nestedAccordian-${index}`);
127
134
  nestedAcordian.push(contentAccordian);
128
- const content = this.getAccordionContent(nestedAcordian, `content-${index}`);
135
+ const content = this.getAccordionContent(nestedAcordian, index, `content-${index}`);
129
136
  accordian.push(content);
130
137
  navArray.push(accordian);
131
138
  } else { // attach items to existing accordian
132
- const accordianElem = this.createAccordianElements(headerTitle, key.items);
139
+ const accordianElem = this.createAccordianElements(headerTitle, key.items, index);
133
140
  navArray.push(accordianElem);
134
141
  }
135
142
  });
@@ -159,7 +166,7 @@ class Sidebar extends React.Component { // eslint-disable-line react/prefer-stat
159
166
  }
160
167
 
161
168
  handleTitleClick(e, i) {
162
- this.setState({ activeIndex: this.state.activeIndex === i ? -1 : i });
169
+ this.setState({ activeIndex: this.state.activeIndex === i ? -1 : typeof i === 'object' ? i?.index : i });
163
170
  }
164
171
 
165
172
  handleSearch(e) {
@@ -172,7 +179,6 @@ class Sidebar extends React.Component { // eslint-disable-line react/prefer-stat
172
179
  const push = !visible ? 'push' : '';
173
180
  const collapse = !visible ? 'collapse' : '';
174
181
  const toggle = visible ? 'hide' : '';
175
-
176
182
  // const types = [{ text: 'Creatives', value: 'Creatives' }];
177
183
  return (
178
184
  <div className="sidebar-container">
@@ -186,7 +192,7 @@ class Sidebar extends React.Component { // eslint-disable-line react/prefer-stat
186
192
  <span className="menu-title"><FormattedMessage {...messages.menuTitle} /> </span>
187
193
  {this.props.actionComponents}
188
194
  </div>
189
- <Accordion className="sidebar-accordian" activeIndex={this.state.activeIndex} onTitleClick={this.handleTitleClick}>
195
+ <Accordion className="sidebar-accordian" activeIndex={this.state.activeIndex}>
190
196
  {this.props.menuData && this.createNavigationElement(this.props.menuData)}
191
197
  </Accordion>
192
198
  </div>
@@ -215,7 +215,12 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
215
215
 
216
216
  render() {
217
217
  const userData = this.props.Global;
218
- const { type } = new URLSearchParams(this.props.location.search) || {};
218
+ const { pathname, search, hash } = this.props.location;
219
+ const fullURL = `${window.location.origin}${pathname}${search}${hash}`;
220
+ const url = new URL(fullURL);
221
+ const params = new URLSearchParams(url.search);
222
+ // Extract parameters
223
+ const type = params.get("type");
219
224
  // const changeOrg = this.props.actions.changeOrg;
220
225
  // const logout = this.props.actions.logout;
221
226
  const proxyOrgList = [];
@@ -1237,6 +1237,7 @@ exports[`<Cap /> should render its children 1`] = `
1237
1237
  "creatives.containersV2.EmailWrapper.invalidUploadFileError": "File cannot be uploaded.",
1238
1238
  "creatives.containersV2.EmailWrapper.invalidUploadFileError2": "File upload failed",
1239
1239
  "creatives.containersV2.EmailWrapper.invalidUploadFileErrorDesc2": "Please select another file with valid file contents",
1240
+ "creatives.containersV2.EmailWrapper.invalidUploadFileErrorDesc3": "Please select another file with valid file size less than 5MB",
1240
1241
  "creatives.containersV2.EmailWrapper.upload": "Upload",
1241
1242
  "creatives.containersV2.EmailWrapper.useEditor": "Create using editor",
1242
1243
  "creatives.containersV2.EmailWrapper.useEditorDesc": "Create using in-built template",
@@ -29,6 +29,7 @@ import injectSaga from '../../utils/injectSaga';
29
29
  import injectReducer from '../../utils/injectReducer';
30
30
  import reducer from './reducer';
31
31
  import { ebillSaga } from './sagas';
32
+ import { createQueryString } from '../../utils/common';
32
33
 
33
34
  const BreadcrumbItem = Breadcrumb.Item;
34
35
 
@@ -624,7 +625,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
624
625
  const type = this.props.location.query.type;
625
626
  this.props.router.push({
626
627
  pathname: `/ebill`,
627
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
628
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
628
629
  });
629
630
  }
630
631
 
@@ -768,7 +769,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
768
769
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
769
770
  this.props.router.push({
770
771
  pathname: `/ebill/`,
771
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
772
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
772
773
  });
773
774
  };
774
775
 
@@ -37,6 +37,7 @@ import injectReducer from '../../utils/injectReducer';
37
37
  import reducer from './reducer';
38
38
  import { emailSaga } from './sagas';
39
39
  import { templateSaga } from '../Templates/sagas';
40
+ import { createQueryString } from '../../utils/common';
40
41
 
41
42
  const BreadcrumbItem = Breadcrumb.Item;
42
43
 
@@ -961,7 +962,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
961
962
  const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
962
963
  this.props.router.push({
963
964
  pathname: `/email`,
964
- query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module, isLanguageSupport, isEdmSupport},
965
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module, isLanguageSupport, isEdmSupport})
965
966
  });
966
967
  }
967
968
  if (nextProps.Email.createTemplateError && !_.isEqual(nextProps.Email.createTemplateError, this.props.Email.createTemplateError)) {
@@ -2441,7 +2442,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2441
2442
  const isEdmSupport = this.props.location.query.isEdmSupport !== false || false;
2442
2443
  this.props.router.push({
2443
2444
  pathname: `/email/`,
2444
- query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module, isLanguageSupport, isEdmSupport},
2445
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module, isLanguageSupport, isEdmSupport})
2445
2446
  });
2446
2447
  }
2447
2448
 
@@ -21,6 +21,7 @@ import injectSaga from '../../../utils/injectSaga';
21
21
  import injectReducer from '../../../utils/injectReducer';
22
22
  import reducer from './reducer';
23
23
  import { lineCreateSaga } from './sagas';
24
+ import { createQueryString } from '../../../utils/common';
24
25
 
25
26
  const BreadcrumbItem = Breadcrumb.Item;
26
27
 
@@ -174,7 +175,7 @@ export class Line extends Component {
174
175
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
175
176
  this.props.router.push({
176
177
  pathname: `/line/`,
177
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
178
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
178
179
  });
179
180
  }
180
181
 
@@ -202,7 +203,7 @@ export class Line extends Component {
202
203
  const type = this.props.location.query.type;
203
204
  this.props.router.push({
204
205
  pathname: `/line/`,
205
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
206
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
206
207
  });
207
208
  }
208
209
 
@@ -417,7 +418,7 @@ export class Line extends Component {
417
418
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
418
419
  this.props.router.push({
419
420
  pathname: `/LINE/`,
420
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
421
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
421
422
  });
422
423
  };
423
424
 
@@ -24,6 +24,7 @@ import * as templatesActions from "../../Templates/actions";
24
24
  import {makeSelectTemplates} from "../../Templates/selectors";
25
25
  import messages from './messages';
26
26
  import './_lineEdit.scss';
27
+ import { createQueryString } from '../../../utils/common';
27
28
  const BreadcrumbItem = Breadcrumb.Item;
28
29
 
29
30
  export class Edit extends React.Component { // eslint-disable-line react/prefer-stateless-function
@@ -91,7 +92,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
91
92
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
92
93
  this.props.router.push({
93
94
  pathname: `/line/`,
94
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
95
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
95
96
  });
96
97
  } else {
97
98
  const query = {
@@ -190,7 +191,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
190
191
  const type = this.props.location.query.type;
191
192
  this.props.router.push({
192
193
  pathname: `/line/`,
193
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
194
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
194
195
  });
195
196
  }
196
197
 
@@ -891,7 +892,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
891
892
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
892
893
  this.props.router.push({
893
894
  pathname: `/line/`,
894
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
895
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
895
896
  });
896
897
  };
897
898
 
@@ -27,6 +27,7 @@ import injectSaga from '../../../utils/injectSaga';
27
27
  import reducer from './reducer';
28
28
  import { createMPushSaga } from './sagas';
29
29
  import { UserIsAuthenticated } from '../../../utils/authWrapper';
30
+ import { createQueryString } from '../../../utils/common';
30
31
 
31
32
  const BreadcrumbItem = Breadcrumb.Item;
32
33
  export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
@@ -182,7 +183,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
182
183
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
183
184
  this.props.router.push({
184
185
  pathname: `/MOBILEPUSH/`,
185
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
186
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
186
187
  });
187
188
  }
188
189
  this.props.globalActions.removeEntitySchema();
@@ -226,7 +227,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
226
227
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
227
228
  this.props.router.push({
228
229
  pathname: `/mobilepush/`,
229
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
230
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
230
231
  });
231
232
  }
232
233
  if (nextProps.params.mode) {
@@ -775,7 +776,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
775
776
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
776
777
  this.props.router.push({
777
778
  pathname: `/MOBILEPUSH/`,
778
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
779
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
779
780
  });
780
781
  };
781
782
 
@@ -31,6 +31,7 @@ import reducer from './reducer';
31
31
  import { editMPushSaga } from './sagas';
32
32
  import { templateSaga } from '../../Templates/sagas';
33
33
  import { UserIsAuthenticated } from '../../../utils/authWrapper';
34
+ import { createQueryString } from '../../../utils/common';
34
35
 
35
36
  const BreadcrumbItem = Breadcrumb.Item;
36
37
 
@@ -175,7 +176,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
175
176
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
176
177
  this.props.router.push({
177
178
  pathname: `/mobilepush/`,
178
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
179
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
179
180
  });
180
181
  } else {
181
182
  const query = {
@@ -278,7 +279,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
278
279
  const type = this.props.location.query.type;
279
280
  this.props.router.push({
280
281
  pathname: `/mobilepush/`,
281
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
282
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
282
283
  });
283
284
  }
284
285
 
@@ -1864,7 +1865,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1864
1865
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
1865
1866
  this.props.router.push({
1866
1867
  pathname: `/mobilepush/`,
1867
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
1868
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
1868
1869
  });
1869
1870
  };
1870
1871
 
@@ -27,6 +27,7 @@ import injectSaga from '../../../utils/injectSaga';
27
27
  import injectReducer from '../../../utils/injectReducer';
28
28
  import reducer from './reducer';
29
29
  import { createSmsSaga } from './sagas';
30
+ import { createQueryString } from '../../../utils/common';
30
31
 
31
32
  export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
32
33
  constructor(props) {
@@ -142,7 +143,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
142
143
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
143
144
  this.props.router.push({
144
145
  pathname: `/sms/`,
145
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
146
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
146
147
  });
147
148
  }
148
149
 
@@ -357,7 +358,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
357
358
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
358
359
  this.props.router.push({
359
360
  pathname: `/sms/`,
360
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
361
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
361
362
  });
362
363
  }
363
364
 
@@ -28,6 +28,7 @@ import injectSaga from '../../../utils/injectSaga';
28
28
  import injectReducer from '../../../utils/injectReducer';
29
29
  import reducer from './reducer';
30
30
  import { editSmsSaga } from './sagas';
31
+ import { createQueryString } from '../../../utils/common';
31
32
  export class Edit extends React.Component { // eslint-disable-line react/prefer-stateless-function
32
33
  constructor(props) {
33
34
  super(props);
@@ -164,7 +165,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
164
165
  const type = this.props.location.query.type;
165
166
  this.props.router.push({
166
167
  pathname: `/sms/`,
167
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
168
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
168
169
  });
169
170
  }
170
171
 
@@ -105,6 +105,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
105
105
  this.onAccountSelect = this.onAccountSelect.bind(this);
106
106
  this.prepareMobilePushPreviewData = this.prepareMobilePushPreviewData.bind(this);
107
107
  this.menuOnClickEvent = this.menuOnClickEvent.bind(this);
108
+ console.log("this.props.location",this.props.location);
108
109
  }
109
110
 
110
111
  componentWillMount() {
@@ -330,7 +331,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
330
331
  }
331
332
  this.props.router.push({
332
333
  pathname: `/${(nextProps.route.name || '').toLowerCase()}/create`,
333
- query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module},
334
+ search: commonUtil.createQueryString(type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module}),
334
335
  });
335
336
  }
336
337
 
@@ -478,34 +479,34 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
478
479
  const isLanguageSupport = this.props.location.query.isLanguageSupport || false;
479
480
  this.props.router.push({
480
481
  pathname: `/email/view`,
481
- query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport} : {},
482
+ search: commonUtil.createQueryString(type === 'embedded' ? {type: 'embedded', module, isLanguageSupport} : {})
482
483
  });
483
484
  } else if (this.state.channel.toLowerCase() === 'sms') {
484
485
  this.props.router.push({
485
486
  pathname: `/sms/view`,
486
- query: type === 'embedded' ? {type: 'embedded', module} : {},
487
+ search: commonUtil.createQueryString(type === 'embedded' ? {type: 'embedded', module} : {})
487
488
  });
488
489
  } else if (this.state.channel.toLowerCase() === 'mobilepush') {
489
490
  this.props.router.push({
490
491
  pathname: `/mobilepush/edit/${e.template_id}`,
491
- query: type === 'embedded' ? {type: 'embedded', module, account_id: e.account_id} : {},
492
+ search: commonUtil.createQueryString(type === 'embedded' ? {type: 'embedded', module, account_id: e.account_id} : {})
492
493
  });
493
494
  } else if (this.state.channel.toLowerCase() === 'wechat') {
494
495
  if (e.template_type && e.template_type === 'RICHMEDIA_WECHAT_TEMPLATE') {
495
496
  this.props.router.push({
496
497
  pathname: `/wechat/richmedia/edit/${e.template_id}`,
497
- query: type === 'embedded' ? {type: 'embedded', module, source_account_id: e.source_account_id} : {},
498
+ search: commonUtil.createQueryString(type === 'embedded' ? {type: 'embedded', module, source_account_id: e.source_account_id} : {})
498
499
  });
499
500
  } else {
500
501
  this.props.router.push({
501
502
  pathname: `/wechat/edit/${e.template_id}`,
502
- query: type === 'embedded' ? {type: 'embedded', module, source_account_id: e.source_account_id} : {},
503
+ search: commonUtil.createQueryString(type === 'embedded' ? {type: 'embedded', module, source_account_id: e.source_account_id} : {})
503
504
  });
504
505
  }
505
506
  } else if (this.state.channel.toLowerCase() === 'line') {
506
507
  this.props.router.push({
507
508
  pathname: `/line/view/${e.msg_type}/`,
508
- query: type === 'embedded' ? {type: 'embedded', module, account_id: e.account_id } : {},
509
+ search: commonUtil.createQueryString(type === 'embedded' ? {type: 'embedded', module, account_id: e.account_id } : {})
509
510
  });
510
511
  }
511
512
  this.setState({loading: true});
@@ -534,12 +535,12 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
534
535
  } else if (item === 'textTemplate') {
535
536
  this.props.router.push({
536
537
  pathname: `/${channel === 'line' ? 'line' : 'mobilepush'}/create/text`,
537
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
538
+ search: commonUtil.createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module},)
538
539
  });
539
540
  } else if (item === 'imageTemplate') {
540
541
  this.props.router.push({
541
542
  pathname: `/${channel === 'line' ? 'line' : 'mobilepush'}/create/image`,
542
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
543
+ search: commonUtil.createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
543
544
  });
544
545
  }
545
546
  }
@@ -572,7 +573,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
572
573
  }
573
574
  this.props.router.push({
574
575
  pathname: `/${this.props.route.name.toLowerCase()}/create`,
575
- query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module},
576
+ search: commonUtil.createQueryString(type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module}),
576
577
  });
577
578
  };
578
579
  reader.readAsText(files[0]);
@@ -748,21 +749,23 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
748
749
  };
749
750
 
750
751
  createTemplate(ev) {
752
+
751
753
  const type = this.props.location.query.type;
752
754
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
753
755
  const channel = this.state.channel.toLowerCase();
756
+ console.log('createTemplate for channel', channel, type, module);
754
757
  //const keyType = ev.key && ev.key.toLowerCase() !== undefined ? ev.state.toLowerCase() : '';
755
758
  if (this.isEnabledInLibraryModule("callCreateFromProps")) {
756
759
  this.props.createNew();
757
760
  } else if (ev.key && (ev.key.toLowerCase() === "text" || ev.key.toLowerCase() === "image")) {
758
761
  this.props.router.push({
759
762
  pathname: `/${channel === 'line' ? 'line' : 'mobilepush'}/create/${ev.key.toLowerCase()}`,
760
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
763
+ search: commonUtil.createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module}),
761
764
  });
762
765
  } else {
763
766
  this.props.router.push({
764
767
  pathname: `/${this.state.channel.toLowerCase()}/create`,
765
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
768
+ search: commonUtil.createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module}),
766
769
  });
767
770
  }
768
771
  }
@@ -776,7 +779,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
776
779
  type = this.props.location.query.type;
777
780
  this.props.router.push({
778
781
  pathname: `/wechat/create`,
779
- query: type === 'embedded' ? {type: 'embedded'} : {},
782
+ search: commonUtil.createQueryString(type === 'embedded' ? {type: 'embedded'} : {}),
780
783
  });
781
784
  } else if (ev && ev.key && ev.key.toLowerCase() === "richmedia_template") {
782
785
  type = this.props.location.query.type;
@@ -785,10 +788,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
785
788
  const message = getMessageObject('error', errorMessage, true);
786
789
  this.props.globalActions.addMessageToQueue(message);
787
790
  } else {
788
- this.props.router.push({
789
- pathname: `/wechat/richmedia/create`,
790
- query: type === 'embedded' ? {type: 'embedded'} : {},
791
- });
791
+ this.props.router.push(`/wechat/richmedia/create?type=embedded`);
792
792
  }
793
793
  }
794
794
  break;
@@ -933,9 +933,15 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
933
933
  this.props.createNew();
934
934
  return;
935
935
  }
936
+ console.log('line 939getQuery', getQuery,this.props.router);
937
+
938
+ const queryParams = commonUtil.createQueryString(getQuery);
939
+ console.log('line 952 queryParams', queryParams);
940
+ // this.props.router.push(`${pathName}${queryParams}`);
941
+
936
942
  this.props.router.push({
937
943
  pathname: `/${this.state.channel.toLowerCase()}/create`,
938
- query: getQuery,
944
+ search: getQuery,
939
945
  });
940
946
  }
941
947
  };
@@ -981,9 +987,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
981
987
  if (this.state.channel.toLowerCase() === 'ebill') {
982
988
  pathName = `/ebill/edit/${id}`;
983
989
  }
990
+ //getQuery
991
+ console.log('getQuery', getQuery, pathName,this.props.router);
984
992
  this.props.router.push({
985
993
  pathname: pathName,
986
- query: getQuery,
994
+ search: commonUtil.createQueryString(getQuery),
987
995
  });
988
996
  }
989
997
  }
@@ -33,6 +33,7 @@ import injectReducer from '../../../utils/injectReducer';
33
33
  import reducer from './reducer';
34
34
  import { mapTemplatesSaga } from './sagas';
35
35
  import { templateSaga } from '../../Templates/sagas';
36
+ import { createQueryString } from '../../../utils/common';
36
37
 
37
38
  // const Option = Select.Option;
38
39
  const URL = "URL";
@@ -175,7 +176,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
175
176
  const type = this.props.location.query.type;
176
177
  this.props.router.push({
177
178
  pathname: `/wechat`,
178
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
179
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
179
180
  });
180
181
  }
181
182
  }
@@ -274,7 +275,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
274
275
  const type = this.props.location.query.type;
275
276
  this.props.router.push({
276
277
  pathname: `/wechat`,
277
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
278
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
278
279
  });
279
280
  }
280
281
  if (nextProps.WeChat.createTemplateError && !_.isEqual(nextProps.WeChat.createTemplateError, this.props.WeChat.createTemplateError)) {
@@ -1260,7 +1261,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
1260
1261
  const type = this.props.location.query.type;
1261
1262
  this.props.router.push({
1262
1263
  pathname: `/wechat`,
1263
- query: type === 'embedded' ? {type: 'embedded'} : {},
1264
+ search : createQueryString(type === 'embedded' ? {type: 'embedded'} : {})
1264
1265
  });
1265
1266
  }
1266
1267
 
@@ -30,6 +30,7 @@ import injectReducer from '../../../../utils/injectReducer';
30
30
  import reducer from './reducer';
31
31
  import { richMediaTemplatesSaga } from './sagas';
32
32
  import { UserIsAuthenticated } from '../../../../utils/authWrapper';
33
+ import { createQueryString } from '../../../../utils/common';
33
34
 
34
35
  const MenuItem = Menu.Item;
35
36
  export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
@@ -142,8 +143,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
142
143
  const type = this.props.location.query.type;
143
144
  this.props.router.push({
144
145
  pathname: `/wechat`,
145
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
146
- });
146
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module}) });
147
147
  }
148
148
  }
149
149
  componentDidMount = () => {
@@ -452,7 +452,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
452
452
  const type = this.props.location.query.type;
453
453
  this.props.router.push({
454
454
  pathname: `/wechat`,
455
- query: type === 'embedded' ? {type: 'embedded'} : {},
455
+ search : createQueryString(type === 'embedded' ? {type: 'embedded'} : {})
456
456
  });
457
457
  }
458
458
  closeSlideBox = () => {
@@ -20,6 +20,7 @@ import reducer from './reducer';
20
20
  import createReducer from '../Create/reducer';
21
21
  import { richMediaTemplatesEditSaga } from './sagas';
22
22
  import { richMediaTemplatesSaga } from '../Create/sagas';
23
+ import { createQueryString } from '../../../../utils/common';
23
24
 
24
25
  export class Edit extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
25
26
  constructor(props) {
@@ -36,7 +37,7 @@ export class Edit extends React.PureComponent { // eslint-disable-line react/pre
36
37
  const type = this.props.location.query.type;
37
38
  this.props.router.push({
38
39
  pathname: `/wechat`,
39
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
40
+ search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
40
41
  });
41
42
  }
42
43
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.53",
4
+ "version": "8.0.55",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",