@capillarytech/creatives-library 8.0.136-beta.0 → 8.0.136-beta.4
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
|
@@ -283,8 +283,6 @@ const transformLinePayload = (lineData, options = {}) => {
|
|
|
283
283
|
|
|
284
284
|
// Get base payload structure
|
|
285
285
|
const payload = createBasePayload(LINE, loyaltyMetaData);
|
|
286
|
-
|
|
287
|
-
// Add LINE-specific properties
|
|
288
286
|
payload.centralCommsPayload.lineMessageContent = {
|
|
289
287
|
channel: LINE,
|
|
290
288
|
accountId: lineData?.accountId || 0,
|
|
@@ -293,7 +291,6 @@ const transformLinePayload = (lineData, options = {}) => {
|
|
|
293
291
|
...lineData,
|
|
294
292
|
};
|
|
295
293
|
payload.centralCommsPayload.lineDeliverySettings = lineDeliverySettings || {};
|
|
296
|
-
|
|
297
294
|
return payload;
|
|
298
295
|
};
|
|
299
296
|
|
|
@@ -307,11 +304,8 @@ const transformViberPayload = (viberData, options = {}) => {
|
|
|
307
304
|
const { loyaltyMetaData = {} } = options;
|
|
308
305
|
const { transformedMessageDetails = {} } = loyaltyMetaData;
|
|
309
306
|
const { viberDeliverySettings = {} } = transformedMessageDetails;
|
|
310
|
-
|
|
311
307
|
// Get base payload structure
|
|
312
308
|
const payload = createBasePayload(VIBER, loyaltyMetaData);
|
|
313
|
-
|
|
314
|
-
// Add VIBER-specific properties
|
|
315
309
|
payload.centralCommsPayload.viberMessageContent = {
|
|
316
310
|
channel: VIBER,
|
|
317
311
|
accountId: viberData?.accountId || 0,
|
|
@@ -320,12 +314,13 @@ const transformViberPayload = (viberData, options = {}) => {
|
|
|
320
314
|
...viberData,
|
|
321
315
|
};
|
|
322
316
|
payload.centralCommsPayload.viberDeliverySettings = viberDeliverySettings || {};
|
|
323
|
-
|
|
324
317
|
return payload;
|
|
325
318
|
};
|
|
326
319
|
|
|
327
320
|
// Checks if the template has changed
|
|
328
321
|
export const getTemplateDiffState = (channel, oldData, newData) => {
|
|
322
|
+
// Original switch implementation (commented out)
|
|
323
|
+
/*
|
|
329
324
|
switch (channel.toUpperCase()) {
|
|
330
325
|
case SMS:
|
|
331
326
|
return checkSmsDiff(oldData, newData);
|
|
@@ -348,6 +343,24 @@ export const getTemplateDiffState = (channel, oldData, newData) => {
|
|
|
348
343
|
default:
|
|
349
344
|
return false;
|
|
350
345
|
}
|
|
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;
|
|
351
364
|
};
|
|
352
365
|
/**
|
|
353
366
|
* Checks differences between old and new SMS data
|
|
@@ -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}
|