@capillarytech/creatives-library 8.0.345-alpha.12 → 8.0.345-alpha.13

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 (138) hide show
  1. package/constants/unified.js +0 -29
  2. package/package.json +1 -1
  3. package/services/api.js +20 -0
  4. package/services/tests/api.test.js +59 -13
  5. package/utils/commonUtils.js +1 -19
  6. package/v2Components/CapActionButton/constants.js +0 -7
  7. package/v2Components/CapActionButton/index.js +109 -167
  8. package/v2Components/CapActionButton/index.scss +6 -157
  9. package/v2Components/CapActionButton/messages.js +3 -19
  10. package/v2Components/CapActionButton/tests/index.test.js +17 -41
  11. package/v2Components/CapCustomSkeleton/index.js +1 -1
  12. package/v2Components/CapCustomSkeleton/tests/__snapshots__/index.test.js.snap +12 -12
  13. package/v2Components/CapTagList/index.js +0 -10
  14. package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +49 -70
  15. package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
  16. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -207
  17. package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
  18. package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +10 -85
  19. package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
  20. package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -79
  21. package/v2Components/CommonTestAndPreview/SendTestMessage.js +5 -10
  22. package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +15 -160
  23. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +76 -341
  24. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +4 -133
  25. package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +0 -11
  26. package/v2Components/CommonTestAndPreview/constants.js +2 -38
  27. package/v2Components/CommonTestAndPreview/index.js +186 -676
  28. package/v2Components/CommonTestAndPreview/messages.js +3 -49
  29. package/v2Components/CommonTestAndPreview/sagas.js +6 -15
  30. package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +284 -308
  31. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +65 -231
  32. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +5 -118
  33. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -341
  34. package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +1 -8
  35. package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +13 -34
  36. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +283 -281
  37. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
  38. package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -132
  39. package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
  40. package/v2Components/FormBuilder/index.js +10 -8
  41. package/v2Components/TemplatePreview/_templatePreview.scss +23 -33
  42. package/v2Components/TemplatePreview/index.js +28 -143
  43. package/v2Components/TemplatePreview/tests/index.test.js +0 -142
  44. package/v2Components/TestAndPreviewSlidebox/index.js +1 -13
  45. package/v2Components/TestAndPreviewSlidebox/sagas.js +4 -11
  46. package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +1 -3
  47. package/v2Containers/Assets/images/archive_Empty_Illustration.svg +9 -0
  48. package/v2Containers/CreativesContainer/SlideBoxContent.js +4 -36
  49. package/v2Containers/CreativesContainer/SlideBoxFooter.js +4 -11
  50. package/v2Containers/CreativesContainer/SlideBoxHeader.js +4 -29
  51. package/v2Containers/CreativesContainer/constants.js +0 -9
  52. package/v2Containers/CreativesContainer/index.js +108 -300
  53. package/v2Containers/CreativesContainer/index.scss +1 -51
  54. package/v2Containers/CreativesContainer/messages.js +4 -0
  55. package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -78
  56. package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +16 -79
  57. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -8
  58. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +98 -357
  59. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +18 -20
  60. package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
  61. package/v2Containers/Rcs/constants.js +8 -119
  62. package/v2Containers/Rcs/index.js +812 -2375
  63. package/v2Containers/Rcs/index.scss +6 -276
  64. package/v2Containers/Rcs/messages.js +3 -38
  65. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +70345 -98302
  66. package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +5 -0
  67. package/v2Containers/Rcs/tests/index.test.js +121 -152
  68. package/v2Containers/Rcs/tests/mockData.js +0 -38
  69. package/v2Containers/Rcs/tests/utils.test.js +30 -646
  70. package/v2Containers/Rcs/utils.js +11 -478
  71. package/v2Containers/Sms/Create/index.js +40 -100
  72. package/v2Containers/SmsTrai/Create/index.js +4 -9
  73. package/v2Containers/SmsTrai/Edit/constants.js +0 -2
  74. package/v2Containers/SmsTrai/Edit/index.js +130 -636
  75. package/v2Containers/SmsTrai/Edit/messages.js +4 -14
  76. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2296 -4249
  77. package/v2Containers/SmsWrapper/index.js +8 -37
  78. package/v2Containers/TagList/index.js +0 -6
  79. package/v2Containers/Templates/ChannelTypeIllustration.js +23 -6
  80. package/v2Containers/Templates/_templates.scss +126 -181
  81. package/v2Containers/Templates/actions.js +36 -11
  82. package/v2Containers/Templates/constants.js +23 -2
  83. package/v2Containers/Templates/index.js +333 -142
  84. package/v2Containers/Templates/messages.js +68 -0
  85. package/v2Containers/Templates/reducer.js +68 -0
  86. package/v2Containers/Templates/sagas.js +98 -55
  87. package/v2Containers/Templates/selectors.js +12 -0
  88. package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +12 -0
  89. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1256 -1042
  90. package/v2Containers/Templates/tests/index.test.js +6 -0
  91. package/v2Containers/Templates/tests/reducer.test.js +178 -0
  92. package/v2Containers/Templates/tests/sagas.test.js +436 -200
  93. package/v2Containers/Templates/tests/selector.test.js +32 -0
  94. package/v2Containers/TemplatesV2/TemplatesV2.style.js +1 -72
  95. package/v2Containers/TemplatesV2/index.js +23 -86
  96. package/v2Containers/Whatsapp/index.js +20 -3
  97. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -578
  98. package/utils/rcsPayloadUtils.js +0 -92
  99. package/utils/templateVarUtils.js +0 -201
  100. package/utils/tests/templateVarUtils.test.js +0 -204
  101. package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js.rej +0 -18
  102. package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
  103. package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
  104. package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -87
  105. package/v2Components/SmsFallback/constants.js +0 -73
  106. package/v2Components/SmsFallback/index.js +0 -955
  107. package/v2Components/SmsFallback/index.scss +0 -265
  108. package/v2Components/SmsFallback/messages.js +0 -78
  109. package/v2Components/SmsFallback/smsFallbackUtils.js +0 -118
  110. package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +0 -50
  111. package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +0 -147
  112. package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +0 -304
  113. package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +0 -197
  114. package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -277
  115. package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
  116. package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
  117. package/v2Components/TemplatePreview/constants.js +0 -2
  118. package/v2Components/VarSegmentMessageEditor/constants.js +0 -2
  119. package/v2Components/VarSegmentMessageEditor/index.js +0 -125
  120. package/v2Components/VarSegmentMessageEditor/index.scss +0 -46
  121. package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +0 -43
  122. package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -67
  123. package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +0 -90
  124. package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +0 -258
  125. package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +0 -125
  126. package/v2Containers/Rcs/index.js.rej +0 -1336
  127. package/v2Containers/Rcs/index.scss.rej +0 -74
  128. package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +0 -225
  129. package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap.rej +0 -128
  130. package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -318
  131. package/v2Containers/Sms/smsFormDataHelpers.js +0 -67
  132. package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +0 -253
  133. package/v2Containers/SmsTrai/Edit/index.scss +0 -121
  134. package/v2Containers/Templates/TemplatesActionBar.js +0 -101
  135. package/v2Containers/Templates/tests/TemplatesActionBar.test.js +0 -120
  136. package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +0 -180
  137. package/v2Containers/Templates/utils/smsTemplatesListApi.js +0 -79
  138. package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +0 -131
