@carlonicora/nextjs-jsonapi 4.0.7 → 4.1.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 (59) hide show
  1. package/dist/{BlockNoteEditor-J7EF7BRX.js → BlockNoteEditor-6CBMNJPU.js} +9 -9
  2. package/dist/{BlockNoteEditor-J7EF7BRX.js.map → BlockNoteEditor-6CBMNJPU.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-KOHN3SSR.mjs → BlockNoteEditor-7N66JABP.mjs} +2 -2
  4. package/dist/billing/index.js +335 -335
  5. package/dist/billing/index.mjs +1 -1
  6. package/dist/{chunk-3W3VVX2N.mjs → chunk-HQKTQBUC.mjs} +89 -29
  7. package/dist/chunk-HQKTQBUC.mjs.map +1 -0
  8. package/dist/{chunk-3M7D6NXU.js → chunk-MJVEKDM4.js} +320 -260
  9. package/dist/chunk-MJVEKDM4.js.map +1 -0
  10. package/dist/client/index.js +2 -2
  11. package/dist/client/index.mjs +1 -1
  12. package/dist/components/index.d.mts +10 -1
  13. package/dist/components/index.d.ts +10 -1
  14. package/dist/components/index.js +4 -2
  15. package/dist/components/index.js.map +1 -1
  16. package/dist/components/index.mjs +3 -1
  17. package/dist/contexts/index.js +2 -2
  18. package/dist/contexts/index.mjs +1 -1
  19. package/dist/features/analytics/index.js +88 -88
  20. package/dist/features/analytics/index.mjs +1 -1
  21. package/dist/features/help/index.js +31 -31
  22. package/dist/features/help/index.mjs +1 -1
  23. package/dist/features/tokenusage/index.js +75 -75
  24. package/dist/features/tokenusage/index.mjs +1 -1
  25. package/dist/next-config/index.d.mts +8 -1
  26. package/dist/next-config/index.d.ts +8 -1
  27. package/dist/next-config/index.js +31 -9
  28. package/dist/next-config/index.js.map +1 -1
  29. package/dist/next-config/index.mjs +31 -9
  30. package/dist/next-config/index.mjs.map +1 -1
  31. package/package.json +1 -1
  32. package/src/features/company/components/details/CompanyContent.tsx +9 -2
  33. package/src/features/company/components/forms/CompanyEditor.tsx +2 -0
  34. package/src/features/company/hooks/useSubscriptionStatus.test.ts +76 -10
  35. package/src/features/company/hooks/useSubscriptionStatus.ts +9 -9
  36. package/src/features/how-to/components/containers/HowToCommand.spec.tsx +79 -6
  37. package/src/features/how-to/components/containers/HowToCommand.tsx +12 -2
  38. package/src/features/how-to/components/forms/HowToSelector.spec.tsx +85 -0
  39. package/src/features/how-to/components/forms/HowToSelector.tsx +1 -0
  40. package/src/features/role/components/forms/UserRoleAdd.spec.tsx +71 -0
  41. package/src/features/role/components/forms/UserRoleAdd.tsx +1 -0
  42. package/src/features/user/components/forms/UserSelector.spec.tsx +85 -0
  43. package/src/features/user/components/forms/UserSelector.tsx +1 -0
  44. package/src/features/user/components/lists/UserListInAdd.spec.tsx +84 -0
  45. package/src/features/user/components/lists/UserListInAdd.tsx +1 -0
  46. package/src/features/user/components/widgets/UserSearchPopover.spec.tsx +68 -0
  47. package/src/features/user/components/widgets/UserSearchPopover.tsx +1 -0
  48. package/src/next-config/__tests__/createNextConfig.test.ts +45 -3
  49. package/src/next-config/csp.ts +25 -4
  50. package/src/next-config/index.ts +19 -12
  51. package/src/shadcnui/custom/multi-select.spec.tsx +70 -0
  52. package/src/shadcnui/custom/multi-select.tsx +26 -2
  53. package/src/shadcnui/custom/multiple-selector.spec.tsx +111 -0
  54. package/src/shadcnui/custom/multiple-selector.tsx +33 -10
  55. package/src/shadcnui/ui/command.spec.ts +26 -0
  56. package/src/shadcnui/ui/command.tsx +13 -1
  57. package/dist/chunk-3M7D6NXU.js.map +0 -1
  58. package/dist/chunk-3W3VVX2N.mjs.map +0 -1
  59. /package/dist/{BlockNoteEditor-KOHN3SSR.mjs.map → BlockNoteEditor-7N66JABP.mjs.map} +0 -0
