@unisim/sdk 0.122.3 → 0.123.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/Package.swift +24 -0
- package/README.md +44 -0
- package/UnisimSdk.podspec +28 -0
- package/dist/UniversalAppsNavBar.d.ts +7 -1
- package/dist/UniversalAppsNavBar.d.ts.map +1 -1
- package/dist/UniversalAppsNavBar.js +48 -9
- package/dist/UniversalAppsNavBar.js.map +1 -1
- package/dist/UserProfile.js +11 -3
- package/dist/UserProfile.js.map +1 -1
- package/dist/barTheme.d.ts +10 -0
- package/dist/barTheme.d.ts.map +1 -1
- package/dist/barTheme.js +7 -0
- package/dist/barTheme.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +22 -69
- package/dist/provider.js.map +1 -1
- package/dist/sessionStorage.d.ts +91 -0
- package/dist/sessionStorage.d.ts.map +1 -0
- package/dist/sessionStorage.js +239 -0
- package/dist/sessionStorage.js.map +1 -0
- package/ios/Sources/UnisimSuiteAuthPlugin/UnisimSuiteAuthPlugin.swift +241 -0
- package/package.json +12 -2
package/dist/provider.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createClient } from '@supabase/supabase-js';
|
|
4
|
+
import { chooseSessionStorage, createCookieStorage } from './sessionStorage.js';
|
|
4
5
|
import { createContext, useContext, useEffect, useMemo, useState, } from 'react';
|
|
5
6
|
import { DEFAULT_LANGUAGE, resolveLanguage } from './i18n.js';
|
|
6
7
|
import { createMockSupabase } from './mockAuth.js';
|
|
@@ -37,93 +38,45 @@ const UNIVERSAL_APP_PRODUCTS = [
|
|
|
37
38
|
function isUniversalApp(product) {
|
|
38
39
|
return UNIVERSAL_APP_PRODUCTS.includes(product);
|
|
39
40
|
}
|
|
40
|
-
// ──────────────────────────────────────────────────────────────────────────────
|
|
41
|
-
// Cookie-backed storage adapter — the load-bearing piece for cross-subdomain
|
|
42
|
-
// SSO. Supabase JS defaults to localStorage which is origin-scoped, so a
|
|
43
|
-
// session created at app.unisim.co.uk wouldn't be visible to a product at
|
|
44
|
-
// assess.unisim.co.uk. By writing the session JSON into a cookie scoped to
|
|
45
|
-
// the parent zone (.unisim.co.uk), every subdomain reads the same auth.
|
|
46
|
-
//
|
|
47
|
-
// Only used in production (when cookieDomain is set). Local dev keeps
|
|
48
|
-
// localStorage so a single product running at localhost:5180 behaves
|
|
49
|
-
// normally.
|
|
50
|
-
// ──────────────────────────────────────────────────────────────────────────────
|
|
51
|
-
function createCookieStorage(domain) {
|
|
52
|
-
const secure = typeof window !== 'undefined' && window.location.protocol === 'https:';
|
|
53
|
-
return {
|
|
54
|
-
getItem(key) {
|
|
55
|
-
if (typeof document === 'undefined')
|
|
56
|
-
return null;
|
|
57
|
-
const encoded = encodeURIComponent(key);
|
|
58
|
-
for (const cookie of document.cookie.split('; ')) {
|
|
59
|
-
const eq = cookie.indexOf('=');
|
|
60
|
-
const name = eq === -1 ? cookie : cookie.slice(0, eq);
|
|
61
|
-
if (name === encoded) {
|
|
62
|
-
return eq === -1 ? '' : decodeURIComponent(cookie.slice(eq + 1));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
66
|
-
},
|
|
67
|
-
setItem(key, value) {
|
|
68
|
-
if (typeof document === 'undefined')
|
|
69
|
-
return;
|
|
70
|
-
const parts = [
|
|
71
|
-
`${encodeURIComponent(key)}=${encodeURIComponent(value)}`,
|
|
72
|
-
'Path=/',
|
|
73
|
-
`Domain=${domain}`,
|
|
74
|
-
`Max-Age=${60 * 60 * 24 * 365}`, // 1 year
|
|
75
|
-
'SameSite=Lax',
|
|
76
|
-
];
|
|
77
|
-
if (secure)
|
|
78
|
-
parts.push('Secure');
|
|
79
|
-
document.cookie = parts.join('; ');
|
|
80
|
-
},
|
|
81
|
-
removeItem(key) {
|
|
82
|
-
if (typeof document === 'undefined')
|
|
83
|
-
return;
|
|
84
|
-
const parts = [
|
|
85
|
-
`${encodeURIComponent(key)}=`,
|
|
86
|
-
'Path=/',
|
|
87
|
-
`Domain=${domain}`,
|
|
88
|
-
'Max-Age=0',
|
|
89
|
-
'SameSite=Lax',
|
|
90
|
-
];
|
|
91
|
-
if (secure)
|
|
92
|
-
parts.push('Secure');
|
|
93
|
-
document.cookie = parts.join('; ');
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
41
|
export function UniversalProvider({ config, children }) {
|
|
98
42
|
// Offline "dummy account" mode is only ever honoured in local dev: setting a
|
|
99
43
|
// cookieDomain is what every product does in production, so requiring it to be
|
|
100
44
|
// absent means a stray mockAuth:true in a prod build is a no-op.
|
|
101
45
|
const mockActive = !!config.mockAuth && !config.cookieDomain;
|
|
46
|
+
// Which store backs the session on THIS platform, decided in one place —
|
|
47
|
+
// see sessionStorage.ts for why the answer is not simply "cookie when we
|
|
48
|
+
// know the parent zone". It also settles whether sibling suite state (the
|
|
49
|
+
// active org) can ride the same cookie.
|
|
50
|
+
const sessionStore = useMemo(() => chooseSessionStorage(config.cookieDomain), [config.cookieDomain]);
|
|
102
51
|
const supabase = useMemo(() => {
|
|
103
52
|
if (mockActive)
|
|
104
53
|
return createMockSupabase();
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
54
|
+
// The cookie domain (e.g. .unisim.co.uk) is what makes a browser session
|
|
55
|
+
// visible to every subdomain — that's the web SSO mechanism. Inside a
|
|
56
|
+
// Capacitor container it is unusable and the shared Keychain takes over;
|
|
57
|
+
// `chooseSessionStorage` owns that decision.
|
|
58
|
+
//
|
|
59
|
+
// ⚠️ `cookieOptions` is gated on `cookiesUsable`, not on `cookieDomain`.
|
|
60
|
+
// Handing supabase-js a cookie domain the origin cannot write to is how
|
|
61
|
+
// the native builds ended up unable to persist a session at all.
|
|
111
62
|
return createClient(config.supabaseUrl, config.supabaseAnonKey, {
|
|
112
63
|
auth: {
|
|
113
64
|
persistSession: true,
|
|
114
65
|
autoRefreshToken: true,
|
|
115
66
|
detectSessionInUrl: true,
|
|
116
67
|
storageKey: 'universal-suite-auth',
|
|
117
|
-
...(storage ? { storage } : {}),
|
|
118
|
-
...(config.cookieDomain
|
|
68
|
+
...(sessionStore.storage ? { storage: sessionStore.storage } : {}),
|
|
69
|
+
...(sessionStore.cookiesUsable && config.cookieDomain
|
|
119
70
|
? { cookieOptions: { domain: config.cookieDomain, sameSite: 'lax' } }
|
|
120
71
|
: {}),
|
|
121
72
|
},
|
|
122
73
|
});
|
|
123
|
-
}, [mockActive, config.supabaseUrl, config.supabaseAnonKey, config.cookieDomain]);
|
|
74
|
+
}, [mockActive, config.supabaseUrl, config.supabaseAnonKey, config.cookieDomain, sessionStore]);
|
|
124
75
|
// Helper for the activeOrgId state — same cookie domain as the session so
|
|
125
76
|
// the user's "active org" choice also travels across subdomains.
|
|
126
|
-
const orgIdStore = useMemo(() =>
|
|
77
|
+
const orgIdStore = useMemo(() => (sessionStore.cookiesUsable && config.cookieDomain)
|
|
78
|
+
? createCookieStorage(config.cookieDomain)
|
|
79
|
+
: null, [config.cookieDomain, sessionStore]);
|
|
127
80
|
// Language preference. For Assess products (Ergo / Cyber / Workplace /
|
|
128
81
|
// future enterprise apps), the cookie rides on .unisim.co.uk so the
|
|
129
82
|
// choice follows the user into the next Assess product they open. The
|
|
@@ -132,9 +85,9 @@ export function UniversalProvider({ config, children }) {
|
|
|
132
85
|
// to the current app's origin so an anonymous PDF user picking French
|
|
133
86
|
// doesn't suddenly reframe the Assess SaaS for a different user on the
|
|
134
87
|
// same machine.
|
|
135
|
-
const languageStore = useMemo(() => (config.cookieDomain && !isUniversalApp(config.product))
|
|
88
|
+
const languageStore = useMemo(() => (sessionStore.cookiesUsable && config.cookieDomain && !isUniversalApp(config.product))
|
|
136
89
|
? createCookieStorage(config.cookieDomain)
|
|
137
|
-
: null, [config.cookieDomain, config.product]);
|
|
90
|
+
: null, [config.cookieDomain, config.product, sessionStore]);
|
|
138
91
|
const [session, setSession] = useState(null);
|
|
139
92
|
const [loading, setLoading] = useState(true);
|
|
140
93
|
const [activeOrgId, setActiveOrgIdState] = useState(() => {
|
package/dist/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,YAAY,EAAqC,MAAM,uBAAuB,CAAA;AACvF,OAAO,EACL,aAAa,EACb,UAAU,EACV,SAAS,EACT,OAAO,EACP,QAAQ,GAET,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAiB,MAAM,WAAW,CAAA;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAmDlD,MAAM,gBAAgB,GAAG,aAAa,CAA+B,IAAI,CAAC,CAAA;AAE1E,MAAM,sBAAsB,GAAG,yBAAyB,CAAA;AACxD,MAAM,oBAAoB,GAAK,oBAAoB,CAAA;AAEnD,uEAAuE;AACvE,0EAA0E;AAC1E,kEAAkE;AAClE,0EAA0E;AAC1E,wEAAwE;AACxE,0EAA0E;AAC1E,sDAAsD;AACtD,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,gCAAgC;AAChC,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,yEAAyE;AACzE,sEAAsE;AACtE,8EAA8E;AAC9E,6EAA6E;AAC7E,0CAA0C;AAC1C,EAAE;AACF,8EAA8E;AAC9E,+DAA+D;AAC/D,MAAM,sBAAsB,GAA2B;IACrD,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY;IACzD,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,KAA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AA;IAChD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAA;AAClC,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape supabase-js wants for `auth.storage`. Every method may be async —
|
|
3
|
+
* the Keychain bridge is, and supabase-js awaits all three.
|
|
4
|
+
*/
|
|
5
|
+
export interface SessionStorageAdapter {
|
|
6
|
+
getItem(key: string): string | null | Promise<string | null>;
|
|
7
|
+
setItem(key: string, value: string): void | Promise<void>;
|
|
8
|
+
removeItem(key: string): void | Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The synchronous subset — what the cookie adapter actually is.
|
|
12
|
+
*
|
|
13
|
+
* ⚠️ Keep this distinction. The active-org and language stores read their
|
|
14
|
+
* value inside a `useState` INITIALISER, which cannot await; typing the cookie
|
|
15
|
+
* adapter as merely "possibly async" made those reads compile as
|
|
16
|
+
* `Promise<string> | string | null` and the org id would have been a pending
|
|
17
|
+
* promise stringified into a cookie. The compiler caught it; the runtime would
|
|
18
|
+
* not have said anything.
|
|
19
|
+
*/
|
|
20
|
+
export interface SyncSessionStorageAdapter {
|
|
21
|
+
getItem(key: string): string | null;
|
|
22
|
+
setItem(key: string, value: string): void;
|
|
23
|
+
removeItem(key: string): void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* True inside a Capacitor container (iOS/Android), false in any browser.
|
|
27
|
+
*
|
|
28
|
+
* ⚠️ Deliberately does NOT trust `cookieDomain` or the build mode to tell it
|
|
29
|
+
* apart. Every product computes `cookieDomain` from `import.meta.env.PROD`,
|
|
30
|
+
* which is true in the native bundle as well as the web one — that shared
|
|
31
|
+
* expression is exactly what made the native session storage silently wrong.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isNativeShell(): boolean;
|
|
34
|
+
interface SuiteAuthPlugin {
|
|
35
|
+
get(options: {
|
|
36
|
+
key: string;
|
|
37
|
+
}): Promise<{
|
|
38
|
+
value: string | null;
|
|
39
|
+
}>;
|
|
40
|
+
set(options: {
|
|
41
|
+
key: string;
|
|
42
|
+
value: string;
|
|
43
|
+
}): Promise<void>;
|
|
44
|
+
remove(options: {
|
|
45
|
+
key: string;
|
|
46
|
+
}): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
/** True when this native build can reach the shared-Keychain plugin. */
|
|
49
|
+
export declare function hasSharedKeychain(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Keychain-backed storage, shared across every suite app signed by the same
|
|
52
|
+
* team. Async, which supabase-js supports.
|
|
53
|
+
*
|
|
54
|
+
* ⚠️ On a plugin ERROR this falls back to localStorage for that call, so a
|
|
55
|
+
* Keychain hiccup degrades to an app-local session rather than signing the
|
|
56
|
+
* user out. A plugin returning `null` is NOT an error — it means "no session
|
|
57
|
+
* in the shared store", and must be reported as such, or a sign-out in one app
|
|
58
|
+
* would never be seen by the others.
|
|
59
|
+
*/
|
|
60
|
+
export declare function createSharedKeychainStorage(plugin: SuiteAuthPlugin): SessionStorageAdapter;
|
|
61
|
+
/**
|
|
62
|
+
* Cookie-backed storage — the load-bearing piece for cross-subdomain SSO.
|
|
63
|
+
* supabase-js defaults to localStorage which is origin-scoped, so a session
|
|
64
|
+
* created at app.unisim.co.uk wouldn't be visible to a product at
|
|
65
|
+
* assess.unisim.co.uk. Writing the session JSON into a cookie scoped to the
|
|
66
|
+
* parent zone (.unisim.co.uk) means every subdomain reads the same auth.
|
|
67
|
+
*
|
|
68
|
+
* ⚠️ Only usable from an origin that actually sits under `domain`. From
|
|
69
|
+
* anywhere else — `capacitor://localhost`, a dev server on localhost, a
|
|
70
|
+
* file:// Electron renderer — the browser rejects the write outright and every
|
|
71
|
+
* read returns null. `chooseSessionStorage()` is what keeps that from
|
|
72
|
+
* happening; don't reach for this adapter directly.
|
|
73
|
+
*/
|
|
74
|
+
export declare function createCookieStorage(domain: string): SyncSessionStorageAdapter;
|
|
75
|
+
export type SessionStorageKind = 'shared-keychain' | 'native-local' | 'shared-cookie' | 'local';
|
|
76
|
+
export interface ChosenSessionStorage {
|
|
77
|
+
kind: SessionStorageKind;
|
|
78
|
+
/** `undefined` means "let supabase-js use its own localStorage adapter". */
|
|
79
|
+
storage: SessionStorageAdapter | undefined;
|
|
80
|
+
/** Whether sibling suite state (active org) may ride the same cookie. */
|
|
81
|
+
cookiesUsable: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Pick the session store for the platform this code is running on.
|
|
85
|
+
*
|
|
86
|
+
* The native check comes FIRST and overrides `cookieDomain`, because every
|
|
87
|
+
* native build sets `cookieDomain` and none of them can use it.
|
|
88
|
+
*/
|
|
89
|
+
export declare function chooseSessionStorage(cookieDomain?: string): ChosenSessionStorage;
|
|
90
|
+
export {};
|
|
91
|
+
//# sourceMappingURL=sessionStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionStorage.d.ts","sourceRoot":"","sources":["../src/sessionStorage.ts"],"names":[],"mappings":"AAoCA;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IAC5D,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACzD,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC9C;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IACnC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACzC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B;AAgBD;;;;;;;GAOG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAcvC;AAID,UAAU,eAAe;IACvB,GAAG,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;IAChE,GAAG,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3D,MAAM,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAChD;AAOD,wEAAwE;AACxE,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAQD;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,eAAe,GAAG,qBAAqB,CAmD1F;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,yBAAyB,CA0C7E;AAID,MAAM,MAAM,kBAAkB,GAC1B,iBAAiB,GACjB,cAAc,GACd,eAAe,GACf,OAAO,CAAA;AAEX,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,kBAAkB,CAAA;IACxB,4EAA4E;IAC5E,OAAO,EAAE,qBAAqB,GAAG,SAAS,CAAA;IAC1C,yEAAyE;IACzE,aAAa,EAAE,OAAO,CAAA;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAsBhF"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2
|
+
// Where the Supabase session lives, per platform.
|
|
3
|
+
//
|
|
4
|
+
// supabase-js keeps the session in whatever `auth.storage` it is handed. The
|
|
5
|
+
// suite needs three different answers, and getting the wrong one is silent
|
|
6
|
+
// every time — a session that fails to persist looks exactly like a session
|
|
7
|
+
// that was never created:
|
|
8
|
+
//
|
|
9
|
+
// • **Browser, production** — a cookie scoped to the parent zone
|
|
10
|
+
// (.unisim.co.uk), so app.unisim.co.uk and assess.unisim.co.uk read the
|
|
11
|
+
// same auth. This is the cross-subdomain SSO mechanism and predates this
|
|
12
|
+
// module; it moved here unchanged.
|
|
13
|
+
//
|
|
14
|
+
// • **Browser, local dev / Electron** — localStorage. There is no parent
|
|
15
|
+
// zone to scope a cookie to on localhost or file://.
|
|
16
|
+
//
|
|
17
|
+
// • **Native (Capacitor)** — the iOS Keychain, in a group shared by every
|
|
18
|
+
// suite app, via the UnisimSuiteAuth plugin. Falls back to localStorage
|
|
19
|
+
// when the plugin is absent.
|
|
20
|
+
//
|
|
21
|
+
// ⚠️ **The native case is why this module exists.** A Capacitor app runs at
|
|
22
|
+
// `capacitor://localhost`, and a cookie written from there with
|
|
23
|
+
// `Domain=.unisim.co.uk` is REJECTED by the cookie domain-match rule — the
|
|
24
|
+
// write silently does nothing and the read comes back null. Every native build
|
|
25
|
+
// sets `cookieDomain` (it is gated on `import.meta.env.PROD`, which is true in
|
|
26
|
+
// the native bundle), so until this module landed **the native apps could not
|
|
27
|
+
// persist a session at all**: sign in, force-quit, and you were signed out
|
|
28
|
+
// again, with nothing logged. `sessionStorage.browser.test.mjs` pins that
|
|
29
|
+
// behaviour so it cannot come back.
|
|
30
|
+
//
|
|
31
|
+
// The shared Keychain then buys the thing that was actually asked for: sign in
|
|
32
|
+
// on Universal Images on the phone and Universal PDF is already signed in.
|
|
33
|
+
// Sign-out is suite-wide too, which matches how the shared cookie already
|
|
34
|
+
// behaves on the web.
|
|
35
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
36
|
+
function capacitorGlobal() {
|
|
37
|
+
if (typeof window === 'undefined')
|
|
38
|
+
return null;
|
|
39
|
+
const c = window.Capacitor;
|
|
40
|
+
return c ?? null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* True inside a Capacitor container (iOS/Android), false in any browser.
|
|
44
|
+
*
|
|
45
|
+
* ⚠️ Deliberately does NOT trust `cookieDomain` or the build mode to tell it
|
|
46
|
+
* apart. Every product computes `cookieDomain` from `import.meta.env.PROD`,
|
|
47
|
+
* which is true in the native bundle as well as the web one — that shared
|
|
48
|
+
* expression is exactly what made the native session storage silently wrong.
|
|
49
|
+
*/
|
|
50
|
+
export function isNativeShell() {
|
|
51
|
+
const c = capacitorGlobal();
|
|
52
|
+
if (c && typeof c.isNativePlatform === 'function') {
|
|
53
|
+
try {
|
|
54
|
+
return c.isNativePlatform();
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
/* fall through to the protocol check */
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// A partially-initialised bridge still serves the app from the container's
|
|
61
|
+
// own scheme, which no browser uses.
|
|
62
|
+
if (typeof window === 'undefined')
|
|
63
|
+
return false;
|
|
64
|
+
const protocol = window.location?.protocol;
|
|
65
|
+
return protocol === 'capacitor:' || protocol === 'ionic:';
|
|
66
|
+
}
|
|
67
|
+
function suiteAuthPlugin() {
|
|
68
|
+
const plugin = capacitorGlobal()?.Plugins?.UnisimSuiteAuth;
|
|
69
|
+
return plugin ? plugin : null;
|
|
70
|
+
}
|
|
71
|
+
/** True when this native build can reach the shared-Keychain plugin. */
|
|
72
|
+
export function hasSharedKeychain() {
|
|
73
|
+
return suiteAuthPlugin() !== null;
|
|
74
|
+
}
|
|
75
|
+
function localStorageAdapter() {
|
|
76
|
+
// `undefined` lets supabase-js install its own localStorage adapter, which
|
|
77
|
+
// already handles the private-mode / storage-disabled throw.
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Keychain-backed storage, shared across every suite app signed by the same
|
|
82
|
+
* team. Async, which supabase-js supports.
|
|
83
|
+
*
|
|
84
|
+
* ⚠️ On a plugin ERROR this falls back to localStorage for that call, so a
|
|
85
|
+
* Keychain hiccup degrades to an app-local session rather than signing the
|
|
86
|
+
* user out. A plugin returning `null` is NOT an error — it means "no session
|
|
87
|
+
* in the shared store", and must be reported as such, or a sign-out in one app
|
|
88
|
+
* would never be seen by the others.
|
|
89
|
+
*/
|
|
90
|
+
export function createSharedKeychainStorage(plugin) {
|
|
91
|
+
let warned = false;
|
|
92
|
+
const warn = (op, err) => {
|
|
93
|
+
if (warned)
|
|
94
|
+
return;
|
|
95
|
+
warned = true;
|
|
96
|
+
console.warn(`[unisim/sdk] shared Keychain ${op} failed; falling back to app-local storage. ` +
|
|
97
|
+
'Sign-in will not carry across the suite apps on this device.', err);
|
|
98
|
+
};
|
|
99
|
+
const local = {
|
|
100
|
+
get: (key) => {
|
|
101
|
+
try {
|
|
102
|
+
return window.localStorage.getItem(key);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
set: (key, value) => {
|
|
109
|
+
try {
|
|
110
|
+
window.localStorage.setItem(key, value);
|
|
111
|
+
}
|
|
112
|
+
catch { /* private mode */ }
|
|
113
|
+
},
|
|
114
|
+
remove: (key) => {
|
|
115
|
+
try {
|
|
116
|
+
window.localStorage.removeItem(key);
|
|
117
|
+
}
|
|
118
|
+
catch { /* private mode */ }
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
return {
|
|
122
|
+
async getItem(key) {
|
|
123
|
+
try {
|
|
124
|
+
const { value } = await plugin.get({ key });
|
|
125
|
+
return value ?? null;
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
warn('read', err);
|
|
129
|
+
return local.get(key);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
async setItem(key, value) {
|
|
133
|
+
try {
|
|
134
|
+
await plugin.set({ key, value });
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
warn('write', err);
|
|
138
|
+
local.set(key, value);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
async removeItem(key) {
|
|
142
|
+
try {
|
|
143
|
+
await plugin.remove({ key });
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
warn('delete', err);
|
|
147
|
+
local.remove(key);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
// ── Browser: the cross-subdomain cookie ──────────────────────────────────────
|
|
153
|
+
/**
|
|
154
|
+
* Cookie-backed storage — the load-bearing piece for cross-subdomain SSO.
|
|
155
|
+
* supabase-js defaults to localStorage which is origin-scoped, so a session
|
|
156
|
+
* created at app.unisim.co.uk wouldn't be visible to a product at
|
|
157
|
+
* assess.unisim.co.uk. Writing the session JSON into a cookie scoped to the
|
|
158
|
+
* parent zone (.unisim.co.uk) means every subdomain reads the same auth.
|
|
159
|
+
*
|
|
160
|
+
* ⚠️ Only usable from an origin that actually sits under `domain`. From
|
|
161
|
+
* anywhere else — `capacitor://localhost`, a dev server on localhost, a
|
|
162
|
+
* file:// Electron renderer — the browser rejects the write outright and every
|
|
163
|
+
* read returns null. `chooseSessionStorage()` is what keeps that from
|
|
164
|
+
* happening; don't reach for this adapter directly.
|
|
165
|
+
*/
|
|
166
|
+
export function createCookieStorage(domain) {
|
|
167
|
+
const secure = typeof window !== 'undefined' && window.location.protocol === 'https:';
|
|
168
|
+
return {
|
|
169
|
+
getItem(key) {
|
|
170
|
+
if (typeof document === 'undefined')
|
|
171
|
+
return null;
|
|
172
|
+
const encoded = encodeURIComponent(key);
|
|
173
|
+
for (const cookie of document.cookie.split('; ')) {
|
|
174
|
+
const eq = cookie.indexOf('=');
|
|
175
|
+
const name = eq === -1 ? cookie : cookie.slice(0, eq);
|
|
176
|
+
if (name === encoded) {
|
|
177
|
+
return eq === -1 ? '' : decodeURIComponent(cookie.slice(eq + 1));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return null;
|
|
181
|
+
},
|
|
182
|
+
setItem(key, value) {
|
|
183
|
+
if (typeof document === 'undefined')
|
|
184
|
+
return;
|
|
185
|
+
const parts = [
|
|
186
|
+
`${encodeURIComponent(key)}=${encodeURIComponent(value)}`,
|
|
187
|
+
'Path=/',
|
|
188
|
+
`Domain=${domain}`,
|
|
189
|
+
`Max-Age=${60 * 60 * 24 * 365}`, // 1 year
|
|
190
|
+
'SameSite=Lax',
|
|
191
|
+
];
|
|
192
|
+
if (secure)
|
|
193
|
+
parts.push('Secure');
|
|
194
|
+
document.cookie = parts.join('; ');
|
|
195
|
+
},
|
|
196
|
+
removeItem(key) {
|
|
197
|
+
if (typeof document === 'undefined')
|
|
198
|
+
return;
|
|
199
|
+
const parts = [
|
|
200
|
+
`${encodeURIComponent(key)}=`,
|
|
201
|
+
'Path=/',
|
|
202
|
+
`Domain=${domain}`,
|
|
203
|
+
'Max-Age=0',
|
|
204
|
+
'SameSite=Lax',
|
|
205
|
+
];
|
|
206
|
+
if (secure)
|
|
207
|
+
parts.push('Secure');
|
|
208
|
+
document.cookie = parts.join('; ');
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Pick the session store for the platform this code is running on.
|
|
214
|
+
*
|
|
215
|
+
* The native check comes FIRST and overrides `cookieDomain`, because every
|
|
216
|
+
* native build sets `cookieDomain` and none of them can use it.
|
|
217
|
+
*/
|
|
218
|
+
export function chooseSessionStorage(cookieDomain) {
|
|
219
|
+
if (isNativeShell()) {
|
|
220
|
+
const plugin = suiteAuthPlugin();
|
|
221
|
+
if (plugin) {
|
|
222
|
+
return {
|
|
223
|
+
kind: 'shared-keychain',
|
|
224
|
+
storage: createSharedKeychainStorage(plugin),
|
|
225
|
+
cookiesUsable: false,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
return { kind: 'native-local', storage: localStorageAdapter(), cookiesUsable: false };
|
|
229
|
+
}
|
|
230
|
+
if (cookieDomain) {
|
|
231
|
+
return {
|
|
232
|
+
kind: 'shared-cookie',
|
|
233
|
+
storage: createCookieStorage(cookieDomain),
|
|
234
|
+
cookiesUsable: true,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
return { kind: 'local', storage: localStorageAdapter(), cookiesUsable: false };
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=sessionStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionStorage.js","sourceRoot":"","sources":["../src/sessionStorage.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,4EAA4E;AAC5E,0BAA0B;AAC1B,EAAE;AACF,mEAAmE;AACnE,4EAA4E;AAC5E,6EAA6E;AAC7E,uCAAuC;AACvC,EAAE;AACF,2EAA2E;AAC3E,yDAAyD;AACzD,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,iCAAiC;AACjC,EAAE;AACF,4EAA4E;AAC5E,gEAAgE;AAChE,2EAA2E;AAC3E,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,2EAA2E;AAC3E,0EAA0E;AAC1E,oCAAoC;AACpC,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,0EAA0E;AAC1E,sBAAsB;AACtB,gFAAgF;AAoChF,SAAS,eAAe;IACtB,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,IAAI,CAAA;IAC9C,MAAM,CAAC,GAAI,MAAqD,CAAC,SAAS,CAAA;IAC1E,OAAO,CAAC,IAAI,IAAI,CAAA;AAClB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,CAAC,GAAG,eAAe,EAAE,CAAA;IAC3B,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,gBAAgB,KAAK,UAAU,EAAE,CAAC;QAClD,IAAI,CAAC;YACH,OAAO,CAAC,CAAC,gBAAgB,EAAE,CAAA;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,wCAAwC;QAC1C,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