@sparkvault/sdk-js 16.5.0 → 16.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.
@@ -118,6 +118,13 @@ export declare class HelpDeskClient {
118
118
  signInWidgetIdentity(options?: HelpDeskWidgetIdentityOptions): Promise<HelpDeskWidgetIdentitySession>;
119
119
  /** Choose a different support identity without logging out or changing the host website. */
120
120
  switchSupportAccount(): Promise<void>;
121
+ /**
122
+ * Sign the customer out of support in this browser: revoke the session, one
123
+ * a provider lent included, and keep the website's identity from signing
124
+ * them back in until `useWebsiteAccount`. The session is gone here before
125
+ * the revocation is answered; the host website's own sign-in is untouched.
126
+ */
127
+ signOutSupport(): Promise<void>;
121
128
  /** The only operation that resumes the website's configured identity provider after an explicit switch. */
122
129
  useWebsiteAccount(): Promise<HelpDeskSession | null>;
123
130
  getMe(): Promise<HelpDeskCustomer>;
@@ -28,7 +28,7 @@ export interface ComposerOptions {
28
28
  * refusals as a picked one; the drop target shows only over the composer. A
29
29
  * paste or drag of text alone stays the browser's. A file brought over the
30
30
  * form is never the browser's to open in place of the unsent request: on the
31
- * reply-to step, or while the form takes no files, it is refused outright,
31
+ * sign-in step, or while the form takes no files, it is refused outright,
32
32
  * and a desk that takes no files says so when the file is dropped.
33
33
  */
34
34
  export declare function createComposer(options: ComposerOptions): FormComposer;
@@ -1,31 +1,61 @@
1
1
  import type { HelpDeskCustomer, HelpDeskSession, HelpDeskTicketCreated } from './types';
2
+ /**
3
+ * @internal The unsent text a widget form hands on with an account change, and
4
+ * `hadFiles` when its composer held files then: files never go on to another form.
5
+ */
6
+ export interface HelpDeskCarriedComposition {
7
+ subject: string;
8
+ body: string;
9
+ hadFiles: boolean;
10
+ }
11
+ /**
12
+ * @internal The account change a widget form arrives from, carrying the request
13
+ * on: a Sign out, to a signed-out form, or a Switch account or Use website
14
+ * account, to the account arrived at. `droppedFiles` when files the request
15
+ * held stayed behind.
16
+ */
17
+ export interface HelpDeskFormArrival {
18
+ from: 'signOut' | 'switch';
19
+ droppedFiles: boolean;
20
+ }
2
21
  /** Internal adapter used by the KB-first support widget; a standalone form verifies the customer itself. */
3
22
  export interface HelpDeskWidgetFormIdentity {
4
23
  customer: HelpDeskCustomer | null;
5
- /** A desk that signs in with SparkVault Identity sends the email alone: its sign-in window asks a missing name itself. */
6
- signIn(input: {
7
- email: string;
8
- givenName?: string;
9
- familyName?: string;
10
- }): Promise<HelpDeskSession>;
11
- switchAccount(composition: {
12
- subject: string;
13
- body: string;
14
- } | null): void;
24
+ /**
25
+ * Open the native sign-in window in the caller's gesture, with no hint of
26
+ * who signs in: the window offers the accounts this browser is signed in
27
+ * to, or a sign-in, and asks a missing name itself.
28
+ */
29
+ signIn(): Promise<HelpDeskSession>;
30
+ /**
31
+ * Open the sign-in window's account chooser in the caller's gesture. This
32
+ * customer stays signed in until another account is chosen; the promise
33
+ * then resolves as a form for that account, carrying `composition`,
34
+ * replaces this one. It rejects, nothing changed, when no account is
35
+ * chosen: a UserCancelledError when the window closes.
36
+ *
37
+ * No `composition` is handed on while a send is under way, unanswered or done.
38
+ */
39
+ switchAccount(composition: HelpDeskCarriedComposition | null): Promise<void>;
40
+ /** Sign this customer out of support, without a window: a signed-out form carrying `composition` replaces this one. */
41
+ signOut(composition: HelpDeskCarriedComposition | null): void;
15
42
  /**
16
43
  * Present when the host bridges its website account: sign in with it again,
17
44
  * carrying the request, or, `recovering`, a website-account customer's
18
45
  * hidden saved request, which the next form keeps hidden while the website
19
46
  * gives no account back.
20
47
  */
21
- useWebsiteAccount?: (composition: {
22
- subject: string;
23
- body: string;
24
- } | null, recovering?: boolean) => void;
48
+ useWebsiteAccount?: (composition: HelpDeskCarriedComposition | null, recovering?: boolean) => void;
25
49
  /** Keep a website-account customer's saved request hidden from the start, as the form this one replaces did; `websiteSignedOut` when the website just gave no account back. */
26
50
  recovering?: {
27
51
  websiteSignedOut: boolean;
28
52
  };
53
+ /**
54
+ * The account change this form arrives from, which it says. A saved request
55
+ * this tab holds for the account arrived at takes the carried text's place,
56
+ * and its own status stands.
57
+ */
58
+ arrived?: HelpDeskFormArrival;
29
59
  /** Offer Use website account beside the request: the customer switched away from the website's account. */
30
60
  offerWebsiteAccount: boolean;
31
61
  /** A previous customer's request left the form: forget their question, in view and in storage. */
@@ -52,7 +82,7 @@ export interface HelpDeskFormOptions {
52
82
  widgetIdentity?: HelpDeskWidgetFormIdentity;
53
83
  /** @internal The support wizard is inline on the host's page (any `target`): that page asks before it unloads while the request holds unsent work. */
54
84
  pageLayout?: boolean;
55
- /** @internal The form's controls changed in place: it moved between its steps, or its actions changed as it left a hidden saved request. */
85
+ /** @internal The form's controls changed in place: it moved between its steps, its actions changed as it left a hidden saved request, or an account switch held or released them. */
56
86
  onScreenChange?: () => void;
57
87
  /** @internal The host page already shows "Secured by SparkVault", so the form leaves its own out. */
58
88
  hostShowsAttribution?: boolean;
@@ -12,6 +12,13 @@ export interface HelpDeskFormController extends HelpDeskFormHandle {
12
12
  * editing.
13
13
  */
14
14
  requestDismiss(): void;
15
+ /**
16
+ * Close the form for an account change that carries its unsent text on:
17
+ * the saved request of the customer the form shows now is removed instead
18
+ * of saved. A form with a send under way or unanswered, or a hidden saved
19
+ * request (recovery), closes as destroy() does, every row kept.
20
+ */
21
+ leave(): void;
15
22
  /**
16
23
  * Put a composition in the subject and description without changing what
17
24
  * the form was filled with: text that differs from that fill, such as edits
@@ -37,15 +44,16 @@ export interface HelpDeskFormController extends HelpDeskFormHandle {
37
44
  /** Clear a resolved access-gate error without changing a draft or uncertain send. */
38
45
  resumeAfterAccess(): void;
39
46
  /**
40
- * Go back from the reply-to step to the request, as the support wizard's
47
+ * Go back from the sign-in step to the request, as the support wizard's
41
48
  * Back does there. False on the request step, where Back is the wizard's.
42
49
  */
43
50
  returnToRequest(): boolean;
44
51
  /**
45
- * Focus where the customer goes on: the field the step in view asks for
46
- * (`stepField`), on the request step the end of the details once the
47
- * summary holds text, or the step's heading while that field cannot be
48
- * edited. False only once the form is destroyed or hidden.
52
+ * Focus where the customer goes on: on the sign-in step its sign-in
53
+ * button, which is all it asks; on the request step the field it asks for
54
+ * (`stepField`), the end of the details once the summary holds text; or the
55
+ * step's heading while that control cannot be used. False only once the
56
+ * form is destroyed or hidden.
49
57
  */
50
58
  focusEntry(focusOptions?: FocusOptions): boolean;
51
59
  }
@@ -68,6 +76,8 @@ export declare function ticketBody(summary: string, details: string): string;
68
76
  *
69
77
  * The request is a summary and optional details, in a composer that also
70
78
  * takes files. A signed-out widget customer writes it as step 1 of 2; step 2
71
- * asks who the reply goes to and proves it in the native sign-in window.
79
+ * asks nothing, and its one button signs them in, in the native sign-in
80
+ * window, and sends it. A signed-in one can switch account or sign out
81
+ * beside the request.
72
82
  */
73
83
  export declare function mountHelpDeskForm(client: HelpDeskClient, options: HelpDeskFormOptions): HelpDeskFormController;
@@ -14,6 +14,14 @@ export interface HelpDeskSupportOptions extends HelpDeskConnectOptions {
14
14
  target?: string | HTMLElement;
15
15
  /** @internal The host page already shows "Secured by SparkVault", so the contact form leaves its own out. */
16
16
  hostShowsAttribution?: boolean;
17
+ /**
18
+ * @internal The host keeps the session this journey proves (`onSession`) and
19
+ * lends it back (`getSessionToken`): no website account stands behind it to go
20
+ * back to, and `onSignOut` runs when the customer signs out here.
21
+ */
22
+ hostKeepsSession?: {
23
+ onSignOut(): void;
24
+ };
17
25
  /** Keep recoverable composition in this browser tab through navigation and reload. Defaults to false. */
18
26
  persist?: boolean;
19
27
  /** Observe the customer session the journey proves or clears. */
@@ -11,6 +11,7 @@ export interface HelpDeskWidgetIdentityOptions {
11
11
  export interface HelpDeskWidgetIdentityChallenge {
12
12
  challenge_id: string;
13
13
  verifier: string;
14
+ /** Private to this window, like the verifier: handed only to the first-party page it opened, which Core requires it from. */
14
15
  state: string;
15
16
  sign_in_url: string;
16
17
  expires_at: number;