@capillarytech/creatives-library 8.0.208 → 8.0.210
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/assets/Android.png +0 -0
- package/assets/iOS.png +0 -0
- package/package.json +16 -2
- package/v2Components/HtmlEditor/HTMLEditor.js +508 -0
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +1809 -0
- package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +532 -0
- package/v2Components/HtmlEditor/_htmlEditor.scss +304 -0
- package/v2Components/HtmlEditor/_index.lazy.scss +26 -0
- package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +376 -0
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +331 -0
- package/v2Components/HtmlEditor/components/DeviceToggle/__tests__/index.test.js +314 -0
- package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +244 -0
- package/v2Components/HtmlEditor/components/DeviceToggle/index.js +111 -0
- package/v2Components/HtmlEditor/components/EditorToolbar/PreviewModeGroup.js +72 -0
- package/v2Components/HtmlEditor/components/EditorToolbar/__tests__/PreviewModeGroup.test.js +1594 -0
- package/v2Components/HtmlEditor/components/EditorToolbar/_editorToolbar.scss +113 -0
- package/v2Components/HtmlEditor/components/EditorToolbar/_previewModeGroup.scss +82 -0
- package/v2Components/HtmlEditor/components/EditorToolbar/index.js +115 -0
- package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +57 -0
- package/v2Components/HtmlEditor/components/InAppPreviewPane/ContentOverlay.js +90 -0
- package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +60 -0
- package/v2Components/HtmlEditor/components/InAppPreviewPane/LayoutSelector.js +58 -0
- package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/ContentOverlay.test.js +403 -0
- package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +424 -0
- package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/LayoutSelector.test.js +248 -0
- package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +253 -0
- package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +104 -0
- package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +179 -0
- package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +220 -0
- package/v2Components/HtmlEditor/components/PreviewPane/index.js +229 -0
- package/v2Components/HtmlEditor/components/SplitContainer/SplitContainer.js +276 -0
- package/v2Components/HtmlEditor/components/SplitContainer/__tests__/SplitContainer.test.js +295 -0
- package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +257 -0
- package/v2Components/HtmlEditor/components/SplitContainer/index.js +7 -0
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +152 -0
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/_validationErrorDisplay.scss +31 -0
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +70 -0
- package/v2Components/HtmlEditor/components/ValidationPanel/__tests__/index.test.js +98 -0
- package/v2Components/HtmlEditor/components/ValidationPanel/_validationPanel.scss +311 -0
- package/v2Components/HtmlEditor/components/ValidationPanel/index.js +297 -0
- package/v2Components/HtmlEditor/components/ValidationPanel/messages.js +57 -0
- package/v2Components/HtmlEditor/components/common/EditorContext.js +84 -0
- package/v2Components/HtmlEditor/components/common/__tests__/EditorContext.test.js +660 -0
- package/v2Components/HtmlEditor/constants.js +241 -0
- package/v2Components/HtmlEditor/hooks/__tests__/useEditorContent.test.js +450 -0
- package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +785 -0
- package/v2Components/HtmlEditor/hooks/__tests__/useLayoutState.test.js +580 -0
- package/v2Components/HtmlEditor/hooks/__tests__/useValidation.enhanced.test.js +768 -0
- package/v2Components/HtmlEditor/hooks/__tests__/useValidation.test.js +590 -0
- package/v2Components/HtmlEditor/hooks/useEditorContent.js +274 -0
- package/v2Components/HtmlEditor/hooks/useInAppContent.js +407 -0
- package/v2Components/HtmlEditor/hooks/useLayoutState.js +247 -0
- package/v2Components/HtmlEditor/hooks/useValidation.js +325 -0
- package/v2Components/HtmlEditor/index.js +29 -0
- package/v2Components/HtmlEditor/index.lazy.js +114 -0
- package/v2Components/HtmlEditor/messages.js +389 -0
- package/v2Components/HtmlEditor/utils/__tests__/contentSanitizer.test.js +741 -0
- package/v2Components/HtmlEditor/utils/__tests__/htmlValidator.enhanced.test.js +1042 -0
- package/v2Components/HtmlEditor/utils/__tests__/liquidTemplateSupport.test.js +515 -0
- package/v2Components/HtmlEditor/utils/__tests__/properSyntaxHighlighting.test.js +473 -0
- package/v2Components/HtmlEditor/utils/__tests__/simplePerformance.test.js +1109 -0
- package/v2Components/HtmlEditor/utils/__tests__/validationAdapter.test.js +240 -0
- package/v2Components/HtmlEditor/utils/contentSanitizer.js +433 -0
- package/v2Components/HtmlEditor/utils/htmlValidator.js +508 -0
- package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +524 -0
- package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +163 -0
- package/v2Components/HtmlEditor/utils/simplePerformance.js +145 -0
- package/v2Components/HtmlEditor/utils/validationAdapter.js +130 -0
- package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +200 -0
- package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +545 -0
- package/v2Containers/EmailWrapper/index.js +8 -1
- package/v2Containers/Rcs/index.js +2 -0
- package/v2Containers/Templates/constants.js +8 -0
- package/v2Containers/Templates/index.js +56 -28
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +5 -14
- package/v2Containers/Whatsapp/index.js +1 -0
|
@@ -104,7 +104,7 @@ import {
|
|
|
104
104
|
FACEBOOK as FACEBOOK_CHANNEL,
|
|
105
105
|
CREATE,
|
|
106
106
|
} from '../App/constants';
|
|
107
|
-
import {MAX_WHATSAPP_TEMPLATES, WARNING_WHATSAPP_TEMPLATES , ACCOUNT_MAPPING_ON_CHANNEL} from './constants';
|
|
107
|
+
import {MAX_WHATSAPP_TEMPLATES, WARNING_WHATSAPP_TEMPLATES , ACCOUNT_MAPPING_ON_CHANNEL, noFilteredWhatsappZaloTemplatesTitle, noFilteredWhatsappZaloTemplatesDesc, noApprovedWhatsappZaloTemplatesTitle, noApprovedWhatsappTemplatesDesc, zaloDescIllustration, noApprovedRcsTemplatesTitle, noApprovedRcsTemplatesDesc} from './constants';
|
|
108
108
|
import { COPY_OF } from '../../constants/unified';
|
|
109
109
|
import {
|
|
110
110
|
STATUS_OPTIONS,
|
|
@@ -196,6 +196,9 @@ const SMS_FILTERS = {
|
|
|
196
196
|
const WHATSAPP_LOWERCASE = WHATSAPP.toLowerCase();
|
|
197
197
|
const RCS_LOWERCASE = RCS.toLowerCase();
|
|
198
198
|
const SMS_LOWERCASE = SMS.toLowerCase();
|
|
199
|
+
const EMAIL_LOWERCASE = EMAIL.toLowerCase();
|
|
200
|
+
const VIBER_LOWERCASE = VIBER.toLowerCase();
|
|
201
|
+
const FB_LOWERCASE = FACEBOOK.toLowerCase();
|
|
199
202
|
const MOBILE_PUSH_LOWERCASE = MOBILE_PUSH.toLowerCase();
|
|
200
203
|
const INAPP_LOWERCASE = INAPP.toLowerCase();
|
|
201
204
|
const EBILL_LOWERCASE = EBILL.toLowerCase();
|
|
@@ -1157,7 +1160,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1157
1160
|
/>
|
|
1158
1161
|
|
|
1159
1162
|
getSmsEmailIllustration = () => {
|
|
1160
|
-
this.props.isDltFromRcs ? (
|
|
1163
|
+
return this.props.isDltFromRcs ? (
|
|
1161
1164
|
<CapHeader
|
|
1162
1165
|
title={
|
|
1163
1166
|
<CapHeading type="h3" className="channel-specific-illustration-text">
|
|
@@ -1171,7 +1174,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1171
1174
|
}
|
|
1172
1175
|
/>
|
|
1173
1176
|
) : (
|
|
1174
|
-
<ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={this.state
|
|
1177
|
+
<ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={this.state?.channel?.toUpperCase()} hostName={this.state?.hostName}/>
|
|
1175
1178
|
);
|
|
1176
1179
|
}
|
|
1177
1180
|
|
|
@@ -1716,18 +1719,35 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1716
1719
|
return templateData;
|
|
1717
1720
|
}) : [];
|
|
1718
1721
|
|
|
1722
|
+
//no templates available
|
|
1723
|
+
const showIllustrationForChannel = (forChannel) => {
|
|
1724
|
+
return forChannel === channelLowerCase && isEmpty(templates) && isEmpty(this.state.searchText) && !isLoading;
|
|
1725
|
+
}
|
|
1726
|
+
//when filters applied not matching templates
|
|
1727
|
+
const filteredEmptyAndFullModeAs = (fullModeValue) => {
|
|
1728
|
+
return this.isFullMode() === fullModeValue && isEmpty(filteredTemplates);
|
|
1729
|
+
}
|
|
1730
|
+
// // return true when channel matches and either account is selected or hostName is missing
|
|
1731
|
+
const accountWithNoHostWhatsapp = (forChannel) => {
|
|
1732
|
+
return [forChannel]?.includes(channelLowerCase) && (!isEmpty(this.props?.Templates?.selectedWhatsappAccount) || !this.state?.hostName);
|
|
1733
|
+
}
|
|
1734
|
+
// // return true when channel matches and either account is selected or hostName is missing
|
|
1735
|
+
const accountWithNoHostZalo = (forChannel) => {
|
|
1736
|
+
return [forChannel]?.includes(channelLowerCase) && (!isEmpty(this.props?.Templates?.selectedZaloAccount) || !this.state?.hostName );
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1719
1739
|
const accountId = get(this.props, 'Templates.selectedWeChatAccount.uuid');
|
|
1720
1740
|
const accounts = get(this.props, 'Templates.weCrmAccounts');
|
|
1721
1741
|
const getAllTemplatesInProgress = get(this.props, 'Templates.getAllTemplatesInProgress');
|
|
1742
|
+
|
|
1722
1743
|
const noWhatsappZaloTemplates = this.isFullMode() && isEmpty(templates) || !this.state.hostName;
|
|
1723
|
-
|
|
1724
|
-
const
|
|
1725
|
-
const
|
|
1726
|
-
const
|
|
1727
|
-
|
|
1728
|
-
const showRcsIllustration = channelLowerCase === RCS_LOWERCASE && isEmpty(templates);
|
|
1729
|
-
const showInAppIllustration = channelLowerCase === INAPP_LOWERCASE && isEmpty(templates);
|
|
1744
|
+
|
|
1745
|
+
const noApprovedWhatsappZaloTemplates = filteredEmptyAndFullModeAs(false) && !isEmpty(this.state?.hostName);
|
|
1746
|
+
const showWhatsappIllustration = accountWithNoHostWhatsapp(WHATSAPP_LOWERCASE);
|
|
1747
|
+
const showZaloIllustration = accountWithNoHostZalo(ZALO_LOWERCASE)
|
|
1748
|
+
|
|
1730
1749
|
const noLoaderAndSearchText = isEmpty(this.state.searchText) && !isLoading;
|
|
1750
|
+
|
|
1731
1751
|
return (<div>
|
|
1732
1752
|
{[WECHAT, MOBILE_PUSH, INAPP, WHATSAPP, ZALO].includes(currentChannel) && this.showAccountName()}
|
|
1733
1753
|
{filterContent}
|
|
@@ -1744,10 +1764,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1744
1764
|
fbType={"list"}
|
|
1745
1765
|
/>
|
|
1746
1766
|
</div>)
|
|
1747
|
-
: [
|
|
1767
|
+
: [SMS_LOWERCASE, EMAIL_LOWERCASE].includes(this.state.channel.toLowerCase()) && !isLoading && this.getSmsEmailIllustration()
|
|
1748
1768
|
}
|
|
1749
1769
|
|
|
1750
|
-
{(this.state.selectedAccount === '' && isEmpty(this.props.Templates.selectedWeChatAccount)) && ([
|
|
1770
|
+
{(this.state.selectedAccount === '' && isEmpty(this.props.Templates.selectedWeChatAccount)) && ([WECHAT_LOWERCASE, MOBILE_PUSH_LOWERCASE, INAPP_LOWERCASE].includes(this.state.channel.toLowerCase())) &&
|
|
1751
1771
|
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh' }}>
|
|
1752
1772
|
<CapHeading type="h6">{accounts ? this.props.intl.formatMessage(messages.noAccountMessage) : this.props.intl.formatMessage(messages.noAccountsPresent)}</CapHeading>
|
|
1753
1773
|
</div>
|
|
@@ -1762,9 +1782,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1762
1782
|
</InlineDiv>
|
|
1763
1783
|
</CapHeading>
|
|
1764
1784
|
</div> : (
|
|
1765
|
-
|
|
1766
|
-
isEmpty(filteredTemplates) &&
|
|
1767
|
-
isEmpty(this.state.searchText) &&
|
|
1785
|
+
showIllustrationForChannel(MOBILE_PUSH_LOWERCASE) &&
|
|
1768
1786
|
<div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto'} : {}}>
|
|
1769
1787
|
<ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel} hostName={this.state?.hostName}/>
|
|
1770
1788
|
</div>
|
|
@@ -1774,27 +1792,37 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1774
1792
|
noLoaderAndSearchText &&
|
|
1775
1793
|
<div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto' } : {}}>
|
|
1776
1794
|
{noWhatsappZaloTemplates && <ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel} hostName={this.state?.hostName}/>}
|
|
1777
|
-
{
|
|
1778
|
-
{noApprovedWhatsappZaloTemplates && this.whatsappZaloIllustrationText(
|
|
1795
|
+
{filteredEmptyAndFullModeAs(true) && !isEmpty(templates) && this.state?.hostName && this.whatsappZaloIllustrationText(noFilteredWhatsappZaloTemplatesTitle, noFilteredWhatsappZaloTemplatesDesc)}
|
|
1796
|
+
{noApprovedWhatsappZaloTemplates && this.whatsappZaloIllustrationText(noApprovedWhatsappZaloTemplatesTitle, showWhatsappIllustration ? noApprovedWhatsappTemplatesDesc : zaloDescIllustration)}
|
|
1779
1797
|
</div>
|
|
1780
1798
|
)
|
|
1781
1799
|
}
|
|
1782
|
-
{
|
|
1783
|
-
(
|
|
1784
|
-
|
|
1785
|
-
|
|
1800
|
+
{showIllustrationForChannel(RCS_LOWERCASE) &&
|
|
1801
|
+
<div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto' } : {}}>
|
|
1802
|
+
<ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel}/>
|
|
1803
|
+
{filteredEmptyAndFullModeAs(false) && this.whatsappZaloIllustrationText(noApprovedRcsTemplatesTitle, noApprovedRcsTemplatesDesc)}
|
|
1804
|
+
</div>
|
|
1805
|
+
}
|
|
1806
|
+
{showIllustrationForChannel(INAPP_LOWERCASE) &&
|
|
1807
|
+
<div className={`${this.isFullMode() ? 'inapp-illustration-parent' : ''}`}>
|
|
1808
|
+
<ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel} />
|
|
1809
|
+
</div>
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
{showIllustrationForChannel(VIBER_LOWERCASE) &&
|
|
1813
|
+
<div className={`${this.isFullMode() ? 'viber-illustration-parent' : ''}`}>
|
|
1786
1814
|
<ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel}/>
|
|
1787
|
-
{noApprovedRcsTemplates && this.whatsappZaloIllustrationText('noApprovedRcsTemplatesTitle', 'noApprovedRcsTemplatesDesc')}
|
|
1788
1815
|
</div>
|
|
1789
|
-
)
|
|
1790
1816
|
}
|
|
1791
|
-
{
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1817
|
+
{showIllustrationForChannel(FB_LOWERCASE) &&
|
|
1818
|
+
<div className={`${this.isFullMode() ? 'fb-illustration-parent' : ''}`}>
|
|
1819
|
+
<ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel}/>
|
|
1820
|
+
</div>
|
|
1821
|
+
}
|
|
1822
|
+
{showIllustrationForChannel(LINE_LOWERCASE) &&
|
|
1823
|
+
<div className={`${this.isFullMode() ? 'line-illustration-parent' : ''}`}>
|
|
1795
1824
|
<ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel}/>
|
|
1796
1825
|
</div>
|
|
1797
|
-
)
|
|
1798
1826
|
}
|
|
1799
1827
|
</div>
|
|
1800
1828
|
}
|
|
@@ -249,20 +249,11 @@ exports[`Test Templates container Should render sms illustration when no templat
|
|
|
249
249
|
</div>
|
|
250
250
|
<CapCustomSkeleton>
|
|
251
251
|
<div>
|
|
252
|
-
<
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
>
|
|
260
|
-
<ChannelTypeIllustration
|
|
261
|
-
createTemplate={[Function]}
|
|
262
|
-
currentChannel="SMS"
|
|
263
|
-
hostName=""
|
|
264
|
-
/>
|
|
265
|
-
</div>
|
|
252
|
+
<ChannelTypeIllustration
|
|
253
|
+
createTemplate={[Function]}
|
|
254
|
+
currentChannel="SMS"
|
|
255
|
+
hostName=""
|
|
256
|
+
/>
|
|
266
257
|
</div>
|
|
267
258
|
</CapCustomSkeleton>
|
|
268
259
|
</div>
|
|
@@ -1711,6 +1711,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1711
1711
|
};
|
|
1712
1712
|
|
|
1713
1713
|
const saveToMessage = () => {
|
|
1714
|
+
console.log("saveToMessage----> createPayload", createPayload());
|
|
1714
1715
|
getFormData({
|
|
1715
1716
|
value: createPayload(),
|
|
1716
1717
|
_id: params?.id,
|