@capillarytech/creatives-library 8.0.243 → 8.0.244
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/CommonTestAndPreview/UnifiedPreview/WhatsAppPreviewContent.js +1 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -1
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/WhatsAppPreviewContent.test.js +1 -1
- package/v2Containers/Email/index.js +0 -7
- package/v2Containers/SmsTrai/Create/index.scss +10 -0
- package/v2Containers/SmsTrai/Edit/index.js +54 -13
- package/v2Containers/SmsTrai/Edit/messages.js +4 -0
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +17629 -2117
- package/v2Containers/SmsTrai/Edit/tests/index.test.js +27 -2
- package/v2Containers/Templates/index.js +1 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -34
package/package.json
CHANGED
|
@@ -115,7 +115,7 @@ const WhatsAppPreviewContent = ({
|
|
|
115
115
|
// Render WhatsApp structure (common for all states) - Based on TemplatePreview lines 1229-1328
|
|
116
116
|
const renderWhatsAppStructure = (contentSection) => (
|
|
117
117
|
<div className="whatsapp-preview-wrapper">
|
|
118
|
-
<div className="shell-v2 align-center">
|
|
118
|
+
<div className="shell-v2-whatsapp align-center">
|
|
119
119
|
<CapImage
|
|
120
120
|
className="preview-image"
|
|
121
121
|
src={deviceImage}
|
|
@@ -759,7 +759,7 @@
|
|
|
759
759
|
// Using same CSS classes as TemplatePreview for consistency
|
|
760
760
|
// Styles are copied from TemplatePreview/_templatePreview.scss to ensure they work
|
|
761
761
|
|
|
762
|
-
.shell-v2 {
|
|
762
|
+
.shell-v2-whatsapp {
|
|
763
763
|
position: relative;
|
|
764
764
|
-webkit-transform: translate(-50%);
|
|
765
765
|
transform: translate(-50%);
|
package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/WhatsAppPreviewContent.test.js
CHANGED
|
@@ -109,7 +109,7 @@ describe('WhatsAppPreviewContent', () => {
|
|
|
109
109
|
);
|
|
110
110
|
|
|
111
111
|
expect(container.querySelector('.whatsapp-preview-wrapper')).toBeTruthy();
|
|
112
|
-
expect(container.querySelector('.shell-v2')).toBeTruthy();
|
|
112
|
+
expect(container.querySelector('.shell-v2-whatsapp')).toBeTruthy();
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
115
|
|
|
@@ -2825,16 +2825,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2825
2825
|
tags = this.props.supportedTags;
|
|
2826
2826
|
}
|
|
2827
2827
|
const { showImageSelectionBox = false } = this.state;
|
|
2828
|
-
const showTestAndPreview = !showImageSelectionBox && getDefaultTags === 'outbound' && !this.props.showTestAndPreviewSlidebox;
|
|
2829
2828
|
return (
|
|
2830
2829
|
<div className="email-container">
|
|
2831
2830
|
<CapSpin spinning={isLoading}>
|
|
2832
|
-
{ showTestAndPreview &&
|
|
2833
|
-
<div className="test-and-preview-container">
|
|
2834
|
-
{this.showTestAndPreviewIcons('PREVIEW')}
|
|
2835
|
-
{this.showTestAndPreviewIcons('TEST')}
|
|
2836
|
-
</div>
|
|
2837
|
-
}
|
|
2838
2831
|
<Row>
|
|
2839
2832
|
<Col>
|
|
2840
2833
|
{ !_.isEmpty(schema) && (this.state.formData[0] || this.state.formData["0"]) ?
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useState, useEffect } from 'react';
|
|
4
4
|
import { createStructuredSelector } from 'reselect';
|
|
5
5
|
import { bindActionCreators } from 'redux';
|
|
6
|
-
import { FormattedMessage
|
|
6
|
+
import { FormattedMessage } from 'react-intl';
|
|
7
7
|
import { get, cloneDeep, isEmpty, isObject } from 'lodash';
|
|
8
8
|
import styled from 'styled-components';
|
|
9
9
|
import CapRow from '@capillarytech/cap-ui-library/CapRow';
|
|
@@ -18,7 +18,6 @@ import CapNotification from '@capillarytech/cap-ui-library/CapNotification';
|
|
|
18
18
|
import CapError from '@capillarytech/cap-ui-library/CapError';
|
|
19
19
|
import CapCheckbox from '@capillarytech/cap-ui-library/CapCheckbox';
|
|
20
20
|
import CapInfoNote from '@capillarytech/cap-ui-library/CapInfoNote';
|
|
21
|
-
import * as globalActions from '../../Cap/actions';
|
|
22
21
|
import injectSaga from '../../../utils/injectSaga';
|
|
23
22
|
import injectReducer from '../../../utils/injectReducer';
|
|
24
23
|
import {
|
|
@@ -33,10 +32,12 @@ import {
|
|
|
33
32
|
import { makeSelectTemplateDetailsResponse } from '../../Sms/Edit/selectors';
|
|
34
33
|
import { makeSelectMetaEntities, selectLiquidStateDetails, setInjectedTags } from '../../Cap/selectors';
|
|
35
34
|
import * as smsEditActions from '../../Sms/Edit/actions';
|
|
35
|
+
import * as globalActions from '../../Cap/actions';
|
|
36
36
|
import messages from './messages';
|
|
37
37
|
import TagList from '../../TagList';
|
|
38
38
|
import formBuilderMessages from '../../../v2Components/FormBuilder/messages';
|
|
39
|
-
import
|
|
39
|
+
import UnifiedPreview from '../../../v2Components/CommonTestAndPreview/UnifiedPreview';
|
|
40
|
+
import TestAndPreviewSlidebox from '../../../v2Components/TestAndPreviewSlidebox';
|
|
40
41
|
import withCreatives from '../../../hoc/withCreatives';
|
|
41
42
|
import { validateTags } from '../../../utils/tagValidations';
|
|
42
43
|
import {
|
|
@@ -53,8 +54,9 @@ import {
|
|
|
53
54
|
import v2EditSmsReducer from '../../Sms/Edit/reducer';
|
|
54
55
|
import { v2SmsEditSagas } from '../../Sms/Edit/sagas';
|
|
55
56
|
import ErrorInfoNote from '../../../v2Components/ErrorInfoNote';
|
|
56
|
-
import {
|
|
57
|
+
import { validateLiquidTemplateContent } from '../../../utils/commonUtils';
|
|
57
58
|
import { hasLiquidSupportFeature } from '../../../utils/common';
|
|
59
|
+
import { ANDROID } from '../../../v2Components/CommonTestAndPreview/constants';
|
|
58
60
|
|
|
59
61
|
let varMap = {};
|
|
60
62
|
let traiData = {};
|
|
@@ -98,6 +100,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
98
100
|
const [showMsgLengthNote, updateshowMsgLengthNote] = useState(false);
|
|
99
101
|
const [liquidErrorMessages, setLiquidErrorMessages] = useState({});
|
|
100
102
|
const [isLiquidValidationError, setIsLiquidValidationError] = useState(false);
|
|
103
|
+
const [showTestAndPreviewSlidebox, setShowTestAndPreviewSlidebox] = useState(false);
|
|
101
104
|
const SMSTraiFooter = styled.div`
|
|
102
105
|
background-color: ${CAP_WHITE};
|
|
103
106
|
padding: ${CAP_SPACE_32} ${CAP_SPACE_24};
|
|
@@ -569,6 +572,25 @@ export const SmsTraiEdit = (props) => {
|
|
|
569
572
|
const unicodeHandler = ({ target: { checked } }) => {
|
|
570
573
|
updateIsUnicodeAllowed(checked);
|
|
571
574
|
};
|
|
575
|
+
|
|
576
|
+
// Get template content for test and preview
|
|
577
|
+
const getTemplateContent = () => {
|
|
578
|
+
if (!updatedSmsEditor || updatedSmsEditor.length === 0) {
|
|
579
|
+
return '';
|
|
580
|
+
}
|
|
581
|
+
return updatedSmsEditor.join('');
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
// Handle test and preview button click
|
|
585
|
+
const handleTestAndPreview = () => {
|
|
586
|
+
setShowTestAndPreviewSlidebox(true);
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
// Handle close test and preview slidebox
|
|
590
|
+
const handleCloseTestAndPreview = () => {
|
|
591
|
+
setShowTestAndPreviewSlidebox(false);
|
|
592
|
+
};
|
|
593
|
+
|
|
572
594
|
const isLiquidSupportFeatureEnabled = hasLiquidSupportFeature();
|
|
573
595
|
return (
|
|
574
596
|
<>
|
|
@@ -600,7 +622,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
600
622
|
<CapHeader
|
|
601
623
|
title={formatMessage(messages.traiEditTitle)}
|
|
602
624
|
size="regular"
|
|
603
|
-
suffix={
|
|
625
|
+
suffix={(
|
|
604
626
|
<TagList
|
|
605
627
|
label={formatMessage(messages.addLabels)}
|
|
606
628
|
onTagSelect={onTagSelect}
|
|
@@ -612,7 +634,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
612
634
|
selectedOfferDetails={selectedOfferDetails}
|
|
613
635
|
eventContextTags={eventContextTags}
|
|
614
636
|
/>
|
|
615
|
-
}
|
|
637
|
+
)}
|
|
616
638
|
/>
|
|
617
639
|
</CapRow>
|
|
618
640
|
|
|
@@ -624,7 +646,9 @@ export const SmsTraiEdit = (props) => {
|
|
|
624
646
|
>
|
|
625
647
|
{renderedContent()}
|
|
626
648
|
</CapRow>
|
|
627
|
-
<CapRow>
|
|
649
|
+
<CapRow>
|
|
650
|
+
{smsLengthForVar()}
|
|
651
|
+
</CapRow>
|
|
628
652
|
{isTagValidationError && tagValidationErrorMessage()}
|
|
629
653
|
<CapCheckbox onChange={unicodeHandler} checked={isUnicodeAllowed} disabled={disablehandler()}>
|
|
630
654
|
{formatMessage(messages.unicodeLabel)}
|
|
@@ -632,12 +656,15 @@ export const SmsTraiEdit = (props) => {
|
|
|
632
656
|
{showMsgLengthNote && <CapInfoNote message={<FormattedMessage {...messages.msgLengthNote} values={{ var: '{#var#}' }} />} />}
|
|
633
657
|
<div style={{ marginBottom: '100px' }} />
|
|
634
658
|
</CapColumn>
|
|
635
|
-
<CapColumn span={
|
|
636
|
-
<
|
|
659
|
+
<CapColumn span={8} offset={1}>
|
|
660
|
+
<UnifiedPreview
|
|
637
661
|
channel={SMS}
|
|
638
662
|
content={updatedSmsEditor.join('')}
|
|
639
|
-
|
|
640
|
-
|
|
663
|
+
device={ANDROID}
|
|
664
|
+
showDeviceToggle={false}
|
|
665
|
+
showHeader={false}
|
|
666
|
+
formatMessage={formatMessage}
|
|
667
|
+
senderId={isUnicodeAllowed ? 'Unicode' : 'ASCII'}
|
|
641
668
|
/>
|
|
642
669
|
</CapColumn>
|
|
643
670
|
</CapRow>
|
|
@@ -646,20 +673,34 @@ export const SmsTraiEdit = (props) => {
|
|
|
646
673
|
<ErrorInfoNote errorMessages={liquidErrorMessages} />
|
|
647
674
|
)}
|
|
648
675
|
<CapButton
|
|
649
|
-
onClick={
|
|
676
|
+
onClick={handleTestAndPreview}
|
|
677
|
+
type="secondary"
|
|
650
678
|
className="create-msg"
|
|
679
|
+
>
|
|
680
|
+
<FormattedMessage {...messages.testAndPreviewButtonLabel} />
|
|
681
|
+
</CapButton>
|
|
682
|
+
<CapButton
|
|
683
|
+
onClick={isLiquidSupportFeatureEnabled ? onSubmitWrapper : onDoneCallback}
|
|
684
|
+
className="create-msg create-dlt-msg"
|
|
651
685
|
disabled={isTagValidationError || (isLiquidSupportFeatureEnabled && !isObject(metaEntities?.tagLookupMap))}
|
|
652
686
|
>
|
|
653
687
|
<FormattedMessage {...messages.saveButtonLabel} />
|
|
654
688
|
</CapButton>
|
|
655
689
|
<CapButton
|
|
656
690
|
onClick={handleClose}
|
|
657
|
-
className="cancel-msg"
|
|
691
|
+
className="cancel-dlt-msg"
|
|
658
692
|
type="secondary"
|
|
659
693
|
>
|
|
660
694
|
<FormattedMessage {...messages.cancelButtonLabel} />
|
|
661
695
|
</CapButton>
|
|
662
696
|
</SMSTraiFooter>
|
|
697
|
+
<TestAndPreviewSlidebox
|
|
698
|
+
show={showTestAndPreviewSlidebox}
|
|
699
|
+
onClose={handleCloseTestAndPreview}
|
|
700
|
+
formData={{}}
|
|
701
|
+
content={getTemplateContent()}
|
|
702
|
+
currentChannel={SMS}
|
|
703
|
+
/>
|
|
663
704
|
</CapSpin>
|
|
664
705
|
</>
|
|
665
706
|
);
|
|
@@ -68,4 +68,8 @@ export default defineMessages({
|
|
|
68
68
|
id: `${prefix}.msgLengthNote`,
|
|
69
69
|
defaultMessage: 'Only 40 characters are allowed per variable {var} field. In case the field resolves to more than 40 characters the message is bound to fail. Hence will not be sent by the Capillary system.',
|
|
70
70
|
},
|
|
71
|
+
testAndPreviewButtonLabel: {
|
|
72
|
+
id: `${prefix}.testAndPreviewButtonLabel`,
|
|
73
|
+
defaultMessage: 'Preview and Test',
|
|
74
|
+
},
|
|
71
75
|
});
|