@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.
Files changed (70) hide show
  1. package/AppRoot.js +124 -0
  2. package/app-config.js +61 -0
  3. package/app.js +10 -175
  4. package/bootstrap.js +185 -0
  5. package/entry.js +67 -1
  6. package/mfe-exposed-components.js +2 -4
  7. package/package.json +2 -2
  8. package/services/api.js +9 -1
  9. package/styles/containers/layout/_layoutPage.scss +8 -6
  10. package/translations/en.json +2 -2
  11. package/utils/getDataLayer.js +15 -0
  12. package/utils/gtmTrackers/gtmEvents/creativeDetails.js +2 -1
  13. package/utils/mfeDetect.js +1 -0
  14. package/utils/mfeFirstPaintReady.js +29 -0
  15. package/utils/mfeHistory.js +62 -0
  16. package/utils/permissions.js +59 -0
  17. package/utils/rcsPayloadUtils.js +5 -2
  18. package/utils/tests/permissions.test.js +116 -0
  19. package/utils/tests/rcsPayloadUtils.test.js +54 -2
  20. package/v2Components/AccessForbidden/_accessForbidden.scss +14 -0
  21. package/v2Components/AccessForbidden/index.js +5 -3
  22. package/v2Components/AccessForbidden/messages.js +3 -2
  23. package/v2Components/CapActionButton/constants.js +1 -0
  24. package/v2Components/CapActionButton/index.js +77 -9
  25. package/v2Components/CapActionButton/index.scss +13 -0
  26. package/v2Components/CapActionButton/messages.js +13 -0
  27. package/v2Components/CapActionButton/tests/index.test.js +32 -1
  28. package/v2Components/CommonTestAndPreview/index.js +44 -15
  29. package/v2Components/CommonTestAndPreview/tests/index.test.js +78 -0
  30. package/v2Components/CommonTestAndPreview/utils.js +34 -0
  31. package/v2Components/NavigationBar/index.js +9 -7
  32. package/v2Components/NavigationBar/mfeModuleHeader.config.js +16 -0
  33. package/v2Components/NavigationBar/tests/index.test.js +39 -19
  34. package/v2Components/NoPermissionWrapper/_noPermissionWrapper.scss +12 -0
  35. package/v2Components/NoPermissionWrapper/index.js +26 -0
  36. package/v2Components/SmsFallback/index.js +6 -0
  37. package/v2Containers/App/constants.js +5 -0
  38. package/v2Containers/Assets/Gallery/_gallery.scss +6 -0
  39. package/v2Containers/Assets/Gallery/index.js +34 -10
  40. package/v2Containers/Cap/constants.js +1 -0
  41. package/v2Containers/Cap/index.js +62 -29
  42. package/v2Containers/Cap/messages.js +4 -0
  43. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +2 -2
  44. package/v2Containers/CreativesContainer/index.js +11 -8
  45. package/v2Containers/CreativesContainer/tests/index.test.js +53 -0
  46. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +6 -6
  47. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +4 -4
  48. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +32 -32
  49. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +36 -36
  50. package/v2Containers/Rcs/components/CarouselCard.js +5 -0
  51. package/v2Containers/Rcs/components/CarouselCardButtons.js +20 -0
  52. package/v2Containers/Rcs/index.js +154 -79
  53. package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +55 -4
  54. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +404 -118
  55. package/v2Containers/Rcs/tests/carouselUtils.test.js +13 -17
  56. package/v2Containers/Rcs/tests/index.test.js +141 -6
  57. package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +110 -0
  58. package/v2Containers/Rcs/tests/utils.test.js +36 -0
  59. package/v2Containers/Rcs/utils.js +16 -4
  60. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +8 -8
  61. package/v2Containers/SmsTrai/Edit/index.js +35 -24
  62. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +18 -18
  63. package/v2Containers/Templates/ChannelTypeIllustration.js +10 -1
  64. package/v2Containers/Templates/_templates.scss +7 -1
  65. package/v2Containers/Templates/index.js +141 -99
  66. package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +7 -0
  67. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +173 -115
  68. package/v2Containers/TemplatesV2/TemplatesV2.style.js +8 -3
  69. package/v2Containers/TemplatesV2/index.js +38 -14
  70. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +268 -268
