@oxy.so/services 15.1.3 → 15.1.5

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.
Files changed (69) hide show
  1. package/lib/commonjs/ui/boot/runProviderColdBoot.js +44 -328
  2. package/lib/commonjs/ui/boot/runProviderColdBoot.js.map +1 -1
  3. package/lib/commonjs/ui/illustrations/ThemedIllustration.js +27 -5
  4. package/lib/commonjs/ui/illustrations/ThemedIllustration.js.map +1 -1
  5. package/lib/commonjs/ui/illustrations/connected-apps.svg +1 -93
  6. package/lib/commonjs/ui/illustrations/connected-apps.svg.json +1 -1
  7. package/lib/commonjs/ui/illustrations/family.svg +1 -150
  8. package/lib/commonjs/ui/illustrations/family.svg.json +1 -1
  9. package/lib/commonjs/ui/illustrations/library.svg +1 -68
  10. package/lib/commonjs/ui/illustrations/library.svg.json +1 -1
  11. package/lib/commonjs/ui/illustrations/people.svg +1 -62
  12. package/lib/commonjs/ui/illustrations/people.svg.json +1 -1
  13. package/lib/commonjs/ui/illustrations/security.svg +1 -78
  14. package/lib/commonjs/ui/illustrations/security.svg.json +1 -1
  15. package/lib/commonjs/ui/illustrations/sessions.svg +1 -74
  16. package/lib/commonjs/ui/illustrations/sessions.svg.json +1 -1
  17. package/lib/commonjs/ui/session/tokenTransport.js +7 -69
  18. package/lib/commonjs/ui/session/tokenTransport.js.map +1 -1
  19. package/lib/module/ui/boot/runProviderColdBoot.js +44 -328
  20. package/lib/module/ui/boot/runProviderColdBoot.js.map +1 -1
  21. package/lib/module/ui/illustrations/ThemedIllustration.js +27 -5
  22. package/lib/module/ui/illustrations/ThemedIllustration.js.map +1 -1
  23. package/lib/module/ui/illustrations/connected-apps.svg +1 -93
  24. package/lib/module/ui/illustrations/connected-apps.svg.json +1 -1
  25. package/lib/module/ui/illustrations/family.svg +1 -150
  26. package/lib/module/ui/illustrations/family.svg.json +1 -1
  27. package/lib/module/ui/illustrations/library.svg +1 -68
  28. package/lib/module/ui/illustrations/library.svg.json +1 -1
  29. package/lib/module/ui/illustrations/people.svg +1 -62
  30. package/lib/module/ui/illustrations/people.svg.json +1 -1
  31. package/lib/module/ui/illustrations/security.svg +1 -78
  32. package/lib/module/ui/illustrations/security.svg.json +1 -1
  33. package/lib/module/ui/illustrations/sessions.svg +1 -74
  34. package/lib/module/ui/illustrations/sessions.svg.json +1 -1
  35. package/lib/module/ui/session/tokenTransport.js +3 -68
  36. package/lib/module/ui/session/tokenTransport.js.map +1 -1
  37. package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts +8 -31
  38. package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts.map +1 -1
  39. package/lib/typescript/commonjs/ui/icons/Ionicons.d.ts +1 -1
  40. package/lib/typescript/commonjs/ui/icons/MaterialCommunityIcons.d.ts +1 -1
  41. package/lib/typescript/commonjs/ui/illustrations/ThemedIllustration.d.ts +1 -1
  42. package/lib/typescript/commonjs/ui/illustrations/ThemedIllustration.d.ts.map +1 -1
  43. package/lib/typescript/commonjs/ui/session/tokenTransport.d.ts +1 -33
  44. package/lib/typescript/commonjs/ui/session/tokenTransport.d.ts.map +1 -1
  45. package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts +8 -31
  46. package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts.map +1 -1
  47. package/lib/typescript/module/ui/icons/Ionicons.d.ts +1 -1
  48. package/lib/typescript/module/ui/icons/MaterialCommunityIcons.d.ts +1 -1
  49. package/lib/typescript/module/ui/illustrations/ThemedIllustration.d.ts +1 -1
  50. package/lib/typescript/module/ui/illustrations/ThemedIllustration.d.ts.map +1 -1
  51. package/lib/typescript/module/ui/session/tokenTransport.d.ts +1 -33
  52. package/lib/typescript/module/ui/session/tokenTransport.d.ts.map +1 -1
  53. package/package.json +3 -3
  54. package/src/ui/boot/runProviderColdBoot.ts +42 -363
  55. package/src/ui/illustrations/ThemedIllustration.tsx +43 -14
  56. package/src/ui/illustrations/__tests__/ThemedIllustration.test.ts +28 -0
  57. package/src/ui/illustrations/connected-apps.svg +1 -93
  58. package/src/ui/illustrations/connected-apps.svg.json +1 -1
  59. package/src/ui/illustrations/family.svg +1 -150
  60. package/src/ui/illustrations/family.svg.json +1 -1
  61. package/src/ui/illustrations/library.svg +1 -68
  62. package/src/ui/illustrations/library.svg.json +1 -1
  63. package/src/ui/illustrations/people.svg +1 -62
  64. package/src/ui/illustrations/people.svg.json +1 -1
  65. package/src/ui/illustrations/security.svg +1 -78
  66. package/src/ui/illustrations/security.svg.json +1 -1
  67. package/src/ui/illustrations/sessions.svg +1 -74
  68. package/src/ui/illustrations/sessions.svg.json +1 -1
  69. package/src/ui/session/tokenTransport.ts +3 -75
