@widergy/mobile-ui 1.38.0 → 1.39.0
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/CHANGELOG.md +7 -0
- package/lib/utils/analyticsUtils/index.js +23 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.39.0](https://github.com/widergy/mobile-ui/compare/v1.38.0...v1.39.0) (2025-04-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* clean object func in single event multitracking added ([#420](https://github.com/widergy/mobile-ui/issues/420)) ([36762be](https://github.com/widergy/mobile-ui/commit/36762bedd180f4a369271ca39f8673f93753ef26))
|
|
7
|
+
|
|
1
8
|
# [1.38.0](https://github.com/widergy/mobile-ui/compare/v1.37.0...v1.38.0) (2025-03-26)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -128,6 +128,27 @@ export const singleArgosEvent = sendArgosAnalytics => eventData => {
|
|
|
128
128
|
sendArgosAnalytics(eventData);
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
+
const cleanObject = obj => {
|
|
132
|
+
if (typeof obj !== 'object' || obj === null) return obj;
|
|
133
|
+
|
|
134
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
135
|
+
if (value === null || value === 'null' || value === '' || value === undefined || value === 'undefined') {
|
|
136
|
+
return acc;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
140
|
+
const cleanedValue = cleanObject(value);
|
|
141
|
+
if (Object.keys(cleanedValue).length > 0) {
|
|
142
|
+
acc[key] = cleanedValue;
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
acc[key] = value;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return acc;
|
|
149
|
+
}, {});
|
|
150
|
+
};
|
|
151
|
+
|
|
131
152
|
export const singleEventMultitracking = (trackers, eventDefinitions) => (name, eventData) => {
|
|
132
153
|
const mergedData = merge(cloneDeep(eventDefinitions[name] || {}), eventData || {});
|
|
133
154
|
const { sharedProps, ...trackerProps } = mergedData;
|
|
@@ -136,7 +157,8 @@ export const singleEventMultitracking = (trackers, eventDefinitions) => (name, e
|
|
|
136
157
|
trackersArray.forEach(trackerName => {
|
|
137
158
|
const eventTracker = trackers[trackerName];
|
|
138
159
|
const fullEventData = merge(trackerProps[trackerName], sharedProps);
|
|
139
|
-
|
|
160
|
+
const fullEventDataCleaned = cleanObject(fullEventData);
|
|
161
|
+
eventTracker?.(fullEventDataCleaned);
|
|
140
162
|
});
|
|
141
163
|
};
|
|
142
164
|
|
package/package.json
CHANGED