@capillarytech/creatives-library 8.0.236-alpha.7 → 8.0.236
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.
- package/assets/Android.png +0 -0
- package/assets/iOS.png +0 -0
- package/constants/unified.js +1 -1
- package/initialReducer.js +0 -2
- package/package.json +1 -1
- package/services/api.js +0 -5
- package/services/tests/api.test.js +0 -18
- package/utils/common.js +2 -1
- package/utils/commonUtils.js +1 -14
- package/utils/tests/commonUtil.test.js +0 -224
- package/utils/transformTemplateConfig.js +10 -0
- package/v2Components/CapDeviceContent/index.js +56 -61
- package/v2Components/CapTagList/index.js +0 -4
- package/v2Components/CapWhatsappCTA/tests/index.test.js +0 -5
- package/v2Components/HtmlEditor/HTMLEditor.js +83 -235
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +19 -932
- package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +12 -17
- package/v2Components/HtmlEditor/_htmlEditor.scss +4 -2
- package/v2Components/HtmlEditor/_index.lazy.scss +1 -0
- package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +101 -2
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +131 -105
- package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +1 -2
- package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
- package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +0 -1
- package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +7 -4
- package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +45 -35
- package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +3 -1
- package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
- package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +6 -7
- package/v2Components/HtmlEditor/constants.js +20 -29
- package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +16 -373
- package/v2Components/HtmlEditor/hooks/useInAppContent.js +148 -130
- package/v2Components/HtmlEditor/index.js +1 -1
- package/v2Components/HtmlEditor/messages.js +85 -85
- package/v2Components/MobilePushPreviewV2/index.js +7 -32
- package/v2Components/TemplatePreview/_templatePreview.scss +24 -44
- package/v2Components/TemplatePreview/index.js +32 -47
- package/v2Components/TemplatePreview/messages.js +0 -4
- package/v2Containers/BeeEditor/index.js +80 -82
- package/v2Containers/CreativesContainer/SlideBoxContent.js +34 -69
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -2
- package/v2Containers/CreativesContainer/constants.js +0 -1
- package/v2Containers/CreativesContainer/index.js +32 -92
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +12 -4
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +0 -15
- package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +74 -40
- package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +67 -2
- package/v2Containers/InApp/actions.js +0 -7
- package/v2Containers/InApp/constants.js +4 -20
- package/v2Containers/InApp/index.js +386 -984
- package/v2Containers/InApp/index.scss +3 -4
- package/v2Containers/InApp/messages.js +3 -7
- package/v2Containers/InApp/reducer.js +3 -21
- package/v2Containers/InApp/sagas.js +9 -29
- package/v2Containers/InApp/selectors.js +5 -25
- package/v2Containers/InApp/tests/index.test.js +50 -154
- package/v2Containers/InApp/tests/reducer.test.js +0 -34
- package/v2Containers/InApp/tests/sagas.test.js +9 -61
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +0 -3
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +0 -2
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +0 -2
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +0 -9
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +0 -12
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +0 -4
- package/v2Containers/TagList/index.js +1 -65
- package/v2Containers/Templates/_templates.scss +1 -60
- package/v2Containers/Templates/index.js +5 -99
- package/v2Containers/Templates/messages.js +0 -4
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +0 -35
- package/v2Containers/BeePopupEditor/constants.js +0 -10
- package/v2Containers/BeePopupEditor/index.js +0 -193
- package/v2Containers/BeePopupEditor/tests/index.test.js +0 -627
- package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +0 -376
- package/v2Containers/InApp/__tests__/sagas.test.js +0 -363
- package/v2Containers/InApp/tests/selectors.test.js +0 -612
- package/v2Containers/InAppWrapper/components/InAppWrapperView.js +0 -162
- package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +0 -267
- package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +0 -9
- package/v2Containers/InAppWrapper/constants.js +0 -16
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +0 -473
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +0 -198
- package/v2Containers/InAppWrapper/index.js +0 -148
- package/v2Containers/InAppWrapper/messages.js +0 -49
- package/v2Containers/InappAdvance/index.js +0 -1115
- package/v2Containers/InappAdvance/index.scss +0 -10
- package/v2Containers/InappAdvance/tests/index.test.js +0 -448
|
@@ -45,7 +45,6 @@ export function SlideBoxHeader(props) {
|
|
|
45
45
|
const isZaloEdit = channel.toLowerCase() === ZALO && slidBoxContent === 'editTemplate';
|
|
46
46
|
const zaloOverview = isZaloEdit && isFullMode;
|
|
47
47
|
const whatsappOverview = isWhatsappEdit && isFullMode;
|
|
48
|
-
const shouldShowInAppEditHeader = isInAppEdit && !isFullMode;
|
|
49
48
|
const headerMessage = whatsappOverview ? messages.whatsappOverview : zaloOverview ? messages.zaloOverview : messages.editMessageContent;
|
|
50
49
|
const {
|
|
51
50
|
whatsappTemplateName,
|
|
@@ -110,7 +109,7 @@ export function SlideBoxHeader(props) {
|
|
|
110
109
|
}
|
|
111
110
|
/>
|
|
112
111
|
)}
|
|
113
|
-
{!showTemplateNameHeader && slidBoxContent === 'editTemplate' && (
|
|
112
|
+
{!showTemplateNameHeader && slidBoxContent === 'editTemplate' && (
|
|
114
113
|
<CapHeader
|
|
115
114
|
className="support-video-elements"
|
|
116
115
|
title={<FormattedMessage {...headerMessage} values={{ channel: getChannelLabel(channel) }} />}
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
IMAGE as LINE_IMAGE, IMAGE_MAP, IMAGE_CAROUSEL, VIDEO as LINE_VIDEO, TEMPLATE, STICKER,
|
|
44
44
|
} from '../Line/Container/constants';
|
|
45
45
|
import { IMAGE, VIDEO } from '../Facebook/Advertisement/constant';
|
|
46
|
-
import {
|
|
46
|
+
import {RCS_STATUSES} from '../Rcs/constants';
|
|
47
47
|
import { CREATIVE } from '../Facebook/constants';
|
|
48
48
|
import { LOYALTY } from '../App/constants';
|
|
49
49
|
import {
|
|
@@ -64,7 +64,6 @@ import {
|
|
|
64
64
|
// getTemplateDiffState
|
|
65
65
|
} from "../../utils/transformerUtils";
|
|
66
66
|
import { MANUAL_CAROUSEL } from '../MobilePushNew/constants';
|
|
67
|
-
import { BIG_HTML } from '../InApp/constants';
|
|
68
67
|
|
|
69
68
|
const classPrefix = 'add-creatives-section';
|
|
70
69
|
const CREATIVES_CONTAINER = 'creativesContainer';
|
|
@@ -96,7 +95,6 @@ export class Creatives extends React.Component {
|
|
|
96
95
|
currentChannel: this.props.channel || 'sms',
|
|
97
96
|
weChatTemplateType: '',
|
|
98
97
|
weChatMaptemplateStep: 0,
|
|
99
|
-
inAppEditorType: null,
|
|
100
98
|
isLiquidValidationError: false,
|
|
101
99
|
errorMessages: [],
|
|
102
100
|
liquidErrorMessage: {
|
|
@@ -138,7 +136,7 @@ export class Creatives extends React.Component {
|
|
|
138
136
|
if (!this.props?.isFullMode) {
|
|
139
137
|
this.props?.templateActions.getCdnTransformationConfig();
|
|
140
138
|
}
|
|
141
|
-
|
|
139
|
+
|
|
142
140
|
// Store loyalty tag props if loyaltyTagFetchingDependencies is provided
|
|
143
141
|
const { loyaltyTagFetchingDependencies } = this.props;
|
|
144
142
|
if (loyaltyTagFetchingDependencies) {
|
|
@@ -164,9 +162,9 @@ export class Creatives extends React.Component {
|
|
|
164
162
|
const isEmptyTemplateName = !value.trim();
|
|
165
163
|
|
|
166
164
|
// 1. IMMEDIATE: Update local state for instant UI feedback
|
|
167
|
-
this.setState({
|
|
165
|
+
this.setState({
|
|
168
166
|
isTemplateNameEmpty: isEmptyTemplateName,
|
|
169
|
-
localTemplateName: value
|
|
167
|
+
localTemplateName: value
|
|
170
168
|
});
|
|
171
169
|
|
|
172
170
|
// 2. DEBOUNCED: Only debounce the expensive onFormDataChange call
|
|
@@ -263,10 +261,6 @@ export class Creatives extends React.Component {
|
|
|
263
261
|
this.setState({ inAppCreateMode: mode });
|
|
264
262
|
}
|
|
265
263
|
|
|
266
|
-
onInAppEditorTypeChange = (editorType) => {
|
|
267
|
-
this.setState({ inAppEditorType: editorType });
|
|
268
|
-
}
|
|
269
|
-
|
|
270
264
|
onMobilepushModeChange = (mode) => {
|
|
271
265
|
this.setState({ mobilePushCreateMode: mode });
|
|
272
266
|
}
|
|
@@ -310,7 +304,7 @@ export class Creatives extends React.Component {
|
|
|
310
304
|
}
|
|
311
305
|
return buttonObj;
|
|
312
306
|
});
|
|
313
|
-
const {
|
|
307
|
+
const {url, previewUrl} = media || {};
|
|
314
308
|
return {
|
|
315
309
|
bodyText: bodyTemplate,
|
|
316
310
|
varMap: cardVarMapped,
|
|
@@ -439,35 +433,14 @@ export class Creatives extends React.Component {
|
|
|
439
433
|
}
|
|
440
434
|
case constants.INAPP: {
|
|
441
435
|
const mode = get(templateData, 'androidContent.type') || get(templateData, 'iosContent.type') || '';
|
|
442
|
-
|
|
443
|
-
// Check if this is a BEE editor template (identified by special title 'bee free template')
|
|
444
|
-
const isAndroidBeeEditor = templateData?.androidContent?.type === constants.HTML
|
|
445
|
-
&& templateData?.androidContent?.title?.toLowerCase() === 'bee free template';
|
|
446
|
-
const isIosBeeEditor = templateData?.iosContent?.type === constants.HTML
|
|
447
|
-
&& templateData?.iosContent?.title?.toLowerCase() === 'bee free template';
|
|
448
|
-
|
|
449
436
|
creativesTemplateData = {
|
|
450
437
|
type: channel,
|
|
451
438
|
name: templateData.messageSubject,
|
|
452
439
|
versions: {
|
|
453
440
|
base: {
|
|
454
441
|
content: {
|
|
455
|
-
ANDROID:
|
|
456
|
-
|
|
457
|
-
bodyType: templateData?.androidContent?.bodyType,
|
|
458
|
-
deviceType: constants.ANDROID,
|
|
459
|
-
beeHtml: { value: templateData?.androidContent?.message },
|
|
460
|
-
beeJson: templateData?.androidContent?.expandableDetails?.message,
|
|
461
|
-
isBEEeditor: true,
|
|
462
|
-
} : templateData?.androidContent,
|
|
463
|
-
IOS: isIosBeeEditor ? {
|
|
464
|
-
type: templateData?.iosContent?.type,
|
|
465
|
-
bodyType: templateData?.iosContent?.bodyType,
|
|
466
|
-
deviceType: constants.IOS,
|
|
467
|
-
beeHtml: { value: templateData?.iosContent?.message },
|
|
468
|
-
beeJson: templateData?.iosContent?.expandableDetails?.message,
|
|
469
|
-
isBEEeditor: true,
|
|
470
|
-
} : templateData?.iosContent,
|
|
442
|
+
ANDROID: templateData?.androidContent,
|
|
443
|
+
IOS: templateData?.iosContent,
|
|
471
444
|
},
|
|
472
445
|
},
|
|
473
446
|
},
|
|
@@ -702,7 +675,7 @@ export class Creatives extends React.Component {
|
|
|
702
675
|
} = templateData || {};
|
|
703
676
|
const cardContent = (rcsContent.cardContent && rcsContent.cardContent[0]) || {};
|
|
704
677
|
const Status = RCS_STATUSES.approved || '';
|
|
705
|
-
|
|
678
|
+
|
|
706
679
|
creativesTemplateData = {
|
|
707
680
|
type: channel,
|
|
708
681
|
edit: true,
|
|
@@ -787,7 +760,7 @@ export class Creatives extends React.Component {
|
|
|
787
760
|
});
|
|
788
761
|
|
|
789
762
|
getMobilePushCarouselData = (expandableDetails = []) => {
|
|
790
|
-
const newExpandableDetails = {
|
|
763
|
+
const newExpandableDetails = {...expandableDetails};
|
|
791
764
|
newExpandableDetails.style = expandableDetails.style || MANUAL_CAROUSEL;
|
|
792
765
|
newExpandableDetails.message = expandableDetails.message || '';
|
|
793
766
|
newExpandableDetails.ctas = expandableDetails.ctas || [];
|
|
@@ -882,24 +855,11 @@ export class Creatives extends React.Component {
|
|
|
882
855
|
androidContent.custom = custom;
|
|
883
856
|
}
|
|
884
857
|
if (channel === constants.MOBILE_PUSH && androidContent?.expandableDetails?.carouselData?.length) {
|
|
885
|
-
androidContent.expandableDetails = this.getMobilePushCarouselData({
|
|
886
|
-
}
|
|
887
|
-
if (androidContent?.isBEEeditor && androidContent?.beeHtml?.value) {
|
|
888
|
-
templateData.androidContent = {};
|
|
889
|
-
templateData.androidContent.type = constants.HTML;
|
|
890
|
-
templateData.androidContent.message = androidContent?.beeHtml?.value || '';
|
|
891
|
-
templateData.androidContent.title = 'bee free template';
|
|
892
|
-
templateData.androidContent.bodyType = androidContent?.bodyType;
|
|
893
|
-
templateData.androidContent.deviceType = constants.ANDROID;
|
|
894
|
-
templateData.androidContent.expandableDetails = {
|
|
895
|
-
style: BIG_HTML,
|
|
896
|
-
message: androidContent?.beeJson || '',
|
|
897
|
-
};
|
|
898
|
-
} else if (!androidContent?.isBEEeditor) {
|
|
899
|
-
templateData.androidContent = androidContent;
|
|
900
|
-
templateData.androidContent.type = androidContent?.type || get(channelTemplate, 'definition.mode', '')?.toUpperCase() || constants.TEXT;
|
|
901
|
-
templateData.androidContent.deviceType = constants.ANDROID;
|
|
858
|
+
androidContent.expandableDetails = this.getMobilePushCarouselData({...androidContent?.expandableDetails});
|
|
902
859
|
}
|
|
860
|
+
templateData.androidContent = androidContent;
|
|
861
|
+
templateData.androidContent.type = androidContent?.type || get(channelTemplate, 'definition.mode', '')?.toUpperCase() || constants.TEXT;
|
|
862
|
+
templateData.androidContent.deviceType = constants.ANDROID;
|
|
903
863
|
}
|
|
904
864
|
const iosContent = channel === constants.INAPP ? get(channelTemplate, 'versions.base.content.IOS') : get(channelTemplate, 'versions.base.IOS');
|
|
905
865
|
if (!isEmpty(iosContent)) {
|
|
@@ -917,24 +877,11 @@ export class Creatives extends React.Component {
|
|
|
917
877
|
iosContent.custom = custom;
|
|
918
878
|
}
|
|
919
879
|
if (channel === constants.MOBILE_PUSH && iosContent?.expandableDetails?.carouselData?.length) {
|
|
920
|
-
iosContent.expandableDetails = this.getMobilePushCarouselData({
|
|
921
|
-
}
|
|
922
|
-
if (iosContent?.isBEEeditor && iosContent?.beeHtml?.value) {
|
|
923
|
-
templateData.iosContent = {};
|
|
924
|
-
templateData.iosContent.type = constants.HTML;
|
|
925
|
-
templateData.iosContent.message = iosContent?.beeHtml?.value || '';
|
|
926
|
-
templateData.iosContent.title = 'bee free template';
|
|
927
|
-
templateData.iosContent.bodyType = iosContent?.bodyType;
|
|
928
|
-
templateData.iosContent.deviceType = constants.IOS;
|
|
929
|
-
templateData.iosContent.expandableDetails = {
|
|
930
|
-
style: BIG_HTML,
|
|
931
|
-
message: iosContent?.beeJson || '',
|
|
932
|
-
};
|
|
933
|
-
} else if (!iosContent?.isBEEeditor) {
|
|
934
|
-
templateData.iosContent = iosContent;
|
|
935
|
-
templateData.iosContent.type = iosContent?.type || get(channelTemplate, 'definition.mode', '')?.toUpperCase() || 'TEXT';
|
|
936
|
-
templateData.iosContent.deviceType = constants.IOS;
|
|
880
|
+
iosContent.expandableDetails = this.getMobilePushCarouselData({...iosContent?.expandableDetails});
|
|
937
881
|
}
|
|
882
|
+
templateData.iosContent = iosContent;
|
|
883
|
+
templateData.iosContent.type = iosContent?.type || get(channelTemplate, 'definition.mode', '')?.toUpperCase() || 'TEXT';
|
|
884
|
+
templateData.iosContent.deviceType = constants.IOS;
|
|
938
885
|
}
|
|
939
886
|
templateData.messageSubject = channelTemplate?.name ? channelTemplate?.name : "messageSubject";
|
|
940
887
|
}
|
|
@@ -1149,7 +1096,7 @@ export class Creatives extends React.Component {
|
|
|
1149
1096
|
contentType = "",
|
|
1150
1097
|
cardType = "",
|
|
1151
1098
|
cardSettings = {},
|
|
1152
|
-
} = get(versions, 'base.content.RCS.rcsContent',
|
|
1099
|
+
} = get(versions, 'base.content.RCS.rcsContent',{});
|
|
1153
1100
|
const rcsContent = {
|
|
1154
1101
|
contentType,
|
|
1155
1102
|
cardType,
|
|
@@ -1287,7 +1234,7 @@ export class Creatives extends React.Component {
|
|
|
1287
1234
|
processCentralCommsMetaId = (channel, creativesData) => {
|
|
1288
1235
|
// Create the payload for the centralcommnsmetaId API call
|
|
1289
1236
|
const { isLoyaltyModule = false, loyaltyMetaData = {} } = this.props;
|
|
1290
|
-
const { actionName, setMetaData = () => {
|
|
1237
|
+
const { actionName, setMetaData = () => {} } = loyaltyMetaData;
|
|
1291
1238
|
|
|
1292
1239
|
// const isTemplateModified = getTemplateDiffState(
|
|
1293
1240
|
// channel,
|
|
@@ -1337,9 +1284,6 @@ export class Creatives extends React.Component {
|
|
|
1337
1284
|
if (prevState.currentChannel.toUpperCase() === constants.EMAIL) {
|
|
1338
1285
|
newState = { ...newState, emailCreateMode: null };
|
|
1339
1286
|
}
|
|
1340
|
-
if (prevState.currentChannel.toUpperCase() === constants.INAPP) {
|
|
1341
|
-
newState = { ...newState, inAppEditorType: null };
|
|
1342
|
-
}
|
|
1343
1287
|
return newState;
|
|
1344
1288
|
});
|
|
1345
1289
|
}
|
|
@@ -1385,7 +1329,7 @@ export class Creatives extends React.Component {
|
|
|
1385
1329
|
shouldShowFooter = () => {
|
|
1386
1330
|
const { isFullMode } = this.props;
|
|
1387
1331
|
const {
|
|
1388
|
-
slidBoxContent, currentChannel, emailCreateMode, templateNameExists, templateStep, mobilePushCreateMode, weChatTemplateType, templateData,
|
|
1332
|
+
slidBoxContent, currentChannel, emailCreateMode, templateNameExists, templateStep, mobilePushCreateMode, weChatTemplateType, templateData,
|
|
1389
1333
|
} = this.state;
|
|
1390
1334
|
const channel = currentChannel.toUpperCase();
|
|
1391
1335
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
@@ -1428,7 +1372,6 @@ export class Creatives extends React.Component {
|
|
|
1428
1372
|
showFooter = true;
|
|
1429
1373
|
}
|
|
1430
1374
|
|
|
1431
|
-
|
|
1432
1375
|
if (showFooter) {
|
|
1433
1376
|
if (slidBoxContent === "createTemplate" && ((channel === constants.EMAIL && currentStep === 'createTemplateContent')
|
|
1434
1377
|
|| ([constants.SMS, constants.WECHAT].includes(channel) && currentStep === 'modeSelection'))) {
|
|
@@ -1451,7 +1394,7 @@ export class Creatives extends React.Component {
|
|
|
1451
1394
|
|
|
1452
1395
|
shouldShowDoneFooter = () => {
|
|
1453
1396
|
const {
|
|
1454
|
-
slidBoxContent, templateStep, currentChannel, templateData,
|
|
1397
|
+
slidBoxContent, templateStep, currentChannel, templateData,
|
|
1455
1398
|
} = this.state;
|
|
1456
1399
|
const { isFullMode } = this.props;
|
|
1457
1400
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
@@ -1492,18 +1435,18 @@ export class Creatives extends React.Component {
|
|
|
1492
1435
|
templateNameComponentInput = ({ formData, onFormDataChange, name }) => {
|
|
1493
1436
|
// Use local state for immediate UI feedback, fallback to prop value
|
|
1494
1437
|
const displayValue = this.state.localTemplateName !== '' ? this.state.localTemplateName : name;
|
|
1495
|
-
|
|
1438
|
+
|
|
1496
1439
|
return (
|
|
1497
1440
|
<CapInput
|
|
1498
1441
|
value={displayValue}
|
|
1499
1442
|
suffix={<span />}
|
|
1500
|
-
onBlur={() => {
|
|
1501
|
-
this.setState({
|
|
1443
|
+
onBlur={() => {
|
|
1444
|
+
this.setState({
|
|
1502
1445
|
isEditName: false,
|
|
1503
1446
|
localTemplateName: '' // Clear local state on blur
|
|
1504
|
-
}, () => {
|
|
1505
|
-
this.showTemplateName({ formData, onFormDataChange });
|
|
1506
|
-
});
|
|
1447
|
+
}, () => {
|
|
1448
|
+
this.showTemplateName({ formData, onFormDataChange });
|
|
1449
|
+
});
|
|
1507
1450
|
}}
|
|
1508
1451
|
onChange={(ev) => {
|
|
1509
1452
|
const { value } = ev.currentTarget;
|
|
@@ -1526,7 +1469,7 @@ export class Creatives extends React.Component {
|
|
|
1526
1469
|
if (name && !isEditName) {
|
|
1527
1470
|
this.setState({ showTemplateNameComponentEdit: false });
|
|
1528
1471
|
} else if (isEditName) {
|
|
1529
|
-
this.setState({
|
|
1472
|
+
this.setState({
|
|
1530
1473
|
showTemplateNameComponentEdit: true,
|
|
1531
1474
|
localTemplateName: name || '' // Initialize local state with current value
|
|
1532
1475
|
});
|
|
@@ -1544,7 +1487,7 @@ export class Creatives extends React.Component {
|
|
|
1544
1487
|
|
|
1545
1488
|
shouldShowContinueFooter = () => { // only for email for now, has to be modified according to channel
|
|
1546
1489
|
const {
|
|
1547
|
-
slidBoxContent, templateStep, currentChannel, emailCreateMode, mobilePushCreateMode,
|
|
1490
|
+
slidBoxContent, templateStep, currentChannel, emailCreateMode, mobilePushCreateMode, inAppCreateMode, weChatTemplateType,
|
|
1548
1491
|
} = this.state;
|
|
1549
1492
|
let isShowContinueFooter = false;
|
|
1550
1493
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
@@ -1559,6 +1502,8 @@ export class Creatives extends React.Component {
|
|
|
1559
1502
|
isShowContinueFooter = !isEmpty(mobilePushCreateMode) && currentStep === "modeSelection";
|
|
1560
1503
|
} else if (currentChannel.toUpperCase() === constants.WECHAT) {
|
|
1561
1504
|
isShowContinueFooter = !isEmpty(weChatTemplateType) && currentStep === "modeSelection";
|
|
1505
|
+
} else if (currentChannel.toUpperCase() === constants.INAPP) {
|
|
1506
|
+
isShowContinueFooter = !isEmpty(inAppCreateMode) && currentChannel === "modeSelection";
|
|
1562
1507
|
}
|
|
1563
1508
|
|
|
1564
1509
|
return isShowContinueFooter;
|
|
@@ -1604,7 +1549,6 @@ export class Creatives extends React.Component {
|
|
|
1604
1549
|
activeFormBuilderTab,
|
|
1605
1550
|
showTestAndPreviewSlidebox,
|
|
1606
1551
|
isTestAndPreviewMode,
|
|
1607
|
-
inAppEditorType,
|
|
1608
1552
|
} = this.state;
|
|
1609
1553
|
const {
|
|
1610
1554
|
isFullMode,
|
|
@@ -1688,8 +1632,6 @@ export class Creatives extends React.Component {
|
|
|
1688
1632
|
onChannelChange={this.onChannelChange}
|
|
1689
1633
|
onEmailModeChange={this.onEmailModeChange}//used when create is clicked in email
|
|
1690
1634
|
emailCreateMode={emailCreateMode}// upload zip || use editor are values
|
|
1691
|
-
onInAppEditorTypeChange={this.onInAppEditorTypeChange}//used when create is clicked in inapp
|
|
1692
|
-
inAppEditorType={inAppEditorType}// htmlEditor || dragDropEditor are values
|
|
1693
1635
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
1694
1636
|
onCreateNextStep={this.onCreateNextStep}
|
|
1695
1637
|
onEnterTemplateName={this.onEnterTemplateName}
|
|
@@ -1699,8 +1641,6 @@ export class Creatives extends React.Component {
|
|
|
1699
1641
|
cap={cap}
|
|
1700
1642
|
setIsLoadingContent={this.setIsLoadingContent}
|
|
1701
1643
|
onMobilepushModeChange={this.onMobilepushModeChange}
|
|
1702
|
-
inAppCreateMode={this.state.inAppCreateMode}
|
|
1703
|
-
onInAppModeChange={this.onInAppModeChange}
|
|
1704
1644
|
mobilePushCreateMode={mobilePushCreateMode}
|
|
1705
1645
|
showTemplateName={this.showTemplateName}
|
|
1706
1646
|
onValidationFail={this.onValidationFail}
|
|
@@ -1771,7 +1711,7 @@ export class Creatives extends React.Component {
|
|
|
1771
1711
|
{(() => {
|
|
1772
1712
|
const errorsToShow = get(liquidErrorMessage, constants.LIQUID_ERROR_MSG, []);
|
|
1773
1713
|
const standardErrorsToShow = get(liquidErrorMessage, constants.STANDARD_ERROR_MSG, []);
|
|
1774
|
-
return <ErrorInfoNote currentTab={activeFormBuilderTab?.toUpperCase()} errorMessages={{
|
|
1714
|
+
return <ErrorInfoNote currentTab={activeFormBuilderTab?.toUpperCase()} errorMessages={{LIQUID_ERROR_MSG: errorsToShow, STANDARD_ERROR_MSG: standardErrorsToShow}} />;
|
|
1775
1715
|
})()}
|
|
1776
1716
|
</CapRow>
|
|
1777
1717
|
)}
|
|
@@ -1101,17 +1101,25 @@ exports[`Test SlideBoxContent container Should render correct component for what
|
|
|
1101
1101
|
|
|
1102
1102
|
exports[`Test SlideBoxContent container Should render correct component for whatsapp channel create mode 2`] = `
|
|
1103
1103
|
<SlideBoxContent__CreativesWrapper>
|
|
1104
|
-
<
|
|
1105
|
-
date={0}
|
|
1104
|
+
<ForwardRef
|
|
1106
1105
|
getDefaultTags=""
|
|
1107
|
-
|
|
1106
|
+
location={
|
|
1107
|
+
Object {
|
|
1108
|
+
"pathname": "/inapp/create",
|
|
1109
|
+
"query": Object {
|
|
1110
|
+
"isEditFromCampaigns": undefined,
|
|
1111
|
+
"module": "library",
|
|
1112
|
+
"type": "embedded",
|
|
1113
|
+
},
|
|
1114
|
+
"search": "",
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1108
1117
|
onCreateComplete={[MockFunction]}
|
|
1109
1118
|
templateData={
|
|
1110
1119
|
Object {
|
|
1111
1120
|
"mode": "create",
|
|
1112
1121
|
}
|
|
1113
1122
|
}
|
|
1114
|
-
type=""
|
|
1115
1123
|
/>
|
|
1116
1124
|
</SlideBoxContent__CreativesWrapper>
|
|
1117
1125
|
`;
|
|
@@ -17,7 +17,6 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
17
17
|
handleCloseTestAndPreview={[Function]}
|
|
18
18
|
handleTestAndPreview={[Function]}
|
|
19
19
|
hostName=""
|
|
20
|
-
inAppEditorType={null}
|
|
21
20
|
isTestAndPreviewMode={false}
|
|
22
21
|
loyaltyMetaData={
|
|
23
22
|
Object {
|
|
@@ -33,8 +32,6 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
33
32
|
onEnterTemplateName={[Function]}
|
|
34
33
|
onFTPSubmit={[MockFunction]}
|
|
35
34
|
onFacebookSubmit={[MockFunction]}
|
|
36
|
-
onInAppEditorTypeChange={[Function]}
|
|
37
|
-
onInAppModeChange={[Function]}
|
|
38
35
|
onMobilepushModeChange={[Function]}
|
|
39
36
|
onPreviewTemplate={[Function]}
|
|
40
37
|
onRemoveTemplateName={[Function]}
|
|
@@ -106,7 +103,6 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
106
103
|
handleCloseTestAndPreview={[Function]}
|
|
107
104
|
handleTestAndPreview={[Function]}
|
|
108
105
|
hostName=""
|
|
109
|
-
inAppEditorType={null}
|
|
110
106
|
isTestAndPreviewMode={false}
|
|
111
107
|
loyaltyMetaData={
|
|
112
108
|
Object {
|
|
@@ -122,8 +118,6 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
122
118
|
onEnterTemplateName={[Function]}
|
|
123
119
|
onFTPSubmit={[MockFunction]}
|
|
124
120
|
onFacebookSubmit={[MockFunction]}
|
|
125
|
-
onInAppEditorTypeChange={[Function]}
|
|
126
|
-
onInAppModeChange={[Function]}
|
|
127
121
|
onMobilepushModeChange={[Function]}
|
|
128
122
|
onPreviewTemplate={[Function]}
|
|
129
123
|
onRemoveTemplateName={[Function]}
|
|
@@ -195,7 +189,6 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
195
189
|
handleCloseTestAndPreview={[Function]}
|
|
196
190
|
handleTestAndPreview={[Function]}
|
|
197
191
|
hostName=""
|
|
198
|
-
inAppEditorType={null}
|
|
199
192
|
isTestAndPreviewMode={false}
|
|
200
193
|
loyaltyMetaData={
|
|
201
194
|
Object {
|
|
@@ -211,8 +204,6 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
211
204
|
onEnterTemplateName={[Function]}
|
|
212
205
|
onFTPSubmit={[MockFunction]}
|
|
213
206
|
onFacebookSubmit={[MockFunction]}
|
|
214
|
-
onInAppEditorTypeChange={[Function]}
|
|
215
|
-
onInAppModeChange={[Function]}
|
|
216
207
|
onMobilepushModeChange={[Function]}
|
|
217
208
|
onPreviewTemplate={[Function]}
|
|
218
209
|
onRemoveTemplateName={[Function]}
|
|
@@ -296,7 +287,6 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
296
287
|
handleCloseTestAndPreview={[Function]}
|
|
297
288
|
handleTestAndPreview={[Function]}
|
|
298
289
|
hostName=""
|
|
299
|
-
inAppEditorType={null}
|
|
300
290
|
isTestAndPreviewMode={false}
|
|
301
291
|
loyaltyMetaData={
|
|
302
292
|
Object {
|
|
@@ -312,8 +302,6 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
312
302
|
onEnterTemplateName={[Function]}
|
|
313
303
|
onFTPSubmit={[MockFunction]}
|
|
314
304
|
onFacebookSubmit={[MockFunction]}
|
|
315
|
-
onInAppEditorTypeChange={[Function]}
|
|
316
|
-
onInAppModeChange={[Function]}
|
|
317
305
|
onMobilepushModeChange={[Function]}
|
|
318
306
|
onPreviewTemplate={[Function]}
|
|
319
307
|
onRemoveTemplateName={[Function]}
|
|
@@ -397,7 +385,6 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
397
385
|
handleCloseTestAndPreview={[Function]}
|
|
398
386
|
handleTestAndPreview={[Function]}
|
|
399
387
|
hostName=""
|
|
400
|
-
inAppEditorType={null}
|
|
401
388
|
isTestAndPreviewMode={false}
|
|
402
389
|
loyaltyMetaData={
|
|
403
390
|
Object {
|
|
@@ -413,8 +400,6 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
413
400
|
onEnterTemplateName={[Function]}
|
|
414
401
|
onFTPSubmit={[MockFunction]}
|
|
415
402
|
onFacebookSubmit={[MockFunction]}
|
|
416
|
-
onInAppEditorTypeChange={[Function]}
|
|
417
|
-
onInAppModeChange={[Function]}
|
|
418
403
|
onMobilepushModeChange={[Function]}
|
|
419
404
|
onPreviewTemplate={[Function]}
|
|
420
405
|
onRemoveTemplateName={[Function]}
|
|
@@ -24,20 +24,24 @@ const HTMLEditorTesting = () => {
|
|
|
24
24
|
// Show/Hide editor
|
|
25
25
|
show: () => {
|
|
26
26
|
setIsVisible(true);
|
|
27
|
+
console.log('✅ HTMLEditor test mode activated');
|
|
27
28
|
},
|
|
28
29
|
|
|
29
30
|
hide: () => {
|
|
30
31
|
setIsVisible(false);
|
|
32
|
+
console.log('✅ HTMLEditor test mode deactivated');
|
|
31
33
|
},
|
|
32
34
|
|
|
33
35
|
toggle: () => {
|
|
34
|
-
setIsVisible(
|
|
36
|
+
setIsVisible(prev => !prev);
|
|
37
|
+
console.log(`✅ HTMLEditor test mode ${!isVisible ? 'activated' : 'deactivated'}`);
|
|
35
38
|
},
|
|
36
39
|
|
|
37
40
|
// Variant control
|
|
38
41
|
setVariant: (newVariant) => {
|
|
39
42
|
if (['email', 'inapp'].includes(newVariant)) {
|
|
40
43
|
setVariant(newVariant);
|
|
44
|
+
console.log(`✅ Variant set to: ${newVariant}`);
|
|
41
45
|
} else {
|
|
42
46
|
console.error('❌ Invalid variant. Use: "email" or "inapp"');
|
|
43
47
|
}
|
|
@@ -48,6 +52,7 @@ const HTMLEditorTesting = () => {
|
|
|
48
52
|
const validLayouts = Object.values(LAYOUT_TYPES);
|
|
49
53
|
if (validLayouts.includes(layout)) {
|
|
50
54
|
setLayoutType(layout);
|
|
55
|
+
console.log(`✅ Layout set to: ${layout}`);
|
|
51
56
|
} else {
|
|
52
57
|
console.error(`❌ Invalid layout. Use: ${validLayouts.join(', ')}`);
|
|
53
58
|
}
|
|
@@ -56,22 +61,58 @@ const HTMLEditorTesting = () => {
|
|
|
56
61
|
// Content control
|
|
57
62
|
setContent: (newContent) => {
|
|
58
63
|
setContent(newContent);
|
|
64
|
+
console.log('✅ Content updated');
|
|
59
65
|
},
|
|
60
66
|
|
|
61
67
|
getContent: () => {
|
|
68
|
+
console.log('Current content:', content);
|
|
62
69
|
return content;
|
|
63
70
|
},
|
|
64
71
|
|
|
65
72
|
// Status
|
|
66
73
|
status: () => {
|
|
74
|
+
console.log('📊 HTMLEditor Test Status:');
|
|
75
|
+
console.log(` Visible: ${isVisible}`);
|
|
76
|
+
console.log(` Variant: ${variant}`);
|
|
77
|
+
console.log(` Layout: ${layoutType}`);
|
|
78
|
+
console.log(` Content size: ${content.length} chars`);
|
|
67
79
|
},
|
|
68
80
|
|
|
69
81
|
// Help
|
|
70
82
|
help: () => {
|
|
71
|
-
|
|
83
|
+
console.log(`
|
|
84
|
+
🚀 HTMLEditor Testing Console Commands:
|
|
85
|
+
|
|
86
|
+
📱 Basic Controls:
|
|
87
|
+
htmlEditorTest.show() - Show the editor
|
|
88
|
+
htmlEditorTest.hide() - Hide the editor
|
|
89
|
+
htmlEditorTest.toggle() - Toggle editor visibility
|
|
90
|
+
|
|
91
|
+
⚙️ Configuration:
|
|
92
|
+
htmlEditorTest.setVariant('email') - Set to email variant
|
|
93
|
+
htmlEditorTest.setVariant('inapp') - Set to inapp variant
|
|
94
|
+
htmlEditorTest.setLayout('POPUP') - Set layout (inapp only)
|
|
95
|
+
- Valid: POPUP, HEADER, FOOTER, FULLSCREEN
|
|
96
|
+
|
|
97
|
+
📝 Content:
|
|
98
|
+
htmlEditorTest.setContent('<h1>Test</h1>') - Set editor content
|
|
99
|
+
htmlEditorTest.getContent() - Get current content
|
|
100
|
+
|
|
101
|
+
📊 Status:
|
|
102
|
+
htmlEditorTest.status() - Show current status
|
|
103
|
+
htmlEditorTest.help() - Show this help
|
|
104
|
+
|
|
105
|
+
💡 Example Usage:
|
|
106
|
+
htmlEditorTest.show()
|
|
107
|
+
htmlEditorTest.setVariant('inapp')
|
|
108
|
+
htmlEditorTest.setLayout('HEADER') // Top banner
|
|
109
|
+
htmlEditorTest.setLayout('FOOTER') // Bottom banner
|
|
110
|
+
`);
|
|
111
|
+
}
|
|
72
112
|
};
|
|
73
113
|
|
|
74
114
|
// Show help on first load
|
|
115
|
+
console.log('🚀 HTMLEditor Testing Ready! Type htmlEditorTest.help() for commands');
|
|
75
116
|
|
|
76
117
|
// Cleanup on unmount
|
|
77
118
|
return () => {
|
|
@@ -87,40 +128,32 @@ const HTMLEditorTesting = () => {
|
|
|
87
128
|
}
|
|
88
129
|
|
|
89
130
|
return (
|
|
90
|
-
<div
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
131
|
+
<div style={{
|
|
132
|
+
position: 'fixed',
|
|
133
|
+
top: 0,
|
|
134
|
+
left: 0,
|
|
135
|
+
right: 0,
|
|
136
|
+
bottom: 0,
|
|
137
|
+
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
138
|
+
zIndex: 9999,
|
|
139
|
+
display: 'flex',
|
|
140
|
+
flexDirection: 'column',
|
|
141
|
+
padding: '20px'
|
|
142
|
+
}}>
|
|
143
|
+
{/* Header */}
|
|
144
|
+
<div style={{
|
|
145
|
+
backgroundColor: '#fff',
|
|
146
|
+
padding: '10px 20px',
|
|
147
|
+
borderRadius: '8px 8px 0 0',
|
|
99
148
|
display: 'flex',
|
|
100
|
-
|
|
101
|
-
|
|
149
|
+
justifyContent: 'space-between',
|
|
150
|
+
alignItems: 'center',
|
|
151
|
+
borderBottom: '1px solid #ddd'
|
|
102
152
|
}}>
|
|
103
|
-
{/* Header */}
|
|
104
|
-
<div
|
|
105
|
-
style={{
|
|
106
|
-
backgroundColor: '#fff',
|
|
107
|
-
padding: '10px 20px',
|
|
108
|
-
borderRadius: '8px 8px 0 0',
|
|
109
|
-
display: 'flex',
|
|
110
|
-
justifyContent: 'space-between',
|
|
111
|
-
alignItems: 'center',
|
|
112
|
-
borderBottom: '1px solid #ddd',
|
|
113
|
-
}}>
|
|
114
153
|
<div>
|
|
115
154
|
<strong>HTMLEditor Testing Mode</strong>
|
|
116
155
|
<span style={{ marginLeft: '20px', color: '#666' }}>
|
|
117
|
-
Variant:
|
|
118
|
-
{' '}
|
|
119
|
-
{variant}
|
|
120
|
-
{' '}
|
|
121
|
-
| Layout:
|
|
122
|
-
{' '}
|
|
123
|
-
{layoutType}
|
|
156
|
+
Variant: {variant} | Layout: {layoutType}
|
|
124
157
|
</span>
|
|
125
158
|
</div>
|
|
126
159
|
<button
|
|
@@ -131,7 +164,7 @@ const HTMLEditorTesting = () => {
|
|
|
131
164
|
border: 'none',
|
|
132
165
|
padding: '5px 15px',
|
|
133
166
|
borderRadius: '4px',
|
|
134
|
-
cursor: 'pointer'
|
|
167
|
+
cursor: 'pointer'
|
|
135
168
|
}}
|
|
136
169
|
>
|
|
137
170
|
Close
|
|
@@ -139,13 +172,12 @@ const HTMLEditorTesting = () => {
|
|
|
139
172
|
</div>
|
|
140
173
|
|
|
141
174
|
{/* Editor Container */}
|
|
142
|
-
<div
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}}>
|
|
175
|
+
<div style={{
|
|
176
|
+
flex: 1,
|
|
177
|
+
backgroundColor: '#fff',
|
|
178
|
+
borderRadius: '0 0 8px 8px',
|
|
179
|
+
overflow: 'hidden'
|
|
180
|
+
}}>
|
|
149
181
|
<IntlProvider locale="en" messages={{}}>
|
|
150
182
|
<HTMLEditor
|
|
151
183
|
variant={variant}
|
|
@@ -153,8 +185,10 @@ const HTMLEditorTesting = () => {
|
|
|
153
185
|
initialContent={content}
|
|
154
186
|
onContentChange={(newContent) => {
|
|
155
187
|
setContent(newContent);
|
|
188
|
+
console.log('📝 Content changed:', newContent.substring(0, 100) + '...');
|
|
156
189
|
}}
|
|
157
|
-
onSave={() => {
|
|
190
|
+
onSave={(savedContent) => {
|
|
191
|
+
console.log('💾 Content saved:', savedContent);
|
|
158
192
|
}}
|
|
159
193
|
/>
|
|
160
194
|
</IntlProvider>
|