@@ -3,52 +3,19 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.SESSION_HANDOFF_DEADLINE_MS = exports.COLD_BOOT_OVERALL_DEADLINE_MS = void 0;
6
+ exports.COLD_BOOT_OVERALL_DEADLINE_MS = void 0;
7
7
  exports.runProviderColdBoot = runProviderColdBoot;
8
8
  var _applicationSessionLane = require("../oauth/applicationSessionLane.js");
9
9
  var _core = require("@oxy.so/core");
10
10
  var _session = require("@oxy.so/core/session");
11
- var _deviceCredential = require("../utils/deviceCredential.js");
12
11
  var _sharedDeviceCredentialStore = require("../session/sharedDeviceCredentialStore.js");
13
12
  var _oauthReturn = require("../utils/oauthReturn.js");
14
13
  var _isWebBrowser = require("../utils/isWebBrowser.js");
15
14
  var _netConnectivity = require("../utils/netConnectivity.js");
16
15
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
17
16
  /**
18
- * Whether the URL carries an OAuth return (`?code=` or `?error=`) for
19
- * `tryCompleteOAuthReturn` to consume. Reads the address bar only.
20
- */
21
- function hasOAuthReturnOnUrl() {
22
- const search = globalThis.location?.search;
23
- if (!search) return false;
24
- const params = new URLSearchParams(search);
25
- return params.has('code') || params.has('error');
26
- }
27
-
28
- /**
29
- * Whether this origin's own store holds anything a web boot could restore from:
30
- * a warm access token to plant or a device secret to mint with. A presence
31
- * check only — nothing read here is used, sent or synced before the
32
- * classification allows it.
33
- */
34
- async function hasRestorableState(store) {
35
- const persisted = await store.load();
36
- return Boolean(persisted?.accessToken || persisted?.deviceSecret);
37
- }
38
-
39
- /** How long the cold boot waits for the post-boot SessionClient handoff (ms). */
40
- const SESSION_HANDOFF_DEADLINE_MS = exports.SESSION_HANDOFF_DEADLINE_MS = 6000;
41
-
42
- /**
43
- * HARD overall deadline (ms) for the whole `runSessionColdBoot` step chain.
44
- *
45
- * Bounds time-to-route: routing gates on `isAuthResolved`, which resolves when
46
- * the cold boot finishes, so a network step that never settles (a black-hole
47
- * network that neither connects nor rejects) would otherwise hang routing
48
- * indefinitely. 12s comfortably exceeds the healthy worst case of the
49
- * sequential, single-attempt (`retry:false`), 5s-capped network steps, so it is
50
- * INERT on healthy loads and only trips on a pathological network. Offline
51
- * devices short-circuit far sooner via the connectivity hint below.
17
+ * HARD overall deadline (ms) for the whole `runSessionColdBoot` step chain; see
18
+ * `runWebSessionColdBoot` in `@oxy.so/core/session`, which owns the boot.
52
19
  */
53
20
  const COLD_BOOT_OVERALL_DEADLINE_MS = exports.COLD_BOOT_OVERALL_DEADLINE_MS = 12_000;
54
21
 
@@ -60,308 +27,57 @@ const COLD_BOOT_OVERALL_DEADLINE_MS = exports.COLD_BOOT_OVERALL_DEADLINE_MS = 12
60
27
  const OFFLINE_PROBE_TIMEOUT_MS = 500;
61
28
 
