@capillarytech/creatives-library 8.0.71 → 8.0.73-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.71",
4
+ "version": "8.0.73-alpha.0",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/services/api.js CHANGED
@@ -2,12 +2,12 @@
2
2
  * Created by vivek on 3/5/17.
3
3
  */
4
4
  import 'whatwg-fetch';
5
+ import { GA, decompressJsonObject } from '@capillarytech/cap-ui-utils';
5
6
  import { loadItem, clearItem } from './localStorageApi';
6
7
  import config from '../config/app';
7
8
  import pathConfig from '../config/path';
8
9
  import getSchema from './getSchema';
9
10
  import * as API from '../utils/ApiCaller';
10
- import { GA, decompressJsonObject } from '@capillarytech/cap-ui-utils';
11
11
  import { addBaseToTemplate } from '../utils/commonUtils';
12
12
  import { EMAIL, SMS } from '../v2Containers/CreativesContainer/constants';
13
13
  let API_ENDPOINT = config.development.api_endpoint;
@@ -403,14 +403,20 @@ export const getCmsData = (cmsType, projectId, langId) => {
403
403
  return API.get(url);
404
404
  };
405
405
 
406
- export const getEdmTemplates = () => {
406
+ export const getEdmTemplates = async () => {
407
407
  const url = `${API_ENDPOINT}/templates/email/default`;
408
- return request(url, getAPICallObject('GET'));
408
+ const compressedEdmTemplates = await request(url, getAPICallObject('GET'));
409
+ const { response = '' } = compressedEdmTemplates || {};
410
+ const decompressedEdmTemplates = decompressJsonObject(response);
411
+ return { ...compressedEdmTemplates, response: addBaseToTemplate(decompressedEdmTemplates)};
409
412
  };
410
413
 
411
- export const getDefaultBeeTemplates = () => {
414
+ export const getDefaultBeeTemplates = async () => {
412
415
  const url = `${API_ENDPOINT}/templates/v2/email/default`;
413
- return request(url, getAPICallObject('GET'));
416
+ const compressedDefaultBeeTemplates = await request(url, getAPICallObject('GET'));
417
+ const { response = '' } = compressedDefaultBeeTemplates || {};
418
+ const decompressedEdmTemplates = decompressJsonObject(response);
419
+ return { ...compressedDefaultBeeTemplates, response: addBaseToTemplate(decompressedEdmTemplates)};
414
420
  };
415
421
 
416
422
  // All about line
@@ -199,9 +199,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
199
199
  this.setState({isDragDrop: true});
200
200
  }
201
201
  if (this.props.params.id) {
202
- this.props.actions.getCmsSetting(BEE_PLUGIN, this.props.Templates.BEETemplate._id, 'open', undefined, isBEESupport, isBEEAppEnable);
202
+ this.props.actions.getCmsSetting(BEE_PLUGIN, this.props.Templates.BEETemplate.versions.base.drag_drop_id, 'open', undefined, isBEESupport, isBEEAppEnable);
203
203
  } else if (this.props.location.query.module !== "library" || (this.props.location.query.module === "library" && !this.props.templateData)) {
204
- this.props.actions.getCmsSetting(BEE_PLUGIN, this.props.Templates.BEETemplate._id, 'create', undefined, isBEESupport, isBEEAppEnable);
204
+ this.props.actions.getCmsSetting(BEE_PLUGIN, this.props.Templates.BEETemplate.versions.base.drag_drop_id, 'create', undefined, isBEESupport, isBEEAppEnable);
205
205
  }
206
206
  }
207
207
  this.setState({ content: (this.props.Templates.selectedEmailLayout ? this.props.Templates.selectedEmailLayout : ''), formData});
@@ -22,7 +22,6 @@ import cloneDeep from 'lodash/cloneDeep';
22
22
  import find from 'lodash/find';
23
23
  import map from 'lodash/map';
24
24
  import { bindActionCreators } from 'redux';
25
- import { Modal, Form} from 'antd';
26
25
  import {
27
26
  CapMenu,
28
27
  CapDropdown,
@@ -102,15 +101,18 @@ import {
102
101
  import {MAX_WHATSAPP_TEMPLATES, WARNING_WHATSAPP_TEMPLATES , ACCOUNT_MAPPING_ON_CHANNEL} from './constants';
103
102
  import { COPY_OF } from '../../containers/App/constants';
104
103
  import {
105
- TWILIO_CATEGORY_OPTIONS,
106
- KARIX_GUPSHUP_CATEGORY_OPTIONS,
107
104
  STATUS_OPTIONS,
108
105
  CATEGORY,
109
106
  WHATSAPP_CATEGORIES,
110
107
  STATUS as WHATSAPP_STATUS,
111
108
  WHATSAPP_STATUSES,
112
- HOST_TWILIO,
113
109
  HOST_GUPSHUP,
110
+ CATEGORY_OPTIONS_MAP,
111
+ HOST_TWILIO,
112
+ TWILIO_CATEGORY_OPTIONS,
113
+ KARIX_GUPSHUP_CATEGORY_OPTIONS,
114
+ ICS_CATEGORY_OPTIONS,
115
+ HOST_ICS,
114
116
  } from '../Whatsapp/constants';
115
117
  import { INAPP_LAYOUT_DETAILS } from '../InApp/constants';
116
118
  import { ZALO_STATUS_OPTIONS, ZALO_STATUSES } from '../Zalo/constants';
@@ -2967,6 +2969,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2967
2969
  }
2968
2970
  }
2969
2971
 
