@capillarytech/creatives-library 7.11.9 → 7.11.12
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 +0 -1
- package/package.json +1 -2
- package/v2Components/CapImageUpload/messages.js +1 -1
- package/v2Components/TemplatePreview/_templatePreview.scss +1 -1
- package/v2Components/TemplatePreview/index.js +30 -32
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +33 -1
- package/v2Components/TemplatePreview/tests/index.test.js +7 -7
- package/v2Containers/CreativesContainer/SlideBoxContent.js +2 -2
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +24 -4
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +23 -4
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +147 -2
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +98 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +71 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +21 -9
- package/v2Containers/MobilePush/Edit/index.js +21 -34
- package/v2Containers/Rcs/actions.js +34 -6
- package/v2Containers/Rcs/constants.js +21 -8
- package/v2Containers/Rcs/index.js +203 -78
- package/v2Containers/Rcs/index.scss +21 -3
- package/v2Containers/Rcs/messages.js +18 -5
- package/v2Containers/Rcs/reducer.js +49 -14
- package/v2Containers/Rcs/sagas.js +87 -18
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +145080 -0
- package/v2Containers/Rcs/tests/index.test.js +226 -0
- package/v2Containers/Rcs/tests/mockData.js +169 -0
- package/v2Containers/Rcs/utils.js +24 -21
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -4
- package/v2Containers/mockdata.js +567 -1588
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/* eslint-disable no-unused-expressions */
|
|
2
|
-
/* eslint-disable indent */
|
|
3
|
-
/* eslint-disable no-unused-vars */
|
|
4
2
|
import React, { useState, useEffect, useCallback } from 'react';
|
|
5
3
|
import { bindActionCreators } from 'redux';
|
|
6
4
|
import { createStructuredSelector } from 'reselect';
|
|
7
5
|
import { injectIntl, FormattedMessage } from 'react-intl';
|
|
8
|
-
import { get } from 'lodash';
|
|
6
|
+
import { get, isEmpty, cloneDeep } from 'lodash';
|
|
9
7
|
import styled from 'styled-components';
|
|
10
8
|
import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
|
|
11
9
|
import CapRow from '@capillarytech/cap-ui-library/CapRow';
|
|
@@ -26,6 +24,8 @@ import CapCustomCard from '@capillarytech/cap-ui-library/CapCustomCard';
|
|
|
26
24
|
import CapDropdown from '@capillarytech/cap-ui-library/CapDropdown';
|
|
27
25
|
import CapMenu from '@capillarytech/cap-ui-library/CapMenu';
|
|
28
26
|
import CapNotification from '@capillarytech/cap-ui-library/CapNotification';
|
|
27
|
+
import CapTooltipWithInfo from '@capillarytech/cap-ui-library/CapTooltipWithInfo';
|
|
28
|
+
import CapError from '@capillarytech/cap-ui-library/CapError';
|
|
29
29
|
import {
|
|
30
30
|
CAP_G01,
|
|
31
31
|
CAP_SPACE_16,
|
|
@@ -42,12 +42,15 @@ import {
|
|
|
42
42
|
setInjectedTags,
|
|
43
43
|
} from '../Cap/selectors';
|
|
44
44
|
import * as RcsActions from './actions';
|
|
45
|
+
import * as TemplatesActions from '../Templates/actions';
|
|
45
46
|
import './index.scss';
|
|
46
47
|
import {
|
|
47
48
|
RCS,
|
|
48
49
|
SMS,
|
|
49
50
|
RCS_MEDIA_TYPES,
|
|
50
|
-
|
|
51
|
+
TEMPLATE_TITLE_MAX_LENGTH,
|
|
52
|
+
TEMPLATE_DESC_MAX_LENGTH,
|
|
53
|
+
FALLBACK_MESSAGE_MAX_LENGTH,
|
|
51
54
|
TAG,
|
|
52
55
|
EMBEDDED,
|
|
53
56
|
DEFAULT,
|
|
@@ -84,6 +87,7 @@ export const Rcs = (props) => {
|
|
|
84
87
|
params,
|
|
85
88
|
templateData = {},
|
|
86
89
|
rcsData = {},
|
|
90
|
+
templatesActions,
|
|
87
91
|
globalActions,
|
|
88
92
|
location,
|
|
89
93
|
getDefaultTags,
|
|
@@ -142,6 +146,7 @@ export const Rcs = (props) => {
|
|
|
142
146
|
},
|
|
143
147
|
];
|
|
144
148
|
|
|
149
|
+
const isMediaTypeNone = templateMediaType === RCS_MEDIA_TYPES.NONE;
|
|
145
150
|
const RcsFooter = styled.div`
|
|
146
151
|
background-color: ${CAP_WHITE};
|
|
147
152
|
position: fixed;
|
|
@@ -162,6 +167,71 @@ export const Rcs = (props) => {
|
|
|
162
167
|
margin-bottom: 6px;
|
|
163
168
|
`;
|
|
164
169
|
|
|
170
|
+
//gets template details
|
|
171
|
+
const paramObj = params || {};
|
|
172
|
+
useEffect(() => {
|
|
173
|
+
const { id } = paramObj;
|
|
174
|
+
if (id && isFullMode) {
|
|
175
|
+
setSpin(true);
|
|
176
|
+
actions.getTemplateDetails(id, setSpin);
|
|
177
|
+
}
|
|
178
|
+
//cleanup code
|
|
179
|
+
return () => {
|
|
180
|
+
actions.clearEditResponse();
|
|
181
|
+
};
|
|
182
|
+
}, [paramObj.id]);
|
|
183
|
+
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
const { name = '', versions = {} } = isFullMode
|
|
186
|
+
? rcsData.templateDetails || {}
|
|
187
|
+
: templateData || {};
|
|
188
|
+
const editContent = get(versions, `base.content.RCS`, {});
|
|
189
|
+
if (!isEmpty(editContent)) {
|
|
190
|
+
const { cardContent = [], smsFallBackContent = {} } = editContent;
|
|
191
|
+
const {
|
|
192
|
+
media: { mediaUrl = '' } = {},
|
|
193
|
+
mediaType = '',
|
|
194
|
+
title = '',
|
|
195
|
+
description = '',
|
|
196
|
+
} = cardContent[0] || {};
|
|
197
|
+
const { message, templateConfigs = {} } = smsFallBackContent;
|
|
198
|
+
setTemplateName(name);
|
|
199
|
+
setTemplateMediaType(mediaType);
|
|
200
|
+
updateRcsImageSrc(mediaUrl);
|
|
201
|
+
setTemplateTitle(title);
|
|
202
|
+
setTemplateDesc(description);
|
|
203
|
+
setFallbackMessage(message);
|
|
204
|
+
setEditFlow(true);
|
|
205
|
+
// for DLT Fallback message
|
|
206
|
+
if (isDltEnabled) {
|
|
207
|
+
const {
|
|
208
|
+
registeredSenderIds: header = [],
|
|
209
|
+
template = {},
|
|
210
|
+
templateId = '',
|
|
211
|
+
templateName: tmpName = '',
|
|
212
|
+
templateVariableMapping = {},
|
|
213
|
+
} = templateConfigs;
|
|
214
|
+
if (header.length > 0) {
|
|
215
|
+
const tempData = {
|
|
216
|
+
versions: {
|
|
217
|
+
base: {
|
|
218
|
+
header,
|
|
219
|
+
'template_id': templateId,
|
|
220
|
+
'template_name': tmpName,
|
|
221
|
+
'sms-editor': template,
|
|
222
|
+
'var-mapped': templateVariableMapping,
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
setDltEditData(tempData);
|
|
227
|
+
setShowDltCard(true);
|
|
228
|
+
} else {
|
|
229
|
+
setShowDltCard(false);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}, [rcsData.templateDetails || templateData]);
|
|
234
|
+
|
|
165
235
|
// tag Code start from here
|
|
166
236
|
useEffect(() => {
|
|
167
237
|
if (!showDltContainer) {
|
|
@@ -220,6 +290,16 @@ export const Rcs = (props) => {
|
|
|
220
290
|
setFallbackMessage(tempMsg);
|
|
221
291
|
setFallbackMessageError(error);
|
|
222
292
|
};
|
|
293
|
+
|
|
294
|
+
//removing optout tag for rcs
|
|
295
|
+
const getRcsTags = () => {
|
|
296
|
+
const tempTags = cloneDeep(tags);
|
|
297
|
+
// eslint-disable-next-line no-undef
|
|
298
|
+
if (tempTags?.length > 0 && tempTags[0]?.definition?.value === 'optout') {
|
|
299
|
+
tempTags.shift();
|
|
300
|
+
}
|
|
301
|
+
return tempTags;
|
|
302
|
+
};
|
|
223
303
|
// tag Code end
|
|
224
304
|
|
|
225
305
|
const renderLabel = (value, showLabel) => (
|
|
@@ -275,9 +355,9 @@ export const Rcs = (props) => {
|
|
|
275
355
|
location,
|
|
276
356
|
tagModule: getDefaultTags,
|
|
277
357
|
}) || {};
|
|
278
|
-
if (value === '' &&
|
|
358
|
+
if (value === '' && isMediaTypeNone) {
|
|
279
359
|
errorMessage = formatMessage(messages.emptyTemplateDescErrorMessage);
|
|
280
|
-
} else if (value?.length >
|
|
360
|
+
} else if (value?.length > TEMPLATE_DESC_MAX_LENGTH) {
|
|
281
361
|
errorMessage = formatMessage(messages.templateDescLengthError);
|
|
282
362
|
} else if (unsupportedTags?.length > 0) {
|
|
283
363
|
errorMessage = formatMessage(
|
|
@@ -306,7 +386,9 @@ export const Rcs = (props) => {
|
|
|
306
386
|
location,
|
|
307
387
|
tagModule: getDefaultTags,
|
|
308
388
|
}) || {};
|
|
309
|
-
if (
|
|
389
|
+
if (value?.length > FALLBACK_MESSAGE_MAX_LENGTH) {
|
|
390
|
+
errorMessage = formatMessage(messages.fallbackMsgLenError);
|
|
391
|
+
} else if (unsupportedTags?.length > 0) {
|
|
310
392
|
errorMessage = formatMessage(
|
|
311
393
|
globalMessages.unsupportedTagsValidationError,
|
|
312
394
|
{
|
|
@@ -322,25 +404,25 @@ export const Rcs = (props) => {
|
|
|
322
404
|
{/* template title */}
|
|
323
405
|
{renderLabel('templateTitle', true)}
|
|
324
406
|
<CapInput
|
|
325
|
-
id=
|
|
407
|
+
id="rcs-template-title-input"
|
|
326
408
|
onChange={onTemplateTitleChange}
|
|
327
409
|
placeholder={formatMessage(messages.templateTitlePlaceholder)}
|
|
328
410
|
value={templateTitle || ''}
|
|
329
411
|
size="default"
|
|
330
|
-
maxLength={
|
|
412
|
+
maxLength={TEMPLATE_TITLE_MAX_LENGTH}
|
|
331
413
|
suffix={
|
|
332
|
-
<CapLabel type="label1">{`${templateTitle.length} /
|
|
414
|
+
<CapLabel type="label1">{`${templateTitle.length} / ${TEMPLATE_TITLE_MAX_LENGTH}`}</CapLabel>
|
|
333
415
|
}
|
|
334
416
|
/>
|
|
335
417
|
{/* template message */}
|
|
336
|
-
<CapRow id=
|
|
418
|
+
<CapRow id="rcs-template-message-label">
|
|
337
419
|
<CapHeader
|
|
338
420
|
title={
|
|
339
|
-
<CapRow
|
|
421
|
+
<CapRow type="flex">
|
|
340
422
|
<CapHeading type="h4">
|
|
341
423
|
{formatMessage(messages.templateDescLabel)}
|
|
342
424
|
</CapHeading>
|
|
343
|
-
{
|
|
425
|
+
{!isMediaTypeNone && (
|
|
344
426
|
<CapHeading type="h4" className="rcs-optional-label">
|
|
345
427
|
{formatMessage(messages.optional)}
|
|
346
428
|
</CapHeading>
|
|
@@ -352,7 +434,7 @@ export const Rcs = (props) => {
|
|
|
352
434
|
label={formatMessage(globalMessages.addLabels)}
|
|
353
435
|
onTagSelect={onTagSelect}
|
|
354
436
|
location={location}
|
|
355
|
-
tags={
|
|
437
|
+
tags={getRcsTags()}
|
|
356
438
|
onContextChange={handleOnTagsContextChange}
|
|
357
439
|
injectedTags={injectedTags || {}}
|
|
358
440
|
/>
|
|
@@ -360,7 +442,7 @@ export const Rcs = (props) => {
|
|
|
360
442
|
/>
|
|
361
443
|
</CapRow>
|
|
362
444
|
<TextArea
|
|
363
|
-
id=
|
|
445
|
+
id="rcs_template_message_textarea"
|
|
364
446
|
autosize={{ minRows: 3, maxRows: 5 }}
|
|
365
447
|
placeholder={formatMessage(messages.templateDescPlaceholder)}
|
|
366
448
|
onChange={onTemplateDescChange}
|
|
@@ -374,7 +456,9 @@ export const Rcs = (props) => {
|
|
|
374
456
|
const fallbackSmsLength = () => (
|
|
375
457
|
<CapLabel type="label1" className="fallback-sms-length">
|
|
376
458
|
{formatMessage(messages.totalCharacters, {
|
|
377
|
-
smsCount: Math.ceil(
|
|
459
|
+
smsCount: Math.ceil(
|
|
460
|
+
fallbackMessage.length / FALLBACK_MESSAGE_MAX_LENGTH,
|
|
461
|
+
),
|
|
378
462
|
number: fallbackMessage.length,
|
|
379
463
|
})}
|
|
380
464
|
</CapLabel>
|
|
@@ -391,6 +475,7 @@ export const Rcs = (props) => {
|
|
|
391
475
|
const closeDltContainerHandler = () => {
|
|
392
476
|
setShowDltContainer(false);
|
|
393
477
|
setDltMode('');
|
|
478
|
+
templatesActions.getAllTemplates('Rcs', { page: 1, perPage: 25 });
|
|
394
479
|
};
|
|
395
480
|
|
|
396
481
|
const rcsDltEditSelectHandler = (data) => {
|
|
@@ -412,6 +497,7 @@ export const Rcs = (props) => {
|
|
|
412
497
|
closeDltContainerHandler();
|
|
413
498
|
setDltEditData(tempData);
|
|
414
499
|
setFallbackMessage(fallMsg);
|
|
500
|
+
setFallbackMessageError(fallMsg?.length > FALLBACK_MESSAGE_MAX_LENGTH);
|
|
415
501
|
setShowDltCard(true);
|
|
416
502
|
};
|
|
417
503
|
|
|
@@ -419,6 +505,7 @@ export const Rcs = (props) => {
|
|
|
419
505
|
closeDltContainerHandler();
|
|
420
506
|
setDltEditData({});
|
|
421
507
|
setFallbackMessage('');
|
|
508
|
+
setFallbackMessageError(false);
|
|
422
509
|
setShowDltCard(false);
|
|
423
510
|
};
|
|
424
511
|
|
|
@@ -508,6 +595,7 @@ export const Rcs = (props) => {
|
|
|
508
595
|
handleClose={closeDltContainerHandler}
|
|
509
596
|
templateData={dltEditData}
|
|
510
597
|
getFormSubscriptionData={rcsDltEditCompletionHandler}
|
|
598
|
+
isFullMode={false}
|
|
511
599
|
/>
|
|
512
600
|
);
|
|
513
601
|
}
|
|
@@ -528,13 +616,20 @@ export const Rcs = (props) => {
|
|
|
528
616
|
>
|
|
529
617
|
<CapHeader
|
|
530
618
|
title={
|
|
531
|
-
<CapRow
|
|
619
|
+
<CapRow type="flex">
|
|
532
620
|
<CapHeading type="h4">
|
|
533
621
|
{formatMessage(messages.fallbackLabel)}
|
|
534
622
|
</CapHeading>
|
|
535
623
|
<CapHeading type="h4" className="rcs-optional-label">
|
|
536
624
|
{formatMessage(messages.optional)}
|
|
537
625
|
</CapHeading>
|
|
626
|
+
<CapTooltipWithInfo
|
|
627
|
+
placement="right"
|
|
628
|
+
infoIconProps={{
|
|
629
|
+
style: { marginLeft: '4px', marginTop: '3px' },
|
|
630
|
+
}}
|
|
631
|
+
title={formatMessage(messages.fallbackToolTip)}
|
|
632
|
+
/>
|
|
538
633
|
</CapRow>
|
|
539
634
|
}
|
|
540
635
|
description={formatMessage(messages.fallbackDesc)}
|
|
@@ -542,6 +637,7 @@ export const Rcs = (props) => {
|
|
|
542
637
|
isDltEnabled ? null : (
|
|
543
638
|
<CapButton
|
|
544
639
|
type="flat"
|
|
640
|
+
className="fallback-preview-btn"
|
|
545
641
|
prefix={<CapIcon type="eye" />}
|
|
546
642
|
style={{ color: CAP_SECONDARY.base }}
|
|
547
643
|
onClick={() => setFallbackPreviewmode(true)}
|
|
@@ -564,7 +660,11 @@ export const Rcs = (props) => {
|
|
|
564
660
|
<CapImage src={addCreativesIcon} />
|
|
565
661
|
</CapColumn>
|
|
566
662
|
<CapColumn span={14}>
|
|
567
|
-
<CapButton
|
|
663
|
+
<CapButton
|
|
664
|
+
className="add-dlt-btn"
|
|
665
|
+
type="secondary"
|
|
666
|
+
onClick={addDltMsgHandler}
|
|
667
|
+
>
|
|
568
668
|
{formatMessage(messages.addSmsCreative)}
|
|
569
669
|
</CapButton>
|
|
570
670
|
</CapColumn>
|
|
@@ -579,6 +679,11 @@ export const Rcs = (props) => {
|
|
|
579
679
|
cardList={[getDltContentCardList(fallbackMessage, SMS)]}
|
|
580
680
|
className="rcs-dlt-card"
|
|
581
681
|
/>,
|
|
682
|
+
fallbackMessageError && (
|
|
683
|
+
<CapError className="rcs-fallback-len-error">
|
|
684
|
+
{formatMessage(messages.fallbackMsgLenError)}
|
|
685
|
+
</CapError>
|
|
686
|
+
),
|
|
582
687
|
);
|
|
583
688
|
|
|
584
689
|
//dlt is not enabled, show non dlt text area
|
|
@@ -605,7 +710,7 @@ export const Rcs = (props) => {
|
|
|
605
710
|
/>
|
|
606
711
|
</CapRow>
|
|
607
712
|
<TextArea
|
|
608
|
-
id=
|
|
713
|
+
id="rcs_fallback_message_textarea"
|
|
609
714
|
autosize={{ minRows: 3, maxRows: 5 }}
|
|
610
715
|
placeholder={formatMessage(messages.fallbackMsgPlaceholder)}
|
|
611
716
|
onChange={onFallbackMessageChange}
|
|
@@ -655,8 +760,8 @@ export const Rcs = (props) => {
|
|
|
655
760
|
updateImageSrc={setUpdateRcsImageSrc}
|
|
656
761
|
updateOnReUpload={updateOnRcsImageReUpload}
|
|
657
762
|
index={0}
|
|
658
|
-
className=
|
|
659
|
-
key=
|
|
763
|
+
className="cap-custom-image-upload"
|
|
764
|
+
key="rcs-uploaded-image"
|
|
660
765
|
imageData={rcsData}
|
|
661
766
|
channel={RCS}
|
|
662
767
|
/>
|
|
@@ -674,9 +779,11 @@ export const Rcs = (props) => {
|
|
|
674
779
|
channel={RCS}
|
|
675
780
|
content={{
|
|
676
781
|
rcsPreviewContent: {
|
|
677
|
-
rcsImageSrc,
|
|
678
782
|
rcsTitle: templateTitle,
|
|
679
783
|
rcsDesc: templateDesc,
|
|
784
|
+
...(!isMediaTypeNone && {
|
|
785
|
+
rcsImageSrc,
|
|
786
|
+
}),
|
|
680
787
|
},
|
|
681
788
|
}}
|
|
682
789
|
/>
|
|
@@ -692,8 +799,7 @@ export const Rcs = (props) => {
|
|
|
692
799
|
header: registeredSenderIds = [],
|
|
693
800
|
'var-mapped': templateVariableMapping = {},
|
|
694
801
|
} = base;
|
|
695
|
-
const tempMediaSrc =
|
|
696
|
-
templateMediaType === RCS_MEDIA_TYPES.IMAGE ? rcsImageSrc : '';
|
|
802
|
+
const tempMediaSrc = !isMediaTypeNone ? rcsImageSrc : '';
|
|
697
803
|
|
|
698
804
|
return {
|
|
699
805
|
name: templateName,
|
|
@@ -738,14 +844,20 @@ export const Rcs = (props) => {
|
|
|
738
844
|
};
|
|
739
845
|
};
|
|
740
846
|
|
|
741
|
-
const actionCallback = ({ errorMessage, resp }) => {
|
|
847
|
+
const actionCallback = ({ errorMessage, resp }, isEdit) => {
|
|
742
848
|
// eslint-disable-next-line no-undef
|
|
743
849
|
const error = errorMessage?.message || errorMessage;
|
|
744
850
|
if (!error) {
|
|
745
851
|
CapNotification.success({
|
|
746
|
-
message:
|
|
852
|
+
message: isEdit
|
|
853
|
+
? formatMessage(messages.rcsEditNotification)
|
|
854
|
+
: formatMessage(messages.rcsCreateNotification),
|
|
747
855
|
});
|
|
748
|
-
|
|
856
|
+
if (isEdit) {
|
|
857
|
+
actions.clearEditResponse();
|
|
858
|
+
} else {
|
|
859
|
+
actions.clearCreateResponse();
|
|
860
|
+
}
|
|
749
861
|
} else {
|
|
750
862
|
CapNotification.error({
|
|
751
863
|
message: error,
|
|
@@ -766,7 +878,21 @@ export const Rcs = (props) => {
|
|
|
766
878
|
};
|
|
767
879
|
|
|
768
880
|
const onEditRcs = () => {
|
|
769
|
-
|
|
881
|
+
setSpin(true);
|
|
882
|
+
actions.editTemplate(
|
|
883
|
+
{
|
|
884
|
+
...createPayload(),
|
|
885
|
+
_id: params.id,
|
|
886
|
+
},
|
|
887
|
+
(resp, errorMessage) => {
|
|
888
|
+
actionCallback({ resp, errorMessage }, true);
|
|
889
|
+
if (!errorMessage) {
|
|
890
|
+
onCreateComplete();
|
|
891
|
+
} else {
|
|
892
|
+
setSpin(false);
|
|
893
|
+
}
|
|
894
|
+
},
|
|
895
|
+
);
|
|
770
896
|
};
|
|
771
897
|
|
|
772
898
|
const onDoneCallback = () => {
|
|
@@ -785,14 +911,11 @@ export const Rcs = (props) => {
|
|
|
785
911
|
return true;
|
|
786
912
|
}
|
|
787
913
|
//if template message is not entered
|
|
788
|
-
if (
|
|
789
|
-
templateMediaType === RCS_MEDIA_TYPES.NONE &&
|
|
790
|
-
templateDesc.trim() === ''
|
|
791
|
-
) {
|
|
914
|
+
if (isMediaTypeNone && templateDesc.trim() === '') {
|
|
792
915
|
return true;
|
|
793
916
|
}
|
|
794
917
|
//if image is not uploaded
|
|
795
|
-
if (
|
|
918
|
+
if (!isMediaTypeNone && rcsImageSrc === '') {
|
|
796
919
|
return true;
|
|
797
920
|
}
|
|
798
921
|
if (templateDescError || fallbackMessageError) {
|
|
@@ -814,48 +937,9 @@ export const Rcs = (props) => {
|
|
|
814
937
|
size="size-xl"
|
|
815
938
|
/>
|
|
816
939
|
);
|
|
817
|
-
} else if (fallbackPreviewmode) {
|
|
818
|
-
const tempMsg = dltPreviewData === '' ? fallbackMessage : dltPreviewData;
|
|
819
|
-
return (
|
|
820
|
-
<CapSlideBox
|
|
821
|
-
show={fallbackPreviewmode}
|
|
822
|
-
header={
|
|
823
|
-
<CapHeading type="h7" style={{ color: CAP_G01 }}>
|
|
824
|
-
{formatMessage(messages.fallbackPreviewtitle)}
|
|
825
|
-
</CapHeading>
|
|
826
|
-
}
|
|
827
|
-
content={
|
|
828
|
-
<>
|
|
829
|
-
<TemplatePreview
|
|
830
|
-
channel={RCS}
|
|
831
|
-
content={{
|
|
832
|
-
rcsPreviewContent: {
|
|
833
|
-
rcsDesc: tempMsg,
|
|
834
|
-
},
|
|
835
|
-
}}
|
|
836
|
-
/>
|
|
837
|
-
<CapHeading
|
|
838
|
-
type="h3"
|
|
839
|
-
style={{ textAlign: 'center' }}
|
|
840
|
-
className="margin-t-16"
|
|
841
|
-
>
|
|
842
|
-
{formatMessage(messages.totalCharacters, {
|
|
843
|
-
smsCount: Math.ceil(tempMsg.length / 160),
|
|
844
|
-
number: tempMsg.length,
|
|
845
|
-
})}
|
|
846
|
-
</CapHeading>
|
|
847
|
-
</>
|
|
848
|
-
}
|
|
849
|
-
handleClose={() => {
|
|
850
|
-
setFallbackPreviewmode(false);
|
|
851
|
-
setDltPreviewData('');
|
|
852
|
-
}}
|
|
853
|
-
size="size-s"
|
|
854
|
-
/>
|
|
855
|
-
);
|
|
856
940
|
}
|
|
857
|
-
const
|
|
858
|
-
|
|
941
|
+
const tempMsg = dltPreviewData === '' ? fallbackMessage : dltPreviewData;
|
|
942
|
+
const mediaTypeMsg = isMediaTypeNone ? 'textMessage' : 'image';
|
|
859
943
|
return (
|
|
860
944
|
<>
|
|
861
945
|
<CapRow className="cap-rcs-creatives">
|
|
@@ -863,7 +947,7 @@ export const Rcs = (props) => {
|
|
|
863
947
|
{/* template name */}
|
|
864
948
|
{isFullMode && (
|
|
865
949
|
<CapInput
|
|
866
|
-
id=
|
|
950
|
+
id="rcs_template_name_input"
|
|
867
951
|
onChange={onTemplateNameChange}
|
|
868
952
|
errorMessage={templateNameError}
|
|
869
953
|
placeholder={formatMessage(
|
|
@@ -880,7 +964,7 @@ export const Rcs = (props) => {
|
|
|
880
964
|
options={mediaRadioOptions || []}
|
|
881
965
|
value={templateMediaType}
|
|
882
966
|
onChange={onTemplateMediaTypeChange}
|
|
883
|
-
className=
|
|
967
|
+
className="rcs-radio"
|
|
884
968
|
/>
|
|
885
969
|
{getMediaBasedComponent()}
|
|
886
970
|
<CapDivider style={{ margin: `${CAP_SPACE_28} 0` }} />
|
|
@@ -897,8 +981,8 @@ export const Rcs = (props) => {
|
|
|
897
981
|
title={
|
|
898
982
|
isDisableDone()
|
|
899
983
|
? formatMessage(messages.rcsDoneBtnToolTip, {
|
|
900
|
-
|
|
901
|
-
|
|
984
|
+
type: formatMessage(messages[mediaTypeMsg]),
|
|
985
|
+
})
|
|
902
986
|
: ''
|
|
903
987
|
}
|
|
904
988
|
placement={'right'}
|
|
@@ -914,6 +998,46 @@ export const Rcs = (props) => {
|
|
|
914
998
|
</div>
|
|
915
999
|
</CapTooltip>
|
|
916
1000
|
</RcsFooter>
|
|
1001
|
+
|
|
1002
|
+
{fallbackPreviewmode && (
|
|
1003
|
+
<CapSlideBox
|
|
1004
|
+
className="rcs-fallback-preview"
|
|
1005
|
+
show={fallbackPreviewmode}
|
|
1006
|
+
header={
|
|
1007
|
+
<CapHeading type="h7" style={{ color: CAP_G01 }}>
|
|
1008
|
+
{formatMessage(messages.fallbackPreviewtitle)}
|
|
1009
|
+
</CapHeading>
|
|
1010
|
+
}
|
|
1011
|
+
content={
|
|
1012
|
+
<>
|
|
1013
|
+
<TemplatePreview
|
|
1014
|
+
channel={RCS}
|
|
1015
|
+
content={{
|
|
1016
|
+
rcsPreviewContent: {
|
|
1017
|
+
rcsDesc: tempMsg,
|
|
1018
|
+
},
|
|
1019
|
+
}}
|
|
1020
|
+
/>
|
|
1021
|
+
<CapHeading
|
|
1022
|
+
type="h3"
|
|
1023
|
+
style={{ textAlign: 'center' }}
|
|
1024
|
+
className="margin-t-16"
|
|
1025
|
+
>
|
|
1026
|
+
{formatMessage(messages.totalCharacters, {
|
|
1027
|
+
smsCount: Math.ceil(
|
|
1028
|
+
tempMsg.length / FALLBACK_MESSAGE_MAX_LENGTH,
|
|
1029
|
+
),
|
|
1030
|
+
number: tempMsg.length,
|
|
1031
|
+
})}
|
|
1032
|
+
</CapHeading>
|
|
1033
|
+
</>
|
|
1034
|
+
}
|
|
1035
|
+
handleClose={() => {
|
|
1036
|
+
setFallbackPreviewmode(false);
|
|
1037
|
+
setDltPreviewData('');
|
|
1038
|
+
}}
|
|
1039
|
+
/>
|
|
1040
|
+
)}
|
|
917
1041
|
</>
|
|
918
1042
|
);
|
|
919
1043
|
};
|
|
@@ -929,6 +1053,7 @@ const mapStateToProps = createStructuredSelector({
|
|
|
929
1053
|
|
|
930
1054
|
const mapDispatchToProps = (dispatch) => ({
|
|
931
1055
|
actions: bindActionCreators(RcsActions, dispatch),
|
|
1056
|
+
templatesActions: bindActionCreators(TemplatesActions, dispatch),
|
|
932
1057
|
});
|
|
933
1058
|
|
|
934
1059
|
export default withCreatives({
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
.cap-rcs-creatives {
|
|
4
4
|
.rcs-scroll-div {
|
|
5
|
-
margin-bottom:
|
|
5
|
+
margin-bottom: 150px;
|
|
6
6
|
}
|
|
7
7
|
.rcs-preview-container {
|
|
8
8
|
.cap-row-v2 {
|
|
@@ -23,16 +23,29 @@
|
|
|
23
23
|
.rcs-dlt-fallback-card.ant-card-bordered > div {
|
|
24
24
|
padding: 12px;
|
|
25
25
|
}
|
|
26
|
-
.rcs-
|
|
26
|
+
.rcs-listing-content {
|
|
27
27
|
display: -webkit-box;
|
|
28
|
-
-webkit-line-clamp: 7;
|
|
29
28
|
-webkit-box-orient: vertical;
|
|
30
29
|
overflow: hidden;
|
|
30
|
+
&.title{
|
|
31
|
+
-webkit-line-clamp: 1;
|
|
32
|
+
}
|
|
33
|
+
&.desc{
|
|
34
|
+
-webkit-line-clamp: 5;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
.rcs-listing-image {
|
|
38
|
+
margin-bottom: 8px;
|
|
39
|
+
width: 220px;
|
|
40
|
+
height: 103px;
|
|
31
41
|
}
|
|
32
42
|
.fallback-sms-length {
|
|
33
43
|
margin-top: 13px;
|
|
34
44
|
float: right;
|
|
35
45
|
}
|
|
46
|
+
.rcs-fallback-len-error{
|
|
47
|
+
margin-top: 8px;
|
|
48
|
+
}
|
|
36
49
|
#rcs-template-title-input {
|
|
37
50
|
padding-right: 10%;
|
|
38
51
|
}
|
|
@@ -52,3 +65,8 @@
|
|
|
52
65
|
}
|
|
53
66
|
}
|
|
54
67
|
}
|
|
68
|
+
.rcs-fallback-preview > .cap-slide-box-v2-container.size-r{
|
|
69
|
+
min-width: 430px;
|
|
70
|
+
max-width: 430px;
|
|
71
|
+
width: 430px;
|
|
72
|
+
}
|
|
@@ -64,11 +64,20 @@ export default defineMessages({
|
|
|
64
64
|
},
|
|
65
65
|
fallbackLabel: {
|
|
66
66
|
id: `${prefix}.fallbackLabel`,
|
|
67
|
-
defaultMessage: '
|
|
67
|
+
defaultMessage: 'Fallback SMS message',
|
|
68
68
|
},
|
|
69
69
|
fallbackDesc: {
|
|
70
70
|
id: `${prefix}.fallbackDesc`,
|
|
71
|
-
defaultMessage: 'We would suggest to add
|
|
71
|
+
defaultMessage: 'We would suggest to add fallback SMS',
|
|
72
|
+
},
|
|
73
|
+
fallbackToolTip: {
|
|
74
|
+
id: `${prefix}.fallbackToolTip`,
|
|
75
|
+
defaultMessage:
|
|
76
|
+
'This is to deliver an RCS message as an SMS message to end users whose phones do not support RCS',
|
|
77
|
+
},
|
|
78
|
+
fallbackMsgLenError: {
|
|
79
|
+
id: `${prefix}.fallbackMsgLenError`,
|
|
80
|
+
defaultMessage: 'Only 1 SMS (160 characters) allowed for fallback sms',
|
|
72
81
|
},
|
|
73
82
|
fallbackTextAreaLabel: {
|
|
74
83
|
id: `${prefix}.fallbackTextAreaLabel`,
|
|
@@ -76,7 +85,7 @@ export default defineMessages({
|
|
|
76
85
|
},
|
|
77
86
|
fallbackMsgPlaceholder: {
|
|
78
87
|
id: `${prefix}.fallbackMsgPlaceholder`,
|
|
79
|
-
defaultMessage: 'Enter the text message content for
|
|
88
|
+
defaultMessage: 'Enter the text message content for fallback SMS',
|
|
80
89
|
},
|
|
81
90
|
totalCharacters: {
|
|
82
91
|
id: `${prefix}.totalCharacters`,
|
|
@@ -100,10 +109,14 @@ export default defineMessages({
|
|
|
100
109
|
},
|
|
101
110
|
rcsCreateNotification: {
|
|
102
111
|
id: `${prefix}.rcsCreateNotification`,
|
|
103
|
-
defaultMessage: '
|
|
112
|
+
defaultMessage: 'RCS template created successfully',
|
|
113
|
+
},
|
|
114
|
+
rcsEditNotification: {
|
|
115
|
+
id: `${prefix}.rcsEditNotification`,
|
|
116
|
+
defaultMessage: 'RCS template updated successfully',
|
|
104
117
|
},
|
|
105
118
|
fallbackPreviewtitle: {
|
|
106
119
|
id: `${prefix}.fallbackPreviewtitle`,
|
|
107
|
-
defaultMessage: 'Preview of
|
|
120
|
+
defaultMessage: 'Preview of fallback SMS',
|
|
108
121
|
},
|
|
109
122
|
});
|