@capillarytech/creatives-library 9.1.8-alpha.sprint-cap-214249.38 → 9.2.0

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 (127) hide show
  1. package/constants/unified.js +4 -0
  2. package/index.js +13 -0
  3. package/package.json +1 -1
  4. package/services/getSchema.js +4 -1
  5. package/services/tests/getSchema.test.js +2 -2
  6. package/translations/en.json +1 -0
  7. package/translations/ja-JP.json +1 -0
  8. package/translations/zh.json +1 -0
  9. package/utils/common.js +6 -0
  10. package/utils/createMobilePushPayload.js +33 -47
  11. package/utils/tagValidations.js +35 -4
  12. package/utils/templateVarUtils.js +49 -0
  13. package/utils/tests/createMobilePushPayload.test.js +8 -102
  14. package/utils/tests/tagValidations.test.js +48 -0
  15. package/utils/tests/templateVarUtils.test.js +89 -0
  16. package/v2Components/CapMpushCTA/index.js +9 -10
  17. package/v2Components/CapMpushCTA/index.scss +3 -29
  18. package/v2Components/CapTagList/TagFallbackPanel.js +124 -0
  19. package/v2Components/CapTagList/constants.js +5 -0
  20. package/v2Components/CapTagList/index.js +46 -7
  21. package/v2Components/CapTagList/messages.js +44 -0
  22. package/v2Components/CapTagList/style.scss +113 -1
  23. package/v2Components/CapTagList/tests/TagFallback.test.js +222 -0
  24. package/v2Components/CapTagList/utils.js +17 -0
  25. package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +13 -26
  26. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -13
  27. package/v2Components/CommonTestAndPreview/constants.js +3 -2
  28. package/v2Components/CommonTestAndPreview/index.js +62 -62
  29. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/MobilePushPreviewContent.test.js +5 -79
  30. package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -86
  31. package/v2Components/CommonTestAndPreview/tests/utils.test.js +102 -0
  32. package/v2Components/CommonTestAndPreview/utils.js +42 -3
  33. package/v2Components/FormBuilder/Classic.js +24 -14
  34. package/v2Components/FormBuilder/Functional/channels/mobilepush/config.js +1 -0
  35. package/v2Components/FormBuilder/Functional/channels/mobilepush/getEditorErrorDescriptor.js +1 -1
  36. package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/validate.test.js +57 -0
  37. package/v2Components/FormBuilder/Functional/channels/mobilepush/validate.js +4 -4
  38. package/v2Components/FormBuilder/Functional/channels/sms/getEditorErrorDescriptor.js +3 -0
  39. package/v2Components/FormBuilder/Functional/channels/sms/tests/getEditorErrorDescriptor.test.js +5 -0
  40. package/v2Components/FormBuilder/Functional/channels/sms/tests/validate.test.js +6 -0
  41. package/v2Components/FormBuilder/Functional/channels/sms/validate.js +3 -1
  42. package/v2Components/FormBuilder/Functional/renderers/mpushRenderers.js +3 -0
  43. package/v2Components/FormBuilder/Functional/tests/manual.typingPerf.test.js +135 -0
  44. package/v2Components/FormBuilder/Functional/tests/mpush.crossFlowParity.test.js +1 -1
  45. package/v2Components/FormBuilder/Functional/tests/mpush.ctaFlows.parity.test.js +320 -0
  46. package/v2Components/FormBuilder/Functional/tests/mpush.editContainer.parity.test.js +148 -0
  47. package/v2Components/FormBuilder/Functional/tests/mpush.libraryValidity.parity.test.js +152 -0
  48. package/v2Components/FormBuilder/Functional/tests/mpush.shellEvents.test.js +1 -1
  49. package/v2Components/FormBuilder/Functional/tests/mpush.singlePlatform.test.js +1 -1
  50. package/v2Components/FormBuilder/Functional/tests/mpushRenderers.test.js +22 -0
  51. package/v2Components/FormBuilder/tests/mpush.characterization.test.js +2 -2
  52. package/v2Components/TemplatePreview/_templatePreview.scss +2 -12
  53. package/v2Components/TemplatePreview/index.js +17 -30
  54. package/v2Components/TemplatePreview/tests/index.test.js +0 -61
  55. package/v2Containers/Cap/index.js +3 -0
  56. package/v2Containers/Cap/messages.js +4 -0
  57. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +1 -0
  58. package/v2Containers/CreativesContainer/SlideBoxContent.js +151 -70
  59. package/v2Containers/CreativesContainer/index.js +6 -3
  60. package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +0 -29
  61. package/v2Containers/InApp/index.js +4 -1
  62. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -0
  63. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -0
  64. package/v2Containers/Line/Container/Text/index.js +3 -1
  65. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +16 -0
  66. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +18 -0
  67. package/v2Containers/MobilePush/Create/_mobilePushCreate.scss +70 -0
  68. package/v2Containers/MobilePush/Create/actions.js +52 -0
  69. package/v2Containers/MobilePush/Create/constants.js +26 -0
  70. package/v2Containers/MobilePush/Create/index.js +2149 -0
  71. package/v2Containers/MobilePush/Create/messages.js +349 -0
  72. package/v2Containers/MobilePush/Create/reducer.js +72 -0
  73. package/v2Containers/MobilePush/Create/sagas.js +79 -0
  74. package/v2Containers/MobilePush/Create/selectors.js +29 -0
  75. package/v2Containers/MobilePush/Create/test/contentValidity.test.js +154 -0
  76. package/v2Containers/MobilePush/Create/test/saga.test.js +19 -0
  77. package/v2Containers/MobilePush/Create/test/stayOpenOnSave.test.js +80 -0
  78. package/v2Containers/MobilePush/Edit/_mobilePushCreate.scss +65 -0
  79. package/v2Containers/MobilePush/Edit/actions.js +94 -0
  80. package/v2Containers/MobilePush/Edit/constants.js +37 -0
  81. package/v2Containers/MobilePush/Edit/index.js +2407 -0
  82. package/v2Containers/MobilePush/Edit/messages.js +341 -0
  83. package/v2Containers/MobilePush/Edit/reducer.js +113 -0
  84. package/v2Containers/MobilePush/Edit/sagas.js +113 -0
  85. package/v2Containers/MobilePush/Edit/selectors.js +33 -0
  86. package/v2Containers/MobilePush/Edit/test/contentValidity.test.js +149 -0
  87. package/v2Containers/MobilePush/Edit/test/saga.test.js +255 -0
  88. package/v2Containers/MobilePush/Edit/test/stayOpenOnSave.test.js +60 -0
  89. package/v2Containers/MobilePush/commonMethods.js +333 -0
  90. package/v2Containers/MobilePush/eventsMap.js +130 -0
  91. package/v2Containers/MobilePush/tests/commonMethods.test.js +401 -0
  92. package/v2Containers/MobilePushNew/components/CtaButtons.js +47 -52
  93. package/v2Containers/MobilePushNew/components/MediaUploaders.js +192 -207
  94. package/v2Containers/MobilePushNew/components/PlatformContentFields.js +121 -116
  95. package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +208 -30
  96. package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +72 -316
  97. package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +16 -45
  98. package/v2Containers/MobilePushNew/constants.js +0 -5
  99. package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +1 -63
  100. package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +0 -52
  101. package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +1 -38
  102. package/v2Containers/MobilePushNew/hooks/useUpload.js +39 -29
  103. package/v2Containers/MobilePushNew/index.js +192 -454
  104. package/v2Containers/MobilePushNew/index.scss +4 -188
  105. package/v2Containers/MobilePushNew/messages.js +6 -86
  106. package/v2Containers/MobilePushNew/tests/index.test.js +1 -450
  107. package/v2Containers/MobilePushNew/tests/utils.test.js +0 -25
  108. package/v2Containers/MobilePushNew/utils.js +0 -8
  109. package/v2Containers/MobilepushWrapper/_mobilepushWrapper.scss +22 -0
  110. package/v2Containers/MobilepushWrapper/index.js +178 -0
  111. package/v2Containers/MobilepushWrapper/messages.js +29 -0
  112. package/v2Containers/Rcs/index.js +8 -1
  113. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +59 -0
  114. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +4 -0
  115. package/v2Containers/SmsTrai/Edit/index.js +17 -7
  116. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +42 -0
  117. package/v2Containers/Templates/_templates.scss +2 -10
  118. package/v2Containers/Templates/index.js +90 -84
  119. package/v2Containers/Templates/tests/index.test.js +0 -68
  120. package/v2Containers/Viber/index.js +3 -1
  121. package/v2Containers/WebPush/Create/utils/validation.js +6 -0
  122. package/v2Containers/WebPush/Create/utils/validation.test.js +50 -0
  123. package/v2Containers/Whatsapp/index.js +9 -5
  124. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +2 -2
  125. package/v2Containers/Zalo/index.js +4 -1
  126. package/v2Components/CapMpushCTA/tests/index.test.js +0 -89
  127. /package/{v2Components/FormBuilder/Functional/tests/fixtures/mpushInitialSchema.js → v2Containers/MobilePush/initialSchema.js} +0 -0
