@zonetrix/shared 2.4.0 → 2.4.1
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.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -2
- package/dist/index.mjs +6 -2
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -261,14 +261,14 @@ declare function downloadConfigAsFile(config: SeatMapConfig, filename?: string):
|
|
|
261
261
|
/**
|
|
262
262
|
* Firebase seat state type (excludes 'selected' which is client-only, 'hidden' which is filtered)
|
|
263
263
|
*/
|
|
264
|
-
type FirebaseSeatState =
|
|
264
|
+
type FirebaseSeatState = "available" | "reserved" | "unavailable";
|
|
265
265
|
/**
|
|
266
266
|
* Seat state value stored in Firebase (for reserved/unavailable seats)
|
|
267
267
|
* Available seats: key is deleted (doesn't exist)
|
|
268
268
|
* Reserved/Unavailable seats: object with state, userId, and timestamp
|
|
269
269
|
*/
|
|
270
270
|
interface FirebaseSeatStateValue {
|
|
271
|
-
state:
|
|
271
|
+
state: "reserved" | "unavailable";
|
|
272
272
|
userId?: string;
|
|
273
273
|
timestamp?: number;
|
|
274
274
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -261,14 +261,14 @@ declare function downloadConfigAsFile(config: SeatMapConfig, filename?: string):
|
|
|
261
261
|
/**
|
|
262
262
|
* Firebase seat state type (excludes 'selected' which is client-only, 'hidden' which is filtered)
|
|
263
263
|
*/
|
|
264
|
-
type FirebaseSeatState =
|
|
264
|
+
type FirebaseSeatState = "available" | "reserved" | "unavailable";
|
|
265
265
|
/**
|
|
266
266
|
* Seat state value stored in Firebase (for reserved/unavailable seats)
|
|
267
267
|
* Available seats: key is deleted (doesn't exist)
|
|
268
268
|
* Reserved/Unavailable seats: object with state, userId, and timestamp
|
|
269
269
|
*/
|
|
270
270
|
interface FirebaseSeatStateValue {
|
|
271
|
-
state:
|
|
271
|
+
state: "reserved" | "unavailable";
|
|
272
272
|
userId?: string;
|
|
273
273
|
timestamp?: number;
|
|
274
274
|
}
|
package/dist/index.js
CHANGED
|
@@ -142,7 +142,9 @@ function validateSeatMapConfig(config) {
|
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
const seatIds = config.seats.map((s) => s.id);
|
|
145
|
-
const duplicates = seatIds.filter(
|
|
145
|
+
const duplicates = seatIds.filter(
|
|
146
|
+
(id, index) => seatIds.indexOf(id) !== index
|
|
147
|
+
);
|
|
146
148
|
if (duplicates.length > 0) {
|
|
147
149
|
errors.push(`Duplicate seat IDs found: ${duplicates.join(", ")}`);
|
|
148
150
|
}
|
|
@@ -257,7 +259,9 @@ function importConfigFromJSON(jsonString) {
|
|
|
257
259
|
const config = JSON.parse(jsonString);
|
|
258
260
|
return config;
|
|
259
261
|
} catch (error) {
|
|
260
|
-
throw new Error(
|
|
262
|
+
throw new Error(
|
|
263
|
+
`Failed to parse JSON: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
264
|
+
);
|
|
261
265
|
}
|
|
262
266
|
}
|
|
263
267
|
function downloadConfigAsFile(config, filename = "seat-map-config.json") {
|
package/dist/index.mjs
CHANGED
|
@@ -92,7 +92,9 @@ function validateSeatMapConfig(config) {
|
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
const seatIds = config.seats.map((s) => s.id);
|
|
95
|
-
const duplicates = seatIds.filter(
|
|
95
|
+
const duplicates = seatIds.filter(
|
|
96
|
+
(id, index) => seatIds.indexOf(id) !== index
|
|
97
|
+
);
|
|
96
98
|
if (duplicates.length > 0) {
|
|
97
99
|
errors.push(`Duplicate seat IDs found: ${duplicates.join(", ")}`);
|
|
98
100
|
}
|
|
@@ -207,7 +209,9 @@ function importConfigFromJSON(jsonString) {
|
|
|
207
209
|
const config = JSON.parse(jsonString);
|
|
208
210
|
return config;
|
|
209
211
|
} catch (error) {
|
|
210
|
-
throw new Error(
|
|
212
|
+
throw new Error(
|
|
213
|
+
`Failed to parse JSON: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
214
|
+
);
|
|
211
215
|
}
|
|
212
216
|
}
|
|
213
217
|
function downloadConfigAsFile(config, filename = "seat-map-config.json") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zonetrix/shared",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "Shared types and utilities for seat-map-studio packages",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
11
12
|
"import": "./dist/index.mjs",
|
|
12
|
-
"require": "./dist/index.js"
|
|
13
|
-
"types": "./dist/index.d.ts"
|
|
13
|
+
"require": "./dist/index.js"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"files": [
|