@sparkvault/sdk-js 16.3.0 → 16.4.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 +117 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.mjs +117 -51
- package/dist/index.mjs.map +1 -1
- package/dist/products/help-desk/types.d.ts +4 -2
- package/dist/products/identity/views/icons.d.ts +4 -4
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/ui/ds-tokens.d.ts +3 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3660,10 +3660,12 @@ interface HelpDeskCustomer {
|
|
|
3660
3660
|
requester_id: string;
|
|
3661
3661
|
email: string;
|
|
3662
3662
|
display_name: string | null;
|
|
3663
|
-
assurance: 'identity' | 'email_pin' | 'external_sso';
|
|
3664
|
-
/**
|
|
3663
|
+
assurance: 'identity' | 'email_pin' | 'external_sso' | 'federated';
|
|
3664
|
+
/** Whether anyone verified the address. False forbids update emails: a company-session contact their company did not verify, or a person the organization's own identity provider signed in without verifying it. */
|
|
3665
3665
|
email_verified?: boolean;
|
|
3666
3666
|
email_updates?: boolean;
|
|
3667
|
+
/** True for a session the organization's own identity provider signed in, whose `assurance` is then `federated`: it changes none of the address's update-email choices. */
|
|
3668
|
+
federated?: boolean;
|
|
3667
3669
|
needs_display_name: boolean;
|
|
3668
3670
|
}
|
|
3669
3671
|
interface HelpDeskSession {
|
package/dist/index.mjs
CHANGED
|
@@ -4392,15 +4392,108 @@ class LoadingView {
|
|
|
4392
4392
|
}
|
|
4393
4393
|
}
|
|
4394
4394
|
|
|
4395
|
+
/**
|
|
4396
|
+
* The sign-in providers' marks and the social networks' marks, each stated
|
|
4397
|
+
* once: the identity dialog (the browser SDK, which bundles this module) and
|
|
4398
|
+
* the console's Identity page draw the providers from here, and the marketing
|
|
4399
|
+
* site's footer and the help center's X post cards draw the networks, so no
|
|
4400
|
+
* two surfaces show one brand two ways.
|
|
4401
|
+
*
|
|
4402
|
+
* Every mark sits in one 24-unit box (BRAND_MARK_VIEWBOX), in one of two
|
|
4403
|
+
* forms, so each surface takes only the form it draws:
|
|
4404
|
+
* - BRAND_MARK_LAYERS: a sign-in provider's mark in its owner's colors, its
|
|
4405
|
+
* shapes painted in order, each `{ d, fill }`. A letter its owner draws
|
|
4406
|
+
* white (Facebook's "f", LinkedIn's "in") is a white shape over a solid
|
|
4407
|
+
* ground, never a cut-out, so a dark button cannot show through it. A
|
|
4408
|
+
* one-color logo (Apple, GitHub) fills with `currentColor`, taking the
|
|
4409
|
+
* color its surface sets for its icons.
|
|
4410
|
+
* - BRAND_MARK_SILHOUETTES: a network's mark as one shape with its letters
|
|
4411
|
+
* cut out, for a surface that paints it in one color.
|
|
4412
|
+
*
|
|
4413
|
+
* Facebook's, LinkedIn's, Instagram's and X's shapes are Simple Icons'
|
|
4414
|
+
* (CC0-1.0): Instagram's, Facebook's and X's from 16.38.0, LinkedIn's from
|
|
4415
|
+
* 13.21.0, the last release that ships it. Each silhouette is that path
|
|
4416
|
+
* exactly. LinkedIn's colored form is the silhouette's square and letters
|
|
4417
|
+
* apart; Facebook's is its whole circle under the cut-out "f", closed along
|
|
4418
|
+
* that circle.
|
|
4419
|
+
*
|
|
4420
|
+
* Browser-safe and import-free.
|
|
4421
|
+
*/
|
|
4422
|
+
|
|
4423
|
+
/** The box every mark is drawn in. */
|
|
4424
|
+
const BRAND_MARK_VIEWBOX = '0 0 24 24';
|
|
4425
|
+
|
|
4426
|
+
/**
|
|
4427
|
+
* Facebook's "f", from its left foot on the circle's edge up and around to its
|
|
4428
|
+
* right foot, (13.454, 23.956), also on the edge. The circle is centered on
|
|
4429
|
+
* (12, 12.044) with radius 12.
|
|
4430
|
+
*/
|
|
4431
|
+
const FACEBOOK_F_OUTLINE = 'M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245';
|
|
4432
|
+
|
|
4433
|
+
/** The short way along the circle's edge between the f's feet, closing the "f" itself. */
|
|
4434
|
+
const FACEBOOK_F_FOOT = 'A12 12 0 0 1 9.101 23.691Z';
|
|
4435
|
+
|
|
4436
|
+
/** Facebook's whole circle, the ground its white "f" stands on. */
|
|
4437
|
+
const FACEBOOK_DISC = 'M24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12 5.373 12 12 12 12-5.373 12-12Z';
|
|
4438
|
+
|
|
4439
|
+
/** LinkedIn's "in": the n, the i's dot, the i's stem. */
|
|
4440
|
+
const LINKEDIN_IN = 'M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452z';
|
|
4441
|
+
|
|
4442
|
+
/** LinkedIn's rounded square, the ground its white "in" stands on. */
|
|
4443
|
+
const LINKEDIN_SQUARE = 'M22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z';
|
|
4444
|
+
|
|
4445
|
+
/** A white letter on its owner's ground. */
|
|
4446
|
+
const WHITE = '#FFFFFF';
|
|
4447
|
+
|
|
4448
|
+
function deepFreeze(value) {
|
|
4449
|
+
for (const child of Object.values(value)) {
|
|
4450
|
+
if (child && typeof child === 'object') deepFreeze(child);
|
|
4451
|
+
}
|
|
4452
|
+
return Object.freeze(value);
|
|
4453
|
+
}
|
|
4454
|
+
|
|
4455
|
+
/**
|
|
4456
|
+
* Each sign-in provider's mark in its owner's colors, by the identity
|
|
4457
|
+
* methods' icon name. Pure, so a bundle that draws no provider drops it.
|
|
4458
|
+
*/
|
|
4459
|
+
const BRAND_MARK_LAYERS = /* @__PURE__ */ deepFreeze({
|
|
4460
|
+
google: [
|
|
4461
|
+
{ d: 'M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z', fill: '#4285F4' },
|
|
4462
|
+
{ d: 'M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z', fill: '#34A853' },
|
|
4463
|
+
{ d: 'M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z', fill: '#FBBC05' },
|
|
4464
|
+
{ d: 'M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z', fill: '#EA4335' },
|
|
4465
|
+
],
|
|
4466
|
+
apple: [
|
|
4467
|
+
{ d: 'M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z', fill: 'currentColor' },
|
|
4468
|
+
],
|
|
4469
|
+
microsoft: [
|
|
4470
|
+
{ d: 'M1 1h10v10H1z', fill: '#F25022' },
|
|
4471
|
+
{ d: 'M1 13h10v10H1z', fill: '#00A4EF' },
|
|
4472
|
+
{ d: 'M13 1h10v10H13z', fill: '#7FBA00' },
|
|
4473
|
+
{ d: 'M13 13h10v10H13z', fill: '#FFB900' },
|
|
4474
|
+
],
|
|
4475
|
+
github: [
|
|
4476
|
+
{ d: 'M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z', fill: 'currentColor' },
|
|
4477
|
+
],
|
|
4478
|
+
facebook: [
|
|
4479
|
+
{ d: FACEBOOK_DISC, fill: '#0866FF' },
|
|
4480
|
+
{ d: FACEBOOK_F_OUTLINE + FACEBOOK_F_FOOT, fill: WHITE },
|
|
4481
|
+
],
|
|
4482
|
+
linkedin: [
|
|
4483
|
+
{ d: LINKEDIN_SQUARE, fill: '#0A66C2' },
|
|
4484
|
+
{ d: LINKEDIN_IN, fill: WHITE },
|
|
4485
|
+
],
|
|
4486
|
+
});
|
|
4487
|
+
|
|
4395
4488
|
/**
|
|
4396
4489
|
* SVG Icon Factory
|
|
4397
4490
|
*
|
|
4398
4491
|
* Bare outline glyphs per the SparkVault design system: stroke `currentColor`
|
|
4399
4492
|
* so the stylesheet drives color, no tinted container backgrounds, round
|
|
4400
|
-
* caps/joins. The sign-in providers' marks are
|
|
4401
|
-
*
|
|
4402
|
-
*
|
|
4403
|
-
* for security.
|
|
4493
|
+
* caps/joins. The sign-in providers' marks are their owners' filled logos,
|
|
4494
|
+
* drawn from `@sparkvault/app-sdk/brand-marks` in their owners' colors, a
|
|
4495
|
+
* one-color logo (Apple, GitHub) in `currentColor`. Uses proper DOM element
|
|
4496
|
+
* creation for security.
|
|
4404
4497
|
*/
|
|
4405
4498
|
function createSvgElement(viewBox, width = 16, height = 16) {
|
|
4406
4499
|
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
@@ -4550,17 +4643,12 @@ function methodIconGlyph(iconName) {
|
|
|
4550
4643
|
case 'link':
|
|
4551
4644
|
return createLinkIcon();
|
|
4552
4645
|
case 'google':
|
|
4553
|
-
return createGoogleIcon();
|
|
4554
4646
|
case 'apple':
|
|
4555
|
-
return createAppleIcon();
|
|
4556
4647
|
case 'microsoft':
|
|
4557
|
-
return createMicrosoftIcon();
|
|
4558
4648
|
case 'github':
|
|
4559
|
-
return createGithubIcon();
|
|
4560
4649
|
case 'facebook':
|
|
4561
|
-
return createFacebookIcon();
|
|
4562
4650
|
case 'linkedin':
|
|
4563
|
-
return
|
|
4651
|
+
return createBrandMarkIcon(iconName);
|
|
4564
4652
|
case 'building':
|
|
4565
4653
|
return createBuildingIcon();
|
|
4566
4654
|
case 'users':
|
|
@@ -4642,43 +4730,15 @@ function createLinkIcon() {
|
|
|
4642
4730
|
svg.appendChild(createPath('M11.67 9.17a3.75 3.75 0 00-5.66-.41l-2.25 2.25a3.75 3.75 0 005.3 5.3l1.28-1.28'));
|
|
4643
4731
|
return svg;
|
|
4644
4732
|
}
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
svg
|
|
4651
|
-
|
|
4652
|
-
}
|
|
4653
|
-
|
|
4654
|
-
const svg = createSvgElement('0 0 20 20', 20, 20);
|
|
4655
|
-
svg.setAttribute('fill', 'currentColor');
|
|
4656
|
-
svg.appendChild(createPath('M14.21 16.9c-.82.79-1.71.67-2.57.29-.91-.38-1.74-.4-2.7 0-1.2.51-1.83.37-2.55-.29C2.7 12.71 3.3 6.33 7.54 6.09c1.13.06 1.91.61 2.57.66.98-.2 1.92-.78 2.97-.7 1.26.1 2.21.6 2.83 1.5-2.6 1.56-1.98 4.99.4 5.94-.48 1.25-1.09 2.49-2.11 3.41h.01zM10.02 6.04c-.12-1.86 1.38-3.39 3.11-3.54.24 2.15-1.95 3.75-3.11 3.54z'));
|
|
4657
|
-
return svg;
|
|
4658
|
-
}
|
|
4659
|
-
function createMicrosoftIcon() {
|
|
4660
|
-
const svg = createSvgElement('0 0 20 20', 20, 20);
|
|
4661
|
-
svg.appendChild(createPath('M1 1h8.33v8.33H1z', { fill: '#F25022' }));
|
|
4662
|
-
svg.appendChild(createPath('M1 10.67h8.33V19H1z', { fill: '#00A4EF' }));
|
|
4663
|
-
svg.appendChild(createPath('M10.67 1H19v8.33h-8.33z', { fill: '#7FBA00' }));
|
|
4664
|
-
svg.appendChild(createPath('M10.67 10.67H19V19h-8.33z', { fill: '#FFB900' }));
|
|
4665
|
-
return svg;
|
|
4666
|
-
}
|
|
4667
|
-
function createGithubIcon() {
|
|
4668
|
-
const svg = createSvgElement('0 0 20 20', 20, 20);
|
|
4669
|
-
svg.setAttribute('fill', 'currentColor');
|
|
4670
|
-
svg.appendChild(createPath('M10 0C4.48 0 0 4.48 0 10c0 4.42 2.86 8.17 6.84 9.49.5.09.68-.22.68-.48 0-.24-.01-1.02-.01-1.86-2.51.46-3.16-.61-3.36-1.18-.11-.29-.6-1.18-1.02-1.41-.35-.19-.85-.65-.01-.66.79-.01 1.35.72 1.54 1.02.9 1.51 2.34 1.09 2.91.83.09-.65.35-1.09.64-1.34-2.22-.25-4.55-1.11-4.55-4.94 0-1.09.39-1.99 1.02-2.69-.1-.25-.45-1.27.1-2.65 0 0 .84-.27 2.75 1.02.8-.22 1.65-.33 2.5-.33s1.7.11 2.5.33c1.91-1.3 2.75-1.02 2.75-1.02.55 1.38.2 2.4.1 2.65.64.7 1.02 1.59 1.02 2.69 0 3.84-2.34 4.69-4.57 4.94.36.31.67.91.67 1.85 0 1.34-.01 2.41-.01 2.75 0 .27.18.58.69.48C17.14 18.16 20 14.42 20 10c0-5.52-4.48-10-10-10z'));
|
|
4671
|
-
return svg;
|
|
4672
|
-
}
|
|
4673
|
-
/** Facebook's mark and blue as Simple Icons (CC0-1.0) draws them, in its own 24-unit box. */
|
|
4674
|
-
function createFacebookIcon() {
|
|
4675
|
-
const svg = createSvgElement('0 0 24 24', 20, 20);
|
|
4676
|
-
svg.appendChild(createPath('M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z', { fill: '#0866FF' }));
|
|
4677
|
-
return svg;
|
|
4678
|
-
}
|
|
4679
|
-
function createLinkedinIcon() {
|
|
4680
|
-
const svg = createSvgElement('0 0 20 20', 20, 20);
|
|
4681
|
-
svg.appendChild(createPath('M17.04 17.04h-2.96v-4.64c0-1.11-.02-2.53-1.54-2.53-1.55 0-1.78 1.2-1.78 2.45v4.73H7.8V7.5h2.84v1.3h.04c.4-.75 1.36-1.54 2.81-1.54 3 0 3.56 1.98 3.56 4.55v5.24zM4.45 6.19c-.95 0-1.72-.77-1.72-1.72s.77-1.72 1.72-1.72 1.72.77 1.72 1.72-.77 1.72-1.72 1.72zm1.48 10.85H2.96V7.5h2.97v9.54zM18.52 0H1.47C.66 0 0 .65 0 1.44v17.12c0 .79.66 1.44 1.48 1.44h17.04c.82 0 1.48-.65 1.48-1.44V1.44c0-.79-.66-1.44-1.48-1.44z', { fill: '#0A66C2' }));
|
|
4733
|
+
/**
|
|
4734
|
+
* A sign-in provider's mark: its layers painted in order, each path carrying
|
|
4735
|
+
* its layer's own fill, which the svg's `fill="none"` never reaches.
|
|
4736
|
+
*/
|
|
4737
|
+
function createBrandMarkIcon(name) {
|
|
4738
|
+
const svg = createSvgElement(BRAND_MARK_VIEWBOX, 20, 20);
|
|
4739
|
+
for (const { d, fill } of BRAND_MARK_LAYERS[name]) {
|
|
4740
|
+
svg.appendChild(createPath(d, { fill }));
|
|
4741
|
+
}
|
|
4682
4742
|
return svg;
|
|
4683
4743
|
}
|
|
4684
4744
|
function createBuildingIcon() {
|
|
@@ -6394,8 +6454,9 @@ class ErrorView {
|
|
|
6394
6454
|
* neutrals. The published bundle cannot read those CSS files, so the values
|
|
6395
6455
|
* the widgets use are mirrored here, each naming the token it mirrors.
|
|
6396
6456
|
* tests/ds-tokens.test.ts holds every value to the design system's own, and
|
|
6397
|
-
* refuses a hex color anywhere else in the SDK's source (
|
|
6398
|
-
*
|
|
6457
|
+
* refuses a hex color anywhere else in the SDK's source and an rgba() whose
|
|
6458
|
+
* color is not the design system's. The sign-in providers' marks keep their
|
|
6459
|
+
* owners' colors, which live in @sparkvault/app-sdk/brand-marks.
|
|
6399
6460
|
*/
|
|
6400
6461
|
/** The design-system token each mirrored value is. */
|
|
6401
6462
|
/** The design system's values for {@link DS_TOKEN_SOURCES}. */
|
|
@@ -18051,7 +18112,12 @@ class HelpDeskClient {
|
|
|
18051
18112
|
}, undefined, false);
|
|
18052
18113
|
if (revision !== this.revision)
|
|
18053
18114
|
throw sessionChanged();
|
|
18054
|
-
|
|
18115
|
+
// A native sign-in opens a session at the desk's issuer: an email sign-in's customer is linked to
|
|
18116
|
+
// its Secure Identity (`identity`); a sign-in by the organization's own identity provider carries
|
|
18117
|
+
// the `federated` mark and the `federated` assurance together, never one without the other.
|
|
18118
|
+
const customer = result?.customer;
|
|
18119
|
+
const nativeIdentity = customer?.federated === true ? customer.assurance === 'federated' : customer?.assurance === 'identity';
|
|
18120
|
+
if (!validToken(result?.token) || !nativeIdentity || !/^hdwip_[A-Za-z0-9_-]{43}$/.test(result.identity_grant?.token)) {
|
|
18055
18121
|
throw new SparkVaultError('The help desk returned an invalid support identity.', 'HELP_DESK_INVALID_RESPONSE');
|
|
18056
18122
|
}
|
|
18057
18123
|
this.issuedSessions.set(result, result.token);
|
|
@@ -29548,7 +29614,7 @@ class SparkVault {
|
|
|
29548
29614
|
}
|
|
29549
29615
|
/** Get the SDK version */
|
|
29550
29616
|
static get version() {
|
|
29551
|
-
return '16.
|
|
29617
|
+
return '16.4.1';
|
|
29552
29618
|
}
|
|
29553
29619
|
}
|
|
29554
29620
|
if (typeof window !== 'undefined') {
|