@sparkvault/sdk-js 15.3.3 → 15.5.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 +31 -0
- package/dist/errors.d.ts +2 -1
- package/dist/index.cjs +127 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +123 -4
- package/dist/index.mjs +127 -30
- package/dist/index.mjs.map +1 -1
- package/dist/notify/types.d.ts +5 -0
- package/dist/products/help-desk/desk-id.d.ts +2 -0
- package/dist/products/help-desk/types.d.ts +6 -0
- package/dist/products/help-desk/widget-identity.d.ts +1 -1
- package/dist/products/index.d.ts +2 -1
- package/dist/products/notify/index.d.ts +13 -1
- package/dist/products/notify/project-types.d.ts +77 -0
- package/dist/products/notify/projects.d.ts +21 -0
- package/dist/products/notify/types.d.ts +2 -0
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
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
|
-
|
|
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.
|
|
@@ -3232,6 +3344,8 @@ interface HelpDeskExternalIdentity {
|
|
|
3232
3344
|
interface HelpDeskConnectOptions {
|
|
3233
3345
|
/** The configured help desk hostname, for example support.example.com. */
|
|
3234
3346
|
host: string;
|
|
3347
|
+
/** Optionally pin the expected desk within this company (hdd_ for a named desk, acc_ for its original desk). */
|
|
3348
|
+
deskId?: string;
|
|
3235
3349
|
/** A help desk hdt_ bearer provider. Core access tokens and API keys are never used. */
|
|
3236
3350
|
getSessionToken?: () => string | null | Promise<string | null>;
|
|
3237
3351
|
/** Obtain a purpose-specific JWT from the signed-in company's backend. No customer consent is shown. */
|
|
@@ -3242,9 +3356,13 @@ interface HelpDeskConnectOptions {
|
|
|
3242
3356
|
interface HelpDeskDesk {
|
|
3243
3357
|
kind: 'desk';
|
|
3244
3358
|
desk_id: string;
|
|
3359
|
+
/** Owning company. Required in named-desk discovery; legacy desks may omit it. */
|
|
3360
|
+
account_id?: string;
|
|
3245
3361
|
handle: string;
|
|
3246
3362
|
canonical_host: string;
|
|
3247
3363
|
sending_host: string;
|
|
3364
|
+
/** Configured contact/PIN sender, independent of the portal's custom domain. */
|
|
3365
|
+
contact_email?: string;
|
|
3248
3366
|
organization_name: string | null;
|
|
3249
3367
|
branding: {
|
|
3250
3368
|
color: string | null;
|
|
@@ -4254,7 +4372,8 @@ declare class QuotaExceededError extends SparkVaultError {
|
|
|
4254
4372
|
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null, serviceCode?: string);
|
|
4255
4373
|
}
|
|
4256
4374
|
/**
|
|
4257
|
-
* Notify subscription gate (403 NOTIFY_SUBSCRIPTION_REQUIRED
|
|
4375
|
+
* Notify subscription gate (403 NOTIFY_SUBSCRIPTION_REQUIRED or
|
|
4376
|
+
* NOTIFY_PROJECT_SUBSCRIPTION_REQUIRED) — the account or selected project
|
|
4258
4377
|
* does not hold Notify and attempted a send that names no accepted send's
|
|
4259
4378
|
* `sendId` (a replay of an accepted send, the same request under its `sendId`,
|
|
4260
4379
|
* is answered with the stored send), or a config save that selects a new
|
|
@@ -5434,5 +5553,5 @@ declare global {
|
|
|
5434
5553
|
}
|
|
5435
5554
|
}
|
|
5436
5555
|
|
|
5437
|
-
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 };
|
|
5438
|
-
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
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
12234
|
+
const response = await this.http.get(this.path `/v1/products/notify/email-sender`);
|
|
12155
12235
|
return response.data;
|
|
12156
12236
|
}
|
|
12157
12237
|
}
|
|
@@ -12204,6 +12284,11 @@ function requireSendId(sendId) {
|
|
|
12204
12284
|
}
|
|
12205
12285
|
}
|
|
12206
12286
|
|
|
12287
|
+
/** The original desk uses its account ID; additional desks have their own ID. */
|
|
12288
|
+
function validHelpDeskId(value) {
|
|
12289
|
+
return typeof value === 'string' && (isResourceIdOf('account', value) || /^hdd_[0-9a-f]{32}$/.test(value));
|
|
12290
|
+
}
|
|
12291
|
+
|
|
12207
12292
|
/**
|
|
12208
12293
|
* Ingot access logs: which of an ingot's audit events are accesses, and how one
|
|
12209
12294
|
* audit entry reads as an access. Both SDKs read
|
|
@@ -14967,7 +15052,9 @@ function mapInvitation(wire) {
|
|
|
14967
15052
|
/** The native support ceremony. Identity receipts stay inside the first-party window. */
|
|
14968
15053
|
const VALUE = /^[A-Za-z0-9_-]{43}$/;
|
|
14969
15054
|
/** Open synchronously inside the user's gesture, before preparing the server challenge. */
|
|
14970
|
-
function openWidgetIdentity(options, prepare, ready, redeem) {
|
|
15055
|
+
function openWidgetIdentity(options, prepare, ready, redeem, deskId) {
|
|
15056
|
+
if (!validHelpDeskId(deskId))
|
|
15057
|
+
return Promise.reject(new ValidationError('Support sign-in requires a valid desk.'));
|
|
14971
15058
|
if (typeof window === 'undefined')
|
|
14972
15059
|
return Promise.reject(new ValidationError('Support sign-in requires a browser.'));
|
|
14973
15060
|
if (options.signal?.aborted)
|
|
@@ -15038,8 +15125,7 @@ function openWidgetIdentity(options, prepare, ready, redeem) {
|
|
|
15038
15125
|
const url = new URL(value.sign_in_url);
|
|
15039
15126
|
if (!VALUE.test(value.challenge_id) || !VALUE.test(value.verifier) || !VALUE.test(value.state) || !Number.isSafeInteger(value.expires_at) ||
|
|
15040
15127
|
url.protocol !== 'https:' || url.origin !== 'https://auth.sv' || url.username || url.password || url.search || url.hash ||
|
|
15041
|
-
|
|
15042
|
-
!url.pathname.endsWith(`/${value.challenge_id}`))
|
|
15128
|
+
url.pathname !== `/help-desk/${deskId}/${value.challenge_id}`)
|
|
15043
15129
|
throw new SparkVaultError('The support sign-in address is invalid.', 'HELP_DESK_INVALID_RESPONSE');
|
|
15044
15130
|
challenge = value;
|
|
15045
15131
|
firstPartyOrigin = url.origin;
|
|
@@ -15188,6 +15274,9 @@ class HelpDeskClient {
|
|
|
15188
15274
|
/** Discover a desk by its configured host, before any customer credentials are sent. */
|
|
15189
15275
|
static async connect(config, options) {
|
|
15190
15276
|
const host = hostname(options?.host);
|
|
15277
|
+
if (options.deskId !== undefined && !validHelpDeskId(options.deskId)) {
|
|
15278
|
+
throw new ValidationError('deskId must be a Help Desk ID', { field: 'deskId' });
|
|
15279
|
+
}
|
|
15191
15280
|
if (options.getSessionToken !== undefined && typeof options.getSessionToken !== 'function') {
|
|
15192
15281
|
throw new ValidationError('getSessionToken must be a function', { field: 'getSessionToken' });
|
|
15193
15282
|
}
|
|
@@ -15207,7 +15296,11 @@ class HelpDeskClient {
|
|
|
15207
15296
|
if (data?.kind === 'moved') {
|
|
15208
15297
|
throw new SparkVaultError('This help desk has moved. Connect using its current host.', 'HELP_DESK_MOVED', 409, { movedTo: data.moved_to });
|
|
15209
15298
|
}
|
|
15210
|
-
|
|
15299
|
+
const originalDesk = data?.kind === 'desk' && isResourceIdOf('account', data.desk_id);
|
|
15300
|
+
const ownerId = data?.kind === 'desk' ? data.account_id ?? (originalDesk ? data.desk_id : null) : null;
|
|
15301
|
+
if (data?.kind !== 'desk' || !validHelpDeskId(data.desk_id) || ownerId !== config.accountId ||
|
|
15302
|
+
(originalDesk && data.desk_id !== config.accountId) ||
|
|
15303
|
+
(options.deskId !== undefined && options.deskId !== data.desk_id) || data.portal_client !== CLIENT) {
|
|
15211
15304
|
throw new SparkVaultError('The help desk lookup did not identify this account\'s desk.', 'HELP_DESK_INVALID_RESPONSE');
|
|
15212
15305
|
}
|
|
15213
15306
|
hostname(data.canonical_host);
|
|
@@ -15287,7 +15380,8 @@ class HelpDeskClient {
|
|
|
15287
15380
|
const { data } = await this.http.request(apiPath `/v1/hd/desks`, {
|
|
15288
15381
|
query: { host: this.desk.canonical_host }, headers: { 'X-SV-Client': CLIENT }, credentials: 'omit',
|
|
15289
15382
|
});
|
|
15290
|
-
|
|
15383
|
+
const ownerId = data?.account_id ?? (isResourceIdOf('account', data?.desk_id) ? data.desk_id : null);
|
|
15384
|
+
if (data?.kind !== 'desk' || data.desk_id !== this.desk.desk_id || ownerId !== (this.desk.account_id ?? this.desk.desk_id) || data.portal_client !== CLIENT) {
|
|
15291
15385
|
throw new SparkVaultError('This help desk could not refresh its access settings.', 'HELP_DESK_INVALID_RESPONSE');
|
|
15292
15386
|
}
|
|
15293
15387
|
if (JSON.stringify(data.ticket_access_control) !== JSON.stringify(this.currentTicketPolicy))
|
|
@@ -15547,7 +15641,7 @@ class HelpDeskClient {
|
|
|
15547
15641
|
}
|
|
15548
15642
|
this.issuedSessions.set(result, result.token);
|
|
15549
15643
|
return result;
|
|
15550
|
-
});
|
|
15644
|
+
}, this.desk.desk_id);
|
|
15551
15645
|
}
|
|
15552
15646
|
/** Choose a different support identity without logging out or changing the host website. */
|
|
15553
15647
|
switchSupportAccount() {
|
|
@@ -17551,7 +17645,7 @@ function mountHelpDeskForm(client, options) {
|
|
|
17551
17645
|
const codeHint = document.createElement('p');
|
|
17552
17646
|
codeHint.id = `${code.input.id}-hint`;
|
|
17553
17647
|
codeHint.className = 'svhd-file-hint';
|
|
17554
|
-
codeHint.textContent = `It works for ${HELP_DESK_PIN_TTL_MINUTES} minutes. Not in your inbox? Look in spam for mail from ${helpDeskCodeSender(client.desk.sending_host)}.`;
|
|
17648
|
+
codeHint.textContent = `It works for ${HELP_DESK_PIN_TTL_MINUTES} minutes. Not in your inbox? Look in spam for mail from ${client.desk.contact_email ?? helpDeskCodeSender(client.desk.sending_host)}.`;
|
|
17555
17649
|
code.input.setAttribute('aria-describedby', codeHint.id);
|
|
17556
17650
|
const resend = document.createElement('button');
|
|
17557
17651
|
resend.type = 'button';
|
|
@@ -18791,8 +18885,8 @@ class HelpDeskKnowledgeBaseClient {
|
|
|
18791
18885
|
this.activeMedia = null;
|
|
18792
18886
|
this.destroyed = false;
|
|
18793
18887
|
this.close = new AbortController();
|
|
18794
|
-
if (!
|
|
18795
|
-
throw new ValidationError('deskId must be a Help Desk
|
|
18888
|
+
if (!validHelpDeskId(deskId))
|
|
18889
|
+
throw new ValidationError('deskId must be a Help Desk ID');
|
|
18796
18890
|
}
|
|
18797
18891
|
getAccessHeaders() {
|
|
18798
18892
|
if (this.grantDeadline !== null && this.grantDeadline <= Date.now())
|
|
@@ -20470,14 +20564,17 @@ function createHelpDeskSupport(config, options) {
|
|
|
20470
20564
|
post: async (path, body) => {
|
|
20471
20565
|
if (destroyed)
|
|
20472
20566
|
throw new Error('Support is closed.');
|
|
20567
|
+
const deskId = client?.desk.desk_id;
|
|
20568
|
+
if (!deskId)
|
|
20569
|
+
throw new Error('Support is still loading.');
|
|
20473
20570
|
const prefix = `/hd/desks/${encodeURIComponent(config.accountId)}/support`;
|
|
20474
20571
|
const suffix = path.slice(prefix.length);
|
|
20475
20572
|
if (!path.startsWith(prefix))
|
|
20476
20573
|
throw new Error('Invalid support analytics route.');
|
|
20477
20574
|
const event = /^\/attempts\/([^/]+)\/events$/.exec(suffix);
|
|
20478
|
-
const route = suffix === '/visitor' ? apiPath `/v1/hd/desks/${
|
|
20479
|
-
: suffix === '/attempts' ? apiPath `/v1/hd/desks/${
|
|
20480
|
-
: event ? apiPath `/v1/hd/desks/${
|
|
20575
|
+
const route = suffix === '/visitor' ? apiPath `/v1/hd/desks/${deskId}/support/visitor`
|
|
20576
|
+
: suffix === '/attempts' ? apiPath `/v1/hd/desks/${deskId}/support/attempts`
|
|
20577
|
+
: event ? apiPath `/v1/hd/desks/${deskId}/support/attempts/${decodeURIComponent(event[1])}/events` : null;
|
|
20481
20578
|
if (!route)
|
|
20482
20579
|
throw new Error('Invalid support analytics route.');
|
|
20483
20580
|
const headers = kb?.getAccessHeaders() ?? {};
|
|
@@ -25020,7 +25117,7 @@ class SparkVault {
|
|
|
25020
25117
|
}
|
|
25021
25118
|
/** Get the SDK version */
|
|
25022
25119
|
static get version() {
|
|
25023
|
-
return '15.
|
|
25120
|
+
return '15.5.0';
|
|
25024
25121
|
}
|
|
25025
25122
|
}
|
|
25026
25123
|
if (typeof window !== 'undefined') {
|
|
@@ -25030,5 +25127,5 @@ if (typeof window !== 'undefined') {
|
|
|
25030
25127
|
window.SparkVault = instance ?? SparkVault;
|
|
25031
25128
|
}
|
|
25032
25129
|
|
|
25033
|
-
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 };
|
|
25034
25131
|
//# sourceMappingURL=index.mjs.map
|