@capillarytech/creatives-library 9.0.15-alpha.3 → 9.0.16-beta.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 (146) hide show
  1. package/AppRoot.js +80 -0
  2. package/app.js +5 -3
  3. package/constants/unified.js +0 -29
  4. package/entry.js +67 -1
  5. package/global-styles.js +1 -1
  6. package/mfe-exposed-components.js +2 -4
  7. package/package.json +2 -2
  8. package/services/api.js +1 -1
  9. package/services/tests/api.test.js +20 -35
  10. package/styles/containers/layout/_layoutPage.scss +8 -6
  11. package/utils/commonUtils.js +1 -19
  12. package/utils/getDataLayer.js +15 -0
  13. package/utils/gtmTrackers/gtmEvents/creativeDetails.js +2 -1
  14. package/utils/mfeDetect.js +1 -0
  15. package/v2Components/CapActionButton/constants.js +1 -8
  16. package/v2Components/CapActionButton/index.js +144 -202
  17. package/v2Components/CapActionButton/index.scss +14 -232
  18. package/v2Components/CapActionButton/messages.js +3 -19
  19. package/v2Components/CapActionButton/tests/index.test.js +18 -42
  20. package/v2Components/CapImageUpload/index.js +2 -2
  21. package/v2Components/CapTagList/index.js +0 -10
  22. package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +48 -70
  23. package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
  24. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -214
  25. package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
  26. package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +9 -83
  27. package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
  28. package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -60
  29. package/v2Components/CommonTestAndPreview/SendTestMessage.js +5 -10
  30. package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +22 -202
  31. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +80 -381
  32. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +8 -155
  33. package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +0 -11
  34. package/v2Components/CommonTestAndPreview/constants.js +2 -38
  35. package/v2Components/CommonTestAndPreview/index.js +222 -761
  36. package/v2Components/CommonTestAndPreview/messages.js +3 -45
  37. package/v2Components/CommonTestAndPreview/sagas.js +6 -25
  38. package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -1
  39. package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +267 -284
  40. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +65 -231
  41. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +5 -118
  42. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -341
  43. package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +1 -8
  44. package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +13 -34
  45. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +283 -281
  46. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
  47. package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -133
  48. package/v2Components/CommonTestAndPreview/tests/sagas.test.js +24 -31
  49. package/v2Components/NavigationBar/index.js +9 -7
  50. package/v2Components/NavigationBar/mfeModuleHeader.config.js +16 -0
  51. package/v2Components/Pagination/_pagination.scss +2 -0
  52. package/v2Components/TemplatePreview/_templatePreview.scss +25 -45
  53. package/v2Components/TemplatePreview/index.js +32 -147
  54. package/v2Components/TemplatePreview/tests/index.test.js +0 -142
  55. package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +6 -6
  56. package/v2Components/TestAndPreviewSlidebox/index.js +1 -13
  57. package/v2Components/TestAndPreviewSlidebox/sagas.js +4 -11
  58. package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +1 -3
  59. package/v2Containers/Cap/constants.js +1 -0
  60. package/v2Containers/Cap/index.js +47 -21
  61. package/v2Containers/Cap/sagas.js +19 -0
  62. package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +1 -4
  63. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +0 -4
  64. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +20 -20
  65. package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -37
  66. package/v2Containers/CreativesContainer/SlideBoxFooter.js +5 -14
  67. package/v2Containers/CreativesContainer/SlideBoxHeader.js +5 -36
  68. package/v2Containers/CreativesContainer/constants.js +0 -11
  69. package/v2Containers/CreativesContainer/index.js +104 -323
  70. package/v2Containers/CreativesContainer/index.scss +1 -83
  71. package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -79
  72. package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +16 -79
  73. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -8
  74. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +90 -333
  75. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +15 -20
  76. package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
  77. package/v2Containers/MobilePush/Create/test/saga.test.js +2 -2
  78. package/v2Containers/Rcs/constants.js +11 -131
  79. package/v2Containers/Rcs/index.js +829 -2682
  80. package/v2Containers/Rcs/index.scss +8 -443
  81. package/v2Containers/Rcs/messages.js +6 -45
  82. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +39409 -74176
  83. package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +74 -10
  84. package/v2Containers/Rcs/tests/index.test.js +40 -151
  85. package/v2Containers/Rcs/tests/mockData.js +0 -38
  86. package/v2Containers/Rcs/tests/utils.test.js +30 -643
  87. package/v2Containers/Rcs/utils.js +12 -466
  88. package/v2Containers/Sms/Create/index.js +48 -115
  89. package/v2Containers/SmsTrai/Create/index.js +4 -9
  90. package/v2Containers/SmsTrai/Edit/constants.js +0 -2
  91. package/v2Containers/SmsTrai/Edit/index.js +169 -678
  92. package/v2Containers/SmsTrai/Edit/messages.js +4 -14
  93. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2854 -5455
  94. package/v2Containers/SmsWrapper/index.js +8 -37
  95. package/v2Containers/TagList/index.js +0 -6
  96. package/v2Containers/Templates/_templates.scss +11 -196
  97. package/v2Containers/Templates/actions.js +0 -11
  98. package/v2Containers/Templates/constants.js +0 -2
  99. package/v2Containers/Templates/index.js +60 -131
  100. package/v2Containers/Templates/sagas.js +13 -57
  101. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1015 -1060
  102. package/v2Containers/Templates/tests/sagas.test.js +16 -199
  103. package/v2Containers/TemplatesV2/TemplatesV2.style.js +10 -75
  104. package/v2Containers/TemplatesV2/index.js +43 -86
  105. package/v2Containers/WeChat/MapTemplates/test/saga.test.js +9 -9
  106. package/v2Containers/Whatsapp/index.js +25 -4
  107. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -578
  108. package/utils/rcsPayloadUtils.js +0 -92
  109. package/utils/templateVarUtils.js +0 -201
  110. package/utils/tests/rcsPayloadUtils.test.js +0 -226
  111. package/utils/tests/templateVarUtils.test.js +0 -204
  112. package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
  113. package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
  114. package/v2Components/CommonTestAndPreview/utils.js +0 -84
  115. package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -91
  116. package/v2Components/SmsFallback/constants.js +0 -94
  117. package/v2Components/SmsFallback/index.js +0 -958
  118. package/v2Components/SmsFallback/index.scss +0 -266
  119. package/v2Components/SmsFallback/messages.js +0 -78
  120. package/v2Components/SmsFallback/smsFallbackUtils.js +0 -120
  121. package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +0 -50
  122. package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +0 -147
  123. package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +0 -304
  124. package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +0 -208
  125. package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -309
  126. package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
  127. package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
  128. package/v2Components/TemplatePreview/constants.js +0 -2
  129. package/v2Components/VarSegmentMessageEditor/constants.js +0 -2
  130. package/v2Components/VarSegmentMessageEditor/index.js +0 -125
  131. package/v2Components/VarSegmentMessageEditor/index.scss +0 -46
  132. package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +0 -17
  133. package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -79
  134. package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +0 -90
  135. package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +0 -258
  136. package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +0 -125
  137. package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +0 -227
  138. package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -318
  139. package/v2Containers/Sms/smsFormDataHelpers.js +0 -67
  140. package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +0 -253
  141. package/v2Containers/SmsTrai/Edit/index.scss +0 -126
  142. package/v2Containers/Templates/TemplatesActionBar.js +0 -101
  143. package/v2Containers/Templates/tests/TemplatesActionBar.test.js +0 -120
  144. package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +0 -180
  145. package/v2Containers/Templates/utils/smsTemplatesListApi.js +0 -79
  146. package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +0 -131
