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