@capillarytech/creatives-library 7.10.39 → 7.10.40

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.
Files changed (37) hide show
  1. package/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +0 -2
  2. package/containers/Email/index.js +2 -3
  3. package/index.js +6 -0
  4. package/package.json +1 -1
  5. package/routes.js +5 -0
  6. package/services/api.js +6 -1
  7. package/v2Components/TemplatePreview/_templatePreview.scss +7 -0
  8. package/v2Components/TemplatePreview/assets/images/whatsapp_mobile_android.svg +2041 -0
  9. package/v2Components/TemplatePreview/index.js +57 -3
  10. package/v2Components/TemplatePreview/messages.js +8 -0
  11. package/v2Containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +0 -2
  12. package/v2Containers/Assets/images/whatsappIllustration.png +0 -0
  13. package/v2Containers/CreativesContainer/SlideBoxContent.js +24 -2
  14. package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -0
  15. package/v2Containers/CreativesContainer/constants.js +1 -0
  16. package/v2Containers/Email/index.js +1 -3
  17. package/v2Containers/Line/Container/index.js +1 -1
  18. package/v2Containers/Templates/_templates.scss +43 -0
  19. package/v2Containers/Templates/actions.js +18 -10
  20. package/v2Containers/Templates/constants.js +3 -1
  21. package/v2Containers/Templates/index.js +259 -43
  22. package/v2Containers/Templates/messages.js +32 -0
  23. package/v2Containers/Templates/reducer.js +2 -0
  24. package/v2Containers/TemplatesV2/index.js +2 -0
  25. package/v2Containers/TemplatesV2/messages.js +4 -0
  26. package/v2Containers/Whatsapp/actions.js +17 -0
  27. package/v2Containers/Whatsapp/constants.js +98 -0
  28. package/v2Containers/Whatsapp/index.js +469 -0
  29. package/v2Containers/Whatsapp/index.scss +36 -0
  30. package/v2Containers/Whatsapp/messages.js +184 -0
  31. package/v2Containers/Whatsapp/reducer.js +39 -0
  32. package/v2Containers/Whatsapp/sagas.js +48 -0
  33. package/v2Containers/Whatsapp/selectors.js +25 -0
  34. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +123185 -0
  35. package/v2Containers/Whatsapp/tests/index.test.js +132 -0
  36. package/v2Containers/Whatsapp/tests/mockData.js +10 -0
  37. package/v2Containers/Whatsapp/utils.js +106 -0
