@unisim/sdk 0.168.0 → 0.170.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/README.md +53 -1
- package/android/src/main/AndroidManifest.xml +14 -9
- package/dist/KnowledgeBaseDialog.d.ts +48 -7
- package/dist/KnowledgeBaseDialog.d.ts.map +1 -1
- package/dist/KnowledgeBaseDialog.js +271 -32
- package/dist/KnowledgeBaseDialog.js.map +1 -1
- package/dist/PreferencesDialog.d.ts +10 -3
- package/dist/PreferencesDialog.d.ts.map +1 -1
- package/dist/PreferencesDialog.js +5 -2
- package/dist/PreferencesDialog.js.map +1 -1
- package/dist/UserProfile.d.ts.map +1 -1
- package/dist/UserProfile.js +44 -2
- package/dist/UserProfile.js.map +1 -1
- package/dist/accountStash.d.ts +56 -0
- package/dist/accountStash.d.ts.map +1 -0
- package/dist/accountStash.js +171 -0
- package/dist/accountStash.js.map +1 -0
- package/dist/accountSwitch.d.ts +18 -0
- package/dist/accountSwitch.d.ts.map +1 -0
- package/dist/accountSwitch.js +102 -0
- package/dist/accountSwitch.js.map +1 -0
- package/dist/defaultView.d.ts +105 -0
- package/dist/defaultView.d.ts.map +1 -0
- package/dist/defaultView.js +255 -0
- package/dist/defaultView.js.map +1 -0
- package/dist/folderDrop.d.ts +11 -0
- package/dist/folderDrop.d.ts.map +1 -1
- package/dist/folderDrop.js +23 -0
- package/dist/folderDrop.js.map +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +168 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +15 -1
- package/dist/provider.js.map +1 -1
- package/dist/useFileDrop.js +2 -2
- package/dist/useFileDrop.js.map +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -314,6 +314,49 @@ they are part of an enterprise? It's kinda pointless if they only use one app"*.
|
|
|
314
314
|
appearance control (Jukebox) should check `useGlobalPreferences().split` and, when false,
|
|
315
315
|
offer plain Light / Dark / System bound to `setColorScheme` with the override cleared.
|
|
316
316
|
|
|
317
|
+
### Default views: double-tap to choose, and Reset to defaults (since 0.170.0)
|
|
318
|
+
|
|
319
|
+
James, 2026-09-30: *"Where there are buttons that offer a different view to default, allow the
|
|
320
|
+
user to double click the button to set that as their default view … Each 'Tune this app' page
|
|
321
|
+
should have a reset defaults button."* Universal Jukebox's library tabs are the model.
|
|
322
|
+
|
|
323
|
+
- **`useDefaultView(id, fallback, { views })`** — one per row of view buttons (tabs, list/grid,
|
|
324
|
+
sort, kind). A single tap switches as before. **`tap(view)`** from the button's own `onClick`
|
|
325
|
+
returns `true` when it was the second tap on the same button within
|
|
326
|
+
`DEFAULT_VIEW_DOUBLE_TAP_MS` (350), and stores that view. The button pops and a polite live
|
|
327
|
+
region says "Table is now the default view". **`defaultView`** is the view to open on.
|
|
328
|
+
**`buttonProps(view, label)`** gives the `title` (a double-tap or double-click hint, or
|
|
329
|
+
"… is the default view"), `data-default-view="true"` on the default, and a `style` with the
|
|
330
|
+
pop and `touch-action: manipulation`.
|
|
331
|
+
- **Paint the default orange, from the attribute.** The SDK can't style an app's buttons. Make it
|
|
332
|
+
a filled orange pill while it is the current view, and an orange outline while it isn't. This
|
|
333
|
+
is Jukebox's look:
|
|
334
|
+
|
|
335
|
+
```tsx
|
|
336
|
+
const active = view === v
|
|
337
|
+
className={active
|
|
338
|
+
? 'data-[default-view=true]:bg-gradient-to-br data-[default-view=true]:from-[#FE8C01] data-[default-view=true]:to-[#E05504] data-[default-view=true]:text-white …'
|
|
339
|
+
: 'data-[default-view=true]:text-orange-700 data-[default-view=true]:ring-1 data-[default-view=true]:ring-inset data-[default-view=true]:ring-orange-400/70 …'}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
- **`<DefaultViewSelect id label fallback views />`** — the same choice as a Tune this app row,
|
|
343
|
+
for anybody who can't double-tap. Pass it in `appPreferences`. It follows the dialog's
|
|
344
|
+
colourway (`PreferencesThemeContext`).
|
|
345
|
+
- **Storage:** localStorage `unisim:default-view:<config.product>:<id>`. It is per device and is
|
|
346
|
+
never synced to the account. `readDefaultView(product, id)` / `writeDefaultView(...)` are for
|
|
347
|
+
a store that needs the value outside React, such as a zustand store's initial state.
|
|
348
|
+
- **Reset to defaults is in EVERY Tune this app now.** Before 0.170.0 it showed only when the app
|
|
349
|
+
passed `onResetDefaults`. The SDK's part of the reset always runs:
|
|
350
|
+
- `clearDefaultViews(product)` clears every default view the app has, including ones on screens
|
|
351
|
+
that aren't mounted.
|
|
352
|
+
- The app's language override is removed.
|
|
353
|
+
- With `themeStore`, the colour scheme override is removed.
|
|
354
|
+
|
|
355
|
+
`onResetDefaults` then handles the settings only the app knows about. An app that draws its
|
|
356
|
+
own settings surface (Jukebox) uses **`useResetAppDefaults(onResetDefaults, themeStore)`** for
|
|
357
|
+
the same reset.
|
|
358
|
+
- `npm run test:default-view` (24 checks).
|
|
359
|
+
|
|
317
360
|
### "There are X total users (Y live)" (since 0.145.0)
|
|
318
361
|
|
|
319
362
|
Every app shows how many people use it, and how many are using it right now, as
|
|
@@ -627,7 +670,16 @@ invisible, keeps a private session, and nothing reports a problem. **Its
|
|
|
627
670
|
apps** — the Java side keeps no second copy, it filters what the package manager
|
|
628
671
|
admits to by the `.unisimsuiteauth` suffix. Adding an app to the suite means
|
|
629
672
|
adding one line there. (The `<package>` list below it is a different list for a
|
|
630
|
-
different job — see the switcher section.
|
|
673
|
+
different job — see the switcher section. ⚠️ But a `<package>` entry makes the
|
|
674
|
+
WHOLE package visible, providers included, so an app on that list is reachable
|
|
675
|
+
for session sharing whether or not it is on the provider list — which is how
|
|
676
|
+
Ergo Assess's native app was reached before it was named there.)
|
|
677
|
+
|
|
678
|
+
**Ergo Assess is the one non-Capacitor member** (2026-09-29). Its Compose app
|
|
679
|
+
hosts a Kotlin port of `SuiteAuthProvider`/`SuiteAuthStore` under the same
|
|
680
|
+
permission and contract (`Ergo_Assess` `android/…/web/SuiteAuthStore.kt`) and
|
|
681
|
+
carries its own copy of the provider list in its manifest — so a new suite app
|
|
682
|
+
goes into both.
|
|
631
683
|
|
|
632
684
|
⚠️ **Same key, in practice, means the same BUILD TYPE.** Debug builds are signed
|
|
633
685
|
with `~/.android/debug.keystore` and release builds with the upload key. Install
|
|
@@ -29,11 +29,16 @@
|
|
|
29
29
|
Two Capacitor apps are deliberately absent, and neither is an oversight:
|
|
30
30
|
Universal AI and Universal Family both run their own Supabase client on
|
|
31
31
|
their own storage key by an explicit decision recorded in their source,
|
|
32
|
-
so they have no shared session to take part in.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
so they have no shared session to take part in.
|
|
33
|
+
|
|
34
|
+
Ergo Assess IS here (2026-09-29), though it is not Capacitor: its native
|
|
35
|
+
Compose app hosts a Kotlin port of SuiteAuthProvider under the same
|
|
36
|
+
permission and contract (Ergo_Assess android/…/web/SuiteAuthStore.kt),
|
|
37
|
+
keeping the com.universalsimulation. prefix of its Gradle module. Before
|
|
38
|
+
this line it was already reachable by accident — its <package> entry in
|
|
39
|
+
2b makes the whole package, providers included, visible — but sharing a
|
|
40
|
+
session must not hang on the switcher's list. Ergo's own manifest keeps
|
|
41
|
+
a copy of this list; add a new app there too.
|
|
37
42
|
|
|
38
43
|
2b. The PACKAGE list: who the suite switcher can OPEN, via
|
|
39
44
|
UnisimSuiteAuthPlugin.installedApps/openApp. Deliberately a separate
|
|
@@ -73,14 +78,14 @@
|
|
|
73
78
|
|
|
74
79
|
<queries>
|
|
75
80
|
<provider
|
|
76
|
-
android:authorities="uk.co.unisim.coshhassess.unisimsuiteauth;uk.co.unisim.cyberassess.unisimsuiteauth;uk.co.unisim.fireassess.unisimsuiteauth;uk.co.unisim.riskassess.unisimsuiteauth;uk.co.unisim.wfhassess.unisimsuiteauth;uk.co.unisim.blackbook.unisimsuiteauth;uk.co.unisim.compress.unisimsuiteauth;uk.co.unisim.converter.unisimsuiteauth;uk.co.unisim.images.unisimsuiteauth;uk.co.unisim.jukebox.unisimsuiteauth;uk.co.unisim.pdf.unisimsuiteauth;uk.co.unisim.polling.unisimsuiteauth;uk.co.unisim.qr.unisimsuiteauth" />
|
|
81
|
+
android:authorities="uk.co.unisim.coshhassess.unisimsuiteauth;uk.co.unisim.cyberassess.unisimsuiteauth;uk.co.unisim.fireassess.unisimsuiteauth;uk.co.unisim.riskassess.unisimsuiteauth;uk.co.unisim.wfhassess.unisimsuiteauth;uk.co.unisim.blackbook.unisimsuiteauth;uk.co.unisim.compress.unisimsuiteauth;uk.co.unisim.converter.unisimsuiteauth;uk.co.unisim.images.unisimsuiteauth;uk.co.unisim.jukebox.unisimsuiteauth;uk.co.unisim.pdf.unisimsuiteauth;uk.co.unisim.polling.unisimsuiteauth;uk.co.unisim.qr.unisimsuiteauth;com.universalsimulation.ergoassesscapture.unisimsuiteauth" />
|
|
77
82
|
|
|
78
83
|
<!-- Ergo Assess is the one non-Capacitor app here: a Compose app whose
|
|
79
84
|
MainActivity already carries MAIN/LAUNCHER, which is all
|
|
80
85
|
getLaunchIntentForPackage needs. It keeps the
|
|
81
|
-
com.universalsimulation. prefix from its own Gradle module
|
|
82
|
-
|
|
83
|
-
SuiteAuthProvider
|
|
86
|
+
com.universalsimulation. prefix from its own Gradle module. Since
|
|
87
|
+
2026-09-29 it is in the provider list above as well: it hosts a
|
|
88
|
+
port of SuiteAuthProvider and shares the session. -->
|
|
84
89
|
<package android:name="com.universalsimulation.ergoassesscapture" />
|
|
85
90
|
<package android:name="uk.co.unisim.cyberassess" />
|
|
86
91
|
<package android:name="uk.co.unisim.wfhassess" />
|
|
@@ -1,15 +1,37 @@
|
|
|
1
1
|
import { type Language } from './i18n.js';
|
|
2
2
|
import { type MenuTheme } from './menuTheme.js';
|
|
3
|
+
/** Where the suite's knowledge-base PDFs are served from. See note 4. */
|
|
4
|
+
export declare const KB_LIBRARY_URL = "https://opensource.unisim.co.uk/kb";
|
|
5
|
+
export type KnowledgeSourceKind = 'paper' | 'standard' | 'report' | 'guidance' | 'law';
|
|
6
|
+
/** A paper, standard or report an article draws on. */
|
|
7
|
+
export interface KnowledgeSource {
|
|
8
|
+
kind: KnowledgeSourceKind;
|
|
9
|
+
/** In the original language; titles of papers are not translated. */
|
|
10
|
+
title: string;
|
|
11
|
+
authors?: string;
|
|
12
|
+
/** Journal, conference or issuing body — "ACM CCS 2019", "NIST". */
|
|
13
|
+
publisher?: string;
|
|
14
|
+
year?: number;
|
|
15
|
+
/** The canonical free link: a DOI, the publisher's page or their own PDF. */
|
|
16
|
+
href: string;
|
|
17
|
+
/**
|
|
18
|
+
* Our hosted copy, relative to the library (`papers/fips-197-aes.pdf`) or
|
|
19
|
+
* absolute. Only when the licence permits redistribution (note 5).
|
|
20
|
+
*/
|
|
21
|
+
pdf?: string;
|
|
22
|
+
/** The licence the hosted copy is shared under. Shown beside it. */
|
|
23
|
+
licence?: string;
|
|
24
|
+
}
|
|
3
25
|
export interface KnowledgeArticle {
|
|
4
|
-
/** Stable slug. Also what `initialArticle` matches. */
|
|
26
|
+
/** Stable slug. Also what `initialArticle` matches, and the guide PDF's name. */
|
|
5
27
|
id: string;
|
|
6
28
|
title: string;
|
|
7
|
-
/** One line under the title
|
|
29
|
+
/** One line under the title on its card. */
|
|
8
30
|
summary?: string;
|
|
9
31
|
/**
|
|
10
|
-
* A heading the
|
|
32
|
+
* A heading the cards are grouped under — "The basics", "Privacy and
|
|
11
33
|
* security". Articles keep their order; a group starts where its label
|
|
12
|
-
* first appears. Leave unset on every article for
|
|
34
|
+
* first appears. Leave unset on every article for one ungrouped grid.
|
|
13
35
|
*/
|
|
14
36
|
group?: string;
|
|
15
37
|
/**
|
|
@@ -17,22 +39,41 @@ export interface KnowledgeArticle {
|
|
|
17
39
|
* `1. ` numbered steps and `**bold**`. Nothing else is interpreted.
|
|
18
40
|
*/
|
|
19
41
|
body: string;
|
|
42
|
+
/** The research behind the article, shown beside it. Not translated. */
|
|
43
|
+
sources?: KnowledgeSource[];
|
|
20
44
|
}
|
|
21
45
|
export type KnowledgeArticles = KnowledgeArticle[] | ((language: Language) => KnowledgeArticle[] | Promise<KnowledgeArticle[]>);
|
|
22
46
|
/** What an app hands the navbar (`knowledgeBase`) or <AdvancedMenu>. */
|
|
23
47
|
export interface KnowledgeBaseConfig {
|
|
24
48
|
articles: KnowledgeArticles;
|
|
49
|
+
/**
|
|
50
|
+
* The app's guide PDFs have been generated and published (see
|
|
51
|
+
* `scripts/kb-pdfs.mjs` in universal-platform). Turns on the "Download
|
|
52
|
+
* guide" buttons, which link to
|
|
53
|
+
* `<library>/<product>/<language>/<article id>.pdf`. Leave unset until
|
|
54
|
+
* they exist.
|
|
55
|
+
*/
|
|
56
|
+
guides?: boolean;
|
|
57
|
+
/** Override the library's address. Tests and self-hosters only. */
|
|
58
|
+
library?: string;
|
|
25
59
|
}
|
|
26
60
|
export interface KnowledgeBaseDialogProps extends KnowledgeBaseConfig {
|
|
27
61
|
open: boolean;
|
|
28
62
|
onClose: () => void;
|
|
29
|
-
/** Open straight onto this article rather than the
|
|
63
|
+
/** Open straight onto this article rather than the cards. */
|
|
30
64
|
initialArticle?: string;
|
|
31
65
|
/** Heading beside the mark. Defaults to the product's name from the SDK. */
|
|
32
66
|
name?: string;
|
|
33
67
|
theme?: MenuTheme;
|
|
34
68
|
}
|
|
35
|
-
|
|
69
|
+
/**
|
|
70
|
+
* The folder a language's guides are filed under. The generator writes one
|
|
71
|
+
* folder per translation the app has; both Englishes share `en`.
|
|
72
|
+
*/
|
|
73
|
+
export declare function guideLanguage(language: string): string;
|
|
74
|
+
/** Resolve a source's `pdf` (library-relative or absolute) to a URL. */
|
|
75
|
+
export declare function libraryUrl(path: string, library?: string): string;
|
|
76
|
+
export declare function KnowledgeBaseDialog({ open, onClose, articles, guides, library, initialArticle, name, theme, }: KnowledgeBaseDialogProps): import("react").ReactPortal | null;
|
|
36
77
|
type Block = {
|
|
37
78
|
kind: 'h';
|
|
38
79
|
text: string;
|
|
@@ -46,7 +87,7 @@ type Block = {
|
|
|
46
87
|
kind: 'ol';
|
|
47
88
|
items: string[];
|
|
48
89
|
};
|
|
49
|
-
/** Exported for the tests — splits
|
|
90
|
+
/** Exported for the tests and the PDF generator — splits a body into blocks. */
|
|
50
91
|
export declare function parseArticleBody(body: string): Block[];
|
|
51
92
|
/** The book glyph for the menu row. Exported so <AdvancedMenu> can use it. */
|
|
52
93
|
export declare function IconBook(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnowledgeBaseDialog.d.ts","sourceRoot":"","sources":["../src/KnowledgeBaseDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAK,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"KnowledgeBaseDialog.d.ts","sourceRoot":"","sources":["../src/KnowledgeBaseDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAK,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAgErD,yEAAyE;AACzE,eAAO,MAAM,cAAc,uCAAuC,CAAA;AAElE,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAA;AAEtF,uDAAuD;AACvD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,mBAAmB,CAAA;IACzB,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAA;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