@@ -62,7 +62,7 @@ import {
62
62
  useCurrentUserContext,
63
63
  useDataListRetriever,
64
64
  usePageUrlGenerator
65
- } from "../chunk-3W3VVX2N.mjs";
65
+ } from "../chunk-HQKTQBUC.mjs";
66
66
  import {
67
67
  getStripePublishableKey
68
68
  } from "../chunk-XTOEN5GN.mjs";
@@ -1763,7 +1763,7 @@ function useComboboxAnchor() {
1763
1763
  __name(useComboboxAnchor, "useComboboxAnchor");
1764
1764
 
1765
1765
  // src/shadcnui/ui/command.tsx
1766
- import { Command as CommandPrimitive } from "cmdk";
1766
+ import { Command as CommandPrimitive, defaultFilter } from "cmdk";
1767
1767
 
1768
1768
  // src/shadcnui/ui/dialog.tsx
1769
1769
  import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
@@ -2012,6 +2012,7 @@ function CommandShortcut({ className, ...props }) {
2012
2012
  );
2013
2013
  }
2014
2014
  __name(CommandShortcut, "CommandShortcut");
2015
+ var commandFilterByKeywords = /* @__PURE__ */ __name((value, search, keywords) => defaultFilter(keywords && keywords.length > 0 ? keywords.join(" ") : value, search), "commandFilterByKeywords");
2015
2016
 
2016
2017
  // src/shadcnui/ui/confirm-dialog.tsx
2017
2018
  import * as React6 from "react";
@@ -5547,6 +5548,9 @@ var multiSelectVariants = cva11(
5547
5548
  }
5548
5549
  }
5549
5550
  );
