@capillarytech/creatives-library 8.0.330-alpha.0 → 8.0.331-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 (111) hide show
  1. package/constants/unified.js +0 -18
  2. package/package.json +1 -1
  3. package/services/tests/api.test.js +0 -13
  4. package/utils/commonUtils.js +1 -19
  5. package/v2Components/CapTagList/index.js +0 -10
  6. package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +49 -70
  7. package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
  8. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -207
  9. package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
  10. package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +10 -85
  11. package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
  12. package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -79
  13. package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +1 -0
  14. package/v2Components/CommonTestAndPreview/SendTestMessage.js +5 -10
  15. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -20
  16. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +4 -133
  17. package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +0 -11
  18. package/v2Components/CommonTestAndPreview/constants.js +2 -38
  19. package/v2Components/CommonTestAndPreview/index.js +176 -672
  20. package/v2Components/CommonTestAndPreview/messages.js +3 -41
  21. package/v2Components/CommonTestAndPreview/reducer.js +3 -1
  22. package/v2Components/CommonTestAndPreview/sagas.js +8 -16
  23. package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +284 -308
  24. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +65 -231
  25. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +5 -118
  26. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -341
  27. package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +13 -34
  28. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
  29. package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -132
  30. package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
  31. package/v2Components/FormBuilder/index.js +1 -7
  32. package/v2Components/TestAndPreviewSlidebox/index.js +1 -13
  33. package/v2Components/TestAndPreviewSlidebox/sagas.js +4 -11
  34. package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +1 -3
  35. package/v2Containers/CreativesContainer/SlideBoxContent.js +4 -36
  36. package/v2Containers/CreativesContainer/SlideBoxFooter.js +1 -10
  37. package/v2Containers/CreativesContainer/SlideBoxHeader.js +4 -29
  38. package/v2Containers/CreativesContainer/constants.js +0 -9
  39. package/v2Containers/CreativesContainer/index.js +93 -292
  40. package/v2Containers/CreativesContainer/index.scss +1 -51
  41. package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -78
  42. package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +16 -79
  43. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -8
  44. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +98 -357
  45. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +10 -20
  46. package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
  47. package/v2Containers/Rcs/constants.js +3 -40
  48. package/v2Containers/Rcs/index.js +895 -1145
  49. package/v2Containers/Rcs/index.scss +6 -85
  50. package/v2Containers/Rcs/messages.js +2 -12
  51. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +1432 -40783
  52. package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +5 -0
  53. package/v2Containers/Rcs/tests/index.test.js +38 -41
  54. package/v2Containers/Rcs/tests/mockData.js +0 -38
  55. package/v2Containers/Rcs/tests/utils.test.js +1 -435
  56. package/v2Containers/Rcs/utils.js +10 -405
  57. package/v2Containers/Sms/Create/index.js +38 -100
  58. package/v2Containers/SmsTrai/Create/index.js +4 -9
  59. package/v2Containers/SmsTrai/Edit/constants.js +0 -2
  60. package/v2Containers/SmsTrai/Edit/index.js +128 -636
  61. package/v2Containers/SmsTrai/Edit/messages.js +4 -14
  62. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2296 -4249
  63. package/v2Containers/SmsWrapper/index.js +8 -37
  64. package/v2Containers/TagList/index.js +11 -21
  65. package/v2Containers/Templates/_templates.scss +2 -63
  66. package/v2Containers/Templates/actions.js +0 -11
  67. package/v2Containers/Templates/constants.js +0 -2
  68. package/v2Containers/Templates/index.js +40 -90
  69. package/v2Containers/Templates/sagas.js +12 -57
  70. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1079 -1043
  71. package/v2Containers/Templates/tests/sagas.test.js +123 -193
  72. package/v2Containers/TemplatesV2/TemplatesV2.style.js +1 -72
  73. package/v2Containers/TemplatesV2/index.js +23 -86
  74. package/v2Containers/WebPush/Create/index.js +1 -1
  75. package/v2Containers/Whatsapp/index.js +20 -3
  76. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -578
  77. package/utils/templateVarUtils.js +0 -201
  78. package/utils/tests/templateVarUtils.test.js +0 -204
  79. package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
  80. package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
  81. package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -87
  82. package/v2Components/SmsFallback/constants.js +0 -73
  83. package/v2Components/SmsFallback/index.js +0 -955
  84. package/v2Components/SmsFallback/index.scss +0 -265
  85. package/v2Components/SmsFallback/messages.js +0 -78
  86. package/v2Components/SmsFallback/smsFallbackUtils.js +0 -118
  87. package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +0 -50
  88. package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +0 -147
  89. package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +0 -304
  90. package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +0 -197
  91. package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -277
  92. package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
  93. package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
  94. package/v2Components/VarSegmentMessageEditor/constants.js +0 -2
  95. package/v2Components/VarSegmentMessageEditor/index.js +0 -125
  96. package/v2Components/VarSegmentMessageEditor/index.scss +0 -46
  97. package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +0 -43
  98. package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -67
  99. package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +0 -90
  100. package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +0 -258
  101. package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +0 -125
  102. package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +0 -225
  103. package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -318
  104. package/v2Containers/Sms/smsFormDataHelpers.js +0 -67
  105. package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +0 -253
  106. package/v2Containers/SmsTrai/Edit/index.scss +0 -121
  107. package/v2Containers/Templates/TemplatesActionBar.js +0 -101
  108. package/v2Containers/Templates/tests/TemplatesActionBar.test.js +0 -120
  109. package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +0 -180
  110. package/v2Containers/Templates/utils/smsTemplatesListApi.js +0 -79
  111. package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +0 -131
