@capillarytech/creatives-library 9.2.1-alpha.sprint-cap-214249.42 → 9.2.1
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/AppRoot.js +4 -7
- package/constants/unified.js +1 -0
- package/package.json +1 -1
- package/utils/beePluginLoader.js +106 -0
- package/utils/common.js +6 -0
- package/utils/createMobilePushPayload.js +51 -56
- package/utils/tests/beePluginLoader.test.js +199 -0
- package/utils/tests/createMobilePushPayload.test.js +10 -162
- package/v2Components/CapMpushCTA/index.js +57 -47
- package/v2Components/CapMpushCTA/index.scss +5 -43
- package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +8 -11
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -13
- package/v2Components/CommonTestAndPreview/constants.js +0 -2
- package/v2Components/CommonTestAndPreview/index.js +10 -48
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/MobilePushPreviewContent.test.js +5 -83
- package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -86
- package/v2Components/TemplatePreview/_templatePreview.scss +2 -12
- package/v2Components/TemplatePreview/index.js +12 -14
- package/v2Components/TemplatePreview/tests/index.test.js +0 -69
- package/v2Containers/BeeEditor/index.js +49 -22
- package/v2Containers/BeeEditor/index.scss +12 -0
- package/v2Containers/BeeEditor/messages.js +8 -0
- package/v2Containers/BeeEditor/test/index.test.js +78 -0
- package/v2Containers/BeePopupEditor/index.js +22 -11
- package/v2Containers/CreativesContainer/SlideBoxContent.js +9 -5
- package/v2Containers/CreativesContainer/index.js +1 -2
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +0 -43
- package/v2Containers/Email/index.js +2 -2
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +25 -23
- package/v2Containers/MobilePushNew/components/CtaButtons.js +47 -52
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +222 -314
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +130 -161
- package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +208 -30
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +123 -484
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +46 -152
- package/v2Containers/MobilePushNew/constants.js +0 -12
- package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +1 -63
- package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +0 -78
- package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +1 -40
- package/v2Containers/MobilePushNew/hooks/useUpload.js +46 -42
- package/v2Containers/MobilePushNew/index.js +273 -503
- package/v2Containers/MobilePushNew/index.scss +4 -215
- package/v2Containers/MobilePushNew/messages.js +6 -106
- package/v2Containers/MobilePushNew/tests/index.test.js +1 -482
- package/v2Containers/MobilePushNew/tests/utils.test.js +0 -122
- package/v2Containers/MobilePushNew/utils.js +0 -107
- package/v2Containers/Templates/_templates.scss +2 -10
- package/v2Containers/Templates/index.js +81 -83
- package/v2Containers/Templates/tests/index.test.js +0 -68
- package/v2Components/CapMpushCTA/tests/index.test.js +0 -150
- package/v2Containers/MobilePushNew/components/TapLinkActions.js +0 -76
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IntlProvider } from 'react-intl';
|
|
2
|
-
import createMobilePushPayload
|
|
2
|
+
import createMobilePushPayload from '../createMobilePushPayload';
|
|
3
3
|
import messages from '../../v2Containers/MobilePushNew/messages';
|
|
4
4
|
|
|
5
5
|
// Create a mock intl object
|
|
@@ -48,7 +48,6 @@ jest.mock('../createMobilePushPayload', () => {
|
|
|
48
48
|
__esModule: true,
|
|
49
49
|
default: mockCreateMobilePushPayload,
|
|
50
50
|
appendDeepLinkKeysToUrl: originalModule.appendDeepLinkKeysToUrl,
|
|
51
|
-
buildCarouselCards: originalModule.buildCarouselCards,
|
|
52
51
|
};
|
|
53
52
|
});
|
|
54
53
|
|
|
@@ -262,21 +261,6 @@ describe('createMobilePushPayload', () => {
|
|
|
262
261
|
accountData: unsupportedAccountData,
|
|
263
262
|
})).not.toThrow();
|
|
264
263
|
});
|
|
265
|
-
|
|
266
|
-
it.each([
|
|
267
|
-
['IOS', 'ANDROID', { androidContent: { title: 'Title', message: 'Message' }, iosContent: { title: '', message: '' } }],
|
|
268
|
-
['ANDROID', 'IOS', { androidContent: { title: '', message: '' }, iosContent: { title: 'Title', message: 'Message' } }],
|
|
269
|
-
])('leaves out a supported platform passed as skipPlatform (%s)', (skipPlatform, keptPlatform, content) => {
|
|
270
|
-
const result = callWithIntl({
|
|
271
|
-
templateName: 'Test',
|
|
272
|
-
...content,
|
|
273
|
-
accountData: mockAccountData,
|
|
274
|
-
options: { skipPlatform },
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
expect(result.versions.base[skipPlatform]).toBeUndefined();
|
|
278
|
-
expect(result.versions.base[keptPlatform]).toBeDefined();
|
|
279
|
-
});
|
|
280
264
|
});
|
|
281
265
|
|
|
282
266
|
// Account Data Validation Tests
|
|
@@ -351,67 +335,33 @@ describe('createMobilePushPayload', () => {
|
|
|
351
335
|
expect(result.versions.base.ANDROID.expandableDetails.image).toBe('test-image.jpg');
|
|
352
336
|
});
|
|
353
337
|
|
|
354
|
-
it('should handle VIDEO media type with
|
|
338
|
+
it('should handle VIDEO media type with mpushVideoSrc', () => {
|
|
355
339
|
const result = callWithIntl({
|
|
356
340
|
templateName: 'Test',
|
|
357
341
|
androidContent: {
|
|
358
342
|
title: 'Title',
|
|
359
343
|
message: 'Message',
|
|
360
344
|
mediaType: 'VIDEO',
|
|
361
|
-
videoSrc: 'test-video.mp4',
|
|
362
345
|
},
|
|
363
346
|
iosContent: { title: 'Title', message: 'Message' },
|
|
364
347
|
accountData: mockAccountData,
|
|
365
|
-
|
|
366
|
-
mpushVideoSrcAndPreview: { mpushVideoSrc: 'other-tab.mp4' },
|
|
348
|
+
mpushVideoSrcAndPreview: { mpushVideoSrc: 'test-video.mp4' },
|
|
367
349
|
});
|
|
368
350
|
expect(result.versions.base.ANDROID.expandableDetails.media[0].url).toBe('test-video.mp4');
|
|
369
351
|
expect(result.versions.base.ANDROID.expandableDetails.media[0].type).toBe('VIDEO');
|
|
370
352
|
});
|
|
371
353
|
|
|
372
|
-
it('should
|
|
373
|
-
const result = callWithIntl({
|
|
374
|
-
templateName: 'Test',
|
|
375
|
-
androidContent: {
|
|
376
|
-
title: 'Title',
|
|
377
|
-
message: 'Message',
|
|
378
|
-
mediaType: 'VIDEO',
|
|
379
|
-
mediaList: [{ url: 'saved.mp4', text: 'Saved' }],
|
|
380
|
-
},
|
|
381
|
-
iosContent: { title: 'Title', message: 'Message' },
|
|
382
|
-
accountData: mockAccountData,
|
|
383
|
-
});
|
|
384
|
-
expect(result.versions.base.ANDROID.expandableDetails.media[0]).toEqual({ url: 'saved.mp4', text: 'Saved', type: 'VIDEO' });
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
it('saves each platform its own video', () => {
|
|
388
|
-
const result = callWithIntl({
|
|
389
|
-
templateName: 'Test',
|
|
390
|
-
androidContent: {
|
|
391
|
-
title: 'Title', message: 'Message', mediaType: 'VIDEO', videoSrc: 'a.mp4',
|
|
392
|
-
},
|
|
393
|
-
iosContent: {
|
|
394
|
-
title: 'Title', message: 'Message', mediaType: 'VIDEO', videoSrc: 'b.mp4',
|
|
395
|
-
},
|
|
396
|
-
accountData: mockAccountData,
|
|
397
|
-
mpushVideoSrcAndPreview: { mpushVideoSrc: 'b.mp4' },
|
|
398
|
-
});
|
|
399
|
-
expect(result.versions.base.ANDROID.expandableDetails.media[0].url).toBe('a.mp4');
|
|
400
|
-
expect(result.versions.base.IOS.expandableDetails.media[0].url).toBe('b.mp4');
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
it('should handle GIF media type with the platform videoSrc', () => {
|
|
354
|
+
it('should handle GIF media type with mpushVideoSrc', () => {
|
|
404
355
|
const result = callWithIntl({
|
|
405
356
|
templateName: 'Test',
|
|
406
357
|
androidContent: {
|
|
407
358
|
title: 'Title',
|
|
408
359
|
message: 'Message',
|
|
409
360
|
mediaType: 'GIF',
|
|
410
|
-
videoSrc: 'test-gif.gif',
|
|
411
361
|
},
|
|
412
362
|
iosContent: { title: 'Title', message: 'Message' },
|
|
413
363
|
accountData: mockAccountData,
|
|
414
|
-
mpushVideoSrcAndPreview: { mpushVideoSrc: '
|
|
364
|
+
mpushVideoSrcAndPreview: { mpushVideoSrc: 'test-gif.gif' },
|
|
415
365
|
});
|
|
416
366
|
expect(result.versions.base.ANDROID.expandableDetails.media[0].url).toBe('test-gif.gif');
|
|
417
367
|
expect(result.versions.base.ANDROID.expandableDetails.media[0].type).toBe('GIF');
|
|
@@ -661,7 +611,7 @@ describe('createMobilePushPayload', () => {
|
|
|
661
611
|
});
|
|
662
612
|
});
|
|
663
613
|
|
|
664
|
-
it('should
|
|
614
|
+
it('should handle deep link CTA with keys when URL contains some keys but not all', () => {
|
|
665
615
|
const result = callWithIntl({
|
|
666
616
|
templateName: 'Test',
|
|
667
617
|
androidContent: {
|
|
@@ -677,47 +627,10 @@ describe('createMobilePushPayload', () => {
|
|
|
677
627
|
});
|
|
678
628
|
expect(result.versions.base.ANDROID.cta).toEqual({
|
|
679
629
|
type: 'DEEP_LINK',
|
|
680
|
-
actionLink: 'app://deep-link?key1=key1
|
|
630
|
+
actionLink: 'app://deep-link?key1=key1',
|
|
681
631
|
});
|
|
682
632
|
});
|
|
683
633
|
|
|
684
|
-
it('should send the configured key with the typed value', () => {
|
|
685
|
-
const result = callWithIntl({
|
|
686
|
-
templateName: 'Test',
|
|
687
|
-
androidContent: {
|
|
688
|
-
title: 'Title',
|
|
689
|
-
message: 'Message',
|
|
690
|
-
actionOnClick: true,
|
|
691
|
-
linkType: 'DEEP_LINK',
|
|
692
|
-
deepLinkValue: 'https://www.youtube.com/',
|
|
693
|
-
deepLinkKeysValue: ['testing_purpose=androidDeeplink'],
|
|
694
|
-
},
|
|
695
|
-
iosContent: { title: 'Title', message: 'Message' },
|
|
696
|
-
accountData: mockAccountData,
|
|
697
|
-
});
|
|
698
|
-
expect(result.versions.base.ANDROID.cta).toEqual({
|
|
699
|
-
type: 'DEEP_LINK',
|
|
700
|
-
actionLink: 'https://www.youtube.com/?testing_purpose=androidDeeplink',
|
|
701
|
-
});
|
|
702
|
-
});
|
|
703
|
-
|
|
704
|
-
it('should replace a saved value instead of adding the key twice', () => {
|
|
705
|
-
const result = callWithIntl({
|
|
706
|
-
templateName: 'Test',
|
|
707
|
-
androidContent: {
|
|
708
|
-
title: 'Title',
|
|
709
|
-
message: 'Message',
|
|
710
|
-
actionOnClick: true,
|
|
711
|
-
linkType: 'DEEP_LINK',
|
|
712
|
-
deepLinkValue: 'app://home?src=push&id=5',
|
|
713
|
-
deepLinkKeysValue: ['id=7'],
|
|
714
|
-
},
|
|
715
|
-
iosContent: { title: 'Title', message: 'Message' },
|
|
716
|
-
accountData: mockAccountData,
|
|
717
|
-
});
|
|
718
|
-
expect(result.versions.base.ANDROID.cta.actionLink).toBe('app://home?src=push&id=7');
|
|
719
|
-
});
|
|
720
|
-
|
|
721
634
|
it('should handle deep link CTA with empty deepLinkKeysValue', () => {
|
|
722
635
|
const result = callWithIntl({
|
|
723
636
|
templateName: 'Test',
|
|
@@ -947,12 +860,13 @@ describe('createMobilePushPayload', () => {
|
|
|
947
860
|
title: 'Title',
|
|
948
861
|
message: 'Message',
|
|
949
862
|
mediaType: 'GIF',
|
|
950
|
-
videoSrc: 'test-gif.gif',
|
|
951
863
|
},
|
|
952
864
|
iosContent: { title: 'Title', message: 'Message' },
|
|
953
865
|
accountData: mockAccountData,
|
|
866
|
+
mpushVideoSrcAndPreview: { mpushVideoSrc: 'test-gif.gif' },
|
|
954
867
|
});
|
|
955
|
-
|
|
868
|
+
// When mediaType is GIF and mpushVideoSrc is provided, it converts to VIDEO for backend compatibility
|
|
869
|
+
expect(result.versions.base.ANDROID.expandableDetails.media[0].type).toBe('GIF');
|
|
956
870
|
});
|
|
957
871
|
|
|
958
872
|
it('should handle options with custom mode', () => {
|
|
@@ -1408,69 +1322,3 @@ describe('createMobilePushPayload', () => {
|
|
|
1408
1322
|
});
|
|
1409
1323
|
});
|
|
1410
1324
|
});
|
|
1411
|
-
|
|
1412
|
-
describe('buildCarouselCards', () => {
|
|
1413
|
-
it.each([
|
|
1414
|
-
['no argument', undefined],
|
|
1415
|
-
['null', null],
|
|
1416
|
-
['an empty array', []],
|
|
1417
|
-
])('returns [] for %s', (_label, input) => {
|
|
1418
|
-
expect(buildCarouselCards(input)).toEqual([]);
|
|
1419
|
-
});
|
|
1420
|
-
|
|
1421
|
-
it('fills defaults for a missing card', () => {
|
|
1422
|
-
expect(buildCarouselCards([null])).toEqual([
|
|
1423
|
-
{ mediaType: 'image', imageUrl: '', videoSrc: '', buttons: [] },
|
|
1424
|
-
]);
|
|
1425
|
-
});
|
|
1426
|
-
|
|
1427
|
-
it('leaves the editor-only isSaved flag out of card buttons', () => {
|
|
1428
|
-
const [card] = buildCarouselCards([{
|
|
1429
|
-
mediaType: 'image',
|
|
1430
|
-
imageUrl: 'a.jpg',
|
|
1431
|
-
buttons: [{
|
|
1432
|
-
actionOnClick: true, linkType: 'EXTERNAL_LINK', externalLinkValue: 'https://a.com', isSaved: true,
|
|
1433
|
-
}],
|
|
1434
|
-
}]);
|
|
1435
|
-
expect(card.buttons[0]).toEqual({ actionOnClick: true, linkType: 'EXTERNAL_LINK', externalLinkValue: 'https://a.com' });
|
|
1436
|
-
});
|
|
1437
|
-
|
|
1438
|
-
it('keeps the video thumbnail only when there is one', () => {
|
|
1439
|
-
const [withThumb, withoutThumb] = buildCarouselCards([
|
|
1440
|
-
{ mediaType: 'video', videoSrc: 'a.mp4', videoPreviewImg: 'a.png' },
|
|
1441
|
-
{ mediaType: 'video', videoSrc: 'b.mp4', videoPreviewImg: '' },
|
|
1442
|
-
]);
|
|
1443
|
-
|
|
1444
|
-
expect(withThumb).toEqual({ mediaType: 'video', imageUrl: '', videoSrc: 'a.mp4', videoPreviewImg: 'a.png', buttons: [] });
|
|
1445
|
-
expect(withoutThumb).toEqual({ mediaType: 'video', imageUrl: '', videoSrc: 'b.mp4', buttons: [] });
|
|
1446
|
-
});
|
|
1447
|
-
|
|
1448
|
-
it('appends key=value deep link params to carousel buttons', () => {
|
|
1449
|
-
const [card] = buildCarouselCards([{
|
|
1450
|
-
mediaType: 'image',
|
|
1451
|
-
imageUrl: 'a.jpg',
|
|
1452
|
-
buttons: [{ linkType: 'DEEP_LINK', deepLinkValue: 'app://home', deepLinkKeys: ['id={{user_id}}'] }],
|
|
1453
|
-
}]);
|
|
1454
|
-
|
|
1455
|
-
expect(card.buttons[0].deepLinkValue).toBe('app://home?id={{user_id}}');
|
|
1456
|
-
});
|
|
1457
|
-
|
|
1458
|
-
it('appends deep link keys and leaves other buttons as they are', () => {
|
|
1459
|
-
const externalButton = { linkType: 'EXTERNAL_LINK', externalLinkValue: 'https://x.com' };
|
|
1460
|
-
const [card] = buildCarouselCards([{
|
|
1461
|
-
mediaType: 'image',
|
|
1462
|
-
imageUrl: 'a.jpg',
|
|
1463
|
-
buttons: [
|
|
1464
|
-
{ linkType: 'DEEP_LINK', deepLinkValue: 'app://home', deepLinkKeys: 'id' },
|
|
1465
|
-
externalButton,
|
|
1466
|
-
null,
|
|
1467
|
-
],
|
|
1468
|
-
}]);
|
|
1469
|
-
|
|
1470
|
-
expect(card.buttons).toEqual([
|
|
1471
|
-
{ linkType: 'DEEP_LINK', deepLinkValue: 'app://home?id=id', deepLinkKeys: 'id' },
|
|
1472
|
-
externalButton,
|
|
1473
|
-
null,
|
|
1474
|
-
]);
|
|
1475
|
-
});
|
|
1476
|
-
});
|
|
@@ -20,9 +20,7 @@ import {
|
|
|
20
20
|
isUrl,
|
|
21
21
|
isValidText,
|
|
22
22
|
} from "../../v2Containers/Line/Container/Wrapper/utils";
|
|
23
|
-
import {
|
|
24
|
-
isDeepLink, getDeepLinkParamValue, setDeepLinkParamValue, hasAllDeepLinkParams,
|
|
25
|
-
} from "../../v2Containers/MobilePushNew/utils";
|
|
23
|
+
import { isDeepLink } from "../../v2Containers/MobilePushNew/utils";
|
|
26
24
|
import {
|
|
27
25
|
BTN_MAX_LENGTH,
|
|
28
26
|
DEEP_LINK,
|
|
@@ -54,9 +52,8 @@ export const CapMpushCTA = (props) => {
|
|
|
54
52
|
const [urlError, setUrlError] = useState(false);
|
|
55
53
|
const [buttonError, setButtonError] = useState(false);
|
|
56
54
|
const [deepLinkKeysError, setDeepLinkKeysError] = useState(false);
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
const ctaDeepLinkKeysValue = ctaData[0]?.deepLinkKeys || [];
|
|
55
|
+
const [ctaDeepLinkValue, setCtaDeepLinkValue] = useState(ctaData[0]?.url || "");
|
|
56
|
+
const [ctaDeepLinkKeysValue, setCtaDeepLinkKeysValue] = useState(ctaData[0]?.deepLinkKeys || []);
|
|
60
57
|
const [localUrlValues, setLocalUrlValues] = useState({});
|
|
61
58
|
// Track which URLs have been manually cleared to prevent restoration
|
|
62
59
|
const clearedUrlsRef = useRef(new Set());
|
|
@@ -136,16 +133,21 @@ export const CapMpushCTA = (props) => {
|
|
|
136
133
|
// Mark this URL as manually cleared to prevent restoration
|
|
137
134
|
clearedUrlsRef.current.add(index);
|
|
138
135
|
|
|
136
|
+
// Clear the URL field when switching between link types
|
|
137
|
+
updateHelper('url', '', index);
|
|
138
|
+
|
|
139
139
|
// Immediately clear the local URL state for this button
|
|
140
140
|
setLocalUrlValues(prev => ({
|
|
141
141
|
...prev,
|
|
142
142
|
[index]: ''
|
|
143
143
|
}));
|
|
144
144
|
|
|
145
|
+
// Also clear the local deep link state
|
|
146
|
+
setCtaDeepLinkValue('');
|
|
145
147
|
// Clear any URL errors
|
|
146
148
|
setUrlError(false);
|
|
147
|
-
//
|
|
148
|
-
|
|
149
|
+
// Update the URL type
|
|
150
|
+
updateHelper('urlType', value, index);
|
|
149
151
|
};
|
|
150
152
|
|
|
151
153
|
const onUrlChange = ({ target }) => {
|
|
@@ -173,6 +175,7 @@ export const CapMpushCTA = (props) => {
|
|
|
173
175
|
};
|
|
174
176
|
|
|
175
177
|
const onDeepLinkSelect = (value, index) => {
|
|
178
|
+
setCtaDeepLinkValue(value);
|
|
176
179
|
let errorMessage = false;
|
|
177
180
|
if (!isDeepLink(value)) {
|
|
178
181
|
errorMessage = formatMessage(messages.ctaWebsiteUrlErrorMessage);
|
|
@@ -181,10 +184,13 @@ export const CapMpushCTA = (props) => {
|
|
|
181
184
|
updateHelper('url', value, index);
|
|
182
185
|
};
|
|
183
186
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
|
|
187
|
+
const onDeepLinkKeysChange = ({ target }) => {
|
|
188
|
+
const { value, dataset } = target;
|
|
189
|
+
const index = parseInt(dataset.index, 10);
|
|
190
|
+
// Parse comma-separated values into array
|
|
191
|
+
const keysArray = value?.split(',')?.map((key) => key?.trim())?.filter((key) => key?.length > 0);
|
|
192
|
+
setCtaDeepLinkKeysValue(keysArray);
|
|
193
|
+
setDeepLinkKeysError(keysArray.length === 0);
|
|
188
194
|
updateHelper('deepLinkKeys', keysArray, index);
|
|
189
195
|
};
|
|
190
196
|
|
|
@@ -194,7 +200,7 @@ export const CapMpushCTA = (props) => {
|
|
|
194
200
|
return true;
|
|
195
201
|
} else if (urlType === DEEP_LINK && (ctaDeepLinkValue === "" || urlError)) {
|
|
196
202
|
return true;
|
|
197
|
-
} else if (urlType === DEEP_LINK && ctaDeepLinkValue && deepLinkKeysFromSelectionArray?.length > 0 && (!
|
|
203
|
+
} else if (urlType === DEEP_LINK && ctaDeepLinkValue && deepLinkKeysFromSelectionArray?.length > 0 && (!Array.isArray(ctaDeepLinkKeysValue) || ctaDeepLinkKeysValue?.length === 0 || deepLinkKeysError)) {
|
|
198
204
|
return true;
|
|
199
205
|
} else if (urlType === EXTERNAL_URL && (url === "" || urlError)) {
|
|
200
206
|
return true;
|
|
@@ -229,10 +235,9 @@ export const CapMpushCTA = (props) => {
|
|
|
229
235
|
type="flex"
|
|
230
236
|
>
|
|
231
237
|
<CapColumn>
|
|
232
|
-
<CapRow
|
|
238
|
+
<CapRow className="mpush-cta-row">
|
|
233
239
|
<CapColumn>
|
|
234
|
-
|
|
235
|
-
<CapIcon size="s" type="open-in-new" />
|
|
240
|
+
<CapIcon size="s" type={'launch'} />
|
|
236
241
|
</CapColumn>
|
|
237
242
|
<CapColumn className="btn-text">
|
|
238
243
|
<CapLabel type="label2" className="mpush-saved-cta-button-text">
|
|
@@ -246,11 +251,13 @@ export const CapMpushCTA = (props) => {
|
|
|
246
251
|
<CapTag className="cta-type-label">{formatMessage(messages.urlDeepLink)}</CapTag>
|
|
247
252
|
: <CapTag className="cta-type-label">{formatMessage(messages.urlExternalLink)}</CapTag>}
|
|
248
253
|
</CapColumn>
|
|
249
|
-
<CapColumn
|
|
250
|
-
{urlType === DEEP_LINK ? selectedDeepLink?.label :
|
|
254
|
+
<CapColumn>
|
|
255
|
+
{urlType === DEEP_LINK ? selectedDeepLink?.label : ''}
|
|
256
|
+
</CapColumn>
|
|
257
|
+
<CapColumn>
|
|
251
258
|
</CapColumn>
|
|
252
259
|
<CapColumn>
|
|
253
|
-
<CapRow
|
|
260
|
+
<CapRow className="cta-action-grp">
|
|
254
261
|
<CapColumn
|
|
255
262
|
className="mpush-saved-cta-edit-icon"
|
|
256
263
|
onClick={() => isSavedCta(index, false)}
|
|
@@ -310,35 +317,9 @@ export const CapMpushCTA = (props) => {
|
|
|
310
317
|
onChange={(value) => onDeepLinkSelect(value, index)}
|
|
311
318
|
value={ctaDeepLinkValue}
|
|
312
319
|
/>
|
|
313
|
-
{/* Keys under the Deep link dropdown, as in Notification tap */}
|
|
314
|
-
{ctaDeepLinkValue && deepLinkKeysFromSelectionArray.length > 0 && (
|
|
315
|
-
<CapRow useLegacy className="mpush-cta-deep-link-keys">
|
|
316
|
-
<CapHeading type="h4">
|
|
317
|
-
{formatMessage(messages.deepLinkKeys)}
|
|
318
|
-
</CapHeading>
|
|
319
|
-
{deepLinkKeysFromSelectionArray.map((key, keyIndex) => (
|
|
320
|
-
<CapRow useLegacy key={key} className="mpush-deep-link-key">
|
|
321
|
-
<CapLabel type="label2" className="cta-deep-link-keys-value">
|
|
322
|
-
{key}
|
|
323
|
-
</CapLabel>
|
|
324
|
-
<CapInput
|
|
325
|
-
id={keyIndex === 0 ? "mpush-deep-link-keys" : `mpush-deep-link-keys-${keyIndex}`}
|
|
326
|
-
className="mpush-deep-link-keys"
|
|
327
|
-
onChange={({ target: { value } }) => onDeepLinkKeysChange(index, key, value)}
|
|
328
|
-
placeholder={formatMessage(messages.deepLinkKeysPlaceholder, { key })}
|
|
329
|
-
value={getDeepLinkParamValue(deepLinkKeysArray, key)}
|
|
330
|
-
data-index={index}
|
|
331
|
-
errorMessage={deepLinkKeysError && keyIndex === deepLinkKeysFromSelectionArray.length - 1 ? formatMessage(messages.deepLinkKeysRequired) : ""}
|
|
332
|
-
/>
|
|
333
|
-
</CapRow>
|
|
334
|
-
))}
|
|
335
|
-
</CapRow>
|
|
336
|
-
)}
|
|
337
320
|
</CapRow>
|
|
338
321
|
)}
|
|
339
322
|
{urlType === EXTERNAL_URL && (
|
|
340
|
-
// Wrapper lets the stylesheet size the label row to match "Type of link"
|
|
341
|
-
<CapRow className="mpush-cta-external-link-field">
|
|
342
323
|
<CapTagListWithInput
|
|
343
324
|
inputId="mpush-cta-external-link"
|
|
344
325
|
inputValue={localUrlValues[index] || ''}
|
|
@@ -348,7 +329,8 @@ export const CapMpushCTA = (props) => {
|
|
|
348
329
|
inputMaxLength={URL_MAX_LENGTH}
|
|
349
330
|
inputErrorMessage={urlError}
|
|
350
331
|
headingText={formatMessage(messages.urlExternalLink)}
|
|
351
|
-
headingStyle={{
|
|
332
|
+
headingStyle={{ marginTop: '3%', marginRight: '50%'}}
|
|
333
|
+
containerStyle={{ width: '70%', marginTop: '-0.625rem' }}
|
|
352
334
|
moduleFilterEnabled={location?.query?.type !== "embedded"}
|
|
353
335
|
onTagSelect={onButtonTagSelect}
|
|
354
336
|
onContextChange={handleOnTagsContextChange}
|
|
@@ -358,9 +340,37 @@ export const CapMpushCTA = (props) => {
|
|
|
358
340
|
selectedOfferDetails={selectedOfferDetails}
|
|
359
341
|
inputProps={{ 'data-index': index }}
|
|
360
342
|
/>
|
|
361
|
-
</CapRow>
|
|
362
343
|
)}
|
|
363
344
|
</CapColumn>
|
|
345
|
+
{urlType === DEEP_LINK && ctaDeepLinkValue && deepLinkKeysFromSelectionArray.length > 0 && (
|
|
346
|
+
<CapColumn>
|
|
347
|
+
<CapRow useLegacy style={{ marginTop: '10px' }}>
|
|
348
|
+
<CapHeading type="h4">
|
|
349
|
+
{formatMessage(messages.deepLinkKeys)}
|
|
350
|
+
</CapHeading>
|
|
351
|
+
<CapLabel type="label2" className="cta-deep-link-keys-value">
|
|
352
|
+
{(() => {
|
|
353
|
+
if (deepLinkKeysFromSelectionArray.length > 0) {
|
|
354
|
+
return deepLinkKeysFromSelectionArray.join(', ');
|
|
355
|
+
}
|
|
356
|
+
if (deepLinkKeysArray.length > 0) {
|
|
357
|
+
return deepLinkKeysArray.join(', ');
|
|
358
|
+
}
|
|
359
|
+
})()}
|
|
360
|
+
</CapLabel>
|
|
361
|
+
<CapInput
|
|
362
|
+
id="mpush-deep-link-keys"
|
|
363
|
+
className="mpush-deep-link-keys"
|
|
364
|
+
onChange={onDeepLinkKeysChange}
|
|
365
|
+
placeholder={formatMessage(messages.deepLinkKeysPlaceholder, { key: deepLinkKeysFromSelectionArray.join(', ') })}
|
|
366
|
+
value={Array.isArray(ctaDeepLinkKeysValue) ? ctaDeepLinkKeysValue.join(', ') : (ctaDeepLinkKeysValue || '')}
|
|
367
|
+
size="large"
|
|
368
|
+
data-index={index}
|
|
369
|
+
errorMessage={deepLinkKeysError ? formatMessage(messages.deepLinkKeysRequired) : ""}
|
|
370
|
+
/>
|
|
371
|
+
</CapRow>
|
|
372
|
+
</CapColumn>
|
|
373
|
+
)}
|
|
364
374
|
<CapColumn>
|
|
365
375
|
<CapRow useLegacy className="mpush-cta-save-delete-btn">
|
|
366
376
|
<CapTooltip
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: row;
|
|
11
11
|
justify-content: space-between;
|
|
12
|
-
// MobilePushNew's .mpush-cta-buttons padding is for the Buttons section, not this link row
|
|
13
|
-
padding-bottom: 0;
|
|
14
12
|
|
|
15
13
|
.mpush-render-btn-length {
|
|
16
14
|
margin-top: $CAP_SPACE_12;
|
|
@@ -33,18 +31,6 @@
|
|
|
33
31
|
margin-top: $CAP_SPACE_12;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
|
-
// External link column: its label row (heading + "Add label") gets the height of the
|
|
37
|
-
// "Type of link" label plus its 8px gap, so the input lines up with the dropdown
|
|
38
|
-
.mpush-cta-external-link-field {
|
|
39
|
-
width: 70%;
|
|
40
|
-
|
|
41
|
-
> .ant-col > .ant-row:first-child {
|
|
42
|
-
height: 1.449rem; // CapHeading h4 line height
|
|
43
|
-
margin-bottom: $CAP_SPACE_08;
|
|
44
|
-
justify-content: space-between;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
34
|
.mpush-cta-save-delete-btn {
|
|
49
35
|
margin-top: $CAP_SPACE_16;
|
|
50
36
|
|
|
@@ -56,18 +42,8 @@
|
|
|
56
42
|
}
|
|
57
43
|
}
|
|
58
44
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
margin-top: $CAP_SPACE_16;
|
|
62
|
-
|
|
63
|
-
.mpush-deep-link-key {
|
|
64
|
-
margin-top: $CAP_SPACE_12;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.cta-deep-link-keys-value {
|
|
68
|
-
display: block;
|
|
69
|
-
margin: 0 0 $CAP_SPACE_08;
|
|
70
|
-
}
|
|
45
|
+
.cta-deep-link-keys-value {
|
|
46
|
+
margin: $CAP_SPACE_08 0;
|
|
71
47
|
}
|
|
72
48
|
|
|
73
49
|
}
|
|
@@ -79,27 +55,13 @@
|
|
|
79
55
|
padding: $CAP_SPACE_08 $CAP_SPACE_12;
|
|
80
56
|
border-radius: $CAP_SPACE_04;
|
|
81
57
|
height: $CAP_SPACE_40;
|
|
82
|
-
gap: $CAP_SPACE_12;
|
|
83
58
|
|
|
84
59
|
.mpush-saved-cta-button-text {
|
|
85
60
|
font-weight: 500;
|
|
86
61
|
}
|
|
87
62
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
display: flex;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// URL fills the space up to the icons and ends in "..." when too long.
|
|
94
|
-
// contain: inline-size stops a long URL from widening the whole form.
|
|
95
|
-
.mpush-saved-cta-link {
|
|
96
|
-
flex: 1;
|
|
97
|
-
min-width: 0;
|
|
98
|
-
contain: inline-size;
|
|
99
|
-
white-space: nowrap;
|
|
100
|
-
overflow: hidden;
|
|
101
|
-
text-overflow: ellipsis;
|
|
102
|
-
color: $CAP_G04;
|
|
63
|
+
.mpush-saved-cta-edit-icon {
|
|
64
|
+
margin-left: 4.286rem;
|
|
103
65
|
}
|
|
104
66
|
}
|
|
105
67
|
.cta-label {
|
|
@@ -127,5 +89,5 @@
|
|
|
127
89
|
padding-left: 1rem;
|
|
128
90
|
}
|
|
129
91
|
.btn-text {
|
|
130
|
-
margin-left: $
|
|
92
|
+
margin-left: $CAP_SPACE_24;
|
|
131
93
|
}
|
|
@@ -23,7 +23,6 @@ const iPhonePushMessagePhone = require('../../TemplatePreview/assets/images/iOS_
|
|
|
23
23
|
|
|
24
24
|
// Import video play icon for carousel
|
|
25
25
|
const videoPlay = require('../../../assets/videoPlay.svg');
|
|
26
|
-
const videoEmptyPreview = require('../../TemplatePreview/assets/images/empty_video_preview.svg');
|
|
27
26
|
|
|
28
27
|
const MobilePushPreviewContent = ({
|
|
29
28
|
content,
|
|
@@ -87,15 +86,14 @@ const MobilePushPreviewContent = ({
|
|
|
87
86
|
|
|
88
87
|
// Render MobilePush carousel (based on TemplatePreview renderMobilePushCarousel)
|
|
89
88
|
const renderMobilePushCarousel = (contentData) => {
|
|
90
|
-
// Every card shows, even before its media is uploaded (an empty card keeps its place)
|
|
91
89
|
if (!contentData?.carouselData || contentData?.carouselData?.length === 0) {
|
|
92
90
|
return null;
|
|
93
91
|
}
|
|
94
92
|
|
|
95
93
|
return (
|
|
96
94
|
<CapRow type="flex" vertical noWrap className="msg-container-carousel mobile-push-carousel-container">
|
|
97
|
-
<CapRow
|
|
98
|
-
{contentData
|
|
95
|
+
<CapRow useLegacy className="scroll-container mobile-push-scroll-container">
|
|
96
|
+
{contentData?.carouselData?.map((item, idx) => (
|
|
99
97
|
<CapColumn
|
|
100
98
|
key={`carousel-card-${idx}`}
|
|
101
99
|
className="mobile-push-carousel-card message-pop align-left message-pop-carousel"
|
|
@@ -107,11 +105,10 @@ const MobilePushPreviewContent = ({
|
|
|
107
105
|
className="carousel-image"
|
|
108
106
|
/>
|
|
109
107
|
)}
|
|
110
|
-
{item?.mediaType?.toLowerCase() === MEDIA_TYPE_VIDEO.toLowerCase() &&
|
|
108
|
+
{item?.mediaType?.toLowerCase() === MEDIA_TYPE_VIDEO.toLowerCase() && item?.videoPreviewImg && (
|
|
111
109
|
<CapRow className="video-preview">
|
|
112
|
-
{/* No thumbnail from the upload: same placeholder as WhatsApp/RCS */}
|
|
113
110
|
<CapImage
|
|
114
|
-
src={item?.videoPreviewImg ||
|
|
111
|
+
src={item?.videoPreviewImg || item?.url}
|
|
115
112
|
alt="carousel-video-preview"
|
|
116
113
|
className="carousel-video-preview"
|
|
117
114
|
/>
|
|
@@ -220,15 +217,15 @@ const MobilePushPreviewContent = ({
|
|
|
220
217
|
{/* Action Buttons */}
|
|
221
218
|
{(deviceContent?.actions || []).filter((action) => action?.label || action?.actionText).length > 0
|
|
222
219
|
&& deviceContent?.carouselData?.length === 0 && (
|
|
223
|
-
<CapRow
|
|
224
|
-
{deviceContent
|
|
220
|
+
<CapRow useLegacy className="actions">
|
|
221
|
+
{(deviceContent?.actions || []).map((action) => (
|
|
225
222
|
(action?.label || action?.actionText) && (
|
|
226
223
|
<span
|
|
227
224
|
className="action"
|
|
228
|
-
key={`action-${
|
|
225
|
+
key={`action-${action?.label || action?.actionText}`}
|
|
229
226
|
title={action?.url || action?.actionLink || ''}
|
|
230
227
|
>
|
|
231
|
-
{action?.label || action?.actionText}
|
|
228
|
+
{action?.label?.toUpperCase() || action?.actionText?.toUpperCase()}
|
|
232
229
|
</span>
|
|
233
230
|
)
|
|
234
231
|
))}
|
|
@@ -2307,21 +2307,9 @@
|
|
|
2307
2307
|
flex-direction: row;
|
|
2308
2308
|
gap: $CAP_SPACE_08;
|
|
2309
2309
|
|
|
2310
|
-
// One button: centred. Two: equal halves, each centred, split by a divider.
|
|
2311
2310
|
.action {
|
|
2312
2311
|
font-size: $FONT_SIZE_S;
|
|
2313
|
-
|
|
2314
|
-
color: $FONT_COLOR_01;
|
|
2315
|
-
flex: 1 1 0;
|
|
2316
|
-
min-width: 0;
|
|
2317
|
-
text-align: center;
|
|
2318
|
-
white-space: nowrap;
|
|
2319
|
-
overflow: hidden;
|
|
2320
|
-
text-overflow: ellipsis;
|
|
2321
|
-
|
|
2322
|
-
& + .action {
|
|
2323
|
-
border-left: 1px solid $CAP_G07;
|
|
2324
|
-
}
|
|
2312
|
+
// Additional action button styles from TemplatePreview
|
|
2325
2313
|
}
|
|
2326
2314
|
}
|
|
2327
2315
|
}
|
|
@@ -212,8 +212,6 @@ export const CTA_TYPE_EXTERNAL_URL = 'EXTERNAL_URL';
|
|
|
212
212
|
// ============================================
|
|
213
213
|
export const STYLE_TYPE_BIG_PICTURE = 'BIG_PICTURE';
|
|
214
214
|
export const STYLE_TYPE_BIG_TEXT = 'BIG_TEXT';
|
|
215
|
-
export const STYLE_TYPE_VIDEO = 'VIDEO';
|
|
216
|
-
export const STYLE_TYPE_MANUAL_CAROUSEL = 'MANUAL_CAROUSEL';
|
|
217
215
|
|
|
218
216
|
// ============================================
|
|
219
217
|
// DEVICE TYPE CONSTANTS (for API payloads)
|