@capillarytech/creatives-library 8.0.299-alpha.0 → 8.0.299-alpha.1

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.299-alpha.0",
4
+ "version": "8.0.299-alpha.1",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/utils/common.js CHANGED
@@ -138,15 +138,13 @@ export const isEmailUnsubscribeTagMandatory = Auth.hasFeatureAccess.bind(
138
138
  EMAIL_UNSUBSCRIBE_TAG_MANDATORY,
139
139
  );
140
140
 
141
- // export const hasNewMobilePushFeatureEnabled = Auth.hasFeatureAccess.bind(
142
- // null,
143
- // ENABLE_NEW_MPUSH,
144
- // );
145
-
146
-
141
+ export const hasNewMobilePushFeatureEnabled = Auth.hasFeatureAccess.bind(
142
+ null,
143
+ ENABLE_NEW_MPUSH,
144
+ );
147
145
 
148
- export const hasNewEditorFlowInAppEnabled = () => {
149
- return false;
146
+ export const hasNewEditorFlowInAppEnabled = ()=>{
147
+ return true
150
148
  }
151
149
 
152
150
  //filtering tags based on scope
@@ -40,6 +40,11 @@ function BeePopupEditor(props) {
40
40
  const savedCallback = useRef();
41
41
  const beeInstanceRef = useRef(null);
42
42
  const isInitializedRef = useRef(false);
43
+ const beeJsonRef = useRef(beeJson);
44
+
45
+ useEffect(() => {
46
+ beeJsonRef.current = beeJson;
47
+ }, [beeJson]);
43
48
 
44
49
  const [visibleTaglist, setVisibleTaglist] = useState(false);
45
50
  const [selectedTag, setSelectedTag] = useState({});
@@ -111,8 +116,10 @@ function BeePopupEditor(props) {
111
116
  window.BeePlugin.create(tokenData, beeConfig, (instance) => {
112
117
  beePluginInstance = instance;
113
118
  beeInstanceRef.current = instance;
114
- // Check if beeJson is already an object (happens when layout type changes)
115
- const parseJson = typeof beeJson === 'string' ? JSON.parse(beeJson) : beeJson;
119
+ // Use ref to get the latest beeJson the closure captures the value at effect time,
120
+ // but beeJsonRef.current is always up-to-date (e.g. when template data loads async)
121
+ const latestBeeJson = beeJsonRef.current;
122
+ const parseJson = typeof latestBeeJson === 'string' ? JSON.parse(latestBeeJson) : latestBeeJson;
116
123
  beePluginInstance.start(parseJson);
117
124
  saveBeeInstance(beePluginInstance, device);
118
125
  isInitializedRef.current = true;