@capillarytech/creatives-library 8.0.68 → 8.0.69-alpha.1

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.68",
4
+ "version": "8.0.69-alpha.1",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -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,18 @@ import {
100
99
  import {MAX_WHATSAPP_TEMPLATES, WARNING_WHATSAPP_TEMPLATES , ACCOUNT_MAPPING_ON_CHANNEL} 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,
109
+ HOST_TWILIO,
110
+ TWILIO_CATEGORY_OPTIONS,
111
+ KARIX_GUPSHUP_CATEGORY_OPTIONS,
112
+ ICS_CATEGORY_OPTIONS,
113
+ HOST_ICS,
112
114
  } from '../Whatsapp/constants';
113
115
  import { INAPP_LAYOUT_DETAILS } from '../InApp/constants';
114
116
  import { ZALO_STATUS_OPTIONS, ZALO_STATUSES } from '../Zalo/constants';
@@ -1644,7 +1646,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1644
1646
  prepareWeChatPreviewData(template) {
1645
1647
  if (template && template.versions && template.versions.base && !isEmpty(template.versions.base)) {
1646
1648
  if (template.definition && template.definition.msgcontent && template.definition.msgcontent === "RICH_MEDIA_WECHAT") {
1647
- console.log("prepareWeChatPreviewData", template, JSON.stringify(template), template.versions.base.mediaList, JSON.stringify(template.versions.base.mediaList));
1648
1649
  return template.versions.base.mediaList;
1649
1650
  }
1650
1651
  return this.prepareWeChatMappedPreviewData(template.versions.base.content, template.versions.base.Tag, template.versions.base.data);
@@ -2950,6 +2951,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2950
2951
  }
2951
2952
  }
2952
2953
 
2954
+ const getCategoryOptions = (hostName) => {
2955
+ return CATEGORY_OPTIONS_MAP[hostName];
2956
+ };
2957
+
2953
2958
  const cmsTemplateSelectionContent = (
2954
2959
  <CardGrid
2955
2960
  className={""}
@@ -3058,8 +3063,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
3058
3063
  <CapSelectFilter
3059
3064
  placement="bottomLeft"
3060
3065
  data={this.state.hostName === HOST_TWILIO
3061
- ? TWILIO_CATEGORY_OPTIONS
3062
- : KARIX_GUPSHUP_CATEGORY_OPTIONS}
3066
+ ? TWILIO_CATEGORY_OPTIONS :
3067
+ this.state.hostName === HOST_ICS ? ICS_CATEGORY_OPTIONS: KARIX_GUPSHUP_CATEGORY_OPTIONS}
3063
3068
  onSelect={this.setWhatsappCategory}
3064
3069
  selectedValue={this.state.selectedWhatsappCategory}
3065
3070
  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
  });