@capillarytech/creatives-library 7.10.9 → 7.10.11
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/config/app.js +1 -0
- package/package.json +2 -3
- package/utils/common.js +7 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +16 -4
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +6 -4
- package/v2Containers/CreativesContainer/index.js +53 -8
- package/v2Containers/SmsTrai/Create/constants.js +32 -37
- package/v2Containers/SmsTrai/Create/index.js +95 -45
- package/v2Containers/SmsTrai/Create/messages.js +20 -17
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +3996 -875
- package/v2Containers/SmsTrai/Create/tests/index.test.js +10 -0
- package/v2Containers/SmsTrai/Create/tests/mockData.js +2 -2
- package/v2Containers/SmsTrai/Edit/index.js +249 -103
- package/v2Containers/SmsTrai/Edit/messages.js +14 -1
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +12487 -810
- package/v2Containers/SmsTrai/Edit/tests/index.test.js +8 -1
- package/v2Containers/SmsWrapper/index.js +14 -10
- package/v2Containers/Templates/index.js +13 -6
- package/v2Containers/TemplatesV2/index.js +2 -1
package/config/app.js
CHANGED
|
@@ -17,6 +17,7 @@ const config = {
|
|
|
17
17
|
},
|
|
18
18
|
development: {
|
|
19
19
|
api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
|
|
20
|
+
//api_endpoint: 'http://localhost:2022/arya/api/v1/creatives',
|
|
20
21
|
campaigns_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/campaigns',
|
|
21
22
|
campaigns_api_org_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/org/campaign',
|
|
22
23
|
auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/creatives-library",
|
|
3
3
|
"author": "meharaj",
|
|
4
|
-
"version": "7.10.
|
|
4
|
+
"version": "7.10.11",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -12,10 +12,9 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "LicenseRef-LICENSE",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@babel/polyfill": "7.4.3",
|
|
16
15
|
"@bugsnag/js": "^7.2.1",
|
|
17
16
|
"@bugsnag/plugin-react": "^7.2.1",
|
|
18
|
-
"@capillarytech/cap-ui-utils": "1.4.
|
|
17
|
+
"@capillarytech/cap-ui-utils": "1.4.2",
|
|
19
18
|
"@mailupinc/bee-plugin": "^1.2.0",
|
|
20
19
|
"babel-cli": "^6.26.0",
|
|
21
20
|
"chalk": "1.1.3",
|
package/utils/common.js
CHANGED
|
@@ -255,3 +255,10 @@ export const bytes2Size = (bytes, decimals = 2) => {
|
|
|
255
255
|
|
|
256
256
|
return `${Math.ceil((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
257
257
|
};
|
|
258
|
+
|
|
259
|
+
export const isTraiDLTEnable = (isFullMode, smsRegister) => {
|
|
260
|
+
const isTraiDltFeatureForOrg = hasTraiDltFeature();
|
|
261
|
+
const isTraiEnableforLib = (!isFullMode && smsRegister === "DLT") || isFullMode;
|
|
262
|
+
const isTraiDltFeature = isTraiDltFeatureForOrg && isTraiEnableforLib;
|
|
263
|
+
return isTraiDltFeature;
|
|
264
|
+
};
|
|
@@ -142,6 +142,7 @@ function SlideBoxContent(props) {
|
|
|
142
142
|
fbAdManager,
|
|
143
143
|
showDisabledFBInfo,
|
|
144
144
|
orgUnitId,
|
|
145
|
+
smsRegister,
|
|
145
146
|
} = props;
|
|
146
147
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
147
148
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
@@ -201,12 +202,18 @@ function SlideBoxContent(props) {
|
|
|
201
202
|
|
|
202
203
|
const getChannelPreviewContent = (templateDataObject) => {
|
|
203
204
|
switch (templateDataObject.type.toUpperCase()) {
|
|
204
|
-
case constants.SMS:
|
|
205
|
-
|
|
205
|
+
case constants.SMS: {
|
|
206
|
+
const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
207
|
+
const updatedSmsEditor = get(
|
|
208
|
+
templateDataObject,
|
|
209
|
+
`versions.base['updated-sms-editor']`,
|
|
210
|
+
'',
|
|
211
|
+
);
|
|
212
|
+
if (!isTraiDlt || updatedSmsEditor === '') {
|
|
206
213
|
return get(templateDataObject, `versions.base['sms-editor']`);
|
|
207
|
-
} else {
|
|
208
|
-
return templateDataObject.versions.base['updated-sms-editor']?.join('');
|
|
209
214
|
}
|
|
215
|
+
return updatedSmsEditor.join('');
|
|
216
|
+
}
|
|
210
217
|
case constants.LINE: {
|
|
211
218
|
const lineContents = get(templateDataObject, `versions.base.content.messages`, [{}]);
|
|
212
219
|
const previewContent = [];
|
|
@@ -347,6 +354,7 @@ function SlideBoxContent(props) {
|
|
|
347
354
|
messageStrategy={messageStrategy}
|
|
348
355
|
showDisabledFBInfo={showDisabledFBInfo}
|
|
349
356
|
orgUnitId={orgUnitId}
|
|
357
|
+
smsRegister={smsRegister}
|
|
350
358
|
/>
|
|
351
359
|
)}
|
|
352
360
|
{isPreview && (
|
|
@@ -416,6 +424,7 @@ function SlideBoxContent(props) {
|
|
|
416
424
|
onTestContentClicked={onTestContentClicked}
|
|
417
425
|
handleClose={handleClose}
|
|
418
426
|
onCreateComplete={onCreateComplete}
|
|
427
|
+
smsRegister={smsRegister}
|
|
419
428
|
/>
|
|
420
429
|
)}
|
|
421
430
|
{isEditFTP && (
|
|
@@ -463,6 +472,8 @@ function SlideBoxContent(props) {
|
|
|
463
472
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
464
473
|
onTestContentClicked={onTestContentClicked}
|
|
465
474
|
onCreateComplete={onCreateComplete}
|
|
475
|
+
smsRegister={smsRegister}
|
|
476
|
+
onShowTemplates={onShowTemplates}
|
|
466
477
|
/>
|
|
467
478
|
)}
|
|
468
479
|
|
|
@@ -716,5 +727,6 @@ SlideBoxContent.propTypes = {
|
|
|
716
727
|
fbAdManager: PropTypes.string,
|
|
717
728
|
showDisabledFBInfo: PropTypes.boolean,
|
|
718
729
|
orgUnitId: PropTypes.any,
|
|
730
|
+
smsRegister: PropTypes.any,
|
|
719
731
|
};
|
|
720
732
|
export default SlideBoxContent;
|
|
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import messages from './messages';
|
|
8
8
|
import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
|
|
9
9
|
import { NO_COMMUNICATION, FTP } from '../App/constants';
|
|
10
|
-
import {
|
|
10
|
+
import { isTraiDLTEnable } from '../../utils/common';
|
|
11
11
|
const PrefixWrapper = styled.div`
|
|
12
12
|
margin-right: 16px;
|
|
13
13
|
`;
|
|
@@ -25,11 +25,12 @@ function getChannelLabel(channel = '') {
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
function SlideBoxHeader(props) {
|
|
28
|
-
const { slidBoxContent, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix, shouldShowTemplateName, channel, templateNameRenderProp, weChatTemplateType, onWeChatMaptemplateStepChange, weChatMaptemplateStep, templateStep } = props;
|
|
28
|
+
const { slidBoxContent, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix, shouldShowTemplateName, channel, templateNameRenderProp, weChatTemplateType, onWeChatMaptemplateStepChange, weChatMaptemplateStep, templateStep, smsRegister } = props;
|
|
29
29
|
const showTemplateNameHeader = isFullMode && shouldShowTemplateName;
|
|
30
30
|
const mapTemplateCreate = !showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
31
|
-
const
|
|
32
|
-
const showCreateTraiSMSHeader =
|
|
31
|
+
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
32
|
+
const showCreateTraiSMSHeader = isTraiDlt && channel.toLowerCase() === "sms";
|
|
33
|
+
|
|
33
34
|
return (
|
|
34
35
|
<div key="creatives-container-slidebox-header-content">
|
|
35
36
|
{slidBoxContent === 'templates' && !showTemplateNameHeader && (
|
|
@@ -103,5 +104,6 @@ SlideBoxHeader.propTypes = {
|
|
|
103
104
|
channel: PropTypes.string,
|
|
104
105
|
shouldShowTemplateName: PropTypes.bool,
|
|
105
106
|
templateNameRenderProp: PropTypes.func,
|
|
107
|
+
smsRegister: PropTypes.any,
|
|
106
108
|
};
|
|
107
109
|
export default SlideBoxHeader;
|
|
@@ -156,7 +156,7 @@ class Creatives extends React.Component {
|
|
|
156
156
|
this.setState({ isGetFormData: false });
|
|
157
157
|
};
|
|
158
158
|
getTemplateData = (templateData) => { //from consumers to creatives
|
|
159
|
-
const {isFullMode, messageDetails = {}} = this.props;
|
|
159
|
+
const { isFullMode, messageDetails = {}, smsRegister } = this.props;
|
|
160
160
|
const { additionalProperties = {} } = messageDetails;
|
|
161
161
|
if (!isFullMode && templateData) { // for component mode
|
|
162
162
|
const {channel} = templateData;
|
|
@@ -170,9 +170,28 @@ class Creatives extends React.Component {
|
|
|
170
170
|
break;
|
|
171
171
|
}
|
|
172
172
|
case constants.SMS: {
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
174
|
+
let formData = {};
|
|
175
|
+
if (isTraiDlt) {
|
|
176
|
+
const {
|
|
177
|
+
template_id = '',
|
|
178
|
+
header = '',
|
|
179
|
+
template_name = '',
|
|
180
|
+
'sms-editor': smsEditor = '',
|
|
181
|
+
'var-mapped': varMapped = {},
|
|
182
|
+
} = templateData;
|
|
183
|
+
formData = {
|
|
184
|
+
template_id,
|
|
185
|
+
header,
|
|
186
|
+
template_name,
|
|
187
|
+
'sms-editor': smsEditor,
|
|
188
|
+
'var-mapped': varMapped,
|
|
189
|
+
};
|
|
190
|
+
} else {
|
|
191
|
+
formData = {
|
|
192
|
+
'sms-editor': templateData.messageBody,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
176
195
|
creativesTemplateData = {
|
|
177
196
|
type: channel,
|
|
178
197
|
name: "Campaign message SMS content",
|
|
@@ -286,14 +305,14 @@ class Creatives extends React.Component {
|
|
|
286
305
|
type: constants.FACEBOOK,
|
|
287
306
|
edit: true,
|
|
288
307
|
selectedFacebookAccount,
|
|
289
|
-
fbContentType
|
|
308
|
+
fbContentType,
|
|
290
309
|
};
|
|
291
310
|
} else {
|
|
292
311
|
creativesTemplateData = {
|
|
293
312
|
selectedMarketingObjective: templateData.selectedMarketingObjective,
|
|
294
313
|
edit: true,
|
|
295
314
|
type: channel,
|
|
296
|
-
fbContentType: templateData.fbContentType
|
|
315
|
+
fbContentType: templateData.fbContentType,
|
|
297
316
|
};
|
|
298
317
|
}
|
|
299
318
|
break;
|
|
@@ -357,7 +376,31 @@ class Creatives extends React.Component {
|
|
|
357
376
|
switch (channel) {
|
|
358
377
|
case constants.SMS:
|
|
359
378
|
if (template.value.base) {
|
|
360
|
-
|
|
379
|
+
const smsBase = template.value.base || {};
|
|
380
|
+
const { isFullMode, smsRegister } = this.props;
|
|
381
|
+
const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
382
|
+
const {
|
|
383
|
+
'updated-sms-editor': updatedSmsEditor,
|
|
384
|
+
'sms-editor': smsEditor,
|
|
385
|
+
} = smsBase;
|
|
386
|
+
if (!isTraiDlt) {
|
|
387
|
+
templateData.messageBody = smsEditor;
|
|
388
|
+
} else {
|
|
389
|
+
templateData.messageBody = updatedSmsEditor === "" ? smsEditor : updatedSmsEditor.join('');
|
|
390
|
+
const {
|
|
391
|
+
template_id,
|
|
392
|
+
template_name,
|
|
393
|
+
header,
|
|
394
|
+
'var-mapped': varMapped,
|
|
395
|
+
} = smsBase;
|
|
396
|
+
templateData.templateConfigs = {
|
|
397
|
+
templateId: template_id,
|
|
398
|
+
templateName: template_name,
|
|
399
|
+
template: smsEditor,
|
|
400
|
+
registeredSenderIds: header,
|
|
401
|
+
templateVariableMapping: varMapped,
|
|
402
|
+
};
|
|
403
|
+
}
|
|
361
404
|
}
|
|
362
405
|
break;
|
|
363
406
|
case constants.EMAIL:
|
|
@@ -771,7 +814,7 @@ class Creatives extends React.Component {
|
|
|
771
814
|
}
|
|
772
815
|
render() {
|
|
773
816
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
774
|
-
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor} = this.props;
|
|
817
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor, smsRegister} = this.props;
|
|
775
818
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
776
819
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
777
820
|
return (
|
|
@@ -795,6 +838,7 @@ class Creatives extends React.Component {
|
|
|
795
838
|
weChatTemplateType={weChatTemplateType}
|
|
796
839
|
showPrefix={!isUploading} // not show back button when email template is being uploaded
|
|
797
840
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
841
|
+
smsRegister={smsRegister}
|
|
798
842
|
/>}
|
|
799
843
|
content={
|
|
800
844
|
<SlideBoxContent
|
|
@@ -848,6 +892,7 @@ class Creatives extends React.Component {
|
|
|
848
892
|
handleClose={this.handleCloseSlideBox}
|
|
849
893
|
onFTPSubmit={getCreativesData}
|
|
850
894
|
editor={editor}
|
|
895
|
+
smsRegister={smsRegister}
|
|
851
896
|
messageStrategy={this.props.strategy}
|
|
852
897
|
orgUnitId={this.props.orgUnitId}
|
|
853
898
|
/>
|
|
@@ -1,34 +1,27 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* SmsTrai constants
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
export const DEFAULT_ACTION = 'app/SmsTrai/DEFAULT_ACTION';
|
|
8
2
|
export const APPROVAL_STATUS = 'approval status';
|
|
3
|
+
export const STATUS = 'status';
|
|
9
4
|
export const TEMPLATE_NAME = 'template name';
|
|
10
5
|
export const TYPE = 'type';
|
|
11
6
|
export const HEADER = 'header';
|
|
12
7
|
export const TEMPLATE_ID = 'template id';
|
|
13
8
|
export const SMS = 'SMS';
|
|
14
|
-
|
|
15
9
|
export const MAPPED_SAVED_COLUMN = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'TEMPLATE
|
|
27
|
-
'TEMPLATE CONTENT':
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
'TEMPLATE ID': 'template_id',
|
|
11
|
+
'TEMPLATE REGISTRATION NUMBER': 'template_id',
|
|
12
|
+
'TEMPLATE NAME': 'template_name',
|
|
13
|
+
'TYPE': 'type',
|
|
14
|
+
'HEADER': 'header',
|
|
15
|
+
'SENDER ID': 'header',
|
|
16
|
+
'SENDERS': 'header',
|
|
17
|
+
'HEADER ID': 'header',
|
|
18
|
+
'HEADERS': 'header',
|
|
19
|
+
'CATEGORY': 'category',
|
|
20
|
+
'TEMPLATE MESSAGE': 'sms-editor',
|
|
21
|
+
'TEMPLATE CONTENT': 'sms-editor',
|
|
22
|
+
'CONSENT TYPE': 'consent-type',
|
|
23
|
+
'COMMUNICATION TYPE': 'consent-type',
|
|
30
24
|
};
|
|
31
|
-
|
|
32
25
|
export const HEADER_ALIASES = [
|
|
33
26
|
HEADER,
|
|
34
27
|
'sender id',
|
|
@@ -36,39 +29,41 @@ export const HEADER_ALIASES = [
|
|
|
36
29
|
'header id',
|
|
37
30
|
'headers',
|
|
38
31
|
];
|
|
39
|
-
|
|
40
32
|
export const TEMPLATE_ID_ALIASES = [
|
|
41
33
|
'template id',
|
|
42
34
|
'template registration number',
|
|
43
35
|
];
|
|
44
|
-
|
|
45
36
|
export const TEMPLATE_MESSAGE_ALIASES = [
|
|
46
37
|
'template message',
|
|
47
38
|
'template content',
|
|
48
39
|
];
|
|
49
|
-
|
|
40
|
+
export const STATUS_ALIASES = [
|
|
41
|
+
'status',
|
|
42
|
+
'template status',
|
|
43
|
+
];
|
|
50
44
|
export const MANDATORY_COLUMNS = [TEMPLATE_NAME, TYPE, APPROVAL_STATUS];
|
|
51
|
-
export const SAVED_COLUMNS = [TEMPLATE_NAME, TYPE,
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
export const SAVED_COLUMNS = [TEMPLATE_NAME, TYPE, 'category', 'consent type'];
|
|
54
46
|
export const SAMPLE_CSV_DATA = [
|
|
55
47
|
[
|
|
56
|
-
'TEMPLATE ID',
|
|
57
48
|
'TEMPLATE NAME',
|
|
49
|
+
'TEMPLATE ID',
|
|
58
50
|
'TYPE',
|
|
59
|
-
'
|
|
51
|
+
'SENDER ID',
|
|
60
52
|
'APPROVAL STATUS',
|
|
53
|
+
'STATUS',
|
|
61
54
|
'TEMPLATE MESSAGE',
|
|
62
55
|
],
|
|
63
56
|
];
|
|
64
|
-
|
|
65
57
|
export const DOWNLOAD_ISSUES_CSV = 'Downloaded issues.csv';
|
|
66
58
|
export const SAMPLE_CSV = 'Sample.csv';
|
|
67
59
|
export const CAPILLARY_REJECTION_REASON = 'CAPILLARY REJECTION REASON';
|
|
68
60
|
export const APPROVED = 'approved';
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export const CREATE_TRAI_SMS_TEMPLATE_SUCCESS =
|
|
73
|
-
|
|
74
|
-
export const
|
|
61
|
+
export const ACTIVE = 'active';
|
|
62
|
+
export const CREATE_TRAI_SMS_TEMPLATE_REQUEST =
|
|
63
|
+
'app/v2Containers/SmsTrai/Create/CREATE_TRAI_SMS_TEMPLATE_REQUEST';
|
|
64
|
+
export const CREATE_TRAI_SMS_TEMPLATE_SUCCESS =
|
|
65
|
+
'app/v2Containers/SmsTrai/Create/CREATE_TRAI_SMS_TEMPLATE_SUCCESS';
|
|
66
|
+
export const CREATE_TRAI_SMS_TEMPLATE_FAILURE =
|
|
67
|
+
'app/v2Containers/SmsTrai/Create/CREATE_TRAI_SMS_TEMPLATE_FAILURE';
|
|
68
|
+
export const CLEAR_TRAI_SMS_TEMPLATE_CREATE_RESPONSE_REQUEST =
|
|
69
|
+
'app/v2Containers/SmsTrai/Create/CLEAR_TRAI_SMS_TEMPLATE_CREATE_RESPONSE_REQUEST';
|