@zonetrix/shared 2.4.1 → 2.4.2
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 +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.js +4 -3
- package/dist/index.mjs +4 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -31,6 +31,7 @@ interface SectionConfig {
|
|
|
31
31
|
price?: number;
|
|
32
32
|
color?: string;
|
|
33
33
|
locked?: boolean;
|
|
34
|
+
[key: string]: unknown;
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* Row pricing structure for section-based pricing
|
|
@@ -196,10 +197,44 @@ interface ValidationResult {
|
|
|
196
197
|
warnings: string[];
|
|
197
198
|
}
|
|
198
199
|
|
|
200
|
+
interface ConfigInput {
|
|
201
|
+
version?: string;
|
|
202
|
+
metadata?: {
|
|
203
|
+
name?: string;
|
|
204
|
+
createdAt?: string;
|
|
205
|
+
updatedAt?: string;
|
|
206
|
+
};
|
|
207
|
+
canvas?: {
|
|
208
|
+
width?: number;
|
|
209
|
+
height?: number;
|
|
210
|
+
backgroundColor?: string;
|
|
211
|
+
};
|
|
212
|
+
colors?: Record<string, string>;
|
|
213
|
+
seats?: Array<{
|
|
214
|
+
id?: string;
|
|
215
|
+
position?: {
|
|
216
|
+
x?: number;
|
|
217
|
+
y?: number;
|
|
218
|
+
};
|
|
219
|
+
shape?: string;
|
|
220
|
+
state?: string;
|
|
221
|
+
}>;
|
|
222
|
+
sections?: Array<{
|
|
223
|
+
id?: string;
|
|
224
|
+
name?: string;
|
|
225
|
+
config?: unknown;
|
|
226
|
+
}>;
|
|
227
|
+
stages?: Array<{
|
|
228
|
+
id?: string;
|
|
229
|
+
config?: {
|
|
230
|
+
label?: string;
|
|
231
|
+
};
|
|
232
|
+
}>;
|
|
233
|
+
}
|
|
199
234
|
/**
|
|
200
235
|
* Validates a seat map configuration
|
|
201
236
|
*/
|
|
202
|
-
declare function validateSeatMapConfig(config:
|
|
237
|
+
declare function validateSeatMapConfig(config: ConfigInput | null | undefined): ValidationResult;
|
|
203
238
|
/**
|
|
204
239
|
* Generates a unique ID for seat map objects
|
|
205
240
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ interface SectionConfig {
|
|
|
31
31
|
price?: number;
|
|
32
32
|
color?: string;
|
|
33
33
|
locked?: boolean;
|
|
34
|
+
[key: string]: unknown;
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* Row pricing structure for section-based pricing
|
|
@@ -196,10 +197,44 @@ interface ValidationResult {
|
|
|
196
197
|
warnings: string[];
|
|
197
198
|
}
|
|
198
199
|
|
|
200
|
+
interface ConfigInput {
|
|
201
|
+
version?: string;
|
|
202
|
+
metadata?: {
|
|
203
|
+
name?: string;
|
|
204
|
+
createdAt?: string;
|
|
205
|
+
updatedAt?: string;
|
|
206
|
+
};
|
|
207
|
+
canvas?: {
|
|
208
|
+
width?: number;
|
|
209
|
+
height?: number;
|
|
210
|
+
backgroundColor?: string;
|
|
211
|
+
};
|
|
212
|
+
colors?: Record<string, string>;
|
|
213
|
+
seats?: Array<{
|
|
214
|
+
id?: string;
|
|
215
|
+
position?: {
|
|
216
|
+
x?: number;
|
|
217
|
+
y?: number;
|
|
218
|
+
};
|
|
219
|
+
shape?: string;
|
|
220
|
+
state?: string;
|
|
221
|
+
}>;
|
|
222
|
+
sections?: Array<{
|
|
223
|
+
id?: string;
|
|
224
|
+
name?: string;
|
|
225
|
+
config?: unknown;
|
|
226
|
+
}>;
|
|
227
|
+
stages?: Array<{
|
|
228
|
+
id?: string;
|
|
229
|
+
config?: {
|
|
230
|
+
label?: string;
|
|
231
|
+
};
|
|
232
|
+
}>;
|
|
233
|
+
}
|
|
199
234
|
/**
|
|
200
235
|
* Validates a seat map configuration
|
|
201
236
|
*/
|
|
202
|
-
declare function validateSeatMapConfig(config:
|
|
237
|
+
declare function validateSeatMapConfig(config: ConfigInput | null | undefined): ValidationResult;
|
|
203
238
|
/**
|
|
204
239
|
* Generates a unique ID for seat map objects
|
|
205
240
|
*/
|
package/dist/index.js
CHANGED
|
@@ -109,6 +109,7 @@ function validateSeatMapConfig(config) {
|
|
|
109
109
|
if (!config.colors) {
|
|
110
110
|
warnings.push("Missing color configuration");
|
|
111
111
|
} else {
|
|
112
|
+
const colors = config.colors;
|
|
112
113
|
const requiredColors = [
|
|
113
114
|
"canvasBackground",
|
|
114
115
|
"stageColor",
|
|
@@ -119,7 +120,7 @@ function validateSeatMapConfig(config) {
|
|
|
119
120
|
"gridLines"
|
|
120
121
|
];
|
|
121
122
|
requiredColors.forEach((color) => {
|
|
122
|
-
if (!
|
|
123
|
+
if (!colors[color] || typeof colors[color] !== "string") {
|
|
123
124
|
warnings.push(`Missing or invalid color: ${color}`);
|
|
124
125
|
}
|
|
125
126
|
});
|
|
@@ -179,10 +180,10 @@ function validateSeatMapConfig(config) {
|
|
|
179
180
|
};
|
|
180
181
|
}
|
|
181
182
|
function isValidSeatState(state) {
|
|
182
|
-
return ["available", "reserved", "selected", "unavailable"].includes(state);
|
|
183
|
+
return typeof state === "string" && ["available", "reserved", "selected", "unavailable"].includes(state);
|
|
183
184
|
}
|
|
184
185
|
function isValidSeatShape(shape) {
|
|
185
|
-
return ["circle", "square", "rounded-square"].includes(shape);
|
|
186
|
+
return typeof shape === "string" && ["circle", "square", "rounded-square"].includes(shape);
|
|
186
187
|
}
|
|
187
188
|
function generateId(prefix = "obj") {
|
|
188
189
|
return `${prefix}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
package/dist/index.mjs
CHANGED
|
@@ -59,6 +59,7 @@ function validateSeatMapConfig(config) {
|
|
|
59
59
|
if (!config.colors) {
|
|
60
60
|
warnings.push("Missing color configuration");
|
|
61
61
|
} else {
|
|
62
|
+
const colors = config.colors;
|
|
62
63
|
const requiredColors = [
|
|
63
64
|
"canvasBackground",
|
|
64
65
|
"stageColor",
|
|
@@ -69,7 +70,7 @@ function validateSeatMapConfig(config) {
|
|
|
69
70
|
"gridLines"
|
|
70
71
|
];
|
|
71
72
|
requiredColors.forEach((color) => {
|
|
72
|
-
if (!
|
|
73
|
+
if (!colors[color] || typeof colors[color] !== "string") {
|
|
73
74
|
warnings.push(`Missing or invalid color: ${color}`);
|
|
74
75
|
}
|
|
75
76
|
});
|
|
@@ -129,10 +130,10 @@ function validateSeatMapConfig(config) {
|
|
|
129
130
|
};
|
|
130
131
|
}
|
|
131
132
|
function isValidSeatState(state) {
|
|
132
|
-
return ["available", "reserved", "selected", "unavailable"].includes(state);
|
|
133
|
+
return typeof state === "string" && ["available", "reserved", "selected", "unavailable"].includes(state);
|
|
133
134
|
}
|
|
134
135
|
function isValidSeatShape(shape) {
|
|
135
|
-
return ["circle", "square", "rounded-square"].includes(shape);
|
|
136
|
+
return typeof shape === "string" && ["circle", "square", "rounded-square"].includes(shape);
|
|
136
137
|
}
|
|
137
138
|
function generateId(prefix = "obj") {
|
|
138
139
|
return `${prefix}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|