@@ -30,6 +30,7 @@ import {
30
30
  REQUEST,
31
31
  DEFAULT,
32
32
  ENABLE_PRODUCT_SUPPORT_VIDEOS,
33
+ ENABLE_NEW_LEFT_NAVIGATION,
33
34
  CAMPAIGN_SETTINGS_URL,
34
35
  } from './constants';
35
36
  import './_cap.scss';
@@ -53,7 +54,8 @@ import { v2ViberSagas } from '../Viber/sagas';
53
54
  import { v2FacebookSagas } from '../Facebook/sagas';
54
55
  import createReducer from '../Line/Container/reducer';
55
56
  import { DAEMON } from '@capillarytech/vulcan-react-sdk/utils/sagaInjectorTypes';
56
- const gtm = window.dataLayer || [];
57
+ import { getDataLayer } from '../../utils/getDataLayer';
58
+ const gtm = getDataLayer();
57
59
  const {
58
60
  logNewTab,
59
61
  utilsGetOrgNameFromId,
@@ -72,18 +74,19 @@ const CapWrapper = styled.div`
72
74
  min-height: 100%;
73
75
  padding: 0;
74
76
  flex-direction: column;
77
+ position: relative;
75
78
  `;
76
79
  GA.initialize({ accessKey: GTM_TRACKING_ID, trackUIError: true, trackLoadPerformance: 'creatives' });
77
80
 
78
81
  const MainWrapper = styled.div`
79
82
  position: relative;
80
- min-height: calc(100vh - 5.29rem);
81
- top: 4.72rem;
83
+ min-height: 100%;
84
+ top: 0;
82
85
  `;
83
86
 
84
87
  const ContentWrapper = styled.div`
85
88
  && {
86
- margin-left: ${(props) => (props.leftNavbarExpanded ? '17rem' : '4.475rem')};
89
+ margin-left: 0;
87
90
  }
88
91
  `;
89
92
 
@@ -500,6 +503,8 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
500
503
  const type = this.props.location.query.type;
501
504
  const toastMessages = this.props.Global.messages;
502
505
  const { isCreativesAccessible, showOrgChangeModal, showRefreshModal } = this.state;
506
+ const { accessibleFeatures = [] } = currentOrgDetails;
507
+ const isLatestLeftNavigationEnabled = accessibleFeatures.includes(ENABLE_NEW_LEFT_NAVIGATION);
503
508
  return (
504
509
  <CapWrapper>
505
510
  { this.props.loader.localeLoading || this.props.Global.fetching_userdata ?
@@ -537,26 +542,47 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
537
542
  campaignOrgV2Status={currentOrgDetails.org_campaign_v2_status}
538
543
  handleLeftNavBarExpanded={this.handleLeftNavBarExpanded}
539
544
  leftNavbarExpandedProp={this.state.leftNavbarExpanded}
540
- />) : ''}
541
- <MainWrapper className="main">
542
545
 
543
- <ContentWrapper
544
- className={`main-content ${this.state.leftNavbarExpanded ? "contet-width-collapse" : "content-width-expanded"}`}
545
- leftNavbarExpanded={this.state.leftNavbarExpanded}
546
546
  >
547
- <Switch>
548
- {componentRoutes.map(routeProps => {
549
- return (
550
- <RenderRoute
551
- {...routeProps}
552
- key={routeProps.path}
553
- isLoggedIn={isLoggedIn}
554
- />
547
+ <MainWrapper isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled} className="main">
548
+ <ContentWrapper
549
+ className={`main-content ${this.state.leftNavbarExpanded ? "contet-width-collapse" : "content-width-expanded"}`}
550
+ isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled}
551
+ leftNavbarExpanded={this.state.leftNavbarExpanded}
552
+ >
553
+ <Switch>
554
+ {componentRoutes.map(routeProps => {
555
+ return (
556
+ <RenderRoute
557
+ {...routeProps}
558
+ key={routeProps.path}
559
+ isLoggedIn={isLoggedIn}
560
+ />
561
+ )}
562
+ )}
563
+ </Switch>
564
+ </ContentWrapper>
565
+ </MainWrapper>
566
+ </NavigationBar>) : (
567
+ <MainWrapper isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled} className="main">
568
+ <ContentWrapper
569
+ className={`main-content ${this.state.leftNavbarExpanded ? "contet-width-collapse" : "content-width-expanded"}`}
570
+ isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled}
571
+ leftNavbarExpanded={this.state.leftNavbarExpanded}
572
+ >
573
+ <Switch>
574
+ {componentRoutes.map(routeProps => {
575
+ return (
576
+ <RenderRoute
577
+ {...routeProps}
578
+ key={routeProps.path}
579
+ isLoggedIn={isLoggedIn}
580
+ />
581
+ )}
555
582
  )}
556
- )}
557
- </Switch>
558
- </ContentWrapper>
559
- </MainWrapper>
583
+ </Switch>
584
+ </ContentWrapper>
585
+ </MainWrapper>)}
560
586
  </div>
