dirk-cfx-react 1.1.87 → 1.1.90

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.
@@ -300,11 +300,35 @@ function reportMissingLocale(key) {
300
300
  fetchNui("REPORT_MISSING_LOCALE", { key }).catch(() => {
301
301
  });
302
302
  }
303
+ var PACKAGE_DEFAULTS = {
304
+ "OccupantsDesc": "Here you can view and manage the occupants of your traphouse. These occupants can be used mainly for selling drugs to the NPCs surrounding your traphouse. However they have other uses to so be careful who you add as an occupant.",
305
+ "cfgpanel_discard": "Discard",
306
+ "cfgpanel_manual_edit": "Manual Edit",
307
+ "cfgpanel_reset_defaults": "Reset Defaults",
308
+ "cfgpanel_version": "Version",
309
+ "cfgpanel_back_title": "Back to script list",
310
+ "cfgpanel_undo": "Undo",
311
+ "cfgpanel_redo": "Redo",
312
+ "cfgpanel_save": "Save",
313
+ "cfgpanel_saving": "Saving...",
314
+ "cfgpanel_history": "History",
315
+ "cfgpanel_reset_title": "Reset to Defaults",
316
+ "cfgpanel_reset_desc": "This will permanently reset ALL config back to the defaults. Every value you have configured will be overwritten. This cannot be undone.",
317
+ "cfgpanel_reset_confirm": "Reset Config",
318
+ "cfgpanel_discard_title": "Discard Unsaved Changes?",
319
+ "cfgpanel_discard_desc_back": "You have unsaved changes. Going back now will discard them.",
320
+ "cfgpanel_discard_desc_close": "You have unsaved changes. Closing now will discard them.",
321
+ "cfgpanel_discard_confirm_back": "Go Back Without Saving",
322
+ "cfgpanel_discard_confirm_close": "Close Without Saving",
323
+ "cfgpanel_json_title": "Config JSON",
324
+ "cfgpanel_cancel": "Cancel",
325
+ "cfgpanel_apply": "Apply",
326
+ "cfgpanel_history_title": "Config History",
327
+ "cfgpanel_close": "Close"
328
+ };
303
329
  var localeStore = create((set, get) => {
304
330
  return {
305
- locales: {
306
- "OccupantsDesc": "Here you can view and manage the occupants of your traphouse. These occupants can be used mainly for selling drugs to the NPCs surrounding your traphouse. However they have other uses to so be careful who you add as an occupant."
307
- },
331
+ locales: { ...PACKAGE_DEFAULTS },
308
332
  locale: (key, ...args) => {
309
333
  const exists = get().locales[key];
310
334
  if (!exists) reportMissingLocale(key);
@@ -318,7 +342,7 @@ var localeStore = create((set, get) => {
318
342
  });
319
343
  var locale = localeStore.getState().locale;
320
344
  registerInitialFetch("GET_LOCALES", void 0).then((data) => {
321
- localeStore.setState({ locales: data });
345
+ localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...data } });
322
346
  }).catch(() => {
323
347
  });
324
348
  if (typeof window !== "undefined") {
@@ -326,7 +350,8 @@ if (typeof window !== "undefined") {
326
350
  const msg = event.data;
327
351
  if (!msg || msg.action !== "UPDATE_DIRK_LIB_LOCALES") return;
328
352
  if (!msg.data || typeof msg.data !== "object") return;
329
- localeStore.setState({ locales: msg.data });
353
+ if (Object.keys(msg.data).length === 0) return;
354
+ localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...msg.data } });
330
355
  });
331
356
  }
332
357
 
@@ -852,15 +877,21 @@ var useFrameworkGroups = create(() => ({
852
877
  gangs: [],
853
878
  loaded: false
854
879
  }));
855
- registerInitialFetch("GET_FRAMEWORK_GROUPS", void 0).then((data) => {
856
- useFrameworkGroups.setState({
857
- jobs: Array.isArray(data?.jobs) ? data.jobs : [],
858
- gangs: Array.isArray(data?.gangs) ? data.gangs : [],
859
- loaded: true
880
+ var frameworkGroupsRequested = false;
881
+ function ensureFrameworkGroups() {
882
+ if (frameworkGroupsRequested) return;
883
+ frameworkGroupsRequested = true;
884
+ fetchNui("GET_FRAMEWORK_GROUPS", void 0).then((data) => {
885
+ useFrameworkGroups.setState({
886
+ jobs: Array.isArray(data?.jobs) ? data.jobs : [],
887
+ gangs: Array.isArray(data?.gangs) ? data.gangs : [],
888
+ loaded: true
889
+ });
890
+ }).catch(() => {
891
+ frameworkGroupsRequested = false;
892
+ useFrameworkGroups.setState({ loaded: true });
860
893
  });
861
- }).catch(() => {
862
- useFrameworkGroups.setState({ loaded: true });
863
- });
894
+ }
864
895
  function selectAllGroups(state) {
865
896
  return [...state.jobs, ...state.gangs];
866
897
  }
@@ -1280,6 +1311,6 @@ var GTA_CONTROL_GROUP_ORDER = [
1280
1311
  "Misc"
1281
1312
  ];
1282
1313
 
1283
- export { GTA_CONTROLS, GTA_CONTROL_GROUP_ORDER, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, colorWithAlpha, copyToClipboard, createSkill, 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 };
1314
+ export { GTA_CONTROLS, GTA_CONTROL_GROUP_ORDER, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, 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 };
1284
1315
  //# sourceMappingURL=index.js.map
1285
1316
  //# sourceMappingURL=index.js.map