@equinor/fusion-framework-react-app 6.2.3 → 6.2.4

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @equinor/fusion-framework-app@9.3.20
9
+
3
10
  ## 6.2.3
4
11
 
5
12
  ### Patch Changes
@@ -1,6 +1,7 @@
1
- import { useCurrentBookmark as _useCurrentBookmark, } from '@equinor/fusion-framework-react-module-bookmark';
1
+ import { useCurrentBookmark as _useCurrentBookmark, bookmarkWithDataSchema, } from '@equinor/fusion-framework-react-module-bookmark';
2
2
  import { useFrameworkModule } from '@equinor/fusion-framework-react';
3
3
  import useAppModules from '../useAppModules';
4
+ import { useCurrentApp } from '@equinor/fusion-framework-react/app';
4
5
  /**
5
6
  * By providing a CreateBookMarkFn bookmarks is enabled for the current application.
6
7
  *
@@ -14,15 +15,23 @@ import useAppModules from '../useAppModules';
14
15
  * @return {*} {CurrentBookmark<TData>}
15
16
  */
16
17
  export const useCurrentBookmark = (payloadGenerator) => {
18
+ const { currentApp } = useCurrentApp();
17
19
  const appBookmarkProvider = useAppModules().bookmark;
18
20
  const frameworkBookmarkProvider = useFrameworkModule('bookmark');
19
21
  if (!appBookmarkProvider) {
20
22
  console.warn('@deprecation', 'application has not enabled bookmarks, this will not work in the future');
21
23
  }
22
- return _useCurrentBookmark({
24
+ const { currentBookmark, setCurrentBookmark } = _useCurrentBookmark({
23
25
  provider: appBookmarkProvider ?? frameworkBookmarkProvider,
24
26
  payloadGenerator,
25
27
  });
28
+ const currentBookmarkAppKey = bookmarkWithDataSchema().safeParse(currentBookmark).success
29
+ ? bookmarkWithDataSchema().parse(currentBookmark).appKey
30
+ : null;
31
+ return {
32
+ currentBookmark: currentBookmarkAppKey === currentApp?.appKey ? currentBookmark : null,
33
+ setCurrentBookmark,
34
+ };
26
35
  };
27
36
  export default useCurrentBookmark;
28
37
  //# sourceMappingURL=useCurrentBookmark.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCurrentBookmark.js","sourceRoot":"","sources":["../../../src/bookmark/useCurrentBookmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,IAAI,mBAAmB,GAC1C,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,gBAAkD,EACH,EAAE;IACjD,MAAM,mBAAmB,GAAG,aAAa,EAAoB,CAAC,QAAQ,CAAC;IACvE,MAAM,yBAAyB,GAAG,kBAAkB,CAAiB,UAAU,CAAC,CAAC;IACjF,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,CACV,cAAc,EACd,yEAAyE,CAC1E,CAAC;IACJ,CAAC;IACD,OAAO,mBAAmB,CAAQ;QAChC,QAAQ,EAAE,mBAAmB,IAAI,yBAAyB;QAC1D,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"useCurrentBookmark.js","sourceRoot":"","sources":["../../../src/bookmark/useCurrentBookmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,kBAAkB,IAAI,mBAAmB,EAEzC,sBAAsB,GACvB,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,gBAAkD,EACjB,EAAE;IACnC,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,EAAE,CAAC;IACvC,MAAM,mBAAmB,GAAG,aAAa,EAAoB,CAAC,QAAQ,CAAC;IACvE,MAAM,yBAAyB,GAAG,kBAAkB,CAAiB,UAAU,CAAC,CAAC;IACjF,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,CACV,cAAc,EACd,yEAAyE,CAC1E,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,eAAe,EAAE,kBAAkB,EAAE,GAAG,mBAAmB,CAAQ;QACzE,QAAQ,EAAE,mBAAmB,IAAI,yBAAyB;QAC1D,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,qBAAqB,GAAG,sBAAsB,EAAE,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,OAAO;QACvF,CAAC,CAAC,sBAAsB,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,MAAM;QACxD,CAAC,CAAC,IAAI,CAAC;IAET,OAAO;QACL,eAAe,EAAE,qBAAqB,KAAK,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI;QACtF,kBAAkB;KACnB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '6.2.3';
2
+ export const version = '6.2.4';
3
3
  //# sourceMappingURL=version.js.map