@sparkvault/sdk-js 18.0.5 → 18.0.6
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 +20 -6
- package/dist/index.cjs +136 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.mjs +136 -26
- package/dist/index.mjs.map +1 -1
- package/dist/products/help-desk/index.d.ts +2 -1
- package/dist/products/help-desk/kb-client.d.ts +2 -0
- package/dist/products/help-desk/types.d.ts +9 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -469,13 +469,14 @@ uncertain submission must be selected again after reload. If storage is
|
|
|
469
469
|
unavailable, the live wizard continues in memory.
|
|
470
470
|
|
|
471
471
|
The wizard searches the same published index as the desk's knowledge base,
|
|
472
|
-
locally; the visitor's question is not uploaded for search. Articles open inside
|
|
473
|
-
the widget, with a link to the canonical page.
|
|
474
|
-
|
|
472
|
+
locally; the visitor's question is not uploaded for search. Articles and FAQ answers open inside
|
|
473
|
+
the widget, with a link to the canonical page. Displayed answers record a view, and
|
|
474
|
+
Yes / No feedback uses the help center's browser visitor. Article and FAQ reports
|
|
475
|
+
remain separate. Explicit helpful feedback or
|
|
476
|
+
contact intent also records content-free assistance analytics; closing records no
|
|
475
477
|
invented outcome. Search outages and protected articles are separate states,
|
|
476
|
-
with contact still available subject to its own access policy.
|
|
477
|
-
|
|
478
|
-
help-center link remains available. Help Desk > Settings > General can set a
|
|
478
|
+
with contact still available subject to its own access policy. Publishing generates
|
|
479
|
+
in-widget reader documents and the canonical help-center pages together. Help Desk > Settings > General can set a
|
|
479
480
|
short note shown beside the "Still need help? Open a support ticket" button under the
|
|
480
481
|
suggestions, such as who answers and how soon. The optional public desk field
|
|
481
482
|
is `ticket_contact_note` (one line, up to 160 characters); null or omission
|
|
@@ -573,6 +574,19 @@ const form = await sv.products.helpDesk.mountForm({
|
|
|
573
574
|
|
|
574
575
|
Call `form.destroy()` when your component unmounts or your website customer changes.
|
|
575
576
|
|
|
577
|
+
When a desk uses OAuth sign-in (`auth_mode: 'oauth2'`), a signed-out form offers
|
|
578
|
+
a link to the hosted help desk before asking the customer to write a request.
|
|
579
|
+
The link opens in a new tab, keeping the original page in place.
|
|
580
|
+
The portal sends the customer to the configured identity provider and receives
|
|
581
|
+
the standard OAuth callback. The embedding website supplies no assertion or
|
|
582
|
+
provider token. Any draft already on the embedding page stays there, available
|
|
583
|
+
to copy; it is not transferred in a URL. An existing desk customer session can
|
|
584
|
+
still use the form normally. When `oauth_identity.guest_email` is true, the
|
|
585
|
+
portal also offers the independent email sign-in window for requests made
|
|
586
|
+
under an email identity. The customer chooses it explicitly; an OAuth failure
|
|
587
|
+
never starts it automatically, and matching email addresses do not link the
|
|
588
|
+
two identities' request history.
|
|
589
|
+
|
|
576
590
|
The form handles a summary and details, screenshots and files, the desk's email-code flow (pasted
|
|
577
591
|
codes, sending a new code, using a different email), a missing display name,
|
|
578
592
|
submitting once, and retrying the same draft after an uncertain response.
|
package/dist/index.cjs
CHANGED
|
@@ -18554,7 +18554,7 @@ class HelpDeskClient {
|
|
|
18554
18554
|
this.rememberToken(null, 'refresh', true);
|
|
18555
18555
|
}
|
|
18556
18556
|
/** Whether company identity can be established without customer interaction. */
|
|
18557
|
-
get hasIdentityProvider() { return typeof this.assertionProvider === 'function'; }
|
|
18557
|
+
get hasIdentityProvider() { return this.desk.auth_mode !== 'oauth2' && typeof this.assertionProvider === 'function'; }
|
|
18558
18558
|
/** The independent ticket gate must be met before rendering authenticated ticket UI. */
|
|
18559
18559
|
get hasTicketAccess() {
|
|
18560
18560
|
const policy = this.currentTicketPolicy;
|
|
@@ -22090,7 +22090,10 @@ function companySignInUrl(value) {
|
|
|
22090
22090
|
function mountHelpDeskForm(client, options) {
|
|
22091
22091
|
const target = resolveTarget(options.target);
|
|
22092
22092
|
injectHelpDeskFormStyles();
|
|
22093
|
-
|
|
22093
|
+
// OAuth sign-in belongs to the hosted desk. A native Identity ceremony or
|
|
22094
|
+
// company assertion on this host cannot stand in for that configured login.
|
|
22095
|
+
const oauth = client.desk.auth_mode === 'oauth2';
|
|
22096
|
+
const widget = oauth ? undefined : options.widgetIdentity;
|
|
22094
22097
|
const shell = new InlineShell(target, {
|
|
22095
22098
|
containerClassName: 'svhd-container',
|
|
22096
22099
|
bodyClassName: 'svhd-body',
|
|
@@ -22393,6 +22396,7 @@ function mountHelpDeskForm(client, options) {
|
|
|
22393
22396
|
let websiteSignedOut = false;
|
|
22394
22397
|
// The form is held while the secure window chooses another account: no send is under way.
|
|
22395
22398
|
let switchingAccount = false;
|
|
22399
|
+
let portalRequired = oauth;
|
|
22396
22400
|
/**
|
|
22397
22401
|
* Save the request as the form holds it. Never while a sign-in is under
|
|
22398
22402
|
* way: a session notification then blanks the fields until the sign-in's
|
|
@@ -22525,7 +22529,7 @@ function mountHelpDeskForm(client, options) {
|
|
|
22525
22529
|
*/
|
|
22526
22530
|
function renderActions() {
|
|
22527
22531
|
send.textContent = idleLabel();
|
|
22528
|
-
send.hidden = recovery === 'external_sso' && widget !== undefined && !widget.useWebsiteAccount;
|
|
22532
|
+
send.hidden = portalRequired || (recovery === 'external_sso' && widget !== undefined && !widget.useWebsiteAccount);
|
|
22529
22533
|
startNew.hidden = recovery === null;
|
|
22530
22534
|
widgetAccount.hidden = recovery !== null || widgetAccount.childElementCount === 0;
|
|
22531
22535
|
recap.hidden = recovery !== null;
|
|
@@ -22558,7 +22562,7 @@ function mountHelpDeskForm(client, options) {
|
|
|
22558
22562
|
function setStep(next) {
|
|
22559
22563
|
const changed = next !== step;
|
|
22560
22564
|
step = next;
|
|
22561
|
-
details.hidden = next !== 'details';
|
|
22565
|
+
details.hidden = next !== 'details' || (portalRequired && !subject.input.value && !description.input.value);
|
|
22562
22566
|
if (identity)
|
|
22563
22567
|
identity.hidden = next !== 'identity';
|
|
22564
22568
|
if (next === 'identity') {
|
|
@@ -22638,13 +22642,13 @@ function mountHelpDeskForm(client, options) {
|
|
|
22638
22642
|
function disable(disabled) {
|
|
22639
22643
|
for (const input of [subject.input, description.input, email.input, code.input, name.input, send, cancel, changeEmail, editRequest, startNew])
|
|
22640
22644
|
input.disabled = disabled;
|
|
22641
|
-
const held = uncertainSubmission !== null || recovery !== null;
|
|
22645
|
+
const held = uncertainSubmission !== null || recovery !== null || portalRequired;
|
|
22642
22646
|
subject.input.readOnly = held;
|
|
22643
22647
|
description.input.readOnly = held;
|
|
22644
22648
|
for (const button of widgetAccount.querySelectorAll('button'))
|
|
22645
22649
|
button.disabled = disabled || uncertainSubmission !== null || completed;
|
|
22646
22650
|
renderResend();
|
|
22647
|
-
composer.disablePicking(disabled || recovery !== null);
|
|
22651
|
+
composer.disablePicking(disabled || recovery !== null || portalRequired);
|
|
22648
22652
|
composer.lock(completed || uncertainSubmission !== null);
|
|
22649
22653
|
}
|
|
22650
22654
|
function clearCode() {
|
|
@@ -22884,7 +22888,7 @@ function mountHelpDeskForm(client, options) {
|
|
|
22884
22888
|
pending = false;
|
|
22885
22889
|
switchingAccount = false;
|
|
22886
22890
|
sessionKnown = false;
|
|
22887
|
-
if (
|
|
22891
|
+
if (widget)
|
|
22888
22892
|
widgetCustomer = null;
|
|
22889
22893
|
clearComposer();
|
|
22890
22894
|
recovery = hidden;
|
|
@@ -22897,6 +22901,8 @@ function mountHelpDeskForm(client, options) {
|
|
|
22897
22901
|
message('Your sign-in changed. Start a new request for the current account.');
|
|
22898
22902
|
else
|
|
22899
22903
|
renderActions();
|
|
22904
|
+
if (oauth)
|
|
22905
|
+
showHosted();
|
|
22900
22906
|
// The request and its actions changed under the pointer: a press already
|
|
22901
22907
|
// under way must not act on what replaced them.
|
|
22902
22908
|
options.onScreenChange?.();
|
|
@@ -22950,6 +22956,26 @@ function mountHelpDeskForm(client, options) {
|
|
|
22950
22956
|
focusAfter = challenge ? code.input : email.input;
|
|
22951
22957
|
}
|
|
22952
22958
|
function showHosted() {
|
|
22959
|
+
if (oauth) {
|
|
22960
|
+
portalRequired = true;
|
|
22961
|
+
persistDraft();
|
|
22962
|
+
// Leave existing text available to copy, without putting a draft or
|
|
22963
|
+
// credentials in the destination URL or claiming it was transferred.
|
|
22964
|
+
const hasDraft = Boolean(subject.input.value || description.input.value);
|
|
22965
|
+
details.hidden = !hasDraft;
|
|
22966
|
+
auth.hidden = true;
|
|
22967
|
+
hosted.hidden = newRequestUrl === null;
|
|
22968
|
+
if (newRequestUrl)
|
|
22969
|
+
hosted.href = newRequestUrl;
|
|
22970
|
+
hosted.textContent = 'Open help desk in a new tab';
|
|
22971
|
+
send.hidden = true;
|
|
22972
|
+
disable(pending);
|
|
22973
|
+
message(hasDraft
|
|
22974
|
+
? 'Continue in the help desk to sign in and send your request. Your draft stays on this page; copy it into the help desk to continue.'
|
|
22975
|
+
: 'Open the help desk to sign in and write your request.');
|
|
22976
|
+
focusAfter = hosted.hidden ? null : hosted;
|
|
22977
|
+
return;
|
|
22978
|
+
}
|
|
22953
22979
|
if (client.desk.auth_mode === 'external_sso' || client.desk.auth_mode === 'external_unavailable') {
|
|
22954
22980
|
const url = companySignInUrl(client.desk.external_identity?.sign_in_url);
|
|
22955
22981
|
hosted.hidden = url === null;
|
|
@@ -22967,6 +22993,11 @@ function mountHelpDeskForm(client, options) {
|
|
|
22967
22993
|
async function submit() {
|
|
22968
22994
|
if (pending || completed || destroyed)
|
|
22969
22995
|
return;
|
|
22996
|
+
if (portalRequired) {
|
|
22997
|
+
showHosted();
|
|
22998
|
+
focusSettled();
|
|
22999
|
+
return;
|
|
23000
|
+
}
|
|
22970
23001
|
// Sending (Enter in a field, a code's last digit) answers the discard
|
|
22971
23002
|
// question: the customer kept going.
|
|
22972
23003
|
closeConfirm(false);
|
|
@@ -23038,7 +23069,7 @@ function mountHelpDeskForm(client, options) {
|
|
|
23038
23069
|
let token = await tokenFor(ownGeneration);
|
|
23039
23070
|
if (!alive(ownGeneration))
|
|
23040
23071
|
return;
|
|
23041
|
-
if (widgetSignIn || (!token && options.onAuthRequired && client.desk.auth_mode !== 'external_sso' && client.desk.auth_mode !== 'external_unavailable')) {
|
|
23072
|
+
if (widgetSignIn || (!token && options.onAuthRequired && !oauth && client.desk.auth_mode !== 'external_sso' && client.desk.auth_mode !== 'external_unavailable')) {
|
|
23042
23073
|
authenticating = true;
|
|
23043
23074
|
authNotification = false;
|
|
23044
23075
|
const session = await (widgetSignIn ?? options.onAuthRequired());
|
|
@@ -23463,6 +23494,8 @@ function mountHelpDeskForm(client, options) {
|
|
|
23463
23494
|
description.input.value = composition.body;
|
|
23464
23495
|
persistDraft();
|
|
23465
23496
|
syncLeaveGuard();
|
|
23497
|
+
if (portalRequired && !pending)
|
|
23498
|
+
showHosted();
|
|
23466
23499
|
},
|
|
23467
23500
|
refill(issue) {
|
|
23468
23501
|
if (destroyed || restoredDraft || recovery !== null || safeComposition() === null)
|
|
@@ -23481,11 +23514,17 @@ function mountHelpDeskForm(client, options) {
|
|
|
23481
23514
|
recapText.textContent = subject.input.value.trim();
|
|
23482
23515
|
persistDraft();
|
|
23483
23516
|
syncLeaveGuard();
|
|
23517
|
+
if (portalRequired && !pending)
|
|
23518
|
+
showHosted();
|
|
23484
23519
|
return true;
|
|
23485
23520
|
},
|
|
23486
23521
|
resumeAfterAccess() {
|
|
23487
|
-
if (!destroyed && !pending && !completed && uncertainSubmission === null)
|
|
23488
|
-
|
|
23522
|
+
if (!destroyed && !pending && !completed && uncertainSubmission === null) {
|
|
23523
|
+
if (portalRequired)
|
|
23524
|
+
showHosted();
|
|
23525
|
+
else
|
|
23526
|
+
message('');
|
|
23527
|
+
}
|
|
23489
23528
|
},
|
|
23490
23529
|
returnToRequest() {
|
|
23491
23530
|
if (destroyed || step !== 'identity')
|
|
@@ -23498,6 +23537,10 @@ function mountHelpDeskForm(client, options) {
|
|
|
23498
23537
|
focusEntry(focusOptions) {
|
|
23499
23538
|
if (destroyed || form.hidden)
|
|
23500
23539
|
return false;
|
|
23540
|
+
if (portalRequired && !hosted.hidden) {
|
|
23541
|
+
hosted.focus(focusOptions);
|
|
23542
|
+
return true;
|
|
23543
|
+
}
|
|
23501
23544
|
if (step === 'identity' && signInStep) {
|
|
23502
23545
|
(send.disabled ? signInStep.heading : send).focus(focusOptions);
|
|
23503
23546
|
return true;
|
|
@@ -23549,8 +23592,8 @@ function mountHelpDeskForm(client, options) {
|
|
|
23549
23592
|
});
|
|
23550
23593
|
send.textContent = idleLabel();
|
|
23551
23594
|
renderWidgetIdentity();
|
|
23552
|
-
if (
|
|
23553
|
-
restoreDraft(
|
|
23595
|
+
if (widget?.customer) {
|
|
23596
|
+
restoreDraft(widget.customer);
|
|
23554
23597
|
disable(false);
|
|
23555
23598
|
}
|
|
23556
23599
|
else if (widget?.recovering) {
|
|
@@ -23580,9 +23623,42 @@ function mountHelpDeskForm(client, options) {
|
|
|
23580
23623
|
live.announce('Step 1 of 2');
|
|
23581
23624
|
syncLeaveGuard();
|
|
23582
23625
|
notify$1(options.onStateChange, state);
|
|
23626
|
+
if (oauth) {
|
|
23627
|
+
// Read an already-established desk session before exposing the composer.
|
|
23628
|
+
// The hosted OAuth flow establishes new sessions; this module never does.
|
|
23629
|
+
const ownGeneration = generation;
|
|
23630
|
+
pending = true;
|
|
23631
|
+
details.hidden = true;
|
|
23632
|
+
send.hidden = true;
|
|
23633
|
+
disable(true);
|
|
23634
|
+
message('Loading support');
|
|
23635
|
+
void tokenFor(ownGeneration).then((token) => {
|
|
23636
|
+
if (!alive(ownGeneration))
|
|
23637
|
+
return;
|
|
23638
|
+
if (!token) {
|
|
23639
|
+
showHosted();
|
|
23640
|
+
return;
|
|
23641
|
+
}
|
|
23642
|
+
portalRequired = false;
|
|
23643
|
+
details.hidden = false;
|
|
23644
|
+
hosted.hidden = true;
|
|
23645
|
+
message('');
|
|
23646
|
+
renderActions();
|
|
23647
|
+
}, (failure) => {
|
|
23648
|
+
if (!alive(ownGeneration))
|
|
23649
|
+
return;
|
|
23650
|
+
showHosted();
|
|
23651
|
+
notify$1(options.onError, failure instanceof Error ? failure : new Error('Support could not be loaded.'));
|
|
23652
|
+
}).finally(() => {
|
|
23653
|
+
if (alive(ownGeneration)) {
|
|
23654
|
+
pending = false;
|
|
23655
|
+
disable(false);
|
|
23656
|
+
}
|
|
23657
|
+
});
|
|
23658
|
+
}
|
|
23583
23659
|
// Native company identity starts as the form opens, never from a Connect,
|
|
23584
23660
|
// Allow, verification or submit gesture. Guest email is explicit desk policy.
|
|
23585
|
-
if (!
|
|
23661
|
+
if (!widget && ((client.desk.auth_mode === 'external_sso' && client.hasIdentityProvider) || client.desk.auth_mode === 'external_unavailable')) {
|
|
23586
23662
|
const ownGeneration = generation;
|
|
23587
23663
|
nativeProofGeneration = ownGeneration;
|
|
23588
23664
|
pending = true;
|
|
@@ -25222,6 +25298,7 @@ const currentVisitor = (value) => value !== null && typeof value === 'object' &&
|
|
|
25222
25298
|
'visitor_id' in value && validVisitorId(value.visitor_id) &&
|
|
25223
25299
|
'expires_at' in value && typeof value.expires_at === 'number' && Number.isSafeInteger(value.expires_at) &&
|
|
25224
25300
|
value.expires_at * 1000 > Date.now() + 60000 && value.expires_at * 1000 <= Date.now() + 31 * 86400000;
|
|
25301
|
+
let viewSequence = 0;
|
|
25225
25302
|
const invalid = () => new SparkVaultError('The help center returned an invalid answer. Try again.', 'KB_INVALID_RESPONSE');
|
|
25226
25303
|
const changed = () => new SparkVaultError('The help center changed. Search again to see current answers.', 'KB_PUBLICATION_CHANGED', 409);
|
|
25227
25304
|
const validPath = (value) => typeof value === 'string' && value.startsWith('/') && !value.startsWith('//') &&
|
|
@@ -25427,10 +25504,12 @@ class HelpDeskKnowledgeBaseClient {
|
|
|
25427
25504
|
if (settings.enabled && validVisitorCookieName(settings.cookie_name)) {
|
|
25428
25505
|
if (cookieEndpoint) {
|
|
25429
25506
|
const endpoint = ownOrigin ? '/_sv/visitor' : new URL('/_sv/visitor', config.canonical_origin).href;
|
|
25430
|
-
const
|
|
25431
|
-
|
|
25432
|
-
|
|
25433
|
-
|
|
25507
|
+
const answer = await exchange(endpoint, { credentials: ownOrigin ? 'same-origin' : 'include', cache: 'no-store', redirect: 'error' }, {
|
|
25508
|
+
timeoutMs: this.sdkConfig.timeout, closeSignal: this.close.signal,
|
|
25509
|
+
read: async (response) => { if (!response.ok)
|
|
25510
|
+
throw invalid(); return await response.json(); },
|
|
25511
|
+
fail: failure => failure === 'timeout' ? new TimeoutError() : new NetworkError('Visitor identification could not be reached. Try again.')
|
|
25512
|
+
});
|
|
25434
25513
|
candidate = answer.visitor_id;
|
|
25435
25514
|
}
|
|
25436
25515
|
else {
|
|
@@ -25463,8 +25542,8 @@ class HelpDeskKnowledgeBaseClient {
|
|
|
25463
25542
|
}
|
|
25464
25543
|
/** Use the help center's browser visitor and vote receipt; ticket identity is never sent. */
|
|
25465
25544
|
async vote(article, vote) {
|
|
25466
|
-
if (article
|
|
25467
|
-
throw new ValidationError('Choose yes or no for a published
|
|
25545
|
+
if (!['article', 'faq'].includes(article?.kind) || typeof article.id !== 'string' || !article.id || article.id.length > 256 || !['yes', 'no'].includes(vote)) {
|
|
25546
|
+
throw new ValidationError('Choose yes or no for a published answer.');
|
|
25468
25547
|
}
|
|
25469
25548
|
const reference = { id: article.id, release_id: article.release_id };
|
|
25470
25549
|
const previous = this.voteQueues.get(reference.id) ?? Promise.resolve();
|
|
@@ -25525,6 +25604,29 @@ class HelpDeskKnowledgeBaseClient {
|
|
|
25525
25604
|
this.readerDocument = { ...value, body_html };
|
|
25526
25605
|
return this.readerDocument;
|
|
25527
25606
|
}
|
|
25607
|
+
/** Record only a displayed reader document; access is checked again by the event endpoint. */
|
|
25608
|
+
async view(document) {
|
|
25609
|
+
const config = this.config;
|
|
25610
|
+
if (!config?.authorized || !config.available || this.readerDocument !== document || config.release_id !== document.release_id)
|
|
25611
|
+
throw changed();
|
|
25612
|
+
if (!visitorCookieSettings(config.visitor_identifier).enabled)
|
|
25613
|
+
return;
|
|
25614
|
+
const eventId = `${Date.now()}-${++viewSequence}`;
|
|
25615
|
+
const visitor = await this.visitor(config);
|
|
25616
|
+
const body = { visitor_id: visitor.visitor_id, release_id: document.release_id, event_id: eventId, type: 'view', article_id: document.id };
|
|
25617
|
+
let result;
|
|
25618
|
+
try {
|
|
25619
|
+
result = await this.request('events', { body });
|
|
25620
|
+
}
|
|
25621
|
+
catch (error) {
|
|
25622
|
+
if (!(error instanceof NetworkError || error instanceof TimeoutError || error instanceof SparkVaultError && (error.statusCode ?? 0) >= 500))
|
|
25623
|
+
throw error;
|
|
25624
|
+
// A lost acknowledgement retries the same receipt so an open is counted once.
|
|
25625
|
+
result = await this.request('events', { body });
|
|
25626
|
+
}
|
|
25627
|
+
if (typeof result?.recorded !== 'boolean')
|
|
25628
|
+
throw invalid();
|
|
25629
|
+
}
|
|
25528
25630
|
/** Paint article text first; hydrate only approved media without replacing the reader DOM. */
|
|
25529
25631
|
hydrateAssets(document, callbacks) {
|
|
25530
25632
|
if (this.destroyed || this.readerDocument?.id !== document.id || this.readerDocument.release_id !== document.release_id)
|
|
@@ -26569,7 +26671,7 @@ class SupportView {
|
|
|
26569
26671
|
this.sourceArticle.textContent = next.sourceArticle ? `Article you read: ${next.sourceArticle.title}` : '';
|
|
26570
26672
|
this.sourceArticle.hidden = !next.sourceArticle;
|
|
26571
26673
|
this.contactTitle.parentElement.hidden = this.contactTitle.hidden && this.contactStatus.hidden && this.contactError.hidden && this.sourceArticle.hidden;
|
|
26572
|
-
this.feedbackStatus.textContent = next.feedbackBusy ? 'Saving your feedback...' : next.feedbackError ? '' :
|
|
26674
|
+
this.feedbackStatus.textContent = next.feedbackBusy ? 'Saving your feedback...' : next.feedbackError ? '' : 'Your feedback has been saved.';
|
|
26573
26675
|
this.feedbackError.textContent = next.feedbackError || '';
|
|
26574
26676
|
this.feedbackError.hidden = !next.feedbackError;
|
|
26575
26677
|
this.retryFeedback.hidden = !next.feedbackError || !this.actions.onRetryFeedback;
|
|
@@ -27219,6 +27321,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
27219
27321
|
let attempt = null;
|
|
27220
27322
|
let results = [];
|
|
27221
27323
|
let requestedArticle = null;
|
|
27324
|
+
let displayedArticle = null;
|
|
27222
27325
|
let articleRetrySearch = false;
|
|
27223
27326
|
let cancelArticleAssets = null;
|
|
27224
27327
|
let stopSession = null;
|
|
@@ -27319,6 +27422,12 @@ function createHelpDeskSupport(config, options) {
|
|
|
27319
27422
|
const rebranded = change.brand !== undefined && change.brand !== state.brand;
|
|
27320
27423
|
state = { ...state, ...change };
|
|
27321
27424
|
view.render(state);
|
|
27425
|
+
if (kb && state.visible && state.stage === 'article' && state.article && state.article !== displayedArticle) {
|
|
27426
|
+
displayedArticle = state.article;
|
|
27427
|
+
// A read can finish while minimized. Count the answer only after it is displayed.
|
|
27428
|
+
void kb.view(state.article).catch(value => { if (!destroyed)
|
|
27429
|
+
notify(options.onError, failure(value)); });
|
|
27430
|
+
}
|
|
27322
27431
|
launcher?.setExpanded(state.visible);
|
|
27323
27432
|
if (rebranded)
|
|
27324
27433
|
launcher?.setBrand(state.brand);
|
|
@@ -27421,8 +27530,8 @@ function createHelpDeskSupport(config, options) {
|
|
|
27421
27530
|
return;
|
|
27422
27531
|
const ownFeedback = ++feedbackSequence;
|
|
27423
27532
|
void attempt?.then((active) => active?.solved());
|
|
27424
|
-
update({ stage: 'resolved', feedbackBusy:
|
|
27425
|
-
if (
|
|
27533
|
+
update({ stage: 'resolved', feedbackBusy: Boolean(kb), feedbackError: undefined, reviewUrl: undefined, error: undefined });
|
|
27534
|
+
if (!kb)
|
|
27426
27535
|
return;
|
|
27427
27536
|
try {
|
|
27428
27537
|
const saved = await kb.vote(article, 'yes');
|
|
@@ -27853,8 +27962,8 @@ function createHelpDeskSupport(config, options) {
|
|
|
27853
27962
|
sourceArticleId = article.id;
|
|
27854
27963
|
update({ sourceArticle: { title: article.title, url: article.canonical_url } });
|
|
27855
27964
|
// The article vote and assistance outcome serve different reports. Neither may block contacting the team.
|
|
27856
|
-
if (
|
|
27857
|
-
void kb.vote(article, 'no').catch(() =>
|
|
27965
|
+
if (kb)
|
|
27966
|
+
void kb.vote(article, 'no').catch((value) => notify(options.onError, failure(value)));
|
|
27858
27967
|
}
|
|
27859
27968
|
followIssue();
|
|
27860
27969
|
cancelArticleAssets?.();
|
|
@@ -28206,7 +28315,8 @@ class HelpDeskModule {
|
|
|
28206
28315
|
/**
|
|
28207
28316
|
* Inject a ticket form, including email-code verification where the desk
|
|
28208
28317
|
* enables it. A custom onAuthRequired callback may supply a server-issued
|
|
28209
|
-
* help desk session.
|
|
28318
|
+
* help desk session. OAuth desks open their hosted portal for sign-in unless
|
|
28319
|
+
* a desk session is already installed. Destroy on unmount/account change.
|
|
28210
28320
|
*/
|
|
28211
28321
|
mountForm(options) {
|
|
28212
28322
|
return this.connectForm(options, (client) => mountHelpDeskForm(client, options));
|
|
@@ -32956,7 +33066,7 @@ class SparkVault {
|
|
|
32956
33066
|
}
|
|
32957
33067
|
/** Get the SDK version */
|
|
32958
33068
|
static get version() {
|
|
32959
|
-
return '18.0.
|
|
33069
|
+
return '18.0.6';
|
|
32960
33070
|
}
|
|
32961
33071
|
}
|
|
32962
33072
|
if (typeof window !== 'undefined') {
|