@autobusal/utilities 1.4.1 → 1.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.1
4
+
5
+ ### Changed
6
+
7
+ - **`error` collapses repeats into one toast** - it now raises the toast
8
+ under an id, defaulting to the message itself, so a page whose parallel
9
+ queries all fail the same way shows one red box rather than a stack of
10
+ identical ones. Existing call sites need no change. A repeat of the same
11
+ failure once the toast has gone still raises a fresh one.
12
+
13
+ ## 1.5.0
14
+
15
+ ### Added
16
+
17
+ - **`GetStatus` knows status 4, "awaiting approval"** - distinct from 3
18
+ (pending, waiting on the account to finish its own form) and from 2
19
+ (suspended, a decision already taken against it).
20
+
3
21
 
4
22
  ## 1.4.1
5
23
 
package/notify.ts CHANGED
@@ -1,7 +1,31 @@
1
1
  import toast from 'react-hot-toast';
2
2
 
3
- export const error = (message: string): void => {
4
- toast.error(message);
3
+ /*
4
+ * Edited: Ferjolt Ozuni - Date: 2026-08-07
5
+ *
6
+ * One cause, one toast.
7
+ *
8
+ * A page that runs several queries at once fails them all at once: the
9
+ * search results page asks three endpoints the same malformed question and
10
+ * gets three identical rejections, which stacked up as three identical red
11
+ * boxes. The visitor has one problem, not three.
12
+ *
13
+ * `id` is react-hot-toast's own de-duplication: raising a toast under an id
14
+ * that is already on screen updates that toast instead of adding another,
15
+ * and refreshes its timer so the message stays up for its full duration
16
+ * from the last occurrence rather than the first.
17
+ *
18
+ * It defaults to the message, which is what makes it work with no changes
19
+ * at any call site - identical text collapses on its own. Pass an explicit
20
+ * id where the same cause produces slightly different text (see the 422 in
21
+ * Queries/apiClient) so those collapse too.
22
+ *
23
+ * Note this deliberately does NOT expire on its own: a visitor who repeats
24
+ * a failing action after the toast has gone still gets a fresh one, because
25
+ * by then there is no toast with that id to update.
26
+ */
27
+ export const error = (message: string, id: string = message): void => {
28
+ toast.error(message, { id });
5
29
  };
6
30
 
7
31
  export const notify = (message: string): void => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/utilities",
3
- "version": "1.4.1",
3
+ "version": "1.5.1",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts",
package/users.tsx CHANGED
@@ -19,6 +19,15 @@ export const GetStatus = (t: TFunction<'common'>) => ([
19
19
  }, {
20
20
  id: 3,
21
21
  name: t('data.statuses.pending', { ns: 'common' })
22
+ }, {
23
+ /*
24
+ * Edited: Ferjolt Ozuni - Date: 2026-08-07
25
+ * Complete and waiting on a decision. Distinct from 3 (pending), which
26
+ * is waiting on the ACCOUNT to finish its own form, and from 2, which
27
+ * is a decision already taken against it.
28
+ */
29
+ id: 4,
30
+ name: t('data.statuses.awaiting', { ns: 'common' })
22
31
  }
23
32
  ]);
24
33