@capillarytech/creatives-library 9.2.2 → 9.2.4-alpha.feature-rcs-multi-account.51

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 (60) hide show
  1. package/constants/unified.js +0 -1
  2. package/package.json +1 -1
  3. package/utils/common.js +0 -6
  4. package/utils/createMobilePushPayload.js +50 -56
  5. package/utils/tests/createMobilePushPayload.test.js +177 -168
  6. package/v2Components/CapMpushCTA/index.js +47 -57
  7. package/v2Components/CapMpushCTA/index.scss +43 -5
  8. package/v2Components/CapMpushCTA/tests/index.test.js +150 -0
  9. package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +11 -8
  10. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +13 -1
  11. package/v2Components/CommonTestAndPreview/constants.js +2 -0
  12. package/v2Components/CommonTestAndPreview/index.js +59 -14
  13. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/MobilePushPreviewContent.test.js +83 -5
  14. package/v2Components/CommonTestAndPreview/tests/index.test.js +158 -0
  15. package/v2Components/MobilePushPreviewV2/_mobilePushPreviewV2.scss +7 -0
  16. package/v2Components/MobilePushPreviewV2/index.js +22 -9
  17. package/v2Components/MobilePushPreviewV2/tests/index.test.js +55 -0
  18. package/v2Components/TemplatePreview/_mobilePushPhone.scss +72 -0
  19. package/v2Components/TemplatePreview/_templatePreview.scss +18 -2
  20. package/v2Components/TemplatePreview/index.js +20 -18
  21. package/v2Components/TemplatePreview/tests/index.test.js +69 -0
  22. package/v2Components/TestAndPreviewSlidebox/index.js +2 -0
  23. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/extractContentForPreview.test.js +45 -0
  24. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/extractContentForPreview.js +12 -2
  25. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +16 -3
  26. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +7 -2
  27. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/deliverySettingsConfig.test.js +44 -0
  28. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/deliverySettingsConfig.js +21 -8
  29. package/v2Containers/CreativesContainer/SlideBoxContent.js +4 -6
  30. package/v2Containers/CreativesContainer/index.js +18 -1
  31. package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +43 -0
  32. package/v2Containers/CreativesContainer/tests/index.test.js +66 -0
  33. package/v2Containers/MobilePushNew/components/CtaButtons.js +52 -47
  34. package/v2Containers/MobilePushNew/components/MediaUploaders.js +105 -345
  35. package/v2Containers/MobilePushNew/components/PlatformContentFields.js +127 -105
  36. package/v2Containers/MobilePushNew/components/TapLinkActions.js +76 -0
  37. package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +30 -208
  38. package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +305 -1482
  39. package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +165 -59
  40. package/v2Containers/MobilePushNew/constants.js +12 -0
  41. package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +63 -1
  42. package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +78 -0
  43. package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +40 -1
  44. package/v2Containers/MobilePushNew/hooks/useUpload.js +42 -46
  45. package/v2Containers/MobilePushNew/index.js +498 -289
  46. package/v2Containers/MobilePushNew/index.scss +151 -4
  47. package/v2Containers/MobilePushNew/messages.js +106 -6
  48. package/v2Containers/MobilePushNew/tests/index.test.js +483 -1
  49. package/v2Containers/MobilePushNew/tests/utils.test.js +110 -0
  50. package/v2Containers/MobilePushNew/utils.js +83 -0
  51. package/v2Containers/Rcs/accountUtils.js +20 -0
  52. package/v2Containers/Rcs/index.js +18 -1
  53. package/v2Containers/Rcs/tests/accountUtils.test.js +24 -0
  54. package/v2Containers/Rcs/tests/index.test.js +23 -0
  55. package/v2Containers/Templates/ChannelTypeIllustration.js +12 -0
  56. package/v2Containers/Templates/_templates.scss +10 -2
  57. package/v2Containers/Templates/index.js +94 -85
  58. package/v2Containers/Templates/messages.js +4 -0
  59. package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +14 -2
  60. package/v2Containers/Templates/tests/index.test.js +182 -0