@@ -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));
@@ -1121,19 +1121,6 @@ describe('useUpload Hook', () => {
1121
1121
  });
1122
1122
  });
1123
1123
 
1124
- it('clears the platform it is given, not the visible tab', () => {
1125
- const { result } = createHook({ sameContent: false, activeTab: ANDROID });
1126
- act(() => {
1127
- result.current.setImageSrc({ androidImageSrc: 'a.jpg', iosImageSrc: 'b.jpg' });
1128
- });
1129
-
1130
- act(() => {
1131
- result.current.clearImageDataByMediaType(IMAGE, IOS);
1132
- });
1133
-
1134
- expect(result.current.imageSrc).toEqual({ androidImageSrc: 'a.jpg', iosImageSrc: '' });
1135
- });
1136
-
1137
1124
  it('should clear video data with sync enabled', () => {
1138
1125
  const { result } = createHook({ sameContent: true });
1139
1126
 
@@ -1469,43 +1456,4 @@ describe('useUpload Hook', () => {
1469
1456
  });
1470
1457
  });
1471
1458
  });
1472
-
1473
- describe('Ticking same content', () => {
1474
- // Android has image A, iOS has video V; then tick on the given tab
1475
- const renderAndTick = (activeTab) => {
1476
- const hook = renderHook(({ sameContent }) => useUpload(
1477
- mockMobilePushActions, {}, {}, {}, false, sameContent,
1478
- mockSetAndroidContent, mockSetIosContent, activeTab, androidContent, iosContent, mockFormatMessage,
1479
- ), { initialProps: { sameContent: false } });
1480
- act(() => {
1481
- hook.result.current.setImageSrc({ androidImageSrc: 'A.jpg', iosImageSrc: '' });
1482
- hook.result.current.setUpdateMpushVideoSrc(1, { videoSrc: 'V.mp4', previewUrl: 'V.jpg', videoDuration: 5 });
1483
- });
1484
- hook.rerender({ sameContent: true });
1485
- return hook.result;
1486
- };
1487
-
1488
- it('wipes the iOS video when ticked on Android, which has none', () => {
1489
- const result = renderAndTick(ANDROID);
1490
- expect(result.current.videoState).toEqual({
1491
- androidVideoSrc: '',
1492
- iosVideoSrc: '',
1493
- androidVideoPreview: '',
1494
- iosVideoPreview: '',
1495
- androidVideoDuration: 0,
1496
- iosVideoDuration: 0,
1497
- });
1498
- expect(result.current.iosAssetList).toEqual([]);
1499
- expect(result.current.imageSrc).toEqual({ androidImageSrc: 'A.jpg', iosImageSrc: 'A.jpg' });
1500
- expect(androidContent.videoSrc).toBe('');
1501
- expect(iosContent.videoSrc).toBe('');
1502
- });
1503
-
1504
- it('wipes the Android image when ticked on iOS, which has none', () => {
1505
- const result = renderAndTick(IOS);
1506
- expect(result.current.imageSrc).toEqual({ androidImageSrc: '', iosImageSrc: '' });
1507
- expect(result.current.videoState.androidVideoSrc).toBe('V.mp4');
1508
- expect(result.current.androidAssetList).toMatchObject({ videoSrc: 'V.mp4' });
1509
- });
1510
- });
1511
1459
  });
