@unisim/sdk 0.157.0 → 0.159.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 +42 -6
- package/dist/UserCountBreakdown.d.ts +4 -1
- package/dist/UserCountBreakdown.d.ts.map +1 -1
- package/dist/UserCountBreakdown.js +165 -21
- package/dist/UserCountBreakdown.js.map +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +116 -16
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/presence.d.ts +120 -9
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js +359 -47
- package/dist/presence.js.map +1 -1
- package/dist/provider.d.ts +8 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +8 -2
- package/dist/provider.js.map +1 -1
- package/package.json +1 -1
package/dist/presence.js
CHANGED
|
@@ -6,16 +6,18 @@
|
|
|
6
6
|
// platform and counting guests. Bipolar Bear did the same on Firestore; this
|
|
7
7
|
// is the Supabase version (migration 0175):
|
|
8
8
|
//
|
|
9
|
-
// * `app_presence_beat(product, install_id)` — this install is
|
|
10
|
-
//
|
|
9
|
+
// * `app_presence_beat(product, install_id, platform)` — this install is
|
|
10
|
+
// here. Called on the first INTERACTION on the web (see below), when a
|
|
11
|
+
// native app opens, on sign-in / sign-out, and every 45 s while visible.
|
|
11
12
|
// Signed in, the server adds auth.uid() itself; nothing else is sent.
|
|
12
|
-
// * `app_user_counts(product)` — `{ total, live }`. "Live" is a
|
|
13
|
-
// two minutes. The dedupe rules (an account is one person
|
|
14
|
-
// a guest install somebody signed in on is that account)
|
|
15
|
-
//
|
|
13
|
+
// * `app_user_counts(product)` — `{ total, live, web, native }`. "Live" is a
|
|
14
|
+
// beat within two minutes. The dedupe rules (an account is one person
|
|
15
|
+
// across devices; a guest install somebody signed in on is that account)
|
|
16
|
+
// live in SQL.
|
|
17
|
+
// * `suite_user_counts()` — the same figures across every product
|
|
16
18
|
// (migration 0177), which the line switches to when tapped. An account is
|
|
17
19
|
// one person suite-wide; a guest is one person per browser origin.
|
|
18
|
-
// * `suite_user_counts_by_product()` — the same
|
|
20
|
+
// * `suite_user_counts_by_product()` — the same figures PER product
|
|
19
21
|
// (migration 0184), which the line shows in a popup on a long press. The
|
|
20
22
|
// rows deliberately do not add up to the suite total: one account using
|
|
21
23
|
// four apps is four rows here and one person there.
|
|
@@ -23,11 +25,35 @@
|
|
|
23
25
|
// The install id is a random UUID in this origin's localStorage, so web,
|
|
24
26
|
// Capacitor and Electron all get one with no native code.
|
|
25
27
|
//
|
|
28
|
+
// ── Web counts from an INTERACTION, not a page load (0.158.0) ────────────────
|
|
29
|
+
// James, 2026-09-21: "I also want the web count to be from the point of an
|
|
30
|
+
// interaction and not just a page load if possible". So on the web the first
|
|
31
|
+
// beat waits for a pointer, key, touch, wheel or scroll event — a visitor who
|
|
32
|
+
// lands and leaves without touching anything is not a user of the app, and
|
|
33
|
+
// used to be one. In an installed app (Capacitor, Electron) the beat goes at
|
|
34
|
+
// once: somebody chose that icon and waited for it to open, which is a good
|
|
35
|
+
// deal more deliberate than arriving at a URL.
|
|
36
|
+
//
|
|
37
|
+
// ⚠️ The "has interacted" flag is per PAGE, not per call — `startPresence` is
|
|
38
|
+
// restarted whenever the account changes, and a signed-in person who has
|
|
39
|
+
// already clicked must not be made to click again to keep counting.
|
|
40
|
+
//
|
|
41
|
+
// ── web / native (0.158.0, migration 0187) ───────────────────────────────────
|
|
42
|
+
// Each beat says which kind of device it came from, and the count functions
|
|
43
|
+
// put each PERSON in one bucket — the platform of their most recent beat — so
|
|
44
|
+
// web + native is at most the total rather than counting a phone-and-laptop
|
|
45
|
+
// person twice. Anyone last seen before 0.158.0 shipped is in neither bucket,
|
|
46
|
+
// so the two can add up to less than the total; the popup's "How we count a
|
|
47
|
+
// user" fold says so. `null` means the figure is not available at all: an
|
|
48
|
+
// older database, or a row whose total comes from an app's own account count
|
|
49
|
+
// (migration 0185).
|
|
50
|
+
//
|
|
26
51
|
// ⚠️ Nothing React in this file, on purpose: Universal AI (Svelte) and Universal
|
|
27
52
|
// Family (no <UniversalProvider>) call these directly. The provider starts
|
|
28
53
|
// presence for every other app — see `presence` in UniversalConfig.
|
|
29
54
|
// ──────────────────────────────────────────────────────────────────────────────
|
|
30
55
|
import { t } from './i18n.js';
|
|
56
|
+
import { capacitorPlatform, isNativeShell } from './sessionStorage.js';
|
|
31
57
|
/** localStorage key holding this install's random id. */
|
|
32
58
|
export const INSTALL_ID_KEY = 'unisim:install-id';
|
|
33
59
|
/** How often an open, visible app beats. Well inside the server's 2-min window. */
|
|
@@ -82,6 +108,131 @@ export function getInstallId() {
|
|
|
82
108
|
return memoryInstallId;
|
|
83
109
|
}
|
|
84
110
|
}
|
|
111
|
+
// ── Which kind of device this is ─────────────────────────────────────────────
|
|
112
|
+
/**
|
|
113
|
+
* True in anything the person INSTALLED — a Capacitor container or an Electron
|
|
114
|
+
* desktop build — as opposed to a page they navigated to.
|
|
115
|
+
*
|
|
116
|
+
* This is what decides that the beat goes immediately rather than waiting for
|
|
117
|
+
* an interaction, so it deliberately errs towards "no": a browser wrongly
|
|
118
|
+
* treated as an app would put page loads back in the total, which is the whole
|
|
119
|
+
* thing this release takes out.
|
|
120
|
+
*
|
|
121
|
+
* ⚠️ Electron is read off `navigator.userAgent` and the preload bridge rather
|
|
122
|
+
* than imported from `desktop.ts`, which pulls React in — and this file has
|
|
123
|
+
* none on purpose (Universal AI is Svelte).
|
|
124
|
+
*/
|
|
125
|
+
export function isInstalledApp() {
|
|
126
|
+
if (isNativeShell())
|
|
127
|
+
return true;
|
|
128
|
+
if (typeof window === 'undefined')
|
|
129
|
+
return false;
|
|
130
|
+
const w = window;
|
|
131
|
+
if (w.unisimDesktop && typeof w.unisimDesktop.openHub === 'function')
|
|
132
|
+
return true;
|
|
133
|
+
const ua = typeof navigator === 'undefined' ? '' : navigator.userAgent ?? '';
|
|
134
|
+
return / Electron\//.test(ua);
|
|
135
|
+
}
|
|
136
|
+
/** Windows / macOS / Linux for a desktop build, or null if it cannot be told. */
|
|
137
|
+
function desktopOs() {
|
|
138
|
+
if (typeof navigator === 'undefined')
|
|
139
|
+
return null;
|
|
140
|
+
// `userAgentData.platform` is the one that survives the user-agent reduction
|
|
141
|
+
// Chromium has been rolling out; the string is the fallback, not the source.
|
|
142
|
+
const hinted = navigator
|
|
143
|
+
.userAgentData?.platform ?? '';
|
|
144
|
+
const ua = `${hinted} ${navigator.userAgent ?? ''}`;
|
|
145
|
+
if (/win/i.test(ua))
|
|
146
|
+
return 'windows';
|
|
147
|
+
if (/mac/i.test(ua))
|
|
148
|
+
return 'macos';
|
|
149
|
+
if (/linux|x11|cros/i.test(ua))
|
|
150
|
+
return 'linux';
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* What this install reports itself as to `app_presence_beat`.
|
|
155
|
+
*
|
|
156
|
+
* ⚠️ An installed app that cannot name its OS answers `null`, NOT `'web'`.
|
|
157
|
+
* Migration 0187 keeps the platform an earlier beat established when a beat
|
|
158
|
+
* says nothing, so an unknown is a missed chance to record rather than a wrong
|
|
159
|
+
* record — and a desktop app quietly filed under "web" is the exact figure
|
|
160
|
+
* this feature exists to get right.
|
|
161
|
+
*/
|
|
162
|
+
export function devicePlatform() {
|
|
163
|
+
if (typeof window === 'undefined')
|
|
164
|
+
return null;
|
|
165
|
+
if (isNativeShell())
|
|
166
|
+
return capacitorPlatform();
|
|
167
|
+
if (isInstalledApp())
|
|
168
|
+
return desktopOs();
|
|
169
|
+
return 'web';
|
|
170
|
+
}
|
|
171
|
+
// ── "Interacted with" — the gate in front of the first beat on the web ───────
|
|
172
|
+
/**
|
|
173
|
+
* What counts as the person doing something. A scroll and a wheel are in the
|
|
174
|
+
* list on purpose: reading a page IS using it, and a reader who never clicks
|
|
175
|
+
* is not the drive-by this gate is meant to drop.
|
|
176
|
+
*/
|
|
177
|
+
export const INTERACTION_EVENTS = ['pointerdown', 'keydown', 'touchstart', 'wheel', 'scroll'];
|
|
178
|
+
let interacted = false;
|
|
179
|
+
let interactionArmed = false;
|
|
180
|
+
const interactionWaiters = new Set();
|
|
181
|
+
function noteInteraction() {
|
|
182
|
+
if (interacted)
|
|
183
|
+
return;
|
|
184
|
+
interacted = true;
|
|
185
|
+
disarmInteraction();
|
|
186
|
+
const waiting = [...interactionWaiters];
|
|
187
|
+
interactionWaiters.clear();
|
|
188
|
+
for (const run of waiting)
|
|
189
|
+
run();
|
|
190
|
+
}
|
|
191
|
+
function armInteraction() {
|
|
192
|
+
if (interactionArmed || typeof window === 'undefined')
|
|
193
|
+
return;
|
|
194
|
+
interactionArmed = true;
|
|
195
|
+
// Capture, so a press inside a component that stops propagation still counts;
|
|
196
|
+
// passive, so nothing here can hold up a scroll.
|
|
197
|
+
for (const type of INTERACTION_EVENTS) {
|
|
198
|
+
window.addEventListener(type, noteInteraction, { capture: true, passive: true });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function disarmInteraction() {
|
|
202
|
+
if (!interactionArmed)
|
|
203
|
+
return;
|
|
204
|
+
interactionArmed = false;
|
|
205
|
+
for (const type of INTERACTION_EVENTS) {
|
|
206
|
+
window.removeEventListener(type, noteInteraction, true);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/** Whether this page has seen a real interaction yet. Exported for tests and
|
|
210
|
+
* for an app that wants to hold something else back on the same rule. */
|
|
211
|
+
export function hasInteracted() {
|
|
212
|
+
return interacted;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Run `fn` on the first interaction — or straight away if one has already
|
|
216
|
+
* happened on this page. Returns a function that cancels the wait.
|
|
217
|
+
*
|
|
218
|
+
* ⚠️ The flag is module-level, so an app that restarts presence (signing in
|
|
219
|
+
* does) does not put the gate back in front of somebody who has been clicking
|
|
220
|
+
* for ten minutes.
|
|
221
|
+
*/
|
|
222
|
+
export function onFirstInteraction(fn) {
|
|
223
|
+
if (interacted || typeof window === 'undefined') {
|
|
224
|
+
if (interacted)
|
|
225
|
+
fn();
|
|
226
|
+
return () => { };
|
|
227
|
+
}
|
|
228
|
+
interactionWaiters.add(fn);
|
|
229
|
+
armInteraction();
|
|
230
|
+
return () => {
|
|
231
|
+
interactionWaiters.delete(fn);
|
|
232
|
+
if (interactionWaiters.size === 0)
|
|
233
|
+
disarmInteraction();
|
|
234
|
+
};
|
|
235
|
+
}
|
|
85
236
|
// The most recent beat per product. fetchUserCounts waits for it, so the first
|
|
86
237
|
// read after opening the app already includes the person reading it.
|
|
87
238
|
const pendingBeat = new Map();
|
|
@@ -94,16 +245,57 @@ function warnOnce(what, err) {
|
|
|
94
245
|
warned = true;
|
|
95
246
|
console.warn(`[unisim/sdk] user count: ${what} failed (not retried loudly)`, err);
|
|
96
247
|
}
|
|
97
|
-
/**
|
|
248
|
+
/**
|
|
249
|
+
* ⚠️ **The one ordering hazard in this release.** PostgREST resolves an RPC by
|
|
250
|
+
* its ARGUMENT NAMES, so sending `p_platform` to a database that has not had
|
|
251
|
+
* migration 0187 applied is not ignored — it is "function not found", and every
|
|
252
|
+
* beat fails. The SDK ships to npm and reaches apps on their own schedule,
|
|
253
|
+
* which is exactly the window where that can happen, so a beat refused for that
|
|
254
|
+
* reason is retried WITHOUT the platform and the argument is dropped for the
|
|
255
|
+
* rest of the page. The count keeps growing; it simply records no platform
|
|
256
|
+
* until the migration lands, which is the same state every pre-0187 row is in.
|
|
257
|
+
*
|
|
258
|
+
* `null` while nothing has been refused — the check is only worth making once.
|
|
259
|
+
*/
|
|
260
|
+
let sendPlatform = null;
|
|
261
|
+
/** PostgREST's "no function with these arguments", and Postgres' own. */
|
|
262
|
+
function isUnknownFunction(error) {
|
|
263
|
+
const code = error?.code;
|
|
264
|
+
return code === 'PGRST202' || code === '42883';
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Report this install as here now. Never throws; resolves whether it landed.
|
|
268
|
+
*/
|
|
98
269
|
export function beatPresence(supabase, product) {
|
|
99
270
|
const installId = getInstallId();
|
|
100
271
|
if (!installId || typeof supabase?.rpc !== 'function')
|
|
101
272
|
return Promise.resolve(false);
|
|
102
|
-
const
|
|
273
|
+
const base = { p_product: product, p_install_id: installId };
|
|
274
|
+
const platform = devicePlatform();
|
|
275
|
+
// Left out, rather than sent as null, when this install cannot name itself:
|
|
276
|
+
// 0187 keeps whatever platform an earlier beat established, so saying nothing
|
|
277
|
+
// costs a record and never erases one.
|
|
278
|
+
const withPlatform = platform !== null && sendPlatform !== false;
|
|
279
|
+
const send = (args) => Promise.resolve(supabase.rpc('app_presence_beat', args));
|
|
280
|
+
const p = send(withPlatform ? { ...base, p_platform: platform } : base)
|
|
281
|
+
.then(async ({ error }) => {
|
|
282
|
+
if (error && withPlatform && isUnknownFunction(error)) {
|
|
283
|
+
// A database on 0175–0185. Say it once, drop the argument, carry on.
|
|
284
|
+
sendPlatform = false;
|
|
285
|
+
const retry = await send(base);
|
|
286
|
+
if (retry.error) {
|
|
287
|
+
warnOnce('presence beat', retry.error);
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
beatLanded.add(product);
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
103
293
|
if (error) {
|
|
104
294
|
warnOnce('presence beat', error);
|
|
105
295
|
return false;
|
|
106
296
|
}
|
|
297
|
+
if (withPlatform)
|
|
298
|
+
sendPlatform = true;
|
|
107
299
|
beatLanded.add(product);
|
|
108
300
|
return true;
|
|
109
301
|
}, (err) => { warnOnce('presence beat', err); return false; });
|
|
@@ -111,46 +303,77 @@ export function beatPresence(supabase, product) {
|
|
|
111
303
|
return p;
|
|
112
304
|
}
|
|
113
305
|
/**
|
|
114
|
-
* Beat now,
|
|
115
|
-
*
|
|
306
|
+
* Beat now — or, on the web, at the first interaction — then every
|
|
307
|
+
* {@link PRESENCE_BEAT_MS} while the page is visible, and straight away when it
|
|
308
|
+
* becomes visible again. Returns a stop function.
|
|
116
309
|
*
|
|
117
310
|
* A hidden page does not beat: a backgrounded tab is not someone using the app,
|
|
118
311
|
* and it drops out of "live" within two minutes on its own.
|
|
119
312
|
*/
|
|
120
|
-
export function startPresence(supabase, product) {
|
|
313
|
+
export function startPresence(supabase, product, options = {}) {
|
|
121
314
|
if (typeof window === 'undefined')
|
|
122
315
|
return () => { };
|
|
123
316
|
const hidden = () => typeof document !== 'undefined' && document.visibilityState === 'hidden';
|
|
124
317
|
const tick = () => { if (!hidden())
|
|
125
318
|
void beatPresence(supabase, product); };
|
|
126
|
-
tick();
|
|
127
|
-
const timer = window.setInterval(tick, PRESENCE_BEAT_MS);
|
|
128
319
|
const onVisible = () => { if (!hidden())
|
|
129
320
|
tick(); };
|
|
130
|
-
|
|
321
|
+
let timer = null;
|
|
322
|
+
const begin = () => {
|
|
323
|
+
if (timer !== null)
|
|
324
|
+
return;
|
|
325
|
+
tick();
|
|
326
|
+
timer = window.setInterval(tick, PRESENCE_BEAT_MS);
|
|
327
|
+
document.addEventListener('visibilitychange', onVisible);
|
|
328
|
+
};
|
|
329
|
+
// An installed app was opened on purpose; a web page has to be touched first.
|
|
330
|
+
const wait = options.requireInteraction === false || isInstalledApp()
|
|
331
|
+
? (begin(), () => { })
|
|
332
|
+
: onFirstInteraction(begin);
|
|
131
333
|
return () => {
|
|
132
|
-
|
|
334
|
+
wait();
|
|
335
|
+
if (timer !== null) {
|
|
336
|
+
window.clearInterval(timer);
|
|
337
|
+
timer = null;
|
|
338
|
+
}
|
|
133
339
|
document.removeEventListener('visibilitychange', onVisible);
|
|
134
340
|
};
|
|
135
341
|
}
|
|
342
|
+
/** A `{ total, live, web, native }` out of anything, or null. The two splits
|
|
343
|
+
* are `null` rather than 0 when absent: 0 is a claim ("nobody is on the web"),
|
|
344
|
+
* null is the absence of one. */
|
|
345
|
+
function readCounts(row) {
|
|
346
|
+
const r = row;
|
|
347
|
+
const total = Number(r?.total);
|
|
348
|
+
const live = Number(r?.live);
|
|
349
|
+
if (!Number.isFinite(total) || !Number.isFinite(live))
|
|
350
|
+
return null;
|
|
351
|
+
return { total, live, web: optionalCount(r?.web), native: optionalCount(r?.native) };
|
|
352
|
+
}
|
|
353
|
+
function optionalCount(value) {
|
|
354
|
+
if (value === null || value === undefined)
|
|
355
|
+
return null;
|
|
356
|
+
const n = Number(value);
|
|
357
|
+
return Number.isFinite(n) ? n : null;
|
|
358
|
+
}
|
|
136
359
|
/** The last counts this origin read for `product` (or, with 'suite', for the
|
|
137
360
|
* whole suite), or null. */
|
|
138
361
|
export function cachedUserCounts(product) {
|
|
139
362
|
if (typeof window === 'undefined')
|
|
140
363
|
return null;
|
|
141
364
|
try {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
365
|
+
// ⚠️ An entry written before 0.158.0 has no web/native in it. readCounts
|
|
366
|
+
// answers null for both rather than 0, so the cached figure paints without
|
|
367
|
+
// a split and gains one when the fresh read lands.
|
|
368
|
+
return readCounts(JSON.parse(window.localStorage.getItem(countsKey(product)) ?? 'null'));
|
|
146
369
|
}
|
|
147
370
|
catch { /* ignore */ }
|
|
148
371
|
return null;
|
|
149
372
|
}
|
|
150
373
|
/**
|
|
151
|
-
* Read `{ total, live }` for `product`. Waits (up to 3 s) for this
|
|
152
|
-
* pending beat so the reader is in the figure. Resolves null on any
|
|
153
|
-
* the caller hides its line rather than showing a wrong number.
|
|
374
|
+
* Read `{ total, live, web, native }` for `product`. Waits (up to 3 s) for this
|
|
375
|
+
* page's pending beat so the reader is in the figure. Resolves null on any
|
|
376
|
+
* failure — the caller hides its line rather than showing a wrong number.
|
|
154
377
|
*/
|
|
155
378
|
export async function fetchUserCounts(supabase, product, scope = 'app') {
|
|
156
379
|
if (typeof supabase?.rpc !== 'function')
|
|
@@ -166,15 +389,17 @@ export async function fetchUserCounts(supabase, product, scope = 'app') {
|
|
|
166
389
|
warnOnce('count read', error);
|
|
167
390
|
return null;
|
|
168
391
|
}
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
const live = Number(row?.live);
|
|
172
|
-
if (!Number.isFinite(total) || !Number.isFinite(live))
|
|
392
|
+
const read = readCounts(Array.isArray(data) ? data[0] : data);
|
|
393
|
+
if (!read)
|
|
173
394
|
return null;
|
|
174
395
|
// Somebody is reading this, and if their beat landed they are live — a
|
|
175
396
|
// count that raced the beat must not tell them "(0 live)".
|
|
176
397
|
const self = beatLanded.has(product) ? 1 : 0;
|
|
177
|
-
const counts = {
|
|
398
|
+
const counts = {
|
|
399
|
+
...read,
|
|
400
|
+
live: Math.max(read.live, self),
|
|
401
|
+
total: Math.max(read.total, read.live, self),
|
|
402
|
+
};
|
|
178
403
|
try {
|
|
179
404
|
window.localStorage.setItem(countsKey(scope === 'suite' ? 'suite' : product), JSON.stringify(counts));
|
|
180
405
|
}
|
|
@@ -194,19 +419,26 @@ export function cachedUserCountsByProduct() {
|
|
|
194
419
|
return null;
|
|
195
420
|
try {
|
|
196
421
|
const raw = JSON.parse(window.localStorage.getItem(BREAKDOWN_KEY) ?? 'null');
|
|
197
|
-
const rows = Array.isArray(raw) ? raw.filter(
|
|
422
|
+
const rows = Array.isArray(raw) ? raw.map(asProductCounts).filter(isRow) : [];
|
|
198
423
|
return rows.length > 0 ? rows : null;
|
|
199
424
|
}
|
|
200
425
|
catch { /* ignore */ }
|
|
201
426
|
return null;
|
|
202
427
|
}
|
|
203
|
-
function
|
|
204
|
-
|
|
205
|
-
|
|
428
|
+
function isRow(row) {
|
|
429
|
+
return row !== null;
|
|
430
|
+
}
|
|
431
|
+
function asProductCounts(row) {
|
|
432
|
+
const product = row?.product;
|
|
433
|
+
if (typeof product !== 'string')
|
|
434
|
+
return null;
|
|
435
|
+
const counts = readCounts(row);
|
|
436
|
+
return counts ? { product, ...counts } : null;
|
|
206
437
|
}
|
|
207
438
|
/**
|
|
208
|
-
* `{ product, total, live }` for every product anybody has ever
|
|
209
|
-
* first — the breakdown behind the suite figure (migration
|
|
439
|
+
* `{ product, total, live, web, native }` for every product anybody has ever
|
|
440
|
+
* opened, biggest first — the breakdown behind the suite figure (migration
|
|
441
|
+
* 0184).
|
|
210
442
|
*
|
|
211
443
|
* Resolves null on any failure, exactly like {@link fetchUserCounts}, so a
|
|
212
444
|
* caller shows nothing rather than a wrong number. ⚠️ **That includes an app
|
|
@@ -218,6 +450,11 @@ function isProductCounts(row) {
|
|
|
218
450
|
* ⚠️ The rows do NOT sum to `fetchUserCounts(_, _, 'suite').total`: an account
|
|
219
451
|
* using four apps is four rows here and one person there. Never add them up to
|
|
220
452
|
* produce a total — the suite figure is the total.
|
|
453
|
+
*
|
|
454
|
+
* ⚠️ `web`/`native` are null on a row whose total comes from that app's own
|
|
455
|
+
* account counter (migration 0185, the Bipolar apps): the counter has no
|
|
456
|
+
* platform in it, so a split beside it would describe a different, smaller
|
|
457
|
+
* population than the total next to it.
|
|
221
458
|
*/
|
|
222
459
|
export async function fetchUserCountsByProduct(supabase) {
|
|
223
460
|
if (typeof supabase?.rpc !== 'function')
|
|
@@ -231,12 +468,9 @@ export async function fetchUserCountsByProduct(supabase) {
|
|
|
231
468
|
const rows = (Array.isArray(data) ? data : []);
|
|
232
469
|
const counts = [];
|
|
233
470
|
for (const row of rows) {
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if (!product || !Number.isFinite(total) || !Number.isFinite(live))
|
|
238
|
-
continue;
|
|
239
|
-
counts.push({ product, total, live });
|
|
471
|
+
const parsed = asProductCounts(row);
|
|
472
|
+
if (parsed)
|
|
473
|
+
counts.push(parsed);
|
|
240
474
|
}
|
|
241
475
|
if (counts.length === 0)
|
|
242
476
|
return null;
|
|
@@ -254,19 +488,70 @@ export async function fetchUserCountsByProduct(supabase) {
|
|
|
254
488
|
return null;
|
|
255
489
|
}
|
|
256
490
|
}
|
|
491
|
+
const ID_COUNTS_KEY = 'unisim:user-counts:universal-ids';
|
|
492
|
+
function readIdCounts(row) {
|
|
493
|
+
const r = row;
|
|
494
|
+
const created = Number(r?.created);
|
|
495
|
+
const live = Number(r?.live);
|
|
496
|
+
if (!Number.isFinite(created) || !Number.isFinite(live))
|
|
497
|
+
return null;
|
|
498
|
+
return { created, live };
|
|
499
|
+
}
|
|
500
|
+
/** The last Universal ID counts this origin read, or null. */
|
|
501
|
+
export function cachedUniversalIdCounts() {
|
|
502
|
+
if (typeof window === 'undefined')
|
|
503
|
+
return null;
|
|
504
|
+
try {
|
|
505
|
+
return readIdCounts(JSON.parse(window.localStorage.getItem(ID_COUNTS_KEY) ?? 'null'));
|
|
506
|
+
}
|
|
507
|
+
catch { /* ignore */ }
|
|
508
|
+
return null;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* `{ created, live }` for Universal IDs — the row at the top of the breakdown
|
|
512
|
+
* (James, 2026-09-27). Resolves null on any failure, including a database
|
|
513
|
+
* without migration 0188, so the popup leaves the row out rather than showing
|
|
514
|
+
* a wrong number.
|
|
515
|
+
*/
|
|
516
|
+
export async function fetchUniversalIdCounts(supabase) {
|
|
517
|
+
if (typeof supabase?.rpc !== 'function')
|
|
518
|
+
return null;
|
|
519
|
+
try {
|
|
520
|
+
const { data, error } = await supabase.rpc('universal_id_counts');
|
|
521
|
+
if (error) {
|
|
522
|
+
warnOnce('universal id read', error);
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
const counts = readIdCounts(Array.isArray(data) ? data[0] : data);
|
|
526
|
+
if (!counts)
|
|
527
|
+
return null;
|
|
528
|
+
try {
|
|
529
|
+
window.localStorage.setItem(ID_COUNTS_KEY, JSON.stringify(counts));
|
|
530
|
+
}
|
|
531
|
+
catch { /* ignore */ }
|
|
532
|
+
return counts;
|
|
533
|
+
}
|
|
534
|
+
catch (err) {
|
|
535
|
+
warnOnce('universal id read', err);
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
/** "52 created", "2 live" — the Universal IDs row's figures, as separate
|
|
540
|
+
* phrases for the same reason as {@link userCountParts}. */
|
|
541
|
+
export function universalIdParts(language, counts) {
|
|
542
|
+
const nf = numberFormat(language);
|
|
543
|
+
return [
|
|
544
|
+
t(language, 'users.part_created').replace('{n}', nf.format(counts.created)),
|
|
545
|
+
t(language, 'users.part_live').replace('{n}', nf.format(counts.live)),
|
|
546
|
+
];
|
|
547
|
+
}
|
|
257
548
|
/**
|
|
258
549
|
* "There are 1,234 total users (5 live)" — or, for the 'suite' scope, "There
|
|
259
550
|
* are a total of 1,234 users across all UNI·SIM apps (5 live)" — in `language`,
|
|
260
551
|
* with the numbers grouped the way that language groups them.
|
|
261
552
|
*/
|
|
262
553
|
export function formatUserCounts(language, counts, scope = 'app') {
|
|
263
|
-
|
|
264
|
-
try {
|
|
265
|
-
nf = new Intl.NumberFormat(language ?? undefined);
|
|
266
|
-
}
|
|
267
|
-
catch {
|
|
268
|
-
nf = new Intl.NumberFormat('en');
|
|
269
|
-
}
|
|
554
|
+
const nf = numberFormat(language);
|
|
270
555
|
const one = counts.total === 1;
|
|
271
556
|
const key = scope === 'suite'
|
|
272
557
|
? (one ? 'users.suite_one' : 'users.suite_other')
|
|
@@ -275,4 +560,31 @@ export function formatUserCounts(language, counts, scope = 'app') {
|
|
|
275
560
|
.replace('{total}', nf.format(counts.total))
|
|
276
561
|
.replace('{live}', nf.format(counts.live));
|
|
277
562
|
}
|
|
563
|
+
/**
|
|
564
|
+
* The figures behind one row of the breakdown, as separate phrases — "1,234
|
|
565
|
+
* users", "900 web", "334 native", "5 live" — so the caller can lay them out
|
|
566
|
+
* and let them WRAP rather than measuring a single string (James, 2026-09-21:
|
|
567
|
+
* "show web | native | live if there's enough space").
|
|
568
|
+
*
|
|
569
|
+
* The split is left out entirely when it is not available, rather than shown as
|
|
570
|
+
* "0 web · 0 native": see {@link UserCounts.web}.
|
|
571
|
+
*/
|
|
572
|
+
export function userCountParts(language, counts) {
|
|
573
|
+
const nf = numberFormat(language);
|
|
574
|
+
const say = (key, n) => t(language, key).replace('{n}', nf.format(n));
|
|
575
|
+
const parts = [say(counts.total === 1 ? 'users.part_total_one' : 'users.part_total', counts.total)];
|
|
576
|
+
if (typeof counts.web === 'number' && typeof counts.native === 'number') {
|
|
577
|
+
parts.push(say('users.part_web', counts.web), say('users.part_native', counts.native));
|
|
578
|
+
}
|
|
579
|
+
parts.push(say('users.part_live', counts.live));
|
|
580
|
+
return parts;
|
|
581
|
+
}
|
|
582
|
+
function numberFormat(language) {
|
|
583
|
+
try {
|
|
584
|
+
return new Intl.NumberFormat(language ?? undefined);
|
|
585
|
+
}
|
|
586
|
+
catch {
|
|
587
|
+
return new Intl.NumberFormat('en');
|
|
588
|
+
}
|
|
589
|
+
}
|
|
278
590
|
//# sourceMappingURL=presence.js.map
|
package/dist/presence.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presence.js","sourceRoot":"","sources":["../src/presence.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,sDAAsD;AACtD,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,6EAA6E;AAC7E,4CAA4C;AAC5C,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,0EAA0E;AAC1E,8EAA8E;AAC9E,8EAA8E;AAC9E,0EAA0E;AAC1E,wEAAwE;AACxE,8EAA8E;AAC9E,uEAAuE;AACvE,0EAA0E;AAC1E,6EAA6E;AAC7E,4EAA4E;AAC5E,wDAAwD;AACxD,EAAE;AACF,yEAAyE;AACzE,0DAA0D;AAC1D,EAAE;AACF,iFAAiF;AACjF,2EAA2E;AAC3E,oEAAoE;AACpE,iFAAiF;AAIjF,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAA;AAE7B,yDAAyD;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAA;AAEjD,mFAAmF;AACnF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAA;AAkBtC;;;;;sCAKsC;AACtC,MAAM,CAAC,MAAM,eAAe,GAAG,yBAAyB,CAAA;AAExD,MA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CAAC,kBAAkB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IACnG,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QACxE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;IACxF,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IAC/C,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,YAAY,CAAC,QAAmC;IACvD,IAAI,CAAC;QAAC,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,IAAI,SAAS,CAAC,CAAA;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;IAAC,CAAC;AAC1G,CAAC"}
|
package/dist/provider.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type ReactNode } from 'react';
|
|
|
3
3
|
import type { ProductCode } from './types.js';
|
|
4
4
|
import { type Language } from './i18n.js';
|
|
5
5
|
import { type RevealOnExpandOptions } from './revealOnExpand.js';
|
|
6
|
+
import { type PresenceOptions } from './presence.js';
|
|
6
7
|
import type { ThemePref } from './themeStore.js';
|
|
7
8
|
export interface UniversalConfig {
|
|
8
9
|
supabaseUrl: string;
|
|
@@ -67,8 +68,14 @@ export interface UniversalConfig {
|
|
|
67
68
|
* in the navbar menu (see presence.ts). ON for every product unless set to
|
|
68
69
|
* false; skipped anyway in mockAuth mode, with no `supabaseUrl`, and on the
|
|
69
70
|
* hubs (`central`). Guests beat too — the figure counts everyone.
|
|
71
|
+
*
|
|
72
|
+
* ⚠️ Since 0.158.0 a WEB app reports itself only once the person interacts
|
|
73
|
+
* with the page — a load on its own is not somebody using the app. Pass
|
|
74
|
+
* `{ requireInteraction: false }` for a surface that is watched rather than
|
|
75
|
+
* touched (a wall display, a kiosk). An installed app never waits: opening it
|
|
76
|
+
* is the interaction.
|
|
70
77
|
*/
|
|
71
|
-
presence?: boolean;
|
|
78
|
+
presence?: boolean | PresenceOptions;
|
|
72
79
|
}
|
|
73
80
|
interface UniversalContextValue {
|
|
74
81
|
config: UniversalConfig;
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAGvF,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAqC,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAA;AAE5E,OAAO,EAAyB,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAGvF,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAqC,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAA;AAE5E,OAAO,EAAyB,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACvF,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AAGnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,MAAM,WAAW,eAAe;IAC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ED
|
@@ -274,11 +274,17 @@ export function UniversalProvider({ config, children }) {
|
|
|
274
274
|
// guest) rather than up to 45 s later.
|
|
275
275
|
const presenceUser = session?.user?.id ?? null;
|
|
276
276
|
const presenceOn = config.presence !== false && !mockActive && !!config.supabaseUrl && config.product !== 'central';
|
|
277
|
+
// Serialised for the same reason `revealOnExpand` is: a product writing the
|
|
278
|
+
// options inline hands a new object every render, and depending on it by
|
|
279
|
+
// identity would tear presence down and restart it on each one — which, with
|
|
280
|
+
// the interaction gate in front of the first beat, would also mean beating
|
|
281
|
+
// twice for one person.
|
|
282
|
+
const presenceKey = typeof config.presence === 'object' ? JSON.stringify(config.presence) : '';
|
|
277
283
|
useEffect(() => {
|
|
278
284
|
if (!presenceOn)
|
|
279
285
|
return;
|
|
280
|
-
return startPresence(supabase, config.product);
|
|
281
|
-
}, [presenceOn, supabase, config.product, presenceUser]);
|
|
286
|
+
return startPresence(supabase, config.product, presenceKey ? JSON.parse(presenceKey) : undefined);
|
|
287
|
+
}, [presenceOn, supabase, config.product, presenceUser, presenceKey]);
|
|
282
288
|
const [activeOrgId, setActiveOrgIdState] = useState(() => {
|
|
283
289
|
if (typeof window === 'undefined')
|
|
284
290
|
return null;
|