@capillarytech/creatives-library 9.0.37-alpha.0 → 9.0.37

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 (29) hide show
  1. package/package.json +1 -1
  2. package/translations/en.json +2 -2
  3. package/v2Components/AccessForbidden/index.js +3 -5
  4. package/v2Components/AccessForbidden/messages.js +2 -3
  5. package/v2Containers/App/constants.js +0 -5
  6. package/v2Containers/Assets/Gallery/_gallery.scss +0 -6
  7. package/v2Containers/Assets/Gallery/index.js +10 -34
  8. package/v2Containers/Cap/index.js +2 -5
  9. package/v2Containers/Cap/messages.js +0 -4
  10. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +2 -2
  11. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +6 -6
  12. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +4 -4
  13. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +32 -32
  14. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +36 -36
  15. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +118 -118
  16. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +8 -8
  17. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +18 -18
  18. package/v2Containers/Templates/ChannelTypeIllustration.js +1 -10
  19. package/v2Containers/Templates/_templates.scss +0 -6
  20. package/v2Containers/Templates/index.js +100 -141
  21. package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +0 -7
  22. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +120 -173
  23. package/v2Containers/TemplatesV2/index.js +5 -16
  24. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +268 -268
  25. package/utils/permissions.js +0 -59
  26. package/utils/tests/permissions.test.js +0 -116
  27. package/v2Components/AccessForbidden/_accessForbidden.scss +0 -14
  28. package/v2Components/NoPermissionWrapper/_noPermissionWrapper.scss +0 -12
  29. package/v2Components/NoPermissionWrapper/index.js +0 -26