@@ -1,7 +1,7 @@
1
1
  // eslint-disable-next-line jsx-a11y/href-no-hash
2
2
  import { useCallback, useEffect, useRef } from 'react';
3
3
  import {
4
- ANDROID, DEEP_LINK, GIF, IMAGE, IOS, VIDEO, TAP_ACTION_APP,
4
+ ANDROID, DEEP_LINK, GIF, IMAGE, IOS, VIDEO,
5
5
  } from '../constants';
6
6
  import { NONE } from '../../Whatsapp/constants';
7
7
 
@@ -353,42 +353,6 @@ const usePlatformSync = ({
353
353
  }
354
354
  }, [androidContent, iosContent, setAndroidContent, setIosContent, sameContent, deepSyncContent]);
355
355
 
356
- // "When tapped, open" dropdown: TAP_ACTION_APP turns the tap action off, DEEP_LINK / EXTERNAL_LINK
357
- // turn it on with that link type. One update, so actionOnClick and linkType can't overwrite each other.
358
- const handleTapActionChange = useCallback((platform, value) => {
359
- const {
360
- setContent,
361
- otherSetContent,
362
- otherContent,
363
- currentContent,
364
- targetPlatform,
365
- } = getPlatformContent(platform, {
366
- androidContent,
367
- iosContent,
368
- setAndroidContent,
369
- setIosContent,
370
- });
371
-
372
- const isApp = value === TAP_ACTION_APP;
373
- const currentValue = currentContent?.actionOnClick ? (currentContent?.linkType || DEEP_LINK) : TAP_ACTION_APP;
374
- if (value === currentValue) return;
375
-
376
- const newContent = {
377
- ...currentContent,
378
- actionOnClick: !isApp,
379
- linkType: isApp ? DEEP_LINK : value,
380
- deepLinkValue: "",
381
- deepLinkKeysValue: [],
382
- externalLinkValue: "",
383
- };
384
- setContent(newContent);
385
-
386
- if (sameContent) {
387
- const synced = deepSyncContent(newContent, otherContent, targetPlatform);
388
- otherSetContent(synced);
389
- }
390
- }, [androidContent, iosContent, setAndroidContent, setIosContent, sameContent, deepSyncContent]);
391
-
392
356
  return {
393
357
  handleTitleChange,
394
358
  handleMessageChange,
@@ -397,7 +361,6 @@ const usePlatformSync = ({
397
361
  handleButtonChange,
398
362
  handleActionOnClickChange,
399
363
  handleLinkTypeChange,
400
- handleTapActionChange,
401
364
  };
402
365
  };
403
366
 
@@ -148,9 +148,8 @@ const useUpload = (mobilePushActions, editData = {}, _uploadedAssetData0 = {}, _
148
148
  mobilePushActions.uploadAsset(file, assetType, fileParams, activeTab === ANDROID ? 0 : 1, mobilePushParams);
149
149
  }, [mobilePushActions, validateImageFile, validateVideoFile, validateGifFile, activeTab]);
