@capillarytech/creatives-library 8.0.176 → 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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.176",
4
+ "version": "8.0.178-alpha.0",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -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
- const onButtonTagSelect = useCallback(
573
- (value) => {
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: 48%;
159
+ margin-right: 43%;
155
160
  }
156
161
 
157
162
  .helper-text {
@@ -60,8 +60,8 @@ export const GET_ORG_LEVEL_CAMPAIGN_SETTINGS_SUCCESS =
60
60
  export const GET_ORG_LEVEL_CAMPAIGN_SETTINGS_FAILURE =
61
61
  'app/v2Containers/Templates/GET_ORG_LEVEL_CAMPAIGN_SETTINGS_FAILURE';
62
62
 
63
- export const MAX_WHATSAPP_TEMPLATES = 1500;
64
- export const WARNING_WHATSAPP_TEMPLATES = 1400;
63
+ export const MAX_WHATSAPP_TEMPLATES = 6000;
64
+ export const WARNING_WHATSAPP_TEMPLATES = 5800;
65
65
 
66
66
  export const GET_SENDER_DETAILS_REQUEST =
67
67
  'app/v2Containers/Templates/GET_SENDER_DETAILS_REQUEST';
@@ -864,20 +864,6 @@ exports[`Test Templates container Test max templates exceeded 1`] = `
864
864
  }
865
865
  type="file"
866
866
  />
867
- <CapAlert
868
- message={
869
- <FormattedMessage
870
- defaultMessage="WhatsApp allows {maxCount} approved templates. To accommodate new approved templates either delete the existing one or reach out to Capillary POC to increase the limit."
871
- id="creatives.containersV2.Templates.whatsappMaxTemplates"
872
- values={
873
- Object {
874
- "maxCount": 1500,
875
- }
876
- }
877
- />
878
- }
879
- type="info"
880
- />
881
867
  <CapRow>
882
868
  <Pagination
883
869
  onPageChange={[Function]}
@@ -1069,33 +1055,15 @@ exports[`Test Templates container Test max templates exceeded 1`] = `
1069
1055
  }
1070
1056
  }
1071
1057
  >
1072
- <CapTooltip
1073
- title={
1074
- <FormattedMessage
1075
- defaultMessage="WhatsApp allows {maxCount} approved templates. To accommodate new approved templates either delete the existing one or reach out to Capillary POC to increase the limit."
1076
- id="creatives.containersV2.Templates.whatsappMaxTemplates"
1077
- values={
1078
- Object {
1079
- "maxCount": 1500,
1080
- }
1081
- }
1082
- />
1083
- }
1058
+ <CapButton
1059
+ className="create-new-whatsapp margin-l-8 margin-b-12"
1060
+ disabled={false}
1061
+ isAddBtn={false}
1062
+ onClick={[Function]}
1063
+ type="primary"
1084
1064
  >
1085
- <div
1086
- className="button-disabled-tooltip-wrapper"
1087
- >
1088
- <CapButton
1089
- className="create-new-whatsapp margin-l-8 margin-b-12"
1090
- disabled={true}
1091
- isAddBtn={false}
1092
- onClick={[Function]}
1093
- type="primary"
1094
- >
1095
- Create new
1096
- </CapButton>
1097
- </div>
1098
- </CapTooltip>
1065
+ Create new
1066
+ </CapButton>
1099
1067
  </div>
1100
1068
  </div>
1101
1069
  <CapRow