@@ -30,28 +30,23 @@ jest.mock('@capillarytech/cap-ui-library/CapNotification', () => ({
30
30
  }));
31
31
 
32
32
  // Mock child components - must use React.createElement to avoid hoisting issues
33
- let lastLeftPanelContentProps = null;
34
33
  jest.mock('../LeftPanelContent', () => {
35
34
  // eslint-disable-next-line global-require, import/no-extraneous-dependencies
36
35
  const ReactLib = require('react');
37
36
  return {
38
37
  __esModule: true,
39
- default: function MockLeftPanelContent(props) {
40
- lastLeftPanelContentProps = props;
41
- const editorEl = props.renderCustomValuesEditor ? props.renderCustomValuesEditor() : null;
42
- return ReactLib.createElement('div', { 'data-testid': 'left-panel' }, 'Left Panel', editorEl);
38
+ default: function MockLeftPanelContent() {
39
+ return ReactLib.createElement('div', { 'data-testid': 'left-panel' }, 'Left Panel');
43
40
  },
44
41
  };
45
42
  });
46
43
 
47
- let lastCustomValuesEditorProps = null;
48
44
  jest.mock('../CustomValuesEditor', () => {
49
45
  // eslint-disable-next-line global-require, import/no-extraneous-dependencies
50
46
  const ReactLib = require('react');
51
47
  return {
52
48
  __esModule: true,
53
- default: function MockCustomValuesEditor(props) {
54
- lastCustomValuesEditorProps = props;
49
+ default: function MockCustomValuesEditor() {
55
50
  return ReactLib.createElement('div', { 'data-testid': 'custom-values-editor' }, 'Custom Values Editor');
56
51
  },
57
52
  };
@@ -196,8 +191,6 @@ describe('CommonTestAndPreview', () => {
196
191
  beforeEach(() => {
197
192
  jest.clearAllMocks();
198
193
  lastSendTestMessageProps = null;
199
- lastLeftPanelContentProps = null;
200
- lastCustomValuesEditorProps = null;
201
194
  // Reset all mock function implementations
202
195
  Object.values(mockActions).forEach((mockFn) => {
203
196
  if (jest.isMockFunction(mockFn)) {
@@ -252,24 +245,6 @@ describe('CommonTestAndPreview', () => {
252
245
  });
253
246
  });
254
247
 
255
- it('should call getSenderDetailsRequested for RCS and SMS when channel is RCS', async () => {
256
- render(
257
- <TestWrapper>
258
- <CommonTestAndPreview {...defaultProps} channel={CHANNELS.RCS} />
259
- </TestWrapper>
260
- );
261
- await waitFor(() => {
262
- expect(mockActions.getSenderDetailsRequested).toHaveBeenCalledWith({
263
- channel: CHANNELS.RCS,
264
- orgUnitId: -1,
265
- });
266
- expect(mockActions.getSenderDetailsRequested).toHaveBeenCalledWith({
267
- channel: CHANNELS.SMS,
268
- orgUnitId: -1,
269
- });
270
- });
271
- });
272
-
273
248
  it('should not call getSenderDetailsRequested when channel is INAPP', async () => {
274
249
  render(
275
250
  <TestWrapper>
@@ -328,7 +303,7 @@ describe('CommonTestAndPreview', () => {
328
303
  });
329
304
  expect(lastSendTestMessageProps).toBeDefined();
330
305
  expect(lastSendTestMessageProps.deliverySettings).toBeDefined();
331
- expect(lastSendTestMessageProps.senderDetailsByChannel).toEqual(senderDetailsByChannel);
306
+ expect(lastSendTestMessageProps.senderDetailsOptions).toEqual(senderDetailsByChannel[CHANNELS.SMS]);
332
307
  expect(lastSendTestMessageProps.wecrmAccounts).toEqual([]);
333
308
  expect(typeof lastSendTestMessageProps.onSaveDeliverySettings).toBe('function');
334
309
  expect(lastSendTestMessageProps.isLoadingSenderDetails).toBe(false);
@@ -3306,107 +3281,4 @@ describe('CommonTestAndPreview', () => {
3306
3281
  });
3307
3282
  });
3308
3283
  });
3309
-
3310
- describe('SMS DLT and mustache tag discrimination (smsTemplateHasMustacheTags / buildSyntheticSmsMustacheTags)', () => {
3311
- it('should return no tags for SMS content that contains only DLT {#var#} tokens', async () => {
3312
- render(
3313
- <TestWrapper>
3314
- <CommonTestAndPreview
3315
- {...defaultProps}
3316
- channel={CHANNELS.SMS}
3317
- formData={{ 0: { 'sms-editor': 'Order {#orderId#} is confirmed' } }}
3318
- extractedTags={[]}
3319
- />
3320
- </TestWrapper>
3321
- );
3322
-
3323
- await waitFor(() => expect(lastLeftPanelContentProps).not.toBeNull());
3324
-
3325
- // smsTemplateHasMustacheTags returns false for DLT-only → extractedTags is []
3326
- expect(lastLeftPanelContentProps.extractedTags).toEqual([]);
3327
- });
3328
-
3329
- it('should build synthetic tags from {{mustache}} tokens, excluding DLT {#var#} tokens', async () => {
3330
- render(
3331
- <TestWrapper>
3332
- <CommonTestAndPreview
3333
- {...defaultProps}
3334
- channel={CHANNELS.SMS}
3335
- formData={{ 0: { 'sms-editor': 'Hi {{name}}, order {#orderId#} shipped' } }}
3336
- extractedTags={[]}
3337
- />
3338
- </TestWrapper>
3339
- );
3340
-
3341
- await waitFor(() => expect(lastLeftPanelContentProps).not.toBeNull());
3342
-
3343
- const tags = lastLeftPanelContentProps.extractedTags;
3344
- // Only {{name}} should become a tag — {#orderId#} must be excluded
3345
- expect(tags).toHaveLength(1);
3346
- expect(tags[0].name).toBe('name');
3347
- });
3348
-
3349
- it('should use API-extracted tags when present instead of building synthetic ones', async () => {
3350
- const apiTags = [{ name: 'firstName', metaData: { userDriven: true }, children: [] }];
3351
- render(
3352
- <TestWrapper>
3353
- <CommonTestAndPreview
3354
- {...defaultProps}
3355
- channel={CHANNELS.SMS}
3356
- formData={{ 0: { 'sms-editor': 'Hi {{firstName}}' } }}
3357
- extractedTags={apiTags}
3358
- />
3359
- </TestWrapper>
3360
- );
3361
-
3362
- await waitFor(() => expect(lastLeftPanelContentProps).not.toBeNull());
3363
-
3364
- // API tags take priority over buildSyntheticSmsMustacheTags
3365
- expect(lastLeftPanelContentProps.extractedTags).toEqual(apiTags);
3366
- });
3367
- });
3368
-
3369
- describe('handleDiscardCustomValues — preview reset', () => {
3370
- it('should call updatePreviewRequested when handleDiscardCustomValues is invoked', async () => {
3371
- render(
3372
- <TestWrapper>
3373
- <CommonTestAndPreview
3374
- {...defaultProps}
3375
- channel={CHANNELS.SMS}
3376
- formData={{ 0: { 'sms-editor': 'Hi {{name}}' } }}
3377
- />
3378
- </TestWrapper>
3379
- );
3380
-
3381
- await waitFor(() => expect(lastCustomValuesEditorProps).not.toBeNull());
3382
-
3383
- lastCustomValuesEditorProps.handleDiscardCustomValues();
3384
-
3385
- expect(mockActions.updatePreviewRequested).toHaveBeenCalledTimes(1);
3386
- });
3387
-
3388
- it('should call updatePreviewRequested with RCS channel when handleDiscardCustomValues is invoked for RCS with fallback', async () => {
3389
- render(
3390
- <TestWrapper>
3391
- <CommonTestAndPreview
3392
- {...defaultProps}
3393
- channel={CHANNELS.RCS}
3394
- smsFallbackContent={{
3395
- templateContent: 'Fallback {{name}}',
3396
- content: 'Fallback {{name}}',
3397
- }}
3398
- formData={{}}
3399
- />
3400
- </TestWrapper>
3401
- );
3402
-
3403
- await waitFor(() => expect(lastCustomValuesEditorProps).not.toBeNull());
3404
-
3405
- lastCustomValuesEditorProps.handleDiscardCustomValues();
3406
-
3407
- // updatePreviewRequested is called; syncSmsFallbackPreview (which hits Api directly) is NOT called
3408
- expect(mockActions.updatePreviewRequested).toHaveBeenCalledTimes(1);
3409
- });
3410
- });
3411
3284
  });
3412
-
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import {
8
- call, put, takeLatest, takeEvery, all,
8
+ call, put, takeLatest, all,
9
9
  } from 'redux-saga/effects';
10
10
  import {
11
11
  searchCustomersSaga,
@@ -1333,7 +1333,7 @@ describe('CommonTestAndPreview Sagas', () => {
1333
1333
  it('should watch for GET_SENDER_DETAILS_REQUESTED', () => {
1334
1334
  const generator = watchGetSenderDetails();
1335
1335
  expect(generator.next().value).toEqual(
1336
- takeEvery('app/CommonTestAndPreview/GET_SENDER_DETAILS_REQUESTED', getSenderDetailsSaga)
1336
+ takeLatest('app/CommonTestAndPreview/GET_SENDER_DETAILS_REQUESTED', getSenderDetailsSaga)
1337
1337
  );
1338
1338
  expect(generator.next().done).toBe(true);
1339
1339
  });
@@ -3658,9 +3658,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3658
3658
  channel={channel}
3659
3659
  eventContextTags={this.props?.eventContextTags}
3660
3660
  restrictPersonalization={this.props.restrictPersonalization}
3661
- getPopupContainer={this.props.tagListGetPopupContainer}
3662
- popoverOverlayStyle={this.props.tagListPopoverOverlayStyle}
3663
- popoverOverlayClassName={this.props.tagListPopoverOverlayClassName}
3664
3661
  />
3665
3662
  </CapColumn>
3666
3663
  );
@@ -4351,15 +4348,12 @@ FormBuilder.propTypes = {
4351
4348
  type: PropTypes.string.isRequired,
4352
4349
  isEmailLoading: PropTypes.bool.isRequired,
4353
4350
  moduleType: PropTypes.string.isRequired,
4354
- showLiquidErrorInFooter: PropTypes.func.isRequired,
4351
+ showLiquidErrorInFooter: PropTypes.bool.isRequired,
4355
4352
  eventContextTags: PropTypes.array.isRequired,
4356
4353
  forwardedTags: PropTypes.object.isRequired,
4357
4354
  isLoyaltyModule: PropTypes.bool.isRequired,
4358
4355
  isTestAndPreviewMode: PropTypes.bool, // Add new prop type
4359
4356
  restrictPersonalization: PropTypes.bool,
4360
- tagListGetPopupContainer: PropTypes.func,
4361
- tagListPopoverOverlayStyle: PropTypes.object,
4362
- tagListPopoverOverlayClassName: PropTypes.string,
4363
4357
  };
4364
4358
 
4365
4359
  const mapStateToProps = createStructuredSelector({
@@ -18,7 +18,7 @@ import injectReducer from '../../utils/injectReducer';
18
18
  import injectSaga from '../../utils/injectSaga';
19
19
 
20
20
  import CommonTestAndPreview from '../CommonTestAndPreview';
21
- import { CHANNELS, RCS_SMS_FALLBACK_VAR_MAPPED_PROP } from '../CommonTestAndPreview/constants';
21
+ import { CHANNELS } from '../CommonTestAndPreview/constants';
22
22
  import * as commonTestAndPreviewActions from '../CommonTestAndPreview/actions';
23
23
  import { commonTestAndPreviewSaga } from '../CommonTestAndPreview/sagas';
24
24
  import commonTestAndPreviewReducer from '../CommonTestAndPreview/reducer';
@@ -78,16 +78,6 @@ TestAndPreviewSlidebox.propTypes = {
78
78
  content: PropTypes.string,
79
79
  beeInstance: PropTypes.object,
80
80
  currentTab: PropTypes.number,
81
- smsFallbackContent: PropTypes.shape({
82
- templateContent: PropTypes.string,
83
- senderId: PropTypes.string,
84
- templateName: PropTypes.string,
85
- [RCS_SMS_FALLBACK_VAR_MAPPED_PROP]: PropTypes.object,
86
- }),
87
- /** Passed to CommonTestAndPreview for RCS test-meta resolution (slot semantics vs full-mode). */
88
- rcsTestPreviewOptions: PropTypes.shape({
89
- isLibraryMode: PropTypes.bool,
90
- }),
91
81
  // Redux props are passed through
92
82
  actions: PropTypes.object.isRequired,
93
83
  extractedTags: PropTypes.array.isRequired,
@@ -119,12 +109,10 @@ TestAndPreviewSlidebox.defaultProps = {
119
109
  currentTab: 1,
120
110
  messageMetaConfigId: null,
121
111
  prefilledValues: {},
122
- rcsTestPreviewOptions: undefined,
123
112
  senderDetailsByChannel: {},
124
113
  wecrmAccounts: [],
125
114
  isLoadingSenderDetails: false,
126
115
  orgUnitId: -1,
127
- smsFallbackContent: null,
128
116
  };
129
117
 
130
118
  const mapStateToProps = createStructuredSelector({
@@ -34,7 +34,6 @@ import {
34
34
  GET_PREFILLED_VALUES_SUCCESS,
35
35
  GET_PREFILLED_VALUES_FAILURE,
36
36
  } from './constants';
37
- import { extractPreviewFromLiquidResponse } from '../CommonTestAndPreview/previewApiUtils';
38
37
 
39
38
  // Search Customers Saga
40
39
  export function* searchCustomersSaga(action) {
@@ -81,12 +80,11 @@ export function* updatePreviewSaga(action) {
81
80
  const customValues = action.payload.resolvedTags;
82
81
 
83
82
  const response = yield call(Api.updateEmailPreview, action.payload);
84
- const previewPayload = extractPreviewFromLiquidResponse(response);
85
- if (previewPayload) {
83
+ if (response?.data) {
86
84
  yield put({
87
85
  type: UPDATE_PREVIEW_SUCCESS,
88
86
  payload: {
89
- previewData: previewPayload,
87
+ previewData: response.data,
90
88
  customValues, // Pass custom values to be preserved
91
89
  },
92
90
  });
@@ -223,13 +221,8 @@ export function* createMessageMetaSaga(action) {
223
221
  export function* getPrefilledValuesSaga(action) {
224
222
  try {
225
223
  const response = yield call(Api.updateEmailPreview, action.payload);
226
- const body =
227
- response?.data !== undefined && response?.data !== null
228
- ? response.data
229
- : response;
230
- const resolvedTagValues = body?.resolvedTagValues;
231
- if (resolvedTagValues != null) {
232
- yield put({ type: GET_PREFILLED_VALUES_SUCCESS, payload: { values: resolvedTagValues } });
224
+ if (response?.data) {
225
+ yield put({ type: GET_PREFILLED_VALUES_SUCCESS, payload: { values: response?.data?.resolvedTagValues } });
233
226
  } else {
234
227
  yield put({ type: GET_PREFILLED_VALUES_FAILURE, payload: { error: response.error || 'Failed to fetch prefilled values' } });
235
228
  }
@@ -136,9 +136,7 @@ describe('TestAndPreviewSlidebox Sagas', () => {
136
136
  describe('updatePreviewSaga', () => {
137
137
  it('should handle successful preview update', () => {
138
138
  const mockResponse = {
139
- data: {
140
- resolvedBody: 'Test Preview Data',
141
- },
139
+ data: 'Test Preview Data',
142
140
  };
143
141
  const customValues = { test: 'value' };
144
142
  return expectSaga(sagas.updatePreviewSaga, {
@@ -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';
@@ -181,8 +179,6 @@ export function SlideBoxContent(props) {
181
179
  isTestAndPreviewMode,
182
180
  onHtmlEditorValidationStateChange,
183
181
  } = props;
184
- const localTemplatesConfig = props.localTemplatesConfig || pick(props, constants.LOCAL_TEMPLATE_CONFIG_KEYS);
185
- const useLocalTemplates = !!get(localTemplatesConfig, 'useLocalTemplates');
186
182
  const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
187
183
  const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
188
184
  const creativesLocationProps = {
@@ -402,37 +398,12 @@ export function SlideBoxContent(props) {
402
398
  }
403
399
  case constants.RCS: {
404
400
  const template = cloneDeep(templateDataObject);
405
- const cardPath = 'versions.base.content.RCS.rcsContent.cardContent[0]';
406
- const card = get(template, cardPath, {}) || {};
407
- const {
408
- description = '',
409
- media: { mediaUrl = '' } = {},
410
- title = '',
411
- mediaType: cardMediaType,
412
- suggestions = [],
413
- cardVarMapped: nestedCardVarMapped,
414
- } = card;
415
- const rootMirror = templateDataObject?.rcsCardVarMapped;
416
- const nestedRecord =
417
- nestedCardVarMapped != null && typeof nestedCardVarMapped === 'object'
418
- ? nestedCardVarMapped
419
- : {};
420
- const rootRecord =
421
- rootMirror != null && typeof rootMirror === 'object' ? rootMirror : {};
422
- const mergedCardVarMapped = { ...rootRecord, ...nestedRecord };
423
- const textOnlyCard = isRcsTextOnlyCardMediaType(cardMediaType);
424
- const { rcsTitle, rcsDesc } = resolveRcsCardPreviewStrings(
425
- title,
426
- description,
427
- mergedCardVarMapped,
428
- !isFullMode,
429
- textOnlyCard,
430
- );
401
+ const { description = "", media: { mediaUrl = "" } = {}, title = "", suggestions = [] } = get(template, 'versions.base.content.RCS.rcsContent.cardContent[0]', {});
431
402
  return {
432
403
  rcsPreviewContent: {
433
404
  rcsImageSrc: mediaUrl,
434
- rcsTitle,
435
- rcsDesc,
405
+ rcsTitle: title,
406
+ rcsDesc: description,
436
407
  ...(suggestions.length > 0 && {
437
408
  buttonText: suggestions[0]?.text,
438
409
  }),
@@ -457,7 +428,7 @@ export function SlideBoxContent(props) {
457
428
 
458
429
  return (
459
430
  <CreativesWrapper>
460
- {slidBoxContent === 'templates' && (!isFullMode || useLocalTemplates) && (
431
+ {!isFullMode && slidBoxContent === 'templates' && (
461
432
  <TemplatesV2
462
433
  isFullMode={isFullMode}
463
434
  onSelectTemplate={onSelectTemplate}
@@ -489,7 +460,6 @@ export function SlideBoxContent(props) {
489
460
  eventContextTags={eventContextTags}
490
461
  loyaltyMetaData={loyaltyMetaData}
491
462
  isLoyaltyModule={isLoyaltyModule}
492
- localTemplatesConfig={localTemplatesConfig}
493
463
  />
494
464
  )}
495
465
  {isPreview && (
@@ -658,7 +628,6 @@ export function SlideBoxContent(props) {
658
628
  route={{ name: 'sms' }}
659
629
  isCreateSms={isCreateSms}
660
630
  isComponent
661
- templateData={templateData}
662
631
  isGetFormData={isGetFormData}
663
632
  getFormSubscriptionData={getFormData}
664
633
  getLiquidTags={getLiquidTags}
@@ -1234,7 +1203,6 @@ export function SlideBoxContent(props) {
1234
1203
  )}
1235
1204
  {isCreateRcs && (<Rcs
1236
1205
  {...rcsCommonProps}
1237
- templateData={templateData}
1238
1206
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1239
1207
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
1240
1208
  handleTestAndPreview={handleTestAndPreview}
@@ -48,8 +48,6 @@ function SlideBoxFooter(props) {
48
48
  isAnonymousType = false,
49
49
  templateData = {},
50
50
  hasPersonalizationTokenError: hasPersonalizationTokenErrorProp = false,
51
- /** When set (e.g. SMS library create), overrides `creativesTemplatesSave` (“Done”) for the primary button */
52
- primarySaveButtonMessage,
53
51
  } = props;
54
52
  // Calculate if buttons should be disabled
55
53
  // Only apply validation state checks for EMAIL channel in HTML Editor mode (not BEE/DragDrop)
@@ -188,9 +186,7 @@ function SlideBoxFooter(props) {
188
186
  onClick={onSave}
189
187
  disabled={isTemplateNameEmpty || fetchingCmsData || shouldDisableButtons || hasPersonalizationTokenError}
190
188
  >
191
- {primarySaveButtonMessage ? (
192
- <FormattedMessage {...primarySaveButtonMessage} />
193
- ) : isFullMode ? (
189
+ {isFullMode ? (
194
190
  getFullModeSaveBtn(slidBoxContent, isCreatingTemplate)
195
191
  ) : (
196
192
  <FormattedMessage {...messages.creativesTemplatesSave} />
@@ -266,10 +262,6 @@ SlideBoxFooter.propTypes = {
266
262
  templateData: PropTypes.object,
267
263
  formData: PropTypes.array,
268
264
  hasPersonalizationTokenError: PropTypes.bool,
269
- primarySaveButtonMessage: PropTypes.shape({
270
- id: PropTypes.string,
271
- defaultMessage: PropTypes.string,
272
- }),
273
265
  };
274
266
 
275
267
  SlideBoxFooter.defaultProps = {
@@ -297,6 +289,5 @@ SlideBoxFooter.defaultProps = {
297
289
  selectedEmailCreateMode: '',
298
290
  formData: [],
299
291
  hasPersonalizationTokenError: false,
300
- primarySaveButtonMessage: undefined,
301
292
  };
302
293
  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
  } from '@capillarytech/cap-ui-library/styled/variables';
21
20
  import { WHATSAPP_HELP_DOC_LINK, JOURNEY } from './constants';
22
21
 
@@ -25,7 +24,7 @@ const StyledLabel = styled(CapLabelInline)`
25
24
  margin-right: ${CAP_SPACE_12};
26
25
  `;
27
26
  const PrefixWrapper = styled.div`
28
- margin-right: ${CAP_SPACE_16};
27
+ margin-right: 16px;
29
28
  `;
30
29
  const renderData = (type, value, channel) => (
31
30
  <StyledLabel className={channel?.toLowerCase() === ZALO ? 'zalo-template-name-spacing' : ''} type={type}>
@@ -34,25 +33,7 @@ const renderData = (type, value, channel) => (
34
33
  );
35
34
 
36
35
  export function SlideBoxHeader(props) {
37
- const {
38
- slidBoxContent,
39
- templateData,
40
- onShowTemplates,
41
- creativesMode,
42
- isFullMode,
43
- showPrefix,
44
- shouldShowTemplateName,
45
- channel,
46
- templateNameRenderProp,
47
- weChatTemplateType,
48
- onWeChatMaptemplateStepChange,
49
- weChatMaptemplateStep,
50
- templateStep,
51
- smsRegister,
52
- handleClose,
53
- moduleType,
54
- useLocalTemplates = false,
55
- } = props;
36
+ const { slidBoxContent, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix, shouldShowTemplateName, channel, templateNameRenderProp, weChatTemplateType, onWeChatMaptemplateStepChange, weChatMaptemplateStep, templateStep, smsRegister, handleClose, moduleType } = props;
56
37
  const showTemplateNameHeader = isFullMode && shouldShowTemplateName;
57
38
  const mapTemplateCreate = !showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
58
39
  const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
@@ -100,9 +81,6 @@ export function SlideBoxHeader(props) {
100
81
  window.open(WHATSAPP_HELP_DOC_LINK, '_blank');
101
82
  };
102
83
 
103
- const showCreativesTemplatesBackButton =
104
- !isFullMode && (moduleType === JOURNEY || useLocalTemplates);
105
-
106
84
  return (
107
85
  <div key="creatives-container-slidebox-header-content">
108
86
  {slidBoxContent === 'templates' && !showTemplateNameHeader && (
@@ -111,7 +89,7 @@ export function SlideBoxHeader(props) {
111
89
  description={![NO_COMMUNICATION, FTP].includes(channel) &&
112
90
  <FormattedMessage {...messages.creativeTemplatesDesc} />
113
91
  }
114
- prefix={showCreativesTemplatesBackButton &&
92
+ prefix={!isFullMode && moduleType === JOURNEY &&
115
93
  <PrefixWrapper>
116
94
  <CapIcons.backIcon onClick={handleClose} />
117
95
  </PrefixWrapper>
@@ -157,7 +135,7 @@ export function SlideBoxHeader(props) {
157
135
  }
158
136
  </>
159
137
  }
160
- prefix={!isFullMode && showPrefix &&
138
+ prefix={creativesMode !== 'edit' && !isFullMode && showPrefix &&
161
139
  <PrefixWrapper>
162
140
  <CapIcons.backIcon onClick={onShowTemplates} />
163
141
  </PrefixWrapper>
@@ -213,8 +191,5 @@ SlideBoxHeader.propTypes = {
213
191
  shouldShowTemplateName: PropTypes.bool,
214
192
  templateNameRenderProp: PropTypes.func,
215
193
  smsRegister: PropTypes.any,
216
- handleClose: PropTypes.func,
217
- moduleType: PropTypes.string,
218
- useLocalTemplates: PropTypes.bool,
219
194
  };
220
195
  export default SlideBoxHeader;
@@ -67,12 +67,3 @@ export const ALLOWED_CHANNELS_FOR_ANONYMOUS = ['mobilepush', 'webpush'];
67
67
  export const ALL_CHANNELS_NEW = [
68
68
  'sms', 'email', 'whatsapp', 'facebook', 'line', 'viber', 'rcs', 'zalo', 'inapp', 'call_task', 'ftp',
69
69
  ];
70
-
71
- export const LOCAL_TEMPLATE_CONFIG_KEYS = ['useLocalTemplates', 'localTemplates', 'localTemplatesLoading', 'localTemplatesFilterContent', 'localTemplatesUseSkeleton', 'localTemplatesOnPageChange'];
72
-
73
- /** Keys passed from parents into `Templates` when using local SMS template list (extends `LOCAL_TEMPLATE_CONFIG_KEYS`). */
74
- export const LOCAL_TEMPLATE_CONFIG_KEYS_FOR_PICK = [
75
- ...LOCAL_TEMPLATE_CONFIG_KEYS,
76
- 'localTemplatesLoadingTip',
77
- 'localTemplatesFooterContent',
78
- ];