150
150
 
151
- // Clear media data when switching media types.
152
- // platform: the tab whose media changed (defaults to the visible tab).
153
- const clearImageDataByMediaType = useCallback((mediaType, platform = activeTab) => {
151
+ // Clear media data when switching media types
152
+ const clearImageDataByMediaType = useCallback((mediaType) => {
154
153
  if (mediaType === IMAGE) {
155
154
  if (sameContent) {
156
155
  // When sync is enabled, clear both platforms
@@ -159,11 +158,11 @@ const useUpload = (mobilePushActions, editData = {}, _uploadedAssetData0 = {}, _
159
158
  iosImageSrc: "",
160
159
  });
161
160
  } else {
162
- // When sync is disabled, only clear that platform
163
- const platformKey = platform === ANDROID ? 'androidImageSrc' : 'iosImageSrc';
161
+ // When sync is disabled, only clear the current platform
162
+ const platform = activeTab === ANDROID ? 'androidImageSrc' : 'iosImageSrc';
164
163
  setImageSrc((prevState) => ({
165
164
  ...prevState,
166
- [platformKey]: "",
165
+ [platform]: "",
167
166
  }));
168
167
  }
169
168
  } else if (mediaType === VIDEO || mediaType === GIF) {
@@ -197,9 +196,9 @@ const useUpload = (mobilePushActions, editData = {}, _uploadedAssetData0 = {}, _
197
196
  mobilePushActions.clearAsset(0);
198
197
  mobilePushActions.clearAsset(1);
199
198
  } else {
200
- // When sync is disabled, only clear that platform
201
- const platformIndex = platform === ANDROID ? 0 : 1;
202
- const isAndroid = platform === ANDROID;
199
+ // When sync is disabled, only clear the current platform
200
+ const platformIndex = activeTab === ANDROID ? 0 : 1;
201
+ const isAndroid = activeTab === ANDROID;
203
202
  const videoProps = getVideoProperties(isAndroid);
204
203
 
205
204
  setVideoState((prevState) => ({
@@ -294,11 +293,17 @@ const useUpload = (mobilePushActions, editData = {}, _uploadedAssetData0 = {}, _
294
293
  }
295
294
  }, [videoState?.androidVideoSrc, videoState?.iosVideoSrc, videoState?.androidVideoPreview, videoState?.iosVideoPreview, videoState?.androidVideoDuration, videoState?.iosVideoDuration, sameContent]);
296
295
 
297
- // On tick, copy the active tab's image to both tabs, even when it has none
296
+ // Sync imageSrc state for both platforms when sameContent is toggled ON
298
297
  useEffect(() => {
299
298
  if (sameContent) {
300
- const currentImageSrc = (activeTab === ANDROID ? imageSrc?.androidImageSrc : imageSrc?.iosImageSrc) || '';
301
- if (imageSrc?.androidImageSrc !== currentImageSrc || imageSrc?.iosImageSrc !== currentImageSrc) {
299
+ // Determine which image to use (prefer activeTab, fallback to either)
300
+ let currentImageSrc = '';
301
+ if (activeTab === ANDROID) {
302
+ currentImageSrc = imageSrc?.androidImageSrc || imageSrc?.iosImageSrc;
303
+ } else {
304
+ currentImageSrc = imageSrc?.iosImageSrc || imageSrc?.androidImageSrc;
305
+ }
306
+ if (currentImageSrc && (imageSrc?.androidImageSrc !== currentImageSrc || imageSrc?.iosImageSrc !== currentImageSrc)) {
302
307
  setImageSrc({
303
308
  androidImageSrc: currentImageSrc,
304
309
  iosImageSrc: currentImageSrc,
@@ -309,20 +314,31 @@ const useUpload = (mobilePushActions, editData = {}, _uploadedAssetData0 = {}, _
309
314
  // eslint-disable-next-line react-hooks/exhaustive-deps
310
315
  }, [sameContent, activeTab]);
311
316
 
312
- // On tick, copy the active tab's video to both tabs, even when it has none
317
+ // Sync videoState for both platforms when sameContent is toggled ON
313
318
  useEffect(() => {
314
319
  if (sameContent) {
315
- const isAndroid = activeTab === ANDROID;
316
- const currentVideoSrc = (isAndroid ? videoState?.androidVideoSrc : videoState?.iosVideoSrc) || '';
317
- const currentVideoPreview = (isAndroid ? videoState?.androidVideoPreview : videoState?.iosVideoPreview) || '';
318
- const currentVideoDuration = (isAndroid ? videoState?.androidVideoDuration : videoState?.iosVideoDuration) || 0;
320
+ // Determine which video to use (prefer activeTab, fallback to either)
321
+ let currentVideoSrc = '';
322
+ let currentVideoPreview = '';
323
+ let currentVideoDuration = 0;
324
+ if (activeTab === ANDROID) {
325
+ currentVideoSrc = videoState?.androidVideoSrc || videoState?.iosVideoSrc;
326
+ currentVideoPreview = videoState?.androidVideoPreview || videoState?.iosVideoPreview;
327
+ currentVideoDuration = videoState?.androidVideoDuration || videoState?.iosVideoDuration;
328
+ } else {
329
+ currentVideoSrc = videoState?.iosVideoSrc || videoState?.androidVideoSrc;
330
+ currentVideoPreview = videoState?.iosVideoPreview || videoState?.androidVideoPreview;
331
+ currentVideoDuration = videoState?.iosVideoDuration || videoState?.androidVideoDuration;
332
+ }
319
333
  if (
320
- videoState?.androidVideoSrc !== currentVideoSrc
321
- || videoState?.iosVideoSrc !== currentVideoSrc
322
- || videoState?.androidVideoPreview !== currentVideoPreview
323
- || videoState?.iosVideoPreview !== currentVideoPreview
324
- || videoState?.androidVideoDuration !== currentVideoDuration
325
- || videoState?.iosVideoDuration !== currentVideoDuration
334
+ currentVideoSrc && (
335
+ videoState?.androidVideoSrc !== currentVideoSrc
336
+ || videoState?.iosVideoSrc !== currentVideoSrc
337
+ || videoState?.androidVideoPreview !== currentVideoPreview
338
+ || videoState?.iosVideoPreview !== currentVideoPreview
339
+ || videoState?.androidVideoDuration !== currentVideoDuration
340
+ || videoState?.iosVideoDuration !== currentVideoDuration
341
+ )
326
342
  ) {
327
343
  setVideoState({
328
344
  androidVideoSrc: currentVideoSrc,
@@ -333,12 +349,6 @@ const useUpload = (mobilePushActions, editData = {}, _uploadedAssetData0 = {}, _
333
349
  iosVideoDuration: currentVideoDuration,
334
350
  });
335
351
  }
336
- // The upload box also reads the uploaded-file list
337
- const sourceAssetList = isAndroid ? androidAssetList : iosAssetList;
338
- const targetAssetList = isAndroid ? iosAssetList : androidAssetList;
339
- if (JSON.stringify(sourceAssetList) !== JSON.stringify(targetAssetList)) {
340
- (isAndroid ? updateIosAssetList : updateAndroidAssetList)(sourceAssetList);
341
- }
342
352
  }
343
353
  // Only run when sameContent or activeTab changes
344
354
  // eslint-disable-next-line react-hooks/exhaustive-deps