@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 +7 -0
- package/dist/esm/bookmark/useCurrentBookmark.js +11 -2
- package/dist/esm/bookmark/useCurrentBookmark.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/bookmark/useCurrentBookmark.d.ts +2 -2
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
- package/src/bookmark/useCurrentBookmark.ts +17 -3
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -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
|
-
|
|
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,
|
|
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"}
|
package/dist/esm/version.js
CHANGED