@sparkvault/sdk-js 15.4.0 → 15.6.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/dist/index.d.ts CHANGED
@@ -621,6 +621,102 @@ declare class IdentityModule {
621
621
  }): Promise<VerifyResult>;
622
622
  }
623
623
 
624
+ /** Named Notify projects owned and billed by one company account. */
625
+ type NotifyProjectStatus = 'draft' | 'active' | 'read_only' | 'archived';
626
+ interface NotifyProjectBilling {
627
+ subscription_item_id?: string | null;
628
+ subscription_id?: string | null;
629
+ status: 'draft' | 'active' | 'past_due' | 'read_only';
630
+ notifications_cap: number;
631
+ /** Allowance selected for the next period when a downgrade is scheduled. */
632
+ renewal_notifications_cap?: number;
633
+ current_period_end?: number | null;
634
+ cancel_at_period_end?: boolean;
635
+ price_id?: string | null;
636
+ stripe_product_id?: string | null;
637
+ tier_price_id?: string | null;
638
+ /** Default uses the company's existing Notify subscription. */
639
+ legacy?: boolean;
640
+ }
641
+ interface NotifyProjectUsage {
642
+ notifications_used: number;
643
+ cycle_resets_at: number | null;
644
+ }
645
+ interface NotifyProject {
646
+ /** Immutable project id. `default` addresses the existing account's Notify. */
647
+ project_id: string;
648
+ account_id: string;
649
+ name: string;
650
+ description: string;
651
+ /** Optional project sender name; null uses the organization's name. */
652
+ sender_name: string | null;
653
+ status: NotifyProjectStatus;
654
+ /** Epoch seconds. */
655
+ created_at: number;
656
+ updated_at: number;
657
+ archived_at?: number;
658
+ billing: NotifyProjectBilling;
659
+ usage: NotifyProjectUsage;
660
+ }
661
+ interface ListNotifyProjectsResponse {
662
+ items: NotifyProject[];
663
+ }
664
+ interface CreateNotifyProjectOptions {
665
+ /** A recognizable name, up to 80 characters. */
666
+ name: string;
667
+ /** Up to 240 characters. */
668
+ description?: string;
669
+ /** Up to 64 characters; null uses the organization's name. */
670
+ sender_name?: string | null;
671
+ }
672
+ interface UpdateNotifyProjectOptions {
673
+ name?: string;
674
+ description?: string;
675
+ sender_name?: string | null;
676
+ }
677
+ interface PreviewNotifyProjectSubscriptionOptions {
678
+ notificationsPerMonth: number;
679
+ }
680
+ interface NotifyProjectSubscriptionPreview {
681
+ project_id: string;
682
+ notifications_per_month: number;
683
+ /** Exact decimal USD amounts, as strings; repeat the quote without float conversion. */
684
+ monthly_usd: string;
685
+ amount_due_now_usd: string;
686
+ currency: string;
687
+ proration_date: number;
688
+ effective_at: number | null;
689
+ checkout_required: boolean;
690
+ }
691
+ interface SubscribeNotifyProjectOptions extends PreviewNotifyProjectSubscriptionOptions {
692
+ /** Repeat the reviewed quote; a changed price is refused rather than charged. */
693
+ quotedAmountDueNowUsd: string;
694
+ prorationDate: number;
695
+ }
696
+ interface NotifyProjectSubscriptionResponse {
697
+ project: NotifyProject;
698
+ /** Present when the company's first subscription needs hosted payment setup. */
699
+ checkout_url?: string;
700
+ }
701
+
702
+ /** Company-level project management. Creation saves a draft and charges nothing. */
703
+ declare class NotifyProjectsModule {
704
+ private readonly http;
705
+ constructor(http: HttpClient);
706
+ list(): Promise<ListNotifyProjectsResponse>;
707
+ create(options: CreateNotifyProjectOptions): Promise<NotifyProject>;
708
+ get(projectId: string): Promise<NotifyProject>;
709
+ update(projectId: string, options: UpdateNotifyProjectOptions): Promise<NotifyProject>;
710
+ /** Archive after its paid plan has ended; Default cannot be archived. */
711
+ archive(projectId: string): Promise<NotifyProject>;
712
+ /** Quote a named project's plan. Requires an interactive company-admin session. */
713
+ previewSubscription(projectId: string, options: PreviewNotifyProjectSubscriptionOptions): Promise<NotifyProjectSubscriptionPreview>;
714
+ /** Purchase the reviewed plan on the company's invoice; an API key cannot authorize spending. */
715
+ subscribe(projectId: string, options: SubscribeNotifyProjectOptions): Promise<NotifyProjectSubscriptionResponse>;
716
+ /** End a named project's plan at its paid period deadline; retained history stays readable. */
717
+ cancelSubscription(projectId: string): Promise<NotifyProjectSubscriptionResponse>;
718
+ }
719
+
624
720
  /**
625
721
  * Notify Module Types
626
722
  *
@@ -652,6 +748,9 @@ type NotificationSender = {
652
748
  } | {
653
749
  type: 'organization';
654
750
  name: string | null;
751
+ /** Present for a named project's notifications. */
752
+ project_id?: string;
753
+ project_name?: string | null;
655
754
  };
