@sparkvault/sdk-js 16.2.0 → 16.3.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 CHANGED
@@ -394,7 +394,11 @@ contact intent records content-free assistance analytics; closing records no
394
394
  invented outcome. Search outages and protected articles are separate states,
395
395
  with contact still available subject to its own access policy. Republish older
396
396
  KB releases once to generate their in-widget reader documents; the canonical
397
- help-center link remains available.
397
+ help-center link remains available. Help Desk > Settings > General can set a
398
+ short note shown beside the "Still need help? Open a ticket" button under the
399
+ suggestions, such as who answers and how soon. The optional public desk field
400
+ is `ticket_contact_note` (one line, up to 160 characters); null or omission
401
+ shows no note. It is rendered as text, never HTML.
398
402
 
399
403
  Contact reuses the ticket form's draft, attachment and uncertain-send handling.
400
404
  The subject and message are editable. A verified website session appears without
package/dist/index.cjs CHANGED
@@ -11612,7 +11612,7 @@ class PendingSignIn {
11612
11612
  constructor(hint) {
11613
11613
  this.hint = hint;
11614
11614
  this.at = 0;
11615
- this.live = true;
11615
+ this.ended = false;
11616
11616
  // Counts the opens and the ends of their popups, so a draw that lands after
11617
11617
  // its popup ended or was replaced is recognised and dropped.
11618
11618
  this.opens = 0;
@@ -11628,6 +11628,10 @@ class PendingSignIn {
11628
11628
  get reference() {
11629
11629
  return this.current;
11630
11630
  }
11631
+ /** False once the sign-in ended: it settled, was closed, or another replaced it. */
11632
+ get live() {
11633
+ return !this.ended;
11634
+ }
11631
11635
  /**
11632
11636
  * A popup opened, or the current one asked again for the reference it
11633
11637
  * lacks: arm the marker holding no reference, and draw this open's own.
@@ -11637,7 +11641,7 @@ class PendingSignIn {
11637
11641
  * rejects.
11638
11642
  */
11639
11643
  open(draw) {
11640
- if (!this.live)
11644
+ if (this.ended)
11641
11645
  return Promise.resolve(false);
11642
11646
  const open = ++this.opens;
11643
11647
  this.at = Date.now();
@@ -11646,7 +11650,7 @@ class PendingSignIn {
11646
11650
  if (!this.write(null))
11647
11651
  removePendingMarker();
11648
11652
  const decided = signinReferenceInTime(draw()).then((reference) => {
11649
- if (!this.live || open !== this.opens)
11653
+ if (this.ended || open !== this.opens)
11650
11654
  return false;
11651
11655
  this.current = reference !== null && this.write(reference) ? reference : null;
11652
11656
  return true;
@@ -11661,7 +11665,7 @@ class PendingSignIn {
11661
11665
  * should it land, is dropped.
11662
11666
  */
11663
11667
  retire() {
11664
- if (!this.live)
11668
+ if (this.ended)
11665
11669
  return;
11666
11670
  this.opens += 1;
11667
11671
  this.current = null;
@@ -11670,7 +11674,7 @@ class PendingSignIn {
11670
11674
  /** The sign-in settled, or another replaced it: retire the marker, and nothing this sign-in does later touches it. */
11671
11675
  end() {
11672
11676
  this.retire();
11673
- this.live = false;
11677
+ this.ended = true;
11674
11678
  }
11675
11679
  /**
11676
11680
  * The current popup's reference, waiting at most `waitMs` for an open still
@@ -12065,7 +12069,7 @@ class IdentityModule {
12065
12069
  const signinRef = await pending.referenceWithin(SIGNIN_REFERENCE.redirectWaitMs);
12066
12070
  if (signinRef === null)
12067
12071
  pending.retire();
12068
- return this.startRedirectFlow(mergedOptions, signinRef);
12072
+ return this.startRedirectFlow(mergedOptions, { signIn: pending, signinRef });
12069
12073
  },
12070
12074
  signinReference: () => pending.reference,
12071
12075
  });
@@ -12323,31 +12327,41 @@ class IdentityModule {
12323
12327
  * 'redirect'`, or a popup whose handle COOP severed. Plain sign-in carries
12324
12328
  * redirect_uri + state + PKCE challenge and returns via the fragment code;
12325
12329
  * OIDC/simple modes navigate without them (their server-rendered pages drive
12326
- * the server-validated redirect back). Either carries `signinRef`, the
12327
- * severed popup's reference; a redirect draws none of its own.
12330
+ * the server-validated redirect back). Either carries the severed popup's
12331
+ * reference; a redirect draws none of its own.
12332
+ *
12333
+ * The return leg is armed first: the check that the sign-in still runs and
12334
+ * the pending marker's removal then share one turn with the navigation, so
12335
+ * no sign-in can start or end between them.
12328
12336
  *
12329
- * @param signinRef - The reference the pending marker holds for this
12330
- * sign-in, or null for a page sent without one
12337
+ * @param severed - The popup sign-in whose severed popup this continues,
12338
+ * with the reference its marker holds for that popup (null for none), or
12339
+ * null for an explicit redirect, which carries none
12331
12340
  * @returns false when the return leg cannot be armed (no session storage or
12332
- * WebCrypto) — the caller surfaces an actionable error instead of a
12333
- * silent dead-end.
12341
+ * WebCrypto), so the caller surfaces an actionable error instead of a
12342
+ * silent dead-end, or when the severed popup's sign-in ended meanwhile.
12334
12343
  */
12335
- async startRedirectFlow(options, signinRef) {
12344
+ async startRedirectFlow(options, severed) {
12345
+ const signinRef = severed?.signinRef ?? null;
12346
+ const authContext = options.authContext;
12347
+ const handoff = authContext?.authRequestId || authContext?.simpleMode?.sessionId
12348
+ ? undefined
12349
+ : await this.armHandoffReturn();
12350
+ if (handoff === null) {
12351
+ return false;
12352
+ }
12353
+ // A popup sign-in that ended meanwhile (the bridge's ✕, close(), or a
12354
+ // signIn() that replaced it) leaves this tab where it is, and leaves
12355
+ // alone the marker of any sign-in that now runs here.
12356
+ if (severed && !severed.signIn.live) {
12357
+ return false;
12358
+ }
12336
12359
  if (signinRef === null) {
12337
12360
  // With no marker, no recovery can stand in for this page's result, so
12338
12361
  // the page needs no reference. A marker left from an earlier sign-in
12339
12362
  // would otherwise bounce on the next load in place of this one.
12340
12363
  removePendingMarker();
12341
12364
  }
12342
- const authContext = options.authContext;
12343
- if (authContext?.authRequestId || authContext?.simpleMode?.sessionId) {
12344
- window.location.assign(buildSigninUrl(this.config, options, { kind: 'redirect', signinRef }));
12345
- return true;
12346
- }
12347
- const handoff = await this.armHandoffReturn();
12348
- if (!handoff) {
12349
- return false;
12350
- }
12351
12365
  window.location.assign(buildSigninUrl(this.config, options, { kind: 'redirect', signinRef, handoff }));
12352
12366
  return true;
12353
12367
  }
@@ -22661,9 +22675,9 @@ function injectHelpDeskSupportStyles() {
22661
22675
  .svhs-result:hover .svhs-result-title{color:var(--hd-accent-ink,${DS.action});text-decoration:underline}
22662
22676
  .svhs-result-excerpt{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0;color:${DS.slate600};font-size:14px;line-height:1.5;overflow-wrap:anywhere}
22663
22677
  .svhs-result-category{display:block;margin-top:6px;color:${DS.slate500};font-size:12px;line-height:1.4}
22664
- .svhs-results-bottom{background:${DS.slate50};border-top-color:${DS.slate200}}
22665
- .svhs-footer-title{margin:0 0 3px;color:${DS.slate900};font-size:14px;font-weight:600;line-height:1.5}
22666
- .svhs-footer-copy{margin:0 0 14px;color:${DS.slate600};font-size:13px;line-height:1.5}
22678
+ .svhs-results-bottom{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;background:${DS.slate50};border-top-color:${DS.slate200}}
22679
+ /* Wraps below the ticket button when less than 200px remain beside it, as under the panel's full-width button. */
22680
+ .svhs-contact-note{flex:1 1 200px;min-width:0;margin:0;color:${DS.slate500};font-size:13px;line-height:1.5;overflow-wrap:anywhere}
22667
22681
  .svhs-error{margin:12px 0 0;color:${DS.error};font-size:14px;line-height:1.5;overflow-wrap:anywhere}
22668
22682
  .svhs-status{margin:16px 0;color:${DS.slate600};font-size:14px;line-height:1.5}
22669
22683
  .svhs-empty{padding:12px 0 4px}
@@ -22806,10 +22820,6 @@ function injectHelpDeskSupportStyles() {
22806
22820
  .svhs-page .svhs-start-bottom{padding-top:0;align-items:flex-start}
22807
22821
  .svhs-page .svhs-start-bottom .svhs-primary{width:auto;min-width:160px}
22808
22822
  .svhs-page[data-stage=issue] .svhs-heading{font-size:28px}
22809
- .svhs-page .svhs-results-bottom{display:flex;align-items:center;gap:24px}
22810
- .svhs-page .svhs-results-bottom[hidden]{display:none}
22811
- .svhs-page .svhs-escalation{flex:1;min-width:0}
22812
- .svhs-page .svhs-footer-copy{margin:0}
22813
22823
  .svhs-page .svhs-results-bottom .svhs-secondary{width:auto;flex:none}
22814
22824
  .svhs-page .svhs-contact-target,.svhs-page .svhs-contact-target>.svhd-container{min-height:0}
22815
22825
  .svhs-page .svhs-contact-scroll{padding:0}
@@ -22822,8 +22832,7 @@ function injectHelpDeskSupportStyles() {
22822
22832
  .svhs-page .svhs-start-bottom{padding-top:0}
22823
22833
  .svhs-page .svhs-start-bottom .svhs-primary{width:100%}
22824
22834
  .svhs-page[data-stage=issue] .svhs-heading{font-size:26px}
22825
- .svhs-page .svhs-results-bottom{display:block}
22826
- .svhs-page .svhs-results-bottom .svhs-secondary{width:100%;margin-top:14px}
22835
+ .svhs-page .svhs-results-bottom .svhs-secondary{width:100%}
22827
22836
  .svhs-page .svhs-contact-scroll{padding:0}
22828
22837
  }
22829
22838
  `;
@@ -23213,6 +23222,7 @@ class SupportView {
23213
23222
  this.resultCopy = element('p', 'svhs-copy');
23214
23223
  this.resultStatus = element('div', 'svhs-empty');
23215
23224
  this.resultError = element('p', 'svhs-error');
23225
+ this.contactNote = element('p', 'svhs-contact-note');
23216
23226
  this.articleTitle = element('h2', 'svhs-article-title');
23217
23227
  this.articleCategory = element('p', 'svhs-category');
23218
23228
  this.articleContent = element('div', 'svhs-article-content');
@@ -23325,9 +23335,11 @@ class SupportView {
23325
23335
  return;
23326
23336
  this.actions.onContact(['locked', 'unavailable'].includes(this.state?.kbState || '') ? 'direct' : this.state?.results?.length ? 'none_match' : 'no_results');
23327
23337
  });
23338
+ this.contactNote.id = `${this.prefix}-contact-note`;
23339
+ this.contactNote.hidden = true;
23328
23340
  this.resultsFooter = this.footer('results');
23329
23341
  this.resultsFooter.classList.add('svhs-results-bottom');
23330
- this.resultsFooter.append(this.contactResults);
23342
+ this.resultsFooter.append(this.contactResults, this.contactNote);
23331
23343
  const article = this.screen('article');
23332
23344
  article.classList.add('svhs-article-scroll');
23333
23345
  this.articleTitle.tabIndex = -1;
@@ -23695,6 +23707,13 @@ class SupportView {
23695
23707
  }
23696
23708
  this.resultsFooter.hidden = Boolean(state.busy);
23697
23709
  this.contactResults.disabled = Boolean(state.busy);
23710
+ // Desk configuration, set as text: never parsed as markup.
23711
+ this.contactNote.textContent = state.contactNote || '';
23712
+ this.contactNote.hidden = !state.contactNote;
23713
+ if (state.contactNote)
23714
+ this.contactResults.setAttribute('aria-describedby', this.contactNote.id);
23715
+ else
23716
+ this.contactResults.removeAttribute('aria-describedby');
23698
23717
  }
23699
23718
  renderResultStatus(state, results) {
23700
23719
  const signature = state.kbState === 'locked' ? `locked:${state.kbAccessMode}` : state.busy ? 'busy' : state.kbState === 'unavailable' ? 'unavailable' : results.length ? 'matches' : 'empty';
@@ -24192,7 +24211,7 @@ function createHelpDeskSupport(config, options) {
24192
24211
  return (await http.request(path, { method: 'POST', body, credentials: 'omit', headers: { 'X-SV-Client': 'help-desk-portal', ...headers } })).data;
24193
24212
  },
24194
24213
  });
24195
- update({ deskName: answer.desk.organization_name || 'Support', brandColor: answer.desk.branding?.color });
24214
+ update({ deskName: answer.desk.organization_name || 'Support', brandColor: answer.desk.branding?.color, contactNote: answer.desk.ticket_contact_note ?? undefined });
24196
24215
  return answer;
24197
24216
  }).catch((error) => { connected = null; throw error; });
24198
24217
  return connected;
@@ -29533,7 +29552,7 @@ class SparkVault {
29533
29552
  }
29534
29553
  /** Get the SDK version */
29535
29554
  static get version() {
29536
- return '16.2.0';
29555
+ return '16.3.0';
29537
29556
  }
29538
29557
  }
29539
29558
  if (typeof window !== 'undefined') {