561
587
  {(toastMessages && toastMessages.length > 0) &&
562
588
  toastMessages.map((message) => {
@@ -7,6 +7,7 @@ import {
7
7
  // import { normalize } from 'normalizr';
8
8
  import * as Api from '../../services/api';
9
9
  import * as LocalStorage from '../../services/localStorageApi';
10
+ import { isMFEMode } from '../../utils/mfeDetect';
10
11
  import * as types from './constants';
11
12
  import config from '../../config/app';
12
13
  //import pathConfig from '../../config/path';
@@ -82,6 +83,24 @@ export function* logoutFlow() {
82
83
 
83
84
  export function* fetchUserInfo(option) {
84
85
  try {
86
+ if (isMFEMode()) {
87
+ const userData = LocalStorage.loadItem('user');
88
+ const currentOrgId = LocalStorage.loadItem('orgID');
89
+ const storedOrgDetails = LocalStorage.loadItem('currentOrgDetails');
90
+ const currentOrgDetails = {
91
+ ...(storedOrgDetails || {}),
92
+ accessibleFeatures: window.capAuth?.accessibleFeatures || [],
93
+ };
94
+ yield put({
95
+ type: types.GET_USER_DATA_SUCCESS,
96
+ userData: userData || {},
97
+ currentOrgId,
98
+ currentOrgDetails,
99
+ });
100
+ if (option.callback) option.callback(userData, currentOrgDetails);
101
+ return;
102
+ }
103
+
85
104
  const result = yield call(Api.getUserData);
86
105
  if (result?.isError || result?.status === 401) {
87
106
  yield call(LocalStorage.clearItem, 'user');
@@ -30,7 +30,7 @@ jest.mock('../../CreativesContainer', () => function MockCreativesContainer({
30
30
  import { Provider } from 'react-redux';
31
31
  import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
32
32
  import {
33
- render as rtlRender, screen, waitFor, within, fireEvent,
33
+ render as rtlRender, screen, waitFor, within,
34
34
  } from '@testing-library/react';
35
35
  import userEvent from '@testing-library/user-event';
36
36
  import '@testing-library/jest-dom';
@@ -47,9 +47,6 @@ import {
47
47
  STEPS,
48
48
  } from '../constants';
49
49
 
50
- // antd Select/Dropdown interactions are slow under the parallel jest suite
51
- jest.setTimeout(15000);
52
-
53
50
  let store;
54
51
 
55
52
  beforeAll(() => {
@@ -24,10 +24,6 @@ jest.mock('../../../../../services/localStorageApi', () => ({
24
24
  loadItem: jest.fn(),
25
25
  }));
26
26
 
27
- // SenderDetails uses antd Select whose click→open→select chains are slow in the
28
- // parallel jest suite; mirror the timeout used in SenderDetails.test.js.
29
- jest.setTimeout(15000);
30
-
31
27
  const WABA_ID = 'waba-test-1';
32
28
 
33
29
  /** Typical `getDomainProperties` payloads per channel (merged when testing multi-channel). */
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import {
3
- render, screen, waitFor, within, fireEvent,
3
+ render, screen, waitFor, within,
4
4
  } from '@testing-library/react';
5
5
  import userEvent from '@testing-library/user-event';
6
6
  import '@testing-library/jest-dom';
@@ -183,9 +183,9 @@ const WAIT_OPTIONS = { timeout: 10000 };
183
183
 
184
184
  async function openSelectAndChoose(root, comboIndex, optionText) {
185
185
  const combos = within(root).getAllByRole('combobox');
186
- fireEvent.mouseDown(combos[comboIndex]);
186
+ await userEvent.click(combos[comboIndex]);
187
187
  await waitFor(() => expect(screen.getByRole('listbox')).toBeInTheDocument(), WAIT_OPTIONS);
188
- fireEvent.click(await findVisibleSelectOption(optionText, WAIT_OPTIONS));
188
+ await userEvent.click(await findVisibleSelectOption(optionText, WAIT_OPTIONS));
189
189
  }
190
190
 
191
191
  describe('SenderDetails', () => {
@@ -334,7 +334,7 @@ describe('SenderDetails', () => {
334
334
  await waitFor(() => expect(within(root).getByText('beta@other.com')).toBeInTheDocument());
335
335
 
336
336
  const resetLinks = within(root).getAllByText('Reset');
337
- fireEvent.click(resetLinks[0]);
337
+ await userEvent.click(resetLinks[0]);
338
338
 
339
339
  await waitFor(() => {
340
340
  expect(within(root).getByText('alpha@brand.com')).toBeInTheDocument();
@@ -349,12 +349,12 @@ describe('SenderDetails', () => {
349
349
  await waitFor(() => expect(within(root).getByText('+1002003001')).toBeInTheDocument());
350
350
 
351
351
  const combos = within(root).getAllByRole('combobox');
352
- fireEvent.mouseDown(combos[1]);
352
+ await userEvent.click(combos[1]);
353
353
  await waitFor(() => expect(screen.getByRole('listbox')).toBeInTheDocument(), WAIT_OPTIONS);
354
- fireEvent.click(await findVisibleSelectOption('+1002003002', WAIT_OPTIONS));
354
+ await userEvent.click(await findVisibleSelectOption('+1002003002', WAIT_OPTIONS));
355
355
 
356
356
  const resetLinks = within(root).getAllByText('Reset');
357
- fireEvent.click(resetLinks[1]);
357
+ await userEvent.click(resetLinks[1]);
358
358
 
359
359
  await waitFor(() => expect(within(root).getByText('+1002003001')).toBeInTheDocument());
360
360
  });
@@ -370,13 +370,13 @@ describe('SenderDetails', () => {
370
370
  await waitFor(() => expect(within(root).getByText('My Business')).toBeInTheDocument());
371
371
 
372
372
  const combos = within(root).getAllByRole('combobox');
373
- fireEvent.mouseDown(combos[combos.length - 1]);
373
+ await userEvent.click(combos[combos.length - 1]);
374
374
  await waitFor(() => expect(screen.getByRole('listbox')).toBeInTheDocument(), WAIT_OPTIONS);
375
- fireEvent.click(await findVisibleSelectOption('+91900111333', WAIT_OPTIONS));
375
+ await userEvent.click(await findVisibleSelectOption('+91900111333', WAIT_OPTIONS));
376
376
 
377
377
  const saveBtn = within(root).getByRole('button', { name: /save changes/i });
378
378
  await waitFor(() => expect(saveBtn).not.toBeDisabled());
379
- fireEvent.click(saveBtn);
379
+ await userEvent.click(saveBtn);
380
380
 
381
381
  expect(onSave).toHaveBeenCalledWith(
382
382
  expect.objectContaining({
@@ -425,9 +425,9 @@ describe('SenderDetails', () => {
425
425
  await waitFor(() => expect(within(root).getByText('Gateway A')).toBeInTheDocument());
426
426
 
427
427
  const combos = within(root).getAllByRole('combobox');
428
- fireEvent.mouseDown(combos[0]);
428
+ await userEvent.click(combos[0]);
429
429
  await waitFor(() => expect(screen.getByRole('listbox')).toBeInTheDocument(), WAIT_OPTIONS);
430
- fireEvent.click(await findVisibleSelectOption('Gateway B', WAIT_OPTIONS));
430
+ await userEvent.click(await findVisibleSelectOption('Gateway B', WAIT_OPTIONS));
431
431
 
432
432
  // The sender ID should now auto-update to Gateway B's sender
433
433
  await waitFor(() => expect(within(root).getByText('+222')).toBeInTheDocument());
@@ -444,9 +444,9 @@ describe('SenderDetails', () => {
444
444
 
445
445
  // Switch to Mail Beta domain
446
446
  const combos = within(root).getAllByRole('combobox');
447
- fireEvent.mouseDown(combos[0]);
447
+ await userEvent.click(combos[0]);
448
448
  await waitFor(() => expect(screen.getByRole('listbox')).toBeInTheDocument(), WAIT_OPTIONS);
449
- fireEvent.click(await findVisibleSelectOption('Mail Beta', WAIT_OPTIONS));
449
+ await userEvent.click(await findVisibleSelectOption('Mail Beta', WAIT_OPTIONS));
450
450
 
451
451
  // Sender ID should auto-update to beta@other.com
452
452
  await waitFor(() => expect(within(root).getByText('beta@other.com')).toBeInTheDocument());
@@ -468,13 +468,13 @@ describe('SenderDetails', () => {
468
468
  // Change sender to enable save
469
469
  const combos = within(root).getAllByRole('combobox');
470
470
  const senderCombo = combos[combos.length - 1];
471
- fireEvent.mouseDown(senderCombo);
471
+ await userEvent.click(senderCombo);
472
472
  await waitFor(() => expect(screen.getByRole('listbox')).toBeInTheDocument(), WAIT_OPTIONS);
473
- fireEvent.click(await findVisibleSelectOption('+91900111333', WAIT_OPTIONS));
473
+ await userEvent.click(await findVisibleSelectOption('+91900111333', WAIT_OPTIONS));
474
474
 
475
475
  const saveBtn = within(root).getByRole('button', { name: /save changes/i });
476
476
  await waitFor(() => expect(saveBtn).not.toBeDisabled());
477
- fireEvent.click(saveBtn);
477
+ await userEvent.click(saveBtn);
478
478
 
479
479
  // Should have called onSave with whatsappDomainId derived from the matched WABA domain
480
480
  expect(onSave).toHaveBeenCalledWith(
@@ -507,9 +507,9 @@ describe('SenderDetails', () => {
507
507
  // Change to an alternate sender
508
508
  const combos = within(root).getAllByRole('combobox');
509
509
  const senderCombo = combos[combos.length - 1];
510
- fireEvent.mouseDown(senderCombo);
510
+ await userEvent.click(senderCombo);
511
511
  await waitFor(() => expect(screen.getByRole('listbox')).toBeInTheDocument(), WAIT_OPTIONS);
512
- fireEvent.click(await findVisibleSelectOption('+viber-alt', WAIT_OPTIONS));
512
+ await userEvent.click(await findVisibleSelectOption('+viber-alt', WAIT_OPTIONS));
513
513
 
514
514
  // antd v6 also renders selected option in an aria-live polite region for
515
515
  // screen readers, so the text appears twice. Match only the visible select
@@ -521,7 +521,7 @@ describe('SenderDetails', () => {
521
521
  // Now click reset — for viberSenderId the else branch in handleReset is hit
522
522
  // (viberSenderId is not smsDomain/emailDomain, so getDefaultValueForField returns '')
523
523
  const resetLinks = within(root).getAllByText('Reset');
524
- fireEvent.click(resetLinks[resetLinks.length - 1]);
524
+ await userEvent.click(resetLinks[resetLinks.length - 1]);
525
525
  // After reset, the field goes to the default value returned by getDefaultValueForField
526
526
  // For viberSenderId this is '' (no specific default handler). The visible
527
527
  // select tile no longer shows +viber-alt; the aria-live polite span may
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
4
  import get from 'lodash/get';
5
5
  import isEmpty from 'lodash/isEmpty';
6
- import pick from 'lodash/pick';
7
6
  import cloneDeep from 'lodash/cloneDeep';
8
7
  import TemplatesV2 from '../TemplatesV2';
9
8
  import TemplatePreview from '../../v2Components/TemplatePreview';
@@ -26,7 +25,6 @@ import Viber from '../Viber';
26
25
  import Whatsapp from '../Whatsapp';
27
26
  import InApp from '../InApp';
28
27
  import Rcs from '../Rcs';
29
- import { isRcsTextOnlyCardMediaType, resolveRcsCardPreviewStrings } from '../Rcs/utils';
30
28
  import { getWhatsappContent } from '../Whatsapp/utils';
31
29
  import * as commonUtil from '../../utils/common';
32
30
  import Zalo from '../Zalo';
@@ -182,8 +180,6 @@ export function SlideBoxContent(props) {
182
180
  isTestAndPreviewMode,
183
181
  onHtmlEditorValidationStateChange,
184
182
  } = props;
185
- const localTemplatesConfig = props.localTemplatesConfig || pick(props, constants.LOCAL_TEMPLATE_CONFIG_KEYS);
186
- const useLocalTemplates = !!get(localTemplatesConfig, 'useLocalTemplates');
187
183
  const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
188
184
  const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
189
185
  const creativesLocationProps = {
@@ -403,37 +399,12 @@ export function SlideBoxContent(props) {
403
399
  }
404
400
  case constants.RCS: {
405
401
  const template = cloneDeep(templateDataObject);
406
- const cardPath = 'versions.base.content.RCS.rcsContent.cardContent[0]';
407
- const card = get(template, cardPath, {}) || {};
408
- const {
409
- description = '',
410
- media: { mediaUrl = '' } = {},
411
- title = '',
412
- mediaType: cardMediaType,
413
- suggestions = [],
414
- cardVarMapped: nestedCardVarMapped,
415
- } = card;
416
- const rootMirror = templateDataObject?.rcsCardVarMapped;
417
- const nestedRecord =
418
- nestedCardVarMapped != null && typeof nestedCardVarMapped === 'object'
419
- ? nestedCardVarMapped
420
- : {};
421
- const rootRecord =
422
- rootMirror != null && typeof rootMirror === 'object' ? rootMirror : {};
423
- const mergedCardVarMapped = { ...rootRecord, ...nestedRecord };
424
- const textOnlyCard = isRcsTextOnlyCardMediaType(cardMediaType);
425
- const { rcsTitle, rcsDesc } = resolveRcsCardPreviewStrings(
426
- title,
427
- description,
428
- mergedCardVarMapped,
429
- !isFullMode,
430
- textOnlyCard,
431
- );
402
+ const { description = "", media: { mediaUrl = "" } = {}, title = "", suggestions = [] } = get(template, 'versions.base.content.RCS.rcsContent.cardContent[0]', {});
432
403
  return {
433
404
  rcsPreviewContent: {
434
405
  rcsImageSrc: mediaUrl,
435
- rcsTitle,
436
- rcsDesc,
406
+ rcsTitle: title,
407
+ rcsDesc: description,
437
408
  ...(suggestions.length > 0 && {
438
409
  buttonText: suggestions[0]?.text,
439
410
  }),
@@ -455,12 +426,11 @@ export function SlideBoxContent(props) {
455
426
  getFormData,
456
427
  eventContextTags,
457
428
  waitEventContextTags,
458
- handleClose,
459
429
  };
460
430
 
461
431
  return (
462
432
  <CreativesWrapper>
463
- {slidBoxContent === 'templates' && (!isFullMode || useLocalTemplates) && (
433
+ {!isFullMode && slidBoxContent === 'templates' && (
464
434
  <TemplatesV2
465
435
  isFullMode={isFullMode}
466
436
  onSelectTemplate={onSelectTemplate}
@@ -493,7 +463,6 @@ export function SlideBoxContent(props) {
493
463
  waitEventContextTags={waitEventContextTags}
494
464
  loyaltyMetaData={loyaltyMetaData}
495
465
  isLoyaltyModule={isLoyaltyModule}
496
- localTemplatesConfig={localTemplatesConfig}
497
466
  />
498
467
  )}
499
468
  {isPreview && (
@@ -664,7 +633,6 @@ export function SlideBoxContent(props) {
664
633
  route={{ name: 'sms' }}
665
634
  isCreateSms={isCreateSms}
666
635
  isComponent
667
- templateData={templateData}
668
636
  isGetFormData={isGetFormData}
669
637
  getFormSubscriptionData={getFormData}
670
638
  getLiquidTags={getLiquidTags}
@@ -682,6 +650,9 @@ export function SlideBoxContent(props) {
682
650
  restrictPersonalization={restrictPersonalization}
683
651
  isAnonymousType={isAnonymousType}
684
652
  waitEventContextTags={waitEventContextTags}
653
+ showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
654
+ handleTestAndPreview={handleTestAndPreview}
655
+ handleCloseTestAndPreview={handleCloseTestAndPreview}
685
656
  />
686
657
  )}
687
658
 
@@ -1271,7 +1242,6 @@ export function SlideBoxContent(props) {
1271
1242
  )}
1272
1243
  {isCreateRcs && (<Rcs
1273
1244
  {...rcsCommonProps}
1274
- templateData={templateData}
1275
1245
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1276
1246
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
1277
1247
  handleTestAndPreview={handleTestAndPreview}
@@ -49,8 +49,6 @@ function SlideBoxFooter(props) {
49
49
  isAnonymousType = false,
50
50
  templateData = {},
51
51
  hasPersonalizationTokenError: hasPersonalizationTokenErrorProp = false,
52
- /** When set (e.g. SMS library create), overrides `creativesTemplatesSave` (“Done”) for the primary button */
53
- primarySaveButtonMessage,
54
52
  } = props;
55
53
  // Calculate if buttons should be disabled
56
54
  // Only apply validation state checks for EMAIL channel in HTML Editor mode (not BEE/DragDrop)
@@ -167,12 +165,6 @@ function SlideBoxFooter(props) {
167
165
  // Use prop from parent (FormBuilder flow) when available; else fall back to templateData check
168
166
  const hasPersonalizationTokenError = hasPersonalizationTokenErrorProp === true || (restrictPersonalization && hasPersonalizationTokens());
169
167
 
170
- function getSaveButtonLabel() {
171
- if (primarySaveButtonMessage) return <FormattedMessage {...primarySaveButtonMessage} />;
172
- if (isFullMode) return getFullModeSaveBtn(slidBoxContent, isCreatingTemplate);
173
- return <FormattedMessage {...messages.creativesTemplatesSave} />;
174
- }
175
-
176
168
  return (
177
169
  <div className="template-footer-width">
178
170
  {shouldShowErrorInfoNote && (
@@ -195,7 +187,11 @@ function SlideBoxFooter(props) {
195
187
  onClick={onSave}
196
188
  disabled={isTemplateNameEmpty || fetchingCmsData || shouldDisableButtons || hasPersonalizationTokenError}
197
189
  >
198
- {getSaveButtonLabel()}
190
+ {isFullMode ? (
191
+ getFullModeSaveBtn(slidBoxContent, isCreatingTemplate)
192
+ ) : (
193
+ <FormattedMessage {...messages.creativesTemplatesSave} />
194
+ )}
199
195
  </CapButton>
200
196
  {showTestAndPreviewButton && (
201
197
  <CapButton
@@ -268,10 +264,6 @@ SlideBoxFooter.propTypes = {
268
264
  templateData: PropTypes.object,
269
265
  formData: PropTypes.array,
270
266
  hasPersonalizationTokenError: PropTypes.bool,
271
- primarySaveButtonMessage: PropTypes.shape({
272
- id: PropTypes.string,
273
- defaultMessage: PropTypes.string,
274
- }),
275
267
  };
276
268
 
277
269
  SlideBoxFooter.defaultProps = {
@@ -299,6 +291,5 @@ SlideBoxFooter.defaultProps = {
299
291
  selectedEmailCreateMode: '',
300
292
  formData: [],
301
293
  hasPersonalizationTokenError: false,
302
- primarySaveButtonMessage: undefined,
303
294
  };
304
295
  export default SlideBoxFooter;
@@ -16,7 +16,6 @@ import { isTraiDLTEnable } from '../../utils/common';
16
16
  import { formatString } from '../../utils/Formatter';
17
17
  import {
18
18
  CAP_SPACE_12,
19
- CAP_SPACE_16,
20
19
  ICON_SIZE_M,
21
20
  } from '@capillarytech/cap-ui-library/styled/variables';
22
21
  import { WHATSAPP_HELP_DOC_LINK, JOURNEY } from './constants';
@@ -29,7 +28,7 @@ const StyledLabel = styled(CapLabelInline)`
29
28
  // the inherited font-size. Pin it to the medium icon size (24px) and center it so
30
29
  // the back arrow matches the header title instead of collapsing to a tiny glyph.
31
30
  const PrefixWrapper = styled.div`
32
- margin-right: ${CAP_SPACE_16};
31
+ margin-right: 16px;
33
32
  display: inline-flex;
34
33
  align-items: center;
35
34
  font-size: ${ICON_SIZE_M};
@@ -41,25 +40,7 @@ const renderData = (type, value, channel) => (
41
40
  );
42
41
 
43
42
  export function SlideBoxHeader(props) {
44
- const {
45
- slidBoxContent,
46
- templateData,
47
- onShowTemplates,
48
- creativesMode,
49
- isFullMode,
50
- showPrefix,
51
- shouldShowTemplateName,
52
- channel,
53
- templateNameRenderProp,
54
- weChatTemplateType,
55
- onWeChatMaptemplateStepChange,
56
- weChatMaptemplateStep,
57
- templateStep,
58
- smsRegister,
59
- handleClose,
60
- moduleType,
61
- useLocalTemplates = false,
62
- } = props;
43
+ const { slidBoxContent, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix, shouldShowTemplateName, channel, templateNameRenderProp, weChatTemplateType, onWeChatMaptemplateStepChange, weChatMaptemplateStep, templateStep, smsRegister, handleClose, moduleType } = props;
63
44
  const showTemplateNameHeader = isFullMode && shouldShowTemplateName;
64
45
  const mapTemplateCreate = !showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
65
46
  const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
@@ -80,7 +61,7 @@ export function SlideBoxHeader(props) {
80
61
  } = templateData || {};
81
62
  const templateName = whatsappTemplateName || templateData?.name;
82
63
  const showRcsTemplateName = channel.toLowerCase() === RCS && slidBoxContent === 'editTemplate' && !isFullMode && templateName;
83
- const showTemplateName = isWhatsappEdit || isZaloEdit;
64
+ const showTemplateName = isWhatsappEdit || showRcsTemplateName || isZaloEdit;
84
65
  const whatsappCategory = whatsappTemplateCategory || get(templateData, `versions.base.content.whatsapp.category`, '');
85
66
  const whatsappLanguageCode = whatsappTemplateLanguageCode || get(templateData, `versions.base.content.whatsapp.languages[0].language`, '');
86
67
 
@@ -107,9 +88,6 @@ export function SlideBoxHeader(props) {
107
88
  window.open(WHATSAPP_HELP_DOC_LINK, '_blank');
108
89
  };
109
90
 
110
- const showCreativesTemplatesBackButton =
111
- !isFullMode && (moduleType === JOURNEY || useLocalTemplates);
112
-
113
91
  return (
114
92
  <div key="creatives-container-slidebox-header-content">
115
93
  {slidBoxContent === 'templates' && !showTemplateNameHeader && (
@@ -118,7 +96,7 @@ export function SlideBoxHeader(props) {
118
96
  description={![NO_COMMUNICATION, FTP].includes(channel) &&
119
97
  <FormattedMessage {...messages.creativeTemplatesDesc} />
120
98
  }
121
- prefix={showCreativesTemplatesBackButton &&
99
+ prefix={!isFullMode && moduleType === JOURNEY &&
122
100
  <PrefixWrapper>
123
101
  <CapIcons.BackIcon onClick={handleClose} />
124
102
  </PrefixWrapper>
@@ -152,12 +130,6 @@ export function SlideBoxHeader(props) {
152
130
  <StyledLabel className='whatsapp-rcs-slidebox-template-name' type="label2">{templateName}</StyledLabel>
153
131
  </>
154
132
  ) : ""}
155
- {showRcsTemplateName && (
156
- <>
157
- {renderData("label1", <FormattedMessage {...globalMessages.creativeNameLabel} />, channel)}
158
- <StyledLabel className='whatsapp-rcs-slidebox-template-name' type="label2">{templateName}</StyledLabel>
159
- </>
160
- )}
161
133
  {isWhatsappEdit && (
162
134
  <>
163
135
  {renderData("label3", <FormattedMessage {...whatsppMsg.labelSeperator} />)}
@@ -170,7 +142,7 @@ export function SlideBoxHeader(props) {
170
142
  }
171
143
  </>
172
144
  }
173
- prefix={!isFullMode && showPrefix &&
145
+ prefix={creativesMode !== 'edit' && !isFullMode && showPrefix &&
174
146
  <PrefixWrapper>
175
147
  <CapIcons.BackIcon onClick={onShowTemplates} />
176
148
  </PrefixWrapper>
@@ -226,8 +198,5 @@ SlideBoxHeader.propTypes = {
226
198
  shouldShowTemplateName: PropTypes.bool,
227
199
  templateNameRenderProp: PropTypes.func,
228
200
  smsRegister: PropTypes.any,
229
- handleClose: PropTypes.func,
230
- moduleType: PropTypes.string,
231
- useLocalTemplates: PropTypes.bool,
232
201
  };
233
202
  export default SlideBoxHeader;
@@ -73,14 +73,3 @@ export const ALLOWED_CHANNELS_FOR_ANONYMOUS = ['mobilepush', 'webpush'];
73
73
  export const ALL_CHANNELS_NEW = [
74
74
  'sms', 'email', 'whatsapp', 'facebook', 'line', 'viber', 'rcs', 'zalo', 'inapp', 'call_task', 'ftp',
75
75
  ];
76
-
77
- export const LOCAL_TEMPLATE_CONFIG_KEYS = ['useLocalTemplates', 'localTemplates', 'localTemplatesLoading', 'localTemplatesFilterContent', 'localTemplatesUseSkeleton', 'localTemplatesOnPageChange'];
78
-
79
- /** Keys passed from parents into `Templates` when using local SMS template list (extends `LOCAL_TEMPLATE_CONFIG_KEYS`). */
80
- export const LOCAL_TEMPLATE_CONFIG_KEYS_FOR_PICK = [
81
- ...LOCAL_TEMPLATE_CONFIG_KEYS,
82
- 'localTemplatesLoadingTip',
83
- 'localTemplatesFooterContent',
84
- ];
85
-
86
- export const DEFAULT_SMS_TEMPLATE_NAME = 'Campaign message SMS content';