@@ -1,5 +1,6 @@
1
1
  import { fromJS } from "immutable";
2
2
  import { makeSelectTemplatesResponse } from "../selectors";
3
+ import { selectArchiveFilter, selectSelectedTemplateIds } from "../selectors";
3
4
 
4
5
  describe("Template selectors", () => {
5
6
  const mockState = fromJS({
@@ -15,3 +16,34 @@ describe("Template selectors", () => {
15
16
  });
16
17
  });
17
18
  });
19
+
20
+ describe("selectArchiveFilter selector", () => {
21
+ it("should return archiveFilter from state", () => {
22
+ const state = fromJS({
23
+ templates: { archiveFilter: 'archived' },
24
+ });
25
+ const result = selectArchiveFilter().resultFunc(state.get('templates').toJS());
26
+ expect(result).toBe('archived');
27
+ });
28
+
29
+ it("should default to 'active' when archiveFilter is not set", () => {
30
+ const result = selectArchiveFilter().resultFunc({});
31
+ expect(result).toBe('active');
32
+ });
33
+ });
34
+
35
+ describe("selectSelectedTemplateIds selector", () => {
36
+ it("should return selectedTemplateIds from state", () => {
37
+ const ids = ['id1', 'id2'];
38
+ const state = fromJS({
39
+ templates: { selectedTemplateIds: ids },
40
+ });
41
+ const result = selectSelectedTemplateIds().resultFunc(state.get('templates').toJS());
42
+ expect(result).toEqual(ids);
43
+ });
44
+
45
+ it("should default to [] when selectedTemplateIds is not set", () => {
46
+ const result = selectSelectedTemplateIds().resultFunc({});
47
+ expect(result).toEqual([]);
48
+ });
49
+ });
@@ -10,7 +10,7 @@ export default css`
10
10
 
11
11
  .component-wrapper {
12
12
  ${(props) => props.isFullMode ? `
