@capillarytech/creatives-library 8.0.139-alpha.2 → 8.0.139

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.139-alpha.2",
4
+ "version": "8.0.139",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -138,7 +138,7 @@ const MediaUploaders = ({
138
138
  // Move updateCarouselCard to top level so useEffect can access it
139
139
  const updateCarouselCard = useCallback((index, fields) => {
140
140
  const currentData = getCurrentCarouselData();
141
- setCurrentCarouselData(currentData.map((card, i) => (
141
+ setCurrentCarouselData(currentData?.map((card, i) => (
142
142
  i === index ? { ...card, ...fields } : card
143
143
  )));
144
144
  }, [getCurrentCarouselData, setCurrentCarouselData]);
@@ -513,10 +513,9 @@ const MediaUploaders = ({
513
513
  imageSrc={imageSource}
514
514
  updateImageSrc={(src) => {
515
515
  // For gallery uploads (direct URL), update immediately
516
- if (src && (src.includes('http') || src.includes('https'))) {
516
+ if (src && src?.includes('http')) {
517
517
  handleCarouselImageChange(src, cardIndex);
518
- }
519
-
518
+ }
520
519
  // Always call setUpdateMpushImageSrc for Redux state management
521
520
  setUpdateMpushImageSrc(src, activeTab === ANDROID ? 0 : 1, CAROUSEL);
522
521
  }}
@@ -849,14 +848,14 @@ const MediaUploaders = ({
849
848
  const platformIndex = activeTab === ANDROID ? 0 : 1;
850
849
  const uploadedData = imageData[`uploadedAssetData${platformIndex}`];
851
850
 
852
- if (uploadedData && uploadedData.metaInfo && uploadedData.metaInfo.secure_file_path) {
851
+ if (uploadedData?.metaInfo?.secure_file_path) {
853
852
  // Check if this is new upload data (different from what we processed last time)
854
853
  const currentDataKey = `${uploadedData.metaInfo.secure_file_path}_${uploadedData.metaInfo.file_name || ''}`;
855
854
  const previousDataKey = previousUploadDataRef.current;
856
855
 
857
856
  if (currentDataKey !== previousDataKey) {
858
857
  // Update the specific card that was uploading
859
- updateCarouselCard(uploadingCardIndex, { imageUrl: uploadedData.metaInfo.secure_file_path });
858
+ updateCarouselCard(uploadingCardIndex, { imageUrl: uploadedData?.metaInfo?.secure_file_path });
860
859
 
861
860
  // Store this upload data as "processed" to avoid reprocessing
862
861
  previousUploadDataRef.current = currentDataKey;
@@ -152,7 +152,7 @@ const processMediaType = (contentType, expandableDetails) => {
152
152
  if (expandableStyle === BIG_PICTURE) {
153
153
  mediaType = IMAGE;
154
154
  imageSrc = expandableDetails?.image || contentType?.image;
155
- } else if (expandableStyle === MANUAL_CAROUSEL || expandableStyle === AUTO_CAROUSEL || expandableStyle === FILMSTRIP_CAROUSEL || expandableStyle === CAROUSEL) {
155
+ } else if ([MANUAL_CAROUSEL, AUTO_CAROUSEL, FILMSTRIP_CAROUSEL, CAROUSEL].includes(expandableStyle)) {
156
156
  mediaType = CAROUSEL;
157
157
  // Extract carousel data from expandableDetails
158
158
  carouselData = expandableCarouselData || [];
@@ -165,7 +165,7 @@ const processMediaType = (contentType, expandableDetails) => {
165
165
  if (expandableMedia?.length > 0) {
166
166
  const mediaItem = expandableMedia[0];
167
167
  const { type, url, videoPreviewUrl } = mediaItem || {};
168
-
168
+
169
169
  if (type === VIDEO) {
170
170
  // Enhanced GIF detection with robust URL validation
171
171
  const isGif = (() => {
@@ -174,7 +174,7 @@ const processMediaType = (contentType, expandableDetails) => {
174
174
  if (!trimmedUrl) return false;
175
175
  return trimmedUrl.toLowerCase().includes('.gif');
176
176
  })();
177
-
177
+
178
178
  if (isGif) {
179
179
  mediaType = GIF;
180
180
  } else {
@@ -191,7 +191,7 @@ const processMediaType = (contentType, expandableDetails) => {
191
191
 
192
192
  // PRIORITY 3: Check mediaTypeFromStyle (from expandable details)
193
193
  // This provides media type information from the expandable details structure
194
- if (mediaTypeFromStyle === VIDEO || mediaTypeFromStyle === GIF || mediaTypeFromStyle === CAROUSEL || mediaTypeFromStyle === IMAGE) {
194
+ if ([VIDEO, GIF, CAROUSEL, IMAGE].includes(mediaTypeFromStyle)) {
195
195
  mediaType = mediaTypeFromStyle;
196
196
  // If mediaType from style is CAROUSEL, also check for carousel data
197
197
  if (mediaTypeFromStyle === CAROUSEL && expandableCarouselData?.length > 0) {
@@ -201,7 +201,7 @@ const processMediaType = (contentType, expandableDetails) => {
201
201
 
202
202
  // PRIORITY 4: Check mediaTypeFromRoot (from root content type)
203
203
  // This provides media type information from the root content structure
204
- if (mediaTypeFromRoot === VIDEO || mediaTypeFromRoot === GIF || mediaTypeFromRoot === CAROUSEL || mediaTypeFromRoot === IMAGE) {
204
+ if ([VIDEO, GIF, CAROUSEL, IMAGE].includes(mediaTypeFromRoot)) {
205
205
  mediaType = mediaTypeFromRoot;
206
206
  // If mediaType from root is CAROUSEL, also check for carousel data
207
207
  if (mediaTypeFromRoot === CAROUSEL && expandableCarouselData?.length > 0) {
@@ -211,7 +211,7 @@ const processMediaType = (contentType, expandableDetails) => {
211
211
 
212
212
  // PRIORITY 5: Check rootType (lowest priority)
213
213
  // This is the basic type from the root content type
214
- if (rootType === VIDEO || rootType === GIF || rootType === CAROUSEL) {
214
+ if ([VIDEO, GIF, CAROUSEL].includes(rootType)) {
215
215
  mediaType = rootType;
216
216
  // If root type is CAROUSEL, also check for carousel data
217
217
  if (rootType === CAROUSEL && expandableCarouselData?.length > 0) {
@@ -301,7 +301,7 @@ const createContentData = (contentType, mediaInfo, buttons, deepLink, processCar
301
301
  // Otherwise, check carousel data
302
302
  if (mediaType === CAROUSEL) {
303
303
  const carouselLinkInfo = processCarouselDataForDeepLinks(carouselData);
304
- return carouselLinkInfo.deepLinkValue || carouselLinkInfo.externalLinkValue;
304
+ return carouselLinkInfo?.deepLinkValue || carouselLinkInfo?.externalLinkValue;
305
305
  }
306
306
  return false;
307
307
  })();
@@ -321,7 +321,7 @@ const createContentData = (contentType, mediaInfo, buttons, deepLink, processCar
321
321
  }
322
322
  if (mediaType === CAROUSEL) {
323
323
  const carouselLinkInfo = processCarouselDataForDeepLinks(carouselData);
324
- return carouselLinkInfo.externalLinkValue ? EXTERNAL_LINK : DEEP_LINK;
324
+ return carouselLinkInfo?.externalLinkValue ? EXTERNAL_LINK : DEEP_LINK;
325
325
  }
326
326
  return DEEP_LINK;
327
327
  })();
@@ -400,7 +400,7 @@ const createContentData = (contentType, mediaInfo, buttons, deepLink, processCar
400
400
  }
401
401
  if (mediaType === CAROUSEL) {
402
402
  const carouselLinkInfo = processCarouselDataForDeepLinks(carouselData);
403
- return carouselLinkInfo.deepLinkValue;
403
+ return carouselLinkInfo?.deepLinkValue;
404
404
  }
405
405
  return "";
406
406
  })(),
@@ -426,7 +426,7 @@ const createContentData = (contentType, mediaInfo, buttons, deepLink, processCar
426
426
  }
427
427
  if (mediaType === CAROUSEL) {
428
428
  const carouselLinkInfo = processCarouselDataForDeepLinks(carouselData);
429
- return carouselLinkInfo.deepLinkKeysValue;
429
+ return carouselLinkInfo?.deepLinkKeysValue;
430
430
  }
431
431
  return [];
432
432
  })(),
@@ -449,7 +449,7 @@ const createContentData = (contentType, mediaInfo, buttons, deepLink, processCar
449
449
  }
450
450
  if (mediaType === CAROUSEL) {
451
451
  const carouselLinkInfo = processCarouselDataForDeepLinks(carouselData);
452
- return carouselLinkInfo.externalLinkValue;
452
+ return carouselLinkInfo?.externalLinkValue;
453
453
  }
454
454
  return "";
455
455
  })(),
@@ -1445,13 +1445,13 @@ const MobilePushNew = ({
1445
1445
  }
1446
1446
 
1447
1447
  // Check all possible media type sources
1448
- if (iosType === VIDEO || iosType === GIF || iosType === CAROUSEL) {
1448
+ if ([VIDEO, GIF, CAROUSEL].includes(iosType)) {
1449
1449
  iosMediaType = iosType;
1450
1450
  }
1451
- if (iosMediaTypeFromRoot === VIDEO || iosMediaTypeFromRoot === GIF || iosMediaTypeFromRoot === CAROUSEL || iosMediaTypeFromRoot === IMAGE) {
1451
+ if ([VIDEO, GIF, CAROUSEL, IMAGE].includes(iosMediaTypeFromRoot)) {
1452
1452
  iosMediaType = iosMediaTypeFromRoot;
1453
1453
  }
1454
- if (iosMediaTypeFromStyle === VIDEO || iosMediaTypeFromStyle === GIF || iosMediaTypeFromStyle === CAROUSEL || iosMediaTypeFromStyle === IMAGE) {
1454
+ if ([VIDEO, GIF, CAROUSEL, IMAGE].includes(iosMediaTypeFromStyle)) {
1455
1455
  iosMediaType = iosMediaTypeFromStyle;
1456
1456
  }
1457
1457