@@ -169,12 +169,11 @@ export const SmsTraiEdit = (props) => {
169
169
  return traiDltEnabled || hasTraiDltFeature() || isRcsEditFlow;
170
170
  }, [isRcsSmsFallback, traiDltEnabled, isRcsEditFlow]);
171
171
 
172
- /**
173
- * RCS SMS fallback: always show character count vs TRAI max (`SMS_TRAI_CONTENT_MAX_LENGTH`).
174
- * Do not use `totalCharacters` ({smsCount} SMS via length/160) here: resolved template + variable
175
- * values can exceed one GSM segment while DLT still shows a single registered template — length/160
176
- * is only a rough segment hint and reads as “wrong SMS count” in campaigns.
177
- */
172
+
173
+ const [rcsFallbackVarSegmentModeActive, setRcsFallbackVarSegmentModeActive] = useState(false);
174
+ const useRcsFallbackVarSegmentForCurrentText = isRcsSmsFallback && rcsFallbackVarSegmentModeActive;
175
+
176
+
178
177
  const renderDescriptionCharacterCount = (className = "rcs-character-count") => (
179
178
  <CapLabel type="label1" className={className}>
180
179
  {formatMessage(messages.charactersCountLabel, {
@@ -196,18 +195,24 @@ export const SmsTraiEdit = (props) => {
196
195
  };
197
196
 
198
197
  const renderRcsFallbackMessage = (str = '') => {
199
- if (!useRcsFallbackVarSegment) {
198
+ if (!useRcsFallbackVarSegmentForCurrentText) {
200
199
  return (
201
200
  <CapRow className="rcs-create-template-message-input">
202
201
  <div className="rcs_text_area_wrapper">
203
- <TextArea
204
- id="rcs_fallback_message_textarea"
205
- autosize={{ minRows: 4, maxRows: 12 }}
206
- value={fallbackText}
207
- onChange={(e) => setFallbackText(e.target.value)}
208
- placeholder={formatMessage(rcsMessages.fallbackMsgPlaceholder)}
209
- data-testid="rcs_fallback_plain_text_area"
210
- />
202
+ <div className="var-segment-message-editor__var-slot">
203
+ <TextArea
204
+ id="rcs_fallback_message_textarea"
205
+ autosize={{ minRows: 1, maxRows: 3 }}
206
+ value={fallbackText}
207
+ onChange={(e) => setFallbackText(e.target.value)}
208
+ onBlur={() => {
209
+ const hasVarToken = (fallbackText.match(COMBINED_SMS_TEMPLATE_VAR_REGEX) || []).length > 0;
210
+ if (hasVarToken) setRcsFallbackVarSegmentModeActive(true);
211
+ }}
212
+ placeholder={formatMessage(rcsMessages.fallbackMsgPlaceholder)}
213
+ data-testid="rcs_fallback_plain_text_area"
214
+ />
215
+ </div>
211
216
  {renderDescriptionCharacterCount()}
212
217
  </div>
213
218
  </CapRow>
@@ -362,7 +367,9 @@ export const SmsTraiEdit = (props) => {
362
367
  const templateBase = get(activeTemplateSourceForInit, 'versions.base', {});
363
368
  const unicodeValidity = get(templateBase, 'unicode-validity', true);
364
369
  const templateMsg = get(activeTemplateSourceForInit, 'versions.base.sms-editor', '') || '';
365
- if (!useRcsFallbackVarSegment) {
370
+ const templateMsgHasVarToken = (templateMsg.match(COMBINED_SMS_TEMPLATE_VAR_REGEX) || []).length > 0;
371
+ setRcsFallbackVarSegmentModeActive(templateMsgHasVarToken);
372
+ if (!templateMsgHasVarToken) {
366
373
  setFallbackText(templateMsg);
367
374
  setFallbackVarMappedData({});
368
375
  setUpdatedSmsEditor(String(templateMsg).split(''));
@@ -429,7 +436,7 @@ export const SmsTraiEdit = (props) => {
429
436
 
430
437
  useEffect(() => {
431
438
  if (!isRcsSmsFallback) return;
432
- if (!useRcsFallbackVarSegment) {
439
+ if (!useRcsFallbackVarSegmentForCurrentText) {
433
440
  const plainFallbackSmsText = fallbackText || '';
434
441
  setUpdatedSmsEditor(plainFallbackSmsText.split(''));
435
442
  setTotalMessageLength(plainFallbackSmsText.length);
@@ -441,15 +448,17 @@ export const SmsTraiEdit = (props) => {
441
448
  );
442
449
  setUpdatedSmsEditor(resolvedFallbackDisplay.split(''));
443
450
  setTotalMessageLength(resolvedFallbackDisplay.length);
444
- }, [isRcsSmsFallback, useRcsFallbackVarSegment, fallbackText, fallbackVarMappedData]);
451
+ }, [isRcsSmsFallback, useRcsFallbackVarSegmentForCurrentText, fallbackText, fallbackVarMappedData]);
445
452
 
446
453
  useEffect(() => {
447
454
  if (!isRcsSmsFallback) return;
455
+ // Skip until hydration populates fallbackVarMappedData, or this wipes the parent's rcsSmsFallbackVarMapped before init restores it.
456
+ if (loading) return;
448
457
  if (typeof onRcsFallbackEditorStateChange !== 'function') return;
449
458
  onRcsFallbackEditorStateChange({
450
459
  rcsSmsFallbackVarMapped: fallbackVarMappedData || {},
451
460
  });
452
- }, [isRcsSmsFallback, fallbackVarMappedData, onRcsFallbackEditorStateChange]);
461
+ }, [isRcsSmsFallback, loading, fallbackVarMappedData, onRcsFallbackEditorStateChange]);
453
462
 
454
463
  useEffect(() => {
455
464
  if (!isRcsSmsFallback) return;
@@ -532,7 +541,7 @@ export const SmsTraiEdit = (props) => {
532
541
  // TRAI/DLT VarSegment: `validateIfTagClosed` only understands paired `{{…}}` and breaks on
533
542
  // legitimate `{#…#}` / mixed TRAI shapes (extra `{`/`}` counts). Do not tie Done to it;
534
543
  // slot completeness is enforced by `areAllRcsSmsFallbackVarSlotsFilled` on the RCS screen.
535
- if (useRcsFallbackVarSegment) {
544
+ if (useRcsFallbackVarSegmentForCurrentText) {
536
545
  tagValidationResponseRef.current = {};
537
546
  updateIsTagValidationError(false);
538
547
  return;
@@ -573,7 +582,7 @@ export const SmsTraiEdit = (props) => {
573
582
  tags,
574
583
  isRcsSmsFallback,
575
584
  isFullMode,
576
- useRcsFallbackVarSegment,
585
+ useRcsFallbackVarSegmentForCurrentText,
577
586
  fallbackText,
578
587
  fallbackVarMappedData,
579
588
  getDefaultTags,
@@ -712,7 +721,8 @@ export const SmsTraiEdit = (props) => {
712
721
  ...baseWithoutDerivedFields,
713
722
  'sms-editor': fallbackText || '',
714
723
  'unicode-validity': isUnicodeAllowed,
715
- ...(useRcsFallbackVarSegment && {
724
+ // Gate on useRcsFallbackVarSegmentForCurrentText (not the static DLT flag), or non-DLT var-token flows lose slot values on save.
725
+ ...(useRcsFallbackVarSegmentForCurrentText && {
716
726
  'rcs-sms-fallback-var-mapped': fallbackVarMappedData || {},
717
727
  }),
718
728
  };
@@ -778,8 +788,9 @@ export const SmsTraiEdit = (props) => {
778
788
 
779
789
  const onTagSelect = (data) => {
780
790
  if (isRcsSmsFallback) {
781
- if (!useRcsFallbackVarSegment) {
791
+ if (!useRcsFallbackVarSegmentForCurrentText) {
782
792
  setFallbackText((prev) => `${prev || ''}{{${data}}}`);
793
+ setRcsFallbackVarSegmentModeActive(true);
783
794
  return;
784
795
  }
785
796
  if (!fallbackFocusedId) return;
@@ -949,7 +960,7 @@ export const SmsTraiEdit = (props) => {
949
960
 
950
961
  const calculateTotalMessageLength = () => {
951
962
  if (isRcsSmsFallback) {
952
- if (useRcsFallbackVarSegment) {
963
+ if (useRcsFallbackVarSegmentForCurrentText) {
953
964
  const resolved = getFallbackResolvedContent(fallbackText || '', fallbackVarMappedData || {});
954
965
  setTotalMessageLength(resolved.length);
955
966
  } else {
@@ -87,8 +87,8 @@ exports[`Creatives SmsTraiEdit test/> should render 1`] = `
87
87
  "app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
88
88
  "app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
89
89
  "app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
90
- "creatives.components.AccessForbidden.forbiddenDesc": "This page access has not been provided to you.",
91
- "creatives.components.AccessForbidden.forbiddenHeader": "Access Forbidden",
90
+ "creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
91
+ "creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
92
92
  "creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
93
93
  "creatives.components.CapTagList.Cancel": "Cancel",
94
94
  "creatives.components.CapTagList.Ok": "Ok",
@@ -7411,8 +7411,8 @@ FREE GIFTS-
7411
7411
  "app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
7412
7412
  "app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
7413
7413
  "app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
7414
- "creatives.components.AccessForbidden.forbiddenDesc": "This page access has not been provided to you.",
7415
- "creatives.components.AccessForbidden.forbiddenHeader": "Access Forbidden",
7414
+ "creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
7415
+ "creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
7416
7416
  "creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
7417
7417
  "creatives.components.CapTagList.Cancel": "Cancel",
7418
7418
  "creatives.components.CapTagList.Ok": "Ok",
@@ -9749,8 +9749,8 @@ FREE GIFTS-
9749
9749
  "app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
9750
9750
  "app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
9751
9751
  "app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
9752
- "creatives.components.AccessForbidden.forbiddenDesc": "This page access has not been provided to you.",
9753
- "creatives.components.AccessForbidden.forbiddenHeader": "Access Forbidden",
9752
+ "creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
9753
+ "creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
9754
9754
  "creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
9755
9755
  "creatives.components.CapTagList.Cancel": "Cancel",
9756
9756
  "creatives.components.CapTagList.Ok": "Ok",
@@ -12238,8 +12238,8 @@ exports[`Creatives SmsTraiEdit test/> should render 2`] = `
12238
12238
  "app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
12239
12239
  "app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
12240
12240
  "app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
12241
- "creatives.components.AccessForbidden.forbiddenDesc": "This page access has not been provided to you.",
12242
- "creatives.components.AccessForbidden.forbiddenHeader": "Access Forbidden",
12241
+ "creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
12242
+ "creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
12243
12243
  "creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
12244
12244
  "creatives.components.CapTagList.Cancel": "Cancel",
12245
12245
  "creatives.components.CapTagList.Ok": "Ok",
@@ -20936,8 +20936,8 @@ FREE GIFTS-
20936
20936
  "app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
20937
20937
  "app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
20938
20938
  "app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
20939
- "creatives.components.AccessForbidden.forbiddenDesc": "This page access has not been provided to you.",
20940
- "creatives.components.AccessForbidden.forbiddenHeader": "Access Forbidden",
20939
+ "creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
20940
+ "creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
20941
20941
  "creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
20942
20942
  "creatives.components.CapTagList.Cancel": "Cancel",
20943
20943
  "creatives.components.CapTagList.Ok": "Ok",
@@ -23274,8 +23274,8 @@ FREE GIFTS-
23274
23274
  "app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
23275
23275
  "app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
23276
23276
  "app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
23277
- "creatives.components.AccessForbidden.forbiddenDesc": "This page access has not been provided to you.",
23278
- "creatives.components.AccessForbidden.forbiddenHeader": "Access Forbidden",
23277
+ "creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
23278
+ "creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
23279
23279
  "creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
23280
23280
  "creatives.components.CapTagList.Cancel": "Cancel",
23281
23281
  "creatives.components.CapTagList.Ok": "Ok",
@@ -25763,8 +25763,8 @@ exports[`Creatives SmsTraiEdit test/> should save 1`] = `
25763
25763
  "app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
25764
25764
  "app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
25765
25765
  "app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
25766
- "creatives.components.AccessForbidden.forbiddenDesc": "This page access has not been provided to you.",
25767
- "creatives.components.AccessForbidden.forbiddenHeader": "Access Forbidden",
25766
+ "creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
25767
+ "creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
25768
25768
  "creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
25769
25769
  "creatives.components.CapTagList.Cancel": "Cancel",
25770
25770
  "creatives.components.CapTagList.Ok": "Ok",
@@ -33087,8 +33087,8 @@ FREE GIFTS-
33087
33087
  "app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
33088
33088
  "app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
33089
33089
  "app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
33090
- "creatives.components.AccessForbidden.forbiddenDesc": "This page access has not been provided to you.",
33091
- "creatives.components.AccessForbidden.forbiddenHeader": "Access Forbidden",
33090
+ "creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
33091
+ "creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
33092
33092
  "creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
33093
33093
  "creatives.components.CapTagList.Cancel": "Cancel",
33094
33094
  "creatives.components.CapTagList.Ok": "Ok",
@@ -35425,8 +35425,8 @@ FREE GIFTS-
35425
35425
  "app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
35426
35426
  "app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
35427
35427
  "app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
35428
- "creatives.components.AccessForbidden.forbiddenDesc": "This page access has not been provided to you.",
35429
- "creatives.components.AccessForbidden.forbiddenHeader": "Access Forbidden",
35428
+ "creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
35429
+ "creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
35430
35430
  "creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
35431
35431
  "creatives.components.CapTagList.Cancel": "Cancel",
35432
35432
  "creatives.components.CapTagList.Ok": "Ok",
@@ -2,8 +2,9 @@ import React, { useMemo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import zaloillustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
4
4
  import inAppIllustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
5
- import { FormattedMessage } from 'react-intl';
5
+ import { FormattedMessage, useIntl } from 'react-intl';
6
6
  import { CapIllustration } from "@capillarytech/cap-ui-library";
7
+ import globalMessages from '../Cap/messages';
7
8
  import emailIllustration from '../Assets/images/emailIllustration.svg';
8
9
  import smsIllustration from '../Assets/images/smsIllustration.svg';
9
10
  import pushIllustration from '../Assets/images/pushIllustration.svg';
@@ -79,12 +80,14 @@ const CHANNEL_CONFIG = {
79
80
  };
80
81
 
81
82
  function ChannelTypeIllustration(props) {
83
+ const intl = useIntl();
82
84
  const {
83
85
  isFullMode,
84
86
  createTemplate,
85
87
  currentChannel,
86
88
  hostName,
87
89
  isArchivedMode,
90
+ canCreate = true,
88
91
  } = props;
89
92
 
90
93
  const templateText = useMemo(() => {
@@ -183,6 +186,11 @@ function ChannelTypeIllustration(props) {
183
186
  if (config.hasButton) {
184
187
  result.buttonLabel = <FormattedMessage {...config.buttonMessage} values={{ template: templateText }} />;
185
188
  result.onClick = createTemplate;
189
+ // RBAC: gray out + disable the create button for users without create permission.
190
+ if (!canCreate) {
191
+ result.disabled = true;
192
+ result.buttonTooltip = intl.formatMessage(globalMessages.noPermissionAction);
193
+ }
186
194
  }
187
195
 
188
196
  if (config.descriptionMessage) {
@@ -213,5 +221,6 @@ ChannelTypeIllustration.propTypes = {
213
221
  currentChannel: PropTypes.string,
214
222
  hostName: PropTypes.string,
215
223
  isArchivedMode: PropTypes.bool,
224
+ canCreate: PropTypes.bool,
216
225
  };
217
226
  export default ChannelTypeIllustration;
@@ -1,6 +1,7 @@
1
1
  @import '~@capillarytech/cap-ui-library/styles/_variables.scss';
2
2
 
3
3
  .ant-tabs-content{
4
+ margin-top: $CAP_SPACE_08;
4
5
  // .creatives-templates-list.full-mode{
5
6
  .v2-pagination-container, .v2-pagination-container-half {
6
7
  .ant-tabs-tabpane-active{
@@ -1427,7 +1428,6 @@
1427
1428
  justify-content: space-between;
1428
1429
  align-items: center;
1429
1430
  gap: $CAP_SPACE_08;
1430
- margin-right: $CAP_SPACE_32;
1431
1431
  }
1432
1432
 
1433
1433
  .template-listing-more-btn {
@@ -1473,3 +1473,9 @@
1473
1473
  min-width: 0;
1474
1474
  }
1475
1475
  }
1476
+
1477
+ // RBAC: dim + block a control the user lacks permission for (used with CapTooltip).
1478
+ .rbac-disabled {
1479
+ opacity: 0.4;
1480
+ cursor: not-allowed;
1481
+ }