@capillarytech/creatives-library 3.9.21 → 3.10.0

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 (85) hide show
  1. package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +7 -7
  2. package/components/TemplatePreview/_templatePreview.scss +20 -287
  3. package/components/TemplatePreview/index.js +31 -203
  4. package/components/TemplatePreview/messages.js +0 -21
  5. package/containers/Assets/Gallery/index.js +59 -53
  6. package/containers/Cap/index.js +0 -1
  7. package/index.js +0 -6
  8. package/package.json +1 -1
  9. package/routes.js +0 -5
  10. package/services/getSchema.js +1 -4
  11. package/translations/en.json +1 -29
  12. package/translations/zh.json +1 -29
  13. package/v2Components/FormBuilder/index.js +37 -188
  14. package/v2Components/FormBuilder/messages.js +0 -16
  15. package/v2Components/MobilePushPreviewV2/index.js +36 -44
  16. package/v2Components/MobilePushPreviewV2/messages.js +8 -0
  17. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +0 -64
  18. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +18 -100
  19. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +0 -12
  20. package/v2Components/TemplatePreview/_templatePreview.scss +4 -24
  21. package/v2Components/TemplatePreview/index.js +23 -162
  22. package/v2Components/TemplatePreview/messages.js +0 -8
  23. package/v2Containers/Assets/Gallery/index.js +48 -54
  24. package/v2Containers/CreativesContainer/SlideBoxContent.js +4 -87
  25. package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -1
  26. package/v2Containers/CreativesContainer/index.js +2 -58
  27. package/v2Containers/CreativesContainer/messages.js +2 -2
  28. package/v2Containers/Email/_email.scss +1 -7
  29. package/v2Containers/Email/index.js +14 -40
  30. package/v2Containers/Email/messages.js +0 -4
  31. package/v2Containers/Email/reducer.js +0 -1
  32. package/v2Containers/EmailWrapper/index.js +5 -7
  33. package/v2Containers/Line/Create/_lineCreate.scss +19 -40
  34. package/v2Containers/Line/Create/actions.js +9 -13
  35. package/v2Containers/Line/Create/index.js +237 -498
  36. package/v2Containers/Line/Create/messages.js +2 -42
  37. package/v2Containers/Line/Create/sagas.js +4 -10
  38. package/v2Containers/Line/Create/selectors.js +9 -3
  39. package/v2Containers/MobilePush/Create/index.js +0 -5
  40. package/v2Containers/MobilePush/Edit/index.js +0 -5
  41. package/v2Containers/MobilepushWrapper/index.js +1 -4
  42. package/v2Containers/Sms/Create/index.js +1 -2
  43. package/v2Containers/Sms/Edit/index.js +0 -2
  44. package/v2Containers/Templates/_templates.scss +1 -24
  45. package/v2Containers/Templates/actions.js +0 -7
  46. package/v2Containers/Templates/constants.js +0 -2
  47. package/v2Containers/Templates/index.js +15 -118
  48. package/v2Containers/Templates/messages.js +0 -8
  49. package/v2Containers/Templates/reducer.js +0 -2
  50. package/v2Containers/TemplatesV2/index.js +4 -5
  51. package/v2Containers/TemplatesV2/messages.js +0 -4
  52. package/assets/IPad.js +0 -23
  53. package/assets/index.js +0 -1
  54. package/assets/lineImageTemplate.png +0 -0
  55. package/components/TemplatePreview/assets/images/HomeScreenAndroid.js +0 -53
  56. package/components/TemplatePreview/assets/images/SmsMobileAndroid.js +0 -52
  57. package/components/TemplatePreview/assets/images/SmsMobileIos.js +0 -71
  58. package/components/TemplatePreview/assets/images/UserIcon.js +0 -24
  59. package/components/TemplatePreview/assets/images/WechatMobileAndroid.js +0 -53
  60. package/components/TemplatePreview/assets/images/home-screen-android.svg +0 -21
  61. package/components/TemplatePreview/assets/images/home-screen-ios.svg +0 -16
  62. package/components/TemplatePreview/assets/images/sms_mobile_android.svg +0 -22
  63. package/components/TemplatePreview/assets/images/sms_mobile_ios.svg +0 -16
  64. package/components/TemplatePreview/assets/images/wechat_mobile_android.svg +0 -20
  65. package/v2Components/TemplatePreview/assets/images/HomeScreenAndroid.js +0 -53
  66. package/v2Components/TemplatePreview/assets/images/SmsMobileAndroid.js +0 -52
  67. package/v2Components/TemplatePreview/assets/images/UserIcon.js +0 -24
  68. package/v2Components/TemplatePreview/assets/images/WechatHomeScreenAndroid.js +0 -74
  69. package/v2Components/TemplatePreview/assets/images/WechatMobileAndroid.js +0 -53
  70. package/v2Components/TemplatePreview/assets/images/home-screen-android.svg +0 -21
  71. package/v2Components/TemplatePreview/assets/images/home-screen-ios.svg +0 -16
  72. package/v2Components/TemplatePreview/assets/images/sms_mobile_android.svg +0 -22
  73. package/v2Components/TemplatePreview/assets/images/wechat-home-screen-android.svg +0 -21
  74. package/v2Components/TemplatePreview/assets/images/wechat_mobile_android.svg +0 -20
  75. package/v2Containers/Assets/images/CalltaskIllustration.js +0 -71
  76. package/v2Containers/Assets/images/EmailIllustration.js +0 -87
  77. package/v2Containers/Assets/images/ImageGalleryIllustration.js +0 -60
  78. package/v2Containers/Assets/images/PushIllustration.js +0 -60
  79. package/v2Containers/Assets/images/SmsIllustration.js +0 -191
  80. package/v2Containers/Assets/images/WechatIllustration.js +0 -90
  81. package/v2Containers/Assets/images/index.js +0 -6
  82. package/v2Containers/Line/Create/initialSchema.js +0 -378
  83. package/v2Containers/Line/CreateWrapper/constants.js +0 -2
  84. package/v2Containers/Line/CreateWrapper/index.js +0 -117
  85. package/v2Containers/Line/CreateWrapper/messages.js +0 -55
@@ -1,66 +1,62 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { Component } from 'react';
3
- import get from 'lodash/get';
4
- import set from 'lodash/set';
5
3
  import { bindActionCreators } from 'redux';
6
4
  import { intlShape } from 'react-intl';
7
5
  import { createStructuredSelector } from 'reselect';
6
+ import { Row, Col, Spin, Breadcrumb } from 'antd';
8
7
  import _ from 'lodash';
9
- import { CapSpin, CapHeading, CapRow, CapColumn } from '@capillarytech/cap-ui-library';
10
8
  import messages from './messages';
11
9
  import * as actions from './actions';
12
- import Gallery from '../../Assets/Gallery';
13
10
  import FormBuilder from '../../../v2Components/FormBuilder';
