@capillarytech/creatives-library 7.17.137 → 7.17.139
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/CapWhatsappQuickReply/index.js +33 -23
- package/v2Components/CapWhatsappQuickReply/index.scss +4 -1
- package/v2Components/CapWhatsappQuickReply/messages.js +4 -0
- package/v2Components/Ckeditor/index.js +6 -6
- package/v2Containers/Cap/messages.js +4 -0
- package/v2Containers/EmailWrapper/index.js +2 -3
- package/v2Containers/Templates/index.js +2 -1
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +3 -0
- package/v2Containers/Whatsapp/constants.js +2 -0
- package/v2Containers/Whatsapp/index.js +155 -34
- package/v2Containers/Whatsapp/index.scss +33 -0
- package/v2Containers/Whatsapp/messages.js +44 -0
- package/v2Containers/Whatsapp/styles.scss +5 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +838 -820
- package/v2Containers/Whatsapp/tests/utils.test.js +9 -2
- package/v2Containers/Whatsapp/utils.js +23 -0
- package/v2Containers/mockdata.js +16 -0
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ import CapButton from "@capillarytech/cap-ui-library/CapButton";
|
|
|
13
13
|
import CapColumn from "@capillarytech/cap-ui-library/CapColumn";
|
|
14
14
|
import CapIcon from "@capillarytech/cap-ui-library/CapIcon";
|
|
15
15
|
import CapLabel from "@capillarytech/cap-ui-library/CapLabel";
|
|
16
|
+
import CapInfoNote from "@capillarytech/cap-ui-library/CapInfoNote";
|
|
16
17
|
import messages from "./messages";
|
|
17
18
|
import "./index.scss";
|
|
18
19
|
import globalMessages from "../../v2Containers/Cap/messages";
|
|
@@ -20,7 +21,7 @@ import { BUTTON_TEXT, INITIAL_QUICK_REPLY_DATA } from "../../v2Containers/Whatsa
|
|
|
20
21
|
import ctaMessages from "../CapWhatsappCTA/messages";
|
|
21
22
|
|
|
22
23
|
export const CapWhatsappQuickReply = (props) => {
|
|
23
|
-
const { quickReplyData = [], renderMessageLength, setQuickReplyData, isEditFlow, intl } = props;
|
|
24
|
+
const { quickReplyData = [], renderMessageLength, setQuickReplyData, isEditFlow, intl,authenticationFlow } = props;
|
|
24
25
|
const { TextArea } = CapInput;
|
|
25
26
|
const { formatMessage } = intl;
|
|
26
27
|
const quickReplyDataLength = quickReplyData?.length;
|
|
@@ -77,7 +78,28 @@ export const CapWhatsappQuickReply = (props) => {
|
|
|
77
78
|
}));
|
|
78
79
|
});
|
|
79
80
|
};
|
|
80
|
-
|
|
81
|
+
const quickReplyConfiguredBtn = ({ text, index, authenticationFlow = false }) => (
|
|
82
|
+
<CapRow className="cap-whatsapp-quick-reply">
|
|
83
|
+
<CapRow className="whatsapp-quick-reply-save-container">
|
|
84
|
+
{!authenticationFlow && <CapColumn>
|
|
85
|
+
<CapIcon type="six-dots" />
|
|
86
|
+
</CapColumn>}
|
|
87
|
+
<CapColumn className="text-container">{text}</CapColumn>
|
|
88
|
+
<CapColumn className={`quick-reply-icon ${authenticationFlow ? 'whatsapp-quick-reply-disabled-icons' : ''}`}>
|
|
89
|
+
<CapIcon
|
|
90
|
+
onClick={() => handleSaveAndEditBtn(index, false)}
|
|
91
|
+
type="edit"
|
|
92
|
+
aria-label="quick-reply-edit"
|
|
93
|
+
/>
|
|
94
|
+
<CapIcon
|
|
95
|
+
onClick={() => handleDelete(index)}
|
|
96
|
+
type="delete"
|
|
97
|
+
aria-label="quick-reply-delete"
|
|
98
|
+
/>
|
|
99
|
+
</CapColumn>
|
|
100
|
+
</CapRow>
|
|
101
|
+
</CapRow>
|
|
102
|
+
)
|
|
81
103
|
const addQuickReply = () => {
|
|
82
104
|
const cloneInitialQuickReplyData = cloneDeep(INITIAL_QUICK_REPLY_DATA);
|
|
83
105
|
cloneInitialQuickReplyData[0].index = quickReplyDataLength || 0;
|
|
@@ -92,6 +114,12 @@ export const CapWhatsappQuickReply = (props) => {
|
|
|
92
114
|
quickReplyDataLength === 1 && !quickReplyData?.[0]?.isSaved;
|
|
93
115
|
return (
|
|
94
116
|
<>
|
|
117
|
+
{authenticationFlow ?
|
|
118
|
+
<>
|
|
119
|
+
{quickReplyConfiguredBtn({ text: formatMessage(globalMessages.autofill), index: '0', authenticationFlow: true })}
|
|
120
|
+
<CapInfoNote className="margin-l-26" message={formatMessage(messages.autofillInfo)}/>
|
|
121
|
+
</> :
|
|
122
|
+
<>
|
|
95
123
|
{quickReplyDataLength > 0 && !isEditFlow && (
|
|
96
124
|
<CapRow>
|
|
97
125
|
{quickReplyData?.map(({ index, isSaved, text, error }) => {
|
|
@@ -174,26 +202,7 @@ export const CapWhatsappQuickReply = (props) => {
|
|
|
174
202
|
}
|
|
175
203
|
return (
|
|
176
204
|
//this section render when data is saved and user can edit it
|
|
177
|
-
|
|
178
|
-
<CapRow className="whatsapp-quick-reply-save-container">
|
|
179
|
-
<CapColumn>
|
|
180
|
-
<CapIcon type="six-dots" />
|
|
181
|
-
</CapColumn>
|
|
182
|
-
<CapColumn className="text-conatiner">{text}</CapColumn>
|
|
183
|
-
<CapColumn className="quick-reply-icon">
|
|
184
|
-
<CapIcon
|
|
185
|
-
onClick={() => handleSaveAndEditBtn(index, false)}
|
|
186
|
-
type="edit"
|
|
187
|
-
data-testid="quick-reply-edit"
|
|
188
|
-
/>
|
|
189
|
-
<CapIcon
|
|
190
|
-
onClick={() => handleDelete(index)}
|
|
191
|
-
type="delete"
|
|
192
|
-
data-testid="quick-reply-delete"
|
|
193
|
-
/>
|
|
194
|
-
</CapColumn>
|
|
195
|
-
</CapRow>
|
|
196
|
-
</CapRow>
|
|
205
|
+
quickReplyConfiguredBtn({text,index})
|
|
197
206
|
);
|
|
198
207
|
})}
|
|
199
208
|
</CapRow>
|
|
@@ -229,7 +238,7 @@ export const CapWhatsappQuickReply = (props) => {
|
|
|
229
238
|
</div>
|
|
230
239
|
</CapTooltip>
|
|
231
240
|
</CapRow>
|
|
232
|
-
)}
|
|
241
|
+
)}</>}
|
|
233
242
|
</>
|
|
234
243
|
);
|
|
235
244
|
};
|
|
@@ -240,6 +249,7 @@ CapWhatsappQuickReply.propTypes = {
|
|
|
240
249
|
setQuickReplyData: PropTypes.func,
|
|
241
250
|
isEditFlow: PropTypes.func,
|
|
242
251
|
intl: intlShape.isRequired,
|
|
252
|
+
authenticationFlow : PropTypes.bool,
|
|
243
253
|
};
|
|
244
254
|
|
|
245
255
|
export default injectIntl(CapWhatsappQuickReply);
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
display: flex;
|
|
25
25
|
align-items: center;
|
|
26
26
|
padding: $CAP_SPACE_08 $CAP_SPACE_12;
|
|
27
|
-
.text-
|
|
27
|
+
.text-container {
|
|
28
28
|
padding-left: $CAP_SPACE_12;
|
|
29
29
|
}
|
|
30
30
|
.quick-reply-icon {
|
|
@@ -35,6 +35,9 @@
|
|
|
35
35
|
.whatsapp-button-text-tooltip {
|
|
36
36
|
margin-left: $CAP_SPACE_04;
|
|
37
37
|
}
|
|
38
|
+
.whatsapp-quick-reply-disabled-icons{
|
|
39
|
+
color: $FONT_COLOR_04;
|
|
40
|
+
}
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
.whatsapp-quick-reply-edit-container {
|
|
@@ -25,4 +25,8 @@ export default defineMessages({
|
|
|
25
25
|
id: `${prefix}.buttonTextTooltip`,
|
|
26
26
|
defaultMessage: 'Use this to name the button. We would recommend not to use special characters for the button text.'
|
|
27
27
|
},
|
|
28
|
+
autofillInfo:{
|
|
29
|
+
id: `${prefix}.autofillInfo`,
|
|
30
|
+
defaultMessage: 'One-tap autofill buttons are only supported on Android. If you send an authentication template to a WhatsApp user who is using a non-Android device, the WhatsApp client will display a copy code button instead.'
|
|
31
|
+
}
|
|
28
32
|
});
|
|
@@ -15,10 +15,10 @@ import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
|
|
|
15
15
|
import './style.scss';
|
|
16
16
|
// import messages from './messages';
|
|
17
17
|
const loadScript = require('load-script');
|
|
18
|
-
|
|
19
|
-
const defaultScriptUrl = 'https://nightly.intouch.capillarytech.com/arya/ui/library/ckeditor/ckeditor.js';
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const defaultScriptUrl = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
|
|
19
|
+
/*const defaultScriptUrl = 'https://nightly.intouch.capillarytech.com/arya/ui/library/ckeditor/ckeditor.js';
|
|
20
|
+
**Uncomment the above line to use CKEDITOR in local
|
|
21
|
+
*/
|
|
22
22
|
const user = localStorage.getItem('user');
|
|
23
23
|
let locale = 'en';
|
|
24
24
|
if (user && JSON.parse(user).lang) {
|
|
@@ -173,7 +173,7 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
|
|
|
173
173
|
// setTimeout(() => {
|
|
174
174
|
// this.editorInstance.name = this.id;
|
|
175
175
|
// }, 5000);
|
|
176
|
-
|
|
176
|
+
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -219,7 +219,7 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
|
|
|
219
219
|
|
|
220
220
|
let html = this.props.content;
|
|
221
221
|
html = html.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, "\"");
|
|
222
|
-
|
|
222
|
+
|
|
223
223
|
this.editorInstance = window.CKEDITOR.appendTo(
|
|
224
224
|
this.node,
|
|
225
225
|
this.state.config,
|
|
@@ -103,9 +103,8 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
103
103
|
}
|
|
104
104
|
onTemplateNameChange = ({target: {value}}) => {
|
|
105
105
|
const {onEnterTemplateName, onRemoveTemplateName} = this.props;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
this.setState({isTemplateNameEmpty: isEmptyTemplateName});
|
|
106
|
+
const isEmptyTemplateName = !value?.trim();
|
|
107
|
+
this.setState({templateName: value, isTemplateNameEmpty: isEmptyTemplateName});
|
|
109
108
|
if (value && onEnterTemplateName) {
|
|
110
109
|
onEnterTemplateName();
|
|
111
110
|
} else if (onRemoveTemplateName) {
|
|
@@ -111,7 +111,7 @@ import {
|
|
|
111
111
|
} from '../Whatsapp/constants';
|
|
112
112
|
import { INAPP_LAYOUT_DETAILS } from '../InApp/constants';
|
|
113
113
|
import { ZALO_STATUS_OPTIONS, ZALO_STATUSES } from '../Zalo/constants';
|
|
114
|
-
import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory, getWhatsappCta, getWhatsappQuickReply } from '../Whatsapp/utils';
|
|
114
|
+
import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory, getWhatsappCta, getWhatsappQuickReply, getWhatsappAutoFill } from '../Whatsapp/utils';
|
|
115
115
|
import { getRCSContent } from '../Rcs/utils';
|
|
116
116
|
import zaloMessages from '../Zalo/messages';
|
|
117
117
|
import globalMessages from '../../v2Containers/Cap/messages';
|
|
@@ -1308,6 +1308,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1308
1308
|
</span>
|
|
1309
1309
|
{getWhatsappCta(template)}
|
|
1310
1310
|
{getWhatsappQuickReply(template)}
|
|
1311
|
+
{getWhatsappAutoFill(template)}
|
|
1311
1312
|
</>
|
|
1312
1313
|
);
|
|
1313
1314
|
break;
|
|
@@ -1447,6 +1447,7 @@ Click {{unsubscribe}} to unsubscribe
|
|
|
1447
1447
|
/>
|
|
1448
1448
|
Visit
|
|
1449
1449
|
</CapLabel>
|
|
1450
|
+
<React.Fragment />
|
|
1450
1451
|
</React.Fragment>,
|
|
1451
1452
|
"extra": Array [
|
|
1452
1453
|
<CapTooltip
|
|
@@ -1891,6 +1892,7 @@ Click {{unsubscribe}} to unsubscribe
|
|
|
1891
1892
|
/>
|
|
1892
1893
|
Visit
|
|
1893
1894
|
</CapLabel>
|
|
1895
|
+
<React.Fragment />
|
|
1894
1896
|
</React.Fragment>,
|
|
1895
1897
|
"extra": Array [
|
|
1896
1898
|
<CapTooltip
|
|
@@ -2335,6 +2337,7 @@ Click {{unsubscribe}} to unsubscribe
|
|
|
2335
2337
|
/>
|
|
2336
2338
|
Visit
|
|
2337
2339
|
</CapLabel>
|
|
2340
|
+
<React.Fragment />
|
|
2338
2341
|
</React.Fragment>,
|
|
2339
2342
|
"extra": Array [
|
|
2340
2343
|
<CapTooltip
|
|
@@ -5,7 +5,7 @@ import React, { useState, useEffect, useCallback } from 'react';
|
|
|
5
5
|
import { bindActionCreators } from 'redux';
|
|
6
6
|
import { createStructuredSelector } from 'reselect';
|
|
7
7
|
import { injectIntl, FormattedMessage } from 'react-intl';
|
|
8
|
-
import { get, isEmpty, cloneDeep } from 'lodash';
|
|
8
|
+
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';
|
|
@@ -25,7 +25,7 @@ import CapAlert from '@capillarytech/cap-ui-library/CapAlert';
|
|
|
25
25
|
import CapCheckbox from '@capillarytech/cap-ui-library/CapCheckbox';
|
|
26
26
|
import CapLink from '@capillarytech/cap-ui-library/CapLink';
|
|
27
27
|
import moment from 'moment';
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
import {
|
|
30
30
|
CAP_SPACE_04,
|
|
31
31
|
CAP_SPACE_16,
|
|
@@ -75,7 +75,9 @@ import {
|
|
|
75
75
|
HEADER_TEXT,
|
|
76
76
|
FOOTER_TEXT,
|
|
77
77
|
MESSAGE_TEXT,
|
|
78
|
-
BUTTON_TEXT
|
|
78
|
+
BUTTON_TEXT,
|
|
79
|
+
OTP_CONFIG_URI,
|
|
80
|
+
WHATSAPP_CATEGORIES,
|
|
79
81
|
} from './constants';
|
|
80
82
|
import { DATE_DISPLAY_FORMAT, TIME_DISPLAY_FORMAT } from '../App/constants';
|
|
81
83
|
import messages from './messages';
|
|
@@ -149,6 +151,8 @@ export const Whatsapp = (props) => {
|
|
|
149
151
|
const [host, setHost] = useState('');
|
|
150
152
|
const [spin, setSpin] = useState(false);
|
|
151
153
|
const [unsubscribeRequired, setUnsubscribeRequired] = useState(false);
|
|
154
|
+
const [securityWarningReqd, setSecurityWarningReqd] = useState(false);
|
|
155
|
+
const [expiryMinutes, setExpiryMinutes] = useState(0);
|
|
152
156
|
const [whatsappImageSrc, setWhatsappImageSrc] = useState('');
|
|
153
157
|
const [whatsappVideoSrcAndPreview, setWhatsappVideoSrcAndPreview] = useState({
|
|
154
158
|
whatsappVideoSrc: '',
|
|
@@ -406,7 +410,10 @@ export const Whatsapp = (props) => {
|
|
|
406
410
|
}
|
|
407
411
|
setUnsubscribeRequired(true);
|
|
408
412
|
}
|
|
409
|
-
|
|
413
|
+
if(msg?.includes(formatMessage(messages.securitySuffix))){
|
|
414
|
+
setUnsubscribeRequired(true);
|
|
415
|
+
}
|
|
416
|
+
//converting msg string to variable arr
|
|
410
417
|
const templateMessageArray = converStringToVarArr(validVarArr, msg);
|
|
411
418
|
updateTempMsgArray(templateMessageArray.filter((i) => i === 0 || i));
|
|
412
419
|
};
|
|
@@ -698,7 +705,7 @@ export const Whatsapp = (props) => {
|
|
|
698
705
|
disabled: host === HOST_TWILIO,
|
|
699
706
|
},
|
|
700
707
|
];
|
|
701
|
-
|
|
708
|
+
const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.authentication);
|
|
702
709
|
const onChangeButtonType = ({ target: { value } }) => {
|
|
703
710
|
setButtonType(value);
|
|
704
711
|
setCtadata(INITIAL_CTA_DATA);
|
|
@@ -829,19 +836,41 @@ export const Whatsapp = (props) => {
|
|
|
829
836
|
|
|
830
837
|
const unsubscribeHandler = ({ target: { checked } }) => {
|
|
831
838
|
setUnsubscribeRequired(checked);
|
|
839
|
+
if (isAuthenticationTemplate) {
|
|
840
|
+
if (checked && !templateMessage?.includes(formatMessage(messages.securitySuffix))) {
|
|
841
|
+
setTemplateMessage(`${templateMessage}${formatMessage(messages.securitySuffix)}`);
|
|
842
|
+
} else {
|
|
843
|
+
setTemplateMessage(formatMessage(messages.authenticationMsg));
|
|
844
|
+
}
|
|
845
|
+
}
|
|
832
846
|
const error = templateMessageErrorHandler(templateMessage);
|
|
833
847
|
setTemplateMessageError(error);
|
|
834
848
|
};
|
|
835
849
|
|
|
836
|
-
const
|
|
837
|
-
|
|
850
|
+
const extraSecurityFooter = ({ target: { checked = false } } = {}) => {
|
|
851
|
+
setSecurityWarningReqd(checked);
|
|
852
|
+
setExpiryMinutes(0);
|
|
853
|
+
setTemplateFooter('');
|
|
854
|
+
const error = templateMessageErrorHandler(templateMessage);
|
|
855
|
+
setTemplateMessageError(error);
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
const changeExpiryMinutes =(event) => {
|
|
859
|
+
setExpiryMinutes(event);
|
|
860
|
+
const footerContent =`${formatMessage(
|
|
861
|
+
messages.codeExpiryNumMinutes,
|
|
862
|
+
)}` ;
|
|
863
|
+
setTemplateFooter(footerContent.replace(formatMessage(messages.numMinutes), event));
|
|
838
864
|
}
|
|
839
865
|
|
|
840
866
|
const renderUnsubscribeText = () => {
|
|
841
867
|
const isDisabled =
|
|
842
868
|
isEditFlow ||
|
|
843
|
-
templateMessage
|
|
869
|
+
templateMessage?.length + UNSUBSCRIBE_TEXT_LENGTH >
|
|
844
870
|
TEMPLATE_MESSAGE_MAX_LENGTH;
|
|
871
|
+
const messageFooter = isAuthenticationTemplate ?
|
|
872
|
+
formatMessage(messages.templateSecurityDisclaimer):
|
|
873
|
+
formatMessage(messages.templateMessageUnsubscribeText, { unsubscribe: '{{unsubscribe}}' });
|
|
845
874
|
return (
|
|
846
875
|
<>
|
|
847
876
|
<CapColumn span={12}>
|
|
@@ -866,16 +895,43 @@ export const Whatsapp = (props) => {
|
|
|
866
895
|
}
|
|
867
896
|
>
|
|
868
897
|
<span className="whatsapp-render-unsubscribe-text">
|
|
869
|
-
{
|
|
898
|
+
{messageFooter}
|
|
870
899
|
</span>
|
|
871
900
|
</CapTooltip>
|
|
872
901
|
</CapCheckbox>
|
|
873
902
|
</CapColumn>
|
|
874
|
-
<CapColumn span={12}></CapColumn>
|
|
875
903
|
</>
|
|
876
904
|
);
|
|
877
905
|
};
|
|
878
|
-
|
|
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
|
+
};
|
|
879
935
|
const maxLengthByType = (type) => {
|
|
880
936
|
switch (type) {
|
|
881
937
|
case MESSAGE_TEXT:
|
|
@@ -897,21 +953,25 @@ export const Whatsapp = (props) => {
|
|
|
897
953
|
<CapHeading type="h4">
|
|
898
954
|
{formatMessage(messages.btnLabel)}
|
|
899
955
|
</CapHeading>
|
|
900
|
-
<CapHeading className="whatsapp-optional-label">
|
|
956
|
+
{!isAuthenticationTemplate && <CapHeading className="whatsapp-optional-label">
|
|
901
957
|
{formatMessage(messages.optional)}
|
|
902
|
-
</CapHeading>
|
|
958
|
+
</CapHeading>}
|
|
903
959
|
</CapRow>
|
|
904
960
|
}
|
|
905
961
|
description={
|
|
906
962
|
<CapLabel type="label3">{formatMessage(messages.btnDesc)}</CapLabel>
|
|
907
963
|
}
|
|
908
964
|
/>
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
965
|
+
{isAuthenticationTemplate ?
|
|
966
|
+
<CapWhatsappQuickReply
|
|
967
|
+
authenticationFlow={true}
|
|
968
|
+
/> :
|
|
969
|
+
<CapRadioGroup
|
|
970
|
+
options={buttonRadioOptions}
|
|
971
|
+
value={buttonType}
|
|
972
|
+
onChange={onChangeButtonType}
|
|
973
|
+
className="whatsapp-btn-radio-group"
|
|
974
|
+
/>}
|
|
915
975
|
</>
|
|
916
976
|
);
|
|
917
977
|
|
|
@@ -1052,6 +1112,14 @@ export const Whatsapp = (props) => {
|
|
|
1052
1112
|
};
|
|
1053
1113
|
|
|
1054
1114
|
const onTemplateCategoryChange = (value) => {
|
|
1115
|
+
if (value === WHATSAPP_CATEGORIES.authentication) {
|
|
1116
|
+
setTemplateHeader('');
|
|
1117
|
+
setTemplateFooter('');
|
|
1118
|
+
setUnsubscribeRequired(false);
|
|
1119
|
+
setTemplateMessage(formatMessage(messages.authenticationMsg));
|
|
1120
|
+
} else {
|
|
1121
|
+
setTemplateMessage('');
|
|
1122
|
+
}
|
|
1055
1123
|
setTemplateCategory(value);
|
|
1056
1124
|
};
|
|
1057
1125
|
|
|
@@ -1127,6 +1195,10 @@ export const Whatsapp = (props) => {
|
|
|
1127
1195
|
} else {
|
|
1128
1196
|
errorMessage = variableErrorHandling(value, MESSAGE_TEXT);
|
|
1129
1197
|
}
|
|
1198
|
+
//we are not allowing user input incase of authentication flow
|
|
1199
|
+
if(isAuthenticationTemplate){
|
|
1200
|
+
errorMessage = false;
|
|
1201
|
+
}
|
|
1130
1202
|
return errorMessage;
|
|
1131
1203
|
};
|
|
1132
1204
|
|
|
@@ -1190,7 +1262,7 @@ export const Whatsapp = (props) => {
|
|
|
1190
1262
|
}
|
|
1191
1263
|
//campaigns edit flow + unsubscribeNotRequired
|
|
1192
1264
|
return updatedSmsEditor.join('');
|
|
1193
|
-
} else if (unsubscribeRequired) {
|
|
1265
|
+
} else if (unsubscribeRequired && !isAuthenticationTemplate) {
|
|
1194
1266
|
//creatives create and edit flow + unsubscribeRequired
|
|
1195
1267
|
return `${templateMessage}\n${formatMessage(
|
|
1196
1268
|
messages.modifiedUnsubscribeText,
|
|
@@ -1299,7 +1371,9 @@ export const Whatsapp = (props) => {
|
|
|
1299
1371
|
},
|
|
1300
1372
|
...(isEditFlow && !isFullMode && {
|
|
1301
1373
|
isPreviewUrl: showUrlPreview
|
|
1302
|
-
})
|
|
1374
|
+
}),
|
|
1375
|
+
securityRecommendation: unsubscribeRequired,
|
|
1376
|
+
codeExpiryMinutes: expiryMinutes,
|
|
1303
1377
|
},
|
|
1304
1378
|
},
|
|
1305
1379
|
},
|
|
@@ -1364,7 +1438,7 @@ export const Whatsapp = (props) => {
|
|
|
1364
1438
|
return true;
|
|
1365
1439
|
}
|
|
1366
1440
|
//if template message is not entered
|
|
1367
|
-
if (templateMessage
|
|
1441
|
+
if (templateMessage?.trim() === '' || templateMessageError) {
|
|
1368
1442
|
return true;
|
|
1369
1443
|
}
|
|
1370
1444
|
//if media type is image, video or document and the mediaType file is not uploaded
|
|
@@ -1391,6 +1465,9 @@ export const Whatsapp = (props) => {
|
|
|
1391
1465
|
return true;
|
|
1392
1466
|
}
|
|
1393
1467
|
|
|
1468
|
+
if(isAuthenticationTemplate && securityWarningReqd && !expiryMinutes){
|
|
1469
|
+
return true;
|
|
1470
|
+
}
|
|
1394
1471
|
if (isBtnTypeQuickReply) {
|
|
1395
1472
|
return !quickReplyData.every((quickReply) => quickReply?.isSaved === true);
|
|
1396
1473
|
}
|
|
@@ -1399,14 +1476,15 @@ export const Whatsapp = (props) => {
|
|
|
1399
1476
|
|
|
1400
1477
|
const renderMediaSection = () => (
|
|
1401
1478
|
<>
|
|
1402
|
-
{renderLabel('mediaLabel')}
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1479
|
+
{!isAuthenticationTemplate && <>{renderLabel('mediaLabel')}
|
|
1480
|
+
<CapRadioGroup
|
|
1481
|
+
id="whatsapp-media-radio"
|
|
1482
|
+
options={mediaRadioOptions}
|
|
1483
|
+
value={templateMediaType}
|
|
1484
|
+
onChange={onTemplateMediaTypeChange}
|
|
1485
|
+
className="whatsapp-media-radio"
|
|
1486
|
+
/>
|
|
1487
|
+
</>}
|
|
1410
1488
|
</>
|
|
1411
1489
|
);
|
|
1412
1490
|
|
|
@@ -1471,7 +1549,7 @@ export const Whatsapp = (props) => {
|
|
|
1471
1549
|
{renderMediaSection()}
|
|
1472
1550
|
{renderMediaComponent()}
|
|
1473
1551
|
{/* this section is for header section in create mode */}
|
|
1474
|
-
{isMediaTypeText && isHostIsNotTwilio && (
|
|
1552
|
+
{isMediaTypeText && isHostIsNotTwilio && !isAuthenticationTemplate && (
|
|
1475
1553
|
<>
|
|
1476
1554
|
<CapHeader
|
|
1477
1555
|
title={
|
|
@@ -1574,8 +1652,9 @@ export const Whatsapp = (props) => {
|
|
|
1574
1652
|
)
|
|
1575
1653
|
}
|
|
1576
1654
|
value={templateMessage || ""}
|
|
1655
|
+
disabled={isAuthenticationTemplate}
|
|
1577
1656
|
/>
|
|
1578
|
-
{renderUnsubscribeText()}
|
|
1657
|
+
{isAuthenticationTemplate ? renderExtraSecurityText() : renderUnsubscribeText()}
|
|
1579
1658
|
</CapRow>
|
|
1580
1659
|
{renderMessageLength(MESSAGE_TEXT)}
|
|
1581
1660
|
{/* this section if for footer in create mode */}
|
|
@@ -1601,6 +1680,36 @@ export const Whatsapp = (props) => {
|
|
|
1601
1680
|
}
|
|
1602
1681
|
/>
|
|
1603
1682
|
<CapRow className="whatsapp-create-template-message-input whatsapp-create-template-header-input">
|
|
1683
|
+
{isAuthenticationTemplate ?
|
|
1684
|
+
<CapRow className="whatsapp-extra-security-footer">
|
|
1685
|
+
<CapCheckbox
|
|
1686
|
+
onChange={extraSecurityFooter}
|
|
1687
|
+
checked={securityWarningReqd}
|
|
1688
|
+
disabled={isEditFlow}
|
|
1689
|
+
autoFocus={true}
|
|
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> :
|
|
1604
1713
|
<TextArea
|
|
1605
1714
|
id="whatsapp-create-template-message-input"
|
|
1606
1715
|
autosize={{ minRows: 1, maxRows: 5 }}
|
|
@@ -1614,7 +1723,9 @@ export const Whatsapp = (props) => {
|
|
|
1614
1723
|
)
|
|
1615
1724
|
}
|
|
1616
1725
|
value={templateFooter || ""}
|
|
1726
|
+
disabled={isAuthenticationTemplate}
|
|
1617
1727
|
/>
|
|
1728
|
+
}
|
|
1618
1729
|
</CapRow>
|
|
1619
1730
|
{renderMessageLength(FOOTER_TEXT)}
|
|
1620
1731
|
</>
|
|
@@ -1959,10 +2070,17 @@ export const Whatsapp = (props) => {
|
|
|
1959
2070
|
<CapLabel type="label15">
|
|
1960
2071
|
{isBtnTypeCta
|
|
1961
2072
|
? formatMessage(messages.btnTypeCTA)
|
|
1962
|
-
: formatMessage(messages.btnTypeNone)}
|
|
2073
|
+
: !isAuthenticationTemplate && formatMessage(messages.btnTypeNone)}
|
|
1963
2074
|
</CapLabel>
|
|
1964
2075
|
</>
|
|
1965
2076
|
)}
|
|
2077
|
+
{isAuthenticationTemplate && (
|
|
2078
|
+
<CapLabel type="label15">
|
|
2079
|
+
<CapWhatsappQuickReply
|
|
2080
|
+
authenticationFlow={true}
|
|
2081
|
+
/>
|
|
2082
|
+
</CapLabel>
|
|
2083
|
+
)}
|
|
1966
2084
|
{isBtnTypeCta && (
|
|
1967
2085
|
<CapWhatsappCTA
|
|
1968
2086
|
ctaData={ctaData}
|
|
@@ -1996,7 +2114,7 @@ export const Whatsapp = (props) => {
|
|
|
1996
2114
|
<CapLabel type="label5">
|
|
1997
2115
|
{isEditFlow ? updatedSmsEditor.join("") : templateMessage}
|
|
1998
2116
|
</CapLabel>
|
|
1999
|
-
{unsubscribeRequired && (
|
|
2117
|
+
{unsubscribeRequired && !isAuthenticationTemplate && (
|
|
2000
2118
|
<CapLabel type="label5">
|
|
2001
2119
|
{formatMessage(messages.templateMessageUnsubscribeText)}
|
|
2002
2120
|
</CapLabel>
|
|
@@ -2039,6 +2157,9 @@ export const Whatsapp = (props) => {
|
|
|
2039
2157
|
...(isBtnTypeCta && {
|
|
2040
2158
|
ctaData,
|
|
2041
2159
|
}),
|
|
2160
|
+
...(isAuthenticationTemplate && {
|
|
2161
|
+
ctaData : [{text: formatMessage(globalMessages.autofill)}]
|
|
2162
|
+
}),
|
|
2042
2163
|
...(isBtnTypeQuickReply && {
|
|
2043
2164
|
quickReplyData,
|
|
2044
2165
|
}),
|
|
@@ -204,4 +204,37 @@
|
|
|
204
204
|
font-size: $FONT_SIZE_M;
|
|
205
205
|
font-weight: $FONT_WEIGHT_MEDIUM;
|
|
206
206
|
}
|
|
207
|
+
.whatsapp-extra-security-footer {
|
|
208
|
+
margin-bottom: $CAP_SPACE_04;
|
|
209
|
+
display: flex;
|
|
210
|
+
justify-content: flex-start;
|
|
211
|
+
flex-direction: column;
|
|
212
|
+
padding-left: $CAP_SPACE_16;
|
|
213
|
+
gap: $CAP_SPACE_08;
|
|
214
|
+
|
|
215
|
+
.whatsapp-extra-security-footer-note {
|
|
216
|
+
margin-top: $CAP_SPACE_04;
|
|
217
|
+
display: inline-flex;
|
|
218
|
+
padding-left: $CAP_SPACE_12;
|
|
219
|
+
border-radius: $CAP_SPACE_04 0px 0px 0px;
|
|
220
|
+
background: $CAP_PURPLE04;
|
|
221
|
+
align-items: center;
|
|
222
|
+
justify-content: space-between;
|
|
223
|
+
margin-right: $CAP_SPACE_12;
|
|
224
|
+
|
|
225
|
+
.add-btn {
|
|
226
|
+
background-color: inherit;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.whatsapp-extra-security-footer-input {
|
|
231
|
+
display: inline-flex;
|
|
232
|
+
align-items: center;
|
|
233
|
+
gap: $CAP_SPACE_04;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.whatsapp-extra-security-footer-checkbox {
|
|
237
|
+
margin-right: auto;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
207
240
|
}
|