@capillarytech/creatives-library 8.0.353-alpha.5 → 8.0.353

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 (23) hide show
  1. package/package.json +1 -1
  2. package/v2Components/CommonTestAndPreview/UnifiedPreview/PreviewHeader.js +0 -17
  3. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +0 -70
  4. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +5 -44
  5. package/v2Components/CommonTestAndPreview/constants.js +0 -2
  6. package/v2Components/CommonTestAndPreview/index.js +2 -51
  7. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/PreviewHeader.test.js +0 -159
  8. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +0 -255
  9. package/v2Components/CommonTestAndPreview/tests/constants.test.js +1 -2
  10. package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -194
  11. package/v2Components/FormBuilder/index.js +162 -52
  12. package/v2Components/TestAndPreviewSlidebox/index.js +2 -2
  13. package/v2Containers/App/constants.js +0 -3
  14. package/v2Containers/CreativesContainer/index.js +60 -24
  15. package/v2Containers/Templates/index.js +2 -68
  16. package/v2Containers/WebPush/Create/index.js +8 -91
  17. package/v2Containers/WebPush/Create/index.scss +0 -7
  18. package/v2Components/CommonTestAndPreview/UnifiedPreview/WebPushPreviewContent.js +0 -169
  19. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/WebPushPreviewContent.test.js +0 -522
  20. package/v2Containers/App/tests/constants.test.js +0 -61
  21. package/v2Containers/Templates/tests/webpush.test.js +0 -375
  22. package/v2Containers/WebPush/Create/tests/getTemplateContent.test.js +0 -338
  23. package/v2Containers/WebPush/Create/tests/testAndPreviewIntegration.test.js +0 -325
@@ -79,6 +79,69 @@ const errorMessageForTags = {
79
79
  TAG_BRACKET_COUNT_MISMATCH_ERROR: 'tagBracketCountMismatchError'
80
80
  };
81
81
 
