@capillarytech/creatives-library 8.0.136-beta.4 → 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 +1 -1
- package/utils/createMobilePushPayload.js +1 -0
- package/utils/transformerUtils.js +0 -207
- package/v2Components/TemplatePreview/_templatePreview.scss +10 -1
- package/v2Containers/Line/Container/Image/index.js +3 -3
- package/v2Containers/Line/Container/Text/index.js +5 -5
- package/v2Containers/Line/Container/_lineCreate.scss +2 -0
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +29 -4
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +21 -3
- package/v2Containers/MobilePushNew/constants.js +0 -1
- package/v2Containers/MobilePushNew/index.js +738 -182
- package/v2Containers/MobilePushNew/index.scss +48 -21
- package/v2Containers/Templates/index.js +33 -39
- package/v2Containers/Whatsapp/index.scss +6 -6
package/package.json
CHANGED
|
@@ -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,87 +231,8 @@ 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
|
-
payload.centralCommsPayload.lineMessageContent = {
|
|
287
|
-
channel: LINE,
|
|
288
|
-
accountId: lineData?.accountId || 0,
|
|
289
|
-
accountDetails: lineData?.accountDetails || "",
|
|
290
|
-
messageBody: lineData?.messageBody || "",
|
|
291
|
-
...lineData,
|
|
292
|
-
};
|
|
293
|
-
payload.centralCommsPayload.lineDeliverySettings = lineDeliverySettings || {};
|
|
294
|
-
return payload;
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Transforms VIBER data to the required payload format
|
|
299
|
-
* @param {Object} viberData - Current VIBER data
|
|
300
|
-
* @param {Object} options - Additional options (ouId, sourceEntityId, etc.)
|
|
301
|
-
* @returns {Object} - Transformed VIBER payload
|
|
302
|
-
*/
|
|
303
|
-
const transformViberPayload = (viberData, options = {}) => {
|
|
304
|
-
const { loyaltyMetaData = {} } = options;
|
|
305
|
-
const { transformedMessageDetails = {} } = loyaltyMetaData;
|
|
306
|
-
const { viberDeliverySettings = {} } = transformedMessageDetails;
|
|
307
|
-
// Get base payload structure
|
|
308
|
-
const payload = createBasePayload(VIBER, loyaltyMetaData);
|
|
309
|
-
payload.centralCommsPayload.viberMessageContent = {
|
|
310
|
-
channel: VIBER,
|
|
311
|
-
accountId: viberData?.accountId || 0,
|
|
312
|
-
accountDetails: viberData?.accountDetails || "",
|
|
313
|
-
messageBody: viberData?.messageBody || "",
|
|
314
|
-
...viberData,
|
|
315
|
-
};
|
|
316
|
-
payload.centralCommsPayload.viberDeliverySettings = viberDeliverySettings || {};
|
|
317
|
-
return payload;
|
|
318
|
-
};
|
|
319
|
-
|
|
320
234
|
// Checks if the template has changed
|
|
321
235
|
export const getTemplateDiffState = (channel, oldData, newData) => {
|
|
322
|
-
// Original switch implementation (commented out)
|
|
323
|
-
/*
|
|
324
236
|
switch (channel.toUpperCase()) {
|
|
325
237
|
case SMS:
|
|
326
238
|
return checkSmsDiff(oldData, newData);
|
|
@@ -333,34 +245,9 @@ export const getTemplateDiffState = (channel, oldData, newData) => {
|
|
|
333
245
|
return checkWhatsappDiff(oldData, newData);
|
|
334
246
|
case ZALO:
|
|
335
247
|
return checkZaloDiff(oldData, newData);
|
|
336
|
-
case LINE:
|
|
337
|
-
return checkLineDiff(oldData, newData);
|
|
338
|
-
case VIBER:
|
|
339
|
-
return checkViberDiff(oldData, newData);
|
|
340
|
-
// TODO: RCS is currently not supported by the CCS - BE. We need to make changes in future as per the BE changes.
|
|
341
|
-
// case RCS:
|
|
342
|
-
// return checkRcsDiff(oldData, newData);
|
|
343
248
|
default:
|
|
344
249
|
return false;
|
|
345
250
|
}
|
|
346
|
-
*/
|
|
347
|
-
|
|
348
|
-
// Refactored implementation using object mapping
|
|
349
|
-
const diffHandlers = {
|
|
350
|
-
[SMS]: checkSmsDiff,
|
|
351
|
-
[EMAIL]: checkEmailDiff,
|
|
352
|
-
[MOBILE_PUSH]: checkPushDiff,
|
|
353
|
-
[PUSH]: checkPushDiff,
|
|
354
|
-
[WHATSAPP]: checkWhatsappDiff,
|
|
355
|
-
[ZALO]: checkZaloDiff,
|
|
356
|
-
[LINE]: checkLineDiff,
|
|
357
|
-
[VIBER]: checkViberDiff,
|
|
358
|
-
// TODO: RCS is currently not supported by the CCS - BE. We need to make changes in future as per the BE changes.
|
|
359
|
-
// [RCS]: checkRcsDiff,
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
const handler = diffHandlers[channel?.toUpperCase()];
|
|
363
|
-
return handler ? handler(oldData, newData) : false;
|
|
364
251
|
};
|
|
365
252
|
/**
|
|
366
253
|
* Checks differences between old and new SMS data
|
|
@@ -531,97 +418,3 @@ const checkZaloDiff = (oldData, newData) => {
|
|
|
531
418
|
// Use deep comparison for template configs
|
|
532
419
|
return !isEqual(oldTemplateConfigs, newTemplateConfigs);
|
|
533
420
|
};
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
* Checks differences between old and new RCS data
|
|
537
|
-
* @param {Object} oldData - Previous RCS template data
|
|
538
|
-
* @param {Object} newData - Updated RCS template data
|
|
539
|
-
* @returns {Boolean} - Whether the template has changed
|
|
540
|
-
*/
|
|
541
|
-
// TODO: RCS is currently not supported by the CCS - BE. We need to make changes in future as per the BE changes.
|
|
542
|
-
const checkRcsDiff = (oldData, newData) => {
|
|
543
|
-
// Extract old RCS content
|
|
544
|
-
const oldTemplateConfigs =
|
|
545
|
-
oldData?.transformedMessageDetails?.rcsMessageContent?.templateConfigs ||
|
|
546
|
-
{};
|
|
547
|
-
const oldAccountId =
|
|
548
|
-
oldData?.transformedMessageDetails?.rcsMessageContent?.accountId || "";
|
|
549
|
-
const oldAccountName =
|
|
550
|
-
oldData?.transformedMessageDetails?.rcsMessageContent?.accountName || "";
|
|
551
|
-
|
|
552
|
-
// Extract new RCS content
|
|
553
|
-
const newTemplateConfigs = newData?.templateConfigs || {};
|
|
554
|
-
const newAccountId = newData?.accountId || "";
|
|
555
|
-
const newAccountName = newData?.accountName || "";
|
|
556
|
-
|
|
557
|
-
// Compare simple properties for quick rejection
|
|
558
|
-
if (oldAccountId !== newAccountId) return true;
|
|
559
|
-
if (oldAccountName !== newAccountName) return true;
|
|
560
|
-
|
|
561
|
-
// If template configs have different structures, they've changed
|
|
562
|
-
if (
|
|
563
|
-
Object.keys(newTemplateConfigs).length !==
|
|
564
|
-
Object.keys(oldTemplateConfigs).length
|
|
565
|
-
) {
|
|
566
|
-
return true;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
// Use deep comparison for template configs
|
|
570
|
-
return !isEqual(oldTemplateConfigs, newTemplateConfigs);
|
|
571
|
-
};
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* Checks differences between old and new LINE data
|
|
575
|
-
* @param {Object} oldData - Previous LINE template data
|
|
576
|
-
* @param {Object} newData - Updated LINE template data
|
|
577
|
-
* @returns {Boolean} - Whether the template has changed
|
|
578
|
-
*/
|
|
579
|
-
const checkLineDiff = (oldData, newData) => {
|
|
580
|
-
// Extract old LINE content
|
|
581
|
-
const oldMessageBody =
|
|
582
|
-
oldData?.transformedMessageDetails?.lineMessageContent?.messageBody || "";
|
|
583
|
-
const oldAccountId =
|
|
584
|
-
oldData?.transformedMessageDetails?.lineMessageContent?.accountId || "";
|
|
585
|
-
const oldAccountDetails =
|
|
586
|
-
oldData?.transformedMessageDetails?.lineMessageContent?.accountDetails || "";
|
|
587
|
-
|
|
588
|
-
// Extract new LINE content
|
|
589
|
-
const newMessageBody = newData?.messageBody || "";
|
|
590
|
-
const newAccountId = newData?.accountId || "";
|
|
591
|
-
const newAccountDetails = newData?.accountDetails || "";
|
|
592
|
-
|
|
593
|
-
// Compare simple properties for quick rejection
|
|
594
|
-
if (oldMessageBody !== newMessageBody) return true;
|
|
595
|
-
if (oldAccountId !== newAccountId) return true;
|
|
596
|
-
if (oldAccountDetails !== newAccountDetails) return true;
|
|
597
|
-
|
|
598
|
-
return false;
|
|
599
|
-
};
|
|
600
|
-
|
|
601
|
-
/**
|
|
602
|
-
* Checks differences between old and new VIBER data
|
|
603
|
-
* @param {Object} oldData - Previous VIBER template data
|
|
604
|
-
* @param {Object} newData - Updated VIBER template data
|
|
605
|
-
* @returns {Boolean} - Whether the template has changed
|
|
606
|
-
*/
|
|
607
|
-
const checkViberDiff = (oldData, newData) => {
|
|
608
|
-
// Extract old VIBER content
|
|
609
|
-
const oldMessageBody =
|
|
610
|
-
oldData?.transformedMessageDetails?.viberMessageContent?.messageBody || "";
|
|
611
|
-
const oldAccountId =
|
|
612
|
-
oldData?.transformedMessageDetails?.viberMessageContent?.accountId || "";
|
|
613
|
-
const oldAccountDetails =
|
|
614
|
-
oldData?.transformedMessageDetails?.viberMessageContent?.accountDetails || "";
|
|
615
|
-
|
|
616
|
-
// Extract new VIBER content
|
|
617
|
-
const newMessageBody = newData?.messageBody || "";
|
|
618
|
-
const newAccountId = newData?.accountId || "";
|
|
619
|
-
const newAccountDetails = newData?.accountDetails || "";
|
|
620
|
-
|
|
621
|
-
// Compare simple properties for quick rejection
|
|
622
|
-
if (oldMessageBody !== newMessageBody) return true;
|
|
623
|
-
if (oldAccountId !== newAccountId) return true;
|
|
624
|
-
if (oldAccountDetails !== newAccountDetails) return true;
|
|
625
|
-
|
|
626
|
-
return false;
|
|
627
|
-
};
|
|
@@ -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 ?
|
|
333
|
+
top: isFullMode ? 105 : -8,
|
|
334
334
|
position: 'absolute',
|
|
335
|
-
right:
|
|
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
|
|
107
|
+
location.query.type === 'embedded'
|
|
108
108
|
? 'outbound'
|
|
109
109
|
: 'default',
|
|
110
110
|
embedded:
|
|
111
|
-
location
|
|
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
|
|
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
|
|
269
|
+
moduleFilterEnabled={location && location.query && location.query.type !== 'embedded'}
|
|
270
270
|
label={formatMessage(messages.addLabels)}
|
|
271
271
|
onTagSelect={onTagSelect}
|
|
272
272
|
onContextChange={handleOnTagsContextChange}
|
|
@@ -569,7 +569,17 @@ const MediaUploaders = ({
|
|
|
569
569
|
{formatMessage(messages.deepLink)}
|
|
570
570
|
</CapHeading>
|
|
571
571
|
<CapSelect.CapCustomSelect
|
|
572
|
-
options={
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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={
|
|
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">
|