@@ -0,0 +1,72 @@
1
+ @import '~@capillarytech/cap-ui-library/styles/_variables';
2
+
3
+ // Mobile push phone preview, matched to the Preview and Test phone.
4
+ // TemplatePreview sets `position: unset` on #mobilepush-preview.shell-v2, so the card was placed
5
+ // against a wider ancestor and spilled out of the phone; this re-anchors it to the phone image.
6
+ // Include on a selector that ends in `#mobilepush-preview.shell-v2`.
7
+ @mixin mobile-push-phone-shell {
8
+ position: relative;
9
+ width: 100%;
10
+ max-width: 26.786rem;
11
+ padding: 0;
12
+
13
+ .preview-image {
14
+ width: 100%;
15
+ }
16
+
17
+ .android-push-message-Container,
18
+ .iphone-push-message-Container {
19
+ left: 4%;
20
+ width: 92%;
21
+
22
+ .message-pop {
23
+ padding: $CAP_SPACE_08;
24
+ border-radius: $CAP_SPACE_08;
25
+ background: $CAP_WHITE;
26
+ line-height: normal;
27
+ }
28
+
29
+ .app-header {
30
+ align-items: center;
31
+ flex-wrap: nowrap;
32
+ }
33
+
34
+ .app-header-left {
35
+ flex: 1 1 auto;
36
+ flex-wrap: nowrap;
37
+ min-width: 0;
38
+
39
+ .app-icon {
40
+ flex: none;
41
+ width: $CAP_SPACE_20;
42
+ height: $CAP_SPACE_20;
43
+ background-color: $CAP_COLOR_16;
44
+ }
45
+ }
46
+
47
+ .title {
48
+ max-width: none;
49
+ min-width: 0;
50
+ font-size: $FONT_SIZE_M;
51
+ font-weight: 600;
52
+ color: $FONT_COLOR_01;
53
+ }
54
+
55
+ .app-header-right {
56
+ flex: none;
57
+ flex-wrap: nowrap;
58
+ margin-left: $CAP_SPACE_08;
59
+ gap: $CAP_SPACE_04;
60
+ font-size: $FONT_SIZE_VS;
61
+ }
62
+
63
+ .body-text {
64
+ padding-left: 2.785rem;
65
+ }
66
+
67
+ // Fixed 18.75rem image + left margin is wider than the card on narrow columns
68
+ .body-image img {
69
+ max-width: calc(100% - 1.571rem);
70
+ }
71
+ }
72
+ }
@@ -627,6 +627,12 @@
627
627
  margin-left: 1.571rem;
628
628
  display: block;
629
629
  }
630
+ // Width leaves room for the left inset, so the video stays inside the card
631
+ .mpush-body-video{
632
+ max-width: calc(100% - 1.5rem);
633
+ max-height: 7.5rem;
634
+ margin-left: 1.5rem;
635
+ }
630
636
  }
631
637
  }
