@sparkvault/sdk-js 16.12.0 → 17.0.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 +49 -1
- package/dist/index.cjs +367 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +110 -12
- package/dist/index.mjs +367 -71
- package/dist/index.mjs.map +1 -1
- package/dist/products/help-desk/client.d.ts +50 -6
- package/dist/products/help-desk/form-types.d.ts +3 -1
- package/dist/products/help-desk/index.d.ts +13 -3
- package/dist/products/help-desk/support-types.d.ts +6 -2
- package/dist/products/help-desk/types.d.ts +38 -0
- package/dist/products/help-desk/widget-identity.d.ts +6 -2
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -420,7 +420,25 @@ through `getSessionToken`, so a host that lends one must drop it when
|
|
|
420
420
|
`onSession` reports `null`. The host website's own login is untouched. Both
|
|
421
421
|
suppress website sign-in until “Use website account” is chosen, which is
|
|
422
422
|
offered once the visitor has switched away from the website account; a Sign
|
|
423
|
-
out alone does not offer it.
|
|
423
|
+
out alone does not offer it. Use website account releases the switched-to
|
|
424
|
+
session at once, its revocation going behind as a switch's does (a refused or
|
|
425
|
+
lost one reaches `onError`), and reports once, through `onSession`, the
|
|
426
|
+
session the website's identity signs support back in with, or `null` when it
|
|
427
|
+
gives none back, never a signed-out moment between. Past a ticket password or
|
|
428
|
+
employee gate, which the return asks again, it reports nothing at the return
|
|
429
|
+
and then at support's next session lookup: contact's once the gate opens, or a
|
|
430
|
+
reopened support's at the question (`persist`), which asks the website while
|
|
431
|
+
the gate still stands; an employee gate that finds no website account reports
|
|
432
|
+
the employee session it installs instead. A host that lends its own
|
|
433
|
+
session through `getSessionToken` hears nothing, as support goes back to the
|
|
434
|
+
session it lends; one that lends back a switched-to session it kept from
|
|
435
|
+
`onSession` lends none, since support revoked it (the client refuses every
|
|
436
|
+
bearer it let go of, through `getSessionToken` and `setSession` alike), and
|
|
437
|
+
hears `null` once so that it drops it. Headless, `returnToWebsiteAccount()` returns `released` and
|
|
438
|
+
`resumed`, which settle apart. A session the secure window redeems that
|
|
439
|
+
support does not keep (the sign-in was cancelled or support closed while it
|
|
440
|
+
finished, or it served only as an employee proof: a help center's, or a
|
|
441
|
+
ticket gate's while another session stands) is revoked at once. Switch account, Sign out and Use website account
|
|
424
442
|
each carry idle, unsent summary and details to the next form and remove the
|
|
425
443
|
previous account's saved copy of the request. Files stay behind: the next form
|
|
426
444
|
asks for them again, unless Use website account finds no website account. A
|
|
@@ -506,6 +524,14 @@ Each desk is discovered from its own hostname and checked against the SDK's
|
|
|
506
524
|
configured company account. Add `deskId` to `connect`, `mountForm`, `openForm`,
|
|
507
525
|
or `attach` to pin an expected desk, for example
|
|
508
526
|
`{ host: 'subscribers.example.com', deskId: 'hdd_0123456789abcdef0123456789abcdef' }`.
|
|
527
|
+
A page that already holds the desk lookup's answer for its host
|
|
528
|
+
(`GET /v1/hd/desks?host=`), as the hosted portal does, passes it as `desk` to
|
|
529
|
+
any of these or to `createSupport`: the SDK checks it as it checks its own
|
|
530
|
+
lookup's answer, and connecting does not look the desk up again (each contact
|
|
531
|
+
opening still refreshes the desk's ticket access policy through the same
|
|
532
|
+
lookup). `host` is then checked
|
|
533
|
+
as a host name but not compared with the desk, which serves hosts its answer
|
|
534
|
+
does not list (its handle host besides a custom `canonical_host`).
|
|
509
535
|
Separate clients keep their customer sessions and ticket requests in their own desks.
|
|
510
536
|
|
|
511
537
|
```typescript
|
|
@@ -593,6 +619,28 @@ ticket history or create/link a global SVID. The support widget's optional
|
|
|
593
619
|
auth.SV account switch opens a separate native requester and leaves the website
|
|
594
620
|
signed in; only “Use website account” resumes the host provider.
|
|
595
621
|
|
|
622
|
+
A custom UI that offers Use website account calls `returnToWebsiteAccount()`.
|
|
623
|
+
The session in use is released at once and the website's identity resumed;
|
|
624
|
+
`released` settles with the revocation apart from the return, and a refused or
|
|
625
|
+
lost one leaves the return made, so handle it:
|
|
626
|
+
|
|
627
|
+
```typescript
|
|
628
|
+
const { released, resumed } = desk.returnToWebsiteAccount();
|
|
629
|
+
released.catch(reportError); // The return is made either way.
|
|
630
|
+
const session = await resumed; // null for none, a lent session, or a ticket gate still standing.
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
While a ticket gate stands, `resumed` is null without asking the website: once
|
|
634
|
+
the gate opens, a company host signs back in with `authenticate()` and a host
|
|
635
|
+
that lends its session reads it with `getSessionToken()`. A session the
|
|
636
|
+
client's own `signInWidgetIdentity()` redeemed that the UI does not install
|
|
637
|
+
ends with `discardSession(session)`, a logout carrying only that bearer. One
|
|
638
|
+
Core opened for the client that reaches no one (an invalid answer, a customer
|
|
639
|
+
changed while it was opened, a sign-in that had ended) the client revokes
|
|
640
|
+
itself, reporting a refused or lost revocation to `connect`'s
|
|
641
|
+
`onDiscardError`; the widget and the SDK's forms report those through their
|
|
642
|
+
own `onError`.
|
|
643
|
+
|
|
596
644
|
A host can also supply an existing server-issued desk session through
|
|
597
645
|
`getSessionToken` or `onAuthRequired`; never construct a session from browser
|
|
598
646
|
user IDs/emails. Return the session answer from `onAuthRequired` and let the form
|