@capillarytech/creatives-library 8.0.136-beta.3 → 8.0.136

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.136-beta.3",
4
+ "version": "8.0.136",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -187,6 +187,7 @@ function buildPlatformContent(content, imageSrc, mpushVideoSrcAndPreview, platfo
187
187
  url: mpushVideoSrcAndPreview.mpushVideoSrc || (content?.mediaList?.[0]?.url || ''),
188
188
  text: content?.mediaList?.[0]?.text || '',
189
189
  type: VIDEO,
190
+ previewImg: mpushVideoSrcAndPreview.mpushVideoPreviewImg,
190
191
  }];
191
192
  templateType = VIDEO;
192
193
  } else if (style === GIF) { // Handle GIF media type
@@ -7,9 +7,6 @@ import {
7
7
  WHATSAPP,
8
8
  PUSH,
9
9
  ZALO,
10
- RCS,
11
- LINE,
12
- VIBER,
13
10
  EMF,
14
11
  VENENO,
15
12
  TEXT,
@@ -57,12 +54,6 @@ export const transformChannelPayload = (data, options = {}) => {
57
54
  return transformWhatsappPayload(data, options);
58
55
  case ZALO:
59
56
  return transformZaloPayload(data, options);
60
- case RCS:
61
- return transformRcsPayload(data, options);
62
- case LINE:
63
- return transformLinePayload(data, options);
64
- case VIBER:
65
- return transformViberPayload(data, options);
66
57
  default:
67
58
  return data; // Return unchanged for unsupported channels
68
59
  }
@@ -240,90 +231,6 @@ const transformZaloPayload = (zaloData, options = {}) => {
240
231
  return payload;
241
232
  };
242
233
 
243
- /**
244
- * Transforms RCS data to the required payload format
245
- * @param {Object} rcsData - Current RCS data
246
- * @param {Object} options - Additional options (ouId, sourceEntityId, etc.)
247
- * @returns {Object} - Transformed RCS payload
248
- */
249
- // TODO: RCS is currently not supported by the CCS - BE. We need to make changes in future as per the BE changes.
250
- const transformRcsPayload = (rcsData, options = {}) => {
251
- const { loyaltyMetaData = {} } = options;
252
- const { transformedMessageDetails = {} } = loyaltyMetaData;
253
- const { rcsDeliverySettings = {} } = transformedMessageDetails;
254
-
255
- // Get base payload structure
256
- const payload = createBasePayload(RCS, loyaltyMetaData);
257
-
258
- // Add RCS-specific properties
259
- payload.centralCommsPayload.rcsMessageContent = {
260
- channel: RCS,
261
- messageBody: "",
262
- accountId: rcsData?.accountId || "",
263
- accountName: rcsData?.accountName || "",
264
- ...rcsData,
265
- // Ensure templateConfigs is preserved (it might contain complex nested objects)
266
- templateConfigs: rcsData?.templateConfigs || {},
267
- };
268
- payload.centralCommsPayload.rcsDeliverySettings = rcsDeliverySettings || {};
269
-
270
- return payload;
271
- };
272
-
273
- /**
274
- * Transforms LINE data to the required payload format
275
- * @param {Object} lineData - Current LINE data
276
- * @param {Object} options - Additional options (ouId, sourceEntityId, etc.)
277
- * @returns {Object} - Transformed LINE payload
278
- */
279
- const transformLinePayload = (lineData, options = {}) => {
280
- const { loyaltyMetaData = {} } = options;
281
- const { transformedMessageDetails = {} } = loyaltyMetaData;
282
- const { lineDeliverySettings = {} } = transformedMessageDetails;
283
-
284
- // Get base payload structure
285
- const payload = createBasePayload(LINE, loyaltyMetaData);
286
-
287
- // Add LINE-specific properties
288
- payload.centralCommsPayload.lineMessageContent = {
289
- channel: LINE,
290
- accountId: lineData?.accountId || 0,
291
- accountDetails: lineData?.accountDetails || "",
292
- messageBody: lineData?.messageBody || "",
293
- ...lineData,
294
- };
295
- payload.centralCommsPayload.lineDeliverySettings = lineDeliverySettings || {};
296
-
297
- return payload;
298
- };
299
-
300
- /**
301
- * Transforms VIBER data to the required payload format
302
- * @param {Object} viberData - Current VIBER data
303
- * @param {Object} options - Additional options (ouId, sourceEntityId, etc.)
304
- * @returns {Object} - Transformed VIBER payload
305
- */
306
- const transformViberPayload = (viberData, options = {}) => {
307
- const { loyaltyMetaData = {} } = options;
308
- const { transformedMessageDetails = {} } = loyaltyMetaData;
309
- const { viberDeliverySettings = {} } = transformedMessageDetails;
310
-
311
- // Get base payload structure
312
- const payload = createBasePayload(VIBER, loyaltyMetaData);
313
-
314
- // Add VIBER-specific properties
315
- payload.centralCommsPayload.viberMessageContent = {
316
- channel: VIBER,
317
- accountId: viberData?.accountId || 0,
318
- accountDetails: viberData?.accountDetails || "",
319
- messageBody: viberData?.messageBody || "",
320
- ...viberData,
321
- };
322
- payload.centralCommsPayload.viberDeliverySettings = viberDeliverySettings || {};
323
-
324
- return payload;
325
- };
326
-
327
234
  // Checks if the template has changed
328
235
  export const getTemplateDiffState = (channel, oldData, newData) => {
329
236
  switch (channel.toUpperCase()) {
@@ -338,13 +245,6 @@ export const getTemplateDiffState = (channel, oldData, newData) => {
338
245
  return checkWhatsappDiff(oldData, newData);
339
246
  case ZALO:
340
247
  return checkZaloDiff(oldData, newData);
341
- case LINE:
342
- return checkLineDiff(oldData, newData);
343
- case VIBER:
344
- return checkViberDiff(oldData, newData);
345
- // TODO: RCS is currently not supported by the CCS - BE. We need to make changes in future as per the BE changes.
346
- // case RCS:
347
- // return checkRcsDiff(oldData, newData);
348
248
  default:
349
249
  return false;
350
250
  }
@@ -518,97 +418,3 @@ const checkZaloDiff = (oldData, newData) => {
518
418
  // Use deep comparison for template configs
519
419
  return !isEqual(oldTemplateConfigs, newTemplateConfigs);
520
420
  };
521
-
522
- /**
523
- * Checks differences between old and new RCS data
524
- * @param {Object} oldData - Previous RCS template data
525
- * @param {Object} newData - Updated RCS template data
526
- * @returns {Boolean} - Whether the template has changed
527
- */
528
- // TODO: RCS is currently not supported by the CCS - BE. We need to make changes in future as per the BE changes.
529
- const checkRcsDiff = (oldData, newData) => {
530
- // Extract old RCS content
531
- const oldTemplateConfigs =
532
- oldData?.transformedMessageDetails?.rcsMessageContent?.templateConfigs ||
533
- {};
534
- const oldAccountId =
535
- oldData?.transformedMessageDetails?.rcsMessageContent?.accountId || "";
536
- const oldAccountName =
537
- oldData?.transformedMessageDetails?.rcsMessageContent?.accountName || "";
538
-
539
- // Extract new RCS content
540
- const newTemplateConfigs = newData?.templateConfigs || {};
541
- const newAccountId = newData?.accountId || "";
542
- const newAccountName = newData?.accountName || "";
543
-
544
- // Compare simple properties for quick rejection
545
- if (oldAccountId !== newAccountId) return true;
546
- if (oldAccountName !== newAccountName) return true;
547
-
548
- // If template configs have different structures, they've changed
549
- if (
550
- Object.keys(newTemplateConfigs).length !==
551
- Object.keys(oldTemplateConfigs).length
552
- ) {
553
- return true;
554
- }
555
-
556
- // Use deep comparison for template configs
557
- return !isEqual(oldTemplateConfigs, newTemplateConfigs);
558
- };
559
-
560
- /**
561
- * Checks differences between old and new LINE data
562
- * @param {Object} oldData - Previous LINE template data
563
- * @param {Object} newData - Updated LINE template data
564
- * @returns {Boolean} - Whether the template has changed
565
- */
566
- const checkLineDiff = (oldData, newData) => {
567
- // Extract old LINE content
568
- const oldMessageBody =
569
- oldData?.transformedMessageDetails?.lineMessageContent?.messageBody || "";
570
- const oldAccountId =
571
- oldData?.transformedMessageDetails?.lineMessageContent?.accountId || "";
572
- const oldAccountDetails =
573
- oldData?.transformedMessageDetails?.lineMessageContent?.accountDetails || "";
574
-
575
- // Extract new LINE content
576
- const newMessageBody = newData?.messageBody || "";
577
- const newAccountId = newData?.accountId || "";
578
- const newAccountDetails = newData?.accountDetails || "";
579
-
580
- // Compare simple properties for quick rejection
581
- if (oldMessageBody !== newMessageBody) return true;
582
- if (oldAccountId !== newAccountId) return true;
583
- if (oldAccountDetails !== newAccountDetails) return true;
584
-
585
- return false;
586
- };
587
-
588
- /**
589
- * Checks differences between old and new VIBER data
590
- * @param {Object} oldData - Previous VIBER template data
591
- * @param {Object} newData - Updated VIBER template data
592
- * @returns {Boolean} - Whether the template has changed
593
- */
594
- const checkViberDiff = (oldData, newData) => {
595
- // Extract old VIBER content
596
- const oldMessageBody =
597
- oldData?.transformedMessageDetails?.viberMessageContent?.messageBody || "";
598
- const oldAccountId =
599
- oldData?.transformedMessageDetails?.viberMessageContent?.accountId || "";
600
- const oldAccountDetails =
601
- oldData?.transformedMessageDetails?.viberMessageContent?.accountDetails || "";
602
-
603
- // Extract new VIBER content
604
- const newMessageBody = newData?.messageBody || "";
605
- const newAccountId = newData?.accountId || "";
606
- const newAccountDetails = newData?.accountDetails || "";
607
-
608
- // Compare simple properties for quick rejection
609
- if (oldMessageBody !== newMessageBody) return true;
610
- if (oldAccountId !== newAccountId) return true;
611
- if (oldAccountDetails !== newAccountDetails) return true;
612
-
613
- return false;
614
- };
@@ -625,6 +625,16 @@
625
625
  object-fit: contain;
626
626
  border-radius: 0.5rem 0.5rem 0 0; // 8px
627
627
  }
628
+
629
+ // // Override FormBuilder CSS for carousel images
630
+ // .image-container {
631
+ // img {
632
+ // object-fit: cover !important;
633
+ // max-width: 18.75rem;
634
+ // max-height: 9.5rem !important;
635
+ // display: block !important;
636
+ // }
637
+ // }
628
638
 
629
639
  .carousel-video-preview {
630
640
  width: 100%;
@@ -1085,7 +1095,6 @@
1085
1095
 
1086
1096
  .MOBILEPUSH {
1087
1097
  .ant-card-body {
1088
- padding: 0;
1089
1098
  background-color: $CAP_WHITE;
1090
1099
  border-top: 1px solid $CAP_COLOR_16;
1091
1100
  .ant-card-meta {
@@ -330,10 +330,10 @@ export const LineImage = ({
330
330
  className="dragger-button"
331
331
  type="flat"
332
332
  style={{
333
- top: isFullMode ? 60 : -8,
333
+ top: isFullMode ? 105 : -8,
334
334
  position: 'absolute',
335
- right: 0, color:
336
- FONT_COLOR_05
335
+ right: 20,
336
+ color: FONT_COLOR_05
337
337
  }}
338
338
  onClick={onReUpload}
339
339
  >
@@ -59,7 +59,7 @@ export const LineText = ({
59
59
  const [translationLang, updateTranslationLang] = useState('en');
60
60
 
61
61
  useEffect(() => {
62
- const { messageTitle = '', messageContent = '', type, isInit } = content || {};
62
+ const { messageTitle = '', messageContent = '', type, isInit } = content;
63
63
  if (type === 'text') {
64
64
  if (messageContent) {
65
65
  updateCreateNew(true);
@@ -104,11 +104,11 @@ export const LineText = ({
104
104
  layout: 'LINE',
105
105
  type: 'TAG',
106
106
  context:
107
- location?.query?.type === 'embedded'
107
+ location.query.type === 'embedded'
108
108
  ? 'outbound'
109
109
  : 'default',
110
110
  embedded:
111
- location?.query?.type === 'embedded'
111
+ location.query.type === 'embedded'
112
112
  ? location.query.type
113
113
  : 'full',
114
114
  };
@@ -125,7 +125,7 @@ export const LineText = ({
125
125
  context:
126
126
  (data || '').toLowerCase() === 'all' ? 'default' : (data || '').toLowerCase(),
127
127
  embedded:
128
- location?.query?.type === 'embedded'
128
+ location.query.type === 'embedded'
129
129
  ? location.query.type
130
130
  : 'full',
131
131
  };
@@ -266,7 +266,7 @@ export const LineText = ({
266
266
  />
267
267
  <TagList
268
268
  key={`${id}_tags`}
269
- moduleFilterEnabled={location && location?.query && location?.query?.type !== 'embedded'}
269
+ moduleFilterEnabled={location && location.query && location.query.type !== 'embedded'}
270
270
  label={formatMessage(messages.addLabels)}
271
271
  onTagSelect={onTagSelect}
272
272
  onContextChange={handleOnTagsContextChange}
@@ -61,6 +61,8 @@
61
61
  max-height: 100%;
62
62
  height: 152px !important;
63
63
  width: auto !important;
64
+ // max-width: 300px;
65
+ // max-height: 150px;
64
66
  }
65
67
  }
66
68
 
@@ -569,7 +569,17 @@ const MediaUploaders = ({
569
569
  {formatMessage(messages.deepLink)}
570
570
  </CapHeading>
571
571
  <CapSelect.CapCustomSelect
572
- options={deepLink || []}
572
+ options={(() => {
573
+ const options = [...(deepLink || [])];
574
+ // If the current value is not in the options, add it
575
+ if (button.deepLinkValue && !options.find(opt => opt.value === button.deepLinkValue)) {
576
+ options.push({
577
+ value: button.deepLinkValue,
578
+ label: button.deepLinkValue,
579
+ });
580
+ }
581
+ return options;
582
+ })()}
573
583
  value={button.deepLinkValue}
574
584
  onChange={(value) => handleCarouselDeepLinkChange(cardIndex, value)}
575
585
  key={`mobile-push-deep-link-type-${activeTab}-${cardIndex}`}
@@ -606,7 +616,12 @@ const MediaUploaders = ({
606
616
  </CapRow>
607
617
  )}
608
618
  {button?.linkType === DEEP_LINK && button?.deepLinkValue && button?.actionOnClick && (() => {
609
- const selectedDeepLink = deepLink?.find((link) => link?.value === button?.deepLinkValue);
619
+ // Try to find exact match first, then try match without query parameters
620
+ let selectedDeepLink = deepLink?.find((link) => link?.value === button?.deepLinkValue);
621
+ if (!selectedDeepLink && button?.deepLinkValue && button?.deepLinkValue.includes('?')) {
622
+ const baseDeepLinkValue = button?.deepLinkValue.split('?')[0];
623
+ selectedDeepLink = deepLink?.find((link) => link?.value === baseDeepLinkValue);
624
+ }
610
625
  const deepLinkKeysFromSelection = selectedDeepLink?.keys;
611
626
  let deepLinkKeysFromSelectionArray = [];
612
627
  if (Array.isArray(deepLinkKeysFromSelection)) {
@@ -623,7 +638,12 @@ const MediaUploaders = ({
623
638
  </CapHeading>
624
639
  <CapLabel type="label2" className="deep-link-keys-value">
625
640
  {(() => {
626
- const selectedDeepLink = deepLink?.find((link) => link?.value === button.deepLinkValue);
641
+ // Try to find exact match first, then try match without query parameters
642
+ let selectedDeepLink = deepLink?.find((link) => link?.value === button?.deepLinkValue);
643
+ if (!selectedDeepLink && button?.deepLinkValue && button?.deepLinkValue.includes('?')) {
644
+ const baseDeepLinkValue = button?.deepLinkValue.split('?')[0];
645
+ selectedDeepLink = deepLink?.find((link) => link?.value === baseDeepLinkValue);
646
+ }
627
647
  const deepLinkKeysFromSelection = selectedDeepLink?.keys;
628
648
  let deepLinkKeysArray = [];
629
649
  if (Array.isArray(button?.deepLinkKeys)) {
@@ -652,7 +672,12 @@ const MediaUploaders = ({
652
672
  onChange={(e) => handleCarouselDeepLinkKeysChange(cardIndex, e.target.value)}
653
673
  placeholder={formatMessage(messages.deepLinkKeysPlaceholder, {
654
674
  key: (() => {
655
- const selectedDeepLink = deepLink?.find((link) => link?.value === button.deepLinkValue);
675
+ // Try to find exact match first, then try match without query parameters
676
+ let selectedDeepLink = deepLink?.find((link) => link?.value === button?.deepLinkValue);
677
+ if (!selectedDeepLink && button?.deepLinkValue && button?.deepLinkValue.includes('?')) {
678
+ const baseDeepLinkValue = button?.deepLinkValue.split('?')[0];
679
+ selectedDeepLink = deepLink?.find((link) => link?.value === baseDeepLinkValue);
680
+ }
656
681
  const deepLinkKeysFromSelection = selectedDeepLink?.keys;
657
682
  let deepLinkKeysFromSelectionArray = [];
658
683
  if (Array.isArray(deepLinkKeysFromSelection)) {
@@ -59,7 +59,15 @@ const PlatformContentFields = ({
59
59
  } = linkProps;
60
60
 
61
61
  // Get the selected deep link object to extract keys
62
- const selectedDeepLink = deepLink?.find((link) => link?.value === deepLinkValue);
62
+ // Try exact match first, then try match without query parameters
63
+ let selectedDeepLink = deepLink?.find((link) => link?.value === deepLinkValue);
64
+
65
+ // If no exact match, try to find match without query parameters
66
+ if (!selectedDeepLink && deepLinkValue && deepLinkValue.includes('?')) {
67
+ const baseDeepLinkValue = deepLinkValue.split('?')[0];
68
+ selectedDeepLink = deepLink?.find((link) => link?.value === baseDeepLinkValue);
69
+ }
70
+
63
71
  const deepLinkKeysFromSelection = selectedDeepLink?.keys;
64
72
 
65
73
  // Handle deep link keys value - could be array or string
@@ -252,7 +260,17 @@ const PlatformContentFields = ({
252
260
  {formatMessage(messages.deepLink)}
253
261
  </CapHeading>
254
262
  <CapSelect.CapCustomSelect
255
- options={deepLink || []}
263
+ options={(() => {
264
+ const options = [...(deepLink || [])];
265
+ // If the current value is not in the options, add it
266
+ if (deepLinkValue && !options.find((opt) => opt.value === deepLinkValue)) {
267
+ options.push({
268
+ value: deepLinkValue,
269
+ label: deepLinkValue,
270
+ });
271
+ }
272
+ return options;
273
+ })()}
256
274
  value={deepLinkValue}
257
275
  onChange={onDeepLinkChange}
258
276
  key="mobile-push-deep-link-type"
@@ -285,7 +303,7 @@ const PlatformContentFields = ({
285
303
  )}
286
304
  </CapRow>
287
305
  )}
288
- {content?.actionOnClick && content?.linkType === DEEP_LINK && deepLinkValue && deepLinkKeysFromSelectionArray?.length > 0 && (
306
+ {content?.actionOnClick && content?.linkType === DEEP_LINK && deepLinkValue && (deepLinkKeysFromSelectionArray?.length > 0 || deepLinkKeysArray?.length > 0) && (
289
307
  <CapRow style={{ marginTop: "10px", left: "6%", width: '115%'}}>
290
308
  <CapColumn span={14}>
291
309
  <CapHeading type="h4" className="deep-link-keys-heading">
@@ -44,7 +44,6 @@ export const MEDIA_TYPES_OPTIONS = [
44
44
  { label: "NONE", value: "NONE" },
45
45
  { label: "IMAGE", value: "IMAGE" },
46
46
  { label: "VIDEO", value: "VIDEO" },
47
- { label: "GIF", value: "GIF" },
48
47
  { label: "CAROUSEL", value: "CAROUSEL" },
49
48
  ];
50
49