@@ -0,0 +1,17 @@
1
+ import {
2
+ WHATSAPP_TEMPLATE_CREATE_REQUEST,
3
+ CLEAR_WHATSAPP_TEMPLATE_REQUEST,
4
+ } from './constants';
5
+
6
+ export function createWhatsappTemplate(payload, callback) {
7
+ return {
8
+ type: WHATSAPP_TEMPLATE_CREATE_REQUEST,
9
+ payload,
10
+ callback,
11
+ };
12
+ }
13
+ export function clearCreateResponse() {
14
+ return {
15
+ type: CLEAR_WHATSAPP_TEMPLATE_REQUEST,
16
+ };
17
+ }
@@ -0,0 +1,98 @@
1
+ import React from 'react';
2
+ import { FormattedMessage } from 'react-intl';
3
+ import messages from './messages';
4
+ import { CAP_ORANGE, CAP_PURPLE02, CAP_PURPLE03, CAP_ORANGE01, CAP_GREEN01, CAP_GREEN02 } from '@capillarytech/cap-ui-library/styled/variables';
5
+
6
+ export const UNSUBSCRIBE_TEXT_LENGTH = 36;
7
+ export const TEMPLATE_MESSAGE_MAX_LENGTH = 1024;
8
+ export const WHATSAPP = 'WHATSAPP';
9
+
10
+ export const WHATSAPP_TEMPLATE_CREATE_REQUEST =
11
+ 'app/v2Containers/Whatsapp/WHATSAPP_TEMPLATE_CREATE_REQUEST';
12
+ export const WHATSAPP_TEMPLATE_CREATE_SUCCESS =
13
+ 'app/v2Containers/Whatsapp/WHATSAPP_TEMPLATE_CREATE_SUCCESS';
14
+ export const WHATSAPP_TEMPLATE_CREATE_FAILURE =
15
+ 'app/v2Containers/Whatsapp/WHATSAPP_TEMPLATE_CREATE_FAILURE';
16
+ export const CLEAR_WHATSAPP_TEMPLATE_REQUEST =
17
+ 'app/v2Containers/Whatsapp/CLEAR_WHATSAPP_TEMPLATE_REQUEST';
18
+
19
+ export const STATUS = 'status';
20
+ export const CATEGORY = 'category';
21
+ const tooltip = 'Tooltip';
22
+
23
+ export const WHATSAPP_CATEGORIES = {
24
+ alertUpdate: 'ALERT_UPDATE',
25
+ accountUpdate: 'ACCOUNT_UPDATE',
26
+ appointmentUpdate: 'APPOINTMENT_UPDATE',
27
+ paymentUpdate: 'PAYMENT_UPDATE',
28
+ reservationUpdate: 'RESERVATION_UPDATE',
29
+ };
30
+
31
+ export const CATEGORY_OPTIONS = [
32
+ {
33
+ key: 'alertUpdate',
34
+ value: WHATSAPP_CATEGORIES.alertUpdate,
35
+ label: <FormattedMessage {...messages.alertUpdate} />,
36
+ tooltipLabel: <FormattedMessage {...messages[`alertUpdate${tooltip}`]} />,
37
+ tagColor: CAP_PURPLE03,
38
+ tagTextColor: CAP_PURPLE02,
39
+ },
40
+ {
41
+ key: 'accountUpdate',
42
+ label: <FormattedMessage {...messages.accountUpdate} />,
43
+ tooltipLabel: <FormattedMessage {...messages[`accountUpdate${tooltip}`]} />,
44
+ value: WHATSAPP_CATEGORIES.alertUpdate,
45
+ tagColor: CAP_ORANGE01,
46
+ tagTextColor: CAP_ORANGE,
47
+ },
48
+ {
49
+ key: 'appointmentUpdate',
50
+ value: WHATSAPP_CATEGORIES.appointmentUpdate,
51
+ label: <FormattedMessage {...messages.appointmentUpdate} />,
52
+ tooltipLabel: <FormattedMessage {...messages[`appointmentUpdate${tooltip}`]} />,
53
+ tagColor: CAP_GREEN02,
54
+ tagTextColor: CAP_GREEN01,
55
+ },
56
+ {
57
+ key: 'paymentUpdate',
58
+ value: WHATSAPP_CATEGORIES.paymentUpdate,
59
+ label: <FormattedMessage {...messages.paymentUpdate} />,
60
+ tooltipLabel: <FormattedMessage {...messages[`paymentUpdate${tooltip}`]} />,
61
+ tagColor: CAP_ORANGE01,
62
+ tagTextColor: CAP_ORANGE,
63
+ },
64
+ {
65
+ key: 'reservationUpdate',
66
+ value: WHATSAPP_CATEGORIES.reservationUpdate,
67
+ label: <FormattedMessage {...messages.reservationUpdate} />,
68
+ tooltipLabel: <FormattedMessage {...messages[`reservationUpdate${tooltip}`]} />,
69
+ tagColor: CAP_ORANGE01,
70
+ tagTextColor: CAP_ORANGE,
71
+ },
72
+ ];
73
+
74
+ export const WHATSAPP_STATUSES = {
75
+ awaitingApproval: 'awaitingApproval',
76
+ approved: 'approved',
77
+ rejected: 'rejected',
78
+ pending: 'pending',
79
+ unsubmitted: 'unsubmitted',
80
+ };
81
+
82
+ export const STATUS_OPTIONS = [
83
+ {
84
+ key: 'awaitingApproval',
85
+ value: WHATSAPP_STATUSES.awaitingApproval,
86
+ label: <FormattedMessage {...messages.awaitingApproval} />,
87
+ },
88
+ {
89
+ key: 'approved',
90
+ value: WHATSAPP_STATUSES.approved,
91
+ label: <FormattedMessage {...messages.approved} />,
92
+ },
93
+ {
94
+ key: 'rejected',
95
+ value: WHATSAPP_STATUSES.rejected,
96
+ label: <FormattedMessage {...messages.rejected} />,
97
+ },
98
+ ];
@@ -0,0 +1,469 @@
1
+ /* eslint-disable no-undef */
2
+ import React, { useState } from 'react';
3
+ import { bindActionCreators } from 'redux';
4
+ import { createStructuredSelector } from 'reselect';
5
+ import { injectIntl, FormattedMessage } from 'react-intl';
6
+ import styled from 'styled-components';
7
+ import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
8
+ import CapRow from '@capillarytech/cap-ui-library/CapRow';
9
+ import CapColumn from '@capillarytech/cap-ui-library/CapColumn';
10
+ import CapHeader from '@capillarytech/cap-ui-library/CapHeader';
11
+ import CapTooltipWithInfo from '@capillarytech/cap-ui-library/CapTooltipWithInfo';
12
+ import CapInput from '@capillarytech/cap-ui-library/CapInput';
13
+ import CapSelect from '@capillarytech/cap-ui-library/CapSelect';
14
+ import CapHeading from '@capillarytech/cap-ui-library/CapHeading';
15
+ import CapRadioGroup from '@capillarytech/cap-ui-library/CapRadioGroup';
16
+ import CapTooltip from '@capillarytech/cap-ui-library/CapTooltip';
17
+ import CapError from '@capillarytech/cap-ui-library/CapError';
18
+ import CapButton from '@capillarytech/cap-ui-library/CapButton';
19
+ import CapNotification from '@capillarytech/cap-ui-library/CapNotification';
20
+ import {
21
+ CAP_SPACE_04,
22
+ CAP_SPACE_16,
23
+ CAP_SPACE_24,
24
+ CAP_SPACE_32,
25
+ CAP_WHITE,
26
+ } from '@capillarytech/cap-ui-library/styled/variables';
27
+ import {} from './selectors';
28
+ import * as WhatsappActions from './actions';
29
+ import './index.scss';
30
+ import {
31
+ UNSUBSCRIBE_TEXT_LENGTH,
32
+ TEMPLATE_MESSAGE_MAX_LENGTH,
33
+ WHATSAPP,
34
+ CATEGORY_OPTIONS,
35
+ } from './constants';
36
+ import messages from './messages';
37
+ import withCreatives from '../../hoc/withCreatives';
38
+ import TemplatePreview from '../../v2Components/TemplatePreview';
39
+
40
+ export const Whatsapp = (props) => {
41
+ const {
42
+ intl,
43
+ isFullMode,
44
+ handleClose,
45
+ location,
46
+ actions,
47
+ onCreateComplete,
48
+ selectedWeChatAccount = {},
49
+ } = props || {};
50
+ const { formatMessage } = intl;
51
+ const {
52
+ name: accountName = '',
53
+ configs: accountConfigs = {},
54
+ sourceAccountIdentifier: accountId = '',
55
+ } = selectedWeChatAccount;
56
+ const { accessToken = '' } = accountConfigs;
57
+ const { TextArea } = CapInput;
58
+ const [templateName, setTemplateName] = useState('');
59
+ const [templateNameError, setTemplateNameError] = useState(false);
60
+ const [templateCategory, setTemplateCategory] = useState(
61
+ formatMessage(messages.select),
62
+ );
63
+ const [templateMessage, setTemplateMessage] = useState('');
64
+ const [templateMessageError, setTemplateMessageError] = useState(false);
65
+ const [addedVarCount, setAddedVarCount] = useState(0);
66
+ const [spin, setSpin] = useState(false);
67
+
68
+ const StyledSelect = styled(CapSelect)`
69
+ margin-top: ${CAP_SPACE_16};
70
+ `;
71
+
72
+ const WhatsappFooter = styled.div`
73
+ background-color: ${CAP_WHITE};
74
+ position: fixed;
75
+ bottom: 0;
76
+ width: 100%;
77
+ margin-left: -32px;
78
+ padding: ${CAP_SPACE_32} ${CAP_SPACE_24};
79
+
80
+ .ant-btn {
81
+ margin-right: ${CAP_SPACE_16};
82
+ }
83
+ }
84
+ `;
85
+
86
+ const renderTemplateCategoryLabel = (tooltipLabel, title) => (
87
+ <CapRow>
88
+ <CapColumn span={23}>{title}</CapColumn>
89
+ <CapColumn span={1}>
90
+ <CapTooltipWithInfo
91
+ infoIconProps={{
92
+ style: { marginLeft: CAP_SPACE_16 },
93
+ }}
94
+ autoAdjustOverflow
95
+ placement="right"
96
+ title={tooltipLabel}
97
+ />
98
+ </CapColumn>
99
+ </CapRow>
100
+ );
101
+
102
+ const templateCategoryOptions = CATEGORY_OPTIONS.map((option) => ({
103
+ value: option.value,
104
+ label: renderTemplateCategoryLabel(option.tooltipLabel, option.label),
105
+ }));
106
+
107
+ const mediaRadioOptions = [
108
+ {
109
+ value: 'text',
110
+ label: formatMessage(messages.mediaTextMessage),
111
+ },
112
+ {
113
+ value: 'image',
114
+ label: (
115
+ <CapTooltip title={formatMessage(messages.disabledMediaTooltip)}>
116
+ {formatMessage(messages.mediaImage)}
117
+ </CapTooltip>
118
+ ),
119
+ disabled: true,
120
+ },
121
+ {
122
+ value: 'video',
123
+ label: (
124
+ <CapTooltip title={formatMessage(messages.disabledMediaTooltip)}>
125
+ {formatMessage(messages.mediaVideo)}
126
+ </CapTooltip>
127
+ ),
128
+ disabled: true,
129
+ },
130
+ ];
131
+
132
+ const onTemplateNameChange = ({ target: { value } }) => {
133
+ setTemplateName(value);
134
+ templateNameErrorHandler(value);
135
+ };
136
+
137
+ const templateNameErrorHandler = (value) => {
138
+ let errorMessage = false;
139
+ //regex to accept only lowercase alphanumeric characters and underscores
140
+ const templateNameRegex = /^[a-z0-9_]+$/;
141
+ if (value === '') {
142
+ errorMessage = formatMessage(messages.emptyTemplateNameErrorMessage);
143
+ } else if (!templateNameRegex.test(value)) {
144
+ errorMessage = formatMessage(messages.templateNameRegexErrorMessage);
145
+ }
146
+ setTemplateNameError(errorMessage);
147
+ };
148
+
149
+ const onTemplateCategoryChange = (value) => {
150
+ setTemplateCategory(value);
151
+ };
152
+ const renderHeading = (value) => (
153
+ <CapHeading type="h4" className="whatsapp-render-heading">
154
+ {formatMessage(messages[value])}
155
+ </CapHeading>
156
+ );
157
+
158
+ const onTemplateMessageChange = ({ target: { value } }) => {
159
+ const error = templateMessageErrorHandler(value);
160
+ setTemplateMessage(value);
161
+ setTemplateMessageError(error);
162
+ };
163
+
164
+ const templateMessageErrorHandler = (value) => {
165
+ let errorMessage = false;
166
+ if (value === '') {
167
+ errorMessage = formatMessage(messages.emptyTemplateMessageErrorMessage);
168
+ } else if (
169
+ UNSUBSCRIBE_TEXT_LENGTH + value?.length >
170
+ TEMPLATE_MESSAGE_MAX_LENGTH
171
+ ) {
172
+ errorMessage = formatMessage(messages.templateMessageLengthError);
173
+ } else {
174
+ const validVarRegex = /{{([1-9]|1[0-9])}}/g;
175
+ const validVarArr = value.match(validVarRegex) || [];
176
+ const validVarSet = [...new Set(validVarArr)];
177
+
178
+ const invalidVarRegex = /{{(.+?)}}/g;
179
+ const invalidVarArr = value.match(invalidVarRegex) || [];
180
+ const invalidVarSet = [...new Set(invalidVarArr)];
181
+
182
+ const spamVar = /}}[^a-zA-Z]*{{/g;
183
+
184
+ if (validVarArr?.length > 0 || invalidVarArr?.length > 0) {
185
+ if (validVarArr?.length !== validVarSet?.length) {
186
+ //checks for repetations like Hi {{1}}, offer for you {{1}}
187
+ errorMessage = formatMessage(messages.repetativeVars);
188
+ } else if (invalidVarSet?.length !== validVarSet?.length) {
189
+ //checks for invalid vars like Hi {{abcd}}, offer for you {{^_^}}
190
+ errorMessage = formatMessage(messages.unknownVars);
191
+ } else if (value.match(spamVar)?.length > 0) {
192
+ //checks for text between vars like Hi {{1}}{{2}}
193
+ errorMessage = formatMessage(messages.noContentBetweenVars);
194
+ } else {
195
+ //checks if vars are added sequentially like, Hi {{1}}, offer for you {{2}} today {{3}}
196
+ const checkSequence = [...validVarSet].filter(
197
+ (validVar, index) => `{{${index + 1}}}` !== validVar,
198
+ );
199
+ if (checkSequence?.length > 0) {
200
+ errorMessage = formatMessage(messages.sequenceVars);
201
+ } else {
202
+ setAddedVarCount(validVarSet?.length || 0);
203
+ }
204
+ }
205
+ }
206
+ }
207
+ return errorMessage;
208
+ };
209
+
210
+ const renderUnsubscribeText = () => (
211
+ <>
212
+ <CapColumn span={12}>
213
+ <CapTooltip
214
+ placement="bottom"
215
+ title={formatMessage(messages.unsubscribeTextTooltip)}
216
+ >
217
+ <CapHeading className="whatsapp-render-unsubscribe-text">
218
+ {formatMessage(messages.templateMessageUnsubscribeText)}
219
+ </CapHeading>
220
+ </CapTooltip>
221
+ </CapColumn>
222
+ <CapColumn span={12}></CapColumn>
223
+ </>
224
+ );
225
+
226
+ const renderMessageLength = () => (
227
+ <CapHeading type="h6" className="whatsapp-render-message-length">
228
+ {formatMessage(messages.templateMessageLength, {
229
+ currentLength: UNSUBSCRIBE_TEXT_LENGTH + templateMessage?.length,
230
+ maxLength: TEMPLATE_MESSAGE_MAX_LENGTH,
231
+ })}
232
+ </CapHeading>
233
+ );
234
+
235
+ const generateVarMapped = () => {
236
+ const varMappedObj = {};
237
+ const finalIndex = addedVarCount + 1;
238
+ for (let i = 1; i <= finalIndex; i += 1) {
239
+ if (i === addedVarCount + 1) {
240
+ varMappedObj[i] = '{{unsubscribe}}';
241
+ } else {
242
+ varMappedObj[i] = '';
243
+ }
244
+ }
245
+ return varMappedObj;
246
+ };
247
+
248
+ const createPayload = () => ({
249
+ name: templateName,
250
+ versions: {
251
+ base: {
252
+ content: {
253
+ whatsapp: {
254
+ category: templateCategory,
255
+ languages: [
256
+ {
257
+ language: 'en',
258
+ content: `$'${templateMessage}\nClick {{${
259
+ addedVarCount + 1
260
+ }}} to unsubscribe'`,
261
+ },
262
+ ],
263
+ mediaType: 'text',
264
+ 'var-mapped': generateVarMapped(),
265
+ accountId,
266
+ accessToken,
267
+ accountName,
268
+ },
269
+ },
270
+ },
271
+ },
272
+ type: WHATSAPP,
273
+ });
274
+
275
+ const actionCallback = ({ errorMessage, resp }) => {
276
+ const error = errorMessage?.message || errorMessage;
277
+ if (!error) {
278
+ CapNotification.success({
279
+ message: formatMessage(messages.whatsappCreateNotification, {
280
+ name: templateName,
281
+ }),
282
+ });
283
+ actions.clearCreateResponse();
284
+ } else {
285
+ CapNotification.error({
286
+ message: error,
287
+ });
288
+ }
289
+ };
290
+
291
+ const createApprovalHandler = () => {
292
+ setSpin(true);
293
+ actions.createWhatsappTemplate(createPayload(), (resp, errorMessage) => {
294
+ actionCallback({ resp, errorMessage });
295
+ if (!errorMessage) {
296
+ onCreateComplete();
297
+ } else {
298
+ setSpin(false);
299
+ }
300
+ });
301
+ };
302
+
303
+ const onDoneCallback = () => {
304
+ if (isFullMode) {
305
+ return createApprovalHandler;
306
+ }
307
+ };
308
+
309
+ const isDisableDone = () => {
310
+ //if template name is not entered
311
+ if (templateName.trim() === '' || templateNameError) {
312
+ return true;
313
+ }
314
+ //if template category is not selected
315
+ if (templateCategory === 'Select') {
316
+ return true;
317
+ }
318
+ //if template message is not entered
319
+ if (templateMessage.trim() === '' || templateMessageError) {
320
+ return true;
321
+ }
322
+ return false;
323
+ };
324
+
325
+ const getPreviewSection = () => {
326
+ const templateMsg = `${templateMessage}\n${formatMessage(
327
+ messages.templateMessageUnsubscribeText,
328
+ )}`;
329
+ return (
330
+ <TemplatePreview
331
+ channel={WHATSAPP}
332
+ content={{ templateMsg }}
333
+ whatsappAccountName={accountName}
334
+ />
335
+ );
336
+ };
337
+ return (
338
+ <CapSpin spinning={spin}>
339
+ <CapRow>
340
+ <CapColumn span={14}>
341
+ <CapInput
342
+ id={`whatsapp_template_name_input`}
343
+ onChange={onTemplateNameChange}
344
+ errorMessage={templateNameError}
345
+ placeholder={formatMessage(messages.templateNamePlaceholder)}
346
+ defaultValue={templateName || ''}
347
+ value={templateName || ''}
348
+ size="default"
349
+ label={
350
+ <CapHeader
351
+ title={
352
+ <>
353
+ {formatMessage(messages.templateNameLabel)}
354
+ <CapTooltipWithInfo
355
+ infoIconProps={{
356
+ style: { marginLeft: CAP_SPACE_04 },
357
+ }}
358
+ autoAdjustOverflow
359
+ title={
360
+ <FormattedMessage {...messages.templateNameTooltip} />
361
+ }
362
+ />
363
+ </>
364
+ }
365
+ description={formatMessage(messages.templateNameDesc)}
366
+ size="regular"
367
+ />
368
+ }
369
+ />
370
+ <StyledSelect
371
+ id={'select-whatsapp-category'}
372
+ label={formatMessage(messages.templateCategoryLabel)}
373
+ options={templateCategoryOptions || []}
374
+ onChange={onTemplateCategoryChange}
375
+ value={templateCategory}
376
+ />
377
+ {renderHeading('messageLanguageLabel')}
378
+ <CapInput
379
+ id={`whatsapp_template_language_input`}
380
+ defaultValue={'English'}
381
+ size="default"
382
+ disabled={true}
383
+ />
384
+ {renderHeading('mediaLabel')}
385
+ <CapRadioGroup
386
+ options={mediaRadioOptions || []}
387
+ defaultValue={'text'}
388
+ />
389
+ <CapHeading type="h4" className="whatsapp-render-heading">
390
+ <>
391
+ {formatMessage(messages.templateMessageLabel)}
392
+ <CapTooltipWithInfo
393
+ placement="right"
394
+ infoIconProps={{
395
+ style: { marginLeft: CAP_SPACE_04 },
396
+ }}
397
+ autoAdjustOverflow
398
+ title={
399
+ <FormattedMessage
400
+ {...messages.templateMessageTooltip}
401
+ values={{
402
+ br: <br />,
403
+ var: '{{1}}',
404
+ }}
405
+ />
406
+ }
407
+ />
408
+ </>
409
+ </CapHeading>
410
+ <CapRow className="whatsapp-template-message-input">
411
+ <TextArea
412
+ id={`whatsapp-template-message-input`}
413
+ autosize={{ minRows: 3, maxRows: 5 }}
414
+ placeholder={formatMessage(messages.templateMessagePlaceholder)}
415
+ onChange={onTemplateMessageChange}
416
+ errorMessage={
417
+ templateMessageError && (
418
+ <CapError className="whatsapp-template-message-error">
419
+ {templateMessageError}
420
+ </CapError>
421
+ )
422
+ }
423
+ value={templateMessage || ''}
424
+ />
425
+ {renderUnsubscribeText()}
426
+ </CapRow>
427
+ {renderMessageLength()}
428
+ <div className="whatsapp-scroll-div" />
429
+ </CapColumn>
430
+ <CapColumn span={6}>
431
+ <CapRow>
432
+ <CapColumn span={24} offset={9}>
433
+ {getPreviewSection()}
434
+ </CapColumn>
435
+ </CapRow>
436
+ </CapColumn>
437
+ </CapRow>
438
+ <WhatsappFooter>
439
+ <CapButton
440
+ onClick={onDoneCallback()}
441
+ disabled={isDisableDone()}
442
+ className="whatsapp-create-btn"
443
+ >
444
+ <FormattedMessage {...messages.sendForApprovalButtonLabel} />
445
+ </CapButton>
446
+ <CapButton
447
+ onClick={handleClose}
448
+ className="whatsapp-cancel-btn"
449
+ type="secondary"
450
+ >
451
+ <FormattedMessage {...messages.cancelButtonLabel} />
452
+ </CapButton>
453
+ </WhatsappFooter>
454
+ </CapSpin>
455
+ );
456
+ };
457
+
458
+ const mapStateToProps = createStructuredSelector({});
459
+
460
+ const mapDispatchToProps = (dispatch) => ({
461
+ actions: bindActionCreators(WhatsappActions, dispatch),
462
+ });
463
+
464
+ export default withCreatives({
465
+ WrappedComponent: injectIntl(Whatsapp),
466
+ mapStateToProps,
467
+ mapDispatchToProps,
468
+ userAuth: true,
469
+ });
@@ -0,0 +1,36 @@
1
+ @import '~@capillarytech/cap-ui-library/styles/_variables';
2
+
3
+ .whatsapp-render-heading {
4
+ margin-top: $CAP_SPACE_16;
5
+ margin-bottom: 6px;
6
+ }
7
+ .whatsapp-render-unsubscribe-text {
8
+ color: $FONT_COLOR_02;
9
+ margin: $CAP_SPACE_08 0px $CAP_SPACE_08 16px;
10
+ }
11
+ .whatsapp-render-message-length {
12
+ text-align: right;
13
+ }
14
+ .whatsapp-template-message-input {
15
+ background-color: $BG_01;
16
+ padding-top: $CAP_SPACE_16;
17
+ }
18
+ .whatsapp-template-message-error {
19
+ margin-left: $CAP_SPACE_16;
20
+ margin-right: $CAP_SPACE_16;
21
+ }
22
+ .whatsapp-scroll-div {
23
+ margin-bottom: 250px;
24
+ }
25
+ #whatsapp-template-message-input {
26
+ margin-left: $CAP_SPACE_16;
27
+ margin-right: $CAP_SPACE_16;
28
+ width: 95%;
29
+ }
30
+ #select-whatsapp-category {
31
+ width: 100%;
32
+ }
33
+
34
+ .whatsapp-category-tag {
35
+ margin-left: 8px;
36
+ }