@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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.60-alpha.0",
4
+ "version": "8.0.60-alpha.2",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -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
- console.log('SET_INJECTED_TAGS',action.injectedTags);
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
- const updatedMetaEntitiesTagLookUp = _.cloneDeep(state.getIn(['metaEntities', 'tagLookupMap']));
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.tagLookupMap = {
151
- ...action?.injectedTags || {},
152
- ...state.getIn(['metaEntities', 'tagLookupMap']),
160
+ updatedMetaEntitiesTagLookUp = {
161
+ ...formattedInjuectedTags|| {},
162
+ ...updatedMetaEntitiesTagLookUp || {},
153
163
  };
154
- console.log('updatedMetaEntitiesTagLookUp',updatedMetaEntitiesTagLookUp.tagLookupMap);
164
+ // console.log('updatedMetaEntitiesTagLookUp',fromJS(updatedMetaEntitiesTagLookUp));
155
165
  return state
156
166
  .set('injectedTags', action.injectedTags)
157
- .setIn(['metaEntities', 'tagLookupMap'], fromJS(updatedMetaEntitiesTagLookUp.tagLookupMap));
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: