@capillarytech/creatives-library 7.17.140 → 7.17.141
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/TemplatePreview/index.js +3 -3
- package/v2Containers/Email/index.js +3 -5
- package/v2Containers/Whatsapp/index.js +82 -101
- package/v2Containers/Whatsapp/index.scss +6 -8
- package/v2Containers/Whatsapp/messages.js +3 -11
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +146 -302
- package/v2Containers/Whatsapp/tests/index.test.js +1 -4
- package/v2Containers/Whatsapp/utils.js +5 -0
- package/v2Containers/mockdata.js +5 -0
package/package.json
CHANGED
|
@@ -50,7 +50,7 @@ import { TEMPLATE, IMAGE_CAROUSEL, IMAGE, STICKER, TEXT, IMAGE_MAP, VIDEO } from
|
|
|
50
50
|
import CapFacebookPreview from '../../v2Containers/CapFacebookPreview';
|
|
51
51
|
import WhatsappStatusContainer from '../WhatsappStatusContainer';
|
|
52
52
|
import { getWhatsappQuickReply } from '../../v2Containers/Whatsapp/utils';
|
|
53
|
-
import { QUICK_REPLY
|
|
53
|
+
import { QUICK_REPLY } from '../../v2Containers/Whatsapp/constants';
|
|
54
54
|
import { ANDROID, INAPP_MESSAGE_LAYOUT_TYPES } from '../../v2Containers/InApp/constants';
|
|
55
55
|
|
|
56
56
|
const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
|
|
@@ -335,12 +335,12 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
335
335
|
if (text) {
|
|
336
336
|
renderArray.push(
|
|
337
337
|
<CapLabel type="label21" className="whatsapp-cta-preview">
|
|
338
|
-
|
|
338
|
+
<CapIcon
|
|
339
339
|
type={
|
|
340
340
|
(ctaType || type) === 'PHONE_NUMBER' ? 'call' : 'launch'
|
|
341
341
|
}
|
|
342
342
|
size="xs"
|
|
343
|
-
/>
|
|
343
|
+
/>
|
|
344
344
|
{text}
|
|
345
345
|
</CapLabel>,
|
|
346
346
|
);
|
|
@@ -557,12 +557,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
557
557
|
const defaultTemplateName = _.get(defaultData, 'template-name', "");
|
|
558
558
|
|
|
559
559
|
//sync back template name from from editing in create flow to wrapper when edited
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
syncTemplateName(defaultTemplateName);
|
|
563
|
-
} else {
|
|
564
|
-
syncTemplateName(templateName);
|
|
560
|
+
if (syncTemplateName) {
|
|
561
|
+
syncTemplateName(_.isEmpty(templateName) && defaultTemplateName ? defaultTemplateName : templateName);
|
|
565
562
|
}
|
|
563
|
+
|
|
566
564
|
if (defaultData && _.isEmpty(templateName) && defaultTemplateName?.length >1 && isFullMode) {
|
|
567
565
|
formData['template-name'] = defaultTemplateName;
|
|
568
566
|
}
|
|
@@ -9,7 +9,6 @@ import { get, isEmpty, cloneDeep, isEqual } from 'lodash';
|
|
|
9
9
|
import styled from 'styled-components';
|
|
10
10
|
import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
|
|
11
11
|
import CapRow from '@capillarytech/cap-ui-library/CapRow';
|
|
12
|
-
import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
13
12
|
import CapColumn from '@capillarytech/cap-ui-library/CapColumn';
|
|
14
13
|
import CapHeader from '@capillarytech/cap-ui-library/CapHeader';
|
|
15
14
|
import CapTooltipWithInfo from '@capillarytech/cap-ui-library/CapTooltipWithInfo';
|
|
@@ -851,11 +850,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
851
850
|
const extraSecurityFooter = ({ target: { checked = false } } = {}) => {
|
|
852
851
|
setSecurityWarningReqd(checked);
|
|
853
852
|
setExpiryMinutes(0);
|
|
854
|
-
|
|
855
|
-
setTemplateFooter(formatMessage(messages.codeExpiryNumMinutes));
|
|
856
|
-
} else {
|
|
857
|
-
setTemplateFooter("");
|
|
858
|
-
}
|
|
853
|
+
setTemplateFooter('');
|
|
859
854
|
const error = templateMessageErrorHandler(templateMessage);
|
|
860
855
|
setTemplateMessageError(error);
|
|
861
856
|
};
|
|
@@ -908,7 +903,35 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
908
903
|
</>
|
|
909
904
|
);
|
|
910
905
|
};
|
|
911
|
-
|
|
906
|
+
|
|
907
|
+
const renderExtraSecurityText = () => {
|
|
908
|
+
const isDisabled =
|
|
909
|
+
isEditFlow ||
|
|
910
|
+
templateMessage?.length + UNSUBSCRIBE_TEXT_LENGTH >
|
|
911
|
+
TEMPLATE_MESSAGE_MAX_LENGTH;
|
|
912
|
+
|
|
913
|
+
return (
|
|
914
|
+
<>
|
|
915
|
+
<CapColumn span={12}>
|
|
916
|
+
<CapCheckbox
|
|
917
|
+
className={`whatsapp-unsubscribe-checkbox ${
|
|
918
|
+
isEditFlow
|
|
919
|
+
? 'whatsapp-edit-unsubscribe-checkbox'
|
|
920
|
+
: 'whatsapp-create-unsubscribe-checkbox'
|
|
921
|
+
}`}
|
|
922
|
+
onChange={unsubscribeHandler}
|
|
923
|
+
checked={unsubscribeRequired}
|
|
924
|
+
disabled={isDisabled}
|
|
925
|
+
autoFocus={true}
|
|
926
|
+
>
|
|
927
|
+
<CapLabel.CapLabelInline type="label9">
|
|
928
|
+
{formatMessage(messages.templateSecurityDisclaimer)}
|
|
929
|
+
</CapLabel.CapLabelInline>
|
|
930
|
+
</CapCheckbox>
|
|
931
|
+
</CapColumn>
|
|
932
|
+
</>
|
|
933
|
+
);
|
|
934
|
+
};
|
|
912
935
|
const maxLengthByType = (type) => {
|
|
913
936
|
switch (type) {
|
|
914
937
|
case MESSAGE_TEXT:
|
|
@@ -1092,7 +1115,6 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1092
1115
|
if (value === WHATSAPP_CATEGORIES.authentication) {
|
|
1093
1116
|
setTemplateHeader('');
|
|
1094
1117
|
setTemplateFooter('');
|
|
1095
|
-
setExpiryMinutes(0);
|
|
1096
1118
|
setUnsubscribeRequired(false);
|
|
1097
1119
|
setTemplateMessage(formatMessage(messages.authenticationMsg));
|
|
1098
1120
|
} else {
|
|
@@ -1604,22 +1626,16 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1604
1626
|
</CapHeading>
|
|
1605
1627
|
}
|
|
1606
1628
|
suffix={
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
}
|
|
1618
|
-
>
|
|
1619
|
-
{formatMessage(messages.addVar)}
|
|
1620
|
-
</CapButton>
|
|
1621
|
-
)}
|
|
1622
|
-
</>
|
|
1629
|
+
<CapButton
|
|
1630
|
+
type="flat"
|
|
1631
|
+
isAddBtn
|
|
1632
|
+
onClick={onMessageAddVar}
|
|
1633
|
+
disabled={
|
|
1634
|
+
(addedVarCount >= 19 || templateMessageError) && templateMessage
|
|
1635
|
+
}
|
|
1636
|
+
>
|
|
1637
|
+
{formatMessage(messages.addVar)}
|
|
1638
|
+
</CapButton>
|
|
1623
1639
|
}
|
|
1624
1640
|
/>
|
|
1625
1641
|
<CapRow className="whatsapp-create-template-message-input">
|
|
@@ -1638,7 +1654,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1638
1654
|
value={templateMessage || ""}
|
|
1639
1655
|
disabled={isAuthenticationTemplate}
|
|
1640
1656
|
/>
|
|
1641
|
-
{renderUnsubscribeText()}
|
|
1657
|
+
{isAuthenticationTemplate ? renderExtraSecurityText() : renderUnsubscribeText()}
|
|
1642
1658
|
</CapRow>
|
|
1643
1659
|
{renderMessageLength(MESSAGE_TEXT)}
|
|
1644
1660
|
{/* this section if for footer in create mode */}
|
|
@@ -1664,87 +1680,52 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1664
1680
|
}
|
|
1665
1681
|
/>
|
|
1666
1682
|
<CapRow className="whatsapp-create-template-message-input whatsapp-create-template-header-input">
|
|
1667
|
-
{isAuthenticationTemplate ?
|
|
1683
|
+
{isAuthenticationTemplate ?
|
|
1668
1684
|
<CapRow className="whatsapp-extra-security-footer">
|
|
1669
1685
|
<CapCheckbox
|
|
1670
1686
|
onChange={extraSecurityFooter}
|
|
1671
1687
|
checked={securityWarningReqd}
|
|
1672
1688
|
disabled={isEditFlow}
|
|
1673
1689
|
autoFocus={true}
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
{formatMessage(messages.
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
<
|
|
1686
|
-
{
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
<CapButton
|
|
1714
|
-
type="flat"
|
|
1715
|
-
className="add-btn"
|
|
1716
|
-
onClick={() =>
|
|
1717
|
-
window.open(
|
|
1718
|
-
`${window.location.origin}${OTP_CONFIG_URI}`,
|
|
1719
|
-
"_blank"
|
|
1720
|
-
)
|
|
1721
|
-
}
|
|
1722
|
-
>
|
|
1723
|
-
{formatMessage(messages.checkExpiryCode)}
|
|
1724
|
-
<CapIcon size="s" type="launch"/>
|
|
1725
|
-
</CapButton>
|
|
1726
|
-
</CapTooltip>
|
|
1727
|
-
</CapRow>
|
|
1728
|
-
</>
|
|
1729
|
-
)}
|
|
1730
|
-
</CapRow>
|
|
1731
|
-
) : (
|
|
1732
|
-
<TextArea
|
|
1733
|
-
id="whatsapp-create-template-message-input"
|
|
1734
|
-
autosize={{ minRows: 1, maxRows: 5 }}
|
|
1735
|
-
placeholder={formatMessage(messages.templateMessagePlaceholder)}
|
|
1736
|
-
onChange={onTemplateFooterChanges}
|
|
1737
|
-
errorMessage={
|
|
1738
|
-
templateFooterError && (
|
|
1739
|
-
<CapError className="whatsapp-template-message-error">
|
|
1740
|
-
{templateFooterError}
|
|
1741
|
-
</CapError>
|
|
1742
|
-
)
|
|
1743
|
-
}
|
|
1744
|
-
value={templateFooter || ""}
|
|
1745
|
-
disabled={isAuthenticationTemplate}
|
|
1746
|
-
/>
|
|
1747
|
-
)}
|
|
1690
|
+
children={formatMessage(messages.expirationWarning)}
|
|
1691
|
+
className="whatsapp-extra-security-footer-checkbox"
|
|
1692
|
+
/>
|
|
1693
|
+
{securityWarningReqd && <>
|
|
1694
|
+
<CapRow className='whatsapp-extra-security-footer-input'>
|
|
1695
|
+
{formatMessage(messages.codeExpiresIn)}
|
|
1696
|
+
<CapInput.Number min={0} placeholder={formatMessage(messages.enterExpiryTime)} onChange={(event) => changeExpiryMinutes(event)} />
|
|
1697
|
+
{formatMessage(messages.minutes)}
|
|
1698
|
+
</CapRow>
|
|
1699
|
+
<CapRow className='whatsapp-extra-security-footer-note' >
|
|
1700
|
+
{formatMessage(messages.expiryCodeNote)}
|
|
1701
|
+
<CapTooltip title={formatMessage(messages.checkExpiryCode)}>
|
|
1702
|
+
<CapButton type="flat" className="add-btn" onClick={() =>
|
|
1703
|
+
window.open(
|
|
1704
|
+
`${window.location.origin}${OTP_CONFIG_URI}`,
|
|
1705
|
+
'_blank',
|
|
1706
|
+
)
|
|
1707
|
+
}>{formatMessage(messages.checkExpiryCode)}
|
|
1708
|
+
</CapButton>
|
|
1709
|
+
</CapTooltip>
|
|
1710
|
+
</CapRow>
|
|
1711
|
+
</>}
|
|
1712
|
+
</CapRow> :
|
|
1713
|
+
<TextArea
|
|
1714
|
+
id="whatsapp-create-template-message-input"
|
|
1715
|
+
autosize={{ minRows: 1, maxRows: 5 }}
|
|
1716
|
+
placeholder={formatMessage(messages.templateMessagePlaceholder)}
|
|
1717
|
+
onChange={onTemplateFooterChanges}
|
|
1718
|
+
errorMessage={
|
|
1719
|
+
templateFooterError && (
|
|
1720
|
+
<CapError className="whatsapp-template-message-error">
|
|
1721
|
+
{templateFooterError}
|
|
1722
|
+
</CapError>
|
|
1723
|
+
)
|
|
1724
|
+
}
|
|
1725
|
+
value={templateFooter || ""}
|
|
1726
|
+
disabled={isAuthenticationTemplate}
|
|
1727
|
+
/>
|
|
1728
|
+
}
|
|
1748
1729
|
</CapRow>
|
|
1749
1730
|
{renderMessageLength(FOOTER_TEXT)}
|
|
1750
1731
|
</>
|
|
@@ -2177,7 +2158,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2177
2158
|
ctaData,
|
|
2178
2159
|
}),
|
|
2179
2160
|
...(isAuthenticationTemplate && {
|
|
2180
|
-
ctaData : [{text: formatMessage(globalMessages.autofill)
|
|
2161
|
+
ctaData : [{text: formatMessage(globalMessages.autofill)}]
|
|
2181
2162
|
}),
|
|
2182
2163
|
...(isBtnTypeQuickReply && {
|
|
2183
2164
|
quickReplyData,
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
font-weight: $FONT_WEIGHT_MEDIUM;
|
|
206
206
|
}
|
|
207
207
|
.whatsapp-extra-security-footer {
|
|
208
|
-
margin-bottom:
|
|
208
|
+
margin-bottom: $CAP_SPACE_04;
|
|
209
209
|
display: flex;
|
|
210
210
|
justify-content: flex-start;
|
|
211
211
|
flex-direction: column;
|
|
@@ -213,7 +213,6 @@
|
|
|
213
213
|
gap: $CAP_SPACE_08;
|
|
214
214
|
|
|
215
215
|
.whatsapp-extra-security-footer-note {
|
|
216
|
-
font-size: small;
|
|
217
216
|
margin-top: $CAP_SPACE_04;
|
|
218
217
|
display: inline-flex;
|
|
219
218
|
padding-left: $CAP_SPACE_12;
|
|
@@ -221,11 +220,10 @@
|
|
|
221
220
|
background: $CAP_PURPLE04;
|
|
222
221
|
align-items: center;
|
|
223
222
|
justify-content: space-between;
|
|
223
|
+
margin-right: $CAP_SPACE_12;
|
|
224
224
|
|
|
225
225
|
.add-btn {
|
|
226
|
-
display: flex;
|
|
227
226
|
background-color: inherit;
|
|
228
|
-
align-items: center;
|
|
229
227
|
}
|
|
230
228
|
}
|
|
231
229
|
|
|
@@ -234,9 +232,9 @@
|
|
|
234
232
|
align-items: center;
|
|
235
233
|
gap: $CAP_SPACE_04;
|
|
236
234
|
}
|
|
237
|
-
}
|
|
238
235
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
236
|
+
.whatsapp-extra-security-footer-checkbox {
|
|
237
|
+
margin-right: auto;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
242
240
|
}
|
|
@@ -674,7 +674,7 @@ export default defineMessages({
|
|
|
674
674
|
},
|
|
675
675
|
checkExpiryCode: {
|
|
676
676
|
id: `${prefix}.checkExpiryCode`,
|
|
677
|
-
defaultMessage: '
|
|
677
|
+
defaultMessage: 'Check here',
|
|
678
678
|
},
|
|
679
679
|
expiryCodeNote:{
|
|
680
680
|
id: `${prefix}.expiryCodeNote`,
|
|
@@ -686,7 +686,7 @@ export default defineMessages({
|
|
|
686
686
|
},
|
|
687
687
|
minutes:{
|
|
688
688
|
id: `${prefix}.minutes`,
|
|
689
|
-
defaultMessage: '
|
|
689
|
+
defaultMessage: 'Minutes',
|
|
690
690
|
},
|
|
691
691
|
codeExpiryNumMinutes:{
|
|
692
692
|
id: `${prefix}.codeExpiryNumMinutes`,
|
|
@@ -707,13 +707,5 @@ export default defineMessages({
|
|
|
707
707
|
enterExpiryTime:{
|
|
708
708
|
id: `${prefix}.enterExpiryTime`,
|
|
709
709
|
defaultMessage: "Enter expiry time"
|
|
710
|
-
}
|
|
711
|
-
checkExpiryTooltipHeader: {
|
|
712
|
-
id: `${prefix}.checkExpiryTooltipHeader`,
|
|
713
|
-
defaultMessage: 'Open OTP settings in new tab',
|
|
714
|
-
},
|
|
715
|
-
checkExpiryTooltipDesc: {
|
|
716
|
-
id: `${prefix}.checkExpiryTooltipDesc`,
|
|
717
|
-
defaultMessage: 'To check the configured expiry time that is same for all OTPs',
|
|
718
|
-
},
|
|
710
|
+
}
|
|
719
711
|
});
|