@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/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 `signinRef`, the
624
- * severed popup's reference; a redirect draws none of its own.
623
+ * the server-validated redirect back). Either carries the severed popup's
624
+ * reference; a redirect draws none of its own.
625
625
  *
626
- * @param signinRef - The reference the pending marker holds for this
627
- * sign-in, or null for a page sent without one
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) — the caller surfaces an actionable error instead of a
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
  /**
@@ -3639,6 +3644,8 @@ interface HelpDeskDesk {
3639
3644
  customer_can_mark_resolved: boolean;
3640
3645
  /** Optional plain-text note shown only after a request is confirmed sent. */
3641
3646
  ticket_confirmation_message?: string | null;
3647
+ /** Optional one-line plain-text note shown beside the support view's ticket button. */
3648
+ ticket_contact_note?: string | null;
3642
3649
  /** Independent ticket-portal gate, additional to customer authentication. */
3643
3650
  ticket_access_control?: {
3644
3651
  mode: 'public' | 'password' | 'ip_allowlist' | 'identity';
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.live = true;
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 (!this.live)
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 (!this.live || open !== this.opens)
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 (!this.live)
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.live = false;
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 `signinRef`, the
12323
- * severed popup's reference; a redirect draws none of its own.
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 signinRef - The reference the pending marker holds for this
12326
- * sign-in, or null for a page sent without one
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) — the caller surfaces an actionable error instead of a
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, signinRef) {
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
  }
@@ -22657,9 +22671,9 @@ function injectHelpDeskSupportStyles() {
22657
22671
  .svhs-result:hover .svhs-result-title{color:var(--hd-accent-ink,${DS.action});text-decoration:underline}
22658
22672
  .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}
22659
22673
  .svhs-result-category{display:block;margin-top:6px;color:${DS.slate500};font-size:12px;line-height:1.4}
22660
- .svhs-results-bottom{background:${DS.slate50};border-top-color:${DS.slate200}}
22661
- .svhs-footer-title{margin:0 0 3px;color:${DS.slate900};font-size:14px;font-weight:600;line-height:1.5}
22662
- .svhs-footer-copy{margin:0 0 14px;color:${DS.slate600};font-size:13px;line-height:1.5}
22674
+ .svhs-results-bottom{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;background:${DS.slate50};border-top-color:${DS.slate200}}
22675
+ /* Wraps below the ticket button when less than 200px remain beside it, as under the panel's full-width button. */
22676
+ .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}
22663
22677
  .svhs-error{margin:12px 0 0;color:${DS.error};font-size:14px;line-height:1.5;overflow-wrap:anywhere}
22664
22678
  .svhs-status{margin:16px 0;color:${DS.slate600};font-size:14px;line-height:1.5}
22665
22679
  .svhs-empty{padding:12px 0 4px}