@@ -236,18 +236,15 @@ exports[`Test Templates container Should render sms illustration when no templat
236
236
  <div
237
237
  className="action-container__create-row"
238
238
  >
239
- <NoPermissionWrapper
240
- allowed={false}
239
+ <CapButton
240
+ className="create-new-sms margin-l-8 margin-b-12"
241
+ disabled={false}
242
+ isAddBtn={true}
243
+ onClick={[Function]}
244
+ type="primary"
241
245
  >
242
- <CapButton
243
- className="create-new-sms margin-l-8 margin-b-12"
244
- disabled={false}
245
- onClick={[Function]}
246
- type="primary"
247
- >
248
- Create new
249
- </CapButton>
250
- </NoPermissionWrapper>
246
+ Create new
247
+ </CapButton>
251
248
  </div>
252
249
  </div>
253
250
  </div>
@@ -255,7 +252,6 @@ exports[`Test Templates container Should render sms illustration when no templat
255
252
  </CapRow>
256
253
  <div>
257
254
  <ChannelTypeIllustration
258
- canCreate={false}
259
255
  createTemplate={[Function]}
260
256
  currentChannel="SMS"
261
257
  hostName=""
@@ -508,21 +504,17 @@ exports[`Test Templates container Should render temlates when whatsapp templates
508
504
  <div
509
505
  className="action-container__create-row"
510
506
  >
511
- <NoPermissionWrapper
512
- allowed={false}
513
- >
514
- <CapLink
515
- className="create-new-link"
516
- onClick={[Function]}
517
- suffix={
518
- <CapIcon
519
- size="s"
520
- type="open-in-new"
521
- />
522
- }
523
- title="Create new template"
524
- />
525
- </NoPermissionWrapper>
507
+ <CapLink
508
+ className="create-new-link"
509
+ onClick={[Function]}
510
+ suffix={
511
+ <CapIcon
512
+ size="s"
513
+ type="open-in-new"
514
+ />
515
+ }
516
+ title="Create new template"
517
+ />
526
518
  </div>
527
519
  </div>
528
520
  </div>
@@ -819,18 +811,15 @@ exports[`Test Templates container Should render temlates when whatsapp templates
819
811
  <div
820
812
  className="action-container__create-row"
821
813
  >
822
- <NoPermissionWrapper
823
- allowed={false}
814
+ <CapButton
815
+ className="create-new-whatsapp margin-l-8 margin-b-12"
816
+ disabled={false}
817
+ isAddBtn={true}
818
+ onClick={[Function]}
819
+ type="primary"
824
820
  >
825
- <CapButton
826
- className="create-new-whatsapp margin-l-8 margin-b-12"
827
- disabled={false}
828
- onClick={[Function]}
829
- type="primary"
830
- >
831
- Create new
832
- </CapButton>
833
- </NoPermissionWrapper>
821
+ Create new
822
+ </CapButton>
834
823
  </div>
835
824
  </div>
836
825
  </div>
@@ -1233,18 +1222,15 @@ exports[`Test Templates container Test max templates exceeded 1`] = `
1233
1222
  <div
1234
1223
  className="action-container__create-row"
1235
1224
  >
1236
- <NoPermissionWrapper
1237
- allowed={false}
1225
+ <CapButton
1226
+ className="create-new-whatsapp margin-l-8 margin-b-12"
1227
+ disabled={false}
1228
+ isAddBtn={true}
1229
+ onClick={[Function]}
1230
+ type="primary"
1238
1231
  >
1239
- <CapButton
1240
- className="create-new-whatsapp margin-l-8 margin-b-12"
1241
- disabled={false}
1242
- onClick={[Function]}
1243
- type="primary"
1244
- >
1245
- Create new
1246
- </CapButton>
1247
- </NoPermissionWrapper>
1232
+ Create new
1233
+ </CapButton>
1248
1234
  </div>
1249
1235
  </div>
1250
1236
  </div>
@@ -1341,26 +1327,14 @@ Click {{unsubscribe}} to unsubscribe
1341
1327
  overlay={
1342
1328
  <CapMenuComponent>
1343
1329
  <withItemHOC
1344
- className="delete-whatsapp rbac-disabled"
1330
+ className="delete-whatsapp"
1345
1331
  onClick={[Function]}
1346
1332
  >
1347
- <CapTooltip
1348
- title={
1349
- <FormattedMessage
1350
- defaultMessage="You don't have permission to perform this action."
1351
- id="creatives.componentsV2.noPermissionAction"
1352
- values={Object {}}
1353
- />
1354
- }
1355
- >
1356
- <span>
1357
- <FormattedMessage
1358
- defaultMessage="Delete"
1359
- id="creatives.containersV2.Templates.deleteButton"
1360
- values={Object {}}
1361
- />
1362
- </span>
1363
- </CapTooltip>
1333
+ <FormattedMessage
1334
+ defaultMessage="Delete"
1335
+ id="creatives.containersV2.Templates.deleteButton"
1336
+ values={Object {}}
1337
+ />
1364
1338
  </withItemHOC>
1365
1339
  </CapMenuComponent>
1366
1340
  }
@@ -1370,7 +1344,12 @@ Click {{unsubscribe}} to unsubscribe
1370
1344
  />
1371
1345
  </CapDropdownComponent>,
1372
1346
  ],
1373
- "hoverOption": null,
1347
+ "hoverOption": <CapButton
1348
+ className="edit-whatsapp"
1349
+ onClick={[Function]}
1350
+ >
1351
+ Overview
1352
+ </CapButton>,
1374
1353
  "key": "WHATSAPP-card-creatives_whatsapp6",
1375
1354
  "title": <CapRow
1376
1355
  align="middle"
@@ -1717,18 +1696,15 @@ exports[`Test Templates container Test max templates not exceeded 1`] = `
1717
1696
  <div
1718
1697
  className="action-container__create-row"
1719
1698
  >
1720
- <NoPermissionWrapper
1721
- allowed={false}
1699
+ <CapButton
1700
+ className="create-new-whatsapp margin-l-8 margin-b-12"
1701
+ disabled={false}
1702
+ isAddBtn={true}
1703
+ onClick={[Function]}
1704
+ type="primary"
1722
1705
  >
1723
- <CapButton
1724
- className="create-new-whatsapp margin-l-8 margin-b-12"
1725
- disabled={false}
1726
- onClick={[Function]}
1727
- type="primary"
1728
- >
1729
- Create new
1730
- </CapButton>
1731
- </NoPermissionWrapper>
1706
+ Create new
1707
+ </CapButton>
1732
1708
  </div>
1733
1709
  </div>
1734
1710
  </div>
@@ -1825,26 +1801,14 @@ Click {{unsubscribe}} to unsubscribe
1825
1801
  overlay={
1826
1802
  <CapMenuComponent>
1827
1803
  <withItemHOC
1828
- className="delete-whatsapp rbac-disabled"
1804
+ className="delete-whatsapp"
1829
1805
  onClick={[Function]}
1830
1806
  >
1831
- <CapTooltip
1832
- title={
1833
- <FormattedMessage
1834
- defaultMessage="You don't have permission to perform this action."
1835
- id="creatives.componentsV2.noPermissionAction"
1836
- values={Object {}}
1837
- />
1838
- }
1839
- >
1840
- <span>
1841
- <FormattedMessage
1842
- defaultMessage="Delete"
1843
- id="creatives.containersV2.Templates.deleteButton"
1844
- values={Object {}}
1845
- />
1846
- </span>
1847
- </CapTooltip>
1807
+ <FormattedMessage
1808
+ defaultMessage="Delete"
1809
+ id="creatives.containersV2.Templates.deleteButton"
1810
+ values={Object {}}
1811
+ />
1848
1812
  </withItemHOC>
1849
1813
  </CapMenuComponent>
1850
1814
  }
@@ -1854,7 +1818,12 @@ Click {{unsubscribe}} to unsubscribe
1854
1818
  />
1855
1819
  </CapDropdownComponent>,
1856
1820
  ],
1857
- "hoverOption": null,
1821
+ "hoverOption": <CapButton
1822
+ className="edit-whatsapp"
1823
+ onClick={[Function]}
1824
+ >
1825
+ Overview
1826
+ </CapButton>,
1858
1827
  "key": "WHATSAPP-card-creatives_whatsapp6",
1859
1828
  "title": <CapRow
1860
1829
  align="middle"
@@ -2201,18 +2170,15 @@ exports[`Test Templates container Test max templates warning 1`] = `
2201
2170
  <div
2202
2171
  className="action-container__create-row"
2203
2172
  >
2204
- <NoPermissionWrapper
2205
- allowed={false}
2173
+ <CapButton
2174
+ className="create-new-whatsapp margin-l-8 margin-b-12"
2175
+ disabled={false}
2176
+ isAddBtn={true}
2177
+ onClick={[Function]}
2178
+ type="primary"
2206
2179
  >
2207
- <CapButton
2208
- className="create-new-whatsapp margin-l-8 margin-b-12"
2209
- disabled={false}
2210
- onClick={[Function]}
2211
- type="primary"
2212
- >
2213
- Create new
2214
- </CapButton>
2215
- </NoPermissionWrapper>
2180
+ Create new
2181
+ </CapButton>
2216
2182
  </div>
2217
2183
  </div>
2218
2184
  </div>
@@ -2309,26 +2275,14 @@ Click {{unsubscribe}} to unsubscribe
2309
2275
  overlay={
2310
2276
  <CapMenuComponent>
2311
2277
  <withItemHOC
2312
- className="delete-whatsapp rbac-disabled"
2278
+ className="delete-whatsapp"
2313
2279
  onClick={[Function]}
2314
2280
  >
2315
- <CapTooltip
2316
- title={
2317
- <FormattedMessage
2318
- defaultMessage="You don't have permission to perform this action."
2319
- id="creatives.componentsV2.noPermissionAction"
2320
- values={Object {}}
2321
- />
2322
- }
2323
- >
2324
- <span>
2325
- <FormattedMessage
2326
- defaultMessage="Delete"
2327
- id="creatives.containersV2.Templates.deleteButton"
2328
- values={Object {}}
2329
- />
2330
- </span>
2331
- </CapTooltip>
2281
+ <FormattedMessage
2282
+ defaultMessage="Delete"
2283
+ id="creatives.containersV2.Templates.deleteButton"
2284
+ values={Object {}}
2285
+ />
2332
2286
  </withItemHOC>
2333
2287
  </CapMenuComponent>
2334
2288
  }
@@ -2338,7 +2292,12 @@ Click {{unsubscribe}} to unsubscribe
2338
2292
  />
2339
2293
  </CapDropdownComponent>,
2340
2294
  ],
2341
- "hoverOption": null,
2295
+ "hoverOption": <CapButton
2296
+ className="edit-whatsapp"
2297
+ onClick={[Function]}
2298
+ >
2299
+ Overview
2300
+ </CapButton>,
2342
2301
  "key": "WHATSAPP-card-creatives_whatsapp6",
2343
2302
  "title": <CapRow
2344
2303
  align="middle"
@@ -2628,21 +2587,17 @@ exports[`Test Templates container Test removing all whatsapp filterss 1`] = `
2628
2587
  <div
2629
2588
  className="action-container__create-row"
2630
2589
  >
2631
- <NoPermissionWrapper
2632
- allowed={false}
2633
- >
2634
- <CapLink
2635
- className="create-new-link"
2636
- onClick={[Function]}
2637
- suffix={
2638
- <CapIcon
2639
- size="s"
2640
- type="open-in-new"
2641
- />
2642
- }
2643
- title="Create new template"
2644
- />
2645
- </NoPermissionWrapper>
2590
+ <CapLink
2591
+ className="create-new-link"
2592
+ onClick={[Function]}
2593
+ suffix={
2594
+ <CapIcon
2595
+ size="s"
2596
+ type="open-in-new"
2597
+ />
2598
+ }
2599
+ title="Create new template"
2600
+ />
2646
2601
  </div>
2647
2602
  </div>
2648
2603
  </div>
@@ -2907,21 +2862,17 @@ exports[`Test Templates container Test removing all whatsapp filterss 2`] = `
2907
2862
  <div
2908
2863
  className="action-container__create-row"
2909
2864
  >
2910
- <NoPermissionWrapper
2911
- allowed={false}
2912
- >
2913
- <CapLink
2914
- className="create-new-link"
2915
- onClick={[Function]}
2916
- suffix={
2917
- <CapIcon
2918
- size="s"
2919
- type="open-in-new"
2920
- />
2921
- }
2922
- title="Create new template"
2923
- />
2924
- </NoPermissionWrapper>
2865
+ <CapLink
2866
+ className="create-new-link"
2867
+ onClick={[Function]}
2868
+ suffix={
2869
+ <CapIcon
2870
+ size="s"
2871
+ type="open-in-new"
2872
+ />
2873
+ }
2874
+ title="Create new template"
2875
+ />
2925
2876
  </div>
2926
2877
  </div>
2927
2878
  </div>
@@ -3161,21 +3112,17 @@ exports[`Test Templates container Test removing single filter 1`] = `
3161
3112
  <div
3162
3113
  className="action-container__create-row"
3163
3114
  >
3164
- <NoPermissionWrapper
3165
- allowed={false}
3166
- >
3167
- <CapLink
3168
- className="create-new-link"
3169
- onClick={[Function]}
3170
- suffix={
3171
- <CapIcon
3172
- size="s"
3173
- type="open-in-new"
3174
- />
3175
- }
3176
- title="Create new template"
3177
- />
3178
- </NoPermissionWrapper>
3115
+ <CapLink
3116
+ className="create-new-link"
3117
+ onClick={[Function]}
3118
+ suffix={
3119
+ <CapIcon
3120
+ size="s"
3121
+ type="open-in-new"
3122
+ />
3123
+ }
3124
+ title="Create new template"
3125
+ />
3179
3126
  </div>
3180
3127
  </div>
3181
3128
  </div>
@@ -34,8 +34,7 @@ import FTP from '../FTP';
34
34
  import Gallery from '../Assets/Gallery';
35
35
  import withStyles from '../../hoc/withStyles';
36
36
  import styles, { CapTabStyle } from './TemplatesV2.style';
37
- import { CREATIVES_UI_VIEW, CREATIVE_VIEW, FTP as FTP_CHANNEL, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCALE_HIDE_FEATURE, ZALO, INAPP, WEBPUSH } from '../App/constants';
38
- import { getUserAccess, hasPermission, PERMISSIONS } from '../../utils/permissions';
37
+ import { CREATIVES_UI_VIEW, FTP as FTP_CHANNEL, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCALE_HIDE_FEATURE, ZALO, INAPP, WEBPUSH } from '../App/constants';
39
38
  import AccessForbidden from '../../v2Components/AccessForbidden';
40
39
  import { getObjFromQueryParams } from '../../utils/v2common';
41
40
  import { makeSelectAuthenticated, selectCurrentOrgDetails } from "../../v2Containers/Cap/selectors";
@@ -277,16 +276,9 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
277
276
  </CapSpin>
278
277
 
279
278
  </div>);