2972
+ const getCategoryOptions = (hostName) => {
2973
+ return CATEGORY_OPTIONS_MAP[hostName];
2974
+ };
2975
+
2970
2976
  const cmsTemplateSelectionContent = (
2971
2977
  <CardGrid
2972
2978
  className={""}
@@ -3074,9 +3080,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
3074
3080
  {this.state?.hostName ? (
3075
3081
  <CapSelectFilter
3076
3082
  placement="bottomLeft"
3077
- data={this.state.hostName === HOST_TWILIO
3078
- ? TWILIO_CATEGORY_OPTIONS
3079
- : KARIX_GUPSHUP_CATEGORY_OPTIONS}
3083
+ data = {CATEGORY_OPTIONS_MAP[this.state.hostName]}
3080
3084
  onSelect={this.setWhatsappCategory}
3081
3085
  selectedValue={this.state.selectedWhatsappCategory}
3082
3086
  placeholder="Category"
@@ -560,6 +560,24 @@ exports[`Test Templates container Should render temlates when whatsapp templates
560
560
  />,
561
561
  "value": "rejected",
562
562
  },
563
+ Object {
564
+ "key": "pending",
565
+ "label": <FormattedMessage
566
+ defaultMessage="Pending"
567
+ id="creatives.containersV2.Whatsapp.pending"
568
+ values={Object {}}
569
+ />,
570
+ "value": "pending",
571
+ },
572
+ Object {
573
+ "key": "paused",
574
+ "label": <FormattedMessage
575
+ defaultMessage="Paused"
576
+ id="creatives.containersV2.Whatsapp.paused"
577
+ values={Object {}}
578
+ />,
579
+ "value": "paused",
580
+ },
563
581
  ]
564
582
  }
565
583
  dropdownMaxHeight="320px"
@@ -943,6 +961,24 @@ exports[`Test Templates container Test max templates exceeded 1`] = `
943
961
  />,
944
962
  "value": "rejected",
945
963
  },
964
+ Object {
965
+ "key": "pending",
966
+ "label": <FormattedMessage
967
+ defaultMessage="Pending"
968
+ id="creatives.containersV2.Whatsapp.pending"
969
+ values={Object {}}
970
+ />,
971
+ "value": "pending",
972
+ },
973
+ Object {
974
+ "key": "paused",
975
+ "label": <FormattedMessage
976
+ defaultMessage="Paused"
977
+ id="creatives.containersV2.Whatsapp.paused"
978
+ values={Object {}}
979
+ />,
980
+ "value": "paused",
981
+ },
946
982
  ]
947
983
  }
948
984
  dropdownMaxHeight="320px"
@@ -1422,6 +1458,24 @@ exports[`Test Templates container Test max templates not exceeded 1`] = `
1422
1458
  />,
1423
1459
  "value": "rejected",
1424
1460
  },
1461
+ Object {
1462
+ "key": "pending",
1463
+ "label": <FormattedMessage
1464
+ defaultMessage="Pending"
1465
+ id="creatives.containersV2.Whatsapp.pending"
1466
+ values={Object {}}
1467
+ />,
1468
+ "value": "pending",
1469
+ },
1470
+ Object {
1471
+ "key": "paused",
1472
+ "label": <FormattedMessage
1473
+ defaultMessage="Paused"
1474
+ id="creatives.containersV2.Whatsapp.paused"
1475
+ values={Object {}}
1476
+ />,
1477
+ "value": "paused",
1478
+ },
1425
1479
  ]
1426
1480
  }
1427
1481
  dropdownMaxHeight="320px"
@@ -1883,6 +1937,24 @@ exports[`Test Templates container Test max templates warning 1`] = `
1883
1937
  />,
1884
1938
  "value": "rejected",
1885
1939
  },
1940
+ Object {
1941
+ "key": "pending",
1942
+ "label": <FormattedMessage
1943
+ defaultMessage="Pending"
1944
+ id="creatives.containersV2.Whatsapp.pending"
1945
+ values={Object {}}
1946
+ />,
1947
+ "value": "pending",
1948
+ },
1949
+ Object {
1950
+ "key": "paused",
1951
+ "label": <FormattedMessage
1952
+ defaultMessage="Paused"
1953
+ id="creatives.containersV2.Whatsapp.paused"
1954
+ values={Object {}}
1955
+ />,
1956
+ "value": "paused",
1957
+ },
1886
1958
  ]
1887
1959
  }
1888
1960
  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('https://developers.facebook.com/docs/whatsapp/updates-to-pricing/new-template-guidelines', "_blank");
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" style={{ fontWeight: 500 }}>
1849
+ <CapLabel type="label2" className='template-status-font'>
1844
1850
  {formatMessage(messages.rejectedStatusMsg)}
1845
1851
  </CapLabel>
1846
1852
  <CapLabel
1847
1853
  type="label2"
1848
- style={{ margin: `${CAP_SPACE_04} 0 ${CAP_SPACE_04}` }}
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" style={{ fontWeight: 500 }}>
1895
+ <CapLabel type="label2" className='template-status-font'>
1859
1896
  {formatMessage(messages.awaitingStatusMsg)}
1860
1897
  </CapLabel>
1861
1898
  <CapLabel
1862
1899
  type="label2"
1863
- style={{ margin: `${CAP_SPACE_04} 0 ${CAP_SPACE_04}` }}
1900
+ className='template-status-margin'
1864
1901
  >
1865
1902
  {formatMessage(messages.awaitingStatusDesc, {
1866
1903
  date: moment(templateDate).format(DATE_DISPLAY_FORMAT),
@@ -247,4 +247,12 @@
247
247
  }
248
248
  .whatsapp-tooltip-header{
249
249
  color: $CAP_G10;
250
+ }
251
+
252
+ .template-status-font{
253
+ font-weight: 500;
254
+ }
255
+
256
+ .template-status-margin{
257
+ margin: $CAP_SPACE_04 0 $CAP_SPACE_04;
250
258
  }
@@ -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
  });