@capillarytech/creatives-library 7.1.7 → 7.1.10

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 (71) hide show
  1. package/config/app.js +0 -2
  2. package/containers/Templates/index.js +1 -1
  3. package/favicon.ico +0 -0
  4. package/index.js +1 -15
  5. package/package.json +1 -2
  6. package/reducers.js +1 -4
  7. package/routes.js +1 -7
  8. package/services/api.js +0 -11
  9. package/utils/common.js +0 -178
  10. package/v2Components/FormBuilder/index.js +4 -5
  11. package/v2Components/TemplatePreview/_templatePreview.scss +2 -8
  12. package/v2Components/TemplatePreview/index.js +18 -108
  13. package/v2Containers/App/constants.js +3 -5
  14. package/v2Containers/CreativesContainer/SlideBoxContent.js +3 -84
  15. package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -5
  16. package/v2Containers/CreativesContainer/constants.js +0 -4
  17. package/v2Containers/CreativesContainer/index.js +5 -48
  18. package/v2Containers/Email/index.js +0 -1
  19. package/v2Containers/Line/Create/_lineCreate.scss +64 -0
  20. package/v2Containers/Line/Create/actions.js +94 -0
  21. package/v2Containers/Line/Create/constants.js +43 -0
  22. package/v2Containers/Line/Create/index.js +1132 -0
  23. package/v2Containers/Line/Create/initialSchema.js +378 -0
  24. package/v2Containers/Line/Create/messages.js +229 -0
  25. package/v2Containers/Line/Create/reducer.js +99 -0
  26. package/v2Containers/Line/Create/sagas.js +113 -0
  27. package/v2Containers/Line/Create/selectors.js +30 -0
  28. package/v2Containers/Line/CreateWrapper/constants.js +2 -0
  29. package/v2Containers/Line/CreateWrapper/index.js +117 -0
  30. package/v2Containers/Line/CreateWrapper/messages.js +55 -0
  31. package/v2Containers/Line/Edit/_lineEdit.scss +23 -0
  32. package/v2Containers/Line/Edit/actions.js +79 -0
  33. package/v2Containers/Line/Edit/constants.js +27 -0
  34. package/v2Containers/Line/Edit/index.js +1051 -0
  35. package/v2Containers/Line/Edit/messages.js +173 -0
  36. package/v2Containers/Line/Edit/reducer.js +83 -0
  37. package/v2Containers/Line/Edit/sagas.js +81 -0
  38. package/v2Containers/Line/Edit/selectors.js +29 -0
  39. package/v2Containers/Line/Edit/tests/actions.test.js +18 -0
  40. package/v2Containers/Line/Edit/tests/index.test.js +10 -0
  41. package/v2Containers/Line/Edit/tests/reducer.test.js +9 -0
  42. package/v2Containers/Line/Edit/tests/sagas.test.js +15 -0
  43. package/v2Containers/Line/Edit/tests/selectors.test.js +10 -0
  44. package/v2Containers/MobilePush/Create/sagas.js +4 -1
  45. package/v2Containers/Templates/_templates.scss +0 -57
  46. package/v2Containers/Templates/actions.js +110 -117
  47. package/v2Containers/Templates/constants.js +0 -2
  48. package/v2Containers/Templates/index.js +7 -88
  49. package/v2Containers/Templates/messages.js +0 -4
  50. package/v2Containers/Templates/reducer.js +0 -2
  51. package/v2Containers/TemplatesV2/index.js +1 -22
  52. package/v2Containers/TemplatesV2/messages.js +0 -8
  53. package/assets/viber.png +0 -0
  54. package/old_favicon.ico +0 -0
  55. package/v2Components/TemplatePreview/assets/images/viberMobile.svg +0 -135
  56. package/v2Containers/FTP/_FTP.scss +0 -114
  57. package/v2Containers/FTP/actions.js +0 -7
  58. package/v2Containers/FTP/constants.js +0 -3
  59. package/v2Containers/FTP/index.js +0 -599
  60. package/v2Containers/FTP/messages.js +0 -68
  61. package/v2Containers/FTP/reducer.js +0 -32
  62. package/v2Containers/FTP/sagas.js +0 -26
  63. package/v2Containers/FTP/selectors.js +0 -20
  64. package/v2Containers/FTP/temp.js +0 -11838
  65. package/v2Containers/Viber/actions.js +0 -74
  66. package/v2Containers/Viber/constants.js +0 -30
  67. package/v2Containers/Viber/index.js +0 -727
  68. package/v2Containers/Viber/messages.js +0 -145
  69. package/v2Containers/Viber/reducer.js +0 -84
  70. package/v2Containers/Viber/sagas.js +0 -107
  71. package/v2Containers/Viber/selectors.js +0 -21
