dirk-cfx-react 1.1.92 → 1.1.93

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/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { AccessOverrideSection, AccessOverrideSectionProps, AccessOverrideValue, AccountSelect, AccountSelectProps, ActiveTool, AdminPageTitle, AdminPageTitleProps, AnimPostFxSelect, AnimPostFxSelectProps, AsyncSaveButton, BlipColorSelect, BlipColorSelectProps, BlipDisplaySelect, BlipDisplaySelectProps, BlipIconSelect, BlipIconSelectProps, BlipMarker, BlipMarkerProps, BorderedIcon, BorderedIconProps, ButtonProps, ConfigPanel, ConfigPanelProps, ConfirmModal, ConfirmModalProps, ControlMultiSelect, ControlMultiSelectProps, ControlSelect, ControlSelectProps, Counter, DiscordRole, DiscordRoleSelect, DiscordRoleSelectProps, DoorPickerButton, FiveMControls, FiveMKeyBindInput, FloatingParticles, FloatingParticlesProps, FrameworkAccount, GroupName, GroupNameProps, GroupRank, GroupRankProps, GroupSelect, GroupSelectProps, GroupType, GroupValue, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, InstructionKey, InstructionPanel, InstructionPanelProps, LevelBanner, LevelPanel, Map, MapLayer, MapProps, MapStyle, MissingItemsBanner, Modal, ModalContext, ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavItem, NavigationContext, NavigationProvider, NavigationStore, ParticleState, PickedDoor, PickedDoorGroup, PlayerSelect, PlayerSelectProps, PositionPicker, PositionPickerProps, ProgressProps, Prompt, PromptButton, PromptModal, ScenarioSelect, ScenarioSelectProps, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, SelectItem, SelectItemProps, StoreModalProps, SwitchPanel, SwitchPanelProps, TestBed, TestBedItem, TestBedPlacement, TestBedProps, ThemeOverrideSection, ThemeOverrideSectionProps, Title, TitleProps, TitleSize, Vector4DeleteButton, Vector4Display, Vector4Value, WorldPositionGotoButton, WorldPositionPicker, WorldPositionPickerSlot, WorldPositionSetButton, ZoomControls, blipUrl, blipUrlForSprite, getBlipColor, getBlipEntry, useAdminToolStore, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore, usePickDoor } from './components/index.cjs';
2
2
  export { FrameworkGrade, FrameworkGroup, GTA_CONTROLS, GTA_CONTROL_GROUP_ORDER, GtaControl, GtaControlGroup, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InitialFetch, InternalEvent, InventoryItem, InventoryItems, SettingsState, SkillSettings, UploadImageProps, colorWithAlpha, copyToClipboard, createSkill, ensureFrameworkGroups, extractDefaults, fetchLuaTable, fetchNui, formatGtaControl, gameToMap, getGtaControl, getImageShape, getItemImageUrl, initialFetches, internalEvent, isEnvBrowser, isProfanity, latPr100, locale, localeStore, mapCenter, mapToGame, noop, numberToRoman, openLink, registerInitialFetch, registerInitialLuaTableFetch, runFetches, selectAllGroups, splitFAString, updatePresignedURL, uploadImage, useAutoFetcher, useFrameworkGroups, useItems, useItemsList, useProfanityStore, useSettings } from './utils/index.cjs';
3
- export { FormProvider, FormState, NuiHandlerSignature, NuiMessageData, ScriptConfigHistoryChange, ScriptConfigHistoryEntry, ScriptConfigHistoryRequest, ScriptConfigHistoryResponse, ScriptConfigInstance, TornEdgeSVGFilter, ValidationRules, ValidatorFn, clearAdminState, createFormStore, createScriptConfig, getScriptConfigInstance, useAdminState, useAudio, useForm, useFormActions, useFormError, useFormErrors, useFormField, useFormFields, useNuiEvent, useTornEdges, useValidModels } from './hooks/index.cjs';
3
+ export { FormProvider, FormState, NuiHandlerSignature, NuiMessageData, ScriptConfigHistoryChange, ScriptConfigHistoryEntry, ScriptConfigHistoryRequest, ScriptConfigHistoryResponse, ScriptConfigInstance, ServerOnlyScriptConfigResponse, TornEdgeSVGFilter, ValidationRules, ValidatorFn, clearAdminState, createFormStore, createScriptConfig, getScriptConfigInstance, useAdminState, useAudio, useForm, useFormActions, useFormError, useFormErrors, useFormField, useFormFields, useNuiEvent, useTornEdges, useValidModels } from './hooks/index.cjs';
4
4
  export { P as Player, U as UsePlayersOptions, a as UsePlayersResult, u as usePlayers } from './usePlayers-BlGBBevs.cjs';
5
5
  export { DirkProvider, DirkProviderProps, dirkQueryClient } from './providers/index.cjs';
