@capillarytech/creatives-library 9.2.2-alpha.sprint-cap-214249.44 → 9.2.2

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 (89) hide show
  1. package/constants/unified.js +1 -3
  2. package/package.json +1 -1
  3. package/translations/en.json +0 -1
  4. package/translations/ja-JP.json +0 -1
  5. package/translations/zh.json +0 -1
  6. package/utils/common.js +6 -0
  7. package/utils/createMobilePushPayload.js +56 -50
  8. package/utils/tagValidations.js +4 -35
  9. package/utils/tests/createMobilePushPayload.test.js +168 -177
  10. package/utils/tests/tagValidations.test.js +0 -48
  11. package/v2Components/CapMpushCTA/index.js +57 -47
  12. package/v2Components/CapMpushCTA/index.scss +5 -43
  13. package/v2Components/CapTagList/index.js +7 -46
  14. package/v2Components/CapTagList/messages.js +0 -44
  15. package/v2Components/CapTagList/style.scss +1 -113
  16. package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +8 -11
  17. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -13
  18. package/v2Components/CommonTestAndPreview/constants.js +0 -2
  19. package/v2Components/CommonTestAndPreview/index.js +12 -51
  20. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/MobilePushPreviewContent.test.js +5 -83
  21. package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -100
  22. package/v2Components/FormBuilder/Classic.js +14 -24
  23. package/v2Components/FormBuilder/Functional/channels/mobilepush/config.js +0 -1
  24. package/v2Components/FormBuilder/Functional/channels/mobilepush/getEditorErrorDescriptor.js +1 -1
  25. package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/validate.test.js +0 -57
  26. package/v2Components/FormBuilder/Functional/channels/mobilepush/validate.js +4 -4
  27. package/v2Components/FormBuilder/Functional/channels/sms/getEditorErrorDescriptor.js +0 -3
  28. package/v2Components/FormBuilder/Functional/channels/sms/tests/getEditorErrorDescriptor.test.js +0 -5
  29. package/v2Components/FormBuilder/Functional/channels/sms/tests/validate.test.js +0 -6
  30. package/v2Components/FormBuilder/Functional/channels/sms/validate.js +1 -3
  31. package/v2Components/FormBuilder/Functional/renderers/mpushRenderers.js +0 -3
  32. package/v2Components/FormBuilder/Functional/tests/mpushRenderers.test.js +0 -22
  33. package/v2Components/MobilePushPreviewV2/index.js +9 -22
  34. package/v2Components/TemplatePreview/_templatePreview.scss +2 -18
  35. package/v2Components/TemplatePreview/index.js +18 -20
  36. package/v2Components/TemplatePreview/tests/index.test.js +0 -69
  37. package/v2Containers/Cap/messages.js +0 -4
  38. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +0 -1
  39. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/extractContentForPreview.js +2 -12
  40. package/v2Containers/CreativesContainer/SlideBoxContent.js +6 -4
  41. package/v2Containers/CreativesContainer/index.js +1 -2
  42. package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +0 -43
  43. package/v2Containers/InApp/index.js +1 -4
  44. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +0 -3
  45. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +0 -2
  46. package/v2Containers/Line/Container/Text/index.js +1 -3
  47. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +0 -16
  48. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +0 -18
  49. package/v2Containers/MobilePushNew/components/CtaButtons.js +47 -52
  50. package/v2Containers/MobilePushNew/components/MediaUploaders.js +345 -105
  51. package/v2Containers/MobilePushNew/components/PlatformContentFields.js +105 -127
  52. package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +208 -30
  53. package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +1484 -307
  54. package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +59 -165
  55. package/v2Containers/MobilePushNew/constants.js +0 -12
  56. package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +1 -63
  57. package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +0 -78
  58. package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +1 -40
  59. package/v2Containers/MobilePushNew/hooks/useUpload.js +46 -42
  60. package/v2Containers/MobilePushNew/index.js +290 -502
  61. package/v2Containers/MobilePushNew/index.scss +4 -151
  62. package/v2Containers/MobilePushNew/messages.js +6 -106
  63. package/v2Containers/MobilePushNew/tests/index.test.js +1 -483
  64. package/v2Containers/MobilePushNew/tests/utils.test.js +0 -110
  65. package/v2Containers/MobilePushNew/utils.js +0 -83
  66. package/v2Containers/Rcs/index.js +1 -8
  67. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +0 -59
  68. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +0 -4
  69. package/v2Containers/SmsTrai/Edit/index.js +5 -13
  70. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +0 -15
  71. package/v2Containers/Templates/_templates.scss +2 -10
  72. package/v2Containers/Templates/index.js +81 -86
  73. package/v2Containers/Templates/tests/index.test.js +0 -81
  74. package/v2Containers/Viber/index.js +1 -3
  75. package/v2Containers/WebPush/Create/utils/validation.js +0 -6
  76. package/v2Containers/WebPush/Create/utils/validation.test.js +0 -50
  77. package/v2Containers/Whatsapp/index.js +5 -9
  78. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +2 -2
  79. package/v2Containers/Zalo/index.js +1 -4
  80. package/v2Components/CapMpushCTA/tests/index.test.js +0 -150
  81. package/v2Components/CapTagList/TagFallbackPanel.js +0 -124
  82. package/v2Components/CapTagList/constants.js +0 -5
  83. package/v2Components/CapTagList/tests/TagFallback.test.js +0 -222
  84. package/v2Components/CapTagList/utils.js +0 -17
  85. package/v2Components/MobilePushPreviewV2/_mobilePushPreviewV2.scss +0 -7
  86. package/v2Components/MobilePushPreviewV2/tests/index.test.js +0 -55
  87. package/v2Components/TemplatePreview/_mobilePushPhone.scss +0 -72
  88. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/extractContentForPreview.test.js +0 -45
  89. package/v2Containers/MobilePushNew/components/TapLinkActions.js +0 -76
