@capillarytech/creatives-library 8.0.60-alpha.1 → 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.1",
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,16 +142,26 @@ 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,getTagMapValue(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
157
  let updatedMetaEntitiesTagLookUp = _.cloneDeep(state.getIn(['metaEntities', 'tagLookupMap']));
148
- const formattedInjuectedTags = getTagMapValue(action?.injectedTags);
158
+ const formattedInjuectedTags = getTagMapValues(action?.injectedTags);
149
159
  // Merge the injectedTags with the existing tagLookupMap
150
160
  updatedMetaEntitiesTagLookUp = {
151
161
  ...formattedInjuectedTags|| {},
152
162
  ...updatedMetaEntitiesTagLookUp || {},
153
163
  };
154
- console.log('updatedMetaEntitiesTagLookUp',fromJS(updatedMetaEntitiesTagLookUp));
164
+ // console.log('updatedMetaEntitiesTagLookUp',fromJS(updatedMetaEntitiesTagLookUp));
155
165
  return state
156
166
  .set('injectedTags', action.injectedTags)
157
167
  .setIn(['metaEntities', 'tagLookupMap'], fromJS(updatedMetaEntitiesTagLookUp));