6
6
  import { z } from 'zod';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { AccessOverrideSection, AccessOverrideSectionProps, AccessOverrideValue, AccountSelect, AccountSelectProps, ActiveTool, AdminPageTitle, AdminPageTitleProps, AnimPostFxSelect, AnimPostFxSelectProps, AsyncSaveButton, BlipColorSelect, BlipColorSelectProps, BlipDisplaySelect, BlipDisplaySelectProps, BlipIconSelect, BlipIconSelectProps, BlipMarker, BlipMarkerProps, BorderedIcon, BorderedIconProps, ButtonProps, ConfigPanel, ConfigPanelProps, ConfirmModal, ConfirmModalProps, ControlMultiSelect, ControlMultiSelectProps, ControlSelect, ControlSelectProps, Counter, DiscordRole, DiscordRoleSelect, DiscordRoleSelectProps, DoorPickerButton, FiveMControls, FiveMKeyBindInput, FloatingParticles, FloatingParticlesProps, FrameworkAccount, GroupName, GroupNameProps, GroupRank, GroupRankProps, GroupSelect, GroupSelectProps, GroupType, GroupValue, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, InstructionKey, InstructionPanel, InstructionPanelProps, LevelBanner, LevelPanel, Map, MapLayer, MapProps, MapStyle, MissingItemsBanner, Modal, ModalContext, ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavItem, NavigationContext, NavigationProvider, NavigationStore, ParticleState, PickedDoor, PickedDoorGroup, PlayerSelect, PlayerSelectProps, PositionPicker, PositionPickerProps, ProgressProps, Prompt, PromptButton, PromptModal, ScenarioSelect, ScenarioSelectProps, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, SelectItem, SelectItemProps, StoreModalProps, SwitchPanel, SwitchPanelProps, TestBed, TestBedItem, TestBedPlacement, TestBedProps, ThemeOverrideSection, ThemeOverrideSectionProps, Title, TitleProps, TitleSize, Vector4DeleteButton, Vector4Display, Vector4Value, WorldPositionGotoButton, WorldPositionPicker, WorldPositionPickerSlot, WorldPositionSetButton, ZoomControls, blipUrl, blipUrlForSprite, getBlipColor, getBlipEntry, useAdminToolStore, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore, usePickDoor } from './components/index.js';
2
2
  export { FrameworkGrade, FrameworkGroup, GTA_CONTROLS, GTA_CONTROL_GROUP_ORDER, GtaControl, GtaControlGroup, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InitialFetch, InternalEvent, InventoryItem, InventoryItems, SettingsState, SkillSettings, UploadImageProps, colorWithAlpha, copyToClipboard, createSkill, ensureFrameworkGroups, extractDefaults, fetchLuaTable, fetchNui, formatGtaControl, gameToMap, getGtaControl, getImageShape, getItemImageUrl, initialFetches, internalEvent, isEnvBrowser, isProfanity, latPr100, locale, localeStore, mapCenter, mapToGame, noop, numberToRoman, openLink, registerInitialFetch, registerInitialLuaTableFetch, runFetches, selectAllGroups, splitFAString, updatePresignedURL, uploadImage, useAutoFetcher, useFrameworkGroups, useItems, useItemsList, useProfanityStore, useSettings } from './utils/index.js';
3
- export { FormProvider, FormState, NuiHandlerSignature, NuiMessageData, ScriptConfigHistoryChange, ScriptConfigHistoryEntry, ScriptConfigHistoryRequest, ScriptConfigHistoryResponse, ScriptConfigInstance, TornEdgeSVGFilter, ValidationRules, ValidatorFn, clearAdminState, createFormStore, createScriptConfig, getScriptConfigInstance, useAdminState, useAudio, useForm, useFormActions, useFormError, useFormErrors, useFormField, useFormFields, useNuiEvent, useTornEdges, useValidModels } from './hooks/index.js';
3
+ export { FormProvider, FormState, NuiHandlerSignature, NuiMessageData, ScriptConfigHistoryChange, ScriptConfigHistoryEntry, ScriptConfigHistoryRequest, ScriptConfigHistoryResponse, ScriptConfigInstance, ServerOnlyScriptConfigResponse, TornEdgeSVGFilter, ValidationRules, ValidatorFn, clearAdminState, createFormStore, createScriptConfig, getScriptConfigInstance, useAdminState, useAudio, useForm, useFormActions, useFormError, useFormErrors, useFormField, useFormFields, useNuiEvent, useTornEdges, useValidModels } from './hooks/index.js';
4
4
  export { P as Player, U as UsePlayersOptions, a as UsePlayersResult, u as usePlayers } from './usePlayers-BlGBBevs.js';
5
5
  export { DirkProvider, DirkProviderProps, dirkQueryClient } from './providers/index.js';
6
6
  import { z } from 'zod';
