@capillarytech/creatives-library 8.0.177 → 8.0.178-alpha.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.
package/package.json
CHANGED
|
@@ -149,6 +149,22 @@ const MediaUploaders = ({
|
|
|
149
149
|
)));
|
|
150
150
|
}, [getCurrentCarouselData, setCurrentCarouselData]);
|
|
151
151
|
|
|
152
|
+
// Create carousel button tag select callback at component level to avoid hooks violation
|
|
153
|
+
const createCarouselButtonTagSelectCallback = useCallback((cardIndex) => {
|
|
154
|
+
return (value) => {
|
|
155
|
+
const currentData = getCurrentCarouselData();
|
|
156
|
+
const card = currentData[cardIndex];
|
|
157
|
+
const button = card?.buttons?.[0];
|
|
158
|
+
if (button) {
|
|
159
|
+
const newUrl = `${button?.externalLinkValue}{{${value}}}`;
|
|
160
|
+
// Update carousel card directly using updateCarouselCard
|
|
161
|
+
const updatedButtons = [...card?.buttons];
|
|
162
|
+
updatedButtons[0] = { ...updatedButtons[0], externalLinkValue: newUrl };
|
|
163
|
+
updateCarouselCard(cardIndex, { buttons: updatedButtons });
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}, [getCurrentCarouselData, updateCarouselCard]);
|
|
167
|
+
|
|
152
168
|
// Clear previous media data when switching media types
|
|
153
169
|
useEffect(() => {
|
|
154
170
|
// Clear carousel data when switching to non-carousel media types
|
|
@@ -569,13 +585,8 @@ const MediaUploaders = ({
|
|
|
569
585
|
|
|
570
586
|
const button = card?.buttons[0]; // We're handling only one button for now
|
|
571
587
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
const newUrl = `${button?.externalLinkValue}{{${value}}}`;
|
|
575
|
-
handleCarouselExternalLinkChange(cardIndex, newUrl);
|
|
576
|
-
},
|
|
577
|
-
[handleCarouselExternalLinkChange, button?.externalLinkValue]
|
|
578
|
-
);
|
|
588
|
+
// Use the callback creator instead of useCallback inside render function
|
|
589
|
+
const onButtonTagSelect = createCarouselButtonTagSelectCallback(cardIndex);
|
|
579
590
|
|
|
580
591
|
return (
|
|
581
592
|
<>
|
|
@@ -647,7 +658,7 @@ const MediaUploaders = ({
|
|
|
647
658
|
)}
|
|
648
659
|
{button?.linkType === EXTERNAL_LINK && (
|
|
649
660
|
<CapColumn span={14}>
|
|
650
|
-
<CapRow>
|
|
661
|
+
<CapRow className="buttons-heading-container">
|
|
651
662
|
<CapHeading type="h4" className="buttons-heading">
|
|
652
663
|
{formatMessage(messages.externalLink)}
|
|
653
664
|
</CapHeading>
|
|
@@ -148,10 +148,15 @@
|
|
|
148
148
|
margin-bottom: $CAP_SPACE_16;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
.buttons-heading-container {
|
|
152
|
+
display: flex;
|
|
153
|
+
justify-content: space-between;
|
|
154
|
+
}
|
|
155
|
+
|
|
151
156
|
.buttons-heading {
|
|
152
157
|
margin-bottom: $CAP_SPACE_12;
|
|
153
158
|
margin-top: $CAP_SPACE_12;
|
|
154
|
-
margin-right:
|
|
159
|
+
margin-right: 43%;
|
|
155
160
|
}
|
|
156
161
|
|
|
157
162
|
.helper-text {
|