@@ -22802,10 +22816,6 @@ function injectHelpDeskSupportStyles() {
22802
22816
  .svhs-page .svhs-start-bottom{padding-top:0;align-items:flex-start}
22803
22817
  .svhs-page .svhs-start-bottom .svhs-primary{width:auto;min-width:160px}
22804
22818
  .svhs-page[data-stage=issue] .svhs-heading{font-size:28px}
22805
- .svhs-page .svhs-results-bottom{display:flex;align-items:center;gap:24px}
22806
- .svhs-page .svhs-results-bottom[hidden]{display:none}
22807
- .svhs-page .svhs-escalation{flex:1;min-width:0}
22808
- .svhs-page .svhs-footer-copy{margin:0}
22809
22819
  .svhs-page .svhs-results-bottom .svhs-secondary{width:auto;flex:none}
22810
22820
  .svhs-page .svhs-contact-target,.svhs-page .svhs-contact-target>.svhd-container{min-height:0}
22811
22821
  .svhs-page .svhs-contact-scroll{padding:0}
@@ -22818,8 +22828,7 @@ function injectHelpDeskSupportStyles() {
22818
22828
  .svhs-page .svhs-start-bottom{padding-top:0}
22819
22829
  .svhs-page .svhs-start-bottom .svhs-primary{width:100%}
22820
22830
  .svhs-page[data-stage=issue] .svhs-heading{font-size:26px}
22821
- .svhs-page .svhs-results-bottom{display:block}
22822
- .svhs-page .svhs-results-bottom .svhs-secondary{width:100%;margin-top:14px}
22831
+ .svhs-page .svhs-results-bottom .svhs-secondary{width:100%}
22823
22832
  .svhs-page .svhs-contact-scroll{padding:0}
22824
22833
  }
22825
22834
  `;
@@ -23209,6 +23218,7 @@ class SupportView {
23209
23218
  this.resultCopy = element('p', 'svhs-copy');
23210
23219
  this.resultStatus = element('div', 'svhs-empty');
23211
23220
  this.resultError = element('p', 'svhs-error');
23221
+ this.contactNote = element('p', 'svhs-contact-note');
23212
23222
  this.articleTitle = element('h2', 'svhs-article-title');
23213
23223
  this.articleCategory = element('p', 'svhs-category');
23214
23224
  this.articleContent = element('div', 'svhs-article-content');
@@ -23321,9 +23331,11 @@ class SupportView {
23321
23331
  return;
23322
23332
  this.actions.onContact(['locked', 'unavailable'].includes(this.state?.kbState || '') ? 'direct' : this.state?.results?.length ? 'none_match' : 'no_results');
23323
23333
  });
23334
+ this.contactNote.id = `${this.prefix}-contact-note`;
23335
+ this.contactNote.hidden = true;
23324
23336
  this.resultsFooter = this.footer('results');
23325
23337
  this.resultsFooter.classList.add('svhs-results-bottom');
23326
- this.resultsFooter.append(this.contactResults);
23338
+ this.resultsFooter.append(this.contactResults, this.contactNote);
23327
23339
  const article = this.screen('article');
23328
23340
  article.classList.add('svhs-article-scroll');
23329
23341
  this.articleTitle.tabIndex = -1;
@@ -23691,6 +23703,13 @@ class SupportView {
23691
23703
  }
23692
23704
  this.resultsFooter.hidden = Boolean(state.busy);
23693
23705
  this.contactResults.disabled = Boolean(state.busy);
23706
+ // Desk configuration, set as text: never parsed as markup.
23707
+ this.contactNote.textContent = state.contactNote || '';
23708
+ this.contactNote.hidden = !state.contactNote;
23709
+ if (state.contactNote)
23710
+ this.contactResults.setAttribute('aria-describedby', this.contactNote.id);
23711
+ else
23712
+ this.contactResults.removeAttribute('aria-describedby');
23694
23713
  }
23695
23714
  renderResultStatus(state, results) {
23696
23715
  const signature = state.kbState === 'locked' ? `locked:${state.kbAccessMode}` : state.busy ? 'busy' : state.kbState === 'unavailable' ? 'unavailable' : results.length ? 'matches' : 'empty';
@@ -24188,7 +24207,7 @@ function createHelpDeskSupport(config, options) {
24188
24207
  return (await http.request(path, { method: 'POST', body, credentials: 'omit', headers: { 'X-SV-Client': 'help-desk-portal', ...headers } })).data;
24189
24208
  },
24190
24209
  });
24191
- update({ deskName: answer.desk.organization_name || 'Support', brandColor: answer.desk.branding?.color });
24210
+ update({ deskName: answer.desk.organization_name || 'Support', brandColor: answer.desk.branding?.color, contactNote: answer.desk.ticket_contact_note ?? undefined });
24192
24211
  return answer;
24193
24212
  }).catch((error) => { connected = null; throw error; });
24194
24213
  return connected;
@@ -29529,7 +29548,7 @@ class SparkVault {
29529
29548
  }
29530
29549
  /** Get the SDK version */
29531
29550
  static get version() {
29532
- return '16.2.0';
29551
+ return '16.3.0';
29533
29552
  }
29534
29553
  }
29535
29554
  if (typeof window !== 'undefined') {