package/dist/index.js CHANGED
@@ -4678,6 +4678,21 @@ function mergeMantineThemeSafe(base, custom, override) {
4678
4678
  }
4679
4679
  };
4680
4680
  }
4681
+ function isPlainObject2(v) {
4682
+ return typeof v === "object" && v !== null && !Array.isArray(v);
4683
+ }
4684
+ function deepMerge(base, patch) {
4685
+ if (!isPlainObject2(base) || !isPlainObject2(patch)) {
4686
+ return patch ?? base;
4687
+ }
4688
+ const out = { ...base };
4689
+ for (const key of Object.keys(patch)) {
4690
+ const patchVal = patch[key];
4691
+ const baseVal = out[key];
4692
+ out[key] = isPlainObject2(baseVal) && isPlainObject2(patchVal) ? deepMerge(baseVal, patchVal) : patchVal;
4693
+ }
4694
+ return out;
4695
+ }
4681
4696
  function changedTopLevelSections(changedFields) {
4682
4697
  if (!changedFields || changedFields.length === 0) return [];
4683
4698
  const sections = /* @__PURE__ */ new Set();
@@ -4724,6 +4739,24 @@ function createScriptConfig(defaultValue) {
4724
4739
  }
4725
4740
  return null;
4726
4741
  };
4742
+ const fetchServerOnlyScriptConfig = async () => {
4743
+ try {
4744
+ const response = await fetchNui(
4745
+ "GET_SERVER_ONLY_SCRIPT_CONFIG"
4746
+ );
4747
+ if (response?.success && response.data) {
4748
+ if (typeof response.data.clientVersion === "number") {
4749
+ clientVersion = response.data.clientVersion;
4750
+ }
4751
+ const sliver = response.data.serverOnly;
4752
+ const merged = deepMerge(store2.getState(), sliver ?? {});
4753
+ store2.setState(() => merged);
4754
+ return merged;
4755
+ }
4756
+ } catch {
4757
+ }
4758
+ return null;
4759
+ };
4727
4760
  const updateScriptConfig = async (newConfig, changedFields) => {
4728
4761
  store2.setState((prev) => ({ ...prev, ...newConfig }));
4729
4762
  const sections = changedTopLevelSections(changedFields);
@@ -4751,10 +4784,7 @@ function createScriptConfig(defaultValue) {
4751
4784
  const resetConfig = async () => {
4752
4785
  const response = await fetchNui("RESET_SCRIPT_CONFIG");
4753
4786
  if (response?.success) {
4754
- const fresh = await fetchScriptConfig();
4755
- if (fresh) {
4756
- store2.setState(() => fresh);
4757
- }
4787
+ await fetchServerOnlyScriptConfig();
4758
4788
  }
4759
4789
  return response;
4760
4790
  };
@@ -4763,9 +4793,10 @@ function createScriptConfig(defaultValue) {
4763
4793
  updateConfig: updateScriptConfig,
4764
4794
  resetConfig,
4765
4795
  getHistory: getScriptConfigHistory,
4766
- fetchConfig: fetchScriptConfig
4796
+ fetchConfig: fetchScriptConfig,
4797
+ fetchServerOnly: fetchServerOnlyScriptConfig
4767
4798
  };
4768
- return { store: store2, updateScriptConfig, resetConfig, getScriptConfigHistory, useScriptConfigHooks, fetchScriptConfig };
4799
+ return { store: store2, updateScriptConfig, resetConfig, getScriptConfigHistory, useScriptConfigHooks, fetchScriptConfig, fetchServerOnlyScriptConfig };
4769
4800
  }
4770
4801
  var DirkErrorBoundary = class extends React4.Component {
4771
4802
  constructor() {
@@ -4952,12 +4983,6 @@ function DirkProvider({ children, overideResourceName, themeOverride }) {
4952
4983
  setScTheme(s?.theme ?? null);
4953
4984
  });
4954
4985
  }
4955
- inst.fetchConfig?.().then((full) => {
4956
- if (full && typeof full === "object") {
4957
- setScTheme(full.theme ?? null);
4958
- }
4959
- }).catch(() => {
4960
- });
4961
4986
  } catch {
4962
4987
  }
4963
4988
  return () => {
@@ -5577,11 +5602,11 @@ function cloneConfig(value) {
5577
5602
  return JSON.parse(JSON.stringify(value));
5578
5603
  }
5579
5604
  function ServerOnlyFetcher() {
5580
- const { fetchConfig } = getScriptConfigInstance();
5605
+ const { fetchServerOnly } = getScriptConfigInstance();
5581
5606
  const { reinitialize } = useFormActions();
5582
5607
  useEffect(() => {
5583
5608
  let cancelled = false;
5584
- fetchConfig().then((full) => {
5609
+ fetchServerOnly().then((full) => {
5585
5610
  if (!cancelled && full) reinitialize(full);
5586
5611
  }).catch(() => {
5587
5612
  });