@autobusal/utilities 1.1.1 → 1.2.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
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this package are documented here. This project follows [Keep a Changelog](https://keepachangelog.com/) and [Semantic Versioning](https://semver.org/).
4
4
 
5
+ ## [1.2.0] - 2026-07-25
6
+
7
+ ### Added
8
+
9
+ - `GetChannelStatus(t)`: shared disabled/dedicated/main select values for
10
+ the Telegram and WhatsApp admin settings tabs (and any future per-label
11
+ messaging channel).
12
+
13
+ ## [1.1.2] - 2026-07-24
14
+
15
+ ### Added
16
+
17
+ - New `sanitizeHtml(html)` helper (wraps DOMPurify) for sanitizing admin-authored CMS content (pages, articles, notifications, policies, affiliate terms, document previews) before rendering via `dangerouslySetInnerHTML`. Added `dompurify` as a dependency.
18
+
5
19
  ## [1.1.1] - 2026-07-19
6
20
 
7
21
  ### Added
package/index.ts CHANGED
@@ -3,11 +3,13 @@ import { Validate, Display } from './form';
3
3
  import { error, notify, success } from './notify';
4
4
  import { getAllowed, getLanguages, getPayments } from './options';
5
5
  import { getSex, getOptionsSex } from './passengers';
6
- import { GetStatus, GetEnvironment, DisplayStatus } from './users';
6
+ import { GetStatus, GetEnvironment, GetChannelStatus, DisplayStatus } from './users';
7
7
  import { getRandomNumber } from './numbers';
8
8
  import { getParams } from './manage';
9
+ import { sanitizeHtml } from './sanitize';
9
10
 
10
11
  export {
12
+ sanitizeHtml,
11
13
  Validate,
12
14
  Display,
13
15
  error,
@@ -27,5 +29,6 @@ export {
27
29
  getRandomNumber,
28
30
  getSex,
29
31
  GetStatus,
30
- GetEnvironment
32
+ GetEnvironment,
33
+ GetChannelStatus
31
34
  };
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@autobusal/utilities",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
- "main": "index.ts"
6
+ "main": "index.ts",
7
+ "dependencies": {
8
+ "dompurify": "^3.4.12"
9
+ }
7
10
  }
package/sanitize.ts ADDED
@@ -0,0 +1,11 @@
1
+ import DOMPurify from 'dompurify';
2
+
3
+ // Sanitizes admin-authored HTML (CMS pages, articles, notifications, policies,
4
+ // affiliate terms, document previews) before it's rendered via
5
+ // dangerouslySetInnerHTML. These fields are only writable by an admin-type
6
+ // account today, but rendering them unsanitized still means a compromised or
7
+ // phished admin can persist JS that runs in every visitor's and every other
8
+ // admin's browser - this is the defense-in-depth layer for that case.
9
+ export const sanitizeHtml = (html: string | null | undefined): string => (
10
+ DOMPurify.sanitize(html ?? '')
11
+ );
package/users.tsx CHANGED
@@ -35,6 +35,25 @@ export const GetEnvironment = (t: TFunction<'common'>) => ([
35
35
  }
36
36
  ]);
37
37
 
38
+ // Edited: Ferjolt Ozuni - Date: 2026-07-25
39
+ // Shared by the Telegram and WhatsApp admin settings tabs (and any future
40
+ // per-label messaging channel): disabled, this label's own credentials, or
41
+ // routed through the main label's - same three-state model Raiffeisen's
42
+ // payment domain toggle uses (that one has no "disabled" option since a
43
+ // separate Available toggle covers on/off there).
44
+ export const GetChannelStatus = (t: TFunction<'common'>) => ([
45
+ {
46
+ id: 'disabled',
47
+ name: t('admin_label.manage.channel_status.disabled', { ns: 'common' })
48
+ }, {
49
+ id: 'dedicated',
50
+ name: t('admin_label.manage.channel_status.dedicated', { ns: 'common' })
51
+ }, {
52
+ id: 'main',
53
+ name: t('admin_label.manage.channel_status.main', { ns: 'common' })
54
+ }
55
+ ]);
56
+
38
57
  const Status = styled.span<{ $type: string }>`
39
58
  display: inline-block;
40
59
  padding: 3px 5px;