@@ -1,599 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import { bindActionCreators } from 'redux';
4
- import { FormattedMessage, intlShape } from 'react-intl';
5
- import { createStructuredSelector } from 'reselect';
6
- import {
7
- CapRadioCard,
8
- CapSpin,
9
- CapHeading,
10
- CapHeader,
11
- CapButton,
12
- CapIcon,
13
- CapLink,
14
- CapRow,
15
- CapColumn,
16
- CapInput,
17
- CapLabel,
18
- CapTag,
19
- CapTreeSelect,
20
- CapDivider,
21
- } from '@capillarytech/cap-ui-library';
22
- import { find, cloneDeep, findIndex, isEmpty, isEqual, filter, forEach } from 'lodash';
23
- import * as actions from './actions';
24
- import { makeSelectFTP, makeSelectMetaEntities } from './selectors';
25
- import withCreatives from '../../hoc/withCreatives';
26
- import messages from './messages';
27
- import './_FTP.scss';
28
- import * as globalActions from '../../containers/Cap/actions';
29
- import { TagList } from '../TagList';
30
- import { NO_COMMUNICATION, CREATE, EDIT, PREVIEW } from '../App/constants';
31
- import { getTreeStructuredTags } from '../../utils/common';
32
-
33
- const UIView = {
34
- serverSelection: 'serverSelection',
35
- configureMessage: 'configureMessage',
36
- };
37
- const { CapLabelInline } = CapLabel;
38
- export class FTP extends React.Component {
39
- constructor(props) {
40
- super(props);
41
- this.state = this.getInitialState();
42
- }
43
- getInitialState = () => {
44
- const mode = this.props.mode || CREATE;
45
- let stateObj = {};
46
- if (mode === CREATE) {
47
- const { formatMessage } = this.props.intl;
48
- const headerTagList = [{
49
- header: formatMessage(messages.customerID),
50
- tag: '{{user_id}}',
51
- }];
52
- stateObj = {
53
- mode,
54
- selectedServer: null,
55
- viewMode: UIView.serverSelection,
56
- headerTagList,
57
- messageContent: '',
58
- tagsTree: [],
59
- };
60
- } else {
61
- const { messageContent = {} } = this.props.messageDetails || {};
62
- const { headerTagList = [], messageBody = '' } = messageContent['message_content_id_1'] || {};
63
- stateObj = {
64
- mode,
65
- selectedServer: null,
66
- viewMode: UIView.configureMessage,
67
- headerTagList,
68
- messageContent: messageBody,
69
- tagsTree: [],
70
- };
71
- }
72
- return stateObj;
73
- };
74
-
75
- setFTPServerInState = (FTPServers) => {
76
- const { deliverySetting = { channelSetting: {} }} = this.props.messageDetails;
77
- const configId = (deliverySetting.channelSetting[NO_COMMUNICATION].endPointConfigs || {}).ftpConfigId;
78
- const selectedServer = find(FTPServers, {id: configId});
79
- this.setState({ selectedServer });
80
- };
81
-
82
- componentDidMount() {
83
- this.props.actions.getFTPServers();
84
- const query = {
85
- layout: 'SMS',
86
- type: 'TAG',
87
- context: 'outbound',
88
- embedded: 'embedded',
89
- };
90
- //This call is to fetch tags that are populated in csv columns.
91
- this.props.globalActions.fetchSchemaForEntity(query);
92
- }
93
-
94
- componentWillReceiveProps(nextProps) {
95
- const { metaEntities = {}, selectedOfferDetails = [], mode, FTP: nextFTP = {} } = nextProps;
96
- const { metaEntities: thisMetaEntities = {}, FTP: thisFTP = {}} = this.props;
97
- const { tags: thisTags = {}} = thisMetaEntities;
98
- if (
99
- !isEmpty((metaEntities.tags || {}).standard) &&
100
- !isEqual((metaEntities.tags || {}).standard, thisTags.standard)
101
- ) {
102
- const tags = getTreeStructuredTags({tagsList: metaEntities.tags.standard, offerDetails: selectedOfferDetails});
103
- this.setState({ tagsTree: tags}, () => this.disableUsedColumns());
104
- }
105
-
106
- if (
107
- mode === EDIT &&
108
- nextFTP.FTPServers.length &&
109
- !isEqual(nextFTP.FTPServers, thisFTP.FTPServers)
110
- ) {
111
- this.setFTPServerInState(nextFTP.FTPServers);
112
- }
113
- }
114
-
115
- onChangeFTPServer = (e) => {
116
- const { value } = e.target;
117
- const { FTPServers = [] } = this.props.FTP || {};
118
- const selectedServer = find(FTPServers, {id: value});
119
- this.setState({ selectedServer, viewMode: UIView.configureMessage});
120
- };
121
-
122
- onTagSelect = (data) => {
123
- this.insertAtCursor(`{{${data}}}`);
124
- };
125
-
126
- setInputRef = (textarea) => {
127
- this.textArea = textarea;
128
- };
129
-
130
- getServerSelectionContent = () => {
131
- const { getFTPServersInProgress } = this.props.FTP || {};
132
- const { formatMessage } = this.props.intl;
133
- const serverOptions = this.getServerOptions();
134
- const { selectedServer } = this.state;
135
- return (
136
- <CapSpin spinning={getFTPServersInProgress}>
137
- <CapHeading
138
- type="h3"
139
- className="select-account-header"
140
- >
141
- {formatMessage(messages.ftpServer)}
142
- </CapHeading>
143
- {serverOptions.length && <CapHeading type="h6" className="manage-ftp-setting-div">
144
- {formatMessage(messages.ftpServerDesc)}
145
- <CapLink
146
- title={formatMessage(messages.manageFTPSettings)}
147
- className="select-server"
148
- onClick={this.handleManageFTPSettings}
149
- />
150
- </CapHeading>}
151
- {serverOptions.length ? (
152
- <CapRadioCard
153
- className="select-account"
154
- onChange={this.onChangeFTPServer}
155
- panes={serverOptions}
156
- cardHeight="48px"
157
- cardWidth="276px"
158
- size="small"
159
- defaultValue={selectedServer}
160
- selected={selectedServer}
161
- />
162
- ) : (
163
- <CapHeading type="h6" className="configure-ftp-setting-div">
164
- {formatMessage(messages.selectFtpServerDesc)}
165
- <CapLink
166
- title={formatMessage(messages.manageFTPSettings)}
167
- className="select-server"
168
- onClick={this.handleManageFTPSettings}
169
- />
170
- </CapHeading>
171
- )}
172
- </CapSpin>
173
- );
174
- };
175
-
176
- getServerOptions = () => {
177
- const { FTPServers = [] } = this.props.FTP || {};
178
- return (FTPServers).map(({
179
- // eslint-disable-next-line camelcase
180
- ftp_tag = '',
181
- id,
182
- }) => ({
183
- key: ftp_tag,
184
- value: id,
185
- title: ftp_tag,
186
- icon: <CapIcon.CapIconAvatar text={ftp_tag[0]} width="auto" height="2rem"/>,
187
- }));
188
- };
189
-
190
- validateTags(content, tagsParam) {
191
- const tags = tagsParam;
192
- const response = {};
193
- response.valid = true;
194
- response.unsupportedTags = [];
195
- if (tags && tags.length) {
196
- const regex = /{{[(A-Z\w+(\s\w+)*$\(\)@!#$%^&*~.,/\\]+}}/g;
197
- const matchedTags = [...content.matchAll(regex)];
198
- matchedTags.forEach((tag) => {
199
- const tagValue = tag[0].substring(this.indexOfEnd(tag[0], '{{'), tag[0].indexOf('}}'));
200
- let ifSupported = !!tags.find((t) => t.definition.value === tagValue);
201
- ifSupported = ifSupported || this.checkIfSupportedTag(tagValue, tags);
202
- if (!ifSupported) {
203
- response.unsupportedTags.push(tagValue);
204
- response.valid = false;
205
- }
206
- if (response.unsupportedTags.length === 0) {
207
- response.valid = true;
208
- }
209
- });
210
- }
211
- return response;
212
- }
213
-
214
- checkIfSupportedTag(checkingTag, injectedTags) {
215
- let result = false;
216
- forEach(injectedTags, (tag, key) => {
217
- if (tag.subtags) {
218
- if (this.checkIfSupportedTag(checkingTag, tag.subtags)) {
219
- result = true;
220
- }
221
- } else if (checkingTag === key) {
222
- result = true;
223
- }
224
- });
225
-
226
- return result;
227
- }
228
-
229
- indexOfEnd(targetString, string) {
230
- const io = targetString.indexOf(string);
231
- return io == -1 ? -1 : io + string.length;
232
- }
233
-
234
- getMessageContent = () => {
235
- const { messageContent } = this.state;
236
- const { formatMessage } = this.props.intl;
237
- const { metaEntities, selectedOfferDetails } = this.props;
238
- const tagsRaw = metaEntities && metaEntities.tags ? metaEntities.tags.standard : [];
239
- const validateTagResponse = this.validateTags(messageContent, tagsRaw);
240
- let unsupportedTags = null;
241
- let errorMessageText = '';
242
- if (!validateTagResponse.valid) {
243
- unsupportedTags = validateTagResponse.unsupportedTags.join(', ').toString();
244
- errorMessageText = formatMessage(messages.unsupportedTagsValidationError, {unsupportedTags})
245
- }
246
- return (
247
- <CapRow>
248
- <CapColumn span={11}>
249
- <div className="message-content-title">
250
- <TagList
251
- className="FTP-tagList"
252
- label={formatMessage(messages.addLabel)}
253
- tags={tagsRaw}
254
- onTagSelect={this.onTagSelect}
255
- selectedOfferDetails={selectedOfferDetails}
256
- />
257
- <CapInput.TextArea
258
- setInputRef={this.setInputRef}
259
- label={formatMessage(messages.messageHeader)}
260
- onChange={this.updateMessageBody}
261
- value={messageContent}
262
- errorMessage={errorMessageText}
263
- />
264
- </div>
265
- </CapColumn>
266
- </CapRow>
267
- );
268
- };
269
-
270
- getCsvColumns = () => {
271
- const { headerTagList = [], tagsTree = [] } = this.state;
272
- const { formatMessage } = this.props.intl;
273
- const tagsWithoutOptout = tagsTree.length && tagsTree.filter((tag) => tag.value !== '{{optout}}');
274
- const headerTagElements = headerTagList.map((item, index) => (
275
- index !== 0 && <div className="column-selection-container">
276
- <CapSpin spinning={!tagsWithoutOptout.length}>
277
- <CapTreeSelect
278
- dropdownClassName="select-csv-col-dropdown"
279
- treeData={tagsWithoutOptout}
280
- className="select-csv-column"
281
- value={!isEmpty(item.header) ? item.header : formatMessage(messages.selectTag)}
282
- onChange={(option, label) => this.selectCsvColumn(option, label, index)}
283
- showSearch
284
- />
285
- <CapIcon
286
- type="close"
287
- size="m"
288
- onClick={() => this.removeCsvColumn(item)}
289
- className="remove-csv-column"
290
- />
291
- </CapSpin>
292
- </div>
293
- ));
294
- headerTagElements.unshift(
295
- <CapLabelInline
296
- className="column-selection-container-cid"
297
- type="label2"
298
- style={{fontSize: 14, fontWeight: 500}}
299
- >
300
- <FormattedMessage {...messages.customerID}/>
301
- </CapLabelInline>
302
- );
303
- return headerTagElements;
304
- };
305
-
306
- getConfigureCsvContent = () => {
307
- const { formatMessage } = this.props.intl;
308
- return (
309
- <>
310
- <CapRow className="configure-csv-container">
311
- <CapColumn span={8} className="configure-csv">
312
- <CapHeader
313
- title={formatMessage(messages.configureCsv)}
314
- size="regular"
315
- className="select-account-header"
316
- />
317
- </CapColumn>
318
- <CapColumn span={3} offset={13} className="add-column">
319
- <CapButton
320
- type="flat"
321
- isAddBtn
322
- onClick={this.addNewColumn}
323
- >
324
- <FormattedMessage {...messages.addColumn} />
325
- </CapButton>
326
- </CapColumn>
327
- </CapRow>
328
- {this.getCsvColumns()}
329
- </>
330
- );
331
- }
332
-
333
- getConfigureMessageContent = () => {
334
- const { formatMessage } = this.props.intl;
335
- const { selectedServer = {}, headerTagList = [] } = this.state;
336
- const emptyHeaderTagList = filter(headerTagList, {tag: ''});
337
- const disableDoneButton = isEmpty(selectedServer) || emptyHeaderTagList.length;
338
- return (
339
- <CapSpin spinning={false}>
340
- <div className="scrollable-section">
341
- <CapHeader
342
- title={formatMessage(messages.ftpServer)}
343
- size="regular"
344
- className="select-account-header"
345
- />
346
- <div className="selected-server-name">
347
- <CapIcon.CapIconAvatar
348
- className="server-avtar"
349
- text={((selectedServer || {}).ftp_tag || [])[0]}
350
- width="auto"
351
- height="2rem"
352
- />
353
- <CapHeading
354
- type="h4"
355
- className="server-name"
356
- >
357
- {(selectedServer || {}).ftp_tag}
358
- </CapHeading>
359
- <CapLink
360
- title={formatMessage(messages.change)}
361
- className="server-change"
362
- onClick={this.showAccountSelection}
363
- />
364
- </div>
365
- <CapDivider />
366
- {this.getConfigureCsvContent()}
367
- <CapDivider />
368
- <div className="ftp-message-container">
369
- <CapHeader
370
- title={formatMessage(messages.messageContent)}
371
- description={formatMessage(messages.optional)}
372
- size="regular"
373
- inline
374
- />
375
- {this.getMessageContent()}
376
- </div>
377
- </div>
378
- <CapButton
379
- type="primary"
380
- disabled={disableDoneButton}
381
- onClick={this.saveFtpMessage}
382
- >
383
- <FormattedMessage {...messages.done} />
384
- </CapButton>
385
- </CapSpin>
386
- );
387
- };
388
-
389
- getColumnsHeaderPreview = (headerTagList) => (
390
- <div className="ftp-preview-data-col-container">
391
- { headerTagList.map((tag) => (
392
- <CapTag type="static" className="ftp-preview-data-col-tag">
393
- {tag.header}
394
- </CapTag>
395
- ))}
396
- </div>
397
- );
398
-
399
- getPreviewModeContents = () => {
400
- const { contents = [] } = this.props;
401
- const { messageBody = '', headerTagList = [] } = contents[0] || {};
402
- return (
403
- <div className="ftp-preview-container">
404
- <CapHeading className="ftp-preview-message-title" type="h3">
405
- <FormattedMessage {...messages.messageContent}/>
406
- </CapHeading>
407
- <CapInput.TextArea
408
- value={messageBody}
409
- disabled
410
- className="ftp-preview-message-content"
411
- />
412
- <CapHeading className="ftp-preview-data-title" type="h3">
413
- <FormattedMessage {...messages.dataPreview}/>
414
- </CapHeading>
415
- {this.getColumnsHeaderPreview(headerTagList)}
416
- </div>
417
- );
418
- };
419
-
420
- showAccountSelection = () => {
421
- this.setState({ viewMode: UIView.serverSelection, selectedServer: null});
422
- };
423
-
424
- selectCsvColumn = (option, label, index) => {
425
- const { headerTagList } = this.state;
426
- const clonedHeaderTagList = cloneDeep(headerTagList);
427
- const obj = {
428
- header: label[0],
429
- tag: option,
430
- };
431
- clonedHeaderTagList[index] = obj;
432
- this.setState({ headerTagList: clonedHeaderTagList}, () => this.disableUsedColumns());
433
- };
434
-
435
- disableUsedColumns = () => {
436
- const { headerTagList = [] } = this.state;
437
- const { selectedOfferDetails = [], metaEntities = {} } = this.props;
438
- const tags = getTreeStructuredTags({tagsList: (metaEntities.tags || {}).standard, offerDetails: selectedOfferDetails});
439
- const clonnedTagsTree = cloneDeep(tags);
440
- headerTagList.map((headerTag) => {
441
- clonnedTagsTree.map((tag, index) => {
442
- if (!isEmpty(tag.children)) { //if we have subtags it will first resolve subtag values.
443
- const subTags = this.disableUsedSubTag(tag.children, headerTag);
444
- clonnedTagsTree[index] = {
445
- ...clonnedTagsTree[index],
446
- children: subTags,
447
- };
448
- } else { // If first level itself is leaf node then I will match the usedtag value and disable it accordingly.
449
- const pos = findIndex(clonnedTagsTree, {value: headerTag.tag});
450
- if (pos > -1) {
451
- clonnedTagsTree[pos] = {
452
- disabled: true,
453
- ...clonnedTagsTree[pos],
454
- };
455
- }
456
- }
457
- });
458
- });
459
- this.setState({tagsTree: clonnedTagsTree});
460
- };
461
-
462
- disableUsedSubTag = (subTags, headerTag) => {
463
- const clonnedSubTags = cloneDeep(subTags);
464
- clonnedSubTags.map((tag, index) => {
465
- if (!isEmpty(tag.children)) { //Using recursion here to dig deep into further level if they have subtags.
466
- //if we still have subtags, it will call same function to resolved deepest subtag value first.
467
- const subTags1 = this.disableUsedSubTag(tag.children, headerTag);
468
- clonnedSubTags[index] = {
469
- ...clonnedSubTags[index],
470
- children: subTags1,
471
- };
472
- } else if (isEqual(tag.value, headerTag.tag)) { // when Leaf node, it will match usedtag value and disable usedtags from tags tree.
473
- clonnedSubTags[index] = {
474
- disabled: true,
475
- ...clonnedSubTags[index],
476
- };
477
- }
478
- return null;
479
- });
480
- return clonnedSubTags;
481
- }
482
-
483
- handleManageFTPSettings = () => {
484
- const path = `/exports/configurations`;
485
- window.open(path, '_blank');
486
- };
487
-
488
- removeCsvColumn = (item) => {
489
- const { headerTagList } = this.state;
490
- const clonedHeaderTagList = cloneDeep(headerTagList);
491
- const index = findIndex(headerTagList, (val) => val.tag === item.tag);
492
- clonedHeaderTagList.splice(index, 1);
493
- this.setState({ headerTagList: clonedHeaderTagList}, () => this.disableUsedColumns());
494
- };
495
-
496
- addNewColumn = () => {
497
- const { headerTagList } = this.state;
498
- const clonedHeaderTagList = cloneDeep(headerTagList);
499
- const newCsvObj = {
500
- header: '',
501
- tag: '',
502
- };
503
- clonedHeaderTagList.push(newCsvObj);
504
- this.setState({ headerTagList: clonedHeaderTagList});
505
- };
506
-
507
- insertAtCursor = (myValue) => {
508
- this.textArea.focus();
509
- const textAreaRef = this.textArea.textAreaRef;
510
- let pos = textAreaRef.selectionEnd + myValue.length;
511
- //IE support
512
- let newMessage = textAreaRef.value + myValue;
513
- if (document.selection) {
514
- this.textArea.focus();
515
- const sel = document.selection.createRange();
516
- sel.text = myValue;
517
- } else if (textAreaRef.selectionStart || textAreaRef.selectionStart === '0') { //MOZILLA and others
518
- const startPos = textAreaRef.selectionStart;
519
- const endPos = textAreaRef.selectionEnd;
520
- newMessage = textAreaRef.value.substring(0, startPos) + myValue + textAreaRef.value.substring(endPos, textAreaRef.value.length);
521
- pos = startPos + myValue.length;
522
- }
523
- this.setState({
524
- messageContent: newMessage,
525
- }, () => {
526
- textAreaRef.selectionStart = pos;
527
- textAreaRef.selectionEnd = pos;
528
- });
529
- };
530
-
531
- updateMessageBody = (e) => {
532
- this.setState({
533
- messageContent: e.target.value,
534
- });
535
- };
536
-
537
- saveFtpMessage = () => {
538
- const { onFTPSubmit } = this.props;
539
- const { FTPServers = [] } = this.props.FTP || {};
540
- const { selectedServer = {}, headerTagList = [], messageContent = '' } = this.state;
541
- onFTPSubmit({
542
- channel: "FTP",
543
- endPointConfigs: {
544
- endPointType: "FTP",
545
- ftpConfigId: selectedServer.id,
546
- },
547
- headerTagList,
548
- messageContent,
549
- FTPServers,
550
- });
551
- };
552
-
553
- render() {
554
- const { viewMode } = this.state;
555
- const { serverSelection } = UIView;
556
- const { mode } = this.props;
557
- return (
558
- mode === PREVIEW ?
559
- this.getPreviewModeContents() :
560
- (viewMode === serverSelection ?
561
- this.getServerSelectionContent() :
562
- this.getConfigureMessageContent()
563
- )
564
- );
565
- }
566
- }
567
-
568
- FTP.propTypes = {
569
- actions: PropTypes.object.isRequired,
570
- FTP: PropTypes.object,
571
- intl: intlShape.isRequired,
572
- globalActions: PropTypes.object,
573
- onFTPSubmit: PropTypes.func,
574
- messageDetails: PropTypes.object,
575
- mode: PropTypes.string,
576
- contents: PropTypes.array,
577
- metaEntities: PropTypes.object,
578
- selectedOfferDetails: PropTypes.array,
579
- };
580
-
581
-
582
- function mapDispatchToProps(dispatch) {
583
- return {
584
- actions: bindActionCreators(actions, dispatch),
585
- globalActions: bindActionCreators(globalActions, dispatch),
586
- };
587
- }
588
-
589
- const mapStateToProps = createStructuredSelector({
590
- FTP: makeSelectFTP(),
591
- metaEntities: makeSelectMetaEntities(),
592
- });
593
-
594
- export default withCreatives({
595
- WrappedComponent: FTP,
596
- mapStateToProps,
597
- mapDispatchToProps,
598
- suserAuth: true,
599
- });
@@ -1,68 +0,0 @@
1
- import { defineMessages } from 'react-intl';
2
-
3
- export default defineMessages({
4
- ftpServerDesc: {
5
- id: 'creatives.containersV2.FTP.ftpServerDesc',
6
- defaultMessage: 'Select the FTP server to send the message data. To add another FTP location, ',
7
- },
8
- selectFtpServerDesc: {
9
- id: 'creatives.containersV2.FTP.selectFtpServerDesc',
10
- defaultMessage: 'FTP not configured for this org. Please add FTP server ',
11
- },
12
- ftpServer: {
13
- id: 'creatives.containersV2.FTP.ftpServer',
14
- defaultMessage: 'FTP Server',
15
- },
16
- configureCsv: {
17
- id: 'creatives.containersV2.FTP.configureCsv',
18
- defaultMessage: 'Configure CSV',
19
- },
20
- addColumn: {
21
- id: 'creatives.containersV2.FTP.addColumn',
22
- defaultMessage: 'Add column',
23
- },
24
- unsupportedTagsValidationError: {
25
- id: 'creatives.containersV2.FTP.unsupportedTagsValidationError',
26
- defaultMessage: 'Unsupported tags: {unsupportedTags}. Please remove them from this message.',
27
- },
28
- selectTag: {
29
- id: 'creatives.containersV2.FTP.selectTag',
30
- defaultMessage: 'Select tag',
31
- },
32
- done: {
33
- id: 'creatives.containersV2.FTP.done',
34
- defaultMessage: 'Done',
35
- },
36
- customerID: {
37
- id: 'creatives.containersV2.FTP.customerID',
38
- defaultMessage: 'Customer ID',
39
- },
40
- change: {
41
- id: 'creatives.containersV2.FTP.change',
42
- defaultMessage: 'Change',
43
- },
44
- manageFTPSettings: {
45
- id: 'creatives.containersV2.FTP.manageFTPSettings',
46
- defaultMessage: 'manage FTP settings',
47
- },
48
- addLabel: {
49
- id: 'creatives.containersV2.FTP.addLabel',
50
- defaultMessage: 'Add Labels',
51
- },
52
- messageHeader: {
53
- id: 'creatives.containersV2.FTP.messageHeader',
54
- defaultMessage: 'Message',
55
- },
56
- messageContent: {
57
- id: 'creatives.containersV2.FTP.messageContent',
58
- defaultMessage: 'Message Content',
59
- },
60
- optional: {
61
- id: 'creatives.containersV2.FTP.optional',
62
- defaultMessage: '(optional)',
63
- },
64
- dataPreview: {
65
- id: 'creatives.containersV2.FTP.dataPreview',
66
- defaultMessage: 'Data Preview',
67
- },
68
- });
@@ -1,32 +0,0 @@
1
- import { fromJS } from 'immutable';
2
- import * as types from './constants';
3
-
4
- const initialState = fromJS({
5
- getFTPServersInProgress: false,
6
- FTPServers: [],
7
- getFTPServersError: false,
8
- });
9
-
10
- function createReducer(state = initialState, action) {
11
- switch (action.type) {
12
- case types.GET_FTP_SERVERS_REQUEST:
13
- return state
14
- .set('getFTPServersInProgress', true)
15
- .set('FTPServers', [])
16
- .set('getFTPServersInProgress', true);
17
- case types.GET_FTP_SERVERS_SUCCESS:
18
- return state
19
- .set('getFTPServersInProgress', false)
20
- .set('FTPServers', action.data)
21
- .set('getFTPServersInProgress', false);
22
- case types.GET_FTP_SERVERS_FAILURE:
23
- return state
24
- .set('getFTPServersInProgress', false)
25
- .set('FTPServers', [])
26
- .set('getFTPServersInProgress', true);
27
- default:
28
- return state;
29
- }
30
- }
31
-
32
- export default createReducer;