@capillarytech/creatives-library 8.0.101 → 8.0.102
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
|
@@ -740,9 +740,7 @@ export class Creatives extends React.Component {
|
|
|
740
740
|
forEach(androidContent.custom, (customKeyValue) => {
|
|
741
741
|
custom[customKeyValue.key] = customKeyValue.value;
|
|
742
742
|
});
|
|
743
|
-
|
|
744
|
-
androidContent.custom = custom;
|
|
745
|
-
}
|
|
743
|
+
androidContent.custom = custom;
|
|
746
744
|
templateData.androidContent = androidContent;
|
|
747
745
|
templateData.androidContent.type = get(channelTemplate, 'definition.mode', '').toUpperCase();
|
|
748
746
|
templateData.androidContent.deviceType = 'ANDROID';
|
|
@@ -758,9 +756,7 @@ export class Creatives extends React.Component {
|
|
|
758
756
|
forEach(iosContent.custom, (customKeyValue) => {
|
|
759
757
|
custom[customKeyValue.key] = customKeyValue.value;
|
|
760
758
|
});
|
|
761
|
-
|
|
762
|
-
iosContent.custom = custom;
|
|
763
|
-
}
|
|
759
|
+
iosContent.custom = custom;
|
|
764
760
|
templateData.iosContent = iosContent;
|
|
765
761
|
templateData.iosContent.type = get(channelTemplate, 'definition.mode').toUpperCase();
|
|
766
762
|
templateData.iosContent.deviceType = IOS.toUpperCase();
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SMS,
|
|
3
|
-
MOBILE_PUSH,
|
|
4
|
-
EMAIL
|
|
5
|
-
} from "../../v2Containers/CreativesContainer/constants";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Transform form data to API payload format
|
|
9
|
-
* @param {object} formData - The form data from the UI
|
|
10
|
-
* @param {string} channel - The communication channel (EMAIL, SMS, WECHAT, MOBILE_PUSH)
|
|
11
|
-
* @param {object} params - Additional parameters like sourceEntityId, ouId, etc.
|
|
12
|
-
* @returns {object} - The formatted API payload
|
|
13
|
-
*/
|
|
14
|
-
export const transformFormDataToAPIPayload = (
|
|
15
|
-
formData,
|
|
16
|
-
loyaltyMetaData = {}
|
|
17
|
-
) => {
|
|
18
|
-
console.log("**** # transformDataToAPIPyaload: ", {
|
|
19
|
-
formData,
|
|
20
|
-
loyaltyMetaData
|
|
21
|
-
});
|
|
22
|
-
const {
|
|
23
|
-
actionId,
|
|
24
|
-
actionName,
|
|
25
|
-
ouId,
|
|
26
|
-
clientName,
|
|
27
|
-
module,
|
|
28
|
-
metaId,
|
|
29
|
-
setMetaId = () => {},
|
|
30
|
-
channel,
|
|
31
|
-
transformedMessageDetails
|
|
32
|
-
} = loyaltyMetaData;
|
|
33
|
-
|
|
34
|
-
const { emailDeliverySettings } = transformedMessageDetails;
|
|
35
|
-
const upperCaseChannel = channel.toUpperCase();
|
|
36
|
-
|
|
37
|
-
// Base response structure
|
|
38
|
-
const response = {
|
|
39
|
-
ouId: ouId || -1,
|
|
40
|
-
sourceEntityId: actionId,
|
|
41
|
-
channel: upperCaseChannel || this.props.schema.channel.toUpperCase(),
|
|
42
|
-
module,
|
|
43
|
-
executionParams: {},
|
|
44
|
-
clientName: clientName || "EMF"
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
switch (upperCaseChannel) {
|
|
48
|
-
case EMAIL: {
|
|
49
|
-
const subject = formData["template-subject"] || "";
|
|
50
|
-
const htmlContent = formData?.base?.en?.["template-content"] || "";
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
...response,
|
|
54
|
-
emailDeliverySettings: emailDeliverySettings || {},
|
|
55
|
-
emailMessageContent: {
|
|
56
|
-
channel: EMAIL,
|
|
57
|
-
messageBody: htmlContent,
|
|
58
|
-
messageSubject: subject
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
case SMS: {
|
|
64
|
-
// Extract SMS content from formData
|
|
65
|
-
const smsContent = formData["sms-editor"] || "";
|
|
66
|
-
const templateId = formData.template_id || "";
|
|
67
|
-
const templateName = formData.template_name || "";
|
|
68
|
-
const header = formData.header || "";
|
|
69
|
-
const varMapped = formData["var-mapped"] || {};
|
|
70
|
-
|
|
71
|
-
return {
|
|
72
|
-
...response,
|
|
73
|
-
smsDeliverySettings: {
|
|
74
|
-
additionalSettings: {
|
|
75
|
-
skipRateLimit: false
|
|
76
|
-
},
|
|
77
|
-
channelSettings: {
|
|
78
|
-
channel: SMS,
|
|
79
|
-
senderId: header || ""
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
smsMessageContent: {
|
|
83
|
-
channel: SMS,
|
|
84
|
-
messageBody: smsContent,
|
|
85
|
-
templateId,
|
|
86
|
-
templateName,
|
|
87
|
-
varMapped
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
case MOBILE_PUSH: {
|
|
93
|
-
// Extract Mobile Push content
|
|
94
|
-
const androidContent = formData.ANDROID || {};
|
|
95
|
-
const iosContent = formData.IOS || {};
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
...response,
|
|
99
|
-
mobilePushDeliverySettings: {
|
|
100
|
-
additionalSettings: {
|
|
101
|
-
skipRateLimit: false
|
|
102
|
-
},
|
|
103
|
-
channelSettings: {
|
|
104
|
-
channel: MOBILE_PUSH
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
mobilePushMessageContent: {
|
|
108
|
-
channel: MOBILE_PUSH,
|
|
109
|
-
androidContent: {
|
|
110
|
-
title: androidContent.title || "",
|
|
111
|
-
body: androidContent.message || "",
|
|
112
|
-
type: androidContent.type || "TEXT",
|
|
113
|
-
custom: androidContent.custom || {}
|
|
114
|
-
},
|
|
115
|
-
iosContent: {
|
|
116
|
-
title: iosContent.title || "",
|
|
117
|
-
body: iosContent.message || "",
|
|
118
|
-
type: iosContent.type || "TEXT",
|
|
119
|
-
custom: iosContent.custom || {}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// case WECHAT: {
|
|
126
|
-
// // Extract WeChat content
|
|
127
|
-
// const wechatContent = formData.content || {};
|
|
128
|
-
|
|
129
|
-
// return {
|
|
130
|
-
// ...response,
|
|
131
|
-
// wechatDeliverySettings: {
|
|
132
|
-
// additionalSettings: {
|
|
133
|
-
// skipRateLimit: false
|
|
134
|
-
// },
|
|
135
|
-
// channelSettings: {
|
|
136
|
-
// channel: WECHAT
|
|
137
|
-
// }
|
|
138
|
-
// },
|
|
139
|
-
// wechatMessageContent: {
|
|
140
|
-
// channel: WECHAT,
|
|
141
|
-
// messageBody: wechatContent.body || "",
|
|
142
|
-
// templateId: wechatContent.templateId || "",
|
|
143
|
-
// templateName: wechatContent.templateName || "",
|
|
144
|
-
// varMapped: wechatContent.varMapped || {}
|
|
145
|
-
// }
|
|
146
|
-
// };
|
|
147
|
-
// }
|
|
148
|
-
|
|
149
|
-
default:
|
|
150
|
-
return response;
|
|
151
|
-
}
|
|
152
|
-
};
|