13
- max-width: 71.25rem;
13
+ max-width: 1140px;
14
14
  margin: 0 auto;
15
15
  width: 100%;
16
16
  padding: ${CAP_SPACE_24} 0;
@@ -23,77 +23,6 @@ export default css`
23
23
  height: calc(100vh - 11.25rem);
24
24
  } `}
25
25
  }
26
-
27
- /* SMS fallback / local list: single pane skips .cap-tab-v2, so flex-fill the grid instead of viewport-fixed pagination height */
28
- .creatives-templates-container--local-sms.library-mode {
29
- display: flex;
30
- flex-direction: column;
31
- flex: 1;
32
- min-height: 0;
33
- height: 100%;
34
-
35
- .component-wrapper {
36
- display: flex;
37
- flex-direction: column;
38
- flex: 1;
39
- min-height: 0;
40
- height: 100%;
41
- }
42
-
43
- .templates-v2-local-sms-pane {
44
- display: flex;
45
- flex-direction: column;
46
- flex: 1;
47
- min-height: 0;
48
- overflow: hidden;
49
- height: 100%;
50
- }
51
-
52
- .templates-v2-local-sms-pane .creatives-templates-list.library-mode {
53
- display: flex;
54
- flex-direction: column;
55
- flex: 1;
56
- min-height: 0;
57
- overflow: hidden;
58
- height: 100%;
59
- }
60
-
61
- .templates-v2-local-sms-pane .creatives-templates-list.library-mode > .cap-row:first-of-type {
62
- flex: 1;
63
- min-height: 0;
64
- display: flex;
65
- flex-direction: column;
66
- overflow: hidden;
67
- }
68
-
69
- .templates-v2-local-sms-pane .creatives-templates-list.library-mode > .cap-row:first-of-type > div {
70
- flex: 1;
71
- min-height: 0;
72
- display: flex;
73
- flex-direction: column;
74
- overflow: hidden;
75
- }
76
-
77
- .templates-v2-local-sms-pane .creatives-templates-list.library-mode > .cap-row:first-of-type > div > div:first-child {
78
- flex: 1;
79
- min-height: 0;
80
- display: flex;
81
- flex-direction: column;
82
- overflow: hidden;
83
- }
84
-
85
- .templates-v2-local-sms-pane .v2-pagination-container,
86
- .templates-v2-local-sms-pane .v2-pagination-container-half {
87
- /* Match _templates local-SMS: bounded height so overflow-y scroll works (flex+100% alone often doesn’t) */
88
- flex: 0 1 auto;
89
- min-height: 0;
90
- height: calc(100vh - 12rem);
91
- max-height: calc(100vh - 12rem);
92
- overflow-y: auto;
93
- overflow-x: hidden;
94
- -webkit-overflow-scrolling: touch;
95
- }
96
- }
97
26
  `;
98
27
 
99
28
  export const CapTabStyle = css`
