@capillarytech/creatives-library 8.0.60-alpha.0 → 8.0.60-alpha.2
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/v2Containers/Cap/reducer.js +18 -8
package/package.json
CHANGED
|
@@ -142,19 +142,29 @@ function capReducer(state = fromJS(initialState.cap), action) {
|
|
|
142
142
|
metaEntities.tags.custom = _.filter(state.get('metaEntities').tags.custom, (tag) => action.tagList.indexOf(tag.name) === -1);
|
|
143
143
|
return state.setIn(['metaEntities'], metaEntities);
|
|
144
144
|
case types.SET_INJECTED_TAGS:
|
|
145
|
-
|
|
145
|
+
const getTagMapValues = (object = {}) => {
|
|
146
|
+
return Object.values(object).reduce((acc, current) => {
|
|
147
|
+
// Check if current has 'subtags' and it's an object
|
|
148
|
+
if (current && current.subtags && typeof current.subtags === 'object') {
|
|
149
|
+
return { ...acc, ...current.subtags };
|
|
150
|
+
}
|
|
151
|
+
// If no 'subtags', return accumulator as is
|
|
152
|
+
return acc;
|
|
153
|
+
}, {});
|
|
154
|
+
};
|
|
155
|
+
console.log('SET_INJECTED_TAGS',action.injectedTags,getTagMapValues(action?.injectedTags));
|
|
146
156
|
// Deep clone the tagLookupMap to avoid direct mutations
|
|
147
|
-
|
|
148
|
-
|
|
157
|
+
let updatedMetaEntitiesTagLookUp = _.cloneDeep(state.getIn(['metaEntities', 'tagLookupMap']));
|
|
158
|
+
const formattedInjuectedTags = getTagMapValues(action?.injectedTags);
|
|
149
159
|
// Merge the injectedTags with the existing tagLookupMap
|
|
150
|
-
updatedMetaEntitiesTagLookUp
|
|
151
|
-
...
|
|
152
|
-
...
|
|
160
|
+
updatedMetaEntitiesTagLookUp = {
|
|
161
|
+
...formattedInjuectedTags|| {},
|
|
162
|
+
...updatedMetaEntitiesTagLookUp || {},
|
|
153
163
|
};
|
|
154
|
-
console.log('updatedMetaEntitiesTagLookUp',updatedMetaEntitiesTagLookUp
|
|
164
|
+
// console.log('updatedMetaEntitiesTagLookUp',fromJS(updatedMetaEntitiesTagLookUp));
|
|
155
165
|
return state
|
|
156
166
|
.set('injectedTags', action.injectedTags)
|
|
157
|
-
.setIn(['metaEntities', 'tagLookupMap'], fromJS(updatedMetaEntitiesTagLookUp
|
|
167
|
+
.setIn(['metaEntities', 'tagLookupMap'], fromJS(updatedMetaEntitiesTagLookUp));
|
|
158
168
|
case types.GET_TOPBAR_MENU_DATA_REQUEST:
|
|
159
169
|
return state.set('topbarMenuData', fromJS({ status: 'request' }));
|
|
160
170
|
case types.GET_TOPBAR_MENU_DATA_SUCCESS:
|