@carlonicora/nextjs-jsonapi 3.14.1 → 3.15.0

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.
Files changed (39) hide show
  1. package/dist/{BlockNoteEditor-QG5OWH5K.mjs → BlockNoteEditor-JZHEGPUW.mjs} +4 -4
  2. package/dist/BlockNoteEditor-JZHEGPUW.mjs.map +1 -0
  3. package/dist/{BlockNoteEditor-WP4K423H.js → BlockNoteEditor-SVXMGHQM.js} +17 -17
  4. package/dist/BlockNoteEditor-SVXMGHQM.js.map +1 -0
  5. package/dist/billing/index.js +335 -335
  6. package/dist/billing/index.mjs +1 -1
  7. package/dist/{chunk-46BRB36R.mjs → chunk-DPPPJ3OP.mjs} +18 -13
  8. package/dist/chunk-DPPPJ3OP.mjs.map +1 -0
  9. package/dist/{chunk-OH6GJY4B.js → chunk-FEYJ6O4X.js} +19 -14
  10. package/dist/chunk-FEYJ6O4X.js.map +1 -0
  11. package/dist/client/index.js +2 -2
  12. package/dist/client/index.mjs +1 -1
  13. package/dist/components/index.d.mts +11 -3
  14. package/dist/components/index.d.ts +11 -3
  15. package/dist/components/index.js +2 -2
  16. package/dist/components/index.mjs +1 -1
  17. package/dist/contexts/index.d.mts +12 -1
  18. package/dist/contexts/index.d.ts +12 -1
  19. package/dist/contexts/index.js +4 -2
  20. package/dist/contexts/index.js.map +1 -1
  21. package/dist/contexts/index.mjs +3 -1
  22. package/dist/features/help/index.js +31 -31
  23. package/dist/features/help/index.mjs +1 -1
  24. package/dist/features/tokenusage/index.js +75 -75
  25. package/dist/features/tokenusage/index.mjs +1 -1
  26. package/package.json +1 -1
  27. package/src/components/editors/BlockNoteEditor.tsx +6 -2
  28. package/src/features/how-to/components/containers/HowToCommand.spec.tsx +72 -0
  29. package/src/features/how-to/components/containers/HowToCommand.tsx +11 -5
  30. package/src/features/how-to/components/containers/HowToCommandViewer.spec.tsx +31 -0
  31. package/src/features/how-to/components/containers/HowToCommandViewer.tsx +5 -2
  32. package/src/features/how-to/components/containers/HowToListContainer.tsx +11 -4
  33. package/src/features/how-to/components/lists/HowToList.spec.tsx +36 -0
  34. package/src/features/how-to/components/lists/HowToList.tsx +4 -1
  35. package/src/features/user/contexts/CurrentUserContext.tsx +16 -0
  36. package/dist/BlockNoteEditor-QG5OWH5K.mjs.map +0 -1
  37. package/dist/BlockNoteEditor-WP4K423H.js.map +0 -1
  38. package/dist/chunk-46BRB36R.mjs.map +0 -1
  39. package/dist/chunk-OH6GJY4B.js.map +0 -1
@@ -62,7 +62,7 @@ import {
62
62
  useCurrentUserContext,
63
63
  useDataListRetriever,
64
64
  usePageUrlGenerator
65
- } from "../chunk-46BRB36R.mjs";
65
+ } from "../chunk-DPPPJ3OP.mjs";
66
66
  import {
67
67
  getRoleId,
68
68
  getStripePublishableKey,
@@ -7891,6 +7891,10 @@ function useCurrentUserContext() {
7891
7891
  return context;
7892
7892
  }
7893
7893
  __name(useCurrentUserContext, "useCurrentUserContext");
7894
+ function useCurrentUserContextOptional() {
7895
+ return useContext14(CurrentUserContext);
7896
+ }
7897
+ __name(useCurrentUserContextOptional, "useCurrentUserContextOptional");
7894
7898
 
7895
7899
  // src/features/user/contexts/UserContext.tsx
7896
7900
  import { useTranslations as useTranslations23 } from "next-intl";
@@ -10381,7 +10385,7 @@ import { useRef as useRef17 } from "react";
10381
10385
  import dynamic from "next/dynamic";
10382
10386
  import React18 from "react";
10383
10387
  import { jsx as jsx90 } from "react/jsx-runtime";
10384
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-QG5OWH5K.mjs"), {
10388
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-JZHEGPUW.mjs"), {
10385
10389
  ssr: false
10386
10390
  });
10387
10391
  var BlockNoteEditorContainer = React18.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -20904,7 +20908,7 @@ function HowToCommandViewer({ howTo, onBack, onStartChat }) {
20904
20908
  },
20905
20909
  heading.id
20906
20910
  )) }) }),
