@sparkvault/sdk-js 16.5.0 → 16.5.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.d.ts CHANGED
@@ -3828,6 +3828,7 @@ interface HelpDeskWidgetIdentityOptions {
3828
3828
  interface HelpDeskWidgetIdentityChallenge {
3829
3829
  challenge_id: string;
3830
3830
  verifier: string;
3831
+ /** Private to this window, like the verifier: handed only to the first-party page it opened, which Core requires it from. */
3831
3832
  state: string;
3832
3833
  sign_in_url: string;
3833
3834
  expires_at: number;
package/dist/index.mjs CHANGED
@@ -14336,15 +14336,16 @@ Array.from({ length: 1 << BRAND_BITS.size }, (_, mask) =>
14336
14336
  * API prefix, team mail aliases, the attachment ceremony's steps, the
14337
14337
  * question a customer's new request asks before it is discarded, session,
14338
14338
  * sign-in code (its length, lifetime, sender, resend wait, countdown and
14339
- * the code step's words),
14340
- * merge and pending-attachment timings, hold presets, tag and size limits,
14341
- * the operator display and desk mode choices, the operator queue's views and
14342
- * orders, the reply review list's views and states, the response-time
14343
- * histogram's bucket edges and the sections of a desk's settings an address
14344
- * names live here for the same reason. So do the one rule a tag is stored by
14345
- * (ticketTag), which Core applies where it stores a tag and the console
14346
- * applies where one is typed, and the one rule a typed or pasted sign-in
14347
- * code is read by (helpDeskPinDigits), which every sign-in form applies. So
14339
+ * the code step's words), merge and pending-attachment timings, hold
14340
+ * presets, tag and size limits, the operator display and desk mode choices,
14341
+ * the operator queue's views and orders, the reply review list's views and
14342
+ * states, the response-time histogram's bucket edges, the sections of a
14343
+ * desk's settings an address names, and the messages the widget's native
14344
+ * sign-in posts between the website and its first-party page live here for
14345
+ * the same reason. So do the one rule a tag is stored by (ticketTag), which
14346
+ * Core applies where it stores a tag and the console applies where one is
14347
+ * typed, and the one rule a typed or pasted sign-in code is read by
14348
+ * (helpDeskPinDigits), which every sign-in form applies. So
14348
14349
  * does the one way a client names a message it sends (newMessageId), which
14349
14350
  * the portal, the SDK and the console's composer each send their messages
14350
14351
  * under, and the one rule that a message sent again is the same message
@@ -14369,6 +14370,22 @@ const HELP_DESK_CLOSE_REASONS = Object.freeze(['resolved', 'duplicate', 'spam'])
14369
14370
  /** The close reasons an operator's status change names: a duplicate closes by merging it into the request it repeats. */
14370
14371
  Object.freeze(HELP_DESK_CLOSE_REASONS.filter((reason) => reason !== 'duplicate'));
14371
14372
 
14373
+ /**
14374
+ * The messages the widget's native sign-in exchanges between the website's
14375
+ * window (the JS SDK's openWidgetIdentity) and the first-party page it opens
14376
+ * on auth.sv (Core's widget-identity-page.js), each posted to the other's
14377
+ * exact origin: the page asks its opener for the challenge's state (`ready`),
14378
+ * the opener answers its own popup alone (`state`), and the page reports the
14379
+ * sign-in's code or its cancellation (`result`). Every message names its
14380
+ * challenge, and the state is never in the page's URL or its server-rendered
14381
+ * context, so only the window that started a challenge can complete it.
14382
+ */
14383
+ const HELP_DESK_WIDGET_IDENTITY_MESSAGES = Object.freeze({
14384
+ ready: 'sparkvault:help-desk:identity-ready',
14385
+ state: 'sparkvault:help-desk:identity-state',
14386
+ result: 'sparkvault:help-desk:identity'
14387
+ });
14388
+
14372
14389
  /**
14373
14390
  * Mail local parts no team may take as its alias: the role mailboxes RFC 2142
14374
14391
  * names, the addresses mail systems and their operators keep for themselves,
@@ -17588,7 +17605,17 @@ function openWidgetIdentity(options, prepare, ready, redeem, deskId) {
17588
17605
  if (!challenge || event.source !== popup || event.origin !== firstPartyOrigin)
17589
17606
  return;
17590
17607
  const data = event.data;
17591
- if (!data || data.type !== 'sparkvault:help-desk:identity' || data.challenge_id !== challenge.challenge_id || data.state !== challenge.state)
17608
+ if (!data || data.challenge_id !== challenge.challenge_id)
17609
+ return;
17610
+ // The first-party page this window opened asks for the challenge's
17611
+ // state, without which Core takes none of its steps: only this popup,
17612
+ // at the first-party origin, is ever answered, so a sign-in link opened
17613
+ // in any other window or browser completes nothing.
17614
+ if (data.type === HELP_DESK_WIDGET_IDENTITY_MESSAGES.ready) {
17615
+ popup.postMessage({ type: HELP_DESK_WIDGET_IDENTITY_MESSAGES.state, challenge_id: challenge.challenge_id, state: challenge.state }, event.origin);
17616
+ return;
17617
+ }
17618
+ if (data.type !== HELP_DESK_WIDGET_IDENTITY_MESSAGES.result || data.state !== challenge.state)
17592
17619
  return;
17593
17620
  if (data.cancelled === true) {
17594
17621
  cancel();
@@ -30244,7 +30271,7 @@ class SparkVault {
30244
30271
  }
30245
30272
  /** Get the SDK version */
30246
30273
  static get version() {
30247
- return '16.5.0';
30274
+ return '16.5.1';
30248
30275
  }
30249
30276
  }
30250
30277
  if (typeof window !== 'undefined') {