@autobusal/providers 1.31.0 → 1.32.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.32.0
4
+
5
+ ### Added
6
+
7
+ - **`LabelSettings.theme`** — a label's chosen theme preset (`{preset, overrides}`), matching obtapi's new `labels_settings.theme` column. Optional/nullable: absent means the label still reads its colors straight out of settings.json, exactly as before this existed.
8
+
9
+ ## 1.31.1
10
+
11
+ ### Fixed
12
+
13
+ - **A 422 no longer stacks one toast per query.** The search results page
14
+ asks three endpoints the same question, so a malformed URL rejected three
15
+ times and showed three identical messages. De-duplicated by the first
16
+ field error rather than by the message: Laravel's summary appends "(and N
17
+ more errors)" and each endpoint validates a different rule set, so the
18
+ three strings differ in that count alone while describing one problem.
19
+
3
20
  ## 1.31.0
4
21
 
5
22
  ### Added
@@ -116,9 +116,30 @@ apiClient.interceptors.response.use(response => (
116
116
  window.location.href = '/account/documents';
117
117
  }
118
118
 
119
- // if we have a 422 error, we display the message
119
+ /*
120
+ * if we have a 422 error, we display the message
121
+ *
122
+ * Edited: Ferjolt Ozuni - Date: 2026-08-07
123
+ *
124
+ * De-duplicated by the FIRST field error rather than by the message.
125
+ *
126
+ * The results page asks three endpoints (dates, departure, alternatives)
127
+ * the same question, so a malformed URL rejects three times and used to
128
+ * raise three identical toasts. The obvious key - the message itself -
129
+ * does not collapse them: Laravel's summary appends "(and N more
130
+ * errors)", each endpoint validates a different rule set, and so the
131
+ * three strings differ in that count alone while describing one problem.
132
+ *
133
+ * The first entry of `errors` is the same across all three, because it
134
+ * is the same field the visitor got wrong. That is the cause, and the
135
+ * cause is what should be shown once.
136
+ */
120
137
  if (error.response.status === 422) {
121
- systemError(error.response.data.message);
138
+ const first = Object.values(
139
+ (error.response.data.errors ?? {}) as Record<string, string[]>
140
+ )[0]?.[0];
141
+
142
+ systemError(error.response.data.message, first);
122
143
  }
123
144
 
124
145
  // if we have a 500 error, we display a generic error message
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/providers",
3
- "version": "1.31.0",
3
+ "version": "1.32.0",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"
package/types/settings.ts CHANGED
@@ -302,6 +302,18 @@ export interface LabelSettings {
302
302
  auto_publish?: boolean
303
303
  threshold?: number
304
304
  }
305
+
306
+ // Edited: Ferjolt Ozuni - Date: 2026-08-08
307
+ // The label's chosen theme preset, or null/absent to keep reading colors
308
+ // straight out of settings.json exactly as before this existed - see
309
+ // obtapi's Settings\ViewController::applyThemePreset(). `overrides`
310
+ // mirrors the SAME shape as a themes.tokens row (colors.light/dark +
311
+ // theme), deep-merged on top of the preset - only the keys actually
312
+ // overridden need to be present.
313
+ theme?: {
314
+ preset: string
315
+ overrides: Record<string, any>
316
+ } | null
305
317
  }
306
318
 
307
319
  // Edited: Ferjolt Ozuni - Date: 2026-07-18