@capillarytech/creatives-library 7.17.139 → 7.17.140
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/Whatsapp/index.js +101 -82
- package/v2Containers/Whatsapp/index.scss +8 -6
- package/v2Containers/Whatsapp/messages.js +11 -3
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +2966 -156
- package/v2Containers/Whatsapp/tests/index.test.js +4 -1
- package/v2Containers/Whatsapp/utils.js +0 -5
- package/v2Containers/mockdata.js +0 -5
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 } from '../../v2Containers/Whatsapp/constants';
|
|
53
|
+
import { QUICK_REPLY, WHATSAPP_CATEGORIES } 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
|
-
<CapIcon
|
|
338
|
+
{type !== WHATSAPP_CATEGORIES.authentication && <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
|
);
|
|
@@ -9,6 +9,7 @@ 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';
|
|
12
13
|
import CapColumn from '@capillarytech/cap-ui-library/CapColumn';
|
|
13
14
|
import CapHeader from '@capillarytech/cap-ui-library/CapHeader';
|
|
14
15
|
import CapTooltipWithInfo from '@capillarytech/cap-ui-library/CapTooltipWithInfo';
|
|
@@ -850,7 +851,11 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
850
851
|
const extraSecurityFooter = ({ target: { checked = false } } = {}) => {
|
|
851
852
|
setSecurityWarningReqd(checked);
|
|
852
853
|
setExpiryMinutes(0);
|
|
853
|
-
|
|
854
|
+
if (checked) {
|
|
855
|
+
setTemplateFooter(formatMessage(messages.codeExpiryNumMinutes));
|
|
856
|
+
} else {
|
|
857
|
+
setTemplateFooter("");
|
|
858
|
+
}
|
|
854
859
|
const error = templateMessageErrorHandler(templateMessage);
|
|
855
860
|
setTemplateMessageError(error);
|
|
856
861
|
};
|
|
@@ -903,35 +908,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
903
908
|
</>
|
|
904
909
|
);
|
|
905
910
|
};
|
|
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
|
-
};
|
|
911
|
+
|
|
935
912
|
const maxLengthByType = (type) => {
|
|
936
913
|
switch (type) {
|
|
937
914
|
case MESSAGE_TEXT:
|
|
@@ -1115,6 +1092,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1115
1092
|
if (value === WHATSAPP_CATEGORIES.authentication) {
|
|
1116
1093
|
setTemplateHeader('');
|
|
1117
1094
|
setTemplateFooter('');
|
|
1095
|
+
setExpiryMinutes(0);
|
|
1118
1096
|
setUnsubscribeRequired(false);
|
|
1119
1097
|
setTemplateMessage(formatMessage(messages.authenticationMsg));
|
|
1120
1098
|
} else {
|
|
@@ -1626,16 +1604,22 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1626
1604
|
</CapHeading>
|
|
1627
1605
|
}
|
|
1628
1606
|
suffix={
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1607
|
+
<>
|
|
1608
|
+
{!isAuthenticationTemplate && (
|
|
1609
|
+
<CapButton
|
|
1610
|
+
data-testid="suffix-button"
|
|
1611
|
+
type="flat"
|
|
1612
|
+
isAddBtn
|
|
1613
|
+
onClick={onMessageAddVar}
|
|
1614
|
+
disabled={
|
|
1615
|
+
(addedVarCount >= 19 || templateMessageError) &&
|
|
1616
|
+
templateMessage
|
|
1617
|
+
}
|
|
1618
|
+
>
|
|
1619
|
+
{formatMessage(messages.addVar)}
|
|
1620
|
+
</CapButton>
|
|
1621
|
+
)}
|
|
1622
|
+
</>
|
|
1639
1623
|
}
|
|
1640
1624
|
/>
|
|
1641
1625
|
<CapRow className="whatsapp-create-template-message-input">
|
|
@@ -1654,7 +1638,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1654
1638
|
value={templateMessage || ""}
|
|
1655
1639
|
disabled={isAuthenticationTemplate}
|
|
1656
1640
|
/>
|
|
1657
|
-
{
|
|
1641
|
+
{renderUnsubscribeText()}
|
|
1658
1642
|
</CapRow>
|
|
1659
1643
|
{renderMessageLength(MESSAGE_TEXT)}
|
|
1660
1644
|
{/* this section if for footer in create mode */}
|
|
@@ -1680,52 +1664,87 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1680
1664
|
}
|
|
1681
1665
|
/>
|
|
1682
1666
|
<CapRow className="whatsapp-create-template-message-input whatsapp-create-template-header-input">
|
|
1683
|
-
{isAuthenticationTemplate ?
|
|
1667
|
+
{isAuthenticationTemplate ? (
|
|
1684
1668
|
<CapRow className="whatsapp-extra-security-footer">
|
|
1685
1669
|
<CapCheckbox
|
|
1686
1670
|
onChange={extraSecurityFooter}
|
|
1687
1671
|
checked={securityWarningReqd}
|
|
1688
1672
|
disabled={isEditFlow}
|
|
1689
1673
|
autoFocus={true}
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
<
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
)
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1674
|
+
className="whatsapp-unsubscribe-checkbox"
|
|
1675
|
+
>
|
|
1676
|
+
<CapLabel.CapLabelInline
|
|
1677
|
+
type="label2"
|
|
1678
|
+
className="whatsapp-render-unsubscribe-text"
|
|
1679
|
+
>
|
|
1680
|
+
{formatMessage(messages.expirationWarning)}
|
|
1681
|
+
</CapLabel.CapLabelInline>
|
|
1682
|
+
</CapCheckbox>
|
|
1683
|
+
{securityWarningReqd && (
|
|
1684
|
+
<>
|
|
1685
|
+
<CapRow className="whatsapp-extra-security-footer-input">
|
|
1686
|
+
{formatMessage(messages.codeExpiresIn)}
|
|
1687
|
+
<CapInput.Number
|
|
1688
|
+
min={0}
|
|
1689
|
+
max={90}
|
|
1690
|
+
placeholder={formatMessage(messages.enterExpiryTime)}
|
|
1691
|
+
onChange={(event) => changeExpiryMinutes(event)}
|
|
1692
|
+
/>
|
|
1693
|
+
{formatMessage(messages.minutes)}
|
|
1694
|
+
</CapRow>
|
|
1695
|
+
<CapRow className="whatsapp-extra-security-footer-note">
|
|
1696
|
+
{formatMessage(messages.expiryCodeNote)}
|
|
1697
|
+
<CapTooltip
|
|
1698
|
+
title={
|
|
1699
|
+
<CapHeader
|
|
1700
|
+
titleClass="whatsapp-tooltip-header"
|
|
1701
|
+
descriptionClass="whatsapp-tooltip-header"
|
|
1702
|
+
size="small"
|
|
1703
|
+
title={formatMessage(
|
|
1704
|
+
messages.checkExpiryTooltipHeader
|
|
1705
|
+
)}
|
|
1706
|
+
description={formatMessage(
|
|
1707
|
+
messages.checkExpiryTooltipDesc
|
|
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
|
+
)}
|
|
1729
1748
|
</CapRow>
|
|
1730
1749
|
{renderMessageLength(FOOTER_TEXT)}
|
|
1731
1750
|
</>
|
|
@@ -2158,7 +2177,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2158
2177
|
ctaData,
|
|
2159
2178
|
}),
|
|
2160
2179
|
...(isAuthenticationTemplate && {
|
|
2161
|
-
ctaData : [{text: formatMessage(globalMessages.autofill)}]
|
|
2180
|
+
ctaData : [{text: formatMessage(globalMessages.autofill), type: WHATSAPP_CATEGORIES.authentication}]
|
|
2162
2181
|
}),
|
|
2163
2182
|
...(isBtnTypeQuickReply && {
|
|
2164
2183
|
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: 1rem;
|
|
209
209
|
display: flex;
|
|
210
210
|
justify-content: flex-start;
|
|
211
211
|
flex-direction: column;
|
|
@@ -213,6 +213,7 @@
|
|
|
213
213
|
gap: $CAP_SPACE_08;
|
|
214
214
|
|
|
215
215
|
.whatsapp-extra-security-footer-note {
|
|
216
|
+
font-size: small;
|
|
216
217
|
margin-top: $CAP_SPACE_04;
|
|
217
218
|
display: inline-flex;
|
|
218
219
|
padding-left: $CAP_SPACE_12;
|
|
@@ -220,10 +221,11 @@
|
|
|
220
221
|
background: $CAP_PURPLE04;
|
|
221
222
|
align-items: center;
|
|
222
223
|
justify-content: space-between;
|
|
223
|
-
margin-right: $CAP_SPACE_12;
|
|
224
224
|
|
|
225
225
|
.add-btn {
|
|
226
|
+
display: flex;
|
|
226
227
|
background-color: inherit;
|
|
228
|
+
align-items: center;
|
|
227
229
|
}
|
|
228
230
|
}
|
|
229
231
|
|
|
@@ -232,9 +234,9 @@
|
|
|
232
234
|
align-items: center;
|
|
233
235
|
gap: $CAP_SPACE_04;
|
|
234
236
|
}
|
|
235
|
-
|
|
236
|
-
.whatsapp-extra-security-footer-checkbox {
|
|
237
|
-
margin-right: auto;
|
|
238
|
-
}
|
|
239
237
|
}
|
|
238
|
+
|
|
239
|
+
}
|
|
240
|
+
.whatsapp-tooltip-header{
|
|
241
|
+
color: $CAP_G10;
|
|
240
242
|
}
|
|
@@ -674,7 +674,7 @@ export default defineMessages({
|
|
|
674
674
|
},
|
|
675
675
|
checkExpiryCode: {
|
|
676
676
|
id: `${prefix}.checkExpiryCode`,
|
|
677
|
-
defaultMessage: '
|
|
677
|
+
defaultMessage: 'OTP settings',
|
|
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,5 +707,13 @@ export default defineMessages({
|
|
|
707
707
|
enterExpiryTime:{
|
|
708
708
|
id: `${prefix}.enterExpiryTime`,
|
|
709
709
|
defaultMessage: "Enter expiry time"
|
|
710
|
-
}
|
|
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
|
+
},
|
|
711
719
|
});
|