sgerp-frontend-lib 0.1.3 → 0.1.5

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 (74) hide show
  1. package/dist/constants/timezones.d.ts +23 -0
  2. package/dist/constants/timezones.d.ts.map +1 -0
  3. package/dist/constants/timezones.js +107 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +2 -0
  7. package/dist/locales/locale-server.d.ts +1 -1
  8. package/dist/locales/locale-server.d.ts.map +1 -1
  9. package/dist/locales/locale-server.js +5 -0
  10. package/dist/locales/locale.d.ts +1 -1
  11. package/dist/locales/locale.d.ts.map +1 -1
  12. package/dist/locales/locale.js +6 -2
  13. package/dist/locales/locale_en.d.ts.map +1 -1
  14. package/dist/locales/locale_en.js +77 -1
  15. package/dist/locales/locale_id.d.ts +2 -0
  16. package/dist/locales/locale_id.d.ts.map +1 -0
  17. package/dist/locales/locale_id.js +2473 -0
  18. package/dist/locales/locale_ja.d.ts.map +1 -1
  19. package/dist/locales/locale_ja.js +76 -1
  20. package/dist/locales/locale_ms.d.ts.map +1 -1
  21. package/dist/locales/locale_ms.js +60 -1
  22. package/dist/locales/locale_tl.d.ts +2 -0
  23. package/dist/locales/locale_tl.d.ts.map +1 -0
  24. package/dist/locales/locale_tl.js +1122 -0
  25. package/dist/markdown.d.ts +33 -0
  26. package/dist/markdown.d.ts.map +1 -0
  27. package/dist/markdown.js +117 -0
  28. package/dist/sgerp/collection.d.ts.map +1 -1
  29. package/dist/sgerp/collection.js +18 -4
  30. package/dist/sgerp/domains.d.ts +16 -2
  31. package/dist/sgerp/domains.d.ts.map +1 -1
  32. package/dist/sgerp/domains.js +47 -1
  33. package/dist/sgerp/hooks/use-selection-state.d.ts +37 -0
  34. package/dist/sgerp/hooks/use-selection-state.d.ts.map +1 -0
  35. package/dist/sgerp/hooks/use-selection-state.js +121 -0
  36. package/dist/sgerp/hooks/use-simulation-data.d.ts +105 -0
  37. package/dist/sgerp/hooks/use-simulation-data.d.ts.map +1 -0
  38. package/dist/sgerp/hooks/use-simulation-data.js +146 -0
  39. package/dist/sgerp/hooks/use-simulation-state.d.ts +80 -0
  40. package/dist/sgerp/hooks/use-simulation-state.d.ts.map +1 -0
  41. package/dist/sgerp/hooks/use-simulation-state.js +161 -0
  42. package/dist/sgerp/index.d.ts +24 -2
  43. package/dist/sgerp/index.d.ts.map +1 -1
  44. package/dist/sgerp/index.js +62 -2
  45. package/dist/sgerp/simulation-logic/fetchUtils.d.ts.map +1 -1
  46. package/dist/sgerp/simulation-logic/fetchUtils.js +2 -0
  47. package/dist/sgerp/simulation-logic/index.d.ts +3 -1
  48. package/dist/sgerp/simulation-logic/index.d.ts.map +1 -1
  49. package/dist/sgerp/simulation-logic/index.js +10 -1
  50. package/dist/sgerp/simulation-logic/liveUpdates.d.ts +102 -0
  51. package/dist/sgerp/simulation-logic/liveUpdates.d.ts.map +1 -0
  52. package/dist/sgerp/simulation-logic/liveUpdates.js +87 -0
  53. package/dist/sgerp/simulation-logic/prepareSimulationData.d.ts +36 -0
  54. package/dist/sgerp/simulation-logic/prepareSimulationData.d.ts.map +1 -0
  55. package/dist/sgerp/simulation-logic/prepareSimulationData.js +34 -0
  56. package/dist/sgerp/simulation-logic/routeCalculationUtils.d.ts +7 -1
  57. package/dist/sgerp/simulation-logic/routeCalculationUtils.d.ts.map +1 -1
  58. package/dist/sgerp/simulation-logic/routeCalculationUtils.js +81 -0
  59. package/dist/utils/countries.d.ts +15 -0
  60. package/dist/utils/countries.d.ts.map +1 -0
  61. package/dist/utils/countries.js +112 -0
  62. package/dist/utils.d.ts +3 -0
  63. package/dist/utils.d.ts.map +1 -0
  64. package/dist/utils.js +8 -0
  65. package/dist/vrptoolbox/collection.d.ts +16 -0
  66. package/dist/vrptoolbox/collection.d.ts.map +1 -0
  67. package/dist/vrptoolbox/collection.js +62 -0
  68. package/dist/vrptoolbox/index.d.ts +6 -0
  69. package/dist/vrptoolbox/index.d.ts.map +1 -0
  70. package/dist/vrptoolbox/index.js +8 -0
  71. package/dist/vrptoolbox/types/job.d.ts +46 -0
  72. package/dist/vrptoolbox/types/job.d.ts.map +1 -0
  73. package/dist/vrptoolbox/types/job.js +5 -0
  74. package/package.json +7 -4
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OptimizationJobCollection = void 0;
4
+ const collection_1 = require("../sgerp/collection");
5
+ /**
6
+ * Adapter to convert VRP Toolbox response to SGERP format
7
+ */
8
+ function adaptVRPToolboxResponse(vrpResponse) {
9
+ const { meta, objects } = vrpResponse;
10
+ // Convert VRP Toolbox meta to SGERP meta
11
+ const sgerpMeta = {
12
+ has_more: !!meta.next,
13
+ next: meta.next || null,
14
+ next_offset: meta.next || null,
15
+ };
16
+ return {
17
+ meta: sgerpMeta,
18
+ objects,
19
+ };
20
+ }
21
+ /**
22
+ * Collection class for VRP Toolbox Optimization Jobs
23
+ */
24
+ class OptimizationJobCollection extends collection_1.Collection {
25
+ constructor(baseUrl, username, password) {
26
+ // Create fetch function that adapts VRP Toolbox API to SGERP format
27
+ const fetchFn = async (params) => {
28
+ const searchParams = new URLSearchParams();
29
+ if (params && typeof params === 'object') {
30
+ Object.entries(params).forEach(([key, value]) => {
31
+ if (value !== undefined && value !== null) {
32
+ searchParams.append(key, String(value));
33
+ }
34
+ });
35
+ }
36
+ const url = `${baseUrl}/jobs/list/?${searchParams.toString()}`;
37
+ const headers = {};
38
+ if (username && password) {
39
+ const credentials = btoa(`${username}:${password}`);
40
+ headers['Authorization'] = `Basic ${credentials}`;
41
+ }
42
+ const response = await fetch(url, { headers });
43
+ if (!response.ok) {
44
+ throw new Error(`Failed to fetch jobs: ${response.status} ${response.statusText}`);
45
+ }
46
+ const vrpResponse = await response.json();
47
+ return adaptVRPToolboxResponse(vrpResponse);
48
+ };
49
+ super(fetchFn);
50
+ this.baseUrl = baseUrl;
51
+ this.username = username;
52
+ this.password = password;
53
+ }
54
+ /**
55
+ * Set authentication credentials
56
+ */
57
+ setCredentials(username, password) {
58
+ this.username = username;
59
+ this.password = password;
60
+ }
61
+ }
62
+ exports.OptimizationJobCollection = OptimizationJobCollection;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * VRP Toolbox library exports
3
+ */
4
+ export { OptimizationJobCollection } from './collection';
5
+ export type { OptimizationJob, VRPToolboxListResponse, VRPToolboxMeta, } from './types/job';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../sgerplib/vrptoolbox/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,cAAc,GACf,MAAM,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /**
3
+ * VRP Toolbox library exports
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.OptimizationJobCollection = void 0;
7
+ var collection_1 = require("./collection");
8
+ Object.defineProperty(exports, "OptimizationJobCollection", { enumerable: true, get: function () { return collection_1.OptimizationJobCollection; } });
@@ -0,0 +1,46 @@
1
+ /**
2
+ * VRP Toolbox Optimization Task/Job types
3
+ */
4
+ export interface OptimizationJob {
5
+ id: string;
6
+ status: string;
7
+ type: string;
8
+ created_at: string;
9
+ modified_at?: string;
10
+ processing_started_at?: string;
11
+ processing_completed_at?: string;
12
+ created_by_id?: number;
13
+ creator_username?: string;
14
+ auth_backend?: string;
15
+ executor?: string;
16
+ label?: string;
17
+ project_id?: number;
18
+ error?: string;
19
+ vehicles_count?: number;
20
+ nodes_count?: number;
21
+ solver_parameters_time_limit_ms?: number;
22
+ solver_parameters_first_solution_strategy?: number;
23
+ solver_parameters_use_local_search_metaheuristic?: boolean;
24
+ calculation_parameters_scheduling_mode?: string;
25
+ status_uri?: string;
26
+ result_uri?: string;
27
+ payload_uri?: string;
28
+ result_with_payload_uri?: string;
29
+ }
30
+ /**
31
+ * VRP Toolbox meta (Tastypie-style pagination)
32
+ */
33
+ export interface VRPToolboxMeta {
34
+ limit: number;
35
+ offset: number;
36
+ next?: string | null;
37
+ previous?: string | null;
38
+ }
39
+ /**
40
+ * VRP Toolbox list response (Tastypie format)
41
+ */
42
+ export interface VRPToolboxListResponse<T> {
43
+ meta: VRPToolboxMeta;
44
+ objects: T[];
45
+ }
46
+ //# sourceMappingURL=job.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../../sgerplib/vrptoolbox/types/job.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+BAA+B,CAAC,EAAE,MAAM,CAAC;IACzC,yCAAyC,CAAC,EAAE,MAAM,CAAC;IACnD,gDAAgD,CAAC,EAAE,OAAO,CAAC;IAC3D,sCAAsC,CAAC,EAAE,MAAM,CAAC;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,CAAC,EAAE,CAAC;CACd"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * VRP Toolbox Optimization Task/Job types
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sgerp-frontend-lib",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "TypeScript/React library for interacting with the SGERP API, providing client SDK, Backbone.js-style Collections, and pre-built React components",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -52,6 +52,7 @@
52
52
  "test:e2e:transitstopsets": "playwright test e2e/ptapp/transitstopsets.spec.ts",