280
- }
281
- getGalleryComponent = (location) => {
282
- const userAccess = getUserAccess(this.props);
283
- return (<Gallery
284
- location={location}
285
- isFullMode={this.props.isFullMode}
286
- canCreate={hasPermission(userAccess, PERMISSIONS.CREATIVE_CREATE)}
287
- canDelete={hasPermission(userAccess, PERMISSIONS.CREATIVE_DELETE)}
288
- />);
289
- }
279
+ };
280
+
281
+ getGalleryComponent = (location) => <Gallery location={location} isFullMode={this.props.isFullMode}/>
290
282
  getCallTaskComponent = () => (
291
283
  <CallTask
292
284
  onCreateNew={this.props.createNew}
@@ -424,10 +416,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
424
416
  const useLocalTemplates = get(this.props, 'localTemplatesConfig.useLocalTemplates', false);
425
417
  const { accessiblePermissions = []} = cap.user || Global.user || {};
426
418
  let isCreativeAccessible = true;
427
- if (
428
- !accessiblePermissions.includes(CREATIVES_UI_VIEW) &&
429
- !accessiblePermissions.includes(CREATIVE_VIEW)
430
- ) {
419
+ if (!accessiblePermissions.includes(CREATIVES_UI_VIEW)) {
431
420
  isCreativeAccessible = false;
432
421
  }
433
422
  // Recompute active pane content every render so local-list mode updates