5551
+ var SELECT_ALL_VALUE = "__multi-select:select-all__";
5552
+ var CLEAR_VALUE = "__multi-select:clear__";
5553
+ var CLOSE_VALUE = "__multi-select:close__";
5550
5554
  var MultiSelect = React12.forwardRef(
5551
5555
  ({
5552
5556
  options,
@@ -5737,7 +5741,7 @@ var MultiSelect = React12.forwardRef(
5737
5741
  className: "w-auto p-0",
5738
5742
  style: { minWidth: triggerWidth > 0 ? triggerWidth : void 0 },
5739
5743
  align: "start",
5740
- children: /* @__PURE__ */ jsxs24(Command, { children: [
5744
+ children: /* @__PURE__ */ jsxs24(Command, { filter: commandFilterByKeywords, children: [
5741
5745
  /* @__PURE__ */ jsx50(
5742
5746
  CommandInput,
5743
5747
  {
@@ -5754,6 +5758,8 @@ var MultiSelect = React12.forwardRef(
5754
5758
  !hideSelectAll && /* @__PURE__ */ jsxs24(
5755
5759
  CommandItem,
5756
5760
  {
5761
+ value: SELECT_ALL_VALUE,
5762
+ keywords: ["(Select All)"],
5757
5763
  onSelect: toggleAll,
5758
5764
  className: "cursor-pointer hover:bg-muted data-selected:hover:bg-muted bg-transparent data-selected:bg-transparent",
5759
5765
  children: [
@@ -5777,6 +5783,8 @@ var MultiSelect = React12.forwardRef(
5777
5783
  return /* @__PURE__ */ jsxs24(
5778
5784
  CommandItem,
5779
5785
  {
5786
+ value: option.value,
5787
+ keywords: [option.label],
5780
5788
  onSelect: () => toggleOption(option.value),
5781
5789
  className: "cursor-pointer hover:bg-muted data-selected:hover:bg-muted bg-transparent data-selected:bg-transparent",
5782
5790
  children: [
@@ -5801,12 +5809,23 @@ var MultiSelect = React12.forwardRef(
5801
5809
  /* @__PURE__ */ jsx50(CommandSeparator, {}),
5802
5810
  /* @__PURE__ */ jsx50(CommandGroup, { children: /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5803
5811
  selectedValues.length > 0 && /* @__PURE__ */ jsxs24(Fragment3, { children: [
5804
- /* @__PURE__ */ jsx50(CommandItem, { onSelect: handleClear, className: "flex-1 cursor-pointer justify-center", children: "Clear" }),
5812
+ /* @__PURE__ */ jsx50(
5813
+ CommandItem,
5814
+ {
5815
+ value: CLEAR_VALUE,
5816
+ keywords: ["Clear"],
5817
+ onSelect: handleClear,
5818
+ className: "flex-1 cursor-pointer justify-center",
5819
+ children: "Clear"
5820
+ }
5821
+ ),
5805
5822
  /* @__PURE__ */ jsx50(Separator, { orientation: "vertical", className: "flex h-full min-h-6" })
5806
5823
  ] }),
5807
5824
  /* @__PURE__ */ jsx50(
5808
5825
  CommandItem,
5809
5826
  {
5827
+ value: CLOSE_VALUE,
5828
+ keywords: ["Close"],
5810
5829
  onSelect: () => setIsPopoverOpen(false),
5811
5830
  className: "max-w-full flex-1 cursor-pointer justify-center hover:bg-muted data-selected:hover:bg-muted bg-transparent data-selected:bg-transparent",
5812
5831
  children: "Close"
@@ -5878,6 +5897,8 @@ function removePickedOption(groupOption, picked) {
5878
5897
  return cloneOption;
5879
5898
  }
5880
5899
  __name(removePickedOption, "removePickedOption");
5900
+ var CREATE_VALUE = "__multiple-selector:create__";
5901
+ var rowText = /* @__PURE__ */ __name((value, keywords) => keywords && keywords.length > 0 ? keywords.join(" ") : value, "rowText");
5881
5902
  function isOptionsExist(groupOption, targetOption) {
5882
5903
  for (const [, value] of Object.entries(groupOption)) {
5883
5904
  if (value.some((option) => targetOption.find((p) => p.value === option.value))) {
@@ -6086,17 +6107,19 @@ var MultipleSelector = React13.forwardRef(
6086
6107
  const Item = /* @__PURE__ */ jsx51(
6087
6108
  CommandItem,
6088
6109
  {
6089
- value: inputValue,
6110
+ value: `${CREATE_VALUE}${inputValue}`,
6111
+ keywords: [inputValue],
6090
6112
  className: "cursor-pointer",
6091
6113
  onMouseDown: (e) => {
6092
6114
  e.preventDefault();
6093
6115
  e.stopPropagation();
6094
6116
  },
6095
- onSelect: (value2) => {
6117
+ onSelect: () => {
6096
6118
  if (selected.length >= maxSelected) {
6097
6119
  onMaxSelected?.(selected.length);
6098
6120
  return;
6099
6121
  }
6122
+ const value2 = inputValue.trim();
6100
6123
  setInputValue("");
6101
6124
  const newOptions = [...selected, { value: value2, label: value2 }];
6102
6125
  setSelected(newOptions);
@@ -6122,15 +6145,16 @@ var MultipleSelector = React13.forwardRef(
6122
6145
  }, [creatable, emptyIndicator, onSearch, options]);
6123
6146
  const selectables = React13.useMemo(() => removePickedOption(options, selected), [options, selected]);
6124
6147
  const commandFilter = React13.useCallback(() => {
6125
- if (commandProps?.filter) {
6126
- return commandProps.filter;
6148
+ const customFilter = commandProps?.filter;
6149
+ if (customFilter) {
6150
+ return (value2, search, keywords) => customFilter(rowText(value2, keywords), search, []);
6127
6151
  }
6128
6152
  if (creatable) {
6129
- return (value2, search) => {
6130
- return value2.toLowerCase().includes(search.toLowerCase()) ? 1 : -1;
6153
+ return (value2, search, keywords) => {
6154
+ return rowText(value2, keywords).toLowerCase().includes(search.toLowerCase()) ? 1 : -1;
6131
6155
  };
6132
6156
  }
6133
- return void 0;
6157
+ return commandFilterByKeywords;
6134
6158
  }, [creatable, commandProps?.filter]);
6135
6159
  const displayedBadges = maxDisplayCount ? selected.slice(0, maxDisplayCount) : selected;
6136
6160
  const hiddenCount = maxDisplayCount ? Math.max(0, selected.length - maxDisplayCount) : 0;
@@ -6285,7 +6309,8 @@ var MultipleSelector = React13.forwardRef(
6285
6309
  return /* @__PURE__ */ jsx51(
6286
6310
  CommandItem,
6287
6311
  {
6288
- value: option.label,
6312
+ value: option.value,
6313
+ keywords: [option.label],
6289
6314
  disabled: option.disable,
6290
6315
  onMouseDown: (e) => {
6291
6316
  e.preventDefault();
@@ -6350,7 +6375,8 @@ var MultipleSelector = React13.forwardRef(
6350
6375
  return /* @__PURE__ */ jsx51(
6351
6376
  CommandItem,
6352
6377
  {
6353
- value: option.label,
6378
+ value: option.value,
6379
+ keywords: [option.label],
6354
6380
  disabled: option.disable,
6355
6381
  onMouseDown: (e) => {
6356
6382
  e.preventDefault();
@@ -10561,7 +10587,7 @@ import { useRef as useRef18 } from "react";
10561
10587
  import dynamic from "next/dynamic";
10562
10588
  import React18 from "react";
10563
10589
  import { jsx as jsx90 } from "react/jsx-runtime";
10564
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-KOHN3SSR.mjs"), {
10590
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-7N66JABP.mjs"), {
10565
10591
  ssr: false
10566
10592
  });
10567
10593
  var BlockNoteEditorContainer = React18.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -11997,6 +12023,7 @@ var UserSearchPopover = /* @__PURE__ */ __name(({ children, onSelect, align = "s
11997
12023
  /* @__PURE__ */ jsx109(CommandList, { children: users.length > 0 ? users.map((user) => /* @__PURE__ */ jsxs65(
11998
12024
  CommandItem,
11999
12025
  {
12026
+ value: user.id,
12000
12027
  className: "cursor-pointer hover:bg-muted data-selected:hover:bg-muted bg-transparent data-selected:bg-transparent",
12001
12028
  onSelect: () => handleSelectUser(user.id),
12002
12029
  children: [
@@ -12101,6 +12128,7 @@ function UserSelector({ id, form, label, placeholder, onChange, isRequired = fal
12101
12128
  CommandItem,
12102
12129
  {
12103
12130
  className: "cursor-pointer hover:bg-muted data-selected:hover:bg-muted bg-transparent data-selected:bg-transparent",
12131
+ value: user.id,
12104
12132
  onSelect: () => setUser(user),
12105
12133
  children: [
12106
12134
  /* @__PURE__ */ jsx110(UserAvatar, { user, className: `me-2 h-4 w-4` }),
@@ -12533,6 +12561,7 @@ function UserListInAdd({ data, existingUsers, setSelectedUser, setLevelOpen }) {
12533
12561
  CommandItem,
12534
12562
  {
12535
12563
  className: "cursor-pointer hover:bg-muted data-selected:hover:bg-muted bg-transparent data-selected:bg-transparent",
12564
+ value: user.id,
12536
12565
  onClick: (_e) => {
12537
12566
  setSelectedUser(user);
12538
12567
  setLevelOpen?.(true);
@@ -12663,7 +12692,17 @@ function CompanyContent({ company, actions }) {
12663
12692
  actions && /* @__PURE__ */ jsx132("div", { className: "flex items-center gap-x-2", children: actions })
12664
12693
  ] }),
12665
12694
  /* @__PURE__ */ jsxs74("div", { className: "flex items-start gap-x-6", children: [
12666
- company.logo && /* @__PURE__ */ jsx132(Image5, { src: company.logo, alt: company.name, width: 150, height: 150, className: "rounded-md" }),
12695
+ company.logo && /* @__PURE__ */ jsx132(
12696
+ Image5,
12697
+ {
12698
+ src: company.logo,
12699
+ alt: company.name,
12700
+ width: 150,
12701
+ height: 150,
12702
+ className: "rounded-md",
12703
+ unoptimized: isRemoteImageSrc(company.logo)
12704
+ }
12705
+ ),
12667
12706
  /* @__PURE__ */ jsxs74("div", { className: "flex flex-col gap-y-2", children: [
12668
12707
  company.legal_address && /* @__PURE__ */ jsxs74("div", { className: "text-muted-foreground flex items-center gap-x-2 text-sm", children: [
12669
12708
  /* @__PURE__ */ jsx132(MapPinIcon, { className: "h-4 w-4 shrink-0" }),
@@ -13047,7 +13086,8 @@ function CompanyEditorInternal({
13047
13086
  src: file ? URL.createObjectURL(file) : company?.logo || "",
13048
13087
  alt: "Company Logo",
13049
13088
  width: 200,
13050
- height: 200
13089
+ height: 200,
13090
+ unoptimized: isRemoteImageSrc(file ? void 0 : company?.logo)
13051
13091
  }
13052
13092
  ) : /* @__PURE__ */ jsxs78(Fragment18, { children: [
13053
13093
  /* @__PURE__ */ jsx136(UploadIcon3, { className: "my-4 h-8 w-8" }),
@@ -17215,6 +17255,7 @@ var useCompanyTableStructure = /* @__PURE__ */ __name((params) => {
17215
17255
  import { useMemo as useMemo28 } from "react";
17216
17256
  var TRIAL_DAYS = 14;
17217
17257
  var GRACE_DAYS = 3;
17258
+ var DAY_MS = 1e3 * 60 * 60 * 24;
17218
17259
  var isAdministrator = /* @__PURE__ */ __name((currentUser) => {
17219
17260
  if (!currentUser || !isRolesConfigured()) return false;
17220
17261
  const adminRoleId = getRoleId().Administrator;
@@ -17269,12 +17310,10 @@ function useSubscriptionStatus() {
17269
17310
  };
17270
17311
  }
17271
17312
  const createdAt = new Date(company.createdAt);
17272
- const trialEndsAt = new Date(createdAt);
17273
- trialEndsAt.setDate(trialEndsAt.getDate() + TRIAL_DAYS);
17313
+ const trialEndsAt = new Date(createdAt.getTime() + TRIAL_DAYS * DAY_MS);
17274
17314
  const now = /* @__PURE__ */ new Date();
17275
- const dstShiftMs = (now.getTimezoneOffset() - trialEndsAt.getTimezoneOffset()) * 60 * 1e3;
17276
- const msRemaining = trialEndsAt.getTime() - now.getTime() + dstShiftMs;
17277
- const daysRemaining = Math.ceil(msRemaining / (1e3 * 60 * 60 * 24));
17315
+ const msRemaining = trialEndsAt.getTime() - now.getTime();
17316
+ const daysRemaining = Math.ceil(msRemaining / DAY_MS);
17278
17317
  const trialElapsed = daysRemaining <= 0;
17279
17318
  return {
17280
17319
  status: trialElapsed ? "expired" : "trial",
@@ -21715,14 +21754,32 @@ function HowToCommand({ pathname, contextKeys, extraGroups, onStartChat }) {
21715
21754
  /* @__PURE__ */ jsxs136(CommandList, { className: "max-h-[60vh] overflow-y-auto", children: [
21716
21755
  /* @__PURE__ */ jsx234(CommandEmpty, { children: t(`howto.command.empty`) }),
21717
21756
  !searchTerm && extraGroups,
21718
- relevantHowTos.length > 0 && /* @__PURE__ */ jsx234(CommandGroup, { heading: t(`howto.command.relevant`), children: relevantHowTos.map((howTo) => /* @__PURE__ */ jsxs136(CommandItem, { onSelect: () => setSelectedHowTo(howTo), className: "cursor-pointer", children: [
21719
- /* @__PURE__ */ jsx234(ArrowRight, { className: "h-4 w-4 rtl:rotate-180" }),
21720
- /* @__PURE__ */ jsx234("span", { children: howTo.name })
21721
- ] }, howTo.id)) }),
21722
- otherHowTos.length > 0 && /* @__PURE__ */ jsx234(CommandGroup, { heading: searchTerm ? void 0 : t(`howto.command.all`), children: otherHowTos.map((howTo) => /* @__PURE__ */ jsxs136(CommandItem, { onSelect: () => setSelectedHowTo(howTo), className: "cursor-pointer", children: [
21723
- /* @__PURE__ */ jsx234(ArrowRight, { className: "h-4 w-4 rtl:rotate-180" }),
21724
- /* @__PURE__ */ jsx234("span", { children: howTo.name })
21725
- ] }, howTo.id)) })
21757
+ relevantHowTos.length > 0 && /* @__PURE__ */ jsx234(CommandGroup, { heading: t(`howto.command.relevant`), children: relevantHowTos.map((howTo) => /* @__PURE__ */ jsxs136(
21758
+ CommandItem,
21759
+ {
21760
+ value: howTo.id,
21761
+ onSelect: () => setSelectedHowTo(howTo),
21762
+ className: "cursor-pointer",
21763
+ children: [
21764
+ /* @__PURE__ */ jsx234(ArrowRight, { className: "h-4 w-4 rtl:rotate-180" }),
21765
+ /* @__PURE__ */ jsx234("span", { children: howTo.name })
21766
+ ]
21767
+ },
21768
+ howTo.id
21769
+ )) }),
21770
+ otherHowTos.length > 0 && /* @__PURE__ */ jsx234(CommandGroup, { heading: searchTerm ? void 0 : t(`howto.command.all`), children: otherHowTos.map((howTo) => /* @__PURE__ */ jsxs136(
21771
+ CommandItem,
21772
+ {
21773
+ value: howTo.id,
21774
+ onSelect: () => setSelectedHowTo(howTo),
21775
+ className: "cursor-pointer",
21776
+ children: [
21777
+ /* @__PURE__ */ jsx234(ArrowRight, { className: "h-4 w-4 rtl:rotate-180" }),
21778
+ /* @__PURE__ */ jsx234("span", { children: howTo.name })
21779
+ ]
21780
+ },
21781
+ howTo.id
21782
+ )) })
21726
21783
  ] }),
21727
21784
  /* @__PURE__ */ jsxs136("div", { className: "text-muted-foreground flex items-center justify-center gap-4 border-t px-3 py-2 text-xs", children: [
21728
21785
  /* @__PURE__ */ jsxs136("span", { className: "flex items-center gap-1", children: [
@@ -22026,6 +22083,7 @@ function HowToSelector({
22026
22083
  CommandItem,
22027
22084
  {
22028
22085
  className: "cursor-pointer hover:bg-muted data-selected:hover:bg-muted bg-transparent data-selected:bg-transparent",
22086
+ value: howTo.id,
22029
22087
  onSelect: () => setHowTo(howTo),
22030
22088
  children: howTo.name
22031
22089
  },
@@ -25394,6 +25452,7 @@ function UserRoleAdd({ user, refresh }) {
25394
25452
  CommandItem,
25395
25453
  {
25396
25454
  className: "cursor-pointer hover:bg-muted data-selected:hover:bg-muted bg-transparent data-selected:bg-transparent",
25455
+ value: role.id,
25397
25456
  onSelect: () => addUserToRole(role),
25398
25457
  onClick: () => addUserToRole(role),
25399
25458
  children: t(`role.roles`, { role: role.id.replaceAll(`-`, ``) })
@@ -27451,6 +27510,7 @@ export {
27451
27510
  CommandSeparator,
27452
27511
  CommandItem,
27453
27512
  CommandShortcut,
27513
+ commandFilterByKeywords,
27454
27514
  ConfirmDialog,
27455
27515
  ContextMenu,
27456
27516
  ContextMenuPortal,
@@ -27922,4 +27982,4 @@ export {
27922
27982
  useOAuthClients,
27923
27983
  useOAuthClient
27924
27984
  };
27925
- //# sourceMappingURL=chunk-3W3VVX2N.mjs.map
27985
+ //# sourceMappingURL=chunk-HQKTQBUC.mjs.map