@capillarytech/creatives-library 8.0.87-alpha.13 → 8.0.87-alpha.14
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
|
@@ -172,6 +172,59 @@ export const transformMpushPayload = (mpushData, options = {}) => {
|
|
|
172
172
|
};
|
|
173
173
|
};
|
|
174
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Transforms WhatsApp data to the required payload format
|
|
177
|
+
* @param {Object} whatsappData - Current WhatsApp data
|
|
178
|
+
* @param {Object} options - Additional options (ouId, sourceEntityId, etc.)
|
|
179
|
+
* @returns {Object} - Transformed WhatsApp payload
|
|
180
|
+
*/
|
|
181
|
+
export const transformWhatsappPayload = (whatsappData, options = {}) => {
|
|
182
|
+
const { loyaltyMetaData = {} } = options;
|
|
183
|
+
|
|
184
|
+
const {
|
|
185
|
+
actionId,
|
|
186
|
+
actionName,
|
|
187
|
+
ouId,
|
|
188
|
+
clientName,
|
|
189
|
+
module,
|
|
190
|
+
metaId,
|
|
191
|
+
setMetaId = () => {},
|
|
192
|
+
transformedMessageDetails = {}
|
|
193
|
+
} = loyaltyMetaData;
|
|
194
|
+
|
|
195
|
+
const { whatsappDeliverySettings = {} } = transformedMessageDetails;
|
|
196
|
+
|
|
197
|
+
// Get template configurations or set defaults
|
|
198
|
+
const templateConfigs = whatsappData.templateConfigs || {};
|
|
199
|
+
|
|
200
|
+
return {
|
|
201
|
+
ouId: ouId || -1,
|
|
202
|
+
sourceEntityId: actionId,
|
|
203
|
+
channel: "WHATSAPP",
|
|
204
|
+
module,
|
|
205
|
+
whatsappMessageContent: {
|
|
206
|
+
messageBody: whatsappData.messageBody || "",
|
|
207
|
+
accountId: whatsappData.accountId || 0,
|
|
208
|
+
templateConfigs,
|
|
209
|
+
channel: "WHATSAPP"
|
|
210
|
+
},
|
|
211
|
+
whatsappDeliverySettings: whatsappDeliverySettings || {
|
|
212
|
+
additionalSettings: {
|
|
213
|
+
encryptUrl: false,
|
|
214
|
+
linkTrackingEnabled: false,
|
|
215
|
+
useTinyUrl: false
|
|
216
|
+
},
|
|
217
|
+
channelSettings: {
|
|
218
|
+
channel: "WHATSAPP",
|
|
219
|
+
senderMobNum: whatsappData.senderMobNum || "",
|
|
220
|
+
domainId: whatsappData.domainId || 0
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
executionParams: {},
|
|
224
|
+
clientName: clientName || "VENENO"
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
|
|
175
228
|
/**
|
|
176
229
|
* General transformer function that handles different channel types
|
|
177
230
|
* @param {Object} data - The input data
|
|
@@ -188,6 +241,8 @@ export const transformChannelPayload = (data, options = {}) => {
|
|
|
188
241
|
return transformMpushPayload(data, options);
|
|
189
242
|
case "EMAIL":
|
|
190
243
|
return transformEmailPayload(data, options);
|
|
244
|
+
case "WHATSAPP":
|
|
245
|
+
return transformWhatsappPayload(data, options);
|
|
191
246
|
default:
|
|
192
247
|
return data; // Return unchanged for unsupported channels
|
|
193
248
|
}
|
|
@@ -98,6 +98,11 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
98
98
|
}
|
|
99
99
|
const commonChannels = ['sms', 'email', 'wechat', 'mobilepush', 'line', 'viber', 'facebook', 'call_task', 'ftp', 'assets'];
|
|
100
100
|
|
|
101
|
+
// TODO: Add feature flag here
|
|
102
|
+
if (true) {
|
|
103
|
+
commonChannels.push('whatsapp');
|
|
104
|
+
}
|
|
105
|
+
|
|
101
106
|
// we only show channels which other than commonChannels
|
|
102
107
|
// if it is coming in enableNewChannels array
|
|
103
108
|
filteredPanes = filteredPanes.filter((item) => {
|