@@ -10,8 +10,8 @@ import { connect } from 'react-redux';
10
10
  import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
11
11
  import { createStructuredSelector } from 'reselect';
12
12
  import { bindActionCreators, compose } from 'redux';
13
- import { CapTab, CapCustomCard, CapButton, CapHeader, CapIcon, CapSpin, CapTooltip } from '@capillarytech/cap-ui-library';
14
- import { find, get, pick } from 'lodash';
13
+ import { CapTab, CapCustomCard, CapButton, CapHeader, CapSpin, CapIcon, CapTooltip } from '@capillarytech/cap-ui-library';
14
+ import { find, get } from 'lodash';
15
15
  import Helmet from 'react-helmet';
16
16
 
17
17
  import { UserIsAuthenticated } from '../../utils/authWrapper';
@@ -36,14 +36,13 @@ import { makeSelectAuthenticated, selectCurrentOrgDetails } from "../../v2Contai
36
36
  import {
37
37
  CALL_TASK,
38
38
  COMMON_CHANNELS,
39
- LOCAL_TEMPLATE_CONFIG_KEYS_FOR_PICK,
40
39
  LOYALTY_SUPPORTED_ACTION,
41
40
  MOBILE_PUSH,
42
41
  NORMALIZED_CHANNEL_ALIASES,
43
42
  SMS,
44
43
  } from "../CreativesContainer/constants";
45
44
 
46
- const { CapCustomCardList } = CapCustomCard;
45
+ const {CapCustomCardList} = CapCustomCard;
47
46
 
48
47
  const StyledCapTab = withStyles(CapTab, CapTabStyle);
49
48
  export class TemplatesV2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
@@ -120,9 +119,9 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
120
119
  return !normalizedChannelsToHideSet.has(paneKey);
121
120
  });
122
121
 
