@capillarytech/creatives-library 8.0.65-alpha.6 → 8.0.65

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.
@@ -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
  });