53
53
  "test:all": "./run-tests.sh",
54
54
  "test:all:open": "./run-tests.sh --open-coverage",
55
+ "translate": "tsx scripts/translate-locales.ts",
55
56
  "prepare": "husky"
56
57
  },
57
58
  "dependencies": {
@@ -77,6 +78,7 @@
77
78
  "@radix-ui/react-toggle": "^1.1.10",
78
79
  "@radix-ui/react-toggle-group": "^1.1.11",
79
80
  "@radix-ui/react-tooltip": "^1.2.8",
81
+ "@tanstack/react-virtual": "^3.13.12",
80
82
  "class-variance-authority": "^0.7.1",
81
83
  "clsx": "^2.1.1",
82
84
  "cmdk": "^1.1.1",
@@ -86,12 +88,12 @@
86
88
  "lucide-react": "^0.545.0",
87
89
  "mapbox-gl": "^3.16.0",
88
90
  "moment-timezone": "^0.6.0",
89
- "next": "15.5.4",
91
+ "next": "^15.5.7",
90
92
  "next-themes": "^0.4.6",
91
93
  "nuqs": "^2.7.2",
92
- "react": "^19.1.0",
94
+ "react": "^19.0.1",
93
95
  "react-day-picker": "^9.11.1",
94
- "react-dom": "19.1.0",
96
+ "react-dom": "^19.0.1",
95
97
  "react-markdown": "^10.1.0",
96
98
  "rehype-highlight": "^7.0.2",
97
99
  "rehype-slug": "^6.0.0",
@@ -119,6 +121,7 @@
119
121
  "husky": "^9.1.7",
120
122
  "jsdom": "^27.0.1",
121
123
  "tailwindcss": "^4",
124
+ "tsx": "^4.21.0",
122
125
  "tw-animate-css": "^1.4.0",
123
126
  "typescript": "^5",
124
127
  "vitest": "^3.2.4"