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.
@@ -306,11 +306,35 @@ function reportMissingLocale(key) {
306
306
  fetchNui("REPORT_MISSING_LOCALE", { key }).catch(() => {
307
307
  });
308
308
  }
309
+ var PACKAGE_DEFAULTS = {
310
+ "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.",
311
+ "cfgpanel_discard": "Discard",
312
+ "cfgpanel_manual_edit": "Manual Edit",
313
+ "cfgpanel_reset_defaults": "Reset Defaults",
314
+ "cfgpanel_version": "Version",
315
+ "cfgpanel_back_title": "Back to script list",
316
+ "cfgpanel_undo": "Undo",
317
+ "cfgpanel_redo": "Redo",
318
+ "cfgpanel_save": "Save",
319
+ "cfgpanel_saving": "Saving...",
320
+ "cfgpanel_history": "History",
321
+ "cfgpanel_reset_title": "Reset to Defaults",
322
+ "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.",
323
+ "cfgpanel_reset_confirm": "Reset Config",
324
+ "cfgpanel_discard_title": "Discard Unsaved Changes?",
325
+ "cfgpanel_discard_desc_back": "You have unsaved changes. Going back now will discard them.",
326
+ "cfgpanel_discard_desc_close": "You have unsaved changes. Closing now will discard them.",
327
+ "cfgpanel_discard_confirm_back": "Go Back Without Saving",
328
+ "cfgpanel_discard_confirm_close": "Close Without Saving",
329
+ "cfgpanel_json_title": "Config JSON",
330
+ "cfgpanel_cancel": "Cancel",
331
+ "cfgpanel_apply": "Apply",
332
+ "cfgpanel_history_title": "Config History",
333
+ "cfgpanel_close": "Close"
334
+ };
309
335
  var localeStore = zustand.create((set, get) => {
310
336
  return {
311
- locales: {
312
- "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."
313
- },
337
+ locales: { ...PACKAGE_DEFAULTS },
314
338
  locale: (key, ...args) => {
315
339
  const exists = get().locales[key];
316
340
  if (!exists) reportMissingLocale(key);
@@ -324,7 +348,7 @@ var localeStore = zustand.create((set, get) => {
324
348
  });
325
349
  var locale = localeStore.getState().locale;
326
350
  registerInitialFetch("GET_LOCALES", void 0).then((data) => {
327
- localeStore.setState({ locales: data });
351
+ localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...data } });
328
352
  }).catch(() => {
329
353
  });
330
354
  if (typeof window !== "undefined") {
@@ -332,7 +356,8 @@ if (typeof window !== "undefined") {
332
356
  const msg = event.data;
333
357
  if (!msg || msg.action !== "UPDATE_DIRK_LIB_LOCALES") return;
334
358
  if (!msg.data || typeof msg.data !== "object") return;
335
- localeStore.setState({ locales: msg.data });
359
+ if (Object.keys(msg.data).length === 0) return;
360
+ localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...msg.data } });
336
361
  });
337
362
  }
338
363
 
@@ -858,15 +883,21 @@ var useFrameworkGroups = zustand.create(() => ({
858
883
  gangs: [],
859
884
  loaded: false
860
885
  }));
861
- registerInitialFetch("GET_FRAMEWORK_GROUPS", void 0).then((data) => {
862
- useFrameworkGroups.setState({
863
- jobs: Array.isArray(data?.jobs) ? data.jobs : [],
864
- gangs: Array.isArray(data?.gangs) ? data.gangs : [],
865
- loaded: true
886
+ var frameworkGroupsRequested = false;
887
+ function ensureFrameworkGroups() {
888
+ if (frameworkGroupsRequested) return;
889
+ frameworkGroupsRequested = true;
890
+ fetchNui("GET_FRAMEWORK_GROUPS", void 0).then((data) => {
891
+ useFrameworkGroups.setState({
892
+ jobs: Array.isArray(data?.jobs) ? data.jobs : [],
893
+ gangs: Array.isArray(data?.gangs) ? data.gangs : [],
894
+ loaded: true
895
+ });
896
+ }).catch(() => {
897
+ frameworkGroupsRequested = false;
898
+ useFrameworkGroups.setState({ loaded: true });
866
899
  });
867
- }).catch(() => {
868
- useFrameworkGroups.setState({ loaded: true });
869
- });
900
+ }
870
901
  function selectAllGroups(state) {
871
902
  return [...state.jobs, ...state.gangs];
872
903
  }
@@ -1293,6 +1324,7 @@ exports.INPUT_MAPPER_PRIMARY_OPTIONS = INPUT_MAPPER_PRIMARY_OPTIONS;
1293
1324
  exports.colorWithAlpha = colorWithAlpha;
1294
1325
  exports.copyToClipboard = copyToClipboard;
1295
1326
  exports.createSkill = createSkill;
1327
+ exports.ensureFrameworkGroups = ensureFrameworkGroups;
1296
1328
  exports.extractDefaults = extractDefaults;
1297
1329
  exports.fetchLuaTable = fetchLuaTable;
1298
1330
  exports.fetchNui = fetchNui;