@@ -1,55 +0,0 @@
1
- import MobilePushPreviewV2 from '../index';
2
-
3
- const { setContent } = MobilePushPreviewV2.prototype;
4
-
5
- // Campaign message as stored: carouselData is dropped on save, cards stay in media
6
- const savedMessage = {
7
- androidContent: {
8
- title: 'Android video',
9
- message: 'Video body',
10
- expandableDetails: {
11
- style: 'VIDEO',
12
- media: [{ url: 'body.mp4', type: 'VIDEO', text: '' }],
13
- },
14
- },
15
- iosContent: {
16
- title: 'IOS carousel',
17
- message: 'Carousel body',
18
- expandableDetails: {
19
- style: 'MANUAL_CAROUSEL',
20
- media: [
21
- { url: 'card1.jpg', type: 'IMAGE', text: '' },
22
- { url: 'card2.mp4', type: 'VIDEO', text: '' },
23
- ],
24
- },
25
- },
26
- };
27
-
28
- describe('MobilePushPreviewV2 setContent', () => {
29
- it('builds carousel cards from media for a saved carousel', () => {
30
- const content = setContent(savedMessage, 'iphone', 'MOBILEPUSH');
31
- expect(content.carouselData).toEqual([
32
- { mediaType: 'IMAGE', imageUrl: 'card1.jpg', videoSrc: '' },
33
- { mediaType: 'VIDEO', imageUrl: '', videoSrc: 'card2.mp4' },
34
- ]);
35
- // A video card is not shown as the body video
36
- expect(content.bodyVideo).toEqual({});
37
- });
38
-
39
- it('keeps carouselData when the template still has it', () => {
40
- const cards = [{ mediaType: 'IMAGE', imageUrl: 'kept.jpg' }];
41
- const templateData = {
42
- iosContent: {
43
- title: 'T',
44
- expandableDetails: { style: 'MANUAL_CAROUSEL', carouselData: cards, media: [{ url: 'x.jpg', type: 'IMAGE' }] },
45
- },
46
- };
47
- expect(setContent(templateData, 'iphone', 'MOBILEPUSH').carouselData).toEqual(cards);
48
- });
49
-
50
- it('shows the first media item as the body video when not a carousel', () => {
51
- const content = setContent(savedMessage, 'android', 'MOBILEPUSH');
52
- expect(content.bodyVideo).toEqual({ videoSrc: 'body.mp4', videoPreview: 'body.mp4' });
53
- expect(content.carouselData).toEqual([]);
54
- });
55
- });
@@ -1,72 +0,0 @@
1
- @import '~@capillarytech/cap-ui-library/styles/_variables';
2
-
3
- // Mobile push phone preview, matched to the Preview and Test phone.
4
- // TemplatePreview sets `position: unset` on #mobilepush-preview.shell-v2, so the card was placed
5
- // against a wider ancestor and spilled out of the phone; this re-anchors it to the phone image.
6
- // Include on a selector that ends in `#mobilepush-preview.shell-v2`.
7
- @mixin mobile-push-phone-shell {
8
- position: relative;
9
- width: 100%;
10
- max-width: 26.786rem;
11
- padding: 0;
12
-
13
- .preview-image {
14
- width: 100%;
15
- }
16
-
17
- .android-push-message-Container,
18
- .iphone-push-message-Container {
19
- left: 4%;
20
- width: 92%;
21
-
22
- .message-pop {
23
- padding: $CAP_SPACE_08;
24
- border-radius: $CAP_SPACE_08;
25
- background: $CAP_WHITE;
26
- line-height: normal;
27
- }
28
-
29
- .app-header {
30
- align-items: center;
31
- flex-wrap: nowrap;
32
- }
33
-
34
- .app-header-left {
35
- flex: 1 1 auto;
36
- flex-wrap: nowrap;
37
- min-width: 0;
38
-
39
- .app-icon {
40
- flex: none;
41
- width: $CAP_SPACE_20;
42
- height: $CAP_SPACE_20;
43
- background-color: $CAP_COLOR_16;
44
- }
45
- }
46
-
47
- .title {
48
- max-width: none;
49
- min-width: 0;
50
- font-size: $FONT_SIZE_M;
51
- font-weight: 600;
52
- color: $FONT_COLOR_01;
53
- }
54
-
55
- .app-header-right {
56
- flex: none;
57
- flex-wrap: nowrap;
58
- margin-left: $CAP_SPACE_08;
59
- gap: $CAP_SPACE_04;
60
- font-size: $FONT_SIZE_VS;
61
- }
62
-
63
- .body-text {
64
- padding-left: 2.785rem;
65
- }
66
-
67
- // Fixed 18.75rem image + left margin is wider than the card on narrow columns
68
- .body-image img {
69
- max-width: calc(100% - 1.571rem);
70
- }
71
- }
72
- }
@@ -1,45 +0,0 @@
1
- import extractContentForPreview from '../extractContentForPreview';
2
-
3
- const extractMpush = (androidContent, iosContent = {}) => extractContentForPreview({
4
- channel: 'MOBILEPUSH',
5
- templateData: { androidContent, iosContent },
6
- }).content;
7
-
8
- describe('extractContentForPreview - Mobile Push', () => {
9
- it('passes each saved notification tap (cta) for the test send', () => {
10
- const androidCta = { type: 'DEEP_LINK', actionLink: 'app://home' };
11
- const iosCta = { type: 'EXTERNAL_URL', actionLink: 'https://x.com' };
12
-
13
- const content = extractMpush({ title: 'A', cta: androidCta }, { title: 'I', cta: iosCta });
14
-
15
- expect(content.androidContent.cta).toEqual(androidCta);
16
- expect(content.iosContent.cta).toEqual(iosCta);
17
- });
18
-
19
- it('maps a saved video to the { videoSrc, videoPreview } shape the test send reads', () => {
20
- const content = extractMpush(
21
- { expandableDetails: { style: 'VIDEO', media: [{ url: 'https://a.mp4', type: 'VIDEO', videoPreviewUrl: 'https://a.jpg' }] } },
22
- { expandableDetails: { style: 'VIDEO', media: [{ url: 'https://i.mp4', type: 'VIDEO' }] } },
23
- );
24
-
25
- expect(content.androidContent.bodyVideo).toEqual({ videoSrc: 'https://a.mp4', videoPreview: 'https://a.jpg' });
26
- expect(content.iosContent.bodyVideo).toEqual({ videoSrc: 'https://i.mp4', videoPreview: '' });
27
- });
28
-
29
- it('gives no body video for a carousel whose first card is a video', () => {
30
- const cards = [{ mediaType: 'video', videoSrc: 'https://c.mp4' }];
31
- const content = extractMpush({
32
- expandableDetails: { style: 'MANUAL_CAROUSEL', media: [{ url: 'https://c.mp4', type: 'VIDEO' }], carouselData: cards },
33
- });
34
-
35
- expect(content.androidContent.bodyVideo).toEqual({});
36
- expect(content.androidContent.carouselData).toEqual(cards);
37
- });
38
-
39
- it('gives no video or cta for a text template', () => {
40
- const content = extractMpush({ title: 'A', expandableDetails: { style: 'BIG_TEXT' } });
41
-
42
- expect(content.androidContent.bodyVideo).toEqual({});
43
- expect(content.androidContent.cta).toBeUndefined();
44
- });
45
- });
@@ -1,76 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import CapRow from "@capillarytech/cap-ui-library/CapRow";
4
- import CapColumn from "@capillarytech/cap-ui-library/CapColumn";
5
- import CapButton from "@capillarytech/cap-ui-library/CapButton";
6
- import CapIcon from "@capillarytech/cap-ui-library/CapIcon";
7
- import CapTag from "@capillarytech/cap-ui-library/CapTag";
8
- import CapTooltip from "@capillarytech/cap-ui-library/CapTooltip";
9
- import globalMessages from "../../Cap/messages";
10
- import messages from "../messages";
11
- import { DEEP_LINK } from "../constants";
12
- // Saved-row styles (.cap-mpush-saved-cta, .cta-type-label, ...) shared with the buttons
13
- import "../../../v2Components/CapMpushCTA/index.scss";
14
-
15
- // Save / Delete under an open tap link, as in the button form
16
- export const TapLinkSaveDelete = ({
17
- isSaveDisabled, onSave, onDelete, formatMessage,
18
- }) => (
19
- <CapRow type="flex" align="middle" className="mpush-tap-save-delete-btn">
20
- <CapTooltip title={isSaveDisabled ? formatMessage(messages.tapLinkSaveDisabled) : ""}>
21
- <CapRow className="button-disabled-tooltip-wrapper">
22
- <CapButton onClick={onSave} disabled={isSaveDisabled} className="mpush-tap-save-btn">
23
- {formatMessage(globalMessages.save)}
24
- </CapButton>
25
- </CapRow>
26
- </CapTooltip>
27
- <CapButton onClick={onDelete} type="secondary" className="mpush-tap-delete-btn">
28
- {formatMessage(globalMessages.delete)}
29
- </CapButton>
30
- </CapRow>
31
- );
32
-
33
- TapLinkSaveDelete.propTypes = {
34
- isSaveDisabled: PropTypes.bool.isRequired,
35
- onSave: PropTypes.func.isRequired,
36
- onDelete: PropTypes.func.isRequired,
37
- formatMessage: PropTypes.func.isRequired,
38
- };
39
-
40
- // Collapsed row for a saved tap link, as for a saved button
41
- export const SavedTapLink = ({
42
- linkType, linkText, onEdit, onDelete, formatMessage,
43
- }) => (
44
- <CapRow type="flex" align="middle" className="cap-mpush-saved-cta mpush-saved-tap-link">
45
- <CapColumn>
46
- <CapTag className="cta-type-label">
47
- {formatMessage(linkType === DEEP_LINK ? messages.tapActionDeepLink : messages.tapActionExternalLink)}
48
- </CapTag>
49
- </CapColumn>
50
- <CapColumn className="mpush-saved-cta-link" title={linkText}>
51
- {linkText}
52
- </CapColumn>
53
- <CapColumn>
54
- <CapRow type="flex" align="middle" className="cta-action-grp">
55
- <CapColumn className="mpush-saved-tap-link-edit-icon" onClick={onEdit}>
56
- <CapIcon size="s" type="edit" className="cta-action" />
57
- </CapColumn>
58
- <CapColumn className="cta-del-icon mpush-saved-tap-link-delete-icon" onClick={onDelete}>
59
- <CapIcon size="s" type="delete" className="cta-action" />
60
- </CapColumn>
61
- </CapRow>
62
- </CapColumn>
63
- </CapRow>
64
- );
65
-
66
- SavedTapLink.propTypes = {
67
- linkType: PropTypes.string.isRequired,
68
- linkText: PropTypes.string,
69
- onEdit: PropTypes.func.isRequired,
70
- onDelete: PropTypes.func.isRequired,
71
- formatMessage: PropTypes.func.isRequired,
72
- };
73
-
74
- SavedTapLink.defaultProps = {
75
- linkText: "",
76
- };