@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
@@ -8,8 +8,8 @@ import {
8
8
  } from "../../constants";
9
9
 
10
10
  // Simple mock components
11
- jest.mock("@capillarytech/cap-ui-library/CapRow", () => ({ children, className }) => <div className={className}>{children}</div>);
12
- jest.mock("@capillarytech/cap-ui-library/CapColumn", () => ({ children, className, onClick }) => <div className={className} onClick={onClick}>{children}</div>);
11
+ jest.mock("@capillarytech/cap-ui-library/CapRow", () => ({ children }) => <div>{children}</div>);
12
+ jest.mock("@capillarytech/cap-ui-library/CapColumn", () => ({ children }) => <div>{children}</div>);
13
13
  jest.mock("@capillarytech/cap-ui-library/CapInput", () => {
14
14
  const MockCapInput = ({
15
15
  value, onChange, errorMessage, error, ...props
@@ -39,15 +39,17 @@ jest.mock("@capillarytech/cap-ui-library/CapInput", () => {
39
39
  jest.mock("@capillarytech/cap-ui-library/CapHeading", () => ({ children }) => <div>{children}</div>);
40
40
  jest.mock("@capillarytech/cap-ui-library/CapError", () => ({ children }) => <div data-testid="cap-error">{children}</div>);
41
41
  jest.mock("@capillarytech/cap-ui-library/CapDivider", () => () => <div data-testid="divider" />);
42
- jest.mock("@capillarytech/cap-ui-library/CapSelect", () => ({ value, onChange, options }) => (
43
- <select value={value} onChange={(e) => onChange && onChange(e.target.value)}>
44
- {options?.map((option) => (
45
- <option key={option.value} value={option.value}>
46
- {option.label}
47
- </option>
48
- ))}
49
- </select>
50
- ));
42
+ jest.mock("@capillarytech/cap-ui-library/CapSelect", () => ({
43
+ CapCustomSelect: ({ value, onChange, options }) => (
44
+ <select value={value} onChange={(e) => onChange && onChange(e.target.value)}>
45
+ {options?.map((option) => (
46
+ <option key={option.value} value={option.value}>
47
+ {option.label}
48
+ </option>
49
+ ))}
50
+ </select>
51
+ ),
52
+ }));
51
53
  jest.mock("@capillarytech/cap-ui-library/CapCheckbox", () => ({ checked, onChange, children }) => (
52
54
  <div>
53
55
  <input type="checkbox" checked={checked} onChange={onChange} data-testid="action-checkbox" />
@@ -99,18 +101,8 @@ jest.mock("../../messages", () => ({
99
101
  deepLink: { id: "deepLink", defaultMessage: "Deep Link" },
100
102
  externalLink: { id: "externalLink", defaultMessage: "External Link" },
101
103
  enterExternalLink: { id: "enterExternalLink", defaultMessage: "Enter external link" },
102
- notificationTap: { id: "notificationTap", defaultMessage: "Notification tap" },
103
- notificationTapDescription: { id: "notificationTapDescription", defaultMessage: "What happens when someone taps the notification itself." },
104
- whenTappedOpen: { id: "whenTappedOpen", defaultMessage: "When tapped, open" },
105
- tapActionApp: { id: "tapActionApp", defaultMessage: "App (default)" },
106
- tapActionAppHelp: { id: "tapActionAppHelp", defaultMessage: "Opens your app. Choose a link to send people to a specific page instead." },
107
- tapActionDeepLink: { id: "tapActionDeepLink", defaultMessage: "Deep link" },
108
- tapActionExternalLink: { id: "tapActionExternalLink", defaultMessage: "External link" },
109
- url: { id: "url", defaultMessage: "URL" },
110
- enterUrl: { id: "enterUrl", defaultMessage: "Enter URL" },
111
104
  deepLinkKeys: { id: "deepLinkKeys", defaultMessage: "Deep Link Keys" },
112
105
  deepLinkKeysPlaceholder: { id: "deepLinkKeysPlaceholder", defaultMessage: "Enter {key}" },
113
- tapLinkSaveDisabled: { id: "tapLinkSaveDisabled", defaultMessage: "Please complete the above fields to enable Save" },
114
106
  deepLinkKeysRequired: { id: "deepLinkKeysRequired", defaultMessage: "Deep link keys are required" },
115
107
  addLabels: { id: "addLabels", defaultMessage: "Add labels" },
116
108
  personalizationTagsErrorMessage: { id: "personalizationTagsErrorMessage", defaultMessage: "Personalization tags are not supported for anonymous customers, please remove the tags." },
@@ -133,12 +125,6 @@ jest.mock("../../constants", () => ({
133
125
  ],
134
126
  DEEP_LINK: "DEEP_LINK",
135
127
  EXTERNAL_LINK: "EXTERNAL_LINK",
136
- TAP_ACTION_APP: "APP",
137
- TAP_ACTION_OPTIONS: [
138
- { labelKey: "tapActionApp", value: "APP" },
139
- { labelKey: "tapActionDeepLink", value: "DEEP_LINK" },
140
- { labelKey: "tapActionExternalLink", value: "EXTERNAL_LINK" },
141
- ],
142
128
  }));
143
129
 
144
130
  describe("PlatformContentFields", () => {
@@ -161,11 +147,11 @@ describe("PlatformContentFields", () => {
161
147
  handleTitleChange: jest.fn(),
162
148
  handleMessageChange: jest.fn(),
163
149
  handleMediaTypeChange: jest.fn(),
164
- handleTapActionChange: jest.fn(),
150
+ handleActionOnClickChange: jest.fn(),
151
+ handleLinkTypeChange: jest.fn(),
165
152
  handleDeepLinkChange: jest.fn(),
166
153
  handleDeepLinkKeysChange: jest.fn(),
167
154
  handleExternalLinkChange: jest.fn(),
168
- handleTapLinkSavedChange: jest.fn(),
169
155
  onTagSelect: jest.fn(),
170
156
  handleOnTagsContextChange: jest.fn(),
171
157
  },
@@ -323,91 +309,30 @@ describe("PlatformContentFields", () => {
323
309
  });
324
310
  });
325
311
 
326
- describe("Notification tap", () => {
327
- // Second select: the first one is Media type
328
- const getTapSelect = (container) => container.querySelectorAll("select")[1];
329
-
330
- it("shows App (default) with its help text when there is no tap action", () => {
331
- const { container } = renderComponent({
332
- content: { ...defaultProps.content, actionOnClick: false },
333
- });
334
-
335
- expect(container.textContent).toContain("Notification tap");
336
- expect(container.textContent).toContain("When tapped, open");
337
- expect(getTapSelect(container)).toHaveValue("APP");
338
- expect(container.textContent).toContain("Opens your app. Choose a link to send people to a specific page instead.");
339
- expect(container.textContent).not.toContain("Buttons and Links");
340
- });
341
-
342
- it("calls the tap action handler with the chosen option", () => {
343
- const { container } = renderComponent();
344
-
345
- fireEvent.change(getTapSelect(container), { target: { value: EXTERNAL_LINK } });
346
-
347
- expect(defaultProps.handlers.handleTapActionChange).toHaveBeenCalledWith(EXTERNAL_LINK);
348
- });
349
-
350
- it("shows the deep link select, without the App help text, for Deep link", () => {
351
- const { container } = renderComponent({
352
- content: { ...defaultProps.content, actionOnClick: true, tapLinkSaved: false, linkType: DEEP_LINK },
353
- });
354
-
355
- expect(getTapSelect(container)).toHaveValue(DEEP_LINK);
356
- expect(container.querySelectorAll("select")).toHaveLength(3);
357
- expect(container.textContent).not.toContain("Opens your app.");
358
- });
359
-
360
- it("shows the URL input for External link", () => {
361
- const { container } = renderComponent({
362
- content: { ...defaultProps.content, actionOnClick: true, tapLinkSaved: false, linkType: EXTERNAL_LINK },
363
- // plain fn: resetMocks wipes jest.fn implementations
364
- formatMessage: (msg) => msg?.defaultMessage ?? "",
365
- });
366
-
367
- expect(getTapSelect(container)).toHaveValue(EXTERNAL_LINK);
368
- expect(container.textContent).toContain("URL");
369
- expect(container.querySelector("#mobile-push-external-link-input")).toHaveAttribute("placeholder", "Enter URL");
370
- });
371
-
372
- // plain fn: resetMocks wipes jest.fn implementations
373
- const plainFormatMessage = (msg) => msg?.defaultMessage ?? "";
374
-
375
- it("shows a saved link as one row; edit reopens it, delete sets App", () => {
376
- const { container } = renderComponent({
377
- content: { ...defaultProps.content, actionOnClick: true, linkType: EXTERNAL_LINK },
378
- formatMessage: plainFormatMessage,
379
- });
312
+ describe("Action on Click", () => {
313
+ it("should call action on click change handler", () => {
314
+ const { getByTestId } = renderComponent();
315
+ const checkbox = getByTestId("action-checkbox");
380
316
 
381
- expect(container.querySelector(".mpush-saved-tap-link")).toBeInTheDocument();
382
- expect(container.textContent).toContain("https://example.com");
383
- expect(container.querySelector("#mobile-push-external-link-input")).toBeNull();
317
+ fireEvent.click(checkbox);
384
318
 
385
- fireEvent.click(container.querySelector(".mpush-saved-tap-link-edit-icon"));
386
- expect(defaultProps.handlers.handleTapLinkSavedChange).toHaveBeenCalledWith(false);
387
- fireEvent.click(container.querySelector(".mpush-saved-tap-link-delete-icon"));
388
- expect(defaultProps.handlers.handleTapActionChange).toHaveBeenCalledWith("APP");
319
+ expect(defaultProps.handlers.handleActionOnClickChange).toHaveBeenCalled();
389
320
  });
390
321
 
391
- it("saves an open link once it is filled", () => {
322
+ it("should show action controls when actionOnClick is true", () => {
392
323
  const { container } = renderComponent({
393
- content: { ...defaultProps.content, actionOnClick: true, tapLinkSaved: false, linkType: EXTERNAL_LINK },
394
- formatMessage: plainFormatMessage,
324
+ content: { ...defaultProps.content, actionOnClick: true },
395
325
  });
396
326
 
397
- const saveButton = container.querySelector(".mpush-tap-save-btn");
398
- expect(saveButton).not.toBeDisabled();
399
- fireEvent.click(saveButton);
400
- expect(defaultProps.handlers.handleTapLinkSavedChange).toHaveBeenCalledWith(true);
327
+ expect(container.textContent).toContain("Link Type");
401
328
  });
402
329
 
403
- it("keeps Save off while the link is empty", () => {
330
+ it("should hide action controls when actionOnClick is false", () => {
404
331
  const { container } = renderComponent({
405
- content: { ...defaultProps.content, actionOnClick: true, tapLinkSaved: false, linkType: DEEP_LINK },
406
- linkProps: { ...defaultProps.linkProps, deepLinkValue: "" },
407
- formatMessage: plainFormatMessage,
332
+ content: { ...defaultProps.content, actionOnClick: false },
408
333
  });
409
334
 
410
- expect(container.querySelector(".mpush-tap-save-btn")).toBeDisabled();
335
+ expect(container.textContent).not.toContain("Link Type");
411
336
  });
412
337
  });
413
338
 
@@ -428,7 +353,7 @@ describe("PlatformContentFields", () => {
428
353
  describe("External Link Input", () => {
429
354
  it("should call external link change handler", () => {
430
355
  const { container } = renderComponent({
431
- content: { ...defaultProps.content, actionOnClick: true, tapLinkSaved: false, linkType: EXTERNAL_LINK },
356
+ content: { ...defaultProps.content, actionOnClick: true, linkType: EXTERNAL_LINK },
432
357
  });
433
358
 
434
359
  const externalLinkInput = container.querySelector('input[value="https://example.com"]');
@@ -441,7 +366,7 @@ describe("PlatformContentFields", () => {
441
366
 
442
367
  it("should display external link error when present", () => {
443
368
  const { getByTestId } = renderComponent({
444
- content: { ...defaultProps.content, actionOnClick: true, tapLinkSaved: false, linkType: EXTERNAL_LINK },
369
+ content: { ...defaultProps.content, actionOnClick: true, linkType: EXTERNAL_LINK },
445
370
  errors: { ...defaultProps.errors, externalLink: "Invalid URL" },
446
371
  });
447
372
 
@@ -450,23 +375,21 @@ describe("PlatformContentFields", () => {
450
375
  });
451
376
 
452
377
  describe("Carousel Media Type", () => {
453
- it("shows Notification tap but hides Buttons when mediaType is CAROUSEL", () => {
378
+ it("should hide action controls when mediaType is CAROUSEL", () => {
454
379
  const { container } = renderComponent({
455
380
  content: { ...defaultProps.content, mediaType: "CAROUSEL" },
456
381
  });
457
382
 
458
- // Notification tap is for the whole notification, carousel included
459
- expect(container.textContent).toContain("Notification tap");
383
+ expect(container.textContent).not.toContain("Buttons and Links");
460
384
  expect(container.textContent).not.toContain("CtaButtons");
461
385
  });
462
386
 
463
- it("shows Notification tap and Buttons when mediaType is not CAROUSEL", () => {
387
+ it("should show action controls when mediaType is not CAROUSEL", () => {
464
388
  const { container } = renderComponent({
465
389
  content: { ...defaultProps.content, mediaType: "IMAGE" },
466
390
  });
467
391
 
468
- expect(container.textContent).toContain("Notification tap");
469
- expect(container.textContent).toContain("CtaButtons");
392
+ expect(container.textContent).toContain("Buttons and Links");
470
393
  });
471
394
  });
472
395
 
@@ -513,14 +436,14 @@ describe("PlatformContentFields", () => {
513
436
  const mockLinkProps = {
514
437
  deepLink: mockDeepLink,
515
438
  deepLinkValue: 'test-deep-link',
516
- deepLinkKeysValue: ['key1=value1', 'key2=value2'],
439
+ deepLinkKeysValue: ['key1', 'key2'],
517
440
  externalLinkValue: '',
518
441
  };
519
442
  const mockContent = {
520
443
  title: 'Test Title',
521
444
  message: 'Test Message',
522
445
  mediaType: 'IMAGE',
523
- actionOnClick: true, tapLinkSaved: false,
446
+ actionOnClick: true,
524
447
  linkType: 'DEEP_LINK',
525
448
  };
526
449
 
@@ -539,11 +462,9 @@ describe("PlatformContentFields", () => {
539
462
  />
540
463
  );
541
464
 
542
- // One input per configured key, showing the value typed for it
543
- expect(getByText('key1')).toBeInTheDocument();
544
- expect(getByText('key2')).toBeInTheDocument();
545
- expect(getByDisplayValue('value1')).toBeInTheDocument();
546
- expect(getByDisplayValue('value2')).toBeInTheDocument();
465
+ // Check that deep link keys are displayed correctly
466
+ expect(getByText('key1, key2')).toBeInTheDocument();
467
+ expect(getByDisplayValue('key1, key2')).toBeInTheDocument();
547
468
  });
548
469
 
549
470
  it('should handle deep link keys with single key from selection', () => {
@@ -560,7 +481,7 @@ describe("PlatformContentFields", () => {
560
481
  title: 'Test Title',
561
482
  message: 'Test Message',
562
483
  mediaType: 'IMAGE',
563
- actionOnClick: true, tapLinkSaved: false,
484
+ actionOnClick: true,
564
485
  linkType: 'DEEP_LINK',
565
486
  };
566
487
 
@@ -598,7 +519,7 @@ describe("PlatformContentFields", () => {
598
519
  title: 'Test Title',
599
520
  message: 'Test Message',
600
521
  mediaType: 'IMAGE',
601
- actionOnClick: true, tapLinkSaved: false,
522
+ actionOnClick: true,
602
523
  linkType: 'DEEP_LINK',
603
524
  };
604
525
 
@@ -635,7 +556,7 @@ describe("PlatformContentFields", () => {
635
556
  title: 'Test Title',
636
557
  message: 'Test Message',
637
558
  mediaType: 'IMAGE',
638
- actionOnClick: true, tapLinkSaved: false,
559
+ actionOnClick: true,
639
560
  linkType: 'DEEP_LINK',
640
561
  };
641
562
 
@@ -665,14 +586,14 @@ describe("PlatformContentFields", () => {
665
586
  const mockLinkProps = {
666
587
  deepLink: mockDeepLink,
667
588
  deepLinkValue: 'test-deep-link',
668
- deepLinkKeysValue: 'single-key=string-key-value',
589
+ deepLinkKeysValue: 'string-key-value',
669
590
  externalLinkValue: '',
670
591
  };
671
592
  const mockContent = {
672
593
  title: 'Test Title',
673
594
  message: 'Test Message',
674
595
  mediaType: 'IMAGE',
675
- actionOnClick: true, tapLinkSaved: false,
596
+ actionOnClick: true,
676
597
  linkType: 'DEEP_LINK',
677
598
  };
678
599
 
@@ -709,7 +630,7 @@ describe("PlatformContentFields", () => {
709
630
  title: 'Test Title',
710
631
  message: 'Test Message',
711
632
  mediaType: 'IMAGE',
712
- actionOnClick: true, tapLinkSaved: false,
633
+ actionOnClick: true,
713
634
  linkType: 'DEEP_LINK',
714
635
  };
715
636
 
@@ -747,7 +668,7 @@ describe("PlatformContentFields", () => {
747
668
  title: 'Test Title',
748
669
  message: 'Test Message',
749
670
  mediaType: 'IMAGE',
750
- actionOnClick: true, tapLinkSaved: false,
671
+ actionOnClick: true,
751
672
  linkType: 'DEEP_LINK',
752
673
  };
753
674
 
@@ -766,9 +687,11 @@ describe("PlatformContentFields", () => {
766
687
  />
767
688
  );
768
689
 
769
- // Each input asks for its own key
770
- expect(defaultProps.formatMessage).toHaveBeenCalledWith(expect.any(Object), { key: 'key1' });
771
- expect(defaultProps.formatMessage).toHaveBeenCalledWith(expect.any(Object), { key: 'key2' });
690
+ // Verify that formatMessage was called with the fallback placeholder
691
+ expect(defaultProps.formatMessage).toHaveBeenCalledWith(
692
+ expect.any(Object),
693
+ { key: 'key1, key2' }
694
+ );
772
695
  });
773
696
 
774
697
  it('should handle deep link keys error display', () => {
@@ -785,7 +708,7 @@ describe("PlatformContentFields", () => {
785
708
  title: 'Test Title',
786
709
  message: 'Test Message',
787
710
  mediaType: 'IMAGE',
788
- actionOnClick: true, tapLinkSaved: false,
711
+ actionOnClick: true,
789
712
  linkType: 'DEEP_LINK',
790
713
  };
791
714
  const mockErrors = {
@@ -811,39 +734,11 @@ describe("PlatformContentFields", () => {
811
734
  expect(getByText('Deep link keys error message')).toBeInTheDocument();
812
735
  });
813
736
 
814
- it('sends the configured key with the typed value', () => {
815
- const handleDeepLinkKeysChange = jest.fn();
816
- const { getByPlaceholderText } = render(
817
- <PlatformContentFields
818
- deviceType="ANDROID"
819
- content={{
820
- title: 'Test Title', message: 'Test Message', mediaType: 'IMAGE', actionOnClick: true, tapLinkSaved: false, linkType: 'DEEP_LINK',
821
- }}
822
- errors={{}}
823
- handlers={{ ...defaultProps.handlers, handleDeepLinkKeysChange }}
824
- tagListProps={defaultProps.tagListProps}
825
- mediaUploaderProps={defaultProps.mediaUploaderProps}
826
- ctaButtonProps={defaultProps.ctaButtonProps}
827
- linkProps={{
828
- deepLink: [{ value: 'https://www.youtube.com/', keys: ['testing_purpose'] }],
829
- deepLinkValue: 'https://www.youtube.com/',
830
- deepLinkKeysValue: [],
831
- externalLinkValue: '',
832
- }}
833
- sameContent={false}
834
- formatMessage={(msg, values) => (values?.key ? `Please input ${values.key} here` : msg.defaultMessage)}
835
- />
836
- );
837
-
838
- fireEvent.change(getByPlaceholderText('Please input testing_purpose here'), { target: { value: 'androidDeeplink' } });
839
- expect(handleDeepLinkKeysChange).toHaveBeenCalledWith(['testing_purpose=androidDeeplink']);
840
- });
841
-
842
737
  // Test cases for uncovered lines
843
738
  describe('Deep link null/undefined handling', () => {
844
739
  it('should handle null deepLink in options', () => {
845
740
  const { container } = renderComponent({
846
- content: { ...defaultProps.content, actionOnClick: true, tapLinkSaved: false, linkType: DEEP_LINK },
741
+ content: { ...defaultProps.content, actionOnClick: true, linkType: DEEP_LINK },
847
742
  linkProps: {
848
743
  deepLink: null, // This should trigger the fallback to empty array
849
744
  deepLinkValue: '',
@@ -857,7 +752,7 @@ describe("PlatformContentFields", () => {
857
752
 
858
753
  it('should handle undefined deepLink in options', () => {
859
754
  const { container } = renderComponent({
860
- content: { ...defaultProps.content, actionOnClick: true, tapLinkSaved: false, linkType: DEEP_LINK },
755
+ content: { ...defaultProps.content, actionOnClick: true, linkType: DEEP_LINK },
861
756
  linkProps: {
862
757
  deepLink: undefined, // This should trigger the fallback to empty array
863
758
  deepLinkValue: '',
@@ -885,7 +780,7 @@ describe("PlatformContentFields", () => {
885
780
  title: 'Test Title',
886
781
  message: 'Test Message',
887
782
  mediaType: 'IMAGE',
888
- actionOnClick: true, tapLinkSaved: false,
783
+ actionOnClick: true,
889
784
  linkType: 'DEEP_LINK',
890
785
  };
891
786
 
@@ -924,7 +819,7 @@ describe("PlatformContentFields", () => {
924
819
  title: 'Test Title',
925
820
  message: 'Test Message',
926
821
  mediaType: 'IMAGE',
927
- actionOnClick: true, tapLinkSaved: false,
822
+ actionOnClick: true,
928
823
  linkType: 'DEEP_LINK',
929
824
  };
930
825
 
@@ -963,7 +858,7 @@ describe("PlatformContentFields", () => {
963
858
  title: 'Test Title',
964
859
  message: 'Test Message',
965
860
  mediaType: 'IMAGE',
966
- actionOnClick: true, tapLinkSaved: false,
861
+ actionOnClick: true,
967
862
  linkType: 'DEEP_LINK',
968
863
  };
969
864
 
@@ -985,8 +880,7 @@ describe("PlatformContentFields", () => {
985
880
  );
986
881
 
987
882
  // Should find the base deep link and display keys
988
- expect(getByText('category')).toBeInTheDocument();
989
- expect(getByText('filter')).toBeInTheDocument();
883
+ expect(getByText('category, filter')).toBeInTheDocument();
990
884
  });
991
885
 
992
886
  it('should handle empty query parameters in deep link value', () => {
@@ -1003,7 +897,7 @@ describe("PlatformContentFields", () => {
1003
897
  title: 'Test Title',
1004
898
  message: 'Test Message',
1005
899
  mediaType: 'IMAGE',
1006
- actionOnClick: true, tapLinkSaved: false,
900
+ actionOnClick: true,
1007
901
  linkType: 'DEEP_LINK',
1008
902
  };
1009
903
 
@@ -1036,7 +930,7 @@ describe("PlatformContentFields", () => {
1036
930
  const { container } = renderComponent({
1037
931
  content: {
1038
932
  ...defaultProps.content,
1039
- actionOnClick: true, tapLinkSaved: false,
933
+ actionOnClick: true,
1040
934
  linkType: EXTERNAL_LINK,
1041
935
  },
1042
936
  linkProps: {
@@ -50,8 +50,6 @@ export const MEDIA_TYPES_OPTIONS = [
50
50
  export const MOBILE_PUSH_CHANNEL = "MOBILEPUSH";
51
51
  export const ANDROID = "ANDROID";
52
52
  export const IOS = "IOS";
53
- // Platforms dropdown value for Android and iOS together
54
- export const BOTH_PLATFORMS = "BOTH";
55
53
  export const ALLOWED_IMAGE_EXTENSIONS_REGEX = /\.(jpe?g|png)$/i;
56
54
  export const MPUSH_IMG_SIZE = 2000000; // 2MB
57
55
  export const MPUSH_VIDEO_SIZE = 209715200; // 200MB (200 * 1024 * 1024)
@@ -75,16 +73,6 @@ export const LINK_TYPE_OPTIONS = [
75
73
  { label: 'External Link', value: EXTERNAL_LINK },
76
74
  ];
77
75
 
78
- // "When tapped, open" dropdown value for opening the app (no link); the other values are DEEP_LINK / EXTERNAL_LINK
79
- export const TAP_ACTION_APP = 'APP';
80
-
81
- // "When tapped, open" options; labelKey is the messages.js key
82
- export const TAP_ACTION_OPTIONS = [
83
- { labelKey: 'tapActionApp', value: TAP_ACTION_APP },
84
- { labelKey: 'tapActionDeepLink', value: DEEP_LINK },
85
- { labelKey: 'tapActionExternalLink', value: EXTERNAL_LINK },
86
- ];
87
-
88
76
  export const EXTERNAL_LINK_LOWERCASE = 'external link';
89
77
  export const PRIMARY = 'PRIMARY';
90
78
  export const SECONDARY = 'SECONDARY';
@@ -1,7 +1,7 @@
1
1
  import { renderHook, act } from '@testing-library/react';
2
2
  import usePlatformSync from '../usePlatformSync';
3
3
  import {
4
- ANDROID, GIF, IMAGE, IOS, VIDEO, DEEP_LINK, EXTERNAL_LINK, TAP_ACTION_APP,
4
+ ANDROID, GIF, IMAGE, IOS, VIDEO,
5
5
  } from '../../constants';
6
6
  import { NONE } from '../../../Whatsapp/constants';
7
7
 
@@ -979,68 +979,6 @@ describe('usePlatformSync Hook', () => {
979
979
  });
980
980
  });
981
981
 
982
- describe('handleTapActionChange', () => {
983
- it('turns the tap action on with External link in one update', () => {
984
- const { result } = renderHook(() => usePlatformSync(defaultProps));
985
-
986
- act(() => {
987
- result.current.handleTapActionChange(ANDROID, EXTERNAL_LINK);
988
- });
989
-
990
- expect(mockSetAndroidContent).toHaveBeenCalledTimes(1);
991
- expect(mockSetAndroidContent).toHaveBeenCalledWith(expect.objectContaining({
992
- actionOnClick: true,
993
- linkType: EXTERNAL_LINK,
994
- deepLinkValue: '',
995
- externalLinkValue: '',
996
- }));
997
- expect(mockSetIosContent).not.toHaveBeenCalled();
998
- });
999
-
1000
- it('turns the tap action off and resets the link for App', () => {
1001
- const props = {
1002
- ...defaultProps,
1003
- iosContent: {
1004
- ...defaultIosContent, actionOnClick: true, linkType: EXTERNAL_LINK, externalLinkValue: 'https://x.com',
1005
- },
1006
- };
1007
- const { result } = renderHook(() => usePlatformSync(props));
1008
-
1009
- act(() => {
1010
- result.current.handleTapActionChange(IOS, TAP_ACTION_APP);
1011
- });
1012
-
1013
- expect(mockSetIosContent).toHaveBeenCalledWith(expect.objectContaining({
1014
- actionOnClick: false,
1015
- linkType: DEEP_LINK,
1016
- externalLinkValue: '',
1017
- }));
1018
- });
1019
-
1020
- it('does nothing when the same option is chosen again', () => {
1021
- const { result } = renderHook(() => usePlatformSync(defaultProps));
1022
-
1023
- act(() => {
1024
- result.current.handleTapActionChange(ANDROID, TAP_ACTION_APP);
1025
- });
1026
-
1027
- expect(mockSetAndroidContent).not.toHaveBeenCalled();
1028
- });
1029
-
1030
- it('syncs to the other platform when sync is enabled', () => {
1031
- const { result } = renderHook(() => usePlatformSync({ ...defaultProps, sameContent: true }));
1032
-
1033
- act(() => {
1034
- result.current.handleTapActionChange(ANDROID, DEEP_LINK);
1035
- });
1036
-
1037
- expect(mockSetIosContent).toHaveBeenCalledWith(expect.objectContaining({
1038
- actionOnClick: true,
1039
- linkType: DEEP_LINK,
1040
- }));
1041
- });
1042
- });
1043
-
1044
982
  describe('handleLinkTypeChange', () => {
1045
983
  it('should update Android linkType when sync is disabled', () => {
1046
984
  const { result } = renderHook(() => usePlatformSync(defaultProps));
@@ -602,32 +602,6 @@ describe('useUpload Hook', () => {
602
602
  });
603
603
  });
604
604
 
605
- it('should clear only the iOS image when re-upload handlers kept from the ticked render run after untick', () => {
606
- const { result, rerender } = renderHook(
607
- ({ sameContent }) => useUpload(
608
- mockMobilePushActions, {}, {}, {}, false, sameContent,
609
- mockSetAndroidContent, mockSetIosContent, IOS, androidContent, iosContent, mockFormatMessage,
610
- ),
611
- { initialProps: { sameContent: true } },
612
- );
613
- // Handlers as the uploader keeps them from its first render
614
- const { setUpdateMpushImageSrc, updateOnMpushImageReUpload } = result.current;
615
-
616
- act(() => {
617
- setUpdateMpushImageSrc('img.png', 1);
618
- });
619
- rerender({ sameContent: false });
620
- act(() => {
621
- setUpdateMpushImageSrc('', 1);
622
- updateOnMpushImageReUpload();
623
- });
624
-
625
- expect(result.current.imageSrc).toEqual({
626
- androidImageSrc: 'img.png',
627
- iosImageSrc: '',
628
- });
629
- });
630
-
631
605
  it('should handle image source update with sync enabled', () => {
632
606
  const { result } = createHook({ sameContent: true });
633
607
 
@@ -1147,19 +1121,6 @@ describe('useUpload Hook', () => {
1147
1121
  });
1148
1122
  });
1149
1123
 
1150
- it('clears the platform it is given, not the visible tab', () => {
1151
- const { result } = createHook({ sameContent: false, activeTab: ANDROID });
1152
- act(() => {
1153
- result.current.setImageSrc({ androidImageSrc: 'a.jpg', iosImageSrc: 'b.jpg' });
1154
- });
1155
-
1156
- act(() => {
1157
- result.current.clearImageDataByMediaType(IMAGE, IOS);
1158
- });
1159
-
1160
- expect(result.current.imageSrc).toEqual({ androidImageSrc: 'a.jpg', iosImageSrc: '' });
1161
- });
1162
-
1163
1124
  it('should clear video data with sync enabled', () => {
1164
1125
  const { result } = createHook({ sameContent: true });
1165
1126
 
@@ -1495,43 +1456,4 @@ describe('useUpload Hook', () => {
1495
1456
  });
1496
1457
  });
1497
1458
  });
1498
-
1499
- describe('Ticking same content', () => {
1500
- // Android has image A, iOS has video V; then tick on the given tab
1501
- const renderAndTick = (activeTab) => {
1502
- const hook = renderHook(({ sameContent }) => useUpload(
1503
- mockMobilePushActions, {}, {}, {}, false, sameContent,
1504
- mockSetAndroidContent, mockSetIosContent, activeTab, androidContent, iosContent, mockFormatMessage,
1505
- ), { initialProps: { sameContent: false } });
1506
- act(() => {
1507
- hook.result.current.setImageSrc({ androidImageSrc: 'A.jpg', iosImageSrc: '' });
1508
- hook.result.current.setUpdateMpushVideoSrc(1, { videoSrc: 'V.mp4', previewUrl: 'V.jpg', videoDuration: 5 });
1509
- });
1510
- hook.rerender({ sameContent: true });
1511
- return hook.result;
1512
- };
1513
-
1514
- it('wipes the iOS video when ticked on Android, which has none', () => {
1515
- const result = renderAndTick(ANDROID);
1516
- expect(result.current.videoState).toEqual({
1517
- androidVideoSrc: '',
1518
- iosVideoSrc: '',
1519
- androidVideoPreview: '',
1520
- iosVideoPreview: '',
1521
- androidVideoDuration: 0,
1522
- iosVideoDuration: 0,
1523
- });
1524
- expect(result.current.iosAssetList).toEqual([]);
1525
- expect(result.current.imageSrc).toEqual({ androidImageSrc: 'A.jpg', iosImageSrc: 'A.jpg' });
1526
- expect(androidContent.videoSrc).toBe('');
1527
- expect(iosContent.videoSrc).toBe('');
1528
- });
1529
-
1530
- it('wipes the Android image when ticked on iOS, which has none', () => {
1531
- const result = renderAndTick(IOS);
1532
- expect(result.current.imageSrc).toEqual({ androidImageSrc: '', iosImageSrc: '' });
1533
- expect(result.current.videoState.androidVideoSrc).toBe('V.mp4');
1534
- expect(result.current.androidAssetList).toMatchObject({ videoSrc: 'V.mp4' });
1535
- });
1536
- });
1537
1459
  });