@capillarytech/creatives-library 7.17.138 → 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/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/v2Components/TemplatePreview/index.js +3 -3
- package/v2Containers/Cap/messages.js +4 -0
- 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 +196 -56
- package/v2Containers/Whatsapp/index.scss +35 -0
- package/v2Containers/Whatsapp/messages.js +52 -0
- package/v2Containers/Whatsapp/styles.scss +5 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +3850 -1022
- package/v2Containers/Whatsapp/tests/index.test.js +4 -1
- package/v2Containers/Whatsapp/tests/utils.test.js +9 -2
- package/v2Containers/Whatsapp/utils.js +18 -0
- package/v2Containers/mockdata.js +11 -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,
|
|
@@ -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
|
);
|
|
@@ -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
|