20907
- /* @__PURE__ */ jsx230("div", { id: "howto-viewer-content", className: "min-w-0 flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx230(BlockNoteEditorContainer, { id: howTo.id, type: "howto", initialContent: howTo.description }) })
20911
+ /* @__PURE__ */ jsx230("div", { id: "howto-viewer-content", className: "min-w-0 flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx230(BlockNoteViewerContainer, { content: howTo.description }) })
20908
20912
  ] }),
20909
20913
  onStartChat && /* @__PURE__ */ jsx230("div", { className: "flex items-center justify-end gap-2 border-t px-4 py-3", children: /* @__PURE__ */ jsxs133(Button, { onClick: onStartChat, variant: "default", size: "sm", children: [
20910
20914
  /* @__PURE__ */ jsx230(MessageSquare, { className: "me-2 h-4 w-4" }),
@@ -20926,7 +20930,7 @@ function matchPage(pathname, pattern) {
20926
20930
  return pathname.toLowerCase().includes(pattern.toLowerCase());
20927
20931
  }
20928
20932
  __name(matchPage, "matchPage");
20929
- function HowToCommand({ pathname, extraGroups, onStartChat }) {
20933
+ function HowToCommand({ pathname, contextKeys, extraGroups, onStartChat }) {
20930
20934
  const t = useTranslations90();
20931
20935
  const [dialogOpen, setDialogOpen] = useState84(false);
20932
20936
  const [selectedHowTo, setSelectedHowTo] = useState84(null);
@@ -20936,7 +20940,7 @@ function HowToCommand({ pathname, extraGroups, onStartChat }) {
20936
20940
  retriever: /* @__PURE__ */ __name((params) => {
20937
20941
  return HowToService.findMany(params);
20938
20942
  }, "retriever"),
20939
- retrieverParams: {},
20943
+ retrieverParams: { fetchAll: true },
20940
20944
  module: Modules.HowTo
20941
20945
  });
20942
20946
  const { relevantHowTos, otherHowTos } = useMemo39(() => {
@@ -20944,8 +20948,7 @@ function HowToCommand({ pathname, extraGroups, onStartChat }) {
20944
20948
  const relevant = [];
20945
20949
  const other = [];
20946
20950
  data.data.forEach((howTo) => {
20947
- const pages = HowTo.parsePagesFromString(howTo.pages);
20948
- const isRelevant = pages.some((page) => page && matchPage(pathname, page));
20951
+ const isRelevant = contextKeys ? (howTo.contextualKeys ?? []).some((k) => contextKeys.includes(k)) : HowTo.parsePagesFromString(howTo.pages).some((page) => page && matchPage(pathname, page));
20949
20952
  if (isRelevant) {
20950
20953
  relevant.push(howTo);
20951
20954
  } else {
@@ -20953,7 +20956,7 @@ function HowToCommand({ pathname, extraGroups, onStartChat }) {
20953
20956
  }
20954
20957
  });
20955
20958
  return { relevantHowTos: relevant, otherHowTos: other };
20956
- }, [data.data, pathname]);
20959
+ }, [data.data, pathname, contextKeys]);
20957
20960
  const search = useCallback40(
20958
20961
  async (searchedTerm) => {
20959
20962
  if (searchedTerm === searchTermRef.current) return;
@@ -21227,7 +21230,7 @@ __name(HowToReindexButton, "HowToReindexButton");
21227
21230
 
21228
21231
  // src/features/how-to/components/lists/HowToList.tsx
21229
21232
  import { jsx as jsx237 } from "react/jsx-runtime";
21230
- function HowToList({ fullWidth }) {
21233
+ function HowToList({ fullWidth, extraFunctions }) {
21231
21234
  const t = useTranslations94();
21232
21235
  const data = useDataListRetriever({
21233
21236
  module: Modules.HowTo,
@@ -21235,6 +21238,7 @@ function HowToList({ fullWidth }) {
21235
21238
  retrieverParams: {}
21236
21239
  });
21237
21240
  const functions = [
21241
+ ...extraFunctions ?? [],
21238
21242
  /* @__PURE__ */ jsx237(HowToReindexButton, { refresh: data.refresh }, "reindex-how-tos"),
21239
21243
  /* @__PURE__ */ jsx237(HowToEditor, {}, "create-how-to")
21240
21244
  ];
@@ -21254,12 +21258,12 @@ __name(HowToList, "HowToList");
21254
21258
 
21255
21259
  // src/features/how-to/components/containers/HowToListContainer.tsx
21256
21260
  import { jsx as jsx238 } from "react/jsx-runtime";
21257
- function HowToListContainerInternal() {
21258
- return /* @__PURE__ */ jsx238(RoundPageContainer, { module: Modules.HowTo, fullWidth: true, children: /* @__PURE__ */ jsx238(HowToList, { fullWidth: true }) });
21261
+ function HowToListContainerInternal({ extraFunctions }) {
21262
+ return /* @__PURE__ */ jsx238(RoundPageContainer, { module: Modules.HowTo, fullWidth: true, children: /* @__PURE__ */ jsx238(HowToList, { fullWidth: true, extraFunctions }) });
21259
21263
  }
21260
21264
  __name(HowToListContainerInternal, "HowToListContainerInternal");
21261
- function HowToListContainer() {
21262
- return /* @__PURE__ */ jsx238(HowToListContainerInternal, {});
21265
+ function HowToListContainer(props) {
21266
+ return /* @__PURE__ */ jsx238(HowToListContainerInternal, { ...props });
21263
21267
  }
21264
21268
  __name(HowToListContainer, "HowToListContainer");
21265
21269
 
@@ -26441,6 +26445,7 @@ export {
26441
26445
  useSocketContext,
26442
26446
  CurrentUserProvider,
26443
26447
  useCurrentUserContext,
26448
+ useCurrentUserContextOptional,
26444
26449
  Accordion,
26445
26450
  AccordionItem,
26446
26451
  AccordionTrigger,
@@ -27010,4 +27015,4 @@ export {
27010
27015
  useOAuthClients,
27011
27016
  useOAuthClient
27012
27017
  };
27013
- //# sourceMappingURL=chunk-46BRB36R.mjs.map
27018
+ //# sourceMappingURL=chunk-DPPPJ3OP.mjs.map