@capillarytech/creatives-library 9.0.36 → 9.0.37-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/AppRoot.js +124 -0
- package/app-config.js +61 -0
- package/app.js +10 -175
- package/bootstrap.js +185 -0
- package/entry.js +67 -1
- package/mfe-exposed-components.js +2 -4
- package/package.json +2 -2
- package/services/api.js +9 -1
- package/styles/containers/layout/_layoutPage.scss +8 -6
- package/translations/en.json +2 -2
- package/utils/getDataLayer.js +15 -0
- package/utils/gtmTrackers/gtmEvents/creativeDetails.js +2 -1
- package/utils/mfeDetect.js +1 -0
- package/utils/mfeFirstPaintReady.js +29 -0
- package/utils/mfeHistory.js +62 -0
- package/utils/permissions.js +59 -0
- package/utils/rcsPayloadUtils.js +5 -2
- package/utils/tests/permissions.test.js +116 -0
- package/utils/tests/rcsPayloadUtils.test.js +54 -2
- package/v2Components/AccessForbidden/_accessForbidden.scss +14 -0
- package/v2Components/AccessForbidden/index.js +5 -3
- package/v2Components/AccessForbidden/messages.js +3 -2
- package/v2Components/CapActionButton/constants.js +1 -0
- package/v2Components/CapActionButton/index.js +77 -9
- package/v2Components/CapActionButton/index.scss +13 -0
- package/v2Components/CapActionButton/messages.js +13 -0
- package/v2Components/CapActionButton/tests/index.test.js +32 -1
- package/v2Components/CommonTestAndPreview/index.js +44 -15
- package/v2Components/CommonTestAndPreview/tests/index.test.js +78 -0
- package/v2Components/CommonTestAndPreview/utils.js +34 -0
- package/v2Components/NavigationBar/index.js +9 -7
- package/v2Components/NavigationBar/mfeModuleHeader.config.js +16 -0
- package/v2Components/NavigationBar/tests/index.test.js +39 -19
- package/v2Components/NoPermissionWrapper/_noPermissionWrapper.scss +12 -0
- package/v2Components/NoPermissionWrapper/index.js +26 -0
- package/v2Components/SmsFallback/index.js +6 -0
- package/v2Containers/App/constants.js +5 -0
- package/v2Containers/Assets/Gallery/_gallery.scss +6 -0
- package/v2Containers/Assets/Gallery/index.js +34 -10
- package/v2Containers/Cap/constants.js +1 -0
- package/v2Containers/Cap/index.js +62 -29
- package/v2Containers/Cap/messages.js +4 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/CreativesContainer/index.js +11 -8
- package/v2Containers/CreativesContainer/tests/index.test.js +53 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +6 -6
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +4 -4
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +32 -32
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +36 -36
- package/v2Containers/Rcs/components/CarouselCard.js +5 -0
- package/v2Containers/Rcs/components/CarouselCardButtons.js +20 -0
- package/v2Containers/Rcs/index.js +154 -79
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +55 -4
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +404 -118
- package/v2Containers/Rcs/tests/carouselUtils.test.js +13 -17
- package/v2Containers/Rcs/tests/index.test.js +141 -6
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +110 -0
- package/v2Containers/Rcs/tests/utils.test.js +36 -0
- package/v2Containers/Rcs/utils.js +16 -4
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +8 -8
- package/v2Containers/SmsTrai/Edit/index.js +35 -24
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +18 -18
- package/v2Containers/Templates/ChannelTypeIllustration.js +10 -1
- package/v2Containers/Templates/_templates.scss +7 -1
- package/v2Containers/Templates/index.js +141 -99
- package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +7 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +173 -115
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +8 -3
- package/v2Containers/TemplatesV2/index.js +38 -14
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +268 -268
|
@@ -236,14 +236,18 @@ exports[`Test Templates container Should render sms illustration when no templat
|
|
|
236
236
|
<div
|
|
237
237
|
className="action-container__create-row"
|
|
238
238
|
>
|
|
239
|
-
<
|
|
240
|
-
|
|
241
|
-
disabled={false}
|
|
242
|
-
onClick={[Function]}
|
|
243
|
-
type="primary"
|
|
239
|
+
<NoPermissionWrapper
|
|
240
|
+
allowed={false}
|
|
244
241
|
>
|
|
245
|
-
|
|
246
|
-
|
|
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>
|
|
247
251
|
</div>
|
|
248
252
|
</div>
|
|
249
253
|
</div>
|
|
@@ -251,6 +255,7 @@ exports[`Test Templates container Should render sms illustration when no templat
|
|
|
251
255
|
</CapRow>
|
|
252
256
|
<div>
|
|
253
257
|
<ChannelTypeIllustration
|
|
258
|
+
canCreate={false}
|
|
254
259
|
createTemplate={[Function]}
|
|
255
260
|
currentChannel="SMS"
|
|
256
261
|
hostName=""
|
|
@@ -503,17 +508,21 @@ exports[`Test Templates container Should render temlates when whatsapp templates
|
|
|
503
508
|
<div
|
|
504
509
|
className="action-container__create-row"
|
|
505
510
|
>
|
|
506
|
-
<
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
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>
|
|
517
526
|
</div>
|
|
518
527
|
</div>
|
|
519
528
|
</div>
|
|
@@ -810,14 +819,18 @@ exports[`Test Templates container Should render temlates when whatsapp templates
|
|
|
810
819
|
<div
|
|
811
820
|
className="action-container__create-row"
|
|
812
821
|
>
|
|
813
|
-
<
|
|
814
|
-
|
|
815
|
-
disabled={false}
|
|
816
|
-
onClick={[Function]}
|
|
817
|
-
type="primary"
|
|
822
|
+
<NoPermissionWrapper
|
|
823
|
+
allowed={false}
|
|
818
824
|
>
|
|
819
|
-
|
|
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
834
|
</div>
|
|
822
835
|
</div>
|
|
823
836
|
</div>
|
|
@@ -1220,14 +1233,18 @@ exports[`Test Templates container Test max templates exceeded 1`] = `
|
|
|
1220
1233
|
<div
|
|
1221
1234
|
className="action-container__create-row"
|
|
1222
1235
|
>
|
|
1223
|
-
<
|
|
1224
|
-
|
|
1225
|
-
disabled={false}
|
|
1226
|
-
onClick={[Function]}
|
|
1227
|
-
type="primary"
|
|
1236
|
+
<NoPermissionWrapper
|
|
1237
|
+
allowed={false}
|
|
1228
1238
|
>
|
|
1229
|
-
|
|
1230
|
-
|
|
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>
|
|
1231
1248
|
</div>
|
|
1232
1249
|
</div>
|
|
1233
1250
|
</div>
|
|
@@ -1324,14 +1341,26 @@ Click {{unsubscribe}} to unsubscribe
|
|
|
1324
1341
|
overlay={
|
|
1325
1342
|
<CapMenuComponent>
|
|
1326
1343
|
<withItemHOC
|
|
1327
|
-
className="delete-whatsapp"
|
|
1344
|
+
className="delete-whatsapp rbac-disabled"
|
|
1328
1345
|
onClick={[Function]}
|
|
1329
1346
|
>
|
|
1330
|
-
<
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
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>
|
|
1335
1364
|
</withItemHOC>
|
|
1336
1365
|
</CapMenuComponent>
|
|
1337
1366
|
}
|
|
@@ -1341,12 +1370,7 @@ Click {{unsubscribe}} to unsubscribe
|
|
|
1341
1370
|
/>
|
|
1342
1371
|
</CapDropdownComponent>,
|
|
1343
1372
|
],
|
|
1344
|
-
"hoverOption":
|
|
1345
|
-
className="edit-whatsapp"
|
|
1346
|
-
onClick={[Function]}
|
|
1347
|
-
>
|
|
1348
|
-
Overview
|
|
1349
|
-
</CapButton>,
|
|
1373
|
+
"hoverOption": null,
|
|
1350
1374
|
"key": "WHATSAPP-card-creatives_whatsapp6",
|
|
1351
1375
|
"title": <CapRow
|
|
1352
1376
|
align="middle"
|
|
@@ -1693,14 +1717,18 @@ exports[`Test Templates container Test max templates not exceeded 1`] = `
|
|
|
1693
1717
|
<div
|
|
1694
1718
|
className="action-container__create-row"
|
|
1695
1719
|
>
|
|
1696
|
-
<
|
|
1697
|
-
|
|
1698
|
-
disabled={false}
|
|
1699
|
-
onClick={[Function]}
|
|
1700
|
-
type="primary"
|
|
1720
|
+
<NoPermissionWrapper
|
|
1721
|
+
allowed={false}
|
|
1701
1722
|
>
|
|
1702
|
-
|
|
1703
|
-
|
|
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>
|
|
1704
1732
|
</div>
|
|
1705
1733
|
</div>
|
|
1706
1734
|
</div>
|
|
@@ -1797,14 +1825,26 @@ Click {{unsubscribe}} to unsubscribe
|
|
|
1797
1825
|
overlay={
|
|
1798
1826
|
<CapMenuComponent>
|
|
1799
1827
|
<withItemHOC
|
|
1800
|
-
className="delete-whatsapp"
|
|
1828
|
+
className="delete-whatsapp rbac-disabled"
|
|
1801
1829
|
onClick={[Function]}
|
|
1802
1830
|
>
|
|
1803
|
-
<
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
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>
|
|
1808
1848
|
</withItemHOC>
|
|
1809
1849
|
</CapMenuComponent>
|
|
1810
1850
|
}
|
|
@@ -1814,12 +1854,7 @@ Click {{unsubscribe}} to unsubscribe
|
|
|
1814
1854
|
/>
|
|
1815
1855
|
</CapDropdownComponent>,
|
|
1816
1856
|
],
|
|
1817
|
-
"hoverOption":
|
|
1818
|
-
className="edit-whatsapp"
|
|
1819
|
-
onClick={[Function]}
|
|
1820
|
-
>
|
|
1821
|
-
Overview
|
|
1822
|
-
</CapButton>,
|
|
1857
|
+
"hoverOption": null,
|
|
1823
1858
|
"key": "WHATSAPP-card-creatives_whatsapp6",
|
|
1824
1859
|
"title": <CapRow
|
|
1825
1860
|
align="middle"
|
|
@@ -2166,14 +2201,18 @@ exports[`Test Templates container Test max templates warning 1`] = `
|
|
|
2166
2201
|
<div
|
|
2167
2202
|
className="action-container__create-row"
|
|
2168
2203
|
>
|
|
2169
|
-
<
|
|
2170
|
-
|
|
2171
|
-
disabled={false}
|
|
2172
|
-
onClick={[Function]}
|
|
2173
|
-
type="primary"
|
|
2204
|
+
<NoPermissionWrapper
|
|
2205
|
+
allowed={false}
|
|
2174
2206
|
>
|
|
2175
|
-
|
|
2176
|
-
|
|
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>
|
|
2177
2216
|
</div>
|
|
2178
2217
|
</div>
|
|
2179
2218
|
</div>
|
|
@@ -2270,14 +2309,26 @@ Click {{unsubscribe}} to unsubscribe
|
|
|
2270
2309
|
overlay={
|
|
2271
2310
|
<CapMenuComponent>
|
|
2272
2311
|
<withItemHOC
|
|
2273
|
-
className="delete-whatsapp"
|
|
2312
|
+
className="delete-whatsapp rbac-disabled"
|
|
2274
2313
|
onClick={[Function]}
|
|
2275
2314
|
>
|
|
2276
|
-
<
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
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
2332
|
</withItemHOC>
|
|
2282
2333
|
</CapMenuComponent>
|
|
2283
2334
|
}
|
|
@@ -2287,12 +2338,7 @@ Click {{unsubscribe}} to unsubscribe
|
|
|
2287
2338
|
/>
|
|
2288
2339
|
</CapDropdownComponent>,
|
|
2289
2340
|
],
|
|
2290
|
-
"hoverOption":
|
|
2291
|
-
className="edit-whatsapp"
|
|
2292
|
-
onClick={[Function]}
|
|
2293
|
-
>
|
|
2294
|
-
Overview
|
|
2295
|
-
</CapButton>,
|
|
2341
|
+
"hoverOption": null,
|
|
2296
2342
|
"key": "WHATSAPP-card-creatives_whatsapp6",
|
|
2297
2343
|
"title": <CapRow
|
|
2298
2344
|
align="middle"
|
|
@@ -2582,17 +2628,21 @@ exports[`Test Templates container Test removing all whatsapp filterss 1`] = `
|
|
|
2582
2628
|
<div
|
|
2583
2629
|
className="action-container__create-row"
|
|
2584
2630
|
>
|
|
2585
|
-
<
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
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>
|
|
2596
2646
|
</div>
|
|
2597
2647
|
</div>
|
|
2598
2648
|
</div>
|
|
@@ -2857,17 +2907,21 @@ exports[`Test Templates container Test removing all whatsapp filterss 2`] = `
|
|
|
2857
2907
|
<div
|
|
2858
2908
|
className="action-container__create-row"
|
|
2859
2909
|
>
|
|
2860
|
-
<
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
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>
|
|
2871
2925
|
</div>
|
|
2872
2926
|
</div>
|
|
2873
2927
|
</div>
|
|
@@ -3107,17 +3161,21 @@ exports[`Test Templates container Test removing single filter 1`] = `
|
|
|
3107
3161
|
<div
|
|
3108
3162
|
className="action-container__create-row"
|
|
3109
3163
|
>
|
|
3110
|
-
<
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
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>
|
|
3121
3179
|
</div>
|
|
3122
3180
|
</div>
|
|
3123
3181
|
</div>
|
|
@@ -10,10 +10,9 @@ export default css`
|
|
|
10
10
|
|
|
11
11
|
.component-wrapper {
|
|
12
12
|
${(props) => props.isFullMode ? `
|
|
13
|
-
max-width: 71.25rem;
|
|
14
13
|
margin: 0 auto;
|
|
15
14
|
width: 100%;
|
|
16
|
-
padding: 0
|
|
15
|
+
padding: 0;
|
|
17
16
|
/* Only main channel tabs content, not HTML Editor validation panel tabs */
|
|
18
17
|
> .cap-tab-v2 > .ant-tabs-content-holder > .ant-tabs-content,
|
|
19
18
|
> .cap-tab-v2 > .ant-tabs-content {
|
|
@@ -97,6 +96,12 @@ export default css`
|
|
|
97
96
|
`;
|
|
98
97
|
|
|
99
98
|
export const CapTabStyle = css`
|
|
100
|
-
${(props) => props.isFullMode ? `margin-top: ${CAP_SPACE_24}
|
|
99
|
+
${(props) => props.isFullMode ? `margin-top: ${CAP_SPACE_24};` : ``
|
|
100
|
+
}
|
|
101
|
+
.ant-tabs-nav-list {
|
|
102
|
+
gap: 2rem;
|
|
103
|
+
}
|
|
104
|
+
.ant-tabs-tab + .ant-tabs-tab {
|
|
105
|
+
margin: 0 !important;
|
|
101
106
|
}
|
|
102
107
|
`;
|
|
@@ -10,7 +10,7 @@ import { connect } from 'react-redux';
|
|
|
10
10
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
11
11
|
import { createStructuredSelector } from 'reselect';
|
|
12
12
|
import { bindActionCreators, compose } from 'redux';
|
|
13
|
-
import { CapTab, CapCustomCard, CapButton,
|
|
13
|
+
import { CapTab, CapCustomCard, CapButton, CapIcon, CapSpin, CapTooltip } from '@capillarytech/cap-ui-library';
|
|
14
14
|
import { find, get, pick } from 'lodash';
|
|
15
15
|
import Helmet from 'react-helmet';
|
|
16
16
|
|
|
@@ -34,7 +34,8 @@ 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, FTP as FTP_CHANNEL, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCALE_HIDE_FEATURE, ZALO, INAPP, WEBPUSH } from '../App/constants';
|
|
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';
|
|
38
39
|
import AccessForbidden from '../../v2Components/AccessForbidden';
|
|
39
40
|
import { getObjFromQueryParams } from '../../utils/v2common';
|
|
40
41
|
import { makeSelectAuthenticated, selectCurrentOrgDetails } from "../../v2Containers/Cap/selectors";
|
|
@@ -47,6 +48,9 @@ import {
|
|
|
47
48
|
NORMALIZED_CHANNEL_ALIASES,
|
|
48
49
|
SMS,
|
|
49
50
|
} from "../CreativesContainer/constants";
|
|
51
|
+
import { MFEEventBus } from '@capillarytech/cap-ui-utils';
|
|
52
|
+
import { isMFEMode } from '../../utils/mfeDetect';
|
|
53
|
+
import appConfig from '../../app-config';
|
|
50
54
|
|
|
51
55
|
const { CapCustomCardList } = CapCustomCard;
|
|
52
56
|
|
|
@@ -54,6 +58,7 @@ const StyledCapTab = withStyles(CapTab, CapTabStyle);
|
|
|
54
58
|
export class TemplatesV2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
55
59
|
constructor(props) {
|
|
56
60
|
super(props);
|
|
61
|
+
this.lcpReported = false;
|
|
57
62
|
let defaultChannel = get(this, 'props.channel') || get(this, 'props.params.channel') || 'sms';
|
|
58
63
|
if (defaultChannel === LOYALTY) {
|
|
59
64
|
defaultChannel = 'sms';
|
|
@@ -222,6 +227,23 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
222
227
|
}
|
|
223
228
|
}
|
|
224
229
|
|
|
230
|
+
componentDidUpdate(prevProps) {
|
|
231
|
+
if (
|
|
232
|
+
isMFEMode() &&
|
|
233
|
+
!this.lcpReported &&
|
|
234
|
+
!this.props.Templates.getAllTemplatesInProgress &&
|
|
235
|
+
prevProps.Templates.getAllTemplatesInProgress
|
|
236
|
+
) {
|
|
237
|
+
this.lcpReported = true;
|
|
238
|
+
MFEEventBus.emit('mfe:segment', {
|
|
239
|
+
action: 'stop',
|
|
240
|
+
appId: appConfig.appName,
|
|
241
|
+
type: 'lcp',
|
|
242
|
+
timestamp: performance.now(),
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
225
247
|
componentWillReceiveProps(nextProps) {
|
|
226
248
|
if (this.props.channel !== nextProps.channel) {
|
|
227
249
|
const panes = this.setChannelContent(nextProps.channel, this.state.panes);
|
|
@@ -255,9 +277,16 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
255
277
|
</CapSpin>
|
|
256
278
|
|
|
257
279
|
</div>);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
|
|
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
|
+
}
|
|
261
290
|
getCallTaskComponent = () => (
|
|
262
291
|
<CallTask
|
|
263
292
|
onCreateNew={this.props.createNew}
|
|
@@ -395,7 +424,10 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
395
424
|
const useLocalTemplates = get(this.props, 'localTemplatesConfig.useLocalTemplates', false);
|
|
396
425
|
const { accessiblePermissions = []} = cap.user || Global.user || {};
|
|
397
426
|
let isCreativeAccessible = true;
|
|
398
|
-
if (
|
|
427
|
+
if (
|
|
428
|
+
!accessiblePermissions.includes(CREATIVES_UI_VIEW) &&
|
|
429
|
+
!accessiblePermissions.includes(CREATIVE_VIEW)
|
|
430
|
+
) {
|
|
399
431
|
isCreativeAccessible = false;
|
|
400
432
|
}
|
|
401
433
|
// Recompute active pane content every render so local-list mode updates
|
|
@@ -422,14 +454,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
422
454
|
/>
|
|
423
455
|
)}
|
|
424
456
|
<section className="component-wrapper">
|
|
425
|
-
{isFullMode && (
|
|
426
|
-
<CapHeader
|
|
427
|
-
title={<FormattedMessage {...messages.creatives} />}
|
|
428
|
-
{...(!useLocalTemplates && {
|
|
429
|
-
description: <FormattedMessage {...messages.creativesDesc} />,
|
|
430
|
-
})}
|
|
431
|
-
/>
|
|
432
|
-
)}
|
|
433
457
|
{hideChannelTabsForLocalSms ? (
|
|
434
458
|
<section className="templates-v2-local-sms-pane">{activeLocalPane?.content}</section>
|
|
435
459
|
) : (
|