123
- if (isFullMode && !normalizedChannelsToHideSet.has(normalizeChannel(ASSETS))) {
124
- filteredPanes.push({ content: <div></div>, tab: intl.formatMessage(messages.gallery), key: ASSETS });
125
- } else if (!isFullMode) {
122
+ if (isFullMode) {
123
+ filteredPanes.push({ content: <div></div>, tab: intl.formatMessage(messages.gallery), key: 'assets' });
124
+ } else {
126
125
  // Add special-mode panes only when not hidden (use normalized checks)
127
126
  if (!normalizedChannelsToHideSet.has(CALL_TASK.toLowerCase())) {
128
127
  filteredPanes.push({ content: <div></div>, tab: intl.formatMessage(messages.callTask), key: CALL_TASK.toLowerCase() });
@@ -223,8 +222,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
223
222
  this.setState({selectedChannel: nextProps.channel, panes });
224
223
  }
225
224
  }
226
-
227
- getTemplateDataForGrid = ({ templates, handlers, filterContent, channel, isLoading, loadingTip }) => {
225
+ getTemplateDataForGrid = ({templates, handlers, filterContent, channel, isLoading, loadingTip}) => {
228
226
  const currentChannel = channel.toUpperCase();
229
227
  const cardDataList = templates.map((template) => {
230
228
  const templateData =
@@ -250,8 +248,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
250
248
  </CapSpin>
251
249
 
252
250
  </div>);
253
- };
254
-
251
+ }
255
252
  getGalleryComponent = (location) => <Gallery location={location} isFullMode={this.props.isFullMode}/>
256
253
  getCallTaskComponent = () => (
257
254
  <CallTask
@@ -315,29 +312,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
315
312
  if (messageStrategy !== "X_ENGAGE" && channel === 'facebook' && !isFullMode) {
316
313
  return this.getFacebookComponent();
317
314
  }
318
- const localConfig = this.props.localTemplatesConfig || pick(this.props, LOCAL_TEMPLATE_CONFIG_KEYS_FOR_PICK);
319
- const useLocalTemplates = localConfig.useLocalTemplates;
320
- if (useLocalTemplates && channel === (this.props.channel || 'sms')) {
321
- // Reuse full Templates component (same UI as Redux flow) with local data only
322
- const location = { pathname: `/${channel}`, search: '', query: !this.props.isFullMode ? { type: 'embedded', module: 'library' } : {} };
323
- return (
324
- <Templates
325
- key={`${channel}-local`}
326
- location={location}
327
- route={{ name: channel }}
328
- router={this.props.router}
329
- isFullMode={this.props.isFullMode}
330
- createNew={this.props.createNew}
331
- onSelectTemplate={this.props.onSelectTemplate}
332
- handlePeviewTemplate={this.props.handlePeviewTemplate}
333
- messageStrategy={this.props.messageStrategy}
334
- smsRegister={this.props.smsRegister}
335
- hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
336
- localTemplatesConfig={localConfig}
337
- />
338
- );
339
- }
340
-
341
315
  const location = {pathname: `/${channel}`, search: '', query};
342
316
  switch (channel) {
343
317
  case 'call_task':
@@ -387,55 +361,29 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
387
361
  }
388
362
  render() {
389
363
  const { isFullMode, className, cap = {}, Global = {}} = this.props;
390
- const useLocalTemplates = get(this.props, 'localTemplatesConfig.useLocalTemplates', false);
391
364
  const { accessiblePermissions = []} = cap.user || Global.user || {};
392
365
  let isCreativeAccessible = true;
393
366
  if (!accessiblePermissions.includes(CREATIVES_UI_VIEW)) {
394
367
  isCreativeAccessible = false;
395
368
  }
396
- // Recompute active pane content every render so local-list mode updates
397
- // (templates/loading/search UI) are not stuck with the initial cached pane.
398
- const panes = this.setChannelContent(this.state.selectedChannel, this.state.panes);
399
- const hideChannelTabsForLocalSms = useLocalTemplates && panes.length === 1;
400
- const activeLocalPane = hideChannelTabsForLocalSms
401
- ? (panes.find(
402
- (p) => String(p.key).toLowerCase() === String(this.state.selectedChannel).toLowerCase(),
403
- ) || panes[0])
404
- : null;
405
369
  return (
406
370
  !isCreativeAccessible ? <AccessForbidden /> : (
407
- <div
408
- className={`${className} creatives-templates-container ${isFullMode ? 'fullmode' : 'library-mode'}${useLocalTemplates ? ' creatives-templates-container--local-sms' : ''}`}
409
- data-testid="cap-wrapper"
410
- >
411
- {isFullMode && !useLocalTemplates && (
412
- <Helmet
413
- title={this.props.intl.formatMessage(messages.creatives)}
414
- meta={[
415
- { name: 'description', content: this.props.intl.formatMessage(messages.creativesDesc) },
416
- ]}
417
- />
418
- )}
371
+ <div className={`${className} creatives-templates-container ${isFullMode ? 'fullmode' : 'library-mode'}`} data-testid="cap-wrapper">
372
+ {isFullMode && <Helmet
373
+ title={this.props.intl.formatMessage(messages.creatives)}
374
+ meta={[
375
+ { name: 'description', content: this.props.intl.formatMessage(messages.creativesDesc) },
376
+ ]}
377
+ />}
419
378
  <div className="component-wrapper">
420
- {isFullMode && (
421
- <CapHeader
422
- title={<FormattedMessage {...messages.creatives} />}
423
- {...(!useLocalTemplates && {
424
- description: <FormattedMessage {...messages.creativesDesc} />,
425
- })}
426
- />
427
- )}
428
- {hideChannelTabsForLocalSms ? (
429
- <div className="templates-v2-local-sms-pane">{activeLocalPane?.content}</div>
430
- ) : (
431
- <StyledCapTab
432
- panes={panes}
433
- onChange={this.channelChange}
434
- activeKey={this.state.selectedChannel}
435
- defaultActiveKey={this.state.selectedChannel}
436
- isFullMode={isFullMode}
437
- />
438
- )}
379
+ {isFullMode && <CapHeader title={<FormattedMessage {...messages.creatives}/>} description={<FormattedMessage {...messages.creativesDesc}/>}/>}
380
+ <StyledCapTab
381
+ panes={this.state.panes}
382
+ onChange={this.channelChange}
383
+ activeKey={this.state.selectedChannel}
384
+ defaultActiveKey={this.state.selectedChannel}
385
+ isFullMode={isFullMode}
386
+ />
439
387
  </div>
440
388
  </div>
441
389
  )
@@ -467,17 +415,6 @@ TemplatesV2.propTypes = {
467
415
  currentOrgDetails: PropTypes.object,
468
416
  restrictPersonalization: PropTypes.bool,
469
417
  isAnonymousType: PropTypes.bool,
470
- // Optional: reuse grid UI with local template list (e.g. SMS fallback). Pass object or same keys as individual props.
471
- localTemplatesConfig: PropTypes.shape({
472
- useLocalTemplates: PropTypes.bool,
473
- localTemplates: PropTypes.arrayOf(PropTypes.object),
474
- localTemplatesLoading: PropTypes.bool,
475
- localTemplatesLoadingTip: PropTypes.string,
476
- localTemplatesFilterContent: PropTypes.node,
477
- localTemplatesFooterContent: PropTypes.node,
478
- localTemplatesOnPageChange: PropTypes.func,
479
- localTemplatesUseSkeleton: PropTypes.bool,
480
- }),
481
418
  };
482
419
 
483
420
  TemplatesV2.defaultProps = {
@@ -118,7 +118,6 @@ import { ANDROID } from '../../v2Components/CommonTestAndPreview/constants';
118
118
  import CapImageUpload from '../../v2Components/CapImageUpload';
119
119
  import TagList from '../TagList';
120
120
  import { validateTags } from '../../utils/tagValidations';
121
- import { splitContentByOrderedVarTokens } from '../../utils/templateVarUtils';
122
121
  import { capitalizeString } from '../../utils/Formatter';
123
122
  import CapWhatsappCTA from '../../v2Components/CapWhatsappCTA';
124
123
  import {
@@ -484,10 +483,28 @@ export const Whatsapp = (props) => {
484
483
  );
485
484
  };
486
485
 
486
+ const converStringToVarArr = (validVarArr, content) => {
487
+ const templateVarArray = [];
488
+ while (content?.length !== 0) {
489
+ //converting content string to an array split at var
490
+ const index = content.indexOf(validVarArr?.[0]);
491
+ if (index !== -1) {
492
+ templateVarArray.push(content.substring(0, index)); //push string before var
493
+ templateVarArray.push(validVarArr?.[0]); //push var
494
+ content = content.substring(index + validVarArr?.[0]?.length, content?.length); //remaining str
495
+ validVarArr?.shift(); //remove considered var
496
+ } else {
497
+ templateVarArray.push(content); //remaining str
498
+ break;
499
+ }
500
+ }
501
+ return templateVarArray;
502
+ }
503
+
487
504
  const computeTextMessage = (msg, varMap, regex) => {
488
505
  const validVarArr = msg?.match(regex) || [];
489
506
  //conerting msg string to variable arr
490
- const templateHeaderArray = splitContentByOrderedVarTokens(validVarArr, msg);
507
+ const templateHeaderArray = converStringToVarArr(validVarArr, msg);
491
508
  if (templateHeaderArray?.length !== 0) {
492
509
  let clonedVarMap = {};
493
510
  if (!isEmpty(varMap)) {
@@ -541,7 +558,7 @@ export const Whatsapp = (props) => {
541
558
  setUnsubscribeRequired(true);
542
559
  }
543
560
  //converting msg string to variable arr
544
- const templateMessageArray = splitContentByOrderedVarTokens(validVarArr, msg);
561
+ const templateMessageArray = converStringToVarArr(validVarArr, msg);
545
562
  updateTempMsgArray(templateMessageArray.filter((i) => i === 0 || i));
546
563
  };
547
564