62
29
  /**
63
- * Best-effort, FAST connectivity probe run once before the cold boot.
64
- *
65
- * Returns `true` ONLY on an EXPLICIT disconnected verdict; every ambiguous
66
- * outcome (probe timeout, unknown/`null` state, NetInfo unavailable, a thrown
67
- * error) resolves to `false` (assume online) so a flaky probe can never falsely
68
- * skip a real sign-in. Never rejects. On web it reads `navigator.onLine`; on
69
- * native it races `NetInfo.fetch()` against {@link OFFLINE_PROBE_TIMEOUT_MS},
70
- * mirroring the existing NetInfo dynamic-import pattern in `OxyProvider`.
30
+ * The native half of the boot's connectivity probe: races `NetInfo.fetch()`
31
+ * against {@link OFFLINE_PROBE_TIMEOUT_MS}. `true` ONLY on an EXPLICIT
32
+ * disconnected verdict; a timeout or an unknown state is "online". A missing
33
+ * NetInfo rejects, which the boot also reads as "online".
71
34
  */
72
- async function detectOfflineHint() {
73
- try {
74
- if ((0, _isWebBrowser.isWebBrowser)()) {
75
- const online = globalThis.navigator?.onLine;
76
- // Only an explicit `false` is an offline verdict; `undefined` ⇒ assume online.
77
- return online === false;
78
- }
79
- const NetInfo = await Promise.resolve().then(() => _interopRequireWildcard(require('@react-native-community/netinfo')));
80
- const state = await Promise.race([NetInfo.default.fetch(), new Promise(resolve => {
81
- setTimeout(() => resolve(null), OFFLINE_PROBE_TIMEOUT_MS);
82
- })]);
83
- // `null` ⇒ the probe timed out (unknown → assume online). Only an explicit
84
- // disconnected verdict disables the network steps (the same rule as the
85
- // online signal: `isConnected`, never the reachability probe).
86
- return state !== null && !(0, _netConnectivity.isNetConnectivityOnline)(state);
87
- } catch {
88
- // NetInfo missing / probe threw — never block sign-in on a probe failure.
89
- return false;
90
- }
35
+ async function probeNetInfoOffline() {
36
+ const NetInfo = await Promise.resolve().then(() => _interopRequireWildcard(require('@react-native-community/netinfo')));
37
+ const state = await Promise.race([NetInfo.default.fetch(), new Promise(resolve => {
38
+ setTimeout(() => resolve(null), OFFLINE_PROBE_TIMEOUT_MS);
39
+ })]);
40
+ // `null` ⇒ the probe timed out (unknown → assume online). Only an explicit
41
+ // disconnected verdict disables the network steps (the same rule as the
42
+ // online signal: `isConnected`, never the reachability probe).
43
+ return state !== null && !(0, _netConnectivity.isNetConnectivityOnline)(state);
91
44
  }
92
- /** Starts the provider's fresh classification; a rejection is observed, not swallowed. */
93
- function startClassification(opts) {
94
- const classification = (async () => opts.resolveSessionLane?.() ?? (0, _applicationSessionLane.resolveApplicationSessionLane)(opts.oxyServices, opts.clientId))();
95
- // Observed so a rejection that lands before it is awaited is not reported as
96
- // unhandled; every caller still awaits it and sees the rejection.
97
- classification.catch(() => undefined);
98
- return classification;
99
- }
100
-
101
- /** What the device lanes made of this holder: a session, a verdict against it, or no answer. */
102
-
103
45
  /**
104
- * The device lanes of the boot (`runSessionColdBoot`), for a first boot or for
105
- * the background check of a painted one.
46
+ * Device-first cold boot for `@oxy.so/services` providers: core's
47
+ * `runWebSessionColdBoot` (the order, the deadlines, the verdicts) with this
48
+ * package's platform parts — the registry classifier, the native connectivity
49
+ * probe, the shared device credential slot and the OAuth return leg.
106
50
  *
107
- * A first boot (`painted: false`) is on the critical path: its committed
108
- * session resolves auth, bounded by {@link SESSION_HANDOFF_DEADLINE_MS}. A
109
- * painted boot already resolved auth from the cache, so nothing waits on the
110
- * handoff and the pure-local warm token is skipped: the check needs the mint's
111
- * verdict, which a still-valid token cannot give.
51
+ * The boot NEVER navigates the top-level window; the OAuth return leg only
52
+ * consumes a code that is already in the address bar (#691 phase 7b).
112
53
  */
113
- async function restoreDeviceSession(opts, painted) {
54
+ function runProviderColdBoot(opts) {
114
55
  const {
115
56
  oxyServices,
116
- authStore,
117
- sessionMode = 'account',
118
- identity,
119
- sessionClient,
120
- syncDeviceCredentialToHost,
121
- commitSession,
122
- markAuthResolved
123
- } = opts;
124
- await opts.beforeDeviceBoot?.();
125
-
126
- // Best-effort connectivity probe up front: an EXPLICIT offline verdict skips
127
- // the two doomed network steps so routing settles immediately instead of
128
- // burning the overall deadline on a mint that cannot succeed. Any ambiguity
129
- // resolves to "online" — the network steps still run.
130
- const offline = await detectOfflineHint();
131
- let outcome = 'unreachable';
132
- let holderRejected = false;
133
- await (0, _session.runSessionColdBoot)({
134
- oxy: oxyServices,
135
- store: authStore,
136
- platform: {
137
- isWeb: (0, _isWebBrowser.isWebBrowser)(),
138
- isNative: !(0, _isWebBrowser.isWebBrowser)()
139
- },
140
- sessionMode,
141
- identity,
142
- // The device-wide shared credential slot, enabling the `shared-device-adopt`
143
- // lane: a newly installed official app joins this device's existing session
144
- // instead of falling back to signing a challenge with the Commons identity
145
- // key. `null` on web, where each origin is its own device by design; the
146
- // core lane is also skipped outright in `sessionMode: 'identity'`.
147
- // Off when the provider was given a platform's own store: the credential
148
- // then lives there and nowhere else.
149
- sharedDeviceCredential: opts.useSharedDeviceCredential === false ? undefined : (0, _sharedDeviceCredentialStore.createPlatformSharedDeviceCredentialStore)() ?? undefined,
150
- overallDeadlineMs: COLD_BOOT_OVERALL_DEADLINE_MS,
151
- isOffline: () => offline,
152
- requireServerVerdict: painted,
153
- onHolderRejected: () => {
154
- holderRejected = true;
155
- },
156
- onStepDeadline: stepId => {
157
- _core.logger.warn(`Cold-boot step "${stepId}" exceeded the ${COLD_BOOT_OVERALL_DEADLINE_MS}ms overall deadline — abandoned; routing proceeds signed-out`, {
158
- component: 'runProviderColdBoot',
159
- method: 'onStepDeadline'
160
- });
161
- },
162
- onSession: async session => {
163
- outcome = 'session';
164
- // Mint already persisted `{deviceId, deviceSecret}` to the store; sync the
165
- // in-memory SessionClient host so sockets + tab-focus re-mint can use it.
166
- await syncDeviceCredentialToHost();
167
- const handoff = commitSession({
168
- sessionId: session.sessionId,
169
- accessToken: session.accessToken,
170
- userId: session.userId,
171
- deviceState: session.state
172
- }, {
173
- activate: false
174
- });
175
- if (painted) {
176
- // The account is already on screen; the commit refreshes its profile.
177
- await handoff;
178
- return;
179
- }
180
- let handoffDeadlineId;
181
- await Promise.race([handoff, new Promise(resolve => {
182
- handoffDeadlineId = setTimeout(resolve, SESSION_HANDOFF_DEADLINE_MS);
183
- })]).finally(() => {
184
- if (handoffDeadlineId !== undefined) {
185
- clearTimeout(handoffDeadlineId);
186
- }
187
- });
188
- markAuthResolved();
189
- },
190
- onSignedOut: async () => {
191
- outcome = holderRejected ? 'rejected' : 'unreachable';
192
- await syncDeviceCredentialToHost();
193
- // A painted session is the caller's to end or keep (see verifyCachedSession).
194
- if (painted) return;
195
- const cred = await (0, _deviceCredential.loadPersistedDeviceCredential)(authStore);
196
- if (cred) {
197
- try {
198
- await sessionClient.start();
199
- } catch (socketError) {
200
- if (__DEV__) {
201
- _core.logger.debug('Device socket start failed (non-fatal)', {
202
- component: 'runProviderColdBoot'
203
- }, socketError);
204
- }
205
- }
206
- }
207
- markAuthResolved();
208
- },
209
- onStepError: (id, error) => {
210
- if (__DEV__) {
211
- _core.logger.debug(`Cold-boot step "${id}" errored (non-fatal, falling through)`, {
212
- component: 'runProviderColdBoot'
213
- }, error);
214
- }
215
- }
216
- });
217
- await opts.afterDeviceBoot?.();
218
- return outcome;
219
- }
220
-
221
- /**
222
- * The background check of a painted session: the registry's classification and
223
- * a mint with this holder's own credential (whose commit refreshes the profile).
224
- * Each is asked until the server answers it. A verdict against the session
225
- * signs out at that moment; no answer keeps the cached session on screen and
226
- * hands the caller a retry.
227
- */
228
- async function verifyCachedSession(opts, verified, classification) {
229
- if (!verified.lane) {
230
- let lane = null;
231
- try {
232
- lane = await classification;
233
- } catch {
234
- // The registry could not be asked (offline, timeout, 5xx). That is no
235
- // verdict on this app: the cached `device` classification stands until it
236
- // answers.
237
- }
238
- if (lane === 'oauth') {
239
- await opts.onCachedSessionRejected?.();
240
- return;
241
- }
242
- verified.lane = lane === 'device';
243
- }
244
- if (!verified.session) {
245
- const outcome = await restoreDeviceSession(opts, true);
246
- if (outcome === 'rejected') {
247
- await opts.onCachedSessionRejected?.();
248
- return;
249
- }
250
- verified.session = outcome === 'session';
251
- }
252
- if (!verified.lane || !verified.session) {
253
- opts.onCachedSessionUnconfirmed?.(() => verifyCachedSession(opts, verified, verified.lane ? Promise.resolve('device') : startClassification(opts)));
254
- }
255
- }
256
-
257
- /**
258
- * Device-first cold boot for `@oxy.so/services` providers.
259
- *
260
- * A returning session saved on this device (account mode, the app last
261
- * classified `device`, its profile cached) paints first, with no network, and
262
- * is then checked in the background — see `paintCachedSession`. Otherwise, a
263
- * first boot:
264
- *
265
- * Ordered pipeline:
266
- * 1. Complete an OAuth authorization-code return already on the URL (web)
267
- * 2. `runSessionColdBoot` — device-secret mint (+ the native Commons-proof lane,
268
- * or the primary-identity-key lane in `sessionMode: 'identity'`)
269
- *
270
- * Step 1 is ACCOUNT-MODE ONLY: it commits whichever account the IdP resolves,
271
- * which for an identity-bound client is somebody else's account by construction.
272
- * In `'identity'` mode the boot is exactly step 2.
273
- *
274
- * The boot NEVER navigates the top-level window. There is no automatic
275
- * `prompt=none` bounce to the IdP: a web origin with no local device credential
276
- * resolves SIGNED OUT and waits for the user's next explicit "Continue with
277
- * Oxy", which opens a popup from a real gesture (#691 phase 7b). Step 1 is not a
278
- * navigation — it only consumes a code that is already in the address bar.
279
- */
280
- async function runProviderColdBoot(opts) {
281
- const {
282
- oxyServices,
283
- authStore,
284
57
  clientId,
285
58
  authRedirectUri,
286
- sessionMode = 'account',
287
- commitSession,
288
- markAuthResolved,
289
- setTokenReady
59
+ commitSession
290
60
  } = opts;
291
- const identityBound = sessionMode === 'identity';
292
- setTokenReady(false);
293
- try {
294
- // Classification precedes every USE of a local secret, the shared credential
295
- // and the identity key. Unavailable registry metadata fails closed on a first
296
- // boot, including offline. It starts now, before anything else, so its round
297
- // trip overlaps the local work below.
298
- const classification = startClassification(opts);
299
-
300
- // A returning session saved on this device paints at once from the cache:
301
- // the account, its cached content, auth resolved, no network on the way.
302
- // The classification and the session are then checked in the background,
303
- // and a verdict against either signs out at that moment. Identity-bound
304
- // clients and OAuth returns keep the path below.
305
- const freshLaunch = !identityBound && !hasOAuthReturnOnUrl();
306
- if (freshLaunch && (await opts.paintCachedSession?.())) {
307
- await verifyCachedSession(opts, {
308
- lane: false,
309
- session: false
310
- }, classification);
311
- return;
312
- }
313
-
314
- // The verdict decides HOW a session is restored, never WHETHER there is one.
315
- // A web origin with nothing to restore and no OAuth return on the URL ends
316
- // signed out on either lane, so routing need not wait a network round trip
317
- // for an answer that cannot change the outcome. The classification still
318
- // completes below and still gates every later sign-in
319
- // (`ensureDeviceSessionLane` shares this same in-flight lookup).
320
- if (freshLaunch && (0, _isWebBrowser.isWebBrowser)()) {
321
- if (!(await hasRestorableState(authStore))) {
322
- markAuthResolved();
323
- const lane = await classification;
324
- await opts.onClassified?.(lane);
325
- if (lane === 'oauth') setTokenReady(true);
326
- return;
327
- }
328
- }
329
- const lane = await classification;
330
- await opts.onClassified?.(lane);
331
- if (identityBound && lane !== 'device') return;
332
- // The redirect transport's RETURN leg. An app reaches it whenever the browser
333
- // BLOCKED the sign-in popup and `startWebOAuthSignIn` fell back to a
334
- // full-page redirect (`popup-blocked` / `popup-navigation-failed`), so it is
335
- // load-bearing even though nothing here ever starts a redirect. It consumes a
336
- // code (or a stale OAuth `error`) already in the address bar and rewrites the
337
- // URL via `history.replaceState`; it never begins a navigation.
338
- const oauthCompleted = identityBound ? false : await (0, _oauthReturn.tryCompleteOAuthReturn)({
339
- oxyServices,
340
- clientId,
341
- authRedirectUri,
342
- commitSession: input => commitSession(input, {
343
- activate: true,
344
- oauth: true
345
- })
346
- });
347
- if (oauthCompleted) {
348
- setTokenReady(true);
349
- markAuthResolved();
350
- return;
351
- }
352
- if (lane === 'oauth') {
353
- setTokenReady(true);
354
- return;
355
- }
356
- await restoreDeviceSession(opts, false);
357
- } catch (error) {
358
- if (__DEV__) {
359
- _core.logger.error('Cold boot error', error instanceof Error ? error : new Error(String(error)), {
360
- component: 'runProviderColdBoot'
361
- });
61
+ return (0, _session.runWebSessionColdBoot)({
62
+ ...opts,
63
+ resolveSessionLane: () => opts.resolveSessionLane?.() ?? (0, _applicationSessionLane.resolveApplicationSessionLane)(oxyServices, clientId),
64
+ overallDeadlineMs: COLD_BOOT_OVERALL_DEADLINE_MS,
65
+ platform: {
66
+ isWeb: _isWebBrowser.isWebBrowser,
67
+ probeNativeOffline: probeNetInfoOffline,
68
+ completeOAuthReturn: () => (0, _oauthReturn.tryCompleteOAuthReturn)({
69
+ oxyServices,
70
+ clientId,
71
+ authRedirectUri,
72
+ commitSession: input => commitSession(input, {
73
+ activate: true,
74
+ oauth: true
75
+ })
76
+ }),
77
+ sharedDeviceCredential: _sharedDeviceCredentialStore.createPlatformSharedDeviceCredentialStore,
78
+ runSessionColdBoot: _session.runSessionColdBoot,
79
+ logger: _core.logger
362
80
  }
363
- } finally {
364
- markAuthResolved();
365
- }
81
+ });
366
82
  }
367
83
  //# sourceMappingURL=runProviderColdBoot.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_applicationSessionLane","require","_core","_session","_deviceCredential","_sharedDeviceCredentialStore","_oauthReturn","_isWebBrowser","_netConnectivity","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","hasOAuthReturnOnUrl","search","globalThis","location","params","URLSearchParams","hasRestorableState","store","persisted","load","Boolean","accessToken","deviceSecret","SESSION_HANDOFF_DEADLINE_MS","exports","COLD_BOOT_OVERALL_DEADLINE_MS","OFFLINE_PROBE_TIMEOUT_MS","detectOfflineHint","isWebBrowser","online","navigator","onLine","NetInfo","Promise","resolve","then","state","race","fetch","setTimeout","isNetConnectivityOnline","startClassification","opts","classification","resolveSessionLane","resolveApplicationSessionLane","oxyServices","clientId","catch","undefined","restoreDeviceSession","painted","authStore","sessionMode","identity","sessionClient","syncDeviceCredentialToHost","commitSession","markAuthResolved","beforeDeviceBoot","offline","outcome","holderRejected","runSessionColdBoot","oxy","platform","isWeb","isNative","sharedDeviceCredential","useSharedDeviceCredential","createPlatformSharedDeviceCredentialStore","overallDeadlineMs","isOffline","requireServerVerdict","onHolderRejected","onStepDeadline","stepId","loggerUtil","warn","component","method","onSession","session","handoff","sessionId","userId","deviceState","activate","handoffDeadlineId","finally","clearTimeout","onSignedOut","cred","loadPersistedDeviceCredential","start","socketError","__DEV__","debug","onStepError","id","error","afterDeviceBoot","verifyCachedSession","verified","lane","onCachedSessionRejected","onCachedSessionUnconfirmed","runProviderColdBoot","authRedirectUri","setTokenReady","identityBound","freshLaunch","paintCachedSession","onClassified","oauthCompleted","tryCompleteOAuthReturn","input","oauth","Error","String"],"sourceRoot":"../../../../src","sources":["ui/boot/runProviderColdBoot.ts"],"mappings":";;;;;;;AAAA,IAAAA,uBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAOA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,4BAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AAAmE,SAAAQ,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,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,WAAW;MACXC,QAAQ;MACR6D,eAAe;MACfnD,aAAa,EAAG2D,KAAK,IAAK3D,aAAa,CAAC2D,KAAK,EAAE;QAAE7B,QAAQ,EAAE,IAAI;QAAE8B,KAAK,EAAE;MAAK,CAAC;IAChF,CAAC,CAAC;IACN,IAAIH,cAAc,EAAE;MAClBL,aAAa,CAAC,IAAI,CAAC;MACnBnD,gBAAgB,CAAC,CAAC;MAClB;IACF;IAEA,IAAI8C,IAAI,KAAK,OAAO,EAAE;MACpBK,aAAa,CAAC,IAAI,CAAC;MACnB;IACF;IAEA,MAAM3D,oBAAoB,CAACR,IAAI,EAAE,KAAK,CAAC;EACzC,CAAC,CAAC,OAAO0D,KAAK,EAAE;IACd,IAAIJ,OAAO,EAAE;MACXnB,YAAU,CAACuB,KAAK,CACd,iBAAiB,EACjBA,KAAK,YAAYkB,KAAK,GAAGlB,KAAK,GAAG,IAAIkB,KAAK,CAACC,MAAM,CAACnB,KAAK,CAAC,CAAC,EACzD;QAAErB,SAAS,EAAE;MAAsB,CACrC,CAAC;IACH;EACF,CAAC,SAAS;IACRrB,gBAAgB,CAAC,CAAC;EACpB;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_applicationSessionLane","require","_core","_session","_sharedDeviceCredentialStore","_oauthReturn","_isWebBrowser","_netConnectivity","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","COLD_BOOT_OVERALL_DEADLINE_MS","exports","OFFLINE_PROBE_TIMEOUT_MS","probeNetInfoOffline","NetInfo","Promise","resolve","then","state","race","fetch","setTimeout","isNetConnectivityOnline","runProviderColdBoot","opts","oxyServices","clientId","authRedirectUri","commitSession","runWebSessionColdBoot","resolveSessionLane","resolveApplicationSessionLane","overallDeadlineMs","platform","isWeb","isWebBrowser","probeNativeOffline","completeOAuthReturn","tryCompleteOAuthReturn","input","activate","oauth","sharedDeviceCredential","createPlatformSharedDeviceCredent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ACrBb,WAAW;QACXC,QAAQ;QACRC,eAAe;QACfC,aAAa,EAAGW,KAAK,IAAKX,aAAa,CAACW,KAAK,EAAE;UAAEC,QAAQ,EAAE,IAAI;UAAEC,KAAK,EAAE;QAAK,CAAC;MAChF,CAAC,CAAC;MACJC,sBAAsB,EAAEC,sEAAyC;MACjEC,kBAAkB,EAAlBA,2BAAkB;MAClBC,MAAM,EAAEC;IACV;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -12,25 +12,47 @@ var _react = require("react");
12
12
  var _reactNative = require("react-native");
13
13
  var _reactNativeSvg = require("react-native-svg");
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
- const paintAttributes = /fill="(#[0-9a-fA-F]{6})" data-bloom-role="(surface|vivid|secondary)" data-bloom-strength="([0-9]{1,3})"/g;
15
+ const paintAttributes = /fill="(#[0-9a-fA-F]{3}(?:[0-9a-fA-F]{3})?)" data-bloom-role="(surface|vivid|secondary)" data-bloom-strength="([0-9]{1,3})"/g;
16
+ const compiledElements = /<[a-zA-Z][^>]* data-bloom-paints="([^"]*)"[^>]*>/g;
17
+ const compiledDeclaration = /^(fill|stroke|stop-color):(surface|vivid|secondary):([0-9]{1,3}):(#[0-9a-fA-F]{3}(?:[0-9a-fA-F]{3})?)$/;
18
+ const paintProperties = {
19
+ fill: / fill="#[0-9a-fA-F]{3}(?:[0-9a-fA-F]{3})?"/,
20
+ stroke: / stroke="#[0-9a-fA-F]{3}(?:[0-9a-fA-F]{3})?"/,
21
+ 'stop-color': / stop-color="#[0-9a-fA-F]{3}(?:[0-9a-fA-F]{3})?"/
22
+ };
16
23
 
17
- /** Resolve just the annotated SVG fills. Unmarked paths retain their own colors. */
24
+ /** Resolve the marked SVG colors, including strokes and gradient stops. */
18
25
  function paintIllustration(svg, paint) {
19
26
  const palette = {
20
27
  surface: (0, _theme.parseRgb)(paint.surface),
21
28
  vivid: (0, _theme.parseRgb)(paint.vivid),
22
29
  secondary: (0, _theme.parseRgb)(paint.secondary)
23
30
  };
24
- return svg.replace(paintAttributes, (_match, original, role, strength) => {
31
+ function blend(original, role, strength) {
25
32
  const base = (0, _theme.parseRgb)(original);
26
33
  const tint = palette[role];
27
- if (!base || !tint) return `fill="${original}"`;
34
+ if (!base || !tint) return original;
28
35
  const weight = Number(strength) / 100;
29
36
  const red = Math.round(base.r * (1 - weight) + tint.r * weight);
30
37
  const green = Math.round(base.g * (1 - weight) + tint.g * weight);
31
38
  const blue = Math.round(base.b * (1 - weight) + tint.b * weight);
32
- return `fill="rgb(${red},${green},${blue})"`;
39
+ return `rgb(${red},${green},${blue})`;
40
+ }
41
+ const resolved = svg.replace(compiledElements, (element, paints) => {
42
+ let updated = element.replace(/ data-bloom-paints="[^"]*"/, '');
43
+ for (const declaration of paints.split(';')) {
44
+ const match = compiledDeclaration.exec(declaration);
45
+ if (!match) continue;
46
+ const [, property, role, strength, original] = match;
47
+ const attribute = paintProperties[property];
48
+ updated = updated.replace(attribute, ` ${property}="${blend(original, role, strength)}"`);
49
+ if (property === 'fill') {
50
+ updated = updated.replace(/ data-bloom-(?:role|strength)="[^"]*"/g, '');
51
+ }
52
+ }
53
+ return updated;
33
54
  });
55
+ return resolved.replace(paintAttributes, (_match, original, role, strength) => `fill="${blend(original, role, strength)}"`);
34
56
  }
35
57
  function ThemedIllustration({
36
58
  svg,
@@ -1 +1 @@
1
- {"version":3,"names":["_theme","require","_react","_reactNative","_reactNativeSvg","_jsxRuntime","paintAttributes","paintIllustration","svg","paint","palette","surface","parseRgb","vivid","secondary","replace","_match","original","role","strength","base","tint","weight","Number","red","Math","round","r","green","g","blue","b","ThemedIllustration","size","colors","useTheme","primaryLight","xml","useMemo","jsx","SvgXml","width","height","lazyIllustration","load","lazy","module","default","IllustrationSlot","art","Picture","Suspense","fallback","View","style","children"],"sourceRoot":"../../../../src","sources":["ui/illustrations/ThemedIllustration.tsx"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,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H,CAAC,CAAC;AACJ;AAEO,SAASe,gBAAgBA,CAAC;EAC/BC,GAAG,EAAEC,OAAO;EACZjB;AAC6D,CAAC,EAAE;EAChE,oBACE,IAAA5B,WAAA,CAAAkC,GAAA,EAACrC,MAAA,CAAAiD,QAAQ;IAACC,QAAQ,eAAE,IAAA/C,WAAA,CAAAkC,GAAA,EAACpC,YAAA,CAAAkD,IAAI;MAAC,mBAAW;MAACC,KAAK,EAAE;QAAEb,KAAK,EAAER,IAAI;QAAES,MAAM,EAAET;MAAK;IAAE,CAAE,CAAE;IAAAsB,QAAA,eAC7E,IAAAlD,WAAA,CAAAkC,GAAA,EAACW,OAAO;MAACjB,IAAI,EAAEA;IAAK,CAAE;EAAC,CACf,CAAC;AAEf","ignoreList":[]}
1
+ {"version":3,"names":["_theme","require","_react","_reactNative","_reactNativeSvg","_jsxRuntime","paintAttributes","compiledElements","compiledDeclaration","paintProperties","fill","stroke","paintIllustration","svg","paint","palette","surface","parseRgb","vivid","secondary","blend","original","role","strength","base","tint","weight","Number","red","Math","round","r","green","g","blue","b","resolved","replace","element","paints","updated","declaration","split","match","exec","property","attribute","_match","ThemedIllustration","size","colors","useTheme","primaryLight","xml","useMemo","jsx","SvgXml","width","height","lazyIllustration","load","lazy","module","default","IllustrationSlot","art","Picture","Suspense","fallback","View","style","children"],"sourceRoot":"../../../../src","sources":["ui/illustrations/ThemedIllustration.tsx"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAA0C,IAAAI,WAAA,GAAAJ,OAAA;AAS1C,MAAMK,eAAe,GACnB,6HAA6H;AAC/H,MAAMC,gBAAgB,GAAG,mDAAmD;AAC5E,MAAMC,mBAAmB,GACvB,wGAAwG;AAC1G,MAAMC,eAAe,GAAG;EACtBC,IAAI,EAAE,4CAA4C;EAClDC,MAAM,EAAE,8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