656
755
  /**
657
756
  * An inbox row in the two-part notification model, as one sending account's
@@ -664,6 +763,8 @@ type NotificationSender = {
664
763
  */
665
764
  interface NotifyInboxRow {
666
765
  notification_id: string;
766
+ /** Named project attribution; absent on Default's legacy rows. */
767
+ notify_project_id?: string;
667
768
  send_id: string;
668
769
  created_at: number;
669
770
  title: string;
@@ -1856,6 +1957,8 @@ type NotifySendState = 'unknown' | 'pending' | 'sending' | 'delivered' | 'partia
1856
1957
  */
1857
1958
  interface NotifySendSummary {
1858
1959
  send_id: string | null;
1960
+ /** Named project id; absent on Default. */
1961
+ notify_project_id?: string;
1859
1962
  /** Epoch seconds. */
1860
1963
  created_at: number | null;
1861
1964
  title: string | null;
@@ -2373,7 +2476,16 @@ declare const NOTIFY_PRESETS: Readonly<Record<NotifyPresetName, NotifyPreset>>;
2373
2476
  declare function buildNotifyPresetSend(preset: NotifyPresetName, options: NotifyPresetSendOptions): CreateNotifySendOptions;
2374
2477
  declare class NotifyProductModule {
2375
2478
  private readonly http;
2376
- constructor(http: HttpClient);
2479
+ readonly projects: NotifyProjectsModule;
2480
+ private readonly projectId?;
2481
+ constructor(http: HttpClient, projectId?: string);
2482
+ /**
2483
+ * Bind every send, read and setting to one project. The original module keeps
2484
+ * addressing Default for existing integrations; this never changes global state.
2485
+ */
2486
+ project(projectId: string): NotifyProductModule;
2487
+ /** Compose two already-validated paths; project selection never enters a body. */
2488
+ private path;
2377
2489
  /**
2378
2490
  * Send a notification: seal the content, mint one single-use SparkLink per
2379
2491
  * recipient, and enqueue delivery across the resolved channel ladder.
@@ -4260,7 +4372,8 @@ declare class QuotaExceededError extends SparkVaultError {
4260
4372
  constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null, serviceCode?: string);
4261
4373
  }
4262
4374
  /**
4263
- * Notify subscription gate (403 NOTIFY_SUBSCRIPTION_REQUIRED) — the account
4375
+ * Notify subscription gate (403 NOTIFY_SUBSCRIPTION_REQUIRED or
4376
+ * NOTIFY_PROJECT_SUBSCRIPTION_REQUIRED) — the account or selected project
4264
4377
  * does not hold Notify and attempted a send that names no accepted send's
4265
4378
  * `sendId` (a replay of an accepted send, the same request under its `sendId`,
4266
4379
  * is answered with the stored send), or a config save that selects a new
@@ -5440,5 +5553,5 @@ declare global {
5440
5553
  }
5441
5554
  }
5442
5555
 
5443
- export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, HelpDeskClient, HelpDeskModule, IdentityModule, IdentityProviderError, IngotsModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, TimeoutError, UnauthorizedError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, isReceivedUploadFailure, logger, setDebugMode };
5444
- export type { AccessLogRetention, AccessLogsOptions, CreateFolderOptions, CreateNotifySendOptions, CreateSparkOptions, CreateUploadOptions, CreateVaultOptions, CreatedIngot, CreatedSpark, DownloadIngotOptions, EntropyFormat, EntropyResult, FetchDownloadOptions, FetchedDownload, Folder, FolderBreadcrumbItem, FolderContents, FolderPage, GenerateEntropyOptions, HealthCheckOptions, HealthCheckResult, HelpDeskAttachmentDownload, HelpDeskAttachmentInput, HelpDeskAttachmentUpload, HelpDeskConnectOptions, HelpDeskCreateTicketOptions, HelpDeskCustomer, HelpDeskCustomerPatch, HelpDeskDesk, HelpDeskDraft, HelpDeskEvent, HelpDeskExternalChallenge, HelpDeskExternalIdentity, HelpDeskFormHandle, HelpDeskFormOptions, HelpDeskFormState, HelpDeskIdentityRequest, HelpDeskListTicketsOptions, HelpDeskMountFormOptions, HelpDeskOpenFormOptions, HelpDeskPinChallenge, HelpDeskReplyCreated, HelpDeskReplyOptions, HelpDeskRequestContext, HelpDeskSession, HelpDeskSessionChange, HelpDeskSupportHandle, HelpDeskSupportLauncherOptions, HelpDeskSupportOpenOptions, HelpDeskSupportOptions, HelpDeskSupportStage, HelpDeskSupportState, HelpDeskTicket, HelpDeskTicketCreated, HelpDeskTicketDetail, HelpDeskTicketList, HelpDeskTimeline, HelpDeskVerifyPinOptions, HelpDeskWidgetFormIdentity, HelpDeskWidgetIdentityChallenge, HelpDeskWidgetIdentityOptions, HelpDeskWidgetIdentitySession, AttachOptions as IdentityAttachOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownloadLink, IngotInvitation, IngotInvite, IngotPage, IngotSharingConfig, IngotUpload, ListContentsOptions, ListFoldersOptions, ListIngotsOptions, ListNotificationsOptions, ListNotificationsResponse, ListNotifyInboxOptions, ListNotifyInboxResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, ListNotifySendsOptions, ListNotifySendsResponse, ListSparksOptions, MarkAllNotificationsStateOptions, MarkAllNotificationsStateResponse, MarkAllReadResult, MarkNotificationStateOptions, MarkNotificationStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, NameConflictPolicy, NotificationBulkMarkState, NotificationInboxState, NotificationMarkState, NotificationRow, NotificationSender, NotifyCategory, NotifyChannel, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigDeliveryPatch, NotifyConfigDestinations, NotifyConfigDestinationsPatch, NotifyConfigEvents, NotifyConfigEventsRead, NotifyConfigHistory, NotifyConfigOverrides, NotifyConfigPatch, NotifyConfigRealtimeFallbackDelay, NotifyConfigReliability, NotifyConfigResponse, NotifyConfigSecurity, NotifyDeliveryMode, NotifyDestinationFailureReason, NotifyDestinationKind, NotifyDestinationReason, NotifyDestinationSkipReason, NotifyDestinationState, NotifyDestinationTestReason, NotifyDestinationTestResult, NotifyDestinationTransportReason, NotifyEscalation, NotifyInboxBulkMarkState, NotifyInboxMarkState, NotifyInboxRow, NotifyInboxView, NotifyIngotRef, NotifyInteraction, NotifyPreset, NotifyPresetCategory, NotifyPresetName, NotifyPresetSendOptions, NotifyRecallMode, NotifyReceipt, NotifyReceiptEventType, NotifyRecipient, NotifyRecipientRef, NotifyRecipientState, NotifyReportableVerificationLevel, NotifySendContent, NotifySendPolicy, NotifySendReceipt, NotifySendReceiptsResponse, NotifySendResult, NotifySendState, NotifySendStatus, NotifySendStatusCounts, NotifySendStatusDestination, NotifySendStatusRecipient, NotifySendSummary, NotifySendSummaryDestination, NotifySlackDestination, NotifySuppressionReason, NotifyTeamsDestination, NotifyTeamsDestinationRead, NotifyVerificationLevel, NotifyWebhookDestination, NotifyWebhookDestinationRead, QuotaResource, RecallNotifySendOptions, RecallNotifySendResponse, RegisterWebPushResponse, ReplaceIngotOptions, ResumeUploadOptions, ScheduledVaultDeletion, SearchIngotsOptions, SendUploadOptions, ShareSparkOptions, SignInOptions, SignInResult, Spark, SparkInviteResend, SparkLinkActionOptions, SparkPage, SparkShare, SparkSummary, SparkVaultConfig, SparkVisibility, StartedVaultDeletion, SubscribeWebPushOptions, SubscribeWebPushResult, SubscribeWebPushStatus, TokenClaims, UnreachedAdmin, UnreadCountResponse, UnsealVaultOptions, UnsealedVault, UnsubscribeWebPushResponse, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadEnd, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, UploadSession, Vault, VaultDetail, VaultLifecycle, VaultResealDefaults, VaultResealSettings, VaultResealSettingsResult, VaultSessionExtension, VaultSessionTiming, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult, WebPushKeyResponse, WebPushStatus, WebPushStatusOptions, WebPushStatusResult, WebPushSubscriptionInput };
5556
+ export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, HelpDeskClient, HelpDeskModule, IdentityModule, IdentityProviderError, IngotsModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifyProjectsModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, TimeoutError, UnauthorizedError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, isReceivedUploadFailure, logger, setDebugMode };
5557
+ export type { AccessLogRetention, AccessLogsOptions, CreateFolderOptions, CreateNotifyProjectOptions, CreateNotifySendOptions, CreateSparkOptions, CreateUploadOptions, CreateVaultOptions, CreatedIngot, CreatedSpark, DownloadIngotOptions, EntropyFormat, EntropyResult, FetchDownloadOptions, FetchedDownload, Folder, FolderBreadcrumbItem, FolderContents, FolderPage, GenerateEntropyOptions, HealthCheckOptions, HealthCheckResult, HelpDeskAttachmentDownload, HelpDeskAttachmentInput, HelpDeskAttachmentUpload, HelpDeskConnectOptions, HelpDeskCreateTicketOptions, HelpDeskCustomer, HelpDeskCustomerPatch, HelpDeskDesk, HelpDeskDraft, HelpDeskEvent, HelpDeskExternalChallenge, HelpDeskExternalIdentity, HelpDeskFormHandle, HelpDeskFormOptions, HelpDeskFormState, HelpDeskIdentityRequest, HelpDeskListTicketsOptions, HelpDeskMountFormOptions, HelpDeskOpenFormOptions, HelpDeskPinChallenge, HelpDeskReplyCreated, HelpDeskReplyOptions, HelpDeskRequestContext, HelpDeskSession, HelpDeskSessionChange, HelpDeskSupportHandle, HelpDeskSupportLauncherOptions, HelpDeskSupportOpenOptions, HelpDeskSupportOptions, HelpDeskSupportStage, HelpDeskSupportState, HelpDeskTicket, HelpDeskTicketCreated, HelpDeskTicketDetail, HelpDeskTicketList, HelpDeskTimeline, HelpDeskVerifyPinOptions, HelpDeskWidgetFormIdentity, HelpDeskWidgetIdentityChallenge, HelpDeskWidgetIdentityOptions, HelpDeskWidgetIdentitySession, AttachOptions as IdentityAttachOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownloadLink, IngotInvitation, IngotInvite, IngotPage, IngotSharingConfig, IngotUpload, ListContentsOptions, ListFoldersOptions, ListIngotsOptions, ListNotificationsOptions, ListNotificationsResponse, ListNotifyInboxOptions, ListNotifyInboxResponse, ListNotifyProjectsResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, ListNotifySendsOptions, ListNotifySendsResponse, ListSparksOptions, MarkAllNotificationsStateOptions, MarkAllNotificationsStateResponse, MarkAllReadResult, MarkNotificationStateOptions, MarkNotificationStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, NameConflictPolicy, NotificationBulkMarkState, NotificationInboxState, NotificationMarkState, NotificationRow, NotificationSender, NotifyCategory, NotifyChannel, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigDeliveryPatch, NotifyConfigDestinations, NotifyConfigDestinationsPatch, NotifyConfigEvents, NotifyConfigEventsRead, NotifyConfigHistory, NotifyConfigOverrides, NotifyConfigPatch, NotifyConfigRealtimeFallbackDelay, NotifyConfigReliability, NotifyConfigResponse, NotifyConfigSecurity, NotifyDeliveryMode, NotifyDestinationFailureReason, NotifyDestinationKind, NotifyDestinationReason, NotifyDestinationSkipReason, NotifyDestinationState, NotifyDestinationTestReason, NotifyDestinationTestResult, NotifyDestinationTransportReason, NotifyEscalation, NotifyInboxBulkMarkState, NotifyInboxMarkState, NotifyInboxRow, NotifyInboxView, NotifyIngotRef, NotifyInteraction, NotifyPreset, NotifyPresetCategory, NotifyPresetName, NotifyPresetSendOptions, NotifyProject, NotifyProjectBilling, NotifyProjectStatus, NotifyProjectSubscriptionPreview, NotifyProjectSubscriptionResponse, NotifyProjectUsage, NotifyRecallMode, NotifyReceipt, NotifyReceiptEventType, NotifyRecipient, NotifyRecipientRef, NotifyRecipientState, NotifyReportableVerificationLevel, NotifySendContent, NotifySendPolicy, NotifySendReceipt, NotifySendReceiptsResponse, NotifySendResult, NotifySendState, NotifySendStatus, NotifySendStatusCounts, NotifySendStatusDestination, NotifySendStatusRecipient, NotifySendSummary, NotifySendSummaryDestination, NotifySlackDestination, NotifySuppressionReason, NotifyTeamsDestination, NotifyTeamsDestinationRead, NotifyVerificationLevel, NotifyWebhookDestination, NotifyWebhookDestinationRead, PreviewNotifyProjectSubscriptionOptions, QuotaResource, RecallNotifySendOptions, RecallNotifySendResponse, RegisterWebPushResponse, ReplaceIngotOptions, ResumeUploadOptions, ScheduledVaultDeletion, SearchIngotsOptions, SendUploadOptions, ShareSparkOptions, SignInOptions, SignInResult, Spark, SparkInviteResend, SparkLinkActionOptions, SparkPage, SparkShare, SparkSummary, SparkVaultConfig, SparkVisibility, StartedVaultDeletion, SubscribeNotifyProjectOptions, SubscribeWebPushOptions, SubscribeWebPushResult, SubscribeWebPushStatus, TokenClaims, UnreachedAdmin, UnreadCountResponse, UnsealVaultOptions, UnsealedVault, UnsubscribeWebPushResponse, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateNotifyProjectOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadEnd, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, UploadSession, Vault, VaultDetail, VaultLifecycle, VaultResealDefaults, VaultResealSettings, VaultResealSettingsResult, VaultSessionExtension, VaultSessionTiming, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult, WebPushKeyResponse, WebPushStatus, WebPushStatusOptions, WebPushStatusResult, WebPushSubscriptionInput };
package/dist/index.mjs CHANGED
@@ -861,7 +861,8 @@ class QuotaExceededError extends SparkVaultError {
861
861
  }
862
862
  }
863
863
  /**
864
- * Notify subscription gate (403 NOTIFY_SUBSCRIPTION_REQUIRED) — the account
864
+ * Notify subscription gate (403 NOTIFY_SUBSCRIPTION_REQUIRED or
865
+ * NOTIFY_PROJECT_SUBSCRIPTION_REQUIRED) — the account or selected project
865
866
  * does not hold Notify and attempted a send that names no accepted send's
866
867
  * `sendId` (a replay of an accepted send, the same request under its `sendId`,
867
868
  * is answered with the stored send), or a config save that selects a new
@@ -1023,6 +1024,7 @@ const RESOURCE_ID_PREFIXES = Object.freeze({
1023
1024
  ingot: 'ing',
1024
1025
  invite: 'inv',
1025
1026
  notification: 'ntf',
1027
+ notifyProject: 'ntp',
1026
1028
  requester: 'hrq',
1027
1029
  routingRule: 'hdr',
1028
1030
  savedReply: 'hds',
@@ -1665,7 +1667,7 @@ class HttpClient {
1665
1667
  // A Notify send, or a config save selecting a new sending domain, refused
1666
1668
  // because the account does not hold Notify is a billing gate, not a
1667
1669
  // credential problem — give it its own catchable type.
1668
- if (code === 'NOTIFY_SUBSCRIPTION_REQUIRED') {
1670
+ if (code === 'NOTIFY_SUBSCRIPTION_REQUIRED' || code === 'NOTIFY_PROJECT_SUBSCRIPTION_REQUIRED') {
1669
1671
  return new NotifySubscriptionRequiredError(message, details, retryAfterMs, code);
1670
1672
  }
1671
1673
  return new AuthorizationError(message, details, retryAfterMs, code);
@@ -11595,6 +11597,67 @@ function mergePresetSend(preset, args) {
11595
11597
  return merged;
11596
11598
  }
11597
11599
 
11600
+ /** Reject malformed project paths before a credentialed request leaves. */
11601
+ function requireNotifyProjectId(projectId) {
11602
+ if (projectId === 'default' || isResourceIdOf('notifyProject', projectId))
11603
+ return projectId;
11604
+ throw new ValidationError('projectId must be a Notify project id or "default"', {
11605
+ field: 'projectId', received: projectId,
11606
+ });
11607
+ }
11608
+ /** Company-level project management. Creation saves a draft and charges nothing. */
11609
+ class NotifyProjectsModule {
11610
+ constructor(http) {
11611
+ this.http = http;
11612
+ }
11613
+ async list() {
11614
+ const response = await this.http.get(apiPath `/v1/products/notify/projects`);
11615
+ return response.data;
11616
+ }
11617
+ async create(options) {
11618
+ const response = await this.http.post(apiPath `/v1/products/notify/projects`, options);
11619
+ return response.data;
11620
+ }
11621
+ async get(projectId) {
11622
+ const id = requireNotifyProjectId(projectId);
11623
+ const response = await this.http.get(apiPath `/v1/products/notify/projects/${id}`);
11624
+ return response.data;
11625
+ }
11626
+ async update(projectId, options) {
11627
+ const id = requireNotifyProjectId(projectId);
11628
+ const response = await this.http.put(apiPath `/v1/products/notify/projects/${id}`, options);
11629
+ return response.data;
11630
+ }
11631
+ /** Archive after its paid plan has ended; Default cannot be archived. */
11632
+ async archive(projectId) {
11633
+ const id = requireNotifyProjectId(projectId);
11634
+ const response = await this.http.post(apiPath `/v1/products/notify/projects/${id}/archive`, {});
11635
+ return response.data;
11636
+ }
11637
+ /** Quote a named project's plan. Requires an interactive company-admin session. */
11638
+ async previewSubscription(projectId, options) {
11639
+ const id = requireNotifyProjectId(projectId);
11640
+ const response = await this.http.post(apiPath `/v1/products/notify/projects/${id}/subscription/preview`, { notifications_per_month: options.notificationsPerMonth });
11641
+ return response.data;
11642
+ }
11643
+ /** Purchase the reviewed plan on the company's invoice; an API key cannot authorize spending. */
11644
+ async subscribe(projectId, options) {
11645
+ const id = requireNotifyProjectId(projectId);
11646
+ const response = await this.http.post(apiPath `/v1/products/notify/projects/${id}/subscription`, {
11647
+ notifications_per_month: options.notificationsPerMonth,
11648
+ quoted_amount_due_now_usd: options.quotedAmountDueNowUsd,
11649
+ proration_date: options.prorationDate,
11650
+ });
11651
+ return response.data;
11652
+ }
11653
+ /** End a named project's plan at its paid period deadline; retained history stays readable. */
11654
+ async cancelSubscription(projectId) {
11655
+ const id = requireNotifyProjectId(projectId);
11656
+ const response = await this.http.delete(apiPath `/v1/products/notify/projects/${id}/subscription`);
11657
+ return response.data;
11658
+ }
11659
+ }
11660
+
11598
11661
  /**
11599
11662
  * Notify Product Module — the TENANT (sender) surface.
11600
11663
  *
@@ -11680,8 +11743,25 @@ function buildNotifyPresetSend(preset, options) {
11680
11743
  return mergePresetSend(bundle, options);
11681
11744
  }
11682
11745
  class NotifyProductModule {
11683
- constructor(http) {
11746
+ constructor(http, projectId) {
11684
11747
  this.http = http;
11748
+ this.projectId = projectId === undefined ? undefined : requireNotifyProjectId(projectId);
11749
+ this.projects = new NotifyProjectsModule(http);
11750
+ }
11751
+ /**
11752
+ * Bind every send, read and setting to one project. The original module keeps
11753
+ * addressing Default for existing integrations; this never changes global state.
11754
+ */
11755
+ project(projectId) {
11756
+ return new NotifyProductModule(this.http, requireNotifyProjectId(projectId));
11757
+ }
11758
+ /** Compose two already-validated paths; project selection never enters a body. */
11759
+ path(literals, ...values) {
11760
+ const path = apiPath(literals, ...values);
11761
+ if (this.projectId === undefined)
11762
+ return path;
11763
+ const project = apiPath `/v1/products/notify/projects/${this.projectId}`;
11764
+ return `${project}${path.slice('/v1/products/notify'.length)}`;
11685
11765
  }
11686
11766
  // ── Send ────────────────────────────────────────────────────────────────────
11687
11767
  /**
@@ -11750,7 +11830,7 @@ class NotifyProductModule {
11750
11830
  if (options.ingot && (!options.ingot.vault?.id || !options.ingot.vault.vatToken)) {
11751
11831
  throw new ValidationError('An ingot send requires its vault unsealed with sv.vaults.unseal (ingot.vault): only a key holder may send a vault file', { field: 'ingot.vault' });
11752
11832
  }
11753
- const response = await this.http.post(apiPath `/v1/products/notify/send`, toSendBody(options), { vat: options.ingot?.vault.vatToken });
11833
+ const response = await this.http.post(this.path `/v1/products/notify/send`, toSendBody(options), { vat: options.ingot?.vault.vatToken });
11754
11834
  return response.data;
11755
11835
  }
11756
11836
  /**
@@ -11840,7 +11920,7 @@ class NotifyProductModule {
11840
11920
  */
11841
11921
  async getInbox(options) {
11842
11922
  requireRecipientId(options?.recipientId);
11843
- const response = await this.http.get(apiPath `/v1/products/notify/inbox`, {
11923
+ const response = await this.http.get(this.path `/v1/products/notify/inbox`, {
11844
11924
  query: {
11845
11925
  recipient_id: options.recipientId,
11846
11926
  state: options.state,
@@ -11878,7 +11958,7 @@ class NotifyProductModule {
11878
11958
  received: options.state,
11879
11959
  });
11880
11960
  }
11881
- const response = await this.http.post(apiPath `/v1/products/notify/inbox/${id}/state`, { recipient_id: options.recipientId, created_at: options.createdAt, state: options.state });
11961
+ const response = await this.http.post(this.path `/v1/products/notify/inbox/${id}/state`, { recipient_id: options.recipientId, created_at: options.createdAt, state: options.state });
11882
11962
  return response.data;
11883
11963
  }
11884
11964
  /**
@@ -11899,7 +11979,7 @@ class NotifyProductModule {
11899
11979
  if (!BULK_MARK_STATES$1.includes(options.state)) {
11900
11980
  throw new ValidationError(`state must be one of ${BULK_MARK_STATES$1.join(', ')} (archive per-row instead)`, { field: 'state', received: options.state });
11901
11981
  }
11902
- const response = await this.http.post(apiPath `/v1/products/notify/inbox/state`, {
11982
+ const response = await this.http.post(this.path `/v1/products/notify/inbox/state`, {
11903
11983
  recipient_id: options.recipientId,
11904
11984
  state: options.state,
11905
11985
  cursor: options.cursor,
@@ -11930,7 +12010,7 @@ class NotifyProductModule {
11930
12010
  * } while (cursor);
11931
12011
  */
11932
12012
  async listSends(options = {}) {
11933
- const response = await this.http.get(apiPath `/v1/products/notify/sends`, {
12013
+ const response = await this.http.get(this.path `/v1/products/notify/sends`, {
11934
12014
  query: { limit: options.limit, cursor: options.cursor },
11935
12015
  });
11936
12016
  return response.data;
@@ -11976,7 +12056,7 @@ class NotifyProductModule {
11976
12056
  received: options.mode,
11977
12057
  });
11978
12058
  }
11979
- const response = await this.http.post(apiPath `/v1/products/notify/sends/${sendId}/recall`, { recipient_ids: options.recipientIds, mode: options.mode });
12059
+ const response = await this.http.post(this.path `/v1/products/notify/sends/${sendId}/recall`, { recipient_ids: options.recipientIds, mode: options.mode });
11980
12060
  return response.data;
11981
12061
  }
11982
12062
  // ── Status & receipts ───────────────────────────────────────────────────────
@@ -11990,7 +12070,7 @@ class NotifyProductModule {
11990
12070
  */
11991
12071
  async getSendStatus(sendId) {
11992
12072
  requireSendId(sendId);
11993
- const response = await this.http.get(apiPath `/v1/products/notify/sends/${sendId}/status`);
12073
+ const response = await this.http.get(this.path `/v1/products/notify/sends/${sendId}/status`);
11994
12074
  return response.data;
11995
12075
  }
11996
12076
  /**
@@ -12004,7 +12084,7 @@ class NotifyProductModule {
12004
12084
  * const { receipts, cursor } = await sv.products.notify.listReceipts({ interaction: 'approve' });
12005
12085
  */
12006
12086
  async listReceipts(options = {}) {
12007
- const response = await this.http.get(apiPath `/v1/products/notify/receipts`, {
12087
+ const response = await this.http.get(this.path `/v1/products/notify/receipts`, {
12008
12088
  query: {
12009
12089
  limit: options.limit,
12010
12090
  cursor: options.cursor,
@@ -12030,7 +12110,7 @@ class NotifyProductModule {
12030
12110
  */
12031
12111
  async getSendReceipts(sendId, options = {}) {
12032
12112
  requireSendId(sendId);
12033
- const response = await this.http.get(apiPath `/v1/products/notify/sends/${sendId}/receipts`, { query: { cursor: options.cursor } });
12113
+ const response = await this.http.get(this.path `/v1/products/notify/sends/${sendId}/receipts`, { query: { cursor: options.cursor } });
12034
12114
  return response.data;
12035
12115
  }
12036
12116
  // ── Config ──────────────────────────────────────────────────────────────────
@@ -12043,7 +12123,7 @@ class NotifyProductModule {
12043
12123
  * const { effective, overrides } = await sv.products.notify.getConfig();
12044
12124
  */
12045
12125
  async getConfig() {
12046
- const response = await this.http.get(apiPath `/v1/products/notify/config`);
12126
+ const response = await this.http.get(this.path `/v1/products/notify/config`);
12047
12127
  return response.data;
12048
12128
  }
12049
12129
  /**
@@ -12092,7 +12172,7 @@ class NotifyProductModule {
12092
12172
  if (!patch || typeof patch !== 'object' || Array.isArray(patch)) {
12093
12173
  throw new ValidationError('config patch must be an object');
12094
12174
  }
12095
- const response = await this.http.put(apiPath `/v1/products/notify/config`, patch);
12175
+ const response = await this.http.put(this.path `/v1/products/notify/config`, patch);
12096
12176
  return response.data;
12097
12177
  }
12098
12178
  /**
@@ -12122,7 +12202,7 @@ class NotifyProductModule {
12122
12202
  if (!NOTIFY_DESTINATION_KINDS.includes(kind)) {
12123
12203
  throw new ValidationError(`kind must be one of ${NOTIFY_DESTINATION_KINDS.join(', ')}`);
12124
12204
  }
12125
- const response = await this.http.post(apiPath `/v1/products/notify/destinations/${kind}/test`);
12205
+ const response = await this.http.post(this.path `/v1/products/notify/destinations/${kind}/test`);
12126
12206
  return response.data;
12127
12207
  }
12128
12208
  /**
@@ -12151,7 +12231,7 @@ class NotifyProductModule {
12151
12231
  * if (sender.state === 'handle_required') promptForHandle();
12152
12232
  */
12153
12233
  async getEmailSender() {
12154
- const response = await this.http.get(apiPath `/v1/products/notify/email-sender`);
12234
+ const response = await this.http.get(this.path `/v1/products/notify/email-sender`);
12155
12235
  return response.data;
12156
12236
  }
12157
12237
  }
@@ -25037,7 +25117,7 @@ class SparkVault {
25037
25117
  }
25038
25118
  /** Get the SDK version */
25039
25119
  static get version() {
25040
- return '15.4.0';
25120
+ return '15.6.0';
25041
25121
  }
25042
25122
  }
25043
25123
  if (typeof window !== 'undefined') {
@@ -25047,5 +25127,5 @@ if (typeof window !== 'undefined') {
25047
25127
  window.SparkVault = instance ?? SparkVault;
25048
25128
  }
25049
25129
 
25050
- export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, HelpDeskClient, HelpDeskModule, IdentityModule, IdentityProviderError, IngotsModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, TimeoutError, UnauthorizedError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, isReceivedUploadFailure, logger, setDebugMode };
25130
+ export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, HelpDeskClient, HelpDeskModule, IdentityModule, IdentityProviderError, IngotsModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifyProjectsModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, TimeoutError, UnauthorizedError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, isReceivedUploadFailure, logger, setDebugMode };
25051
25131
  //# sourceMappingURL=index.mjs.map