@capillarytech/creatives-library 8.0.62 → 8.0.64-alpha.0
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/v2Containers/Templates/index.js +6 -8
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +72 -0
- package/v2Containers/Whatsapp/constants.js +39 -1
- package/v2Containers/Whatsapp/index.js +50 -13
- package/v2Containers/Whatsapp/index.scss +8 -0
- package/v2Containers/Whatsapp/messages.js +21 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +2600 -7738
- package/v2Containers/Whatsapp/tests/utils.test.js +9 -2
- package/v2Containers/Whatsapp/utils.js +13 -4
- package/v2Containers/mockdata.js +11 -0
package/package.json
CHANGED
|
@@ -21,7 +21,6 @@ import cloneDeep from 'lodash/cloneDeep';
|
|
|
21
21
|
import find from 'lodash/find';
|
|
22
22
|
import map from 'lodash/map';
|
|
23
23
|
import { bindActionCreators } from 'redux';
|
|
24
|
-
import { Modal, Form} from 'antd';
|
|
25
24
|
import {
|
|
26
25
|
CapMenu,
|
|
27
26
|
CapDropdown,
|
|
@@ -100,15 +99,13 @@ import {
|
|
|
100
99
|
import {MAX_WHATSAPP_TEMPLATES, WARNING_WHATSAPP_TEMPLATES } from './constants';
|
|
101
100
|
import { COPY_OF } from '../../containers/App/constants';
|
|
102
101
|
import {
|
|
103
|
-
TWILIO_CATEGORY_OPTIONS,
|
|
104
|
-
KARIX_GUPSHUP_CATEGORY_OPTIONS,
|
|
105
102
|
STATUS_OPTIONS,
|
|
106
103
|
CATEGORY,
|
|
107
104
|
WHATSAPP_CATEGORIES,
|
|
108
105
|
STATUS as WHATSAPP_STATUS,
|
|
109
106
|
WHATSAPP_STATUSES,
|
|
110
|
-
HOST_TWILIO,
|
|
111
107
|
HOST_GUPSHUP,
|
|
108
|
+
CATEGORY_OPTIONS_MAP,
|
|
112
109
|
} from '../Whatsapp/constants';
|
|
113
110
|
import { INAPP_LAYOUT_DETAILS } from '../InApp/constants';
|
|
114
111
|
import { ZALO_STATUS_OPTIONS, ZALO_STATUSES } from '../Zalo/constants';
|
|
@@ -1580,7 +1577,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1580
1577
|
prepareWeChatPreviewData(template) {
|
|
1581
1578
|
if (template && template.versions && template.versions.base && !isEmpty(template.versions.base)) {
|
|
1582
1579
|
if (template.definition && template.definition.msgcontent && template.definition.msgcontent === "RICH_MEDIA_WECHAT") {
|
|
1583
|
-
console.log("prepareWeChatPreviewData", template, JSON.stringify(template), template.versions.base.mediaList, JSON.stringify(template.versions.base.mediaList));
|
|
1584
1580
|
return template.versions.base.mediaList;
|
|
1585
1581
|
}
|
|
1586
1582
|
return this.prepareWeChatMappedPreviewData(template.versions.base.content, template.versions.base.Tag, template.versions.base.data);
|
|
@@ -2861,6 +2857,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2861
2857
|
}
|
|
2862
2858
|
}
|
|
2863
2859
|
|
|
2860
|
+
const getCategoryOptions = (hostName) => {
|
|
2861
|
+
return CATEGORY_OPTIONS_MAP[hostName];
|
|
2862
|
+
};
|
|
2863
|
+
|
|
2864
2864
|
const cmsTemplateSelectionContent = (
|
|
2865
2865
|
<CardGrid
|
|
2866
2866
|
className={""}
|
|
@@ -2965,9 +2965,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2965
2965
|
}
|
|
2966
2966
|
<CapSelectFilter
|
|
2967
2967
|
placement="bottomLeft"
|
|
2968
|
-
data={this.state.hostName
|
|
2969
|
-
? TWILIO_CATEGORY_OPTIONS
|
|
2970
|
-
: KARIX_GUPSHUP_CATEGORY_OPTIONS}
|
|
2968
|
+
data={getCategoryOptions(this.state.hostName)}
|
|
2971
2969
|
onSelect={this.setWhatsappCategory}
|
|
2972
2970
|
selectedValue={this.state.selectedWhatsappCategory}
|
|
2973
2971
|
placeholder="Category"
|
|
@@ -474,6 +474,24 @@ exports[`Test Templates container Should render temlates when whatsapp templates
|
|
|
474
474
|
/>,
|
|
475
475
|
"value": "rejected",
|
|
476
476
|
},
|
|
477
|
+
Object {
|
|
478
|
+
"key": "pending",
|
|
479
|
+
"label": <FormattedMessage
|
|
480
|
+
defaultMessage="Pending"
|
|
481
|
+
id="creatives.containersV2.Whatsapp.pending"
|
|
482
|
+
values={Object {}}
|
|
483
|
+
/>,
|
|
484
|
+
"value": "pending",
|
|
485
|
+
},
|
|
486
|
+
Object {
|
|
487
|
+
"key": "paused",
|
|
488
|
+
"label": <FormattedMessage
|
|
489
|
+
defaultMessage="Paused"
|
|
490
|
+
id="creatives.containersV2.Whatsapp.paused"
|
|
491
|
+
values={Object {}}
|
|
492
|
+
/>,
|
|
493
|
+
"value": "paused",
|
|
494
|
+
},
|
|
477
495
|
]
|
|
478
496
|
}
|
|
479
497
|
dropdownMaxHeight="320px"
|
|
@@ -833,6 +851,24 @@ exports[`Test Templates container Test max templates exceeded 1`] = `
|
|
|
833
851
|
/>,
|
|
834
852
|
"value": "rejected",
|
|
835
853
|
},
|
|
854
|
+
Object {
|
|
855
|
+
"key": "pending",
|
|
856
|
+
"label": <FormattedMessage
|
|
857
|
+
defaultMessage="Pending"
|
|
858
|
+
id="creatives.containersV2.Whatsapp.pending"
|
|
859
|
+
values={Object {}}
|
|
860
|
+
/>,
|
|
861
|
+
"value": "pending",
|
|
862
|
+
},
|
|
863
|
+
Object {
|
|
864
|
+
"key": "paused",
|
|
865
|
+
"label": <FormattedMessage
|
|
866
|
+
defaultMessage="Paused"
|
|
867
|
+
id="creatives.containersV2.Whatsapp.paused"
|
|
868
|
+
values={Object {}}
|
|
869
|
+
/>,
|
|
870
|
+
"value": "paused",
|
|
871
|
+
},
|
|
836
872
|
]
|
|
837
873
|
}
|
|
838
874
|
dropdownMaxHeight="320px"
|
|
@@ -1288,6 +1324,24 @@ exports[`Test Templates container Test max templates not exceeded 1`] = `
|
|
|
1288
1324
|
/>,
|
|
1289
1325
|
"value": "rejected",
|
|
1290
1326
|
},
|
|
1327
|
+
Object {
|
|
1328
|
+
"key": "pending",
|
|
1329
|
+
"label": <FormattedMessage
|
|
1330
|
+
defaultMessage="Pending"
|
|
1331
|
+
id="creatives.containersV2.Whatsapp.pending"
|
|
1332
|
+
values={Object {}}
|
|
1333
|
+
/>,
|
|
1334
|
+
"value": "pending",
|
|
1335
|
+
},
|
|
1336
|
+
Object {
|
|
1337
|
+
"key": "paused",
|
|
1338
|
+
"label": <FormattedMessage
|
|
1339
|
+
defaultMessage="Paused"
|
|
1340
|
+
id="creatives.containersV2.Whatsapp.paused"
|
|
1341
|
+
values={Object {}}
|
|
1342
|
+
/>,
|
|
1343
|
+
"value": "paused",
|
|
1344
|
+
},
|
|
1291
1345
|
]
|
|
1292
1346
|
}
|
|
1293
1347
|
dropdownMaxHeight="320px"
|
|
@@ -1725,6 +1779,24 @@ exports[`Test Templates container Test max templates warning 1`] = `
|
|
|
1725
1779
|
/>,
|
|
1726
1780
|
"value": "rejected",
|
|
1727
1781
|
},
|
|
1782
|
+
Object {
|
|
1783
|
+
"key": "pending",
|
|
1784
|
+
"label": <FormattedMessage
|
|
1785
|
+
defaultMessage="Pending"
|
|
1786
|
+
id="creatives.containersV2.Whatsapp.pending"
|
|
1787
|
+
values={Object {}}
|
|
1788
|
+
/>,
|
|
1789
|
+
"value": "pending",
|
|
1790
|
+
},
|
|
1791
|
+
Object {
|
|
1792
|
+
"key": "paused",
|
|
1793
|
+
"label": <FormattedMessage
|
|
1794
|
+
defaultMessage="Paused"
|
|
1795
|
+
id="creatives.containersV2.Whatsapp.paused"
|
|
1796
|
+
values={Object {}}
|
|
1797
|
+
/>,
|
|
1798
|
+
"value": "paused",
|
|
1799
|
+
},
|
|
1728
1800
|
]
|
|
1729
1801
|
}
|
|
1730
1802
|
dropdownMaxHeight="320px"
|
|
@@ -144,12 +144,32 @@ export const TWILIO_CATEGORY_OPTIONS = [
|
|
|
144
144
|
},
|
|
145
145
|
];
|
|
146
146
|
|
|
147
|
+
export const ICS_CATEGORY_OPTIONS = [
|
|
148
|
+
{
|
|
149
|
+
key: 'utility',
|
|
150
|
+
value: WHATSAPP_CATEGORIES.utility,
|
|
151
|
+
label: <FormattedMessage {...messages.utility} />,
|
|
152
|
+
tooltipLabel: <FormattedMessage {...messages.utilityTooltip} />,
|
|
153
|
+
tagColor: CAP_PURPLE03,
|
|
154
|
+
tagTextColor: CAP_PURPLE02,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
key: 'marketing',
|
|
158
|
+
value: WHATSAPP_CATEGORIES.marketing,
|
|
159
|
+
label: <FormattedMessage {...messages.marketing} />,
|
|
160
|
+
tooltipLabel: <FormattedMessage {...messages.marketingTooltip} />,
|
|
161
|
+
tagColor: CAP_ORANGE01,
|
|
162
|
+
tagTextColor: CAP_ORANGE,
|
|
163
|
+
},
|
|
164
|
+
];
|
|
165
|
+
|
|
147
166
|
export const WHATSAPP_STATUSES = {
|
|
148
167
|
awaitingApproval: 'awaitingApproval',
|
|
149
168
|
approved: 'approved',
|
|
150
169
|
rejected: 'rejected',
|
|
151
170
|
pending: 'pending',
|
|
152
171
|
unsubmitted: 'unsubmitted',
|
|
172
|
+
paused: 'paused',
|
|
153
173
|
};
|
|
154
174
|
|
|
155
175
|
export const STATUS_OPTIONS = [
|
|
@@ -168,6 +188,16 @@ export const STATUS_OPTIONS = [
|
|
|
168
188
|
value: WHATSAPP_STATUSES.rejected,
|
|
169
189
|
label: <FormattedMessage {...messages.rejected} />,
|
|
170
190
|
},
|
|
191
|
+
{
|
|
192
|
+
key: 'pending',
|
|
193
|
+
value: WHATSAPP_STATUSES.pending,
|
|
194
|
+
label: <FormattedMessage {...messages.pending} />,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
key: 'paused',
|
|
198
|
+
value: WHATSAPP_STATUSES.paused,
|
|
199
|
+
label: <FormattedMessage {...messages.paused} />,
|
|
200
|
+
},
|
|
171
201
|
];
|
|
172
202
|
|
|
173
203
|
export const TAG = 'TAG';
|
|
@@ -228,6 +258,7 @@ export const WHATSAPP_DOCUMENT_SIZE = 16000000; // 16MB
|
|
|
228
258
|
export const HOST_TWILIO = 'twiliowhatsapptrans';
|
|
229
259
|
export const HOST_KARIX = 'karixwhatsappbulk';
|
|
230
260
|
export const HOST_GUPSHUP = 'gupshupwhatsappbulk';
|
|
261
|
+
export const HOST_ICS = 'icswababulk';
|
|
231
262
|
export const SIZE_UNITS = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
232
263
|
export const DOCUMENT_FORMAT = 'PDF';
|
|
233
264
|
export const DOCUMENT_SIZE = '16 MB';
|
|
@@ -528,4 +559,11 @@ export const LANGUAGE_OPTIONS = [
|
|
|
528
559
|
];
|
|
529
560
|
|
|
530
561
|
export const OTP_CONFIG_URI = "/org/setup/configurations/OTPConfigurations";
|
|
531
|
-
export const AI_CONTENT_BOT_DISABLED = "AI_CONTENT_BOT_DISABLED";
|
|
562
|
+
export const AI_CONTENT_BOT_DISABLED = "AI_CONTENT_BOT_DISABLED";
|
|
563
|
+
export const CORRECT_TEMPLATE_FORMAT_URL = "https://developers.facebook.com/docs/whatsapp/updates-to-pricing/new-template-guidelines";
|
|
564
|
+
export const CATEGORY_OPTIONS_MAP = {
|
|
565
|
+
[HOST_TWILIO]: TWILIO_CATEGORY_OPTIONS,
|
|
566
|
+
[HOST_KARIX]: KARIX_GUPSHUP_CATEGORY_OPTIONS,
|
|
567
|
+
[HOST_GUPSHUP]: KARIX_GUPSHUP_CATEGORY_OPTIONS,
|
|
568
|
+
[HOST_ICS]: ICS_CATEGORY_OPTIONS,
|
|
569
|
+
};
|
|
@@ -29,7 +29,6 @@ import CapAskAira from '@capillarytech/cap-ui-library/CapAskAira';
|
|
|
29
29
|
import moment from 'moment';
|
|
30
30
|
|
|
31
31
|
import {
|
|
32
|
-
CAP_SPACE_04,
|
|
33
32
|
CAP_SPACE_16,
|
|
34
33
|
CAP_SPACE_24,
|
|
35
34
|
CAP_SPACE_32,
|
|
@@ -65,7 +64,6 @@ import {
|
|
|
65
64
|
ALLOWED_IMAGE_EXTENSIONS_REGEX,
|
|
66
65
|
WHATSAPP_IMG_SIZE,
|
|
67
66
|
HOST_TWILIO,
|
|
68
|
-
HOST_KARIX,
|
|
69
67
|
HOST_GUPSHUP,
|
|
70
68
|
ALLOWED_EXTENSIONS_VIDEO_REGEX,
|
|
71
69
|
ALLOWED_EXTENSIONS_DOCUMENT_REGEX,
|
|
@@ -81,7 +79,10 @@ import {
|
|
|
81
79
|
BUTTON_TEXT,
|
|
82
80
|
OTP_CONFIG_URI,
|
|
83
81
|
WHATSAPP_CATEGORIES,
|
|
84
|
-
AI_CONTENT_BOT_DISABLED
|
|
82
|
+
AI_CONTENT_BOT_DISABLED,
|
|
83
|
+
ICS_CATEGORY_OPTIONS,
|
|
84
|
+
CORRECT_TEMPLATE_FORMAT_URL,
|
|
85
|
+
CATEGORY_OPTIONS_MAP,
|
|
85
86
|
} from './constants';
|
|
86
87
|
import { DATE_DISPLAY_FORMAT, TIME_DISPLAY_FORMAT } from '../App/constants';
|
|
87
88
|
import messages from './messages';
|
|
@@ -672,6 +673,11 @@ export const Whatsapp = (props) => {
|
|
|
672
673
|
label: renderTemplateCategoryLabel(option.tooltipLabel, option.label),
|
|
673
674
|
}));
|
|
674
675
|
|
|
676
|
+
const icsCategoryOptions = ICS_CATEGORY_OPTIONS.map((option) => ({
|
|
677
|
+
value: option.value,
|
|
678
|
+
label: renderTemplateCategoryLabel(option.tooltipLabel, option.label),
|
|
679
|
+
}));
|
|
680
|
+
|
|
675
681
|
const mediaRadioOptions = [
|
|
676
682
|
{
|
|
677
683
|
value: WHATSAPP_MEDIA_TYPES.TEXT,
|
|
@@ -1126,6 +1132,10 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1126
1132
|
setTemplateCategory(value);
|
|
1127
1133
|
};
|
|
1128
1134
|
|
|
1135
|
+
const getCategoryOptions = (host) => {
|
|
1136
|
+
return CATEGORY_OPTIONS_MAP[host] || [];
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1129
1139
|
const onTemplateLanguageChange = (value) => {
|
|
1130
1140
|
setTemplateLanguage(value);
|
|
1131
1141
|
};
|
|
@@ -1534,11 +1544,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1534
1544
|
{renderLabel("templateCategoryLabel")}
|
|
1535
1545
|
<CapSelect
|
|
1536
1546
|
id="select-whatsapp-category"
|
|
1537
|
-
options={
|
|
1538
|
-
host === HOST_TWILIO
|
|
1539
|
-
? twilioCategoryOptions
|
|
1540
|
-
: karixGupshupCategoryOptions
|
|
1541
|
-
}
|
|
1547
|
+
options={getCategoryOptions(host)}
|
|
1542
1548
|
onChange={onTemplateCategoryChange}
|
|
1543
1549
|
value={templateCategory}
|
|
1544
1550
|
/>
|
|
@@ -1815,7 +1821,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1815
1821
|
};
|
|
1816
1822
|
|
|
1817
1823
|
const onClickIncorrectFormat = () => {
|
|
1818
|
-
window.open(
|
|
1824
|
+
window.open(CORRECT_TEMPLATE_FORMAT_URL, "_blank");
|
|
1819
1825
|
};
|
|
1820
1826
|
|
|
1821
1827
|
const getTemplateStatusType = () => {
|
|
@@ -1840,27 +1846,58 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1840
1846
|
case WHATSAPP_STATUSES.rejected:
|
|
1841
1847
|
return (
|
|
1842
1848
|
<>
|
|
1843
|
-
<CapLabel type="label2"
|
|
1849
|
+
<CapLabel type="label2" className='template-status-font'>
|
|
1844
1850
|
{formatMessage(messages.rejectedStatusMsg)}
|
|
1845
1851
|
</CapLabel>
|
|
1846
1852
|
<CapLabel
|
|
1847
1853
|
type="label2"
|
|
1848
|
-
|
|
1854
|
+
className='template-status-margin'
|
|
1855
|
+
>
|
|
1856
|
+
{computeTemplateRejectionReason()}
|
|
1857
|
+
</CapLabel>
|
|
1858
|
+
</>
|
|
1859
|
+
);
|
|
1860
|
+
case WHATSAPP_STATUSES.paused:
|
|
1861
|
+
return (
|
|
1862
|
+
<>
|
|
1863
|
+
<CapLabel type="label2" className='template-status-font'>
|
|
1864
|
+
{formatMessage(messages.pausedStatusMsg)}
|
|
1865
|
+
</CapLabel>
|
|
1866
|
+
<CapLabel
|
|
1867
|
+
type="label2"
|
|
1868
|
+
className='template-status-margin'
|
|
1849
1869
|
>
|
|
1850
1870
|
{computeTemplateRejectionReason()}
|
|
1851
1871
|
</CapLabel>
|
|
1852
1872
|
</>
|
|
1853
1873
|
);
|
|
1874
|
+
case WHATSAPP_STATUSES.pending:
|
|
1875
|
+
return (
|
|
1876
|
+
<>
|
|
1877
|
+
<CapLabel type="label2" className='template-status-font'>
|
|
1878
|
+
{formatMessage(messages.pendingStatusMsg)}
|
|
1879
|
+
</CapLabel>
|
|
1880
|
+
<CapLabel
|
|
1881
|
+
type="label2"
|
|
1882
|
+
className='template-status-margin'
|
|
1883
|
+
>
|
|
1884
|
+
{formatMessage(messages.pendingStatusDesc, {
|
|
1885
|
+
date: moment(templateDate).format(DATE_DISPLAY_FORMAT),
|
|
1886
|
+
time: moment(templateDate).format(TIME_DISPLAY_FORMAT),
|
|
1887
|
+
})}
|
|
1888
|
+
</CapLabel>
|
|
1889
|
+
</>
|
|
1890
|
+
);
|
|
1854
1891
|
default:
|
|
1855
1892
|
//all cases except approved and rejected, return awaiting approval
|
|
1856
1893
|
return (
|
|
1857
1894
|
<>
|
|
1858
|
-
<CapLabel type="label2"
|
|
1895
|
+
<CapLabel type="label2" className='template-status-font'>
|
|
1859
1896
|
{formatMessage(messages.awaitingStatusMsg)}
|
|
1860
1897
|
</CapLabel>
|
|
1861
1898
|
<CapLabel
|
|
1862
1899
|
type="label2"
|
|
1863
|
-
|
|
1900
|
+
className='template-status-margin'
|
|
1864
1901
|
>
|
|
1865
1902
|
{formatMessage(messages.awaitingStatusDesc, {
|
|
1866
1903
|
date: moment(templateDate).format(DATE_DISPLAY_FORMAT),
|
|
@@ -251,6 +251,10 @@ export default defineMessages({
|
|
|
251
251
|
id: `${prefix}.rejectedStatusMsg`,
|
|
252
252
|
defaultMessage: 'This template has been rejected',
|
|
253
253
|
},
|
|
254
|
+
pausedStatusMsg: {
|
|
255
|
+
id: `${prefix}.pausedStatusMsg`,
|
|
256
|
+
defaultMessage: 'This template has been paused',
|
|
257
|
+
},
|
|
254
258
|
tagContentMismatchError: {
|
|
255
259
|
id: `${prefix}.tagContentMismatchError`,
|
|
256
260
|
defaultMessage:
|
|
@@ -270,6 +274,15 @@ export default defineMessages({
|
|
|
270
274
|
id: `${prefix}.awaitingStatusMsg`,
|
|
271
275
|
defaultMessage: 'This template is awaiting approval',
|
|
272
276
|
},
|
|
277
|
+
pendingStatusMsg: {
|
|
278
|
+
id: `${prefix}.pendingStatusMsg`,
|
|
279
|
+
defaultMessage: 'This template has been pending for approval',
|
|
280
|
+
},
|
|
281
|
+
pendingStatusDesc: {
|
|
282
|
+
id: `${prefix}.pendingStatusDesc`,
|
|
283
|
+
defaultMessage:
|
|
284
|
+
'The template has been sent for approval at {date}, {time}. It takes up to 48 hrs to get approved.',
|
|
285
|
+
},
|
|
273
286
|
here: {
|
|
274
287
|
id: `${prefix}.here`,
|
|
275
288
|
defaultMessage: 'here',
|
|
@@ -716,4 +729,12 @@ export default defineMessages({
|
|
|
716
729
|
id: `${prefix}.checkExpiryTooltipDesc`,
|
|
717
730
|
defaultMessage: 'To check the configured expiry time that is same for all OTPs',
|
|
718
731
|
},
|
|
732
|
+
pending: {
|
|
733
|
+
id: `${prefix}.pending`,
|
|
734
|
+
defaultMessage: 'Pending',
|
|
735
|
+
},
|
|
736
|
+
paused: {
|
|
737
|
+
id: `${prefix}.paused`,
|
|
738
|
+
defaultMessage: 'Paused',
|
|
739
|
+
},
|
|
719
740
|
});
|