@sparkvault/sdk-js 8.13.1 → 8.15.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 +2 -0
- package/dist/errors.d.ts +9 -0
- package/dist/index.d.ts +903 -228
- package/dist/notify/index.d.ts +32 -2
- package/dist/notify/types.d.ts +27 -0
- package/dist/products/identity/index.d.ts +13 -2
- package/dist/products/identity/types.d.ts +8 -0
- package/dist/products/index.d.ts +15 -1
- package/dist/products/notify/index.d.ts +188 -0
- package/dist/products/notify/types.d.ts +392 -0
- package/dist/sparkvault.cjs.js +623 -19
- package/dist/sparkvault.cjs.js.map +1 -1
- package/dist/sparkvault.esm.js +620 -20
- package/dist/sparkvault.esm.js.map +1 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/sparkvault.cjs.js
CHANGED
|
@@ -63,6 +63,19 @@ class QuotaExceededError extends SparkVaultError {
|
|
|
63
63
|
Object.setPrototypeOf(this, QuotaExceededError.prototype);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Notify subscription gate (403 NOTIFY_SUBSCRIPTION_REQUIRED) — the account has
|
|
68
|
+
* no active Notify subscription and attempted a send. Distinct from a generic
|
|
69
|
+
* authorization failure: the credential is fine and re-authenticating changes
|
|
70
|
+
* nothing, so surface a subscribe CTA rather than a sign-in prompt.
|
|
71
|
+
*/
|
|
72
|
+
class NotifySubscriptionRequiredError extends SparkVaultError {
|
|
73
|
+
constructor(message, details) {
|
|
74
|
+
super(message, 'NOTIFY_SUBSCRIPTION_REQUIRED', 403, details);
|
|
75
|
+
this.name = 'NotifySubscriptionRequiredError';
|
|
76
|
+
Object.setPrototypeOf(this, NotifySubscriptionRequiredError.prototype);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
66
79
|
class NetworkError extends SparkVaultError {
|
|
67
80
|
constructor(message, details) {
|
|
68
81
|
super(message, 'network_error', undefined, details);
|
|
@@ -325,6 +338,11 @@ class HttpClient {
|
|
|
325
338
|
// PLAN_REQUIRED is the canonical 402 gate; treat any other 402 as one too.
|
|
326
339
|
return new PlanRequiredError(message, details);
|
|
327
340
|
case 403:
|
|
341
|
+
// A Notify send refused for want of a subscription is a billing gate, not
|
|
342
|
+
// a credential problem — give it its own catchable type.
|
|
343
|
+
if (code === 'NOTIFY_SUBSCRIPTION_REQUIRED') {
|
|
344
|
+
return new NotifySubscriptionRequiredError(message, details);
|
|
345
|
+
}
|
|
328
346
|
return new AuthorizationError(message, details);
|
|
329
347
|
default:
|
|
330
348
|
return new SparkVaultError(message, code, status, details);
|
|
@@ -848,6 +866,12 @@ function buildSigninUrl(config, options, extras) {
|
|
|
848
866
|
params.set('mode', 'simple');
|
|
849
867
|
params.set('session', authContext.simpleMode.sessionId);
|
|
850
868
|
}
|
|
869
|
+
// `prompt` is validated here, the single serialization point: only the exact
|
|
870
|
+
// literal reaches the sign-in page; anything else is silently dropped, so a
|
|
871
|
+
// plain-JS caller passing junk degrades to the default behavior.
|
|
872
|
+
if (options.prompt === 'select_account') {
|
|
873
|
+
params.set('prompt', 'select_account');
|
|
874
|
+
}
|
|
851
875
|
if (extras) {
|
|
852
876
|
params.set('redirect_uri', extras.redirectUri);
|
|
853
877
|
params.set('state', extras.state);
|
|
@@ -8548,17 +8572,67 @@ const PORTAL_SECTIONS = ['home', 'identity', 'security', 'sessions', 'sites'];
|
|
|
8548
8572
|
// listener but not sessionStorage) is what lets the next load self-heal.
|
|
8549
8573
|
const PENDING_KEY = 'sv_signin_pending';
|
|
8550
8574
|
const PENDING_TTL_MS = 10 * 60 * 1000;
|
|
8551
|
-
|
|
8552
|
-
|
|
8575
|
+
// One-shot: the identifier the recovery bounce is re-minting for. Written only
|
|
8576
|
+
// by the recovery bounce; the return leg consumes it to verify the redeemed
|
|
8577
|
+
// result is for that same account (see consumeHandoffFragment).
|
|
8578
|
+
const RECOVERY_HINT_KEY = 'sv_recovery_hint';
|
|
8579
|
+
/**
|
|
8580
|
+
* Normalize an identifier for equality, mirroring the server: trim, and
|
|
8581
|
+
* lowercase emails (a value containing '@'). Phones compare trimmed-exact.
|
|
8582
|
+
*/
|
|
8583
|
+
function normalizeIdentity(value) {
|
|
8584
|
+
const trimmed = value.trim();
|
|
8585
|
+
return trimmed.includes('@') ? trimmed.toLowerCase() : trimmed;
|
|
8586
|
+
}
|
|
8587
|
+
/**
|
|
8588
|
+
* Read and parse the pending marker — JSON `{ at, hint }`, where `hint` is the
|
|
8589
|
+
* email or phone the sign-in was started with (null when the flow collects the
|
|
8590
|
+
* identifier itself). A bare-timestamp value is accepted as `{ at, hint: null }`:
|
|
8591
|
+
* markers live at most 10 minutes in sessionStorage, so any such value
|
|
8592
|
+
* disappears within one deploy window of this parser going live — the fallback
|
|
8593
|
+
* is bounded and never grows. Anything unreadable yields null.
|
|
8594
|
+
*/
|
|
8595
|
+
function readPendingMarker() {
|
|
8553
8596
|
let raw = null;
|
|
8554
8597
|
try {
|
|
8555
8598
|
raw = sessionStorage.getItem(PENDING_KEY);
|
|
8556
8599
|
}
|
|
8557
8600
|
catch {
|
|
8558
|
-
return
|
|
8601
|
+
return null;
|
|
8602
|
+
}
|
|
8603
|
+
if (!raw) {
|
|
8604
|
+
return null;
|
|
8605
|
+
}
|
|
8606
|
+
let at = NaN;
|
|
8607
|
+
let hint = null;
|
|
8608
|
+
try {
|
|
8609
|
+
const parsed = JSON.parse(raw);
|
|
8610
|
+
if (typeof parsed === 'object' && parsed !== null) {
|
|
8611
|
+
const marker = parsed;
|
|
8612
|
+
if (typeof marker.at === 'number') {
|
|
8613
|
+
at = marker.at;
|
|
8614
|
+
}
|
|
8615
|
+
if (typeof marker.hint === 'string' && marker.hint) {
|
|
8616
|
+
hint = marker.hint;
|
|
8617
|
+
}
|
|
8618
|
+
}
|
|
8619
|
+
else if (typeof parsed === 'number') {
|
|
8620
|
+
// A bare timestamp parses as a JSON number.
|
|
8621
|
+
at = parsed;
|
|
8622
|
+
}
|
|
8559
8623
|
}
|
|
8560
|
-
|
|
8561
|
-
|
|
8624
|
+
catch {
|
|
8625
|
+
at = Number(raw);
|
|
8626
|
+
}
|
|
8627
|
+
return Number.isFinite(at) ? { at, hint } : null;
|
|
8628
|
+
}
|
|
8629
|
+
/** True while a marker is within the self-heal TTL. */
|
|
8630
|
+
function isFreshPendingMarker(marker) {
|
|
8631
|
+
return marker !== null && Date.now() - marker.at < PENDING_TTL_MS;
|
|
8632
|
+
}
|
|
8633
|
+
/** True when the pending marker is present and still within its TTL. */
|
|
8634
|
+
function hasFreshPendingMarker() {
|
|
8635
|
+
return isFreshPendingMarker(readPendingMarker());
|
|
8562
8636
|
}
|
|
8563
8637
|
/**
|
|
8564
8638
|
* Whether `handleRedirectResult()` has anything to do on this load — a returned
|
|
@@ -8828,7 +8902,8 @@ class IdentityModule {
|
|
|
8828
8902
|
// the backgrounded opener tab, killing the postMessage listener),
|
|
8829
8903
|
// handleRedirectResult() can silently self-heal on the next load from
|
|
8830
8904
|
// the SSO session the popup login established.
|
|
8831
|
-
|
|
8905
|
+
const pendingHint = mergedOptions.email || mergedOptions.phone || null;
|
|
8906
|
+
this.markSignInPending(pendingHint);
|
|
8832
8907
|
this.launcher = new DialogLauncher(this.config, this.api, mergedOptions, {
|
|
8833
8908
|
onSuccess: (result) => { this.clearSignInPending(); hostCallbacks.onSuccess(result); },
|
|
8834
8909
|
onError: (error) => { this.clearSignInPending(); hostCallbacks.onError(error); },
|
|
@@ -8837,7 +8912,7 @@ class IdentityModule {
|
|
|
8837
8912
|
// no-result end retires the marker (no spurious bounce on a reload
|
|
8838
8913
|
// while the retry alert is up); "Try again" re-arms it.
|
|
8839
8914
|
onPopupClosedUnresolved: () => this.clearSignInPending(),
|
|
8840
|
-
onPopupReopened: () => this.markSignInPending(),
|
|
8915
|
+
onPopupReopened: () => this.markSignInPending(pendingHint),
|
|
8841
8916
|
// COOP-severed popup: postMessage can never deliver, so switch this tab
|
|
8842
8917
|
// to the redirect flow (returns via handleRedirectResult). The pending
|
|
8843
8918
|
// marker stays armed — the returned #sv_code fragment retires it.
|
|
@@ -8875,6 +8950,7 @@ class IdentityModule {
|
|
|
8875
8950
|
email: options.email,
|
|
8876
8951
|
phone: options.phone,
|
|
8877
8952
|
authContext: options.authContext,
|
|
8953
|
+
prompt: options.prompt,
|
|
8878
8954
|
onSuccess: options.onSuccess,
|
|
8879
8955
|
onError: options.onError,
|
|
8880
8956
|
onCancel: options.onCancel,
|
|
@@ -8990,8 +9066,9 @@ class IdentityModule {
|
|
|
8990
9066
|
}
|
|
8991
9067
|
// No returned result. If a sign-in was in flight and its result never
|
|
8992
9068
|
// arrived, self-heal once from the SSO session (mobile opener-tab discard).
|
|
8993
|
-
|
|
8994
|
-
|
|
9069
|
+
const pending = this.consumeSignInPending();
|
|
9070
|
+
if (pending.fresh) {
|
|
9071
|
+
await this.startRecoveryBounce(pending.hint);
|
|
8995
9072
|
}
|
|
8996
9073
|
return null;
|
|
8997
9074
|
}
|
|
@@ -9008,9 +9085,11 @@ class IdentityModule {
|
|
|
9008
9085
|
// (and a StrictMode double-invocation finds an empty hash and no-ops).
|
|
9009
9086
|
let expectedState = null;
|
|
9010
9087
|
let codeVerifier = null;
|
|
9088
|
+
let expectedRecoveryIdentity = null;
|
|
9011
9089
|
try {
|
|
9012
9090
|
expectedState = sessionStorage.getItem('sv_oauth_state');
|
|
9013
9091
|
codeVerifier = sessionStorage.getItem('sv_pkce_verifier');
|
|
9092
|
+
expectedRecoveryIdentity = sessionStorage.getItem(RECOVERY_HINT_KEY);
|
|
9014
9093
|
this.clearOneShotAuthState();
|
|
9015
9094
|
}
|
|
9016
9095
|
catch {
|
|
@@ -9040,6 +9119,18 @@ class IdentityModule {
|
|
|
9040
9119
|
sessionId: raw.session_id ?? undefined,
|
|
9041
9120
|
refreshToken: raw.refresh_token ?? undefined,
|
|
9042
9121
|
};
|
|
9122
|
+
// A recovery bounce carries the identifier the interrupted sign-in was
|
|
9123
|
+
// addressing, but /sso treats a hint matching no hub session like no hint
|
|
9124
|
+
// at all (anti-oracle) — so the bounce can come back holding a DIFFERENT
|
|
9125
|
+
// single-eligible account. The client is the one place that knows which
|
|
9126
|
+
// account the person was signing in to: a mismatched result is discarded,
|
|
9127
|
+
// never handed to the host (a wrong-account handoff). Silent — no
|
|
9128
|
+
// onError — falling through to interactive sign-in, matching the recovery
|
|
9129
|
+
// flow's non-oracle posture.
|
|
9130
|
+
if (expectedRecoveryIdentity &&
|
|
9131
|
+
normalizeIdentity(expectedRecoveryIdentity) !== normalizeIdentity(result.identity)) {
|
|
9132
|
+
return null;
|
|
9133
|
+
}
|
|
9043
9134
|
options.onSuccess?.(result);
|
|
9044
9135
|
return result;
|
|
9045
9136
|
}
|
|
@@ -9058,11 +9149,41 @@ class IdentityModule {
|
|
|
9058
9149
|
* so a hostile/degraded environment simply never recovers rather than
|
|
9059
9150
|
* erroring.
|
|
9060
9151
|
*/
|
|
9061
|
-
async startRecoveryBounce() {
|
|
9062
|
-
const
|
|
9152
|
+
async startRecoveryBounce(loginHint) {
|
|
9153
|
+
const sso = new URL(`${this.config.identityBaseUrl}/${this.config.accountId}/sso`);
|
|
9154
|
+
// With several hub sessions, login_hint tells /sso which account the
|
|
9155
|
+
// interrupted sign-in was addressing, so recovery never re-mints another.
|
|
9156
|
+
// Also stash it one-shot: a hint matching no hub session deliberately
|
|
9157
|
+
// behaves server-side like no hint at all (anti-oracle), so the return leg
|
|
9158
|
+
// must verify the redeemed identity is the one this sign-in was for.
|
|
9159
|
+
try {
|
|
9160
|
+
if (loginHint) {
|
|
9161
|
+
sessionStorage.setItem(RECOVERY_HINT_KEY, loginHint);
|
|
9162
|
+
}
|
|
9163
|
+
else {
|
|
9164
|
+
sessionStorage.removeItem(RECOVERY_HINT_KEY);
|
|
9165
|
+
}
|
|
9166
|
+
}
|
|
9167
|
+
catch {
|
|
9168
|
+
// No storage → prepareHandoffNavigation bails below; nothing to verify.
|
|
9169
|
+
}
|
|
9170
|
+
if (loginHint) {
|
|
9171
|
+
sso.searchParams.set('login_hint', loginHint);
|
|
9172
|
+
}
|
|
9173
|
+
const nav = await this.prepareHandoffNavigation(sso.toString());
|
|
9063
9174
|
if (nav) {
|
|
9064
9175
|
window.location.assign(nav);
|
|
9065
9176
|
}
|
|
9177
|
+
else {
|
|
9178
|
+
// The bounce never left (no storage or WebCrypto) — retire the stash so
|
|
9179
|
+
// it cannot linger into an unrelated later return leg.
|
|
9180
|
+
try {
|
|
9181
|
+
sessionStorage.removeItem(RECOVERY_HINT_KEY);
|
|
9182
|
+
}
|
|
9183
|
+
catch {
|
|
9184
|
+
// Storage disabled: nothing was persisted, nothing to clear.
|
|
9185
|
+
}
|
|
9186
|
+
}
|
|
9066
9187
|
}
|
|
9067
9188
|
/**
|
|
9068
9189
|
* Explicit `flow: 'redirect'` — navigate this tab to the interactive sign-in
|
|
@@ -9122,9 +9243,16 @@ class IdentityModule {
|
|
|
9122
9243
|
url.searchParams.set('code_challenge', codeChallenge);
|
|
9123
9244
|
return url.toString();
|
|
9124
9245
|
}
|
|
9125
|
-
|
|
9246
|
+
/**
|
|
9247
|
+
* Arm the self-heal marker for an in-flight sign-in. `hint` is the identifier
|
|
9248
|
+
* (email or phone) the sign-in was started with, when the caller supplied
|
|
9249
|
+
* one — the recovery bounce forwards it as the /sso `login_hint`, so with
|
|
9250
|
+
* several hub sessions recovery re-mints the account this sign-in was for,
|
|
9251
|
+
* never a different one.
|
|
9252
|
+
*/
|
|
9253
|
+
markSignInPending(hint) {
|
|
9126
9254
|
try {
|
|
9127
|
-
sessionStorage.setItem(PENDING_KEY,
|
|
9255
|
+
sessionStorage.setItem(PENDING_KEY, JSON.stringify({ at: Date.now(), hint }));
|
|
9128
9256
|
}
|
|
9129
9257
|
catch {
|
|
9130
9258
|
// No storage → no self-heal; the popup still delivers when it can.
|
|
@@ -9138,11 +9266,16 @@ class IdentityModule {
|
|
|
9138
9266
|
// Nothing to clear.
|
|
9139
9267
|
}
|
|
9140
9268
|
}
|
|
9141
|
-
/**
|
|
9269
|
+
/**
|
|
9270
|
+
* Consume the pending marker: `fresh` is true once (then cleared) if a recent
|
|
9271
|
+
* sign-in is still awaiting its result; `hint` is the identifier that sign-in
|
|
9272
|
+
* carried, for the recovery bounce's `login_hint`.
|
|
9273
|
+
*/
|
|
9142
9274
|
consumeSignInPending() {
|
|
9143
|
-
const
|
|
9275
|
+
const marker = readPendingMarker();
|
|
9276
|
+
const fresh = isFreshPendingMarker(marker);
|
|
9144
9277
|
this.clearSignInPending();
|
|
9145
|
-
return fresh;
|
|
9278
|
+
return { fresh, hint: fresh ? marker.hint : null };
|
|
9146
9279
|
}
|
|
9147
9280
|
/** Remove the result fragment from the URL bar (and history entry). */
|
|
9148
9281
|
clearUrlFragment() {
|
|
@@ -9150,11 +9283,12 @@ class IdentityModule {
|
|
|
9150
9283
|
window.history.replaceState(window.history.state, document.title, `${window.location.pathname}${window.location.search}`);
|
|
9151
9284
|
}
|
|
9152
9285
|
}
|
|
9153
|
-
/** Drop the one-shot PKCE state/verifier a
|
|
9286
|
+
/** Drop the one-shot PKCE state/verifier (+ recovery hint) a bounce staged. */
|
|
9154
9287
|
clearOneShotAuthState() {
|
|
9155
9288
|
try {
|
|
9156
9289
|
sessionStorage.removeItem('sv_oauth_state');
|
|
9157
9290
|
sessionStorage.removeItem('sv_pkce_verifier');
|
|
9291
|
+
sessionStorage.removeItem(RECOVERY_HINT_KEY);
|
|
9158
9292
|
}
|
|
9159
9293
|
catch {
|
|
9160
9294
|
// Storage disabled: nothing was persisted, nothing to clear.
|
|
@@ -9286,6 +9420,401 @@ class IdentityModule {
|
|
|
9286
9420
|
}
|
|
9287
9421
|
}
|
|
9288
9422
|
|
|
9423
|
+
/**
|
|
9424
|
+
* Notify Product Module — the TENANT (sender) surface.
|
|
9425
|
+
*
|
|
9426
|
+
* The counterpart to `sv.notify`: where that module is session-scoped and reads
|
|
9427
|
+
* only the signed-in person's OWN inbox, this one is the account-scoped product
|
|
9428
|
+
* surface a tenant's BACKEND drives — send, sender-side inbox reads and state,
|
|
9429
|
+
* send status, receipts, and the account's Notify config. Every method maps to
|
|
9430
|
+
* `/v1/products/notify/*` and is authorized by the caller's account, so the
|
|
9431
|
+
* recipient is supplied explicitly rather than derived from a session.
|
|
9432
|
+
*
|
|
9433
|
+
* Intended for server-side use with an `apiKey` (sent as `X-API-Key`); a Core JWT
|
|
9434
|
+
* works identically. Note the API prefers a Bearer JWT when both credentials are
|
|
9435
|
+
* configured, so a server integration should set `apiKey` alone.
|
|
9436
|
+
*
|
|
9437
|
+
* Notify never touches crypto here: `send` seals content and mints one single-use
|
|
9438
|
+
* SparkLink per recipient server-side, and the client only ever carries pointers
|
|
9439
|
+
* and metadata.
|
|
9440
|
+
*/
|
|
9441
|
+
/** Root of every tenant-facing Notify route. */
|
|
9442
|
+
const BASE_PATH = '/v1/products/notify';
|
|
9443
|
+
/**
|
|
9444
|
+
* The caller-supplied idempotency key's accepted shape. Mirrors the server's
|
|
9445
|
+
* validation exactly so a malformed key fails locally instead of on the wire.
|
|
9446
|
+
*/
|
|
9447
|
+
const SEND_ID_PATTERN = /^[A-Za-z0-9_.:-]{1,128}$/;
|
|
9448
|
+
const MARK_STATES$1 = ['seen', 'read', 'archived'];
|
|
9449
|
+
/**
|
|
9450
|
+
* Bulk drains ride the sparse unseen/unread GSIs. `archived` has no index, so it
|
|
9451
|
+
* is per-row only.
|
|
9452
|
+
*/
|
|
9453
|
+
const BULK_MARK_STATES$1 = ['seen', 'read'];
|
|
9454
|
+
/**
|
|
9455
|
+
* The five secure-by-default preset bundles, mirroring the server's table.
|
|
9456
|
+
*
|
|
9457
|
+
* There is no preset endpoint — presets are a merge over the one send contract,
|
|
9458
|
+
* so they are applied client-side and produce an ordinary `send` request. Caller
|
|
9459
|
+
* arguments always win over a preset's defaults; `channels` left unset lets the
|
|
9460
|
+
* account config resolve the ladder per category.
|
|
9461
|
+
*
|
|
9462
|
+
* `alert` is the only plaintext preset: a non-confidential ping is read at a
|
|
9463
|
+
* glance rather than behind a tap-to-view link. The other four seal.
|
|
9464
|
+
*/
|
|
9465
|
+
const NOTIFY_PRESETS = Object.freeze({
|
|
9466
|
+
alert: {
|
|
9467
|
+
category: 'alert',
|
|
9468
|
+
delivery: 'plaintext',
|
|
9469
|
+
policy: { verificationLevel: 'none', interaction: 'view' },
|
|
9470
|
+
},
|
|
9471
|
+
secureMessage: {
|
|
9472
|
+
category: 'secure',
|
|
9473
|
+
channels: ['push', 'web_push', 'email'],
|
|
9474
|
+
policy: { verificationLevel: 'identifier', interaction: 'view' },
|
|
9475
|
+
},
|
|
9476
|
+
conversation: {
|
|
9477
|
+
category: 'conversation',
|
|
9478
|
+
channels: ['in_app', 'push', 'web_push', 'email'],
|
|
9479
|
+
policy: { verificationLevel: 'identifier', interaction: 'reply' },
|
|
9480
|
+
},
|
|
9481
|
+
approval: {
|
|
9482
|
+
category: 'approval',
|
|
9483
|
+
channels: ['in_app', 'push', 'web_push', 'email'],
|
|
9484
|
+
policy: { verificationLevel: 'passkey', interaction: 'approve' },
|
|
9485
|
+
},
|
|
9486
|
+
signatureRequest: {
|
|
9487
|
+
category: 'signature',
|
|
9488
|
+
channels: ['in_app', 'push', 'web_push', 'email'],
|
|
9489
|
+
policy: { verificationLevel: 'passkey', interaction: 'sign' },
|
|
9490
|
+
},
|
|
9491
|
+
});
|
|
9492
|
+
/**
|
|
9493
|
+
* Merge a preset's bundle UNDER the caller's arguments, yielding ordinary send
|
|
9494
|
+
* options. Exported so a caller can inspect (or further adjust) what a preset
|
|
9495
|
+
* would send before sending it.
|
|
9496
|
+
*/
|
|
9497
|
+
function buildNotifyPresetSend(preset, options) {
|
|
9498
|
+
const bundle = NOTIFY_PRESETS[preset];
|
|
9499
|
+
if (!bundle) {
|
|
9500
|
+
throw new ValidationError(`Unknown notify preset "${preset}" (valid: ${Object.keys(NOTIFY_PRESETS).join(', ')})`, { field: 'preset', received: preset });
|
|
9501
|
+
}
|
|
9502
|
+
const merged = {
|
|
9503
|
+
...options,
|
|
9504
|
+
category: options.category || bundle.category,
|
|
9505
|
+
// A caller-supplied delivery wins (a sealed override of an alert is allowed);
|
|
9506
|
+
// otherwise the preset's mode, or the sealed default when it declares none.
|
|
9507
|
+
delivery: options.delivery ?? bundle.delivery,
|
|
9508
|
+
policy: { ...bundle.policy, ...(options.policy ?? {}) },
|
|
9509
|
+
};
|
|
9510
|
+
// Only set channels when the preset declares them and the caller did not
|
|
9511
|
+
// override — leaving it unset lets the account config resolve them per category.
|
|
9512
|
+
const channels = options.channels || bundle.channels;
|
|
9513
|
+
if (channels)
|
|
9514
|
+
merged.channels = channels;
|
|
9515
|
+
return merged;
|
|
9516
|
+
}
|
|
9517
|
+
class NotifyProductModule {
|
|
9518
|
+
constructor(http) {
|
|
9519
|
+
this.http = http;
|
|
9520
|
+
}
|
|
9521
|
+
// ── Send ────────────────────────────────────────────────────────────────────
|
|
9522
|
+
/**
|
|
9523
|
+
* Send a notification: seal the content, mint one single-use SparkLink per
|
|
9524
|
+
* recipient, and enqueue delivery across the resolved channel ladder.
|
|
9525
|
+
*
|
|
9526
|
+
* `sendId` is the idempotency key. Replaying an existing one returns the stored
|
|
9527
|
+
* send unchanged — never re-sealed, never re-delivered — flagged `idempotent`.
|
|
9528
|
+
*
|
|
9529
|
+
* @example
|
|
9530
|
+
* const send = await sv.products.notify.send({
|
|
9531
|
+
* sendId: `invoice:${invoice.id}`,
|
|
9532
|
+
* recipients: [{ id: user.svid, email: user.email }],
|
|
9533
|
+
* content: { payload: 'Your invoice is ready.' },
|
|
9534
|
+
* policy: { verificationLevel: 'identifier', interaction: 'view' },
|
|
9535
|
+
* title: 'Invoice ready',
|
|
9536
|
+
* category: 'transactional',
|
|
9537
|
+
* });
|
|
9538
|
+
*/
|
|
9539
|
+
async send(options) {
|
|
9540
|
+
if (options?.sendId !== undefined) {
|
|
9541
|
+
if (typeof options.sendId !== 'string' || !SEND_ID_PATTERN.test(options.sendId)) {
|
|
9542
|
+
throw new ValidationError('sendId must be 1-128 characters of letters, digits, and _ . : -', { field: 'sendId', received: options.sendId });
|
|
9543
|
+
}
|
|
9544
|
+
}
|
|
9545
|
+
if (!Array.isArray(options?.recipients) || options.recipients.length === 0) {
|
|
9546
|
+
throw new ValidationError('recipients is required and must be non-empty', {
|
|
9547
|
+
field: 'recipients',
|
|
9548
|
+
});
|
|
9549
|
+
}
|
|
9550
|
+
if (Boolean(options.content) === Boolean(options.ingot)) {
|
|
9551
|
+
throw new ValidationError('Provide exactly one content source: content OR ingot');
|
|
9552
|
+
}
|
|
9553
|
+
const response = await this.http.post(`${BASE_PATH}/send`, toSendBody(options));
|
|
9554
|
+
return response.data;
|
|
9555
|
+
}
|
|
9556
|
+
/**
|
|
9557
|
+
* Frictionless informational ping — no verification, view-only, delivered
|
|
9558
|
+
* INLINE (plaintext) so it is read at a glance. Channels resolve from the
|
|
9559
|
+
* account config; plaintext requires an inline-capable channel.
|
|
9560
|
+
*
|
|
9561
|
+
* @example
|
|
9562
|
+
* await sv.products.notify.sendAlert({
|
|
9563
|
+
* recipients: [{ id: user.svid }],
|
|
9564
|
+
* content: { payload: 'Your export finished.' },
|
|
9565
|
+
* title: 'Export complete',
|
|
9566
|
+
* });
|
|
9567
|
+
*/
|
|
9568
|
+
async sendAlert(options) {
|
|
9569
|
+
return this.send(buildNotifyPresetSend('alert', options));
|
|
9570
|
+
}
|
|
9571
|
+
/** Confidential content revealed after the recipient proves their identifier. */
|
|
9572
|
+
async sendSecureMessage(options) {
|
|
9573
|
+
return this.send(buildNotifyPresetSend('secureMessage', options));
|
|
9574
|
+
}
|
|
9575
|
+
/** Two-way thread: identifier-verified reveal plus an encrypted reply. */
|
|
9576
|
+
async sendConversation(options) {
|
|
9577
|
+
return this.send(buildNotifyPresetSend('conversation', options));
|
|
9578
|
+
}
|
|
9579
|
+
/** High-stakes approve/deny — passkey-verified, with `action_hash` binding. */
|
|
9580
|
+
async sendApproval(options) {
|
|
9581
|
+
return this.send(buildNotifyPresetSend('approval', options));
|
|
9582
|
+
}
|
|
9583
|
+
/** Signature-on-delivery — passkey-verified, with `action_hash` binding. */
|
|
9584
|
+
async sendSignatureRequest(options) {
|
|
9585
|
+
return this.send(buildNotifyPresetSend('signatureRequest', options));
|
|
9586
|
+
}
|
|
9587
|
+
// ── Inbox (sender-side) ─────────────────────────────────────────────────────
|
|
9588
|
+
/**
|
|
9589
|
+
* Read one recipient's metadata-only feed, newest first. Rows are pointers: a
|
|
9590
|
+
* sealed row carries only `sparklink_code`, never the content.
|
|
9591
|
+
*
|
|
9592
|
+
* A page can come back SHORT of `limit` yet still carry a non-null cursor —
|
|
9593
|
+
* follow the cursor; never treat a short page as the end.
|
|
9594
|
+
*
|
|
9595
|
+
* @example
|
|
9596
|
+
* const { notifications, cursor } = await sv.products.notify.getInbox({
|
|
9597
|
+
* recipientId: user.svid,
|
|
9598
|
+
* state: 'unread',
|
|
9599
|
+
* });
|
|
9600
|
+
*/
|
|
9601
|
+
async getInbox(options) {
|
|
9602
|
+
requireRecipientId(options?.recipientId);
|
|
9603
|
+
const query = buildQuery$3({
|
|
9604
|
+
recipient_id: options.recipientId,
|
|
9605
|
+
state: options.state,
|
|
9606
|
+
limit: options.limit,
|
|
9607
|
+
cursor: options.cursor,
|
|
9608
|
+
});
|
|
9609
|
+
const response = await this.http.get(`${BASE_PATH}/inbox${query}`);
|
|
9610
|
+
return response.data;
|
|
9611
|
+
}
|
|
9612
|
+
/**
|
|
9613
|
+
* Apply a terminal display state to one row (idempotent). `createdAt` MUST be
|
|
9614
|
+
* the row's own `created_at`, round-tripped from the feed or the webhook/push
|
|
9615
|
+
* payload — the id alone cannot address the row.
|
|
9616
|
+
*
|
|
9617
|
+
* @example
|
|
9618
|
+
* await sv.products.notify.markInboxState(row.notification_id, {
|
|
9619
|
+
* recipientId: user.svid,
|
|
9620
|
+
* createdAt: row.created_at,
|
|
9621
|
+
* state: 'read',
|
|
9622
|
+
* });
|
|
9623
|
+
*/
|
|
9624
|
+
async markInboxState(notificationId, options) {
|
|
9625
|
+
if (!notificationId || typeof notificationId !== 'string') {
|
|
9626
|
+
throw new ValidationError('notificationId is required', { field: 'notificationId' });
|
|
9627
|
+
}
|
|
9628
|
+
requireRecipientId(options?.recipientId);
|
|
9629
|
+
if (!Number.isInteger(options?.createdAt)) {
|
|
9630
|
+
throw new ValidationError("createdAt (the row's created_at) is required", {
|
|
9631
|
+
field: 'createdAt',
|
|
9632
|
+
received: options?.createdAt,
|
|
9633
|
+
});
|
|
9634
|
+
}
|
|
9635
|
+
if (!MARK_STATES$1.includes(options.state)) {
|
|
9636
|
+
throw new ValidationError(`state must be one of ${MARK_STATES$1.join(', ')}`, {
|
|
9637
|
+
field: 'state',
|
|
9638
|
+
received: options.state,
|
|
9639
|
+
});
|
|
9640
|
+
}
|
|
9641
|
+
const response = await this.http.post(`${BASE_PATH}/inbox/${encodeURIComponent(notificationId)}/state`, { recipient_id: options.recipientId, created_at: options.createdAt, state: options.state });
|
|
9642
|
+
return response.data;
|
|
9643
|
+
}
|
|
9644
|
+
/**
|
|
9645
|
+
* Bulk-mark one bounded page of a recipient's inbox `seen` or `read`. Loop on
|
|
9646
|
+
* the returned cursor until it is null. `archived` is per-row only.
|
|
9647
|
+
*
|
|
9648
|
+
* @example
|
|
9649
|
+
* let cursor: string | undefined;
|
|
9650
|
+
* do {
|
|
9651
|
+
* const page = await sv.products.notify.markInboxAll({
|
|
9652
|
+
* recipientId: user.svid, state: 'read', cursor,
|
|
9653
|
+
* });
|
|
9654
|
+
* cursor = page.cursor ?? undefined;
|
|
9655
|
+
* } while (cursor);
|
|
9656
|
+
*/
|
|
9657
|
+
async markInboxAll(options) {
|
|
9658
|
+
requireRecipientId(options?.recipientId);
|
|
9659
|
+
if (!BULK_MARK_STATES$1.includes(options.state)) {
|
|
9660
|
+
throw new ValidationError(`state must be one of ${BULK_MARK_STATES$1.join(', ')} (archive per-row instead)`, { field: 'state', received: options.state });
|
|
9661
|
+
}
|
|
9662
|
+
const response = await this.http.post(`${BASE_PATH}/inbox/state`, {
|
|
9663
|
+
recipient_id: options.recipientId,
|
|
9664
|
+
state: options.state,
|
|
9665
|
+
cursor: options.cursor,
|
|
9666
|
+
});
|
|
9667
|
+
return response.data;
|
|
9668
|
+
}
|
|
9669
|
+
// ── Status & receipts ───────────────────────────────────────────────────────
|
|
9670
|
+
/**
|
|
9671
|
+
* The sender's per-recipient delivery rollup for one send: who it reached and
|
|
9672
|
+
* how far each recipient got. Metadata only — never the pointer or contacts.
|
|
9673
|
+
*
|
|
9674
|
+
* @example
|
|
9675
|
+
* const { counts } = await sv.products.notify.getSendStatus(send.send_id);
|
|
9676
|
+
*/
|
|
9677
|
+
async getSendStatus(sendId) {
|
|
9678
|
+
requireSendId(sendId);
|
|
9679
|
+
const response = await this.http.get(`${BASE_PATH}/sends/${encodeURIComponent(sendId)}/status`);
|
|
9680
|
+
return response.data;
|
|
9681
|
+
}
|
|
9682
|
+
/**
|
|
9683
|
+
* The account's verified-interaction receipts (portable, JWKS-verifiable
|
|
9684
|
+
* proofs), newest first. Follow `cursor` to page.
|
|
9685
|
+
*
|
|
9686
|
+
* A page can come back SHORT of `limit` — even EMPTY — yet still carry a
|
|
9687
|
+
* non-null cursor: the receipt-subtype and `interaction` filters are applied
|
|
9688
|
+
* after the key query, so a page of non-matching rows yields no receipts and a
|
|
9689
|
+
* live cursor. Follow the cursor; never treat a short or empty page as the end.
|
|
9690
|
+
*
|
|
9691
|
+
* @example
|
|
9692
|
+
* const { receipts, cursor } = await sv.products.notify.listReceipts({ interaction: 'approve' });
|
|
9693
|
+
*/
|
|
9694
|
+
async listReceipts(options = {}) {
|
|
9695
|
+
const query = buildQuery$3({
|
|
9696
|
+
limit: options.limit,
|
|
9697
|
+
cursor: options.cursor,
|
|
9698
|
+
interaction: options.interaction,
|
|
9699
|
+
});
|
|
9700
|
+
const response = await this.http.get(`${BASE_PATH}/receipts${query}`);
|
|
9701
|
+
return response.data;
|
|
9702
|
+
}
|
|
9703
|
+
/**
|
|
9704
|
+
* Every receipt for one send, each attached to the recipient who produced it.
|
|
9705
|
+
* The correlation scan is bounded: when `truncated` is true, some older
|
|
9706
|
+
* receipts fall outside the scanned window — pass the returned `cursor` back in
|
|
9707
|
+
* to resume the scan exactly where it stopped.
|
|
9708
|
+
*
|
|
9709
|
+
* @example
|
|
9710
|
+
* const all: NotifySendReceipt[] = [];
|
|
9711
|
+
* let cursor: string | undefined;
|
|
9712
|
+
* do {
|
|
9713
|
+
* const page = await sv.products.notify.getSendReceipts(send.send_id, { cursor });
|
|
9714
|
+
* all.push(...page.receipts);
|
|
9715
|
+
* cursor = page.truncated ? page.cursor ?? undefined : undefined;
|
|
9716
|
+
* } while (cursor);
|
|
9717
|
+
*/
|
|
9718
|
+
async getSendReceipts(sendId, options = {}) {
|
|
9719
|
+
requireSendId(sendId);
|
|
9720
|
+
const query = buildQuery$3({ cursor: options.cursor });
|
|
9721
|
+
const response = await this.http.get(`${BASE_PATH}/sends/${encodeURIComponent(sendId)}/receipts${query}`);
|
|
9722
|
+
return response.data;
|
|
9723
|
+
}
|
|
9724
|
+
// ── Config ──────────────────────────────────────────────────────────────────
|
|
9725
|
+
/**
|
|
9726
|
+
* The account's effective Notify config (secure defaults deep-merged with its
|
|
9727
|
+
* overrides) plus the raw override delta, so an editor can show what is
|
|
9728
|
+
* customized versus default.
|
|
9729
|
+
*
|
|
9730
|
+
* @example
|
|
9731
|
+
* const { effective, overrides } = await sv.products.notify.getConfig();
|
|
9732
|
+
*/
|
|
9733
|
+
async getConfig() {
|
|
9734
|
+
const response = await this.http.get(`${BASE_PATH}/config`);
|
|
9735
|
+
return response.data;
|
|
9736
|
+
}
|
|
9737
|
+
/**
|
|
9738
|
+
* Merge a partial patch onto the account's config overrides. Owner-gated
|
|
9739
|
+
* (`channel_credentials`) and unknown keys are rejected before any write.
|
|
9740
|
+
*
|
|
9741
|
+
* Delete a category by storing an explicit `null` TOMBSTONE — that is what keeps
|
|
9742
|
+
* a seeded default from re-appearing on the next merge. The reserved `security`
|
|
9743
|
+
* category can neither be removed nor made optional.
|
|
9744
|
+
*
|
|
9745
|
+
* @example
|
|
9746
|
+
* await sv.products.notify.updateConfig({
|
|
9747
|
+
* categories: {
|
|
9748
|
+
* weekly_newsletter: { label: 'Weekly newsletter', required: false },
|
|
9749
|
+
* marketing: null, // tombstone — remove the seeded default
|
|
9750
|
+
* },
|
|
9751
|
+
* });
|
|
9752
|
+
*/
|
|
9753
|
+
async updateConfig(patch) {
|
|
9754
|
+
if (!patch || typeof patch !== 'object' || Array.isArray(patch)) {
|
|
9755
|
+
throw new ValidationError('config patch must be an object');
|
|
9756
|
+
}
|
|
9757
|
+
const response = await this.http.put(`${BASE_PATH}/config`, patch);
|
|
9758
|
+
return response.data;
|
|
9759
|
+
}
|
|
9760
|
+
}
|
|
9761
|
+
/**
|
|
9762
|
+
* Map the camelCase option bag onto the send body. Undefined fields drop out at
|
|
9763
|
+
* JSON serialization, so an omitted option is absent on the wire rather than null.
|
|
9764
|
+
*/
|
|
9765
|
+
function toSendBody(options) {
|
|
9766
|
+
return {
|
|
9767
|
+
send_id: options.sendId,
|
|
9768
|
+
recipients: options.recipients,
|
|
9769
|
+
content: options.content
|
|
9770
|
+
? {
|
|
9771
|
+
payload: options.content.payload,
|
|
9772
|
+
content_type: options.content.contentType,
|
|
9773
|
+
filename: options.content.filename,
|
|
9774
|
+
ttl_minutes: options.content.ttlMinutes,
|
|
9775
|
+
}
|
|
9776
|
+
: undefined,
|
|
9777
|
+
ingot: options.ingot
|
|
9778
|
+
? { ingot_id: options.ingot.ingotId, vault_id: options.ingot.vaultId }
|
|
9779
|
+
: undefined,
|
|
9780
|
+
delivery: options.delivery,
|
|
9781
|
+
policy: options.policy
|
|
9782
|
+
? {
|
|
9783
|
+
verification_level: options.policy.verificationLevel,
|
|
9784
|
+
interaction: options.policy.interaction,
|
|
9785
|
+
reveal_freshness_minutes: options.policy.revealFreshnessMinutes,
|
|
9786
|
+
}
|
|
9787
|
+
: undefined,
|
|
9788
|
+
channels: options.channels,
|
|
9789
|
+
escalation: options.escalation,
|
|
9790
|
+
title: options.title,
|
|
9791
|
+
category: options.category,
|
|
9792
|
+
type: options.type,
|
|
9793
|
+
instructions: options.instructions,
|
|
9794
|
+
history_ttl_days: options.historyTtlDays,
|
|
9795
|
+
};
|
|
9796
|
+
}
|
|
9797
|
+
function requireRecipientId(recipientId) {
|
|
9798
|
+
if (!recipientId || typeof recipientId !== 'string') {
|
|
9799
|
+
throw new ValidationError('recipientId is required', { field: 'recipientId' });
|
|
9800
|
+
}
|
|
9801
|
+
}
|
|
9802
|
+
function requireSendId(sendId) {
|
|
9803
|
+
if (!sendId || typeof sendId !== 'string') {
|
|
9804
|
+
throw new ValidationError('sendId is required', { field: 'sendId' });
|
|
9805
|
+
}
|
|
9806
|
+
}
|
|
9807
|
+
function buildQuery$3(params) {
|
|
9808
|
+
const search = new URLSearchParams();
|
|
9809
|
+
for (const [key, value] of Object.entries(params)) {
|
|
9810
|
+
if (value === undefined || value === '')
|
|
9811
|
+
continue;
|
|
9812
|
+
search.append(key, String(value));
|
|
9813
|
+
}
|
|
9814
|
+
const query = search.toString();
|
|
9815
|
+
return query ? `?${query}` : '';
|
|
9816
|
+
}
|
|
9817
|
+
|
|
9289
9818
|
/**
|
|
9290
9819
|
* Products Module
|
|
9291
9820
|
*
|
|
@@ -9294,8 +9823,13 @@ class IdentityModule {
|
|
|
9294
9823
|
* Currently exposes `identity`; future products attach here alongside it.
|
|
9295
9824
|
*/
|
|
9296
9825
|
class ProductsModule {
|
|
9297
|
-
|
|
9826
|
+
/**
|
|
9827
|
+
* `http` defaults to a client over the same resolved config so constructing
|
|
9828
|
+
* this module standalone stays a one-argument call.
|
|
9829
|
+
*/
|
|
9830
|
+
constructor(config, http = new HttpClient(config)) {
|
|
9298
9831
|
this.identity = new IdentityModule(config);
|
|
9832
|
+
this.notify = new NotifyProductModule(http);
|
|
9299
9833
|
}
|
|
9300
9834
|
}
|
|
9301
9835
|
|
|
@@ -13696,6 +14230,13 @@ class EntropyModule {
|
|
|
13696
14230
|
* device push registration is intentionally omitted (Expo-only on mobile).
|
|
13697
14231
|
*/
|
|
13698
14232
|
const MARK_STATES = ['seen', 'read', 'archived'];
|
|
14233
|
+
const BULK_MARK_STATES = ['seen', 'read'];
|
|
14234
|
+
/**
|
|
14235
|
+
* Hard bound on `markAllRead()`'s drain loop: 100 server pages of 100 rows. A
|
|
14236
|
+
* cursor that never resolves to null can therefore never spin forever, and an
|
|
14237
|
+
* inbox deeper than the bound finishes on a second call (the drain is idempotent).
|
|
14238
|
+
*/
|
|
14239
|
+
const MARK_ALL_MAX_PAGES = 100;
|
|
13699
14240
|
/**
|
|
13700
14241
|
* Decode a base64url VAPID key into the Uint8Array `pushManager.subscribe`
|
|
13701
14242
|
* requires for `applicationServerKey`. Standalone (no atob dependency on a
|
|
@@ -13785,6 +14326,65 @@ class NotifyModule {
|
|
|
13785
14326
|
const response = await this.http.post(`/v1/me/notifications/${encodeURIComponent(notificationId)}/state`, { created_at: options.createdAt, state: options.state });
|
|
13786
14327
|
return response.data;
|
|
13787
14328
|
}
|
|
14329
|
+
/**
|
|
14330
|
+
* Bulk-mark ONE bounded page of the caller's inbox and return the server's
|
|
14331
|
+
* payload verbatim. `cursor` comes back non-null while rows remain — thread it
|
|
14332
|
+
* into the next call. `archived` is per-row only (no GSI to page over), so the
|
|
14333
|
+
* bulk states are `seen` and `read`.
|
|
14334
|
+
*
|
|
14335
|
+
* Prefer `markAllRead()` unless the caller needs to own the paging.
|
|
14336
|
+
*
|
|
14337
|
+
* @example
|
|
14338
|
+
* let page = await sv.notify.markAllState({ state: 'seen' });
|
|
14339
|
+
* while (page.cursor) page = await sv.notify.markAllState({ state: 'seen', cursor: page.cursor });
|
|
14340
|
+
*/
|
|
14341
|
+
async markAllState(options) {
|
|
14342
|
+
if (!BULK_MARK_STATES.includes(options?.state)) {
|
|
14343
|
+
throw new ValidationError(`state must be one of ${BULK_MARK_STATES.join(', ')}`, {
|
|
14344
|
+
field: 'state',
|
|
14345
|
+
received: options?.state,
|
|
14346
|
+
});
|
|
14347
|
+
}
|
|
14348
|
+
if (options.cursor !== undefined && typeof options.cursor !== 'string') {
|
|
14349
|
+
throw new ValidationError('cursor must be the string cursor from a prior response', {
|
|
14350
|
+
field: 'cursor',
|
|
14351
|
+
received: options.cursor,
|
|
14352
|
+
});
|
|
14353
|
+
}
|
|
14354
|
+
const body = { state: options.state };
|
|
14355
|
+
if (options.cursor)
|
|
14356
|
+
body.cursor = options.cursor;
|
|
14357
|
+
const response = await this.http.post('/v1/me/notifications/state', body);
|
|
14358
|
+
return response.data;
|
|
14359
|
+
}
|
|
14360
|
+
/**
|
|
14361
|
+
* Drain the caller's whole inbox to read: loop `markAllState` on the returned
|
|
14362
|
+
* cursor until it comes back null, and return the total marked. Marking read
|
|
14363
|
+
* clears the unseen marker too, so the badge zeroes with it. Idempotent.
|
|
14364
|
+
*
|
|
14365
|
+
* `complete` is false when the loop stopped at the page bound with rows still
|
|
14366
|
+
* unmarked — an inbox deeper than the bound finishes on a second call. Without
|
|
14367
|
+
* it a truncated drain looks exactly like a finished one.
|
|
14368
|
+
*
|
|
14369
|
+
* An error mid-drain propagates — the pages already marked stay marked, and a
|
|
14370
|
+
* re-run picks up the remainder.
|
|
14371
|
+
*
|
|
14372
|
+
* @example
|
|
14373
|
+
* let { updated, complete } = await sv.notify.markAllRead();
|
|
14374
|
+
* while (!complete) ({ complete } = await sv.notify.markAllRead());
|
|
14375
|
+
*/
|
|
14376
|
+
async markAllRead() {
|
|
14377
|
+
let cursor;
|
|
14378
|
+
let updated = 0;
|
|
14379
|
+
for (let page = 0; page < MARK_ALL_MAX_PAGES; page += 1) {
|
|
14380
|
+
const result = await this.markAllState(cursor ? { state: 'read', cursor } : { state: 'read' });
|
|
14381
|
+
updated += result?.updated ?? 0;
|
|
14382
|
+
if (!result?.cursor)
|
|
14383
|
+
return { updated, complete: true };
|
|
14384
|
+
cursor = result.cursor;
|
|
14385
|
+
}
|
|
14386
|
+
return { updated, complete: false };
|
|
14387
|
+
}
|
|
13788
14388
|
// ── Browser Web Push ──────────────────────────────────────────────────────
|
|
13789
14389
|
/**
|
|
13790
14390
|
* Whether this environment can do Web Push (service worker + Push API +
|
|
@@ -14067,7 +14667,7 @@ class SparkVault {
|
|
|
14067
14667
|
validateConfig(config);
|
|
14068
14668
|
this.config = resolveConfig(config);
|
|
14069
14669
|
const http = new HttpClient(this.config);
|
|
14070
|
-
this.products = new ProductsModule(this.config);
|
|
14670
|
+
this.products = new ProductsModule(this.config, http);
|
|
14071
14671
|
this.vaults = new VaultsModule(this.config, http);
|
|
14072
14672
|
this.ingots = new IngotsModule(this.config, http);
|
|
14073
14673
|
this.folders = new FoldersModule(http);
|
|
@@ -14119,8 +14719,11 @@ exports.EntropyModule = EntropyModule;
|
|
|
14119
14719
|
exports.FoldersModule = FoldersModule;
|
|
14120
14720
|
exports.IdentityModule = IdentityModule;
|
|
14121
14721
|
exports.IngotsModule = IngotsModule;
|
|
14722
|
+
exports.NOTIFY_PRESETS = NOTIFY_PRESETS;
|
|
14122
14723
|
exports.NetworkError = NetworkError;
|
|
14123
14724
|
exports.NotifyModule = NotifyModule;
|
|
14725
|
+
exports.NotifyProductModule = NotifyProductModule;
|
|
14726
|
+
exports.NotifySubscriptionRequiredError = NotifySubscriptionRequiredError;
|
|
14124
14727
|
exports.PlanRequiredError = PlanRequiredError;
|
|
14125
14728
|
exports.PopupBlockedError = PopupBlockedError;
|
|
14126
14729
|
exports.ProductsModule = ProductsModule;
|
|
@@ -14132,6 +14735,7 @@ exports.TimeoutError = TimeoutError;
|
|
|
14132
14735
|
exports.UserCancelledError = UserCancelledError;
|
|
14133
14736
|
exports.ValidationError = ValidationError;
|
|
14134
14737
|
exports.VaultsModule = VaultsModule;
|
|
14738
|
+
exports.buildNotifyPresetSend = buildNotifyPresetSend;
|
|
14135
14739
|
exports.default = SparkVault;
|
|
14136
14740
|
exports.logger = logger;
|
|
14137
14741
|
exports.setDebugMode = setDebugMode;
|