@capillarytech/creatives-library 7.10.26 → 7.10.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/v2Components/FormBuilder/index.js +3 -3
- package/v2Containers/CreativesContainer/SlideBoxContent.js +0 -2
- package/v2Containers/CreativesContainer/index.js +0 -1
- package/v2Containers/Sms/Create/index.js +0 -2
- package/v2Containers/Sms/Edit/index.js +0 -2
- package/v2Containers/SmsTrai/Create/index.js +67 -18
- package/v2Containers/SmsWrapper/index.js +32 -35
package/package.json
CHANGED
|
@@ -2430,7 +2430,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2430
2430
|
content={content}
|
|
2431
2431
|
charCounterEnabled={val.charCounterEnabled}
|
|
2432
2432
|
unicodeEnabled={unicodeEnabled}
|
|
2433
|
-
showTestAndPreviewIcon
|
|
2433
|
+
showTestAndPreviewIcon
|
|
2434
2434
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
2435
2435
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
2436
2436
|
module={this.props.tagModule}
|
|
@@ -3028,7 +3028,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3028
3028
|
content={content}
|
|
3029
3029
|
charCounterEnabled={val.charCounterEnabled}
|
|
3030
3030
|
unicodeEnabled={unicodeEnabled}
|
|
3031
|
-
showTestAndPreviewIcon
|
|
3031
|
+
showTestAndPreviewIcon
|
|
3032
3032
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
3033
3033
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
3034
3034
|
module={this.props.tagModule}
|
|
@@ -3081,7 +3081,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3081
3081
|
],
|
|
3082
3082
|
appName: val.content.appName,
|
|
3083
3083
|
}}
|
|
3084
|
-
showTestAndPreviewIcon
|
|
3084
|
+
showTestAndPreviewIcon
|
|
3085
3085
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
3086
3086
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
3087
3087
|
templateDataRaw={this.props.templateData}
|
|
@@ -143,7 +143,6 @@ function SlideBoxContent(props) {
|
|
|
143
143
|
showDisabledFBInfo,
|
|
144
144
|
orgUnitId,
|
|
145
145
|
smsRegister,
|
|
146
|
-
disablePreviewAndTest,
|
|
147
146
|
} = props;
|
|
148
147
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
149
148
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
@@ -426,7 +425,6 @@ function SlideBoxContent(props) {
|
|
|
426
425
|
handleClose={handleClose}
|
|
427
426
|
onCreateComplete={onCreateComplete}
|
|
428
427
|
smsRegister={smsRegister}
|
|
429
|
-
disablePreviewAndTest={disablePreviewAndTest}
|
|
430
428
|
/>
|
|
431
429
|
)}
|
|
432
430
|
{isEditFTP && (
|
|
@@ -853,7 +853,6 @@ class Creatives extends React.Component {
|
|
|
853
853
|
location={this.props.location}
|
|
854
854
|
messageDetails={this.props.messageDetails}
|
|
855
855
|
showDisabledFBInfo={this.props.showDisabledFBInfo}
|
|
856
|
-
disablePreviewAndTest={this.props.disablePreviewAndTest}
|
|
857
856
|
getFormData={this.getFormData}
|
|
858
857
|
onCallTaskSubmit={this.onCallTaskSubmit}
|
|
859
858
|
onCreateNew={this.onCreateNew}
|
|
@@ -989,7 +989,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
989
989
|
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
990
990
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
991
991
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
992
|
-
disablePreviewAndTest={this.props.disablePreviewAndTest}
|
|
993
992
|
/>
|
|
994
993
|
</CapColumn>
|
|
995
994
|
</CapRow>
|
|
@@ -1016,7 +1015,6 @@ Create.propTypes = {
|
|
|
1016
1015
|
getFormSubscriptionData: PropTypes.func,
|
|
1017
1016
|
isLoadingMetaEntities: PropTypes.bool,
|
|
1018
1017
|
selectedOfferDetails: PropTypes.array,
|
|
1019
|
-
disablePreviewAndTest: PropTypes.bool,
|
|
1020
1018
|
};
|
|
1021
1019
|
|
|
1022
1020
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -987,7 +987,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
987
987
|
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
988
988
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
989
989
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
990
|
-
disablePreviewAndTest={this.props.disablePreviewAndTest}
|
|
991
990
|
/>
|
|
992
991
|
</CapColumn>
|
|
993
992
|
</CapRow>
|
|
@@ -1017,7 +1016,6 @@ Edit.propTypes = {
|
|
|
1017
1016
|
// route: PropTypes.object,
|
|
1018
1017
|
injectedTags: PropTypes.object,
|
|
1019
1018
|
selectedOfferDetails: PropTypes.array,
|
|
1020
|
-
disablePreviewAndTest: PropTypes.bool,
|
|
1021
1019
|
};
|
|
1022
1020
|
|
|
1023
1021
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
APPROVED,
|
|
40
40
|
ACTIVE,
|
|
41
41
|
REGISTERED,
|
|
42
|
+
TEMPLATE_NAME,
|
|
42
43
|
TEMPLATE_ID_ALIASES,
|
|
43
44
|
TEMPLATE_MESSAGE_ALIASES,
|
|
44
45
|
STATUS_ALIASES,
|
|
@@ -87,6 +88,16 @@ export const SmsTraiCreate = (props) => {
|
|
|
87
88
|
(column) => column.toLowerCase().trim() === columnName,
|
|
88
89
|
);
|
|
89
90
|
|
|
91
|
+
const getIndexesofColumns = (allColumnNames, columnNames) => {
|
|
92
|
+
const indexes = [];
|
|
93
|
+
allColumnNames.forEach((colName, index) => {
|
|
94
|
+
if (columnNames.includes(colName.toLowerCase().trim())) {
|
|
95
|
+
indexes.push(index);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return indexes;
|
|
99
|
+
};
|
|
100
|
+
|
|
90
101
|
const headerValidationHandler = (senderIdString) => {
|
|
91
102
|
//each row must contain atleast 1 header
|
|
92
103
|
//each header can be either 6 letters or 6 numbers, no mixing
|
|
@@ -123,6 +134,34 @@ export const SmsTraiCreate = (props) => {
|
|
|
123
134
|
return isError;
|
|
124
135
|
};
|
|
125
136
|
|
|
137
|
+
const duplicateTemplateNameValidation = (
|
|
138
|
+
transformedResults,
|
|
139
|
+
templateNameObj,
|
|
140
|
+
) => {
|
|
141
|
+
//filtering and extracting index of template names with more than 1 occurence
|
|
142
|
+
const duplicateTemplateNameRows =
|
|
143
|
+
Object.values(templateNameObj)
|
|
144
|
+
?.filter((i) => i.count > 1)
|
|
145
|
+
?.map((i) => i.csvRow)
|
|
146
|
+
?.flat()
|
|
147
|
+
?.sort((a, b) => a - b) || [];
|
|
148
|
+
let duplicateTemplateNameCounts = 0;
|
|
149
|
+
|
|
150
|
+
//only if there are atleast 2 duplicate template names
|
|
151
|
+
if (duplicateTemplateNameRows.length > 1) {
|
|
152
|
+
duplicateTemplateNameRows.forEach((row) => {
|
|
153
|
+
if (!transformedResults[row][transformedResults[row]?.length - 1]) {
|
|
154
|
+
duplicateTemplateNameCounts += 1;
|
|
155
|
+
}
|
|
156
|
+
transformedResults[row][
|
|
157
|
+
transformedResults[row]?.length - 1
|
|
158
|
+
] += ` Duplicate template names are not allowed.`;
|
|
159
|
+
});
|
|
160
|
+
setTotalFailCount((prev) => prev + duplicateTemplateNameCounts);
|
|
161
|
+
}
|
|
162
|
+
return transformedResults;
|
|
163
|
+
};
|
|
164
|
+
|
|
126
165
|
const checkCSVRowsValidation = (
|
|
127
166
|
transformedResults,
|
|
128
167
|
selectedHeaderAlias,
|
|
@@ -137,42 +176,54 @@ export const SmsTraiCreate = (props) => {
|
|
|
137
176
|
transformedResults[0],
|
|
138
177
|
selectedTemplateIdAlias,
|
|
139
178
|
);
|
|
140
|
-
const
|
|
179
|
+
const statusIndexes = getIndexesofColumns(
|
|
141
180
|
transformedResults[0],
|
|
142
181
|
selectedStatusAlias,
|
|
143
182
|
);
|
|
183
|
+
const templateNameIndex = getIndexofColumn(
|
|
184
|
+
transformedResults[0],
|
|
185
|
+
TEMPLATE_NAME,
|
|
186
|
+
);
|
|
187
|
+
const templateNameObj = {};
|
|
144
188
|
|
|
145
189
|
for (let row = 1; row < transformedResults.length; row += 1) {
|
|
146
190
|
const errorArray = [];
|
|
147
191
|
const columnErrorArray = [];
|
|
148
192
|
let rejectionReasons = '';
|
|
193
|
+
let statusErrorIndicator = true;
|
|
149
194
|
//adding rejection reasons
|
|
150
195
|
transformedResults[row].forEach((cell, index) => {
|
|
151
196
|
if (index === headerIndex && headerValidationHandler(cell)) {
|
|
152
197
|
columnErrorArray.push(
|
|
153
198
|
`${selectedHeaderAlias.toUpperCase()} is mandatory and each ${selectedHeaderAlias.toUpperCase()} must contain either 6 letters or 6 digits. It cannot contain special characters. `,
|
|
154
199
|
);
|
|
155
|
-
} else if (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
cell.toLowerCase() !== APPROVED
|
|
200
|
+
} else if (statusIndexes.includes(index) &&
|
|
201
|
+
(cell.toLowerCase() === ACTIVE ||
|
|
202
|
+
cell.toLowerCase() === REGISTERED ||
|
|
203
|
+
cell.toLowerCase() === APPROVED)
|
|
160
204
|
) {
|
|
161
|
-
|
|
162
|
-
`Only Templates with active/registered/approved status will be created.`,
|
|
163
|
-
);
|
|
205
|
+
statusErrorIndicator = false;
|
|
164
206
|
} else if (index === templateIdIndex && templateIdValidation(cell)) {
|
|
165
207
|
columnErrorArray.push(
|
|
166
208
|
`${selectedTemplateIdAlias.toUpperCase()} is mandatory and ${selectedTemplateIdAlias.toUpperCase()} must be numeric.`,
|
|
167
209
|
);
|
|
168
|
-
} else if (
|
|
169
|
-
!cell &&
|
|
170
|
-
![headerIndex, templateIdIndex, statusIndex].includes(index)
|
|
171
|
-
) {
|
|
210
|
+
} else if (!cell && ![headerIndex, templateIdIndex, ...statusIndexes].includes(index)) {
|
|
172
211
|
errorArray.push(`"${transformedResults[0][index]}"`);
|
|
212
|
+
} else if (index === templateNameIndex && cell) {
|
|
213
|
+
if (templateNameObj[cell]) {
|
|
214
|
+
templateNameObj[cell]['count'] += 1;
|
|
215
|
+
templateNameObj[cell]['csvRow']?.push(row);
|
|
216
|
+
} else {
|
|
217
|
+
templateNameObj[cell] = { count: 1, csvRow: [row] };
|
|
218
|
+
}
|
|
173
219
|
}
|
|
174
220
|
});
|
|
175
221
|
|
|
222
|
+
if (statusErrorIndicator) {
|
|
223
|
+
columnErrorArray.push(
|
|
224
|
+
`Only templates with active/registered/approved status will be created.`,
|
|
225
|
+
);
|
|
226
|
+
}
|
|
176
227
|
if (errorArray.length !== 0) {
|
|
177
228
|
rejectionReasons = `${rejectionReasons} Please include these mandatory fields value: ${errorArray.join(
|
|
178
229
|
' ',
|
|
@@ -190,7 +241,7 @@ export const SmsTraiCreate = (props) => {
|
|
|
190
241
|
}
|
|
191
242
|
}
|
|
192
243
|
uploadValidated = true;
|
|
193
|
-
return transformedResults;
|
|
244
|
+
return duplicateTemplateNameValidation(transformedResults, templateNameObj);
|
|
194
245
|
};
|
|
195
246
|
|
|
196
247
|
const checkCSVValidation = (results, file) => {
|
|
@@ -368,7 +419,7 @@ export const SmsTraiCreate = (props) => {
|
|
|
368
419
|
transformedResults,
|
|
369
420
|
headerAliasPresent[0],
|
|
370
421
|
templateIdAliasPresent[0],
|
|
371
|
-
statusAliasPresent
|
|
422
|
+
statusAliasPresent,
|
|
372
423
|
);
|
|
373
424
|
};
|
|
374
425
|
|
|
@@ -745,9 +796,7 @@ export const SmsTraiCreate = (props) => {
|
|
|
745
796
|
{formatMessage(messages.uploadInstructions)}
|
|
746
797
|
</CapHeading>
|
|
747
798
|
<div className="upload-instruction-list">
|
|
748
|
-
<InstructionComp
|
|
749
|
-
message={formatMessage(messages.deferEdit)}
|
|
750
|
-
/>
|
|
799
|
+
<InstructionComp message={formatMessage(messages.deferEdit)} />
|
|
751
800
|
<InstructionComp
|
|
752
801
|
message={
|
|
753
802
|
<FormattedMessage
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* SmsWrapper
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
|
-
import PropTypes from
|
|
7
|
-
import React from
|
|
8
|
-
import SmsCreate from
|
|
9
|
-
import { isTraiDLTEnable } from
|
|
10
|
-
import SmsEdit from
|
|
11
|
-
import SmsTraiCreate from
|
|
12
|
-
import SmsTraiEdit from
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import SmsCreate from '../Sms/Create';
|
|
9
|
+
import { isTraiDLTEnable } from '../../utils/common';
|
|
10
|
+
import SmsEdit from '../Sms/Edit';
|
|
11
|
+
import SmsTraiCreate from '../SmsTrai/Create';
|
|
12
|
+
import SmsTraiEdit from '../SmsTrai/Edit';
|
|
13
13
|
const SmsWrapper = (props) => {
|
|
14
14
|
const {
|
|
15
15
|
isCreateSms,
|
|
@@ -29,14 +29,13 @@ const SmsWrapper = (props) => {
|
|
|
29
29
|
handleClose,
|
|
30
30
|
smsRegister,
|
|
31
31
|
onShowTemplates,
|
|
32
|
-
disablePreviewAndTest,
|
|
33
32
|
} = props;
|
|
34
33
|
|
|
35
34
|
const smsProps = {
|
|
36
35
|
onCreateComplete,
|
|
37
36
|
setIsLoadingContent,
|
|
38
37
|
location,
|
|
39
|
-
route: { name:
|
|
38
|
+
route: { name: 'sms' },
|
|
40
39
|
isGetFormData,
|
|
41
40
|
getFormSubscriptionData,
|
|
42
41
|
getDefaultTags,
|
|
@@ -45,38 +44,36 @@ const SmsWrapper = (props) => {
|
|
|
45
44
|
selectedOfferDetails,
|
|
46
45
|
onPreviewContentClicked,
|
|
47
46
|
onTestContentClicked,
|
|
48
|
-
disablePreviewAndTest,
|
|
49
47
|
};
|
|
50
48
|
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
{isEditSms &&
|
|
64
|
-
(isTraiDlt ? (
|
|
65
|
-
<SmsTraiEdit
|
|
66
|
-
{...smsProps}
|
|
67
|
-
params={{ id: templateData._id }}
|
|
68
|
-
templateData={templateData}
|
|
69
|
-
handleClose={handleClose}
|
|
49
|
+
return <>
|
|
50
|
+
{
|
|
51
|
+
isCreateSms && (isTraiDlt ?
|
|
52
|
+
<SmsTraiCreate
|
|
53
|
+
isComponent
|
|
54
|
+
{...smsProps}
|
|
55
|
+
onShowTemplates={onShowTemplates}
|
|
56
|
+
/> :
|
|
57
|
+
<SmsCreate
|
|
58
|
+
isComponent {
|
|
59
|
+
...smsProps
|
|
60
|
+
}
|
|
70
61
|
/>
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
{isEditSms && (isTraiDlt ?
|
|
65
|
+
<SmsTraiEdit
|
|
66
|
+
{...smsProps}
|
|
67
|
+
params={{id: templateData._id}}
|
|
68
|
+
templateData={templateData}
|
|
69
|
+
handleClose={handleClose}
|
|
70
|
+
/> : <SmsEdit
|
|
73
71
|
{...smsProps}
|
|
74
|
-
params={{
|
|
72
|
+
params={{id: templateData._id}}
|
|
75
73
|
templateData={templateData}
|
|
76
74
|
/>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
);
|
|
75
|
+
)}
|
|
76
|
+
</>;
|
|
80
77
|
};
|
|
81
78
|
|
|
82
79
|
export default SmsWrapper;
|