14
11
  //import { makeSelectCreate, makeSelectCreateResponse, makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse } from './selectors';
15
- import {makeSelectCreateLine, makeSelectLine} from './selectors';
12
+ import {makeSelectCreateLine} from './selectors';
16
13
  import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
17
14
  import {getMessageObject} from '../../../utils/messageUtils';
18
15
  import { makeSelectTemplates } from '../../Templates/selectors';
19
16
  import './_lineCreate.scss';
20
17
  import withCreatives from '../../../hoc/withCreatives';
21
18
 
19
+ const BreadcrumbItem = Breadcrumb.Item;
20
+
22
21
  export class Line extends Component {
22
+
23
23
  constructor(props) {
24
24
  super(props);
25
25
  const map = {
26
- 'save-button': {
26
+ "save-button": {
27
27
  saveFormData: this.saveFormData,
28
28
  },
29
- 'template-name': {
29
+ "template-name": {
30
30
  onChange: this.onTemplateNameChange,
31
31
  },
32
- 'discard-button': {
32
+ "discard-button": {
33
33
  discardValues: this.discardValues,
34
34
  },
35
- 'message-editor': {
35
+ "cancel-button": {
36
+ cancelTemplate: this.cancelTemplate,
37
+ },
38
+ "message-editor": {
36
39
  onChange: this.onTemplateContentChange,
37
40
  },
38
- 'message-editor2': {
41
+ "message-editor2": {
39
42
  onChange: this.onTemplateContentChange,
40
43
  },
41
- 'message-tagList': {
44
+ "message-tagList": {
42
45
  onTagSelect: this.onTagSelect,
43
46
  },
44
- 'title-tagList': {
47
+ "title-tagList": {
45
48
  onTagSelect: this.onTagSelectTitle,
46
49
  },
47
- 'pane': {
50
+ "pane": {
48
51
  onTabChange: this.onTabChange,
49
52
  },
50
- 'line-template': {
53
+ "line-template": {
51
54
  onSelect: this.onTemplateChange,
52
55
  },
53
- 'image-upload-line': {
56
+ "image-upload-line": {
54
57
  onUpload: this.uploadImage,
55
58
  },
56
- 'tagList': {
57
- onTagSelect: this.onTagSelect,
58
- },
59
- 'line-editor': {
60
- onChange: this.onTemplateContentChange,
61
- },
62
59
  };
63
-
64
60
  this.state = {
65
61
  schema: {},
66
62
  isSchemaChanged: false,
@@ -74,21 +70,13 @@ export class Line extends Component {
74
70
  eventsMap: map,
75
71
  errorData: {},
76
72
  displayProps: {},
77
- modalContent: {
78
- title: this.props.intl.formatMessage(messages.alertMessage),
79
- body: this.props.intl.formatMessage(
80
- messages.templateNotConfigured
81
- ),
82
- type: 'confirm',
83
- },
73
+ modalContent: {title: this.props.intl.formatMessage(messages.alertMessage), body: this.props.intl.formatMessage(messages.templateNotConfigured), type: 'confirm'},
84
74
  injectedTags: {},
85
75
  isEdit: false,
86
76
  isEdited: false,
87
77
  editTemplateData: {},
88
78
  isReady: false,
89
79
  modeType: null,
90
- isDrawerRequired: false,
91
- startValidation: false,
92
80
  };
93
81
  }
94
82
 
@@ -96,7 +84,7 @@ export class Line extends Component {
96
84
  if (this.props.params.id) {
97
85
  const editTemplateId = this.props.params.id;
98
86
  this.props.actions.getTemplateDetails(editTemplateId, 'LINE');
99
- this.setState({ isEdit: true });
87
+ this.setState({isEdit: true});
100
88
  }
101
89
  }
102
90
 
@@ -104,60 +92,47 @@ export class Line extends Component {
104
92
  const getSchemaQuery = {
105
93
  layout: 'LINE',
106
94
  type: 'LAYOUT',
107
- version: 'v2',
108
95
  };
109
96
  this.props.globalActions.fetchSchemaForEntity(getSchemaQuery);
97
+ const type = this.props.location.query.type;
98
+ const name = this.props.route.name;
99
+ window.addEventListener("message", this.handleFrameTasks);
100
+ if (type === 'embedded') {
101
+ const response = {
102
+ action: 'startTemplateCreation',
103
+ window: name === 'view' ? 'view' : '',
104
+ };
105
+ parent.postMessage(JSON.stringify(response), '*');
106
+ }
110
107
  }
111
108
 
112
109
  componentWillReceiveProps(nextProps) {
110
+ console.log("nextProps line @@@", nextProps);
111
+
113
112
  //// Create template logic ////
114
113
 
115
114
  let modeType;
116
- const { layouts, tags } = nextProps.metaEntities;
117
- const isSchemaReady = layouts !== undefined && layouts.length > 0;
115
+ const {layouts, tags} = nextProps.metaEntities;
116
+ const isSchemaReady = (layouts !== undefined && layouts.length > 0);
118
117
  const editModeType = nextProps.route.name;
119
- if (
120
- nextProps.params.mode === 'text' ||
121
- nextProps.route.name === 'edit_text'
122
- ) {
118
+ if (nextProps.params.mode === 'text' || nextProps.route.name === 'edit_text') {
123
119
  modeType = 'text';
124
120
  } else {
125
121
  modeType = 'image';
126
122
  }
127
123
  if (modeType) {
128
- this.setState({ modeType, schema: {} });
129
- }
130
- const {
131
- isGetFormData,
132
- templateData,
133
- } = nextProps;
134
- if (isGetFormData) {
135
- const {
136
- lineData,
137
- getFormSubscriptionData,
138
- } = nextProps;
139
- let selectedAccount = {};
140
- if (lineData) {
141
- const {
142
- weCrmAccounts = [],
143
- } = lineData;
144
- selectedAccount = weCrmAccounts.filter((account) => account === selectedAccount);
145
- }
146
- getFormSubscriptionData({ ...this.getFormData(), accountDetails: selectedAccount, type: 'LINE' });
124
+ this.setState({modeType, schema: {}});
125
+ //console.log("ooo", this.state.schema);
147
126
  }
148
- if (templateData && templateData.edit) {
149
- this.setEditState(templateData);
127
+ if (nextProps.isGetFormData) {
128
+ nextProps.getFormLibraryData(this.getFormData());
150
129
  }
151
130
  if (isSchemaReady) {
152
131
  // set schema value as per mode type. Supported mode (text & image)
153
- const { textSchema, imageSchema } = this.updateSchemaWithLabels(
154
- layouts[0].definition
155
- );
156
- const schema =
157
- modeType === 'text' || editModeType === 'edit_text'
158
- ? textSchema
159
- : imageSchema;
160
- this.setState({ schema }, () => {
132
+ console.log("modeType", this.state.modeType);
133
+ const {textSchema, imageSchema} = layouts[0].definition;
134
+ const schema = (modeType === "text" || editModeType === 'edit_text') ? textSchema : imageSchema;
135
+ this.setState({schema}, () => {
161
136
  // Once schema is ready and set, then inject the available events from the schema
162
137
  if (!_.isEmpty(this.state.schema)) {
163
138
  this.injectEvents(this.state.schema);
@@ -166,188 +141,118 @@ export class Line extends Component {
166
141
  const getTagsQuery = {
167
142
  layout: 'LINE',
168
143
  type: 'TAG',
169
- context:
170
- this.props.location.query.type === 'embedded'
171
- ? 'outbound'
172
- : 'default',
173
- embedded:
174
- this.props.location.query.type === 'embedded'
175
- ? this.props.location.query.type
176
- : 'full',
144
+ context: 'outbound',
145
+ embedded: this.props.location.query.type === 'embedded' ? this.props.location.query.type : 'full',
177
146
  };
178
147
  if (this.props.getDefaultTags) {
179
148
  getTagsQuery.context = this.props.getDefaultTags;
180
149
  }
181
- if (!Object.keys(tags || {}).length && modeType !== 'image') {
150
+ if (tags === undefined && modeType !== 'image') {
182
151
  this.props.globalActions.fetchSchemaForEntity(getTagsQuery);
183
152
  } else {
184
- this.setState({ isReady: true });
153
+ this.setState({isReady: true});
154
+ }
155
+ if (this.props.location.query.type === 'embedded') {
156
+ this.showNext();
185
157
  }
186
158
  });
187
159
  }
188
160
 
189
- const lineTemplateId = get(nextProps, 'Line.response.templateId', '');
190
- if (lineTemplateId) {
161
+ if ( nextProps.Line && (nextProps.Line.response && nextProps.Line.response.templateId) ) {
162
+ console.log('create response', nextProps.Line);
191
163
  this.discardValues();
192
- const message = getMessageObject(
193
- 'success',
194
- this.props.intl.formatMessage(
195
- messages.lineTemplateCreatedSuccessfully
196
- ),
197
- true
198
- );
164
+ const message = getMessageObject('success', this.props.intl.formatMessage(messages["Line Template Created Successfully"]), true);
199
165
  this.props.globalActions.addMessageToQueue(message);
200
166
  this.props.actions.clearCreateResponse();
167
+ const type = this.props.location.query.type;
168
+ const module = this.props.location.query.module ? this.props.location.query.module : 'default';
169
+ this.props.router.push({
170
+ pathname: `/line/`,
171
+ query: type === 'embedded' ? {type: 'embedded', module} : {module},
172
+ });
201
173
  }
202
174
 
203
- if (
204
- nextProps.Line.createTemplateError &&
205
- !_.isEqual(
206
- nextProps.Line.createTemplateError,
207
- this.props.Line.createTemplateError
208
- )
209
- ) {
210
- const {
211
- Line: {
212
- createTemplateErrorMessage,
213
- },
214
- } = nextProps;
215
- const message = getMessageObject(
216
- 'error',
217
- createTemplateErrorMessage || this.props.intl.formatMessage(messages.somethingWentWrong),
218
- true
219
- );
175
+ if (nextProps.Line.createTemplateError && !_.isEqual(nextProps.Line.createTemplateError, this.props.Line.createTemplateError)) {
176
+ const message = getMessageObject('error', (nextProps.Line.createTemplateErrorMessage && nextProps.Line.createTemplateErrorMessage !== '') ? nextProps.Line.createTemplateErrorMessage : this.props.intl.formatMessage(messages.somethingWentWrong), true);
220
177
  this.props.globalActions.addMessageToQueue(message);
221
178
  }
222
179
 
223
180
  //// Edit Template Logic ////
224
- const isEdit =
225
- this.state.isEdit &&
226
- this.props.params.id &&
227
- (this.props.route.name === 'edit_text' ||
228
- this.props.route.name === 'edit_image') &&
229
- this.props.Line.templateDetails &&
230
- this.props.Line.templateDetails.versions;
181
+
182
+ const isEdit = this.state.isEdit && this.props.params.id && (this.props.route.name === 'edit_text' || this.props.route.name === 'edit_image') && this.props.Line.templateDetails && this.props.Line.templateDetails.versions;
231
183
  if (isEdit) {
232
- const formData = this.getEditTransformedData(
233
- this.props.Line.templateDetails
234
- );
235
- this.setState({
236
- formData,
237
- editTemplateData: this.props.Line.templateDetails,
238
- });
184
+ const formData = this.getEditTransformedData(this.props.Line.templateDetails);
185
+ this.setState({formData, editTemplateData: this.props.Line.templateDetails});
239
186
  this.props.actions.clearData();
240
187
  }
241
188
 
242
- if (
243
- nextProps.Line.editTemplateError &&
244
- !_.isEqual(
245
- nextProps.Line.editTemplateError,
246
- this.props.Line.editTemplateError
247
- )
248
- ) {
249
- const message = getMessageObject(
250
- 'error',
251
- nextProps.Line.editTemplateErrorMessage &&
252
- nextProps.Line.editTemplateErrorMessage !== ''
253
- ? nextProps.Line.editTemplateErrorMessage
254
- : this.props.intl.formatMessage(messages.somethingWentWrong),
255
- true
256
- );
189
+ const isEditSucceed = (this.state.isEdit && nextProps.Line && nextProps.Line.editResponse && nextProps.Line.editResponse.templateId);
190
+ if (isEditSucceed) {
191
+ this.setState({formData: {} });
192
+ const message = getMessageObject('success', this.props.intl.formatMessage(messages['Line Template Edited Successfully']), true);
257
193
  this.props.globalActions.addMessageToQueue(message);
194
+ this.props.actions.clearEditResponse();
195
+ const module = this.props.location.query.module ? this.props.location.query.module : 'default';
196
+ const type = this.props.location.query.type;
197
+ this.props.router.push({
198
+ pathname: `/line/`,
199
+ query: type === 'embedded' ? {type: 'embedded', module} : {module},
200
+ });
258
201
  }
259
202
 
260
- if (
261
- nextProps.Line.uploadAssetSuccess &&
262
- nextProps.Line.uploadedAssetData
263
- ) {
203
+ if (nextProps.Line.editTemplateError && !_.isEqual(nextProps.Line.editTemplateError, this.props.Line.editTemplateError)) {
204
+ const message = getMessageObject('error', (nextProps.Line.editTemplateErrorMessage && nextProps.Line.editTemplateErrorMessage !== '') ? nextProps.Line.editTemplateErrorMessage : this.props.intl.formatMessage(messages.somethingWentWrong), true);
205
+ this.props.globalActions.addMessageToQueue(message);
206
+ }
207
+
208
+ if (nextProps.Line.uploadAssetSuccess && nextProps.Line.uploadedAssetData) {
264
209
  const formData = _.cloneDeep(this.state.formData);
265
210
  // TODO: if multiple image upload supports, change below accordingly.
266
- formData[this.state.currentTab - 1].image =
267
- nextProps.Line.uploadedAssetData.metaInfo.secure_file_path;
268
- formData[this.state.currentTab - 1].imagePreview =
269
- nextProps.Line.uploadedAssetData.metaInfo.secure_file_path_preview;
270
- this.setState({ formData });
211
+ formData[this.state.currentTab - 1].image = nextProps.Line.uploadedAssetData.metaInfo.secure_file_path;
212
+ formData[this.state.currentTab - 1].imagePreview = nextProps.Line.uploadedAssetData.metaInfo.secure_file_path_preview;
213
+ console.log("before 2", formData[this.state.currentTab - 1].image);
214
+ this.setState({formData});
215
+ console.log("ooo", this.state.formData);
271
216
  this.props.actions.clearAsset();
272
217
  }
273
218
  }
274
219
 
275
- setEditSuccessMessage = () => {
276
- this.setState({ formData: {} });
277
- const message = getMessageObject(
278
- 'success',
279
- this.props.intl.formatMessage(
280
- messages['Line Template Edited Successfully']
281
- ),
282
- true
283
- );
284
- this.props.globalActions.addMessageToQueue(message);
285
- this.props.actions.clearEditResponse();
286
- }
287
-
288
- setEditState = (data) => {
289
- const { formData: previousFormData } = this.state;
290
- const { text, originalContentUrl, imagePreview, image } = get(data, "versions.base.content.messages[0]", {});
291
- const retrievedData = {
292
- ...previousFormData[0],
293
- };
294
- if (text) {
295
- retrievedData["message-editor"] = text;
296
- }
297
- const lineImage = originalContentUrl || image;
298
- if (lineImage) {
299
- retrievedData.image = lineImage;
300
- retrievedData.imagePreview = imagePreview;
301
- }
302
- const formData = {
303
- 0: retrievedData,
304
- base: retrievedData,
305
- };
306
- this.setState({ formData });
307
- }
308
-
309
220
  componentWillUnmount() {
310
- window.removeEventListener('message', this.handleFrameTasks);
221
+ console.log('removed listener templates');
222
+ window.removeEventListener("message", this.handleFrameTasks);
311
223
  }
312
224
 
313
225
  onTagSelect(data, currentTab) {
226
+ console.log('parent data tag', data, currentTab);
314
227
  const editorId = 'message-editor';
315
- this.insertAtCursor(
316
- document.getElementById(editorId),
317
- `{{${data}}}`,
318
- currentTab
319
- );
228
+ this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
320
229
  document.getElementById(editorId).focus();
321
230
  }
322
231
 
323
232
  onTagSelectTitle(data, currentTab) {
233
+ console.log('parent data tag', data, currentTab);
324
234
  const editorId = 'message-title';
325
- this.insertAtCursor(
326
- document.getElementById(editorId),
327
- `{{${data}}}`,
328
- currentTab
329
- );
235
+ this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
330
236
  document.getElementById(editorId).focus();
331
237
  }
332
238
 
333
239
  onFormDataChange = (formData, tabCount, currentTab) => {
334
- this.setState({ formData: { ...formData } });
335
- if (tabCount) {
336
- this.setState({ tabCount });
337
- }
240
+ console.log('Form data changed is ', formData, tabCount, currentTab);
241
+ this.setState({formData, tabCount});
338
242
  if (currentTab) {
339
- this.setState({ currentTab });
243
+ this.setState({currentTab});
340
244
  }
341
245
  };
342
246
 
343
247
  getTransformedData = (formData) => {
248
+ console.log("formData before transform@@@", formData);
344
249
  const modeType = this.state.modeType;
345
250
  const obj = {};
346
251
  const msgData = {};
347
252
  obj.versions = {
348
253
  base: {
349
254
  content: {
350
- to: '{{line_id}}',
255
+ to: "{{line_id}}",
351
256
  messages: [],
352
257
  },
353
258
  },
@@ -357,7 +262,7 @@ export class Line extends Component {
357
262
  obj.definition = {
358
263
  mode: modeType,
359
264
  };
360
- if (modeType && modeType !== undefined) {
265
+ if ( modeType && modeType !== undefined) {
361
266
  msgData.type = modeType;
362
267
  }
363
268
  if (modeType === 'text') {
@@ -382,6 +287,15 @@ export class Line extends Component {
382
287
  msgData.previewImageUrl = formData['0'].imagePreview;
383
288
  }
384
289
  } else {
290
+ // const img = new Image();
291
+ // img.src = formData['0'].image;
292
+ // img.onload = () => {
293
+ // console.log(`Image aspect ratio details line@@@${img.width} and ${img.height}`);
294
+ // };
295
+ // // Preview Image set to 240px max
296
+ // const prevImgSet = new Image(240, 240);
297
+ // prevImgSet.src = formData['0'].image;
298
+
385
299
  msgData.originalContentUrl = formData['0'].image;
386
300
  msgData.previewImageUrl = formData['0'].imagePreview;
387
301
  }
@@ -390,7 +304,7 @@ export class Line extends Component {
390
304
  return obj;
391
305
  };
392
306
 
393
- getEditTransformedData = ({ name, versions }) => {
307
+ getEditTransformedData = ({name, versions}) => {
394
308
  const modeType = this.state.modeType;
395
309
  const obj = {};
396
310
  obj['0'] = {};
@@ -399,39 +313,33 @@ export class Line extends Component {
399
313
  };
400
314
  obj['template-name'] = name;
401
315
  if (modeType === 'text') {
402
- obj.base['message-editor'] =
403
- versions.base.content.messages[0].text;
404
- obj['0']['message-editor'] =
405
- versions.base.content.messages[0].text;
316
+ obj.base['message-editor'] = versions.base.content.messages[0].text;
317
+ obj['0']['message-editor'] = versions.base.content.messages[0].text;
406
318
  } else if (modeType === 'image') {
407
- const {
408
- base: {
409
- content: {
410
- messages: [{
411
- originalContentUrl,
412
- previewImageUrl,
413
- }],
414
- },
415
- },
416
- } = versions;
417
- obj.base.image = originalContentUrl;
418
- obj['0'].image = originalContentUrl;
419
- obj['0'].imagePreview = previewImageUrl;
420
- obj.base.imagePreview = previewImageUrl;
319
+ obj.base.image = versions.base.content.messages[0].originalContentUrl;
320
+ obj['0'].image = versions.base.content.messages[0].originalContentUrl;
321
+ obj['0'].imagePreview = versions.base.content.messages[0].previewImageUrl;
322
+ obj.base.imagePreview = versions.base.content.messages[0].previewImageUrl;
421
323
  }
324
+
325
+ console.log("getEditTransformedData", obj);
422
326
  return obj;
423
327
  };
424
328
 
425
329
  setFormValidity = (isFormValid) => {
426
- this.setState({ isFormValid });
330
+ this.setState({isFormValid});
427
331
  };
428
332
 
429
333
  getMappedEvent = (id, event) => {
430
334
  const map = this.state.eventsMap;
335
+ if (!map[id] || !map[id][event]) {
336
+ console.log(`error map[id] ${map[id]}` );
337
+ }
431
338
  return map[id][event];
432
339
  };
433
340
 
434
341
  getCurrentWindow(e) {
342
+ console.log('in Line create@@@', e);
435
343
  const response = {
436
344
  action: e.action,
437
345
  value: 'edit',
@@ -441,12 +349,13 @@ export class Line extends Component {
441
349
  }
442
350
 
443
351
  getFormData = (e) => {
352
+ console.log('posting final result', this.state.formData);
444
353
  const response = {
445
- action: 'getFormData',
354
+ action: "getFormData",
446
355
  value: this.getTransformedData(this.state.formData),
447
356
  validity: this.state.isFormValid,
448
357
  };
449
- this.setState({ checkValidation: true });
358
+ this.setState({checkValidation: true});
450
359
  if (e) {
451
360
  e.source.postMessage(JSON.stringify(response), e.origin);
452
361
  }
@@ -456,79 +365,56 @@ export class Line extends Component {
456
365
  injectEvents = (schema) => {
457
366
  const temp = schema;
458
367
  if (temp.standalone) {
459
- temp.standalone.sections = this.injectSections(
460
- temp.standalone.sections
461
- );
368
+ temp.standalone.sections = this.injectSections(temp.standalone.sections);
462
369
  }
463
370
  _.forEach(temp.containers, (container) => {
464
371
  let tempContainer = container;
465
372
  tempContainer = this.injectContainer(tempContainer);
466
373
  return tempContainer;
467
374
  });
468
- this.setState({ schema, isSchemaChanged: true }, () => {
375
+ console.log('final injected schema', schema);
376
+ this.setState({schema, isSchemaChanged: true}, () => {
469
377
  this.removeStandAlone();
470
378
  });
379
+ console.log('final returned schema', this.state.schema);
471
380
  return schema;
472
381
  };
473
382
 
474
383
  saveFormData = (formData) => {
384
+ console.log("ccc", this.props);
385
+ console.log('Saving form data of LINE @@@', formData, this.state.tabCount);
475
386
  const obj = this.getTransformedData(formData);
387
+ console.log('obj final@@@', obj);
476
388
  if (obj === 'IMAGE_ERROR') {
477
- const message = getMessageObject(
478
- 'error',
479
- this.props.intl.formatMessage(
480
- messages['Please upload an image to proceed']
481
- ),
482
- true
483
- );
389
+ const message = getMessageObject('error', this.props.intl.formatMessage(messages['Please upload an image to proceed']), true);
484
390
  this.props.globalActions.addMessageToQueue(message);
485
391
  return;
486
392
  }
487
- if (
488
- obj !== 'IMAGE_ERROR' &&
489
- obj.versions.base.content.messages[0].type === 'text'
490
- ) {
491
- const text = obj.versions.base.content.messages[0].text;
492
- const charCount = text ? text.length : 0;
393
+ if (obj !== 'IMAGE_ERROR' && obj.versions.base.content.messages[0].type === 'text') {
394
+ const charCount = obj.versions.base.content.messages[0].text.length;
493
395
  if (charCount > 1600) {
494
- const message = getMessageObject(
495
- 'error',
496
- this.props.intl.formatMessage(
497
- messages['Maximum characters length exceeds']
498
- ),
499
- true
500
- );
396
+ const message = getMessageObject('error', this.props.intl.formatMessage(messages['Maximum characters length exceeds']), true);
501
397
  this.props.globalActions.addMessageToQueue(message);
502
398
  return;
503
399
  }
504
400
  }
505
- if (!this.state.startValidation) {
506
- this.setState({
507
- startValidation: true,
508
- }, () => {
509
- const {
510
- isFullMode,
511
- saveMessage,
512
- actions,
513
- onCreateComplete,
514
- } = this.props;
515
- if (!isFullMode) {
516
- saveMessage();
517
- } else if (this.state.isEdit) {
518
- actions.editTemplate(obj, () => {
519
- this.setEditSuccessMessage();
520
- onCreateComplete();
521
- });
522
- } else {
523
- actions.createTemplate(
524
- obj,
525
- onCreateComplete
526
- );
527
- }
528
- });
401
+ if (this.state.isEdit) {
402
+ console.log("Inside edit line template@@");
403
+ this.props.actions.editTemplate(obj);
404
+ } else {
405
+ this.props.actions.createTemplate(obj);
529
406
  }
530
407
  };
531
408
 
409
+ cancelTemplate = () => {
410
+ const type = this.props.location.query.type;
411
+ const module = this.props.location.query.module ? this.props.location.query.module : 'default';
412
+ this.props.router.push({
413
+ pathname: `/LINE/`,
414
+ query: type === 'embedded' ? {type: 'embedded', module} : {module},
415
+ });
416
+ };
417
+
532
418
  injectSections = (sections) => {
533
419
  _.forEach(sections, (section) => {
534
420
  let temp = section;
@@ -548,28 +434,24 @@ export class Line extends Component {
548
434
  _.forEach(inputField.cols, (col) => {
549
435
  const temp = col;
550
436
  if (temp.type === 'popover') {
551
- temp.content.sections = this.injectSections(
552
- temp.content.sections
553
- );
437
+ temp.content.sections = this.injectSections(temp.content.sections);
554
438
  temp.value.sections = this.injectSections(temp.value.sections);
555
439
  return true;
556
440
  }
557
- if (temp.id === 'discard-button') {
558
- temp.colStyle = { ...temp.colStyle, display: 'none' };
441
+ if (temp.id === "discard-button") {
442
+ temp.colStyle = {...temp.colStyle, display: 'none'};
559
443
  }
560
- if (temp.id === 'cancel-button') {
444
+ if (temp.id === "cancel-button") {
561
445
  temp.offset = 11;
562
446
  }
563
- if (temp.id === 'line-push-preview') {
447
+ if (temp.id === "line-push-preview") {
564
448
  temp.content.appName = this.props.Templates.selectedWeChatAccount.name;
565
449
  }
566
450
  temp.injectedEvents = {};
567
451
 
568
452
  _.forEach(col.supportedEvents, (event) => {
569
- temp.injectedEvents[event] = this.getMappedEvent(
570
- col.id,
571
- event
572
- );
453
+ console.log('injected event for ', col, event, this.getMappedEvent(col.id, event));
454
+ temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
573
455
  });
574
456
  return true;
575
457
  });
@@ -578,18 +460,13 @@ export class Line extends Component {
578
460
  _.forEach(actionField.cols, (col) => {
579
461
  const temp = col;
580
462
  if (temp.type === 'popover') {
581
- temp.content.sections = this.injectSections(
582
- temp.content.sections
583
- );
463
+ temp.content.sections = this.injectSections(temp.content.sections);
584
464
  temp.value.sections = this.injectSections(temp.value.sections);
585
465
  return true;
586
466
  }
587
467
  temp.injectedEvents = {};
588
468
  _.forEach(col.supportedEvents, (event) => {
589
- temp.injectedEvents[event] = this.getMappedEvent(
590
- col.id,
591
- event
592
- );
469
+ temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
593
470
  });
594
471
  return true;
595
472
  });
@@ -601,36 +478,26 @@ export class Line extends Component {
601
478
  _.forEach(section.inputFields, (inputField) => {
602
479
  const temp = inputField;
603
480
  if (temp.type === 'popover') {
604
- temp.content.sections = this.injectSections(
605
- temp.content.sections
606
- );
481
+ temp.content.sections = this.injectSections(temp.content.sections);
607
482
  temp.value.sections = this.injectSections(temp.value.sections);
608
483
  return true;
609
484
  }
610
485
  temp.injectedEvents = {};
611
486
  _.forEach(inputField.supportedEvents, (event) => {
612
- temp.injectedEvents[event] = this.getMappedEvent(
613
- inputField.id,
614
- event
615
- );
487
+ temp.injectedEvents[event] = this.getMappedEvent(inputField.id, event);
616
488
  });
617
489
  return true;
618
490
  });
619
491
  _.forEach(section.actionFields, (actionField) => {
620
492
  const temp = actionField;
621
493
  if (temp.type === 'popover') {
622
- temp.content.sections = this.injectSections(
623
- temp.content.sections
624
- );
494
+ temp.content.sections = this.injectSections(temp.content.sections);
625
495
  temp.value.sections = this.injectSections(temp.value.sections);
626
496
  return true;
627
497
  }
628
498
  temp.injectedEvents = {};
629
499
  _.forEach(actionField.supportedEvents, (event) => {
630
- temp.injectedEvents[event] = this.getMappedEvent(
631
- actionField.id,
632
- event
633
- );
500
+ temp.injectedEvents[event] = this.getMappedEvent(actionField.id, event);
634
501
  });
635
502
  return true;
636
503
  });
@@ -658,17 +525,12 @@ export class Line extends Component {
658
525
  myField.focus();
659
526
  const sel = document.selection.createRange();
660
527
  sel.text = myValue;
661
- } else if (
662
- myField.selectionStart ||
663
- myField.selectionStart === '0'
664
- ) {
665
- //MOZILLA and others
528
+ } else if (myField.selectionStart || myField.selectionStart === '0') { //MOZILLA and others
666
529
  const startPos = myField.selectionStart;
667
530
  const endPos = myField.selectionEnd;
668
- myField.value =
669
- myField.value.substring(0, startPos) +
670
- myValue +
671
- myField.value.substring(endPos, myField.value.length);
531
+ myField.value = myField.value.substring(0, startPos)
532
+ + myValue
533
+ + myField.value.substring(endPos, myField.value.length);
672
534
  myField.selectionStart = startPos + myValue.length;
673
535
  myField.selectionEnd = startPos + myValue.length;
674
536
  } else {
@@ -676,7 +538,7 @@ export class Line extends Component {
676
538
  }
677
539
  const formData = _.cloneDeep(this.state.formData);
678
540
  formData[currentTab - 1][field.id] = myField.value;
679
- this.setState({ formData });
541
+ this.setState({formData});
680
542
  };
681
543
 
682
544
  startTemplateCreation = (data) => {
@@ -685,6 +547,7 @@ export class Line extends Component {
685
547
  type: 'LAYOUT',
686
548
  };
687
549
  this.props.globalActions.fetchSchemaForEntity(getSchemaQuery);
550
+ console.log('startTemplateCreation');
688
551
  const content = data.content;
689
552
  const obj = {};
690
553
  obj['0'] = {};
@@ -698,17 +561,14 @@ export class Line extends Component {
698
561
  obj.base.image = content;
699
562
  obj['0'].image = content;
700
563
  }
701
- this.setState({
702
- formData: obj,
703
- loading: false,
704
- injectedTags: data.tags,
705
- });
564
+ this.setState({formData: obj, loading: false, injectedTags: data.tags});
706
565
  this.props.globalActions.setInjectedTags(data.tags);
707
566
  };
708
567
 
709
568
  startLoading = (ifEdit) => {
569
+ console.log('startLoading', ifEdit);
710
570
  if (ifEdit) {
711
- this.setState({ loading: true });
571
+ this.setState({loading: true});
712
572
  }
713
573
  };
714
574
 
@@ -721,9 +581,7 @@ export class Line extends Component {
721
581
  });
722
582
  _.forEach(temp.panes, (pane) => {
723
583
  const tempPane = pane;
724
- tempPane.sectionsHeaders = this.injectSections(
725
- tempPane.sectionsHeaders
726
- );
584
+ tempPane.sectionsHeaders = this.injectSections(tempPane.sectionsHeaders);
727
585
  tempPane.sections = this.injectSections(tempPane.sections);
728
586
  });
729
587
  }
@@ -731,11 +589,7 @@ export class Line extends Component {
731
589
  };
732
590
 
733
591
  resetSchema = () => {
734
- this.setState({
735
- schema: this.state.initialState
736
- ? this.state.initialState
737
- : this.state.schema,
738
- });
592
+ this.setState({ schema: this.state.initialState ? this.state.initialState : this.state.schema});
739
593
  };
740
594
 
741
595
  resetState = () => {
@@ -752,6 +606,7 @@ export class Line extends Component {
752
606
  };
753
607
 
754
608
  moveToTemplates() {
609
+ console.log('in move to Templates');
755
610
  const modalContent = {
756
611
  title: this.props.intl.formatMessage(messages.alertMessage),
757
612
  body: this.props.intl.formatMessage(messages.goBackTemporaryLost),
@@ -759,12 +614,12 @@ export class Line extends Component {
759
614
  id: 'template-back-confirm-modal',
760
615
  show: true,
761
616
  };
762
- this.setState({ modalContent, showModal: true });
617
+ this.setState({modalContent, showModal: true});
763
618
  }
764
619
 
765
620
  showNext() {
766
621
  const response = {
767
- action: 'showNext',
622
+ action: "showNext",
768
623
  value: true,
769
624
  };
770
625
  parent.postMessage(JSON.stringify(response), '*');
@@ -776,17 +631,20 @@ export class Line extends Component {
776
631
  };
777
632
 
778
633
  handleFrameTasks = (e) => {
634
+ console.log('listened from cheetah@@@', e.data);
779
635
  const type = e.data;
636
+ console.log('data type', typeof type);
780
637
  if (typeof type === 'object') {
638
+ console.log('received something', type);
781
639
  const action = type.action;
782
640
  switch (action) {
783
- case 'startTemplateCreation':
641
+ case "startTemplateCreation":
784
642
  this.startTemplateCreation(type.value);
785
643
  break;
786
- case 'startLoading':
644
+ case "startLoading":
787
645
  this.startLoading(type.edit);
788
646
  break;
789
- case 'getCurrentWindow':
647
+ case "getCurrentWindow":
790
648
  this.getCurrentWindow(type);
791
649
  break;
792
650
  default:
@@ -794,16 +652,19 @@ export class Line extends Component {
794
652
  }
795
653
  } else {
796
654
  switch (type) {
797
- case 'getFormData':
655
+ case "getFormData":
798
656
  this.getFormData(e);
799
657
  break;
800
- case 'startTemplateCreation':
658
+ case "startTemplateCreation":
659
+ console.log('Starting to create template');
801
660
  //this.getFormData(e);
802
661
  break;
803
- case 'moveToTemplates':
662
+ case "moveToTemplates":
663
+ console.log('moving to templates');
804
664
  this.moveToTemplates();
805
665
  break;
806
- case 'validateContent':
666
+ case "validateContent":
667
+ console.log('validating Content');
807
668
  this.validateContent(e);
808
669
  break;
809
670
  default:
@@ -814,24 +675,11 @@ export class Line extends Component {
814
675
 
815
676
  removeStandAlone = () => {
816
677
  const schema = _.cloneDeep(this.state.schema);
817
- const {
818
- location: {
819
- query: {
820
- type,
821
- mode,
822
- module,
823
- },
824
- },
825
- } = this.props;
826
- if (type === 'embedded' && module === 'loyalty') {
678
+ console.log("schema line", schema);
679
+ if (this.props.location.query.type === 'embedded' && this.props.location.query.module === 'loyalty') {
827
680
  schema.standalone.sections.splice(0, 1);
828
- } else if (type === 'embedded' && typeof mode !== 'undefined') {
829
- delete schema.standalone;
830
- } else if (!this.props.isFullMode) {
831
- const childSections = get(schema, 'standalone.sections[0].childSections');
832
- const fields = get(childSections, '[1].childSections[0].childSections');//removing template name section
833
- fields.splice(0, 1);
834
- set(childSections, '[1].childSections[0].childSections', fields);
681
+ } else if (this.props.location.query.type === 'embedded' && typeof this.props.location.query.mode !== 'undefined') {
682
+ delete schema.standalone;
835
683
  } else {
836
684
  schema.standalone.sections.splice(1, 1);
837
685
  }
@@ -839,170 +687,74 @@ export class Line extends Component {
839
687
  };
840
688
 
841
689
  validateContent = (e) => {
690
+ console.log('posting final validation result', this.state.isFormValid);
842
691
  const response = {
843
- action: 'validateContent',
692
+ action: "validateContent",
844
693
  value: this.state.isFormValid,
845
694
  };
846
695
  e.source.postMessage(JSON.stringify(response), e.origin);
847
696
  };
848
697
 
849
698
  handleOnTagsContextChange = (data) => {
699
+ console.log('parent tags context', data);
850
700
  const query = {
851
701
  layout: 'LINE',
852
702
  type: 'TAG',
853
- context:
854
- data.toLowerCase() === 'all' ? 'default' : data.toLowerCase(),
855
- embedded:
856
- this.props.location.query.type === 'embedded'
857
- ? this.props.location.query.type
858
- : 'full',
703
+ context: data.toLowerCase() === 'all' ? 'default' : data.toLowerCase(),
704
+ embedded: this.props.location.query.type === 'embedded' ? this.props.location.query.type : 'full',
859
705
  };
860
706
  this.props.globalActions.fetchSchemaForEntity(query);
861
707
  };
862
708
 
863
709
  uploadImage = (pearmData) => {
710
+ console.log("image data line@@@", pearmData);
864
711
  const data = pearmData;
865
712
  if (data.file.size > 1000000) {
866
- const message = getMessageObject(
867
- 'error',
868
- this.props.intl.formatMessage(
869
- messages['File size cannot be more than 1mb']
870
- ),
871
- true
872
- );
713
+ const message = getMessageObject('error', this.props.intl.formatMessage(messages['File size cannot be more than 1mb']), true);
873
714
  this.props.globalActions.addMessageToQueue(message);
874
715
  } else {
875
716
  data.fileParams.isGeneratePreview = true;
876
- this.props.actions.uploadAsset(
877
- data.file,
878
- data.type,
879
- data.fileParams,
880
- );
717
+ const name = data.file.name.split('.');
718
+ const blob = data.file.slice(0, -1, 'image');
719
+ const newFile = new File([blob], `${name[0]}${Date.now()}.${name[1]}`, {type: 'image'});
720
+ this.props.actions.uploadAsset(newFile, data.type, data.fileParams);
881
721
  }
882
722
  };
883
723
 
884
- onGalleryImageSelect = (imageTemplate) => {
885
- const { formData } = this.state;
886
- const image = get(imageTemplate, 'metaInfo.secure_file_path');
887
- const imagePreview = get(imageTemplate, 'metaInfo.secure_file_path_preview');
888
- this.setState({
889
- isDrawerRequired: false,
890
- formData: {
891
- ...formData,
892
- 0: {
893
- ...formData[0],
894
- image,
895
- imagePreview,
896
- },
897
- base: {
898
- ...formData.base,
899
- image,
900
- imagePreview,
901
- },
902
- },
903
- });
904
- }
905
-
906
- getGalleryDrawerContent = () => {
907
- const location = {
908
- pathname: `/assets`,
909
- search: '',
910
- query: !this.props.isFullMode ? {type: 'embedded', module: 'library'} : {},
911
- };
912
- const content = (
913
- <Gallery
914
- location={location}
915
- isFullMode={this.props.isFullMode}
916
- isLineAsset
917
- onGalleryImageSelect={this.onGalleryImageSelect}
918
- />);
919
- return (
920
- <>
921
- <CapHeading type="h3">
922
- {this.props.intl.formatMessage(messages.imageGallery)}
923
- </CapHeading>
924
- {content}
925
- </>
926
- );
927
- };
928
-
929
- updateSchemaWithLabels = (schema) => {
930
- /* eslint-disable no-param-reassign */
931
- schema.textSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[0].cols[0].placeholder = this.props.intl.formatMessage(
932
- messages.templatePlaceholder
933
- );
934
- schema.textSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[0].cols[0].errorMessage = this.props.intl.formatMessage(
935
- messages.templateNameErrorPlaceholder
936
- );
937
- schema.textSchema.standalone.sections[0].childSections[1].childSections[0].childSections[1].inputFields[0].cols[0].label = this.props.intl.formatMessage(
938
- messages.templateAddTag
939
- );
940
- schema.textSchema.standalone.sections[0].childSections[1].childSections[0].childSections[2].inputFields[0].cols[0].placeholder = this.props.intl.formatMessage(
941
- messages.templateMessagePlaceholder
942
- );
943
- schema.textSchema.standalone.sections[0].childSections[1].childSections[0].childSections[2].inputFields[0].cols[0].errorMessage = this.props.intl.formatMessage(
944
- messages.templateMessageError
945
- );
946
- schema.imageSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[0].cols[0].placeholder = this.props.intl.formatMessage(
947
- messages.templatePlaceholder
948
- );
949
- schema.imageSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[0].cols[0].errorMessage = this.props.intl.formatMessage(
950
- messages.templateNameErrorPlaceholder
951
- );
952
- schema.imageSchema.standalone.sections[0].childSections[1].childSections[0].childSections[1].inputFields[0].cols[0].previewProps.label = this.props.intl.formatMessage(
953
- messages.templateMessagePreviewPropsLabel
954
- );
955
- schema.imageSchema.standalone.sections[0].childSections[1].childSections[0].childSections[1].inputFields[0].cols[0].previewProps.inductiveText = this.props.intl.formatMessage(
956
- messages.templateMessagePreviewPropsInductiveText
957
- );
958
- schema.imageSchema.standalone.sections[0].childSections[1].childSections[0].childSections[1].inputFields[0].cols[0].previewProps.errorMessage = this.props.intl.formatMessage(
959
- messages.templateMessagePreviewPropsError
960
- );
961
- return schema;
962
- };
963
-
964
724
  render() {
965
- const {
966
- Line: {
967
- createTemplateInProgress,
968
- assetUploading,
969
- } = {},
970
- templateData,
971
- params: {
972
- id,
973
- } = {},
974
- } = this.props;
975
- const {
976
- edit,
977
- mode,
978
- orgId,
979
- isDefault,
980
- } = templateData || {};
981
- let loading = createTemplateInProgress || false;
982
- loading = !!assetUploading;
983
- if (!isDefault && (edit || mode === 'edit' || (orgId && id))) {
984
- const {
985
- base: {
986
- 'message-editor': msgEditor,
987
- image: uploadedAsset,
988
- } = {},
989
- reUpload,
990
- } = this.state.formData;
991
- loading = typeof reUpload === 'undefined' ? !(msgEditor || uploadedAsset) : !reUpload;
992
- }
993
- let tags =
994
- this.props.metaEntities && this.props.metaEntities.tags
995
- ? this.props.metaEntities.tags.standard
996
- : [];
725
+ if (this.state.formData && this.state.formData["0"] && this.state.formData["0"].image) {
726
+ console.log("before render@@@", this.state.formData["0"].image);
727
+ }
728
+ console.log("render state", this.state);
729
+ let loading = this.props.Line.createTemplateInProgress ? this.props.Line.createTemplateInProgress : false;
730
+ if (this.props.Line.assetUploading) {
731
+ loading = true;
732
+ }
733
+ // if (!this.state.isReady) {
734
+ // tipText = "Please wait..";
735
+ // loading = true;
736
+ // }
737
+ let tags = this.props.metaEntities && this.props.metaEntities.tags ? this.props.metaEntities.tags.standard : [];
997
738
  if (this.props.supportedTags) {
998
739
  tags = this.props.supportedTags;
999
740
  }
1000
741
  return (
1001
- <CapSpin spinning={loading}>
1002
- <CapRow>
1003
- <CapColumn>
742
+ <Spin spinning={loading}>
743
+ <Row style={{marginLeft: '-48px'}}>
744
+ <Col offset={1}>
745
+ {this.props.location.query.type !== "embedded" &&
746
+ <Breadcrumb>
747
+ <BreadcrumbItem>{this.props.intl.formatMessage(messages.Campaigns)}</BreadcrumbItem>
748
+ <BreadcrumbItem>{this.props.intl.formatMessage(messages.Creatives)}</BreadcrumbItem>
749
+ <BreadcrumbItem>{this.props.intl.formatMessage(messages.Line)}</BreadcrumbItem>
750
+ </Breadcrumb>
751
+ }
752
+ </Col>
753
+ </Row>
754
+ <Row>
755
+ <Col>
1004
756
  <FormBuilder
1005
- key={'form builder'}
757
+ key={"form builder"}
1006
758
  schema={this.state.schema}
1007
759
  onSubmit={this.saveFormData}
1008
760
  onChange={this.onFormDataChange}
@@ -1011,9 +763,7 @@ export class Line extends Component {
1011
763
  formData={_.cloneDeep(this.state.formData)}
1012
764
  location={this.props.location}
1013
765
  tags={tags}
1014
- injectedTags={
1015
- this.props.injectedTags ? this.props.injectedTags : {}
1016
- }
766
+ injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
1017
767
  onFormValidityChange={this.setFormValidity}
1018
768
  usingTabContainer
1019
769
  checkValidation={this.state.checkValidation}
@@ -1027,16 +777,10 @@ export class Line extends Component {
1027
777
  router={this.props.router}
1028
778
  onContextChange={this.handleOnTagsContextChange}
1029
779
  setModalContent={this.setModalContent}
1030
- capDrawerContent={this.getGalleryDrawerContent()}
1031
- isDrawerRequired={this.state.isDrawerRequired}
1032
- setDrawerVisibility={(drawervisibleFlag) =>
1033
- this.setState({ isDrawerRequired: drawervisibleFlag })
1034
- }
1035
- startValidation={this.state.startValidation}
1036
780
  />
1037
- </CapColumn>
1038
- </CapRow>
1039
- </CapSpin>
781
+ </Col>
782
+ </Row>
783
+ </Spin>
1040
784
  );
1041
785
  }
1042
786
  }
@@ -1055,15 +799,10 @@ Line.propTypes = {
1055
799
  supportedTags: PropTypes.any,
1056
800
  getDefaultTags: PropTypes.string,
1057
801
  injectedTags: PropTypes.object,
1058
- onCreateComplete: PropTypes.func,
1059
- isFullMode: PropTypes.bool,
1060
- saveMessage: PropTypes.func,
1061
- templateData: PropTypes.object,
1062
802
  };
1063
803
 
1064
804
  const mapStateToProps = createStructuredSelector({
1065
805
  Line: makeSelectCreateLine(),
1066
- lineData: makeSelectLine(),
1067
806
  Templates: makeSelectTemplates(),
1068
807
  metaEntities: makeSelectMetaEntities(),
1069
808
  injectedTags: setInjectedTags(),