@sparkvault/sdk-js 16.1.1 → 16.2.1
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.cjs +112 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +11 -6
- package/dist/index.mjs +112 -23
- package/dist/index.mjs.map +1 -1
- package/dist/products/identity/dialog-launcher.d.ts +4 -1
- package/dist/products/identity/index.d.ts +11 -6
- package/dist/products/identity/pending-signin.d.ts +3 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -620,14 +620,19 @@ declare class IdentityModule {
|
|
|
620
620
|
* 'redirect'`, or a popup whose handle COOP severed. Plain sign-in carries
|
|
621
621
|
* redirect_uri + state + PKCE challenge and returns via the fragment code;
|
|
622
622
|
* OIDC/simple modes navigate without them (their server-rendered pages drive
|
|
623
|
-
* the server-validated redirect back). Either carries
|
|
624
|
-
*
|
|
623
|
+
* the server-validated redirect back). Either carries the severed popup's
|
|
624
|
+
* reference; a redirect draws none of its own.
|
|
625
625
|
*
|
|
626
|
-
*
|
|
627
|
-
*
|
|
626
|
+
* The return leg is armed first: the check that the sign-in still runs and
|
|
627
|
+
* the pending marker's removal then share one turn with the navigation, so
|
|
628
|
+
* no sign-in can start or end between them.
|
|
629
|
+
*
|
|
630
|
+
* @param severed - The popup sign-in whose severed popup this continues,
|
|
631
|
+
* with the reference its marker holds for that popup (null for none), or
|
|
632
|
+
* null for an explicit redirect, which carries none
|
|
628
633
|
* @returns false when the return leg cannot be armed (no session storage or
|
|
629
|
-
* WebCrypto)
|
|
630
|
-
* silent dead-end.
|
|
634
|
+
* WebCrypto), so the caller surfaces an actionable error instead of a
|
|
635
|
+
* silent dead-end, or when the severed popup's sign-in ended meanwhile.
|
|
631
636
|
*/
|
|
632
637
|
private startRedirectFlow;
|
|
633
638
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -11608,7 +11608,7 @@ class PendingSignIn {
|
|
|
11608
11608
|
constructor(hint) {
|
|
11609
11609
|
this.hint = hint;
|
|
11610
11610
|
this.at = 0;
|
|
11611
|
-
this.
|
|
11611
|
+
this.ended = false;
|
|
11612
11612
|
// Counts the opens and the ends of their popups, so a draw that lands after
|
|
11613
11613
|
// its popup ended or was replaced is recognised and dropped.
|
|
11614
11614
|
this.opens = 0;
|
|
@@ -11624,6 +11624,10 @@ class PendingSignIn {
|
|
|
11624
11624
|
get reference() {
|
|
11625
11625
|
return this.current;
|
|
11626
11626
|
}
|
|
11627
|
+
/** False once the sign-in ended: it settled, was closed, or another replaced it. */
|
|
11628
|
+
get live() {
|
|
11629
|
+
return !this.ended;
|
|
11630
|
+
}
|
|
11627
11631
|
/**
|
|
11628
11632
|
* A popup opened, or the current one asked again for the reference it
|
|
11629
11633
|
* lacks: arm the marker holding no reference, and draw this open's own.
|
|
@@ -11633,7 +11637,7 @@ class PendingSignIn {
|
|
|
11633
11637
|
* rejects.
|
|
11634
11638
|
*/
|
|
11635
11639
|
open(draw) {
|
|
11636
|
-
if (
|
|
11640
|
+
if (this.ended)
|
|
11637
11641
|
return Promise.resolve(false);
|
|
11638
11642
|
const open = ++this.opens;
|
|
11639
11643
|
this.at = Date.now();
|
|
@@ -11642,7 +11646,7 @@ class PendingSignIn {
|
|
|
11642
11646
|
if (!this.write(null))
|
|
11643
11647
|
removePendingMarker();
|
|
11644
11648
|
const decided = signinReferenceInTime(draw()).then((reference) => {
|
|
11645
|
-
if (
|
|
11649
|
+
if (this.ended || open !== this.opens)
|
|
11646
11650
|
return false;
|
|
11647
11651
|
this.current = reference !== null && this.write(reference) ? reference : null;
|
|
11648
11652
|
return true;
|
|
@@ -11657,7 +11661,7 @@ class PendingSignIn {
|
|
|
11657
11661
|
* should it land, is dropped.
|
|
11658
11662
|
*/
|
|
11659
11663
|
retire() {
|
|
11660
|
-
if (
|
|
11664
|
+
if (this.ended)
|
|
11661
11665
|
return;
|
|
11662
11666
|
this.opens += 1;
|
|
11663
11667
|
this.current = null;
|
|
@@ -11666,7 +11670,7 @@ class PendingSignIn {
|
|
|
11666
11670
|
/** The sign-in settled, or another replaced it: retire the marker, and nothing this sign-in does later touches it. */
|
|
11667
11671
|
end() {
|
|
11668
11672
|
this.retire();
|
|
11669
|
-
this.
|
|
11673
|
+
this.ended = true;
|
|
11670
11674
|
}
|
|
11671
11675
|
/**
|
|
11672
11676
|
* The current popup's reference, waiting at most `waitMs` for an open still
|
|
@@ -12061,7 +12065,7 @@ class IdentityModule {
|
|
|
12061
12065
|
const signinRef = await pending.referenceWithin(SIGNIN_REFERENCE.redirectWaitMs);
|
|
12062
12066
|
if (signinRef === null)
|
|
12063
12067
|
pending.retire();
|
|
12064
|
-
return this.startRedirectFlow(mergedOptions, signinRef);
|
|
12068
|
+
return this.startRedirectFlow(mergedOptions, { signIn: pending, signinRef });
|
|
12065
12069
|
},
|
|
12066
12070
|
signinReference: () => pending.reference,
|
|
12067
12071
|
});
|
|
@@ -12319,31 +12323,41 @@ class IdentityModule {
|
|
|
12319
12323
|
* 'redirect'`, or a popup whose handle COOP severed. Plain sign-in carries
|
|
12320
12324
|
* redirect_uri + state + PKCE challenge and returns via the fragment code;
|
|
12321
12325
|
* OIDC/simple modes navigate without them (their server-rendered pages drive
|
|
12322
|
-
* the server-validated redirect back). Either carries
|
|
12323
|
-
*
|
|
12326
|
+
* the server-validated redirect back). Either carries the severed popup's
|
|
12327
|
+
* reference; a redirect draws none of its own.
|
|
12328
|
+
*
|
|
12329
|
+
* The return leg is armed first: the check that the sign-in still runs and
|
|
12330
|
+
* the pending marker's removal then share one turn with the navigation, so
|
|
12331
|
+
* no sign-in can start or end between them.
|
|
12324
12332
|
*
|
|
12325
|
-
* @param
|
|
12326
|
-
*
|
|
12333
|
+
* @param severed - The popup sign-in whose severed popup this continues,
|
|
12334
|
+
* with the reference its marker holds for that popup (null for none), or
|
|
12335
|
+
* null for an explicit redirect, which carries none
|
|
12327
12336
|
* @returns false when the return leg cannot be armed (no session storage or
|
|
12328
|
-
* WebCrypto)
|
|
12329
|
-
* silent dead-end.
|
|
12337
|
+
* WebCrypto), so the caller surfaces an actionable error instead of a
|
|
12338
|
+
* silent dead-end, or when the severed popup's sign-in ended meanwhile.
|
|
12330
12339
|
*/
|
|
12331
|
-
async startRedirectFlow(options,
|
|
12340
|
+
async startRedirectFlow(options, severed) {
|
|
12341
|
+
const signinRef = severed?.signinRef ?? null;
|
|
12342
|
+
const authContext = options.authContext;
|
|
12343
|
+
const handoff = authContext?.authRequestId || authContext?.simpleMode?.sessionId
|
|
12344
|
+
? undefined
|
|
12345
|
+
: await this.armHandoffReturn();
|
|
12346
|
+
if (handoff === null) {
|
|
12347
|
+
return false;
|
|
12348
|
+
}
|
|
12349
|
+
// A popup sign-in that ended meanwhile (the bridge's ✕, close(), or a
|
|
12350
|
+
// signIn() that replaced it) leaves this tab where it is, and leaves
|
|
12351
|
+
// alone the marker of any sign-in that now runs here.
|
|
12352
|
+
if (severed && !severed.signIn.live) {
|
|
12353
|
+
return false;
|
|
12354
|
+
}
|
|
12332
12355
|
if (signinRef === null) {
|
|
12333
12356
|
// With no marker, no recovery can stand in for this page's result, so
|
|
12334
12357
|
// the page needs no reference. A marker left from an earlier sign-in
|
|
12335
12358
|
// would otherwise bounce on the next load in place of this one.
|
|
12336
12359
|
removePendingMarker();
|
|
12337
12360
|
}
|
|
12338
|
-
const authContext = options.authContext;
|
|
12339
|
-
if (authContext?.authRequestId || authContext?.simpleMode?.sessionId) {
|
|
12340
|
-
window.location.assign(buildSigninUrl(this.config, options, { kind: 'redirect', signinRef }));
|
|
12341
|
-
return true;
|
|
12342
|
-
}
|
|
12343
|
-
const handoff = await this.armHandoffReturn();
|
|
12344
|
-
if (!handoff) {
|
|
12345
|
-
return false;
|
|
12346
|
-
}
|
|
12347
12361
|
window.location.assign(buildSigninUrl(this.config, options, { kind: 'redirect', signinRef, handoff }));
|
|
12348
12362
|
return true;
|
|
12349
12363
|
}
|
|
@@ -14420,6 +14434,81 @@ const CUSTOMER_UPLOAD_REFUSALS = Object.freeze({
|
|
|
14420
14434
|
UPLOADS_OFF: 'customer_uploads_off'
|
|
14421
14435
|
});
|
|
14422
14436
|
|
|
14437
|
+
/**
|
|
14438
|
+
* The roles a member holds on one desk, each granted per desk to a member who
|
|
14439
|
+
* holds Help Desk product access (@sparkvault/app-sdk/product-access): a
|
|
14440
|
+
* Manager runs the desk, an Agent works its tickets, a Trainee works them
|
|
14441
|
+
* with every customer reply approved by a Manager first. No role is no row:
|
|
14442
|
+
* the member does not work the desk.
|
|
14443
|
+
*/
|
|
14444
|
+
const HELP_DESK_ROLES = Object.freeze(['manager', 'agent', 'trainee']);
|
|
14445
|
+
|
|
14446
|
+
/**
|
|
14447
|
+
* What each role may do on its desk: the one authorization matrix Core's gates
|
|
14448
|
+
* enforce and the console reads to show what a member may do. Each capability
|
|
14449
|
+
* names the roles that hold it; `admin` true when a company admin holds it with
|
|
14450
|
+
* no role on the desk (an admin who holds a role holds the union); and
|
|
14451
|
+
* `requires_admin` true when holding it takes a company admin as well as one
|
|
14452
|
+
* of its roles. A role is a desk's only while its holder holds Help Desk
|
|
14453
|
+
* product access and is an active member; a Full License is separate and
|
|
14454
|
+
* still licenses every content write (working tickets, approving a reply,
|
|
14455
|
+
* editing the knowledge base).
|
|
14456
|
+
*
|
|
14457
|
+
* see_desk list the desk, read its settings and queues
|
|
14458
|
+
* view_tickets read every ticket of the desk, every queue and untriaged included
|
|
14459
|
+
* work_tickets notes, status, priority, tags, assignment changes, attachments, merges
|
|
14460
|
+
* reply send a customer reply directly (a Trainee's reply becomes a review instead)
|
|
14461
|
+
* submit_reply_for_approval a customer reply is held for a Manager's approval
|
|
14462
|
+
* open_request open a request for a customer with a first message
|
|
14463
|
+
* approve_replies approve or return a held reply (never one's own)
|
|
14464
|
+
* discard_replies end a held reply without sending it
|
|
14465
|
+
* delete_attachments delete a customer's or an operator's file from a ticket
|
|
14466
|
+
* hold_tickets be assigned, mentioned, alerted and balanced-assigned
|
|
14467
|
+
* configure_desk edit the desk's settings, queues, routing, alerts and knowledge base
|
|
14468
|
+
* configure_chat the desk's chat intake and new-ticket chat notifications
|
|
14469
|
+
* assign_roles choose who holds which role on the desk
|
|
14470
|
+
* view_analytics the desk's analytics, its CSV and the operator breakdown
|
|
14471
|
+
* manage_requesters block or unblock a requester
|
|
14472
|
+
* requester_duties export or erase a requester's data
|
|
14473
|
+
* legal_holds place, clear and list legal holds
|
|
14474
|
+
* keep_desk_saved_replies create, change and delete the desk's shared saved replies
|
|
14475
|
+
* keep_queue_saved_replies create a queue's saved replies, and change or delete one's own
|
|
14476
|
+
* keep_others_saved_replies change or delete a saved reply another member wrote
|
|
14477
|
+
* manage_desks create, archive and restore desks; desk capacity
|
|
14478
|
+
* grant_product_access give or remove a member's Help Desk product access
|
|
14479
|
+
*
|
|
14480
|
+
* A Trainee keeps no saved replies: they use every one, and their reply is
|
|
14481
|
+
* reviewed before it reaches a customer, so no text of theirs reaches one
|
|
14482
|
+
* through another operator's reply unreviewed.
|
|
14483
|
+
*/
|
|
14484
|
+
const EVERY_ROLE = HELP_DESK_ROLES;
|
|
14485
|
+
const capability = (roles, { admin = false, requiresAdmin = false } = {}) =>
|
|
14486
|
+
Object.freeze({ roles: Object.freeze([...roles]), admin, requires_admin: requiresAdmin });
|
|
14487
|
+
Object.freeze({
|
|
14488
|
+
see_desk: capability(EVERY_ROLE, { admin: true }),
|
|
14489
|
+
view_tickets: capability(EVERY_ROLE),
|
|
14490
|
+
work_tickets: capability(EVERY_ROLE),
|
|
14491
|
+
reply: capability(['manager', 'agent']),
|
|
14492
|
+
submit_reply_for_approval: capability(['trainee']),
|
|
14493
|
+
open_request: capability(['manager', 'agent']),
|
|
14494
|
+
approve_replies: capability(['manager']),
|
|
14495
|
+
discard_replies: capability(['manager']),
|
|
14496
|
+
delete_attachments: capability(['manager']),
|
|
14497
|
+
hold_tickets: capability(EVERY_ROLE),
|
|
14498
|
+
configure_desk: capability(['manager'], { admin: true }),
|
|
14499
|
+
configure_chat: capability([], { admin: true }),
|
|
14500
|
+
assign_roles: capability(['manager'], { admin: true }),
|
|
14501
|
+
view_analytics: capability(['manager']),
|
|
14502
|
+
manage_requesters: capability(['manager']),
|
|
14503
|
+
requester_duties: capability(['manager'], { requiresAdmin: true }),
|
|
14504
|
+
legal_holds: capability(EVERY_ROLE, { requiresAdmin: true }),
|
|
14505
|
+
keep_desk_saved_replies: capability(['manager']),
|
|
14506
|
+
keep_queue_saved_replies: capability(['manager', 'agent']),
|
|
14507
|
+
keep_others_saved_replies: capability(['manager']),
|
|
14508
|
+
manage_desks: capability([], { admin: true }),
|
|
14509
|
+
grant_product_access: capability([], { admin: true })
|
|
14510
|
+
});
|
|
14511
|
+
|
|
14423
14512
|
/** The longest subject, in characters. */
|
|
14424
14513
|
const MAX_SUBJECT_LEN = 200;
|
|
14425
14514
|
|
|
@@ -29454,7 +29543,7 @@ class SparkVault {
|
|
|
29454
29543
|
}
|
|
29455
29544
|
/** Get the SDK version */
|
|
29456
29545
|
static get version() {
|
|
29457
|
-
return '16.
|
|
29546
|
+
return '16.2.1';
|
|
29458
29547
|
}
|
|
29459
29548
|
}
|
|
29460
29549
|
if (typeof window !== 'undefined') {
|