82
+ // Isolated input for EMAIL template-name: only this tiny component re-renders on each keystroke.
83
+ // formData is updated only on blur (onCommit), eliminating all re-renders during typing.
84
+ class HighFreqInput extends React.Component {
85
+ constructor(props) {
86
+ super(props);
87
+ this.state = { localValue: props.value || '' };
88
+ }
89
+
90
+ componentDidUpdate(prevProps) {
91
+ if (prevProps.value !== this.props.value && this.state.localValue !== this.props.value) {
92
+ this.setState({ localValue: this.props.value || '' });
93
+ }
94
+ }
95
+
96
+ handleChange = (e) => {
97
+ this.setState({ localValue: e.target.value });
98
+ };
99
+
100
+ handleBlur = (e) => {
101
+ this.props.onCommit(this.state.localValue);
102
+ if (this.props.onBlur) this.props.onBlur(e);
103
+ };
104
+
105
+ render() {
106
+ const { value: _v, onCommit: _oc, onBlur: _ob, ...rest } = this.props;
107
+ return <CapInput {...rest} value={this.state.localValue} onChange={this.handleChange} onBlur={this.handleBlur} />;
108
+ }
109
+ }
110
+
111
+ // Isolated wrapper for EMAIL template-subject: blur-only commit, same as HighFreqInput.
112
+ class HighFreqTagInput extends React.Component {
113
+ constructor(props) {
114
+ super(props);
115
+ this.state = { localInputValue: props.inputValue || '' };
116
+ }
117
+
118
+ componentDidUpdate(prevProps) {
119
+ if (prevProps.inputValue !== this.props.inputValue && this.state.localInputValue !== this.props.inputValue) {
120
+ this.setState({ localInputValue: this.props.inputValue || '' });
121
+ }
122
+ }
123
+
124
+ handleInputChange = (e) => {
125
+ this.setState({ localInputValue: e.target.value });
126
+ };
127
+
128
+ handleBlur = () => {
129
+ this.props.onCommit(this.state.localInputValue);
130
+ };
131
+
132
+ render() {
133
+ const { inputValue: _iv, onCommit: _oc, inputOnChange: _ic, ...rest } = this.props;
134
+ return (
135
+ <CapTagListWithInput
136
+ {...rest}
137
+ inputValue={this.state.localInputValue}
138
+ inputOnChange={this.handleInputChange}
139
+ inputProps={{ ...(this.props.inputProps || {}), onBlur: this.handleBlur }}
140
+ />
141
+ );
142
+ }
143
+ }
144
+
82
145
  class FormBuilder extends React.Component { // eslint-disable-line react/prefer-stateless-function
83
146
  constructor(props) {
84
147
  super(props);
@@ -352,6 +415,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
352
415
  this.setState({tabCount: nextProps.tabCount});
353
416
  }
354
417
  if (nextProps.startValidation && nextProps.startValidation !== false && this.props.startValidation !== nextProps.startValidation) {
418
+ if (this.debouncedUpdateFormData) this.debouncedUpdateFormData.flush();
355
419
  this.setState({checkValidation: true});
356
420
  this.validateForm(null, null, true, true, () => {
357
421
  //triggering the saveFormData or onSubmit when validation sets isFormValid to TRUE
@@ -3410,26 +3474,25 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3410
3474
  ? formatMessage(messages.personalizationTagsErrorMessage)
3411
3475
  : (errorType === TAG_BRACKET_COUNT_MISMATCH_ERROR ? formatMessage(globalMessages.unbalanacedCurlyBraces) : (val.errorMessage && ifError ? val.errorMessage : ''));
3412
3476
  if (styling === 'semantic') {
3413
- columns.push(
3414
- <CapColumn key={val.id} span={val.width} offset={val.offset} style={val.style || {}}>
3415
- <CapInput
3416
- id={val.id}
3417
- errorMessage={errorMessageText}
3418
- label={val.label}
3419
- inductiveText={val.inductiveText}
3420
- className={`input-primary chart-name-input${ifError ? ' error' : ''}`}
3421
- // fluid={val.fluid}
3422
- style={val.style ? val.style : {}}
3423
- placeholder={val.placeholder}
3424
- onChange={(e) => this.updateFormData(e.target.value, val)}
3425
- onBlur={(e) => this.handleFieldBlur(e, val)}
3426
- value={value || ""}
3427
- defaultValue={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
3428
- disabled={val.disabled}
3429
- size={val.size || "default"}
3430
- />
3431
- {this.props.schema?.channel === EMAIL &&
3432
- !aiContentBotDisabled && (
3477
+ const isEmailStandaloneHighFreq = val.standalone && this.props.schema?.channel?.toUpperCase() === EMAIL;
3478
+ if (isEmailStandaloneHighFreq) {
3479
+ columns.push(
3480
+ <CapColumn key={val.id} span={val.width} offset={val.offset} style={val.style || {}}>
3481
+ <HighFreqInput
3482
+ id={val.id}
3483
+ errorMessage={errorMessageText}
3484
+ label={val.label}
3485
+ inductiveText={val.inductiveText}
3486
+ className={`input-primary chart-name-input${ifError ? ' error' : ''}`}
3487
+ style={val.style ? val.style : {}}
3488
+ placeholder={val.placeholder}
3489
+ onCommit={(newValue) => this.performFormDataUpdate(newValue, val)}
3490
+ onBlur={(e) => this.handleFieldBlur(e, val)}
3491
+ value={value || ""}
3492
+ disabled={val.disabled}
3493
+ size={val.size || "default"}
3494
+ />
3495
+ {!aiContentBotDisabled && (
3433
3496
  <CapAskAira.ContentGenerationBot
3434
3497
  text={value || ""}
3435
3498
  setText={this.handleSetText.bind(this, val)}
@@ -3438,12 +3501,48 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3438
3501
  rootStyle={{
3439
3502
  bottom: "0.2rem",
3440
3503
  right: "0.2rem",
3441
- left: "auto",
3504
+ left: "auto",
3442
3505
  }}
3443
3506
  />
3444
3507
  )}
3445
- </CapColumn>
3446
- );
3508
+ </CapColumn>
3509
+ );
3510
+ } else {
3511
+ columns.push(
3512
+ <CapColumn key={val.id} span={val.width} offset={val.offset} style={val.style || {}}>
3513
+ <CapInput
3514
+ id={val.id}
3515
+ errorMessage={errorMessageText}
3516
+ label={val.label}
3517
+ inductiveText={val.inductiveText}
3518
+ className={`input-primary chart-name-input${ifError ? ' error' : ''}`}
3519
+ // fluid={val.fluid}
3520
+ style={val.style ? val.style : {}}
3521
+ placeholder={val.placeholder}
3522
+ onChange={(e) => this.updateFormData(e.target.value, val)}
3523
+ onBlur={(e) => this.handleFieldBlur(e, val)}
3524
+ value={value || ""}
3525
+ defaultValue={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
3526
+ disabled={val.disabled}
3527
+ size={val.size || "default"}
3528
+ />
3529
+ {this.props.schema?.channel === EMAIL &&
3530
+ !aiContentBotDisabled && (
3531
+ <CapAskAira.ContentGenerationBot
3532
+ text={value || ""}
3533
+ setText={this.handleSetText.bind(this, val)}
3534
+ iconPlacement="float-br"
3535
+ iconSize="1.6rem"
3536
+ rootStyle={{
3537
+ bottom: "0.2rem",
3538
+ right: "0.2rem",
3539
+ left: "auto",
3540
+ }}
3541
+ />
3542
+ )}
3543
+ </CapColumn>
3544
+ );
3545
+ }
3447
3546
  }
3448
3547
  break;
3449
3548
 
@@ -3684,37 +3783,48 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3684
3783
  isBEEAppEnableForCapTagList === false ||
3685
3784
  channelForCapTagList !== 'EMAIL'
3686
3785
  ) {
3786
+ const isEmailStandaloneSubject = val.standalone && channelForCapTagList === EMAIL && val.id === 'template-subject';
3787
+ const tagListProps = {
3788
+ key: `input-${val.id}`,
3789
+ inputId: val.id,
3790
+ inputValue: this.state.formData[val.id] || '',
3791
+ inputPlaceholder: val.placeholder || '',
3792
+ inputErrorMessage: val.errorMessage && ifError ? val.errorMessage : '',
3793
+ inputRequired: val.required || false,
3794
+ inputDisabled: val.disabled || false,
3795
+ headingText: val.label || '',
3796
+ headingStyle: val.headingStyle || { marginTop: '3%', marginRight: '79%' },
3797
+ headingType: "h4",
3798
+ onTagSelect: (data) => this.callChildEvent(data, val, 'onTagSelect'),
3799
+ onContextChange: this.props.onContextChange,
3800
+ location: this.props.location,
3801
+ tags: this.props.tags ? this.props.tags : [],
3802
+ injectedTags: this.props.injectedTags ? this.props.injectedTags : {},
3803
+ className: val.className ? val.className : '',
3804
+ userLocale: this.state.translationLang,
3805
+ selectedOfferDetails: this.props.selectedOfferDetails,
3806
+ eventContextTags: this.props?.eventContextTags,
3807
+ waitEventContextTags: this.props?.waitEventContextTags,
3808
+ moduleFilterEnabled: moduleFilterEnabledForCapTagList,
3809
+ containerStyle: val.style || {},
3810
+ inputProps: val.inputProps || {},
3811
+ showInput: val.showInput !== false,
3812
+ showTagList: val.showTagList !== false,
3813
+ restrictPersonalization: this.props.restrictPersonalization,
3814
+ };
3687
3815
  columns.push(
3688
3816
  <CapColumn key={`input-${val.id}`} offset={val.offset} span={val.width ? val.width : ''} style={val.style ? val.style : {marginBottom: '16px'}}>
3689
- <CapTagListWithInput
3690
- key={`input-${val.id}`}
3691
- inputId={val.id}
3692
- inputValue={this.state.formData[val.id] || ''}
3693
- inputOnChange={(e) => this.updateFormData(e.target.value, val)}
3694
- inputPlaceholder={val.placeholder || ''}
3695
- inputErrorMessage={val.errorMessage && ifError ? val.errorMessage : ''}
3696
- inputRequired={val.required || false}
3697
- inputDisabled={val.disabled || false}
3698
- headingText={val.label || ''}
3699
- headingStyle={val.headingStyle || { marginTop: '3%', marginRight: '79%' }}
3700
- headingType="h4"
3701
- onTagSelect={(data) => this.callChildEvent(data, val, 'onTagSelect')}
3702
- onContextChange={this.props.onContextChange}
3703
- location={this.props.location}
3704
- tags={this.props.tags ? this.props.tags : []}
3705
- injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
3706
- className={val.className ? val.className : ''}
3707
- userLocale={this.state.translationLang}
3708
- selectedOfferDetails={this.props.selectedOfferDetails}
3709
- eventContextTags={this.props?.eventContextTags}
3710
- waitEventContextTags={this.props?.waitEventContextTags}
3711
- moduleFilterEnabled={moduleFilterEnabledForCapTagList}
3712
- containerStyle={val.style || {}}
3713
- inputProps={val.inputProps || {}}
3714
- showInput={val.showInput !== false}
3715
- showTagList={val.showTagList !== false}
3716
- restrictPersonalization={this.props.restrictPersonalization}
3717
- />
3817
+ {isEmailStandaloneSubject ? (
3818
+ <HighFreqTagInput
3819
+ {...tagListProps}
3820
+ onCommit={(newValue) => this.performFormDataUpdate(newValue, val)}
3821
+ />
3822
+ ) : (
3823
+ <CapTagListWithInput
3824
+ {...tagListProps}
3825
+ inputOnChange={(e) => this.updateFormData(e.target.value, val)}
3826
+ />
3827
+ )}
3718
3828
  </CapColumn>
3719
3829
  );
3720
3830
  }
@@ -69,8 +69,8 @@ const TestAndPreviewSlidebox = (props) => {
69
69
 
70
70
  TestAndPreviewSlidebox.propTypes = {
71
71
  // Channel prop - supports all channels
72
- channel: PropTypes.oneOf([CHANNELS.EMAIL, CHANNELS.SMS, CHANNELS.RCS, CHANNELS.WHATSAPP, CHANNELS.INAPP, CHANNELS.MOBILEPUSH, CHANNELS.VIBER, CHANNELS.ZALO, CHANNELS.WEBPUSH]),
73
- currentChannel: PropTypes.oneOf([CHANNELS.EMAIL, CHANNELS.SMS, CHANNELS.RCS, CHANNELS.WHATSAPP, CHANNELS.INAPP, CHANNELS.MOBILEPUSH, CHANNELS.VIBER, CHANNELS.ZALO, CHANNELS.WEBPUSH]), // Alternative prop name for backward compatibility
72
+ channel: PropTypes.oneOf([CHANNELS.EMAIL, CHANNELS.SMS, CHANNELS.RCS, CHANNELS.WHATSAPP, CHANNELS.INAPP, CHANNELS.MOBILEPUSH]),
73
+ currentChannel: PropTypes.oneOf([CHANNELS.EMAIL, CHANNELS.SMS, CHANNELS.RCS, CHANNELS.WHATSAPP, CHANNELS.INAPP, CHANNELS.MOBILEPUSH]), // Alternative prop name for backward compatibility
74
74
  // All original props are passed through
75
75
  show: PropTypes.bool.isRequired,
76
76
  onClose: PropTypes.func.isRequired,
@@ -124,6 +124,3 @@ export const LOYALTY = 'loyalty';
124
124
  export const FAILURE = 'FAILURE';
125
125
  export const DATE_DISPLAY_FORMAT = 'D MMM YYYY';
126
126
  export const TIME_DISPLAY_FORMAT = 'hh:mm A';
127
- export const EXTERNAL_URL = 'EXTERNAL_URL';
128
- export const URL = 'URL';
129
- export const SITE_URL = 'SITE_URL';
@@ -1,4 +1,48 @@
1
1
  import React from 'react';
2
+
3
+ // Isolated input for the email template name field.
4
+ // Manages its own value in local state so keystrokes only re-render this
5
+ // small component, not the entire CreativesContainer → Email → FormBuilder tree.
6
+ class TemplateNameInputField extends React.Component {
7
+ constructor(props) {
8
+ super(props);
9
+ this.state = { localValue: props.initialValue || '' };
10
+ }
11
+
12
+ componentDidUpdate(prevProps) {
13
+ // Sync from props only when the external value changed AND the user hasn't
14
+ // diverged from the previous prop value. This handles async data-load in edit
15
+ // mode without overwriting what the user is actively typing.
16
+ if (
17
+ prevProps.initialValue !== this.props.initialValue &&
18
+ this.state.localValue === (prevProps.initialValue || '')
19
+ ) {
20
+ this.setState({ localValue: this.props.initialValue || '' });
21
+ }
22
+ }
23
+
24
+ handleChange = (ev) => {
25
+ const { value } = ev.currentTarget;
26
+ this.setState({ localValue: value });
27
+ if (this.props.onChange) this.props.onChange(value);
28
+ };
29
+
30
+ handleBlur = () => {
31
+ if (this.props.onBlur) this.props.onBlur(this.state.localValue);
32
+ };
33
+
34
+ render() {
35
+ const { onChange: _onChange, initialValue: _initialValue, onBlur: _ob, ...rest } = this.props;
36
+ return (
37
+ <CapInput
38
+ {...rest}
39
+ value={this.state.localValue}
40
+ onChange={this.handleChange}
41
+ onBlur={this.handleBlur}
42
+ />
43
+ );
44
+ }
45
+ }
2
46
  import PropTypes from 'prop-types';
3
47
  import {
4
48
  CAP_SPACE_16, CAP_SPACE_32, CAP_SPACE_56, CAP_SPACE_64,
@@ -1753,30 +1797,22 @@ export class Creatives extends React.Component {
1753
1797
  } />
1754
1798
  )
1755
1799
 
1756
- templateNameComponentInput = ({ formData, onFormDataChange, name }) => {
1757
- // Use local state for immediate UI feedback, fallback to prop value
1758
- const displayValue = this.state.localTemplateName !== '' ? this.state.localTemplateName : name;
1759
-
1760
- return (
1761
- <CapInput
1762
- value={displayValue}
1763
- suffix={<span />}
1764
- onBlur={() => {
1765
- this.setState({
1766
- isEditName: false,
1767
- localTemplateName: '', // Clear local state on blur
1768
- }, () => {
1769
- this.showTemplateName({ formData, onFormDataChange });
1770
- });
1771
- }}
1772
- onChange={(ev) => {
1773
- const { value } = ev.currentTarget;
1774
- // Use optimized update for better performance
1775
- this.updateTemplateNameImmediately(value, formData, onFormDataChange);
1776
- }}
1777
- />
1778
- );
1779
- }
1800
+ templateNameComponentInput = ({ formData, onFormDataChange, name }) => (
1801
+ <TemplateNameInputField
1802
+ initialValue={name}
1803
+ suffix={<span />}
1804
+ onBlur={(committedValue) => {
1805
+ this.performTemplateNameUpdate(committedValue, formData, onFormDataChange);
1806
+ this.setState({ isEditName: false });
1807
+ }}
1808
+ onChange={(value) => {
1809
+ const isEmptyTemplateName = !value.trim();
1810
+ if (this.state.isTemplateNameEmpty !== isEmptyTemplateName) {
1811
+ this.setState({ isTemplateNameEmpty: isEmptyTemplateName });
1812
+ }
1813
+ }}
1814
+ />
1815
+ )
1780
1816
 
1781
1817
  showTemplateName = ({ formData, onFormDataChange }) => { //gets called from email/index after template data is fetched
1782
1818
  const {
@@ -104,9 +104,6 @@ import {
104
104
  VIBER as VIBER_CHANNEL,
105
105
  FACEBOOK as FACEBOOK_CHANNEL,
106
106
  CREATE,
107
- EXTERNAL_URL,
108
- URL,
109
- SITE_URL,
110
107
  } from '../App/constants';
111
108
  import {MAX_WHATSAPP_TEMPLATES, WARNING_WHATSAPP_TEMPLATES , ACCOUNT_MAPPING_ON_CHANNEL, noFilteredWhatsappZaloTemplatesTitle, noFilteredWhatsappZaloTemplatesDesc, noApprovedWhatsappZaloTemplatesTitle, noApprovedWhatsappTemplatesDesc, zaloDescIllustration, noApprovedRcsTemplatesTitle, noApprovedRcsTemplatesDesc, ARCHIVE_STATUS_ACTIVE, ARCHIVE_STATUS_ARCHIVED, ARCHIVE_REFRESH_TYPE_ARCHIVE, ARCHIVE_REFRESH_TYPE_UNARCHIVE} from './constants';
112
109
  import { COPY_OF, EMBEDDED } from '../../constants/unified';
@@ -1402,69 +1399,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1402
1399
  };
1403
1400
  }
1404
1401
 
1405
- case WEBPUSH: {
1406
- // WebPush content is stored in creatives format (brandIcon, onClickAction, ctas)
1407
- // Must be transformed to campaign/test-message format matching getTemplateContent() in WebPush/Create/index.js
1408
- const webpushContent = get(baseContent, 'content.webpush', {});
1409
- const title = webpushContent?.title || '';
1410
- const message = webpushContent?.message || '';
1411
- const accountId = get(template, 'definition.accountId', null);
1412
- const templateName = template?.name || '';
1413
-
1414
- // iconImageUrl stored as brandIcon in creatives format
1415
- const iconImageUrl = webpushContent?.brandIcon || webpushContent?.iconImageUrl || undefined;
1416
-
1417
- // cta stored as onClickAction in creatives format (type: URL|SITE_URL, url)
1418
- // or already as cta in campaign format (type: EXTERNAL_URL|SITE_URL, actionLink)
1419
- let cta = null;
1420
- const onClickAction = webpushContent?.onClickAction;
1421
- const existingCta = webpushContent?.cta;
1422
- if (onClickAction) {
1423
- const ctaType = onClickAction.type === URL ? EXTERNAL_URL : (onClickAction.type || SITE_URL);
1424
- cta = { type: ctaType, actionLink: onClickAction.url || '' };
1425
- } else if (existingCta) {
1426
- cta = { type: existingCta.type || EXTERNAL_URL, actionLink: existingCta.actionLink || '' };
1427
- }
1428
-
1429
- // expandableDetails: image → media[], ctas[] → mapped ctas
1430
- const image = webpushContent?.image;
1431
- const rawCtas = webpushContent?.ctas;
1432
- const existingExpandable = webpushContent?.expandableDetails;
1433
- let expandableDetails = null;
1434
- const hasImage = !!image;
1435
- const hasCtas = Array.isArray(rawCtas) && rawCtas.length > 0;
1436
- if (hasImage || hasCtas) {
1437
- expandableDetails = {
1438
- media: hasImage ? [{ url: image, type: IMAGE }] : [],
1439
- ctas: hasCtas ? rawCtas.map((ctaItem) => ({
1440
- type: ctaItem?.type === URL ? EXTERNAL_URL : (ctaItem?.type || EXTERNAL_URL),
1441
- action: ctaItem?.action || '',
1442
- title: ctaItem?.actionText || ctaItem?.title || '',
1443
- actionLink: ctaItem?.actionLink || '',
1444
- })) : [],
1445
- };
1446
- } else if (existingExpandable) {
1447
- expandableDetails = {
1448
- media: existingExpandable?.media || [],
1449
- ctas: existingExpandable?.ctas || [],
1450
- };
1451
- }
1452
-
1453
- return {
1454
- channel: WEBPUSH,
1455
- accountId,
1456
- content: {
1457
- title,
1458
- message,
1459
- ...(iconImageUrl ? { iconImageUrl } : {}),
1460
- ...(cta ? { cta } : {}),
1461
- ...(expandableDetails ? { expandableDetails } : {}),
1462
- },
1463
- messageSubject: templateName || title,
1464
- offers: [],
1465
- };
1466
- }
1467
-
1468
1402
  default:
1469
1403
  console.warn(`Unsupported channel for content extraction: ${channelUpper}`);
1470
1404
  return null;
@@ -1477,7 +1411,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1477
1411
  * @returns {Boolean} - True if channel supports Test and Preview
1478
1412
  */
1479
1413
  isTestAndPreviewSupported = () => {
1480
- const supportedChannels = [EMAIL, SMS, INAPP, MOBILE_PUSH, VIBER, ZALO, WEBPUSH];
1414
+ const supportedChannels = [EMAIL, SMS, INAPP, MOBILE_PUSH, VIBER, ZALO];
1481
1415
  return supportedChannels.includes(this.state.channel.toUpperCase());
1482
1416
  }
1483
1417
 
@@ -2037,7 +1971,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2037
1971
  // Show preview icon only for channels that don't support Test and Preview
2038
1972
  (() => {
2039
1973
  // Channels that have Test and Preview integrated
2040
- const testAndPreviewChannels = [EMAIL, SMS, WHATSAPP, RCS, INAPP, MOBILE_PUSH, VIBER, ZALO, WEBPUSH];
1974
+ const testAndPreviewChannels = [EMAIL, SMS, WHATSAPP, RCS, INAPP, MOBILE_PUSH, VIBER, ZALO];
2041
1975
  const isTestAndPreviewSupported = testAndPreviewChannels.includes(currentChannel.toUpperCase());
2042
1976
 
2043
1977
  // Don't show preview icon if channel supports Test and Preview
@@ -45,8 +45,6 @@ import {
45
45
  ACTION_TYPES,
46
46
  NOTIFICATION_TITLE_MAX_LENGTH,
47
47
  MESSAGE_MAX_LENGTH,
48
- EXTERNAL_URL,
49
- SITE_URL,
50
48
  } from '../constants';
51
49
  import * as actions from '../actions';
52
50
  import {
@@ -75,9 +73,6 @@ import {
75
73
  import './index.scss';
76
74
  import { WEBPUSH } from '../../CreativesContainer/constants';
77
75
  import { isAiContentBotDisabled } from '../../../utils/common';
78
- import TestAndPreviewSlidebox from '../../../v2Components/TestAndPreviewSlidebox';
79
- import creativesMessages from '../../CreativesContainer/messages';
80
- import CapButton from '@capillarytech/cap-ui-library/CapButton';
81
76
 
82
77
  // Memoized TagList wrapper components for better performance
83
78
  const MemoizedTagList = memo(({
@@ -187,7 +182,6 @@ const WebPushCreate = ({
187
182
  const [redirectUrlError, setRedirectUrlError] = useState('');
188
183
  const [activeUploadField, setActiveUploadField] = useState(null);
189
184
  const [templateIdError, setTemplateIdError] = useState('');
190
- const [showTestAndPreviewSlidebox, setShowTestAndPreviewSlidebox] = useState(false);
191
185
 
192
186
  // Refs
193
187
  const titleCountRef = useRef(null);
@@ -575,67 +569,6 @@ const WebPushCreate = ({
575
569
  return !(templateNameInvalid || titleValidation || messageValidation);
576
570
  };
577
571
 
578
- const getTemplateContent = useCallback(() => {
579
- let cta = null;
580
- if (onClickBehaviour === ON_CLICK_BEHAVIOUR_OPTIONS.REDIRECT_TO_URL && redirectUrl) {
581
- cta = { type: EXTERNAL_URL, actionLink: redirectUrl.trim() };
582
- } else if (onClickBehaviour === ON_CLICK_BEHAVIOUR_OPTIONS.SITE_URL && websiteLink) {
583
- cta = { type: SITE_URL, actionLink: websiteLink };
584
- }
585
-
586
- const hasImage = mediaType === WEBPUSH_MEDIA_TYPES.IMAGE && imageSrc;
587
- const hasCtas = buttons && buttons.length > 0;
588
- let expandableDetails = null;
589
- if (hasImage || hasCtas) {
590
- expandableDetails = {
591
- media: hasImage ? [{ url: imageSrc, type: WEBPUSH_MEDIA_TYPES.IMAGE }] : [],
592
- ctas: hasCtas ? buttons.map((btn) => ({
593
- type: EXTERNAL_URL,
594
- action: '',
595
- title: btn.text || '',
596
- actionLink: btn.url || '',
597
- })) : [],
598
- };
599
- }
600
-
601
- const iconImageUrl = brandIconOption !== BRAND_ICON_OPTIONS.DONT_SHOW && brandIconSrc ? brandIconSrc : undefined;
602
-
603
- return {
604
- channel: WEBPUSH,
605
- accountId,
606
- content: {
607
- title: notificationTitle || '',
608
- message: message || '',
609
- ...(iconImageUrl ? { iconImageUrl } : {}),
610
- ...(cta ? { cta } : {}),
611
- ...(expandableDetails ? { expandableDetails } : {}),
612
- },
613
- messageSubject: templateName || notificationTitle || '',
614
- offers: [],
615
- };
616
- }, [
617
- notificationTitle,
618
- message,
619
- accountId,
620
- mediaType,
621
- imageSrc,
622
- brandIconOption,
623
- brandIconSrc,
624
- buttons,
625
- onClickBehaviour,
626
- redirectUrl,
627
- websiteLink,
628
- templateName,
629
- ]);
630
-
631
- const handleTestAndPreview = useCallback(() => {
632
- setShowTestAndPreviewSlidebox(true);
633
- }, []);
634
-
635
- const handleCloseTestAndPreview = useCallback(() => {
636
- setShowTestAndPreviewSlidebox(false);
637
- }, []);
638
-
639
572
  const isFormValid = () => {
640
573
  const templateNameInvalid = isFullMode && validateTemplateName(templateName);
641
574
  const titleValidation = validateTitle(notificationTitle);
@@ -1107,23 +1040,14 @@ const WebPushCreate = ({
1107
1040
  formatMessage={formatMessage}
1108
1041
  messages={messages}
1109
1042
  />
1110
- <CapRow className="webpush-test-preview-action">
1111
- <FormActions
1112
- onSave={handleSave}
1113
- isSaveDisabled={isSaveDisabled}
1114
- errorText={errorText}
1115
- accountErrorText={accountErrorText}
1116
- formatMessage={formatMessage}
1117
- messages={messages}
1118
- />
1119
- <CapButton
1120
- type="secondary"
1121
- onClick={handleTestAndPreview}
1122
- className="webpush-test-preview-btn"
1123
- >
1124
- {formatMessage(creativesMessages.testAndPreview)}
1125
- </CapButton>
1126
- </CapRow>
1043
+ <FormActions
1044
+ onSave={handleSave}
1045
+ isSaveDisabled={isSaveDisabled}
1046
+ errorText={errorText}
1047
+ accountErrorText={accountErrorText}
1048
+ formatMessage={formatMessage}
1049
+ messages={messages}
1050
+ />
1127
1051
  </CapColumn>
1128
1052
  <CapColumn className="preview-section" span={10}>
1129
1053
  <WebPushPreview
@@ -1135,13 +1059,6 @@ const WebPushCreate = ({
1135
1059
  buttons={buttons}
1136
1060
  />
1137
1061
  </CapColumn>
1138
- <TestAndPreviewSlidebox
1139
- show={showTestAndPreviewSlidebox}
1140
- onClose={handleCloseTestAndPreview}
1141
- content={getTemplateContent()}
1142
- currentChannel={WEBPUSH}
1143
- accountId={accountId || null}
1144
- />
1145
1062
  </CapRow>
1146
1063
  );
1147
1064
  };
@@ -135,12 +135,5 @@
135
135
  font-family: 'Roboto', open-sans, sans-serif;
136
136
  }
137
137
  }
138
-
139
- .webpush-test-preview-action {
140
- display: flex;
141
- .webpush-test-preview-btn {
142
- margin-left: $CAP_SPACE_12;
143
- }
144
- }
145
138
  }
146
139