632
638
  .mobile-push-carousel-card {
@@ -745,13 +751,23 @@
745
751
  justify-content: space-between;
746
752
  flex-direction: row;
747
753
  gap: $CAP_SPACE_08;
754
+ width: 100%;
755
+ // One button: centred. Two: equal halves, each centred, split by a divider.
748
756
  .action{
757
+ flex: 1 1 0;
758
+ min-width: 0;
759
+ text-align: center;
760
+ white-space: nowrap;
761
+ overflow: hidden;
762
+ text-overflow: ellipsis;
749
763
  font-size: $FONT_SIZE_S;
750
764
  font-weight: 600;
751
- color: #1970DA;
765
+ color: $FONT_COLOR_01;
752
766
  height: 1.25rem;
753
- text-transform: uppercase;
754
767
  cursor: pointer;
768
+ & + .action {
769
+ border-left: 1px solid $CAP_G07;
770
+ }
755
771
  &:hover {
756
772
  text-decoration: underline;
757
773
  }
@@ -168,14 +168,15 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
168
168
  };
169
169
 
170
170
  renderMobilePushCarousel = (content) => {
171
+ // Every card shows, even before its media is uploaded (an empty card keeps its place)
171
172
  if (!content?.carouselData || content?.carouselData?.length === 0) {
172
173
  return null;
173
174
  }
174
175
 
175
176
  return (
176
177
  <CapRow type="flex" vertical noWrap className="msg-container-carousel mobile-push-carousel-container">
177
- <CapRow className="scroll-container mobile-push-scroll-container">
178
- {content?.carouselData?.map((item, idx) => (
178
+ <CapRow type="flex" noWrap className="scroll-container mobile-push-scroll-container">
179
+ {content.carouselData.map((item, idx) => (
179
180
  <CapColumn
180
181
  key={`carousel-card-${idx}`}
181
182
  className="mobile-push-carousel-card message-pop align-left message-pop-carousel"
@@ -187,10 +188,11 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
187
188
  className="carousel-image"
188
189
  />
189
190
  )}
190
- {item?.mediaType?.toLowerCase() === VIDEO && item?.videoPreviewImg && (
191
+ {item?.mediaType?.toLowerCase() === VIDEO && (item?.videoPreviewImg || item?.videoSrc) && (
191
192
  <CapRow className="video-preview">
193
+ {/* No thumbnail from the upload: same placeholder as WhatsApp/RCS */}
192
194
  <CapImage
193
- src={item?.videoPreviewImg || item?.url}
195
+ src={item?.videoPreviewImg || whatsappVideoEmptyPreview}
194
196
  alt="carousel-video-preview"
195
197
  className="carousel-video-preview"
196
198
  />
@@ -879,10 +881,10 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
879
881
  {(() => {
880
882
  if (content?.bodyVideo?.videoSrc && !content?.bodyImage && !content?.bodyGif) {
881
883
  return (
882
- <video
884
+ <video
883
885
  key={`android-video-${content.bodyVideo.videoSrc}`}
884
- controls
885
- style={{ maxWidth: '100%', maxHeight: '120px', marginLeft: '24px' }}
886
+ controls
887
+ className="mpush-body-video"
886
888
  poster={content?.bodyVideo?.videoPreview || undefined}
887
889
  >
888
890
  <source src={content.bodyVideo.videoSrc} type="video/mp4" />
@@ -907,17 +909,17 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
907
909
  )}
908
910
  {(content?.actions || []).filter((action) => action?.label)
909
911
  .length && content?.carouselData?.length === 0 ? (
910
- <CapRow className="actions">
912
+ <CapRow type="flex" noWrap className="actions">
911
913
  {_.map(
912
914
  content?.actions || [],
913
- (action) =>
915
+ (action, index) =>
914
916
  !!action?.label && (
915
917
  <span
916
918
  className="action"
917
- key={`action-${action?.label}`}
919
+ key={`action-${index}`}
918
920
  title={action?.url || ''}
919
921
  >
920
- {action?.label?.toUpperCase()}
922
+ {action?.label}
921
923
  </span>
922
924
  )
923
925
  )}
@@ -943,10 +945,10 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
943
945
  {(() => {
944
946
  if (content?.bodyVideo?.videoSrc && !content?.bodyImage && !content?.bodyGif) {
945
947
  return (
946
- <video
948
+ <video
947
949
  key={`ios-video-${content?.bodyVideo?.videoSrc}`}
948
- controls
949
- style={{ maxWidth: '100%', maxHeight: '120px', marginLeft: '24px' }}
950
+ controls
951
+ className="mpush-body-video"
950
952
  poster={content?.bodyVideo?.videoPreview || undefined}
951
953
  >
952
954
  <source src={content?.bodyVideo?.videoSrc} type="video/mp4" />
@@ -971,17 +973,17 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
971
973
  )}
972
974
  {(content?.actions || []).filter((action) => action?.label)
973
975
  .length && content?.carouselData?.length === 0 ? (
974
- <CapRow className="actions">
976
+ <CapRow type="flex" noWrap className="actions">
975
977
  {_.map(
976
978
  content?.actions || [],
977
- (action) =>
979
+ (action, index) =>
978
980
  !!action?.label && (
979
981
  <span
980
982
  className="action"
981
- key={`action-${action?.label}`}
983
+ key={`action-${index}`}
982
984
  title={action?.url || ''}
983
985
  >
984
- {action?.label?.toUpperCase()}
986
+ {action?.label}
985
987
  </span>
986
988
  )
987
989
  )}
@@ -73,6 +73,75 @@ describe('Test Templates container', () => {
73
73
  expect(renderedComponent).toMatchSnapshot();
74
74
  });
75
75
 
76
+ describe('Mobile push action buttons', () => {
77
+ const renderMobilePush = (device, actions) => {
78
+ renderedComponent = shallowWithIntl(
79
+ <TemplatePreview
80
+ channel="MOBILEPUSH"
81
+ device={device}
82
+ content={{ header: 'Title', bodyText: 'Body', actions, carouselData: [] }}
83
+ />,
84
+ );
85
+ return renderedComponent.find('.actions');
86
+ };
87
+
88
+ it.each(['android', 'ios'])('renders labels as typed on one flex row with index keys (%s)', (device) => {
89
+ const row = renderMobilePush(device, [
90
+ { label: 'Shop', url: 'https://a.com' },
91
+ { label: 'Shop' },
92
+ { label: '' },
93
+ ]);
94
+ const buttons = row.find('.action');
95
+
96
+ expect(row.props()).toEqual(expect.objectContaining({ type: 'flex', noWrap: true }));
97
+ expect(buttons).toHaveLength(2);
98
+ expect(buttons.map((button) => button.key())).toEqual(['action-0', 'action-1']);
99
+ expect(buttons.map((button) => button.text())).toEqual(['Shop', 'Shop']);
100
+ expect(buttons.at(0).prop('title')).toBe('https://a.com');
101
+ });
102
+
103
+ const renderCarousel = (device, carouselData) => {
104
+ renderedComponent = shallowWithIntl(
105
+ <TemplatePreview
106
+ channel="MOBILEPUSH"
107
+ device={device}
108
+ content={{ header: 'Title', carouselData }}
109
+ />,
110
+ );
111
+ };
112
+
113
+ it.each(['android', 'ios'])('shows every card, with or without media, in one horizontal row (%s)', (device) => {
114
+ renderCarousel(device, [
115
+ { mediaType: 'IMAGE', imageUrl: 'https://a.url' },
116
+ { mediaType: 'IMAGE' },
117
+ { mediaType: 'VIDEO', videoPreviewImg: 'https://b.url' },
118
+ ]);
119
+ const scrollRow = renderedComponent.find('.scroll-container');
120
+
121
+ expect(scrollRow.props()).toEqual(expect.objectContaining({ type: 'flex', noWrap: true }));
122
+ expect(renderedComponent.find('.mobile-push-carousel-card')).toHaveLength(3);
123
+ });
124
+
125
+ it.each(['android', 'ios'])('shows a video card with no thumbnail as the video placeholder (%s)', (device) => {
126
+ renderCarousel(device, [{ mediaType: 'video', videoSrc: 'https://v.mp4' }]);
127
+ expect(renderedComponent.find('.mobile-push-carousel-card')).toHaveLength(1);
128
+ expect(renderedComponent.find('video')).toHaveLength(0);
129
+ expect(renderedComponent.find('.carousel-video-preview').prop('src')).toBe('test-file-stub');
130
+ });
131
+
132
+ it.each(['android', 'ios'])('shows an empty card while no media is uploaded (%s)', (device) => {
133
+ renderCarousel(device, [{ mediaType: 'IMAGE' }]);
134
+ expect(renderedComponent.find('.mobile-push-carousel-container')).toHaveLength(1);
135
+ expect(renderedComponent.find('.mobile-push-carousel-card')).toHaveLength(1);
136
+ expect(renderedComponent.find('.carousel-image')).toHaveLength(0);
137
+ });
138
+
139
+ it.each(['android', 'ios'])('shows no carousel when there are no cards (%s)', (device) => {
140
+ renderCarousel(device, []);
141
+ expect(renderedComponent.find('.mobile-push-carousel-container')).toHaveLength(0);
142
+ });
143
+ });
144
+
76
145
  describe('RCS carousel preview branches', () => {
77
146
  const buildRcsContent = (cards) => ({
78
147
  rcsPreviewContent: {
@@ -88,6 +88,8 @@ TestAndPreviewSlidebox.propTypes = {
88
88
  /** Passed to CommonTestAndPreview for RCS test-meta resolution (slot semantics vs full-mode). */
89
89
  rcsTestPreviewOptions: PropTypes.shape({
90
90
  isLibraryMode: PropTypes.bool,
91
+ /** RCS multi-account: template account's sourceAccountIdentifier; scopes RCS senders to that account. */
92
+ sourceAccountIdentifier: PropTypes.string,
91
93
  }),
92
94
  // Redux props are passed through
93
95
  actions: PropTypes.object.isRequired,
@@ -0,0 +1,45 @@
1
+ import extractContentForPreview from '../extractContentForPreview';
2
+
3
+ const extractMpush = (androidContent, iosContent = {}) => extractContentForPreview({
4
+ channel: 'MOBILEPUSH',
5
+ templateData: { androidContent, iosContent },
6
+ }).content;
7
+
8
+ describe('extractContentForPreview - Mobile Push', () => {
9
+ it('passes each saved notification tap (cta) for the test send', () => {
10
+ const androidCta = { type: 'DEEP_LINK', actionLink: 'app://home' };
11
+ const iosCta = { type: 'EXTERNAL_URL', actionLink: 'https://x.com' };
12
+
13
+ const content = extractMpush({ title: 'A', cta: androidCta }, { title: 'I', cta: iosCta });
14
+
15
+ expect(content.androidContent.cta).toEqual(androidCta);
16
+ expect(content.iosContent.cta).toEqual(iosCta);
17
+ });
18
+
19
+ it('maps a saved video to the { videoSrc, videoPreview } shape the test send reads', () => {
20
+ const content = extractMpush(
21
+ { expandableDetails: { style: 'VIDEO', media: [{ url: 'https://a.mp4', type: 'VIDEO', videoPreviewUrl: 'https://a.jpg' }] } },
22
+ { expandableDetails: { style: 'VIDEO', media: [{ url: 'https://i.mp4', type: 'VIDEO' }] } },
23
+ );
24
+
25
+ expect(content.androidContent.bodyVideo).toEqual({ videoSrc: 'https://a.mp4', videoPreview: 'https://a.jpg' });
26
+ expect(content.iosContent.bodyVideo).toEqual({ videoSrc: 'https://i.mp4', videoPreview: '' });
27
+ });
28
+
29
+ it('gives no body video for a carousel whose first card is a video', () => {
30
+ const cards = [{ mediaType: 'video', videoSrc: 'https://c.mp4' }];
31
+ const content = extractMpush({
32
+ expandableDetails: { style: 'MANUAL_CAROUSEL', media: [{ url: 'https://c.mp4', type: 'VIDEO' }], carouselData: cards },
33
+ });
34
+
35
+ expect(content.androidContent.bodyVideo).toEqual({});
36
+ expect(content.androidContent.carouselData).toEqual(cards);
37
+ });
38
+
39
+ it('gives no video or cta for a text template', () => {
40
+ const content = extractMpush({ title: 'A', expandableDetails: { style: 'BIG_TEXT' } });
41
+
42
+ expect(content.androidContent.bodyVideo).toEqual({});
43
+ expect(content.androidContent.cta).toBeUndefined();
44
+ });
45
+ });
@@ -3,6 +3,7 @@ import {
3
3
  TEXT, IMAGE, VIDEO, DOCUMENT, CTA, QUICK_REPLY,
4
4
  } from '../../../CreativesContainer/constants';
5
5
  import { getWhatsappDocPreview } from '../../../Whatsapp/utils';
6
+ import { MANUAL_CAROUSEL } from '../../../MobilePushNew/constants';
6
7
 
7
8
  const extractSmsContent = (templateData) => {
8
9
  const smsBody = templateData.messageBody || templateData.smsBody || '';
@@ -20,19 +21,28 @@ const extractEmailContent = (templateData) => {
20
21
  return { content: emailContent, formData };
21
22
  };
22
23
 
24
+ // Saved media[0] is { url, type }; the test send reads { videoSrc, videoPreview }. A carousel's media are its cards
25
+ const toPreviewVideo = (style, media) => {
26
+ const { type, url, videoPreviewUrl } = media[0] || {};
27
+ return style !== MANUAL_CAROUSEL && type === VIDEO && url ? { videoSrc: url, videoPreview: videoPreviewUrl || '' } : {};
28
+ };
29
+
23
30
  const extractMobilePushDevice = ({
24
31
  title = '',
25
32
  message = '',
33
+ cta,
26
34
  expandableDetails: {
27
- image = '', media = [], ctas = [], carouselData = [],
35
+ style, image = '', media = [], ctas = [], carouselData = [],
28
36
  } = {},
29
37
  } = {}) => ({
30
38
  header: title,
31
39
  bodyText: message,
32
40
  bodyImage: image,
33
- bodyVideo: media[0] || null,
41
+ bodyVideo: toPreviewVideo(style, media),
34
42
  bodyGif: '',
35
43
  actions: ctas,
44
+ // Notification tap, read by the test send
45
+ cta,
36
46
  carouselData,
37
47
  });
38
48
 
@@ -90,6 +90,18 @@ const DeliverySettingsSection = ({
90
90
  return waContentItem?.templateData?.sourceAccountIdentifier || '';
91
91
  }, [contentItems]);
92
92
 
93
+ // Extract RCS sourceAccountIdentifier from contentItems (set by CreativesContainer for multi-account RCS)
94
+ const rcsSourceAccountId = useMemo(() => {
95
+ const rcsContentItem = contentItems.find((contentItem) => (contentItem.channel)?.toUpperCase() === RCS);
96
+ return rcsContentItem?.templateData?.sourceAccountIdentifier || '';
97
+ }, [contentItems]);
98
+
99
+ // Account context for account-bound fields (WhatsApp WABA, RCS account)
100
+ const accountContext = useMemo(() => ({
101
+ whatsappSourceAccountId,
102
+ rcsSourceAccountId,
103
+ }), [whatsappSourceAccountId, rcsSourceAccountId]);
104
+
93
105
  // Extract WhatsApp account name from contentItems (set by Whatsapp/index.js)
94
106
  const whatsappAccNameFromContent = useMemo(() => {
95
107
  const waContentItem = contentItems.find((contentItem) => (contentItem.channel)?.toUpperCase() === WHATSAPP);
@@ -221,7 +233,7 @@ const DeliverySettingsSection = ({
221
233
  if (!entityWithWecrmViber || !onDeliverySettingChange || deliveryChannels.length === 0) return;
222
234
 
223
235
  // Convert the API entity into the channelSetting shape (e.g. { SMS: { gsmSenderId: '...' } })
224
- const senderDetailsFromAPI = parseSenderDetailsFromEntity(entityWithWecrmViber, { whatsappSourceAccountId });
236
+ const senderDetailsFromAPI = parseSenderDetailsFromEntity(entityWithWecrmViber, accountContext);
225
237
  const channelSettingFromAPI = buildChannelSettingFromFieldValues(senderDetailsFromAPI);
226
238
 
227
239
  const savedChannelSetting = deliverySetting?.channelSetting || {};
@@ -252,13 +264,13 @@ const DeliverySettingsSection = ({
252
264
 
253
265
  const parsedSenderDetails = useMemo(() => {
254
266
  if (!entityWithWecrmViber) return null;
255
- const fromEntity = parseSenderDetailsFromEntity(entityWithWecrmViber, { whatsappSourceAccountId });
267
+ const fromEntity = parseSenderDetailsFromEntity(entityWithWecrmViber, accountContext);
256
268
  const fromSaved = parseChannelSettingForDisplay(deliverySetting?.channelSetting);
257
269
  // Derive WhatsApp account name: from entity domain or from content templateData
258
270
  const waAccountName = whatsappAccNameFromContent
259
271
  || getWhatsappAccountName(entityWithWecrmViber, whatsappSourceAccountId);
260
272
  return { ...fromEntity, ...fromSaved, whatsappAccountName: waAccountName || fromEntity.whatsappAccountName };
261
- }, [entityWithWecrmViber, deliverySetting, whatsappSourceAccountId, whatsappAccNameFromContent]);
273
+ }, [entityWithWecrmViber, deliverySetting, accountContext, whatsappSourceAccountId, whatsappAccNameFromContent]);
262
274
 
263
275
  // Map channel -> { labelKey, valueKey } or array of { labelKey, valueKey } for summary display
264
276
  // SMS, RCS, EMAIL, VIBER: Sender ID | WHATSAPP: Sender number | LINE: Account
@@ -351,6 +363,7 @@ const DeliverySettingsSection = ({
351
363
  isLoadingDomainProperties={isFetchingDomains}
352
364
  savedFieldValues={parseChannelSettingForDisplay(deliverySetting?.channelSetting)}
353
365
  whatsappSourceAccountId={whatsappSourceAccountId}
366
+ rcsSourceAccountId={rcsSourceAccountId}
354
367
  whatsappAccountName={whatsappAccNameFromContent || getWhatsappAccountName(entityWithWecrmViber, whatsappSourceAccountId)}
355
368
  onSave={handleDeliverySettingSave}
356
369
  />
@@ -47,6 +47,7 @@ const SenderDetails = ({
47
47
  savedFieldValues,
48
48
  onSave,
49
49
  whatsappSourceAccountId,
50
+ rcsSourceAccountId,
50
51
  whatsappAccountName,
51
52
  intl,
52
53
  }) => {
@@ -64,7 +65,8 @@ const SenderDetails = ({
64
65
  // Context for WABA-bound fields (WhatsApp sender number filtered by sourceAccountIdentifier)
65
66
  const wabaContext = useMemo(() => ({
66
67
  whatsappSourceAccountId: whatsappSourceAccountId || '',
67
- }), [whatsappSourceAccountId]);
68
+ rcsSourceAccountId: rcsSourceAccountId || '',
69
+ }), [whatsappSourceAccountId, rcsSourceAccountId]);
68
70
 
69
71
  // Only use preloaded data from parent (DeliverySettingsSection) - no fetch here to avoid duplicate API calls
70
72
  // When reopening, use savedFieldValues to restore user's last saved selections
@@ -83,7 +85,7 @@ const SenderDetails = ({
83
85
  initial.whatsappAccount = whatsappAccountName;
84
86
  }
85
87
  // Set RCS account name (disabled field)
86
- const rcsAccName = getRcsAccountName(preloadedDomainProperties);
88
+ const rcsAccName = getRcsAccountName(preloadedDomainProperties, rcsSourceAccountId);
87
89
  if (rcsAccName) {
88
90
  initial.rcsAccount = rcsAccName;
89
91
  }
@@ -322,6 +324,8 @@ SenderDetails.propTypes = {
322
324
  savedFieldValues: PropTypes.object,
323
325
  onSave: PropTypes.func,
324
326
  whatsappSourceAccountId: PropTypes.string,
327
+ /** RCS multi-account: template account's sourceAccountIdentifier; binds RCS fields to its domain. */
328
+ rcsSourceAccountId: PropTypes.string,
325
329
  whatsappAccountName: PropTypes.string,
326
330
  intl: PropTypes.object.isRequired,
327
331
  };
@@ -333,6 +337,7 @@ SenderDetails.defaultProps = {
333
337
  savedFieldValues: null,
334
338
  onSave: null,
335
339
  whatsappSourceAccountId: '',
340
+ rcsSourceAccountId: '',
336
341
  whatsappAccountName: '',
337
342
  };
338
343
 
@@ -340,6 +340,50 @@ describe('deliverySettingsConfig — user-facing flows', () => {
340
340
  });
341
341
  });
342
342
 
343
+ describe('RCS: multi-account binding by sourceAccountIdentifier', () => {
344
+ const rcsRow = (domainName, sender, connectionProperties) => ({
345
+ domainProperties: {
346
+ domainName,
347
+ ...(connectionProperties && { connectionProperties }),
348
+ contactInfo: [{
349
+ type: 'gsm_sender_id', value: sender, valid: true, default: true,
350
+ }],
351
+ },
352
+ });
353
+ const multiAccountEntity = {
354
+ RCS: [
355
+ rcsRow('Brand A', '+rcsA', { sourceAccountIdentifier: 'acc-A' }),
356
+ rcsRow('Brand B', '+rcsB', { sourceAccountIdentifier: 'acc-B' }),
357
+ ],
358
+ };
359
+
360
+ it('binds account name and sender number to the template account domain', () => {
361
+ expect(getRcsAccountName(multiAccountEntity, 'acc-B')).toBe('Brand B');
362
+ const summary = parseEntityForDisplay(multiAccountEntity, { rcsSourceAccountId: 'acc-B' });
363
+ expect(summary.rcsAccountName).toBe('Brand B');
364
+ expect(summary.rcsSenderNumber).toBe('+rcsB');
365
+ expect(summary.senderNumber).toBe('+rcsB');
366
+ });
367
+
368
+ it('falls back to the first RCS domain when the account is unknown', () => {
369
+ expect(getRcsAccountName(multiAccountEntity, 'unknown')).toBe('Brand A');
370
+ const summary = parseEntityForDisplay(multiAccountEntity, { rcsSourceAccountId: 'unknown' });
371
+ expect(summary.rcsSenderNumber).toBe('+rcsA');
372
+ });
373
+
374
+ it('falls back to the first RCS domain when no account is passed (single-account behaviour)', () => {
375
+ expect(getRcsAccountName(multiAccountEntity)).toBe('Brand A');
376
+ expect(parseEntityForDisplay(multiAccountEntity).rcsSenderNumber).toBe('+rcsA');
377
+ });
378
+
379
+ it('does not let the RCS account change the WhatsApp sender number', () => {
380
+ const combined = { ...domainPropertiesFromApi, RCS: multiAccountEntity.RCS };
381
+ const summary = parseEntityForDisplay(combined, { rcsSourceAccountId: 'acc-B' });
382
+ expect(summary.senderNumber).toBe('+wa1');
383
+ expect(summary.rcsSenderNumber).toBe('+rcsB');
384
+ });
385
+ });
386
+
343
387
  describe('Viber: gateway id 0 + alternate API sender types', () => {
344
388
  it('uses viber_sender_id when GSM is not present (API variance)', () => {
345
389
  const entity = domainPropertiesFromApi;
@@ -348,15 +348,27 @@ const getWhatsappSenderNumberOptions = (entity, context = {}) => {
348
348
  return options?.map((option) => ({ label: option.value || option.label, value: option.value || option.label }));
349
349
  };
350
350
 
351
- const getRcsSenderNumberValue = (entity) => {
352
- const channelData = getChannelData(entity, 'RCS');
351
+ // --- RCS account-bound domain (multi-account) ---
352
+ // Same as WhatsApp: the RCS template carries its account's sourceAccountIdentifier (contentItems templateData),
353
+ // matched against the domain's connectionProperties; falls back to the first RCS domain when unknown or unmatched.
354
+
355
+ /** Find the RCS domain matching a sourceAccountIdentifier */
356
+ const getRcsDomainBySourceAccount = (entity, sourceAccountId) => {
357
+ const rcsDomains = toArray(entity?.RCS);
358
+ if (!sourceAccountId) return rcsDomains?.length ? rcsDomains[0] : null;
359
+ const matchedDomain = rcsDomains.find((domain) => getDomainSourceAccountId(domain) === sourceAccountId);
360
+ return matchedDomain || (rcsDomains?.length ? rcsDomains[0] : null);
361
+ };
362
+
363
+ const getRcsSenderNumberValue = (entity, context = {}) => {
364
+ const channelData = getRcsDomainBySourceAccount(entity, context?.rcsSourceAccountId);
353
365
  if (!channelData) return '';
354
366
  return getValueFromContactInfo(channelData, 'gsm_sender_id', ['cdma_sender_id']);
355
367
  };
356
368
 
357
- /** Get RCS account name from first domain (like campaigns-v2: rcsSender display) */
358
- export const getRcsAccountName = (entity) => {
359
- const rcsData = getChannelData(entity, 'RCS');
369
+ /** Get RCS account name from the account's domain (like campaigns-v2: rcsSender display) */
370
+ export const getRcsAccountName = (entity, sourceAccountId = '') => {
371
+ const rcsData = getRcsDomainBySourceAccount(entity, sourceAccountId);
360
372
  if (!rcsData) return '';
361
373
  return rcsData.domainProperties?.domainName || rcsData.domainName || rcsData.label || '';
362
374
  };
@@ -623,6 +635,7 @@ export const getFieldsForChannels = (channels = []) => {
623
635
  export const parseEntityForDisplay = (entity, context = {}) => {
624
636
  if (!entity) return null;
625
637
  const whatsappSourceAccountId = context?.whatsappSourceAccountId || '';
638
+ const rcsSourceAccountId = context?.rcsSourceAccountId || '';
626
639
  return {
627
640
  senderDetails: entity,
628
641
  smsSenderId: getSmsSenderIdValue(entity),
@@ -637,12 +650,12 @@ export const parseEntityForDisplay = (entity, context = {}) => {
637
650
  lineSenderId: getSenderIdFromContactInfo(entity, 'LINE'),
638
651
  whatsappSenderNumber: getWhatsappSenderNumberValue(entity, { whatsappSourceAccountId }),
639
652
  whatsappAccountName: getWhatsappAccountName(entity, whatsappSourceAccountId),
640
- rcsSenderNumber: getRcsSenderNumberValue(entity),
641
- rcsAccountName: getRcsAccountName(entity),
653
+ rcsSenderNumber: getRcsSenderNumberValue(entity, { rcsSourceAccountId }),
654
+ rcsAccountName: getRcsAccountName(entity, rcsSourceAccountId),
642
655
  // RCS SMS-fallback: sourced from the SMS domain data (same as the SMS channel's own fields).
643
656
  rcsSmsFallbackDomain: getSmsDomainValue(entity),
644
657
  rcsSmsFallbackSenderId: getSmsSenderIdValue(entity),
645
- senderNumber: getWhatsappSenderNumberValue(entity, { whatsappSourceAccountId }) || getRcsSenderNumberValue(entity),
658
+ senderNumber: getWhatsappSenderNumberValue(entity, { whatsappSourceAccountId }) || getRcsSenderNumberValue(entity, { rcsSourceAccountId }),
646
659
  };
647
660
  };
648
661
 
@@ -848,9 +848,7 @@ export function SlideBoxContent(props) {
848
848
  })()
849
849
  )}
850
850
  {isEditMPush && (
851
- (isFullMode && !commonUtil.hasNewMobilePushFeatureEnabled()) ||
852
- (!isFullMode && isLoyaltyModule) ||
853
- (!isFullMode && !isLoyaltyModule && !commonUtil.hasNewMobilePushFeatureEnabled()) ? (
851
+ !isFullMode && isLoyaltyModule ? (
854
852
  <MobliPushEdit
855
853
  getFormLibraryData={getFormData}
856
854
  setIsLoadingContent={setIsLoadingContent}
@@ -912,6 +910,8 @@ export function SlideBoxContent(props) {
912
910
  waitEventContextTags={waitEventContextTags}
913
911
  showLiquidErrorInFooter={showLiquidErrorInFooter}
914
912
  handleClose={handleClose}
913
+ showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
914
+ handleCloseTestAndPreview={handleCloseTestAndPreview}
915
915
  restrictPersonalization={restrictPersonalization}
916
916
  isAnonymousType={isAnonymousType}
917
917
  onPersonalizationTokensChange={onPersonalizationTokensChange}
@@ -920,9 +920,7 @@ export function SlideBoxContent(props) {
920
920
  )
921
921
  )}
922
922
  {isCreateMPush && (
923
- (isFullMode && !commonUtil.hasNewMobilePushFeatureEnabled()) ||
924
- (!isFullMode && isLoyaltyModule) ||
925
- (!isFullMode && !isLoyaltyModule && !commonUtil.hasNewMobilePushFeatureEnabled()) ? (
923
+ !isFullMode && isLoyaltyModule ? (
926
924
  <MobilepushWrapper
927
925
  key="creatives-mobilepush-wrapper"
928
926
  date={new Date().getMilliseconds()}