@sparkvault/sdk-js 18.0.0 → 18.0.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
@@ -18849,7 +18849,657 @@ class HelpDeskClient {
18849
18849
  }
18850
18850
  }
18851
18851
 
18852
- /** Scoped styles for the optional inline help desk form. */
18852
+ /**
18853
+ * A tenant's brand color and the WCAG contrast rules that decide how it may be
18854
+ * used: the one hex rule the server stores, the console checks and the portal
18855
+ * paints, the one contrast reading the console's readouts, the portal's
18856
+ * accent and the portal's reading of a help center's ground share, and the
18857
+ * one way a readout writes that reading.
18858
+ *
18859
+ * A brand color is tenant-controlled, so it is used only when it is a
18860
+ * six-digit hex color, read case-insensitively and held in lowercase; anything
18861
+ * else (a color name, a CSS function, a value that runs on into more CSS) is
18862
+ * no color at all.
18863
+ *
18864
+ * A brand color can be any lightness, so whatever shows it picks what goes
18865
+ * with it, in one pairing per scheme that every surface painting the color
18866
+ * shares (the customer portal, the SDK's support journey, the desk's email,
18867
+ * the console's sample):
18868
+ *
18869
+ * light (lightAccent) the fill, moved in lightness away from its label
18870
+ * only where neither white nor ink reads on it at
18871
+ * 4.5:1; white or ink on it, whichever reads more
18872
+ * strongly; the color itself as text only where it
18873
+ * reaches 4.5:1 on both grounds accent text stands on,
18874
+ * the white surface and the canvas tone, ink otherwise
18875
+ * dark (darkAccent) a color with a hue a reader sees, lifted in
18876
+ * lightness at its own hue and the saturation it shows
18877
+ * where it would not read: as text until it reads at
18878
+ * 4.5:1 on every dark ground accent text stands on
18879
+ * (darkAccentInk), as a fill until it stands at 3:1 on
18880
+ * the dark page and its cards under a label at 4.5:1,
18881
+ * its hover too (darkAccentFill); a grey or black, the
18882
+ * dark scheme's ink, as fill and as text, under ink
18883
+ *
18884
+ * A hue is the one a reader sees (shownChroma): a black whose OKLCH chroma
18885
+ * names a hue no reader sees there, such as #000001, pairs as black in both
18886
+ * schemes. Under the pointer each fill moves a step a reader sees, away from
18887
+ * its label wherever there is room, and on dark grounds wherever that step
18888
+ * still stands there (hoverOf). schemePairings gives both pairings at once,
18889
+ * DEFAULT_PAIRINGS the ones a desk with no brand color paints, and
18890
+ * accentProperties says either as the accent custom properties the customer
18891
+ * portal paints with.
18892
+ *
18893
+ * BROWSER-SAFE: data only, no imports.
18894
+ */
18895
+
18896
+ const HEX_COLOR = /^#[0-9a-f]{6}$/;
18897
+
18898
+ /** WCAG AA's floor for normal-size text. */
18899
+ const AA_TEXT_CONTRAST = 4.5;
18900
+
18901
+ /**
18902
+ * The canvas tone, the design system's `--canvas` (`--color-slate-50`): the
18903
+ * page ground the customer portal (its pages and a customer's own messages)
18904
+ * and the knowledge base's default theme set accent text on, beside the white
18905
+ * surface. The design system publishes its tokens only as CSS, which this
18906
+ * import-free module cannot read, so the value is mirrored here once, and
18907
+ * tests/brand-color.test.js holds it to packages/design-system/tokens/colors.css.
18908
+ */
18909
+ const CANVAS_COLOR = '#f7fafb';
18910
+
18911
+ /**
18912
+ * The ink, the design system's `--ink` (`--color-slate-900`): the dark text a
18913
+ * pairing paints on a fill and in place of a color too light to stand as
18914
+ * text. Mirrored here once for the same reason as CANVAS_COLOR, and held to
18915
+ * packages/design-system/tokens/colors.css by tests/brand-color.test.js.
18916
+ */
18917
+ const INK_COLOR = '#0d1a20';
18918
+
18919
+ /**
18920
+ * The design system's dark app grounds accent colors stand on, mirrored for
18921
+ * the same reason as CANVAS_COLOR and held to the tokens the same way: the
18922
+ * page (`--dark-app-canvas`), its cards (`--dark-app-surface`) and the
18923
+ * ground of selected text and of the composer's drop prompt
18924
+ * (`--dark-app-selection`), the lightest ground accent text stands on there.
18925
+ */
18926
+ const DARK_CANVAS_COLOR = '#071217';
18927
+ const DARK_SURFACE_COLOR = '#0d1a20';
18928
+ const DARK_SELECTION_COLOR = '#1b2e4c';
18929
+
18930
+ /**
18931
+ * The dark app ramp's ink, `--dark-app-ink`: the text on its grounds, and the
18932
+ * accent a grey or black brand color takes there. Mirrored and held to the
18933
+ * tokens as CANVAS_COLOR is.
18934
+ */
18935
+ const DARK_INK_COLOR = '#f0f5f7';
18936
+
18937
+ /**
18938
+ * The pairings a desk with no brand color paints, in the shape a brand
18939
+ * color's take (schemePairings), so every surface that paints a desk's accent
18940
+ * (the customer portal, the SDK's support journey, the desk's email, the
18941
+ * console's sample) paints this one default: on light grounds the design
18942
+ * system's primary button (`--color-btn-primary`, under the pointer
18943
+ * `--color-btn-primary-hover`) under white, with `--color-action` as text; on
18944
+ * the dark app grounds its action fill (`--dark-app-action`, under the
18945
+ * pointer `--dark-app-action-hover`) under white, with
18946
+ * `--color-action-on-dark` as text. Each color is its token's value,
18947
+ * mirrored and held to the tokens as CANVAS_COLOR is.
18948
+ */
18949
+ const DEFAULT_PAIRINGS = Object.freeze({
18950
+ light: Object.freeze({ fill: '#0a4eb1', onAccent: 'white', ink: '#216bde', hover: '#03439f' }),
18951
+ dark: Object.freeze({ fill: '#226ee3', onAccent: 'white', ink: '#72a8ff', hover: '#1d60c8' })
18952
+ });
18953
+
18954
+ /**
18955
+ * The chroma a reader sees (shownChroma) under which a color is a grey rather
18956
+ * than a hue: the neutral greys a brand picks (a pure, warm or cool grey,
18957
+ * stone, zinc) sit at 0 to 0.019, and the least saturated colors still named
18958
+ * by their hue (a desaturated olive, a charcoal navy, a taupe, a brown) at
18959
+ * 0.028 to 0.035.
18960
+ */
18961
+ const CHROMA_FLOOR = 0.02;
18962
+
18963
+ /**
18964
+ * The OKLCH lightness under which OKLCH's chroma names a hue a reader does
18965
+ * not see: CIE L*a*b*'s 6/29, under which L*a*b* weighs light linearly where
18966
+ * OKLab keeps its cube root to black. Near black that cube root finds a hue
18967
+ * in what little light there is (a chroma of 0.021 in #000001, 0.045 in
18968
+ * #00000a) in a color a reader sees as black.
18969
+ */
18970
+ const LINEAR_LIGHTNESS = 6 / 29;
18971
+
18972
+ /** WCAG AA's floor for a control's parts and a state's mark (1.4.11). */
18973
+ const AA_NON_TEXT_CONTRAST = 3;
18974
+
18975
+ /** sRGB's transfer function: an encoded channel, from 0 to 1, as linear light, and back. */
18976
+ const toLinear = (channel) => (channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4);
18977
+ const toGamma = (channel) => (channel <= 0.0031308 ? 12.92 * channel : 1.055 * channel ** (1 / 2.4) - 0.055);
18978
+
18979
+ /** A validated `#rrggbb` color's red, green and blue channels, each from 0 to 1. */
18980
+ const channelsOf = (color) => [1, 3, 5].map((offset) => Number.parseInt(color.slice(offset, offset + 2), 16) / 255);
18981
+
18982
+ /** Relative luminance (WCAG 2) of an sRGB color's red, green and blue channels, each from 0 to 1. */
18983
+ function channelLuminance(channels) {
18984
+ const [red, green, blue] = channels.map(toLinear);
18985
+ return 0.2126 * red + 0.7152 * green + 0.0722 * blue;
18986
+ }
18987
+
18988
+ /** Relative luminance (WCAG 2) of a validated `#rrggbb` color. */
18989
+ function relativeLuminance(color) {
18990
+ return channelLuminance(channelsOf(color));
18991
+ }
18992
+
18993
+ /** The contrast ratio of two relative luminances. */
18994
+ function contrastRatio(first, second) {
18995
+ return (Math.max(first, second) + 0.05) / (Math.min(first, second) + 0.05);
18996
+ }
18997
+
18998
+ /** The relative luminance of the ink a fill's text is weighed in, the real ink rather than pure black. */
18999
+ const INK_LUMINANCE = relativeLuminance(INK_COLOR);
19000
+
19001
+ /** The relative luminances of the grounds accent text stands on: the white surface and the canvas tone. */
19002
+ const TEXT_GROUNDS = Object.freeze([1, relativeLuminance(CANVAS_COLOR)]);
19003
+
19004
+ /** The dark app ramp's grounds accent text stands on, as sRGB channels: the dark page, its cards and the selection. */
19005
+ const DARK_TEXT_GROUNDS = Object.freeze([DARK_CANVAS_COLOR, DARK_SURFACE_COLOR, DARK_SELECTION_COLOR].map((color) => Object.freeze(channelsOf(color))));
19006
+
19007
+ /** The dark app ramp's grounds an accent fill stands on, as sRGB channels: the dark page and its cards. */
19008
+ const DARK_FILL_GROUNDS = Object.freeze([DARK_CANVAS_COLOR, DARK_SURFACE_COLOR].map((color) => Object.freeze(channelsOf(color))));
19009
+
19010
+ /** How strongly a color of this luminance reads on the one of `grounds` it reads least on. */
19011
+ function lowestContrast(luminance, grounds) {
19012
+ return Math.min(...grounds.map((ground) => contrastRatio(luminance, ground)));
19013
+ }
19014
+
19015
+ /** The text a fill of this luminance takes: white or ink, whichever reads more strongly on it. */
19016
+ function labelOf(luminance) {
19017
+ return contrastRatio(luminance, 1) >= contrastRatio(luminance, INK_LUMINANCE) ? 'white' : 'ink';
19018
+ }
19019
+
19020
+ /** How strongly that text reads on a fill of this luminance. */
19021
+ function labelContrast(luminance) {
19022
+ return contrastRatio(luminance, labelOf(luminance) === 'white' ? 1 : INK_LUMINANCE);
19023
+ }
19024
+
19025
+ /** How strongly a color of this luminance reads as text on the light ground it reads least on. */
19026
+ function textContrast(luminance) {
19027
+ return lowestContrast(luminance, TEXT_GROUNDS);
19028
+ }
19029
+
19030
+ /**
19031
+ * A validated `#rrggbb` color in OKLCH (lightness from 0 to 1, chroma, hue in
19032
+ * radians), by the same transform the design system derives its palette with
19033
+ * (packages/design-system/scripts/token-css.mjs oklchOfRgb, by which
19034
+ * tests/brand-color.test.js measures every lift).
19035
+ */
19036
+ function oklchOf(color) {
19037
+ const [r, g, b] = channelsOf(color).map(toLinear);
19038
+ const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
19039
+ const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
19040
+ const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
19041
+ const a = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s;
19042
+ const bAxis = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s;
19043
+ return { L: 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s, C: Math.hypot(a, bAxis), H: Math.atan2(bAxis, a) };
19044
+ }
19045
+
19046
+ /** An OKLCH color's linear red, green and blue; a channel outside 0 to 1 is one sRGB cannot draw. */
19047
+ function linearOfOklch(L, C, H) {
19048
+ const [a, b] = [C * Math.cos(H), C * Math.sin(H)];
19049
+ const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3;
19050
+ const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3;
19051
+ const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3;
19052
+ return [
19053
+ 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
19054
+ -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
19055
+ -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s
19056
+ ];
19057
+ }
19058
+
19059
+ /**
19060
+ * The chroma a reader sees in a color (its OKLCH lightness and chroma): its
19061
+ * OKLCH chroma, under LINEAR_LIGHTNESS faded by the square of the color's
19062
+ * share of that lightness, as L*a*b*'s linear weighing scales chroma against
19063
+ * the cube root there.
19064
+ */
19065
+ const shownChroma = ({ L, C }) => C * Math.min(1, (L / LINEAR_LIGHTNESS) ** 2);
19066
+
19067
+ /** Whether a color (its OKLCH lightness and chroma) has a hue a reader sees: its shown chroma at CHROMA_FLOOR or more. */
19068
+ const hasHue = (oklch) => shownChroma(oklch) >= CHROMA_FLOOR;
19069
+
19070
+ /**
19071
+ * The saturation a walk from a color keeps (shiftedUntil): its shown chroma
19072
+ * for its lightness. A color darker than LINEAR_LIGHTNESS with no hue a
19073
+ * reader sees keeps none, so it walks as a grey: a walk toward the light
19074
+ * would grow its trace into a hue. A lighter grey keeps its faint tint, which
19075
+ * its short walks barely move.
19076
+ */
19077
+ function saturationOf(oklch) {
19078
+ if (oklch.L <= 0 || (oklch.L < LINEAR_LIGHTNESS && !hasHue(oklch))) return 0;
19079
+ return shownChroma(oklch) / oklch.L;
19080
+ }
19081
+
19082
+ const drawable = (channels) => channels.every((channel) => channel >= 0 && channel <= 1);
19083
+
19084
+ /** The `#rrggbb` color at OKLCH lightness L and hue H, with as much of chroma C as sRGB holds there. */
19085
+ function colorAt(L, C, H) {
19086
+ let chroma = C;
19087
+ if (!drawable(linearOfOklch(L, chroma, H))) {
19088
+ let [low, high] = [0, C];
19089
+ for (let halving = 0; halving < 24; halving += 1) {
19090
+ const middle = (low + high) / 2;
19091
+ if (drawable(linearOfOklch(L, middle, H))) low = middle;
19092
+ else high = middle;
19093
+ }
19094
+ chroma = low;
19095
+ }
19096
+ return `#${linearOfOklch(L, chroma, H).map((channel) => Math.round(toGamma(Math.min(1, Math.max(0, channel))) * 255).toString(16).padStart(2, '0')).join('')}`;
19097
+ }
19098
+
19099
+ /** How far each step of a shift moves a color's OKLCH lightness. */
19100
+ const SHIFT_STEP = 0.005;
19101
+
19102
+ /**
19103
+ * A color as it stands where `reads` asks more of it: itself where it reads,
19104
+ * else moved in OKLCH lightness (up for `direction` 1, down for -1) at its
19105
+ * own hue, one step at a time, to the first step that reads, white or black
19106
+ * at the end. Its saturation (saturationOf), the chroma a reader sees for its
19107
+ * lightness, stays as it is, so a navy lifts to a clear blue of its own
19108
+ * family rather than greying out, with as much of that chroma as sRGB holds
19109
+ * at each step. Null where not even the end reads.
19110
+ *
19111
+ * @param {string} color - A validated brand color
19112
+ * @param {1|-1} direction
19113
+ * @param {(candidate: string) => boolean} reads
19114
+ * @returns {string|null}
19115
+ */
19116
+ function shiftedUntil(color, direction, reads) {
19117
+ if (reads(color)) return color;
19118
+ const oklch = oklchOf(color);
19119
+ const { L, H } = oklch;
19120
+ const saturation = saturationOf(oklch);
19121
+ for (let lightness = L + direction * SHIFT_STEP; lightness > 0 && lightness < 1; lightness += direction * SHIFT_STEP) {
19122
+ const shifted = colorAt(lightness, saturation * lightness, H);
19123
+ if (reads(shifted)) return shifted;
19124
+ }
19125
+ const end = direction > 0 ? '#ffffff' : '#000000';
19126
+ return reads(end) ? end : null;
19127
+ }
19128
+
19129
+ /**
19130
+ * A brand color as it may be stored and shown, or null when the value is not
19131
+ * one: a `#rrggbb` hex value, read case-insensitively.
19132
+ *
19133
+ * @param {unknown} value
19134
+ * @returns {string|null} The color in lowercase
19135
+ */
19136
+ function brandColor(value) {
19137
+ if (typeof value !== 'string') return null;
19138
+ const color = value.toLowerCase();
19139
+ return HEX_COLOR.test(color) ? color : null;
19140
+ }
19141
+
19142
+ /** How far a fill under the pointer moves at least, in OKLCH lightness. */
19143
+ const HOVER_SHIFT = 0.05;
19144
+
19145
+ /**
19146
+ * How far a fill under the pointer stands from the fill at least, as a
19147
+ * contrast ratio: where HOVER_SHIFT moves a very dark fill too little for a
19148
+ * reader to see (black's step is a 1.0:1 change), the hover moves on until
19149
+ * it stands this far apart.
19150
+ */
19151
+ const HOVER_CONTRAST = 1.1;
19152
+
19153
+ /**
19154
+ * A fill under the pointer: the first step in OKLCH lightness at its own hue
19155
+ * (shiftedUntil) at least HOVER_SHIFT from the fill that stands
19156
+ * HOVER_CONTRAST from it, away from its label (darker under white, lighter
19157
+ * under ink), so the label reads more strongly on it still, where that step
19158
+ * `stands` (for a dark fill, standsWhere: on the grounds it stands on, under
19159
+ * its label). Where it does not (a fill too near that end of the range, black
19160
+ * and its nearest neighbors under white or white under ink, or a dark fill
19161
+ * whose step away sinks into its grounds), the first such step toward its
19162
+ * label, where that one stands; a step further either way only moves further
19163
+ * from the fill. Null where neither stands.
19164
+ *
19165
+ * @param {string} fill - A `#rrggbb` color
19166
+ * @param {'white'|'ink'} onAccent - Its label
19167
+ * @param {(candidate: string) => boolean} [stands]
19168
+ * @returns {string|null}
19169
+ */
19170
+ function hoverOf(fill, onAccent, stands = () => true) {
19171
+ const { L } = oklchOf(fill);
19172
+ const luminance = relativeLuminance(fill);
19173
+ const apart = (candidate) => Math.abs(oklchOf(candidate).L - L) >= HOVER_SHIFT - Number.EPSILON
19174
+ && contrastRatio(relativeLuminance(candidate), luminance) >= HOVER_CONTRAST;
19175
+ const away = onAccent === 'white' ? -1 : 1;
19176
+ return [away, -away].map((direction) => shiftedUntil(fill, direction, apart)).find((step) => step !== null && stands(step)) ?? null;
19177
+ }
19178
+
19179
+ /**
19180
+ * Whether a dark fill's hover stands where the fill does: at
19181
+ * AA_NON_TEXT_CONTRAST on each of the grounds (their relative luminances),
19182
+ * under the fill's label at AA_TEXT_CONTRAST.
19183
+ *
19184
+ * @param {number[]} luminances
19185
+ * @param {'white'|'ink'} onAccent
19186
+ * @returns {(candidate: string) => boolean}
19187
+ */
19188
+ const standsWhere = (luminances, onAccent) => (candidate) => {
19189
+ const luminance = relativeLuminance(candidate);
19190
+ return lowestContrast(luminance, luminances) >= AA_NON_TEXT_CONTRAST
19191
+ && contrastRatio(luminance, onAccent === 'white' ? 1 : INK_LUMINANCE) >= AA_TEXT_CONTRAST;
19192
+ };
19193
+
19194
+ /**
19195
+ * @typedef {Object} AccentPairing
19196
+ * @property {string} fill - The fill of a primary action, `#rrggbb`
19197
+ * @property {'white'|'ink'} onAccent - The text on it: white, or the light ink (INK_COLOR)
19198
+ * @property {string} ink - The accent as text on the scheme's grounds, `#rrggbb`
19199
+ * @property {string} hover - The fill under the pointer, `#rrggbb`
19200
+ */
19201
+
19202
+ /**
19203
+ * What a brand color becomes on the light grounds (the white surface and the
19204
+ * canvas tone): its label, white or ink, whichever reads more strongly on
19205
+ * it; its fill, itself where that label reads on it at AA_TEXT_CONTRAST,
19206
+ * else moved in lightness away from the label (shiftedUntil) to the first
19207
+ * step where it does; the color itself as text where it reads at
19208
+ * AA_TEXT_CONTRAST on both grounds (accentTextContrast), INK_COLOR otherwise;
19209
+ * and its fill under the pointer (hoverOf).
19210
+ *
19211
+ * @param {unknown} value
19212
+ * @returns {AccentPairing|null} Null when the value is not a brand color
19213
+ */
19214
+ function lightAccent(value) {
19215
+ const color = brandColor(value);
19216
+ if (!color) return null;
19217
+ const luminance = relativeLuminance(color);
19218
+ const onAccent = labelOf(luminance);
19219
+ const fill = shiftedUntil(color, onAccent === 'white' ? -1 : 1, (candidate) => labelContrast(relativeLuminance(candidate)) >= AA_TEXT_CONTRAST);
19220
+ return { fill, onAccent, ink: textContrast(luminance) >= AA_TEXT_CONTRAST ? color : INK_COLOR, hover: hoverOf(fill, onAccent) };
19221
+ }
19222
+
19223
+ /**
19224
+ * The color a brand color starts its dark lift from: itself where it has a
19225
+ * hue a reader sees (hasHue), kept as it lifts; the dark scheme's ink
19226
+ * (DARK_INK_COLOR) for a grey or black, which has no hue to keep and lifted
19227
+ * would read as a disabled control.
19228
+ */
19229
+ const darkSource = (color) => (hasHue(oklchOf(color)) ? color : DARK_INK_COLOR);
19230
+
19231
+ /** The relative luminances of grounds given as sRGB channels. */
19232
+ const luminancesOf = (grounds) => grounds.map(channelLuminance);
19233
+
19234
+ /**
19235
+ * A brand color's fill on dark grounds: the color (darkSource) lifted
19236
+ * (shiftedUntil) until it stands at AA_NON_TEXT_CONTRAST on each of `grounds`,
19237
+ * white or ink, whichever reads more strongly on it, reads at
19238
+ * AA_TEXT_CONTRAST, and it has a fill under the pointer that stands there
19239
+ * too (hoverOf, standsWhere); that label; and that hover. A color that
19240
+ * already stands there is itself.
19241
+ *
19242
+ * @param {unknown} value
19243
+ * @param {number[][]} [grounds] - sRGB channels from 0 to 1; the dark app ramp's page and cards unless given
19244
+ * @returns {{ fill: string, onAccent: 'white'|'ink', hover: string }|null} Null when the value is not a brand color, or no lift stands on `grounds`
19245
+ */
19246
+ function darkAccentFill(value, grounds = DARK_FILL_GROUNDS) {
19247
+ const color = brandColor(value);
19248
+ if (!color) return null;
19249
+ const luminances = luminancesOf(grounds);
19250
+ // The step that stands, with its label and hover, kept from the walk that found it.
19251
+ let found = null;
19252
+ shiftedUntil(darkSource(color), 1, (candidate) => {
19253
+ const luminance = relativeLuminance(candidate);
19254
+ if (lowestContrast(luminance, luminances) < AA_NON_TEXT_CONTRAST || labelContrast(luminance) < AA_TEXT_CONTRAST) return false;
19255
+ const onAccent = labelOf(luminance);
19256
+ const hover = hoverOf(candidate, onAccent, standsWhere(luminances, onAccent));
19257
+ found = hover && { fill: candidate, onAccent, hover };
19258
+ return found !== null;
19259
+ });
19260
+ return found;
19261
+ }
19262
+
19263
+ /**
19264
+ * A brand color as text on dark grounds: the color (darkSource) lifted
19265
+ * (shiftedUntil) until it reads at AA_TEXT_CONTRAST on each of `grounds`. A
19266
+ * color that already reads there is itself.
19267
+ *
19268
+ * @param {unknown} value
19269
+ * @param {number[][]} [grounds] - sRGB channels from 0 to 1; the dark app ramp's page, cards and selection unless given
19270
+ * @returns {string|null} Null when the value is not a brand color, or no lift reads on `grounds`
19271
+ */
19272
+ function darkAccentInk(value, grounds = DARK_TEXT_GROUNDS) {
19273
+ const color = brandColor(value);
19274
+ if (!color) return null;
19275
+ const luminances = luminancesOf(grounds);
19276
+ return shiftedUntil(darkSource(color), 1, (candidate) => lowestContrast(relativeLuminance(candidate), luminances) >= AA_TEXT_CONTRAST);
19277
+ }
19278
+
19279
+ /**
19280
+ * What a brand color becomes on the design system's dark app grounds: its
19281
+ * fill and label (darkAccentFill) and its text (darkAccentInk), each lifted
19282
+ * at the color's own hue until it reads there. On a help center's own dark
19283
+ * ground the customer portal lifts this pairing again, with the same two,
19284
+ * against that ground and the grounds it draws from it.
19285
+ *
19286
+ * @param {unknown} value
19287
+ * @returns {AccentPairing|null} Null when the value is not a brand color
19288
+ */
19289
+ function darkAccent(value) {
19290
+ const fill = darkAccentFill(value);
19291
+ return fill && { ...fill, ink: darkAccentInk(value) };
19292
+ }
19293
+
19294
+ /**
19295
+ * A brand color's pairing in each scheme, derived once for whatever writes
19296
+ * them and weighs them together: on the light grounds (lightAccent) and on
19297
+ * the dark app grounds (darkAccent).
19298
+ *
19299
+ * @param {unknown} value
19300
+ * @returns {Readonly<{ light: AccentPairing, dark: AccentPairing }>|null} Null when the value is not a brand color
19301
+ */
19302
+ function schemePairings(value) {
19303
+ const light = lightAccent(value);
19304
+ return light && Object.freeze({ light, dark: darkAccent(value) });
19305
+ }
19306
+
19307
+ /**
19308
+ * How accentProperties writes white and each scheme's ink, the colors a
19309
+ * design-system token names: as those tokens (`tokens`), for a page whose
19310
+ * stylesheet declares them (the customer portal, the console's sample), or as
19311
+ * the colors themselves (`colors`), for a page that declares none (the SDK's
19312
+ * widget on a customer's website). Each token holds the color beside it.
19313
+ */
19314
+ const WRITINGS = Object.freeze({
19315
+ tokens: Object.freeze({ white: 'var(--color-white)', ink: 'var(--ink)', darkInk: 'var(--dark-app-ink)' }),
19316
+ colors: Object.freeze({ white: '#ffffff', ink: INK_COLOR, darkInk: DARK_INK_COLOR })
19317
+ });
19318
+
19319
+ /**
19320
+ * The accent custom properties for a desk's pairings (a brand color's,
19321
+ * schemePairings, or DEFAULT_PAIRINGS), for each scheme a help desk surface
19322
+ * paints in: on light grounds the fill (`--hd-light-accent`), the text on it
19323
+ * (`--hd-light-on-accent`), the accent as text (`--hd-light-accent-ink`) and
19324
+ * the fill under the pointer (`--hd-light-accent-hover`); on the dark app
19325
+ * grounds the same four (`--hd-dark-*`). The one place these names are
19326
+ * spelled: the customer portal's root, the console's sample and every element
19327
+ * of the SDK's widget carry what it returns.
19328
+ *
19329
+ * @param {{ light: AccentPairing, dark: AccentPairing }} pairings
19330
+ * @param {'tokens'|'colors'} [writing] - How white and each scheme's ink are written (WRITINGS)
19331
+ * @returns {Record<`--hd-${'light'|'dark'}-${'accent'|'on-accent'|'accent-ink'|'accent-hover'}`, string>}
19332
+ */
19333
+ function accentProperties(pairings, writing = 'tokens') {
19334
+ const { white, ink, darkInk } = WRITINGS[writing];
19335
+ const label = { white, ink };
19336
+ const { light, dark } = pairings;
19337
+ return {
19338
+ '--hd-light-accent': light.fill,
19339
+ '--hd-light-on-accent': label[light.onAccent],
19340
+ '--hd-light-accent-ink': light.ink === INK_COLOR ? ink : light.ink,
19341
+ '--hd-light-accent-hover': light.hover,
19342
+ '--hd-dark-accent': dark.fill === DARK_INK_COLOR ? darkInk : dark.fill,
19343
+ '--hd-dark-on-accent': label[dark.onAccent],
19344
+ '--hd-dark-accent-ink': dark.ink === DARK_INK_COLOR ? darkInk : dark.ink,
19345
+ '--hd-dark-accent-hover': dark.hover
19346
+ };
19347
+ }
19348
+
19349
+ /**
19350
+ * The help desk's color roles as every customer-facing piece of its UI reads
19351
+ * them, written once: the SDK's support launcher, its panel, the request
19352
+ * form and its modal (sdk-js products/help-desk) and the composer both share
19353
+ * (help-desk-composer.js). Each reads the customer portal's color role of the
19354
+ * same meaning (`--hd-*`, which the portal's root maps to its scheme's color
19355
+ * set), else the design system's light value, the one the portal's own light
19356
+ * set maps the role to, so on a page that sets none, a customer's own website
19357
+ * among them, the UI stays light.
19358
+ *
19359
+ * The accent reads the page's accent roles (`--hd-accent*`, which the portal's
19360
+ * root sets to the pairing its scheme paints), else the light pairing the
19361
+ * element it paints in carries (`--hd-light-accent*`: the SDK's launcher,
19362
+ * panel, form container and modal each carry the desk's), else the light
19363
+ * half of brand-color.js' DEFAULT_PAIRINGS, the pairing a desk without a
19364
+ * brand color takes.
19365
+ *
19366
+ * BROWSER-SAFE: data only; imports only brand-color.js.
19367
+ */
19368
+
19369
+
19370
+ /**
19371
+ * The light value of each design-system token a role falls back to, keyed by
19372
+ * that token (tests/help-desk-colors.test.js holds each to
19373
+ * packages/design-system/tokens). The canvas tone and the ink are
19374
+ * brand-color.js' mirrors of those tokens.
19375
+ */
19376
+ const HELP_DESK_LIGHT_COLORS = Object.freeze({
19377
+ '--surface': '#ffffff',
19378
+ '--canvas': CANVAS_COLOR,
19379
+ '--color-slate-100': '#f0f5f7',
19380
+ '--color-slate-200': '#e0e9ed',
19381
+ '--color-slate-300': '#c9d6dc',
19382
+ '--ink': INK_COLOR,
19383
+ '--text-body': '#425761',
19384
+ '--text-muted': '#5e757f',
19385
+ '--color-action-bg': '#eef4fe',
19386
+ '--color-error': '#b02b27'
19387
+ });
19388
+
19389
+ const LIGHT = HELP_DESK_LIGHT_COLORS;
19390
+
19391
+ /** The default pairings (DEFAULT_PAIRINGS) as the properties an element carries, written as colors: a page that declares none of the design system's tokens reads them. */
19392
+ const DEFAULT = accentProperties(DEFAULT_PAIRINGS, 'colors');
19393
+
19394
+ /** The neutral and error roles, each the page's `--hd-*` role, else its light value. */
19395
+ const HELP_DESK_COLORS = Object.freeze({
19396
+ /** A panel and its cards. */
19397
+ surface: `var(--hd-surface,${LIGHT['--surface']})`,
19398
+ /** A field's ground. */
19399
+ field: `var(--hd-field,${LIGHT['--surface']})`,
19400
+ /** A quiet ground: a question's recap, a note, code, a disabled field. */
19401
+ canvas: `var(--hd-canvas,${LIGHT['--canvas']})`,
19402
+ /** A raised row or control under the pointer. */
19403
+ hover: `var(--hd-hover,${LIGHT['--canvas']})`,
19404
+ /** An icon control under the pointer, and the quietest rules. */
19405
+ fill: `var(--hd-fill,${LIGHT['--color-slate-100']})`,
19406
+ /** Rules and edges. */
19407
+ fillStrong: `var(--hd-fill-strong,${LIGHT['--color-slate-200']})`,
19408
+ /** A field's and a secondary action's edge. */
19409
+ lineStrong: `var(--hd-line-strong,${LIGHT['--color-slate-300']})`,
19410
+ ink: `var(--hd-ink,${LIGHT['--ink']})`,
19411
+ body: `var(--hd-text-body,${LIGHT['--text-body']})`,
19412
+ muted: `var(--hd-text-muted,${LIGHT['--text-muted']})`,
19413
+ /** Selected text, and the composer's drop prompt. */
19414
+ selection: `var(--hd-selection,${LIGHT['--color-action-bg']})`,
19415
+ error: `var(--hd-error,${LIGHT['--color-error']})`
19416
+ });
19417
+
19418
+ /** The accent roles: the fill of a primary action, the text on it, the accent as text, and the fill under the pointer. */
19419
+ const HELP_DESK_ACCENT = Object.freeze({
19420
+ fill: `var(--hd-accent,var(--hd-light-accent,${DEFAULT['--hd-light-accent']}))`,
19421
+ onAccent: `var(--hd-on-accent,var(--hd-light-on-accent,${DEFAULT['--hd-light-on-accent']}))`,
19422
+ ink: `var(--hd-accent-ink,var(--hd-light-accent-ink,${DEFAULT['--hd-light-accent-ink']}))`,
19423
+ hover: `var(--hd-accent-hover,var(--hd-light-accent-hover,${DEFAULT['--hd-light-accent-hover']}))`
19424
+ });
19425
+
19426
+ /** The focus ring's color: the page's `--hd-focus` where it sets one, else the accent as text. */
19427
+ const HELP_DESK_FOCUS = `var(--hd-focus,${HELP_DESK_ACCENT.ink})`;
19428
+
19429
+ /**
19430
+ * Both schemes' pairings as the custom properties an element carries them
19431
+ * under (@sparkvault/app-sdk/brand-color accentProperties: `--hd-light-accent*`,
19432
+ * `--hd-dark-accent*`), written as colors, since a customer's website declares
19433
+ * none of the design system's tokens.
19434
+ */
19435
+ function pairingProperties(pairings) {
19436
+ return Object.freeze(accentProperties(pairings, 'colors'));
19437
+ }
19438
+ /** The default pairings (@sparkvault/app-sdk/brand-color DEFAULT_PAIRINGS) as the custom properties, every one an element can carry. */
19439
+ const DEFAULT_PROPERTIES = pairingProperties(DEFAULT_PAIRINGS);
19440
+ /**
19441
+ * The default pairings (@sparkvault/app-sdk/brand-color DEFAULT_PAIRINGS, the
19442
+ * ones the customer portal, the console's sample and the desk's email paint
19443
+ * for a desk without a brand color) as stylesheet declarations, which a
19444
+ * desk's brand color replaces (applySupportBrand). The launcher, the support
19445
+ * panel, the request form's container and its modal each carry them, so the
19446
+ * accent roles (@sparkvault/app-sdk/help-desk-colors HELP_DESK_ACCENT) read
19447
+ * the light pairing the element carries, and a website may point those roles
19448
+ * at the dark one.
19449
+ */
19450
+ const DEFAULT_PAIRING_DECLARATIONS = Object.entries(DEFAULT_PROPERTIES).map(([name, value]) => `${name}:${value}`).join(';');
19451
+ const NO_BRAND = Object.freeze({ color: null, properties: null });
19452
+ /**
19453
+ * Pairs a desk's brand color for every carrier, once: both of its pairings
19454
+ * (@sparkvault/app-sdk/brand-color schemePairings, the ones the customer
19455
+ * portal and the desk's email paint too), under each scheme's names: the
19456
+ * fill, white or the ink on it, the accent as text, and the fill under the
19457
+ * pointer. Whoever learns the desk's color derives it and hands the one brand
19458
+ * to each element it paints (applySupportBrand), so a desk's color is paired
19459
+ * once however often its elements render. A value that is no brand color is
19460
+ * none.
19461
+ */
19462
+ function supportBrand(value) {
19463
+ const color = brandColor(value);
19464
+ const pairings = color === null ? null : schemePairings(color);
19465
+ return pairings ? Object.freeze({ color, properties: pairingProperties(pairings) }) : NO_BRAND;
19466
+ }
19467
+ /**
19468
+ * The brand for a desk's color: `held` where it pairs that same color, so a
19469
+ * color learned again (a held desk's, then connect's answer for it) is paired
19470
+ * once and stays the one object every element compares.
19471
+ */
19472
+ function brandFor(value, held) {
19473
+ return brandColor(value) === held.color ? held : supportBrand(value);
19474
+ }
19475
+ /**
19476
+ * Sets a desk's brand (supportBrand) on the launcher, the support panel, the
19477
+ * request form's container or the form's modal. The stylesheet paints the
19478
+ * light pairing wherever the accent roles (`--hd-accent*`) are not set, so on
19479
+ * a website the widget's accent is the pairing the portal paints on light
19480
+ * pages until the page points the roles at the dark pairing, and inside the
19481
+ * customer portal each takes the portal's roles. Scoped to the element, so it
19482
+ * works on a hosted page and on any website the widget stands on; a brand
19483
+ * with no color clears them, and the stylesheet's default pairings return.
19484
+ */
19485
+ function applySupportBrand(target, brand) {
19486
+ for (const name of Object.keys(DEFAULT_PROPERTIES)) {
19487
+ const value = brand.properties?.[name];
19488
+ if (value)
19489
+ target.style.setProperty(name, value);
19490
+ else
19491
+ target.style.removeProperty(name);
19492
+ }
19493
+ }
19494
+
19495
+ /**
19496
+ * Scoped styles for the optional inline help desk form and its modal, in the
19497
+ * help desk's color roles (@sparkvault/app-sdk/help-desk-colors): their
19498
+ * neutrals the page's roles where it sets them (HOST), their accent the
19499
+ * page's accent roles, else the desk's light pairing, which the form's
19500
+ * container and the modal each carry (ACCENT, DEFAULT_PAIRING_DECLARATIONS),
19501
+ * as the support panel does.
19502
+ */
18853
19503
  function injectHelpDeskFormStyles() {
18854
19504
  if (document.getElementById('sparkvault-help-desk-styles'))
18855
19505
  return;
@@ -18858,33 +19508,33 @@ function injectHelpDeskFormStyles() {
18858
19508
  style.textContent = `
18859
19509
  .svhd-overlay{position:fixed;inset:0;z-index:2147483000;display:flex;align-items:center;justify-content:center;padding:16px;background:${DS.modalOverlay};overflow:auto}
18860
19510
  .svhd-blur{backdrop-filter:blur(5px)}
18861
- .svhd-modal{width:100%;max-width:36rem;max-height:calc(100dvh - 32px);overflow:auto;border-radius:12px;background:${DS.white};box-shadow:${DS.shadowPopover}}
19511
+ .svhd-modal{width:100%;max-width:36rem;max-height:calc(100dvh - 32px);overflow:auto;border-radius:12px;background:${HELP_DESK_COLORS.surface};box-shadow:${DS.shadowPopover};${DEFAULT_PAIRING_DECLARATIONS}}
18862
19512
  .svhd-modal-header{display:flex;justify-content:flex-end;padding:12px 16px 0}
18863
- .svhd-modal-close{border:0;border-radius:4px;background:transparent;color:${DS.slate600};cursor:pointer;font:600 14px/1.5 system-ui,sans-serif;padding:6px 8px;min-height:44px}
18864
- .svhd-modal-close:hover{color:${DS.slate900}}
18865
- .svhd-modal-close:focus-visible{outline:3px solid ${DS.action};outline-offset:2px}
19513
+ .svhd-modal-close{border:0;border-radius:4px;background:transparent;color:${HELP_DESK_COLORS.body};cursor:pointer;font:600 14px/1.5 system-ui,sans-serif;padding:6px 8px;min-height:44px}
19514
+ .svhd-modal-close:hover{color:${HELP_DESK_COLORS.ink}}
19515
+ .svhd-modal-close:focus-visible{outline:3px solid ${HELP_DESK_FOCUS};outline-offset:2px}
18866
19516
  .svhd-modal .svhd-container{max-width:none;border:0;border-radius:0;padding-top:8px}
18867
- .svhd-container{box-sizing:border-box;max-width:36rem;border:1px solid ${DS.slate200};border-radius:12px;background:${DS.white};color:${DS.slate900};font:400 15px/1.5 system-ui,sans-serif;padding:24px}
19517
+ .svhd-container{box-sizing:border-box;max-width:36rem;border:1px solid ${HELP_DESK_COLORS.fillStrong};border-radius:12px;background:${HELP_DESK_COLORS.surface};color:${HELP_DESK_COLORS.ink};font:400 15px/1.5 system-ui,sans-serif;padding:24px;${DEFAULT_PAIRING_DECLARATIONS}}
18868
19518
  .svhd-container *{box-sizing:border-box}
18869
19519
  .svhd-container h2{font-size:22px;line-height:1.25;margin:0}
18870
19520
  .svhd-step-head h2:focus{outline:none}
18871
19521
  .svhd-form{display:grid;gap:16px}
18872
19522
  .svhd-field{display:grid;gap:6px}
18873
19523
  .svhd-label{font-weight:600}
18874
- .svhd-input{width:100%;border:1px solid ${DS.slate300};border-radius:6px;padding:10px 12px;color:${DS.slate900};background:${DS.white};font:inherit;font-size:16px}
18875
- .svhd-input:focus-visible,.svhd-button:focus-visible,.svhd-link:focus-visible{outline:3px solid ${DS.action};outline-offset:2px}
18876
- .svhd-input:disabled{background:${DS.slate50}}
19524
+ .svhd-input{width:100%;border:1px solid ${HELP_DESK_COLORS.lineStrong};border-radius:6px;padding:10px 12px;color:${HELP_DESK_COLORS.ink};background:${HELP_DESK_COLORS.field};font:inherit;font-size:16px}
19525
+ .svhd-input:focus-visible,.svhd-button:focus-visible,.svhd-link:focus-visible{outline:3px solid ${HELP_DESK_FOCUS};outline-offset:2px}
19526
+ .svhd-input:disabled{background:${HELP_DESK_COLORS.canvas}}
18877
19527
  .svhd-auth{display:grid;gap:16px;border:0;padding:0;margin:0}
18878
19528
  .svhd-form[hidden],.svhd-step[hidden],.svhd-auth[hidden],.svhd-field[hidden],.svhd-field-error[hidden],.svhd-status[hidden],.svhd-link[hidden],.svhd-actions[hidden],.svhd-confirm[hidden],.svhd-widget-account[hidden],.svhd-text-button[hidden]{display:none}
18879
19529
  .svhd-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
18880
- .svhd-button{border:0;border-radius:6px;padding:10px 16px;min-height:44px;font:600 15px/1.5 system-ui,sans-serif;background:${DS.action};color:${DS.white};cursor:pointer}
18881
- .svhd-button:hover{background:${DS.actionHover}}
19530
+ .svhd-button{border:0;border-radius:6px;padding:10px 16px;min-height:44px;font:600 15px/1.5 system-ui,sans-serif;background:${HELP_DESK_ACCENT.fill};color:${HELP_DESK_ACCENT.onAccent};cursor:pointer}
19531
+ .svhd-button:hover{background:${HELP_DESK_ACCENT.hover}}
18882
19532
  .svhd-button:disabled{opacity:.6;cursor:default}
18883
- .svhd-secondary{background:transparent;color:${DS.slate600};padding:10px 4px}
18884
- .svhd-secondary:hover{background:transparent;color:${DS.slate900}}
18885
- .svhd-status{margin:0;color:${DS.slate600}}
18886
- .svhd-error{color:${DS.error}}
18887
- .svhd-field-error{margin:0;font-size:14px;color:${DS.error}}
19533
+ .svhd-secondary{background:transparent;color:${HELP_DESK_COLORS.body};padding:10px 4px}
19534
+ .svhd-secondary:hover{background:transparent;color:${HELP_DESK_COLORS.ink}}
19535
+ .svhd-status{margin:0;color:${HELP_DESK_COLORS.body}}
19536
+ .svhd-error{color:${HELP_DESK_COLORS.error}}
19537
+ .svhd-field-error{margin:0;font-size:14px;color:${HELP_DESK_COLORS.error}}
18888
19538
  .svhd-code-links{display:flex;flex-wrap:wrap;gap:4px 16px}
18889
19539
  .svhd-confirm{display:grid;gap:8px}
18890
19540
  .svhd-confirm-title{font-weight:600;margin:0}
@@ -18892,26 +19542,26 @@ function injectHelpDeskFormStyles() {
18892
19542
  .svhd-done-title{font-size:18px;line-height:1.3;margin:0}
18893
19543
  .svhd-done-title:focus{outline:none}
18894
19544
  .svhd-confirmation-message{white-space:pre-wrap;overflow-wrap:anywhere}
18895
- .svhd-link{display:inline-flex;align-items:center;justify-self:start;min-height:44px;color:${DS.action};text-decoration:underline}
18896
- .svhd-hint{font-size:13px;color:${DS.slate600};margin:0}
19545
+ .svhd-link{display:inline-flex;align-items:center;justify-self:start;min-height:44px;color:${HELP_DESK_ACCENT.ink};text-decoration:underline}
19546
+ .svhd-hint{font-size:13px;color:${HELP_DESK_COLORS.body};margin:0}
18897
19547
  .svhd-step{display:grid;gap:16px;min-width:0}
18898
19548
  .svhd-step-head{display:grid;gap:4px;margin-bottom:4px}
18899
- .svhd-step-label{margin:0;font-size:13px;font-weight:600;line-height:1.4;color:${DS.slate600}}
18900
- .svhd-text-button{display:inline-flex;align-items:center;min-height:44px;padding:0 4px;border:0;border-radius:6px;background:transparent;color:${DS.action};font:inherit;font-size:14px;font-weight:600;text-decoration:underline;text-underline-offset:2px;cursor:pointer}
18901
- .svhd-text-button:hover{color:${DS.actionHover}}
18902
- .svhd-text-button:focus-visible{outline:3px solid ${DS.action};outline-offset:2px}
18903
- .svhd-text-button:disabled{color:${DS.slate500};cursor:default}
19549
+ .svhd-step-label{margin:0;font-size:13px;font-weight:600;line-height:1.4;color:${HELP_DESK_COLORS.body}}
19550
+ .svhd-text-button{display:inline-flex;align-items:center;min-height:44px;padding:0 4px;border:0;border-radius:6px;background:transparent;color:${HELP_DESK_ACCENT.ink};font:inherit;font-size:14px;font-weight:600;text-decoration:underline;text-underline-offset:2px;cursor:pointer}
19551
+ .svhd-text-button:not(:disabled):hover{text-decoration-thickness:2px}
19552
+ .svhd-text-button:focus-visible{outline:3px solid ${HELP_DESK_FOCUS};outline-offset:2px}
19553
+ .svhd-text-button:disabled{color:${HELP_DESK_COLORS.muted};cursor:default}
18904
19554
  .svhd-widget-account{display:flex;align-items:center;flex-wrap:wrap;gap:0 16px;min-width:0}
18905
- .svhd-posting-as{margin:0;color:${DS.slate600};font-size:14px;line-height:1.5;overflow-wrap:anywhere}
18906
- .svhd-note{display:flex;align-items:flex-start;gap:10px;margin:0;padding:12px 14px;border:1px solid ${DS.slate200};border-radius:8px;background:${DS.slate50};color:${DS.slate900};font-size:14px;line-height:1.5}
18907
- .svhd-step .svhd-note svg{display:block;width:18px;height:18px;flex:none;margin-top:2px;color:${DS.action}}
18908
- .svhd-recap{display:flex;align-items:center;gap:12px;padding:6px 6px 6px 14px;border:1px solid ${DS.slate200};border-radius:8px}
19555
+ .svhd-posting-as{margin:0;color:${HELP_DESK_COLORS.body};font-size:14px;line-height:1.5;overflow-wrap:anywhere}
19556
+ .svhd-note{display:flex;align-items:flex-start;gap:10px;margin:0;padding:12px 14px;border:1px solid ${HELP_DESK_COLORS.fillStrong};border-radius:8px;background:${HELP_DESK_COLORS.canvas};color:${HELP_DESK_COLORS.ink};font-size:14px;line-height:1.5}
19557
+ .svhd-step .svhd-note svg{display:block;width:18px;height:18px;flex:none;margin-top:2px;color:${HELP_DESK_ACCENT.ink}}
19558
+ .svhd-recap{display:flex;align-items:center;gap:12px;padding:6px 6px 6px 14px;border:1px solid ${HELP_DESK_COLORS.fillStrong};border-radius:8px}
18909
19559
  .svhd-recap-request{flex:1;min-width:0}
18910
- .svhd-recap-label{display:block;color:${DS.slate600};font-size:12px;font-weight:600;line-height:1.4}
18911
- .svhd-recap-text{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0;color:${DS.slate900};font-size:14px;line-height:1.5;overflow-wrap:anywhere}
19560
+ .svhd-recap-label{display:block;color:${HELP_DESK_COLORS.body};font-size:12px;font-weight:600;line-height:1.4}
19561
+ .svhd-recap-text{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0;color:${HELP_DESK_COLORS.ink};font-size:14px;line-height:1.5;overflow-wrap:anywhere}
18912
19562
  .svhd-recap .svhd-text-button{flex:none}
18913
19563
  .svhd-live{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
18914
- .svhd-footer{margin-top:20px;font-size:12px;color:${DS.slate500}}
19564
+ .svhd-footer{margin-top:20px;font-size:12px;color:${HELP_DESK_COLORS.muted}}
18915
19565
  `;
18916
19566
  document.head.appendChild(style);
18917
19567
  }
@@ -19530,123 +20180,6 @@ function refusalCopy(refusal, maxBytes) {
19530
20180
  return REFUSAL_COPY[refusal] ?? "This file can't be attached.";
19531
20181
  }
19532
20182
 
19533
- /**
19534
- * A tenant's brand color and the WCAG contrast rules that decide how it may be
19535
- * used: the one hex rule the server stores, the console checks and the portal
19536
- * paints, the one contrast reading the console's readouts, the portal's
19537
- * accent and the portal's reading of a help center's ground share, and the
19538
- * one way a readout writes that reading.
19539
- *
19540
- * A brand color is tenant-controlled, so it is used only when it is a
19541
- * six-digit hex color, read case-insensitively and held in lowercase; anything
19542
- * else (a color name, a CSS function, a value that runs on into more CSS) is
19543
- * no color at all.
19544
- *
19545
- * A brand color can be any lightness, so whatever shows it picks what goes
19546
- * with it: white or ink as the text on its fill, whichever reads more
19547
- * strongly (at least 4.2:1 on any fill, as far as two inks reach on a
19548
- * mid-tone), and the color itself as text only where it reaches 4.5:1 on
19549
- * both grounds accent text stands on, the white surface and the canvas
19550
- * tone, ink otherwise. accentProperties says that as the accent
19551
- * custom properties the customer portal paints with and the console's sample
19552
- * of it shows, in the design system's own tokens.
19553
- *
19554
- * BROWSER-SAFE: data only, no imports.
19555
- */
19556
-
19557
- const HEX_COLOR = /^#[0-9a-f]{6}$/;
19558
-
19559
- /** WCAG AA's floor for normal-size text. */
19560
- const AA_TEXT_CONTRAST = 4.5;
19561
-
19562
- /**
19563
- * The canvas tone, the design system's `--canvas` (`--color-slate-50`): the
19564
- * page ground the customer portal (its pages and a customer's own messages)
19565
- * and the knowledge base's default theme set accent text on, beside the white
19566
- * surface. The design system publishes its tokens only as CSS, which this
19567
- * import-free module cannot read, so the value is mirrored here once, and
19568
- * tests/brand-color.test.js holds it to packages/design-system/tokens/colors.css.
19569
- */
19570
- const CANVAS_COLOR = '#f7fafb';
19571
-
19572
- /**
19573
- * The ink, the design system's `--ink` (`--color-slate-900`): the dark text a
19574
- * pairing paints on a fill and in place of a color too light to stand as
19575
- * text. Mirrored here once for the same reason as CANVAS_COLOR, and held to
19576
- * packages/design-system/tokens/colors.css by tests/brand-color.test.js.
19577
- */
19578
- const INK_COLOR = '#0d1a20';
19579
-
19580
- /** Relative luminance (WCAG 2) of an sRGB color's red, green and blue channels, each from 0 to 1. */
19581
- function channelLuminance(channels) {
19582
- const [red, green, blue] = channels.map((channel) => (channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4));
19583
- return 0.2126 * red + 0.7152 * green + 0.0722 * blue;
19584
- }
19585
-
19586
- /** Relative luminance (WCAG 2) of a validated `#rrggbb` color. */
19587
- function relativeLuminance(color) {
19588
- return channelLuminance([1, 3, 5].map((offset) => Number.parseInt(color.slice(offset, offset + 2), 16) / 255));
19589
- }
19590
-
19591
- /** The contrast ratio of two relative luminances. */
19592
- function contrastRatio(first, second) {
19593
- return (Math.max(first, second) + 0.05) / (Math.min(first, second) + 0.05);
19594
- }
19595
-
19596
- /** The relative luminance of the ink a fill's text is weighed in, the real ink rather than pure black. */
19597
- const INK_LUMINANCE = relativeLuminance(INK_COLOR);
19598
-
19599
- /** The relative luminances of the grounds accent text stands on: the white surface and the canvas tone. */
19600
- const TEXT_GROUNDS = Object.freeze([1, relativeLuminance(CANVAS_COLOR)]);
19601
-
19602
- /** How strongly a color of this luminance reads as text on the ground it reads least on. */
19603
- function textContrast(luminance) {
19604
- return Math.min(...TEXT_GROUNDS.map((ground) => contrastRatio(luminance, ground)));
19605
- }
19606
-
19607
- /**
19608
- * A brand color as it may be stored and shown, or null when the value is not
19609
- * one: a `#rrggbb` hex value, read case-insensitively.
19610
- *
19611
- * @param {unknown} value
19612
- * @returns {string|null} The color in lowercase
19613
- */
19614
- function brandColor(value) {
19615
- if (typeof value !== 'string') return null;
19616
- const color = value.toLowerCase();
19617
- return HEX_COLOR.test(color) ? color : null;
19618
- }
19619
-
19620
- /**
19621
- * What goes with a brand color: the text on its fill (white or ink,
19622
- * whichever reads more strongly, at least 4.2:1 on any fill) and the ink for
19623
- * it as text
19624
- * (the color itself where it reaches AA_TEXT_CONTRAST on both the white
19625
- * surface and the canvas tone, ink otherwise).
19626
- *
19627
- * @param {unknown} value
19628
- * @returns {{ onAccent: 'white'|'ink', accentInk: 'accent'|'ink', ratio: number }|null} Null when the value is not a brand color; `ratio` is its contrast as text (accentTextContrast)
19629
- */
19630
- function accentPairing(value) {
19631
- const color = brandColor(value);
19632
- if (!color) return null;
19633
- const luminance = relativeLuminance(color);
19634
- const ratio = textContrast(luminance);
19635
- return {
19636
- onAccent: contrastRatio(luminance, 1) >= contrastRatio(luminance, INK_LUMINANCE) ? 'white' : 'ink',
19637
- accentInk: ratio >= AA_TEXT_CONTRAST ? 'accent' : 'ink',
19638
- ratio
19639
- };
19640
- }
19641
-
19642
- /** Contrast between a brand fill and the label selected by accentPairing. */
19643
- function accentFillContrast(value) {
19644
- const color = brandColor(value);
19645
- if (!color) return null;
19646
- const pairing = accentPairing(color);
19647
- return contrastRatio(relativeLuminance(color), pairing.onAccent === 'white' ? 1 : INK_LUMINANCE);
19648
- }
19649
-
19650
20183
  /**
19651
20184
  * Files brought to a message's composer by drag, drop and paste, handled
19652
20185
  * alike by every composer that takes them: the console's reply composer and
@@ -19930,11 +20463,14 @@ function helpDeskIcon(name) {
19930
20463
  * and whether trying again can mend it.
19931
20464
  *
19932
20465
  * The composer draws its own stylesheet (one unlayered `<style>` per
19933
- * document), in the design system's colors with the help desk's accent
19934
- * (`--hd-accent-ink`) where the host sets one. Its focus ring is the one the
19935
- * host's fields wear: its color, width and offset are the host's
19936
- * `--hd-focus`, `--hd-focus-width` and `--hd-focus-offset`, else the SDK's
19937
- * field ring (Action Blue, 3px, 2px out).
20466
+ * document), in the help desk's color roles (help-desk-colors.js): the
20467
+ * host's where it sets them, else the design system's light values, with the
20468
+ * help desk's accent as text, the light pairing of the SDK's panel, form
20469
+ * container or modal it stands in where the host sets no accent role. Its
20470
+ * focus ring is the one the host's fields wear: its color, width and offset
20471
+ * are the host's `--hd-focus`, `--hd-focus-width` and `--hd-focus-offset`,
20472
+ * the color else that accent, the width and offset else the SDK's field
20473
+ * ring's (3px, 2px out).
19938
20474
  *
19939
20475
  * BROWSER-SAFE: builds its DOM through the page's `document`, and imports
19940
20476
  * only app-sdk's browser-safe modules.
@@ -19944,34 +20480,11 @@ function helpDeskIcon(name) {
19944
20480
  /** The id of the composer's one `<style>` element in a document. */
19945
20481
  const HELP_DESK_COMPOSER_STYLE_ID = 'sparkvault-help-desk-composer-styles';
19946
20482
 
19947
- /**
19948
- * The design-system colors the composer is drawn in, each the value of the
19949
- * token it names (tests/help-desk-composer.test.js holds them to
19950
- * packages/design-system/tokens). The canvas tone and the ink are
19951
- * brand-color.js' mirrors of those tokens.
19952
- */
19953
- const COMPOSER_COLORS = Object.freeze({
19954
- '--color-white': '#ffffff',
19955
- '--canvas': CANVAS_COLOR,
19956
- '--color-slate-100': '#f0f5f7',
19957
- '--color-slate-200': '#e0e9ed',
19958
- '--color-slate-300': '#c9d6dc',
19959
- '--color-slate-600': '#425761',
19960
- '--ink': INK_COLOR,
19961
- '--color-action': '#216bde',
19962
- '--color-action-bg': '#eef4fe',
19963
- '--color-error': '#b02b27'
19964
- });
19965
-
19966
- const C = COMPOSER_COLORS;
19967
- /** The help desk's accent ink where the host sets one, Action Blue where none does. */
19968
- const ACCENT_INK = `var(--hd-accent-ink,${C['--color-action']})`;
19969
- /** The focus ring of the host's fields: the SDK's field ring (`.svhd-input`) where the host sets none. */
19970
- const FOCUS = `var(--hd-focus,${C['--color-action']})`;
20483
+ /** The focus ring's width and offset: the host's where it sets them, else the SDK's field ring (`.svhd-input`). */
19971
20484
  const FOCUS_WIDTH = 'var(--hd-focus-width,3px)';
19972
20485
  const FOCUS_OFFSET = 'var(--hd-focus-offset,2px)';
19973
20486
  /** A control inside the frame wears the ring within its own hit area. */
19974
- const INSET_RING = `outline:${FOCUS_WIDTH} solid ${FOCUS};outline-offset:calc(-1 * ${FOCUS_WIDTH});box-shadow:none`;
20487
+ const INSET_RING = `outline:${FOCUS_WIDTH} solid ${HELP_DESK_FOCUS};outline-offset:calc(-1 * ${FOCUS_WIDTH});box-shadow:none`;
19975
20488
 
19976
20489
  /**
19977
20490
  * The composer's stylesheet. Every rule but the notice's sits under
@@ -19981,41 +20494,41 @@ const INSET_RING = `outline:${FOCUS_WIDTH} solid ${FOCUS};outline-offset:calc(-1
19981
20494
  */
19982
20495
  const COMPOSER_CSS = `
19983
20496
  .svhd-composer,.svhd-composer *{box-sizing:border-box}
19984
- .svhd-composer{position:relative;display:flex;flex-direction:column;min-width:0;border:1px solid ${C['--color-slate-300']};border-radius:6px;background:${C['--color-white']};color:${C['--ink']}}
19985
- .svhd-composer:has(.svhd-composer-input:focus-visible){outline:${FOCUS_WIDTH} solid ${FOCUS};outline-offset:${FOCUS_OFFSET}}
19986
- @supports not selector(:has(*)){.svhd-composer:focus-within{outline:${FOCUS_WIDTH} solid ${FOCUS};outline-offset:${FOCUS_OFFSET}}}
19987
- .svhd-composer:has(.svhd-composer-input[aria-invalid=true]){border-color:${C['--color-error']}}
19988
- .svhd-composer.svhd-composer-dragging{border-style:dashed;border-color:${ACCENT_INK}}
19989
- .svhd-composer .svhd-composer-input{display:block;width:100%;min-height:140px;margin:0;resize:vertical;border:0;border-radius:6px 6px 0 0;padding:10px 12px;background:transparent;color:${C['--ink']};font-family:inherit;font-size:16px;line-height:1.5}
20497
+ .svhd-composer{position:relative;display:flex;flex-direction:column;min-width:0;border:1px solid ${HELP_DESK_COLORS.lineStrong};border-radius:6px;background:${HELP_DESK_COLORS.field};color:${HELP_DESK_COLORS.ink}}
20498
+ .svhd-composer:has(.svhd-composer-input:focus-visible){outline:${FOCUS_WIDTH} solid ${HELP_DESK_FOCUS};outline-offset:${FOCUS_OFFSET}}
20499
+ @supports not selector(:has(*)){.svhd-composer:focus-within{outline:${FOCUS_WIDTH} solid ${HELP_DESK_FOCUS};outline-offset:${FOCUS_OFFSET}}}
20500
+ .svhd-composer:has(.svhd-composer-input[aria-invalid=true]){border-color:${HELP_DESK_COLORS.error}}
20501
+ .svhd-composer.svhd-composer-dragging{border-style:dashed;border-color:${HELP_DESK_ACCENT.ink}}
20502
+ .svhd-composer .svhd-composer-input{display:block;width:100%;min-height:140px;margin:0;resize:vertical;border:0;border-radius:6px 6px 0 0;padding:10px 12px;background:transparent;color:${HELP_DESK_COLORS.ink};font-family:inherit;font-size:16px;line-height:1.5}
19990
20503
  .svhd-composer .svhd-composer-input:focus,.svhd-composer .svhd-composer-input:focus-visible{outline:none;box-shadow:none}
19991
- .svhd-composer .svhd-composer-input:disabled{background:${C['--canvas']}}
19992
- .svhd-composer .svhd-composer-drop{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;margin:0;padding:12px;border-radius:5px;background:${C['--color-action-bg']};color:${ACCENT_INK};font-size:15px;font-weight:600;line-height:1.4;text-align:center;pointer-events:none}
19993
- .svhd-composer .svhd-composer-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:0 4px;padding:0 4px;border-top:1px solid ${C['--color-slate-200']}}
19994
- .svhd-composer .svhd-composer-attach{display:inline-flex;align-items:center;gap:6px;min-height:44px;margin:0;padding:0 8px;border:0;border-radius:6px;background:transparent;color:${C['--color-slate-600']};font-family:inherit;font-size:14px;font-weight:600;line-height:1.4;cursor:pointer}
19995
- .svhd-composer .svhd-composer-attach:hover,.svhd-composer .svhd-composer-help:hover{background:${C['--color-slate-100']};color:${C['--ink']}}
20504
+ .svhd-composer .svhd-composer-input:disabled{background:${HELP_DESK_COLORS.canvas}}
20505
+ .svhd-composer .svhd-composer-drop{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;margin:0;padding:12px;border-radius:5px;background:${HELP_DESK_COLORS.selection};color:${HELP_DESK_ACCENT.ink};font-size:15px;font-weight:600;line-height:1.4;text-align:center;pointer-events:none}
20506
+ .svhd-composer .svhd-composer-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:0 4px;padding:0 4px;border-top:1px solid ${HELP_DESK_COLORS.fillStrong}}
20507
+ .svhd-composer .svhd-composer-attach{display:inline-flex;align-items:center;gap:6px;min-height:44px;margin:0;padding:0 8px;border:0;border-radius:6px;background:transparent;color:${HELP_DESK_COLORS.body};font-family:inherit;font-size:14px;font-weight:600;line-height:1.4;cursor:pointer}
20508
+ .svhd-composer .svhd-composer-attach:hover,.svhd-composer .svhd-composer-help:hover{background:${HELP_DESK_COLORS.fill};color:${HELP_DESK_COLORS.ink}}
19996
20509
  .svhd-composer .svhd-composer-attach:disabled{opacity:.6;cursor:default}
19997
20510
  .svhd-composer .svhd-composer-attach svg{display:block;width:18px;height:18px}
19998
- .svhd-composer .svhd-composer-help{display:inline-grid;place-items:center;width:44px;height:44px;margin:0;padding:0;border:0;border-radius:6px;background:transparent;color:${C['--color-slate-600']};font-family:inherit;cursor:pointer}
20511
+ .svhd-composer .svhd-composer-help{display:inline-grid;place-items:center;width:44px;height:44px;margin:0;padding:0;border:0;border-radius:6px;background:transparent;color:${HELP_DESK_COLORS.body};font-family:inherit;cursor:pointer}
19999
20512
  .svhd-composer .svhd-composer-help-glyph{display:inline-grid;place-items:center;width:20px;height:20px;border:1px solid currentColor;border-radius:50%;font-size:13px;font-weight:600;line-height:1}
20000
- .svhd-composer .svhd-composer-help-panel{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:8px;align-items:start;flex:1 1 100%;min-width:0;margin:0 0 8px;padding:10px 12px;border:1px solid ${C['--color-slate-200']};border-radius:6px;background:${C['--canvas']};color:${C['--color-slate-600']};font-size:13px;line-height:1.5}
20513
+ .svhd-composer .svhd-composer-help-panel{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:8px;align-items:start;flex:1 1 100%;min-width:0;margin:0 0 8px;padding:10px 12px;border:1px solid ${HELP_DESK_COLORS.fillStrong};border-radius:6px;background:${HELP_DESK_COLORS.canvas};color:${HELP_DESK_COLORS.body};font-size:13px;line-height:1.5}
20001
20514
  .svhd-composer .svhd-composer-help-copy{grid-column:1;min-width:0;overflow-wrap:anywhere}
20002
20515
  .svhd-composer .svhd-composer-help-copy p{margin:0}
20003
20516
  .svhd-composer .svhd-composer-help-copy p+p{margin-top:6px}
20004
- .svhd-composer .svhd-composer-help-close{grid-row:1;grid-column:2;display:grid;place-items:center;width:44px;height:44px;margin:-10px -12px 0 0;padding:0;border:0;border-radius:6px;background:transparent;color:${C['--color-slate-600']};cursor:pointer}
20005
- .svhd-composer .svhd-composer-help-close:hover,.svhd-composer .svhd-attachment-remove:hover{background:${C['--color-slate-200']};color:${C['--ink']}}
20517
+ .svhd-composer .svhd-composer-help-close{grid-row:1;grid-column:2;display:grid;place-items:center;width:44px;height:44px;margin:-10px -12px 0 0;padding:0;border:0;border-radius:6px;background:transparent;color:${HELP_DESK_COLORS.body};cursor:pointer}
20518
+ .svhd-composer .svhd-composer-help-close:hover,.svhd-composer .svhd-attachment-remove:hover{background:${HELP_DESK_COLORS.fillStrong};color:${HELP_DESK_COLORS.ink}}
20006
20519
  .svhd-composer .svhd-composer-help-close svg,.svhd-composer .svhd-attachment-remove svg{display:block;width:16px;height:16px}
20007
- .svhd-composer .svhd-attachment-chips{display:flex;flex-wrap:wrap;gap:8px;list-style:none;margin:0;padding:8px;border-top:1px solid ${C['--color-slate-200']}}
20520
+ .svhd-composer .svhd-attachment-chips{display:flex;flex-wrap:wrap;gap:8px;list-style:none;margin:0;padding:8px;border-top:1px solid ${HELP_DESK_COLORS.fillStrong}}
20008
20521
  .svhd-composer .svhd-attachment-chips:empty{display:none}
20009
- .svhd-composer .svhd-attachment-chip{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;align-content:start;flex:0 1 280px;min-width:0;max-width:100%;margin:0;padding:0 0 8px 10px;border:1px solid ${C['--color-slate-200']};border-radius:6px;background:${C['--canvas']};font-size:13px;line-height:1.4}
20010
- .svhd-composer .svhd-attachment-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;color:${C['--ink']}}
20011
- .svhd-composer .svhd-attachment-status{grid-column:1;padding-right:8px;color:${C['--color-slate-600']};font-size:12px;overflow-wrap:anywhere}
20012
- .svhd-composer .svhd-attachment-status.svhd-composer-problem{color:${C['--color-error']}}
20013
- .svhd-composer .svhd-attachment-progress{grid-column:1/-1;width:calc(100% - 10px);height:6px;margin-top:6px;accent-color:${ACCENT_INK}}
20014
- .svhd-composer .svhd-attachment-remove{display:grid;place-items:center;width:44px;height:44px;min-height:44px;margin:0;padding:0;border:0;border-radius:6px;background:transparent;color:${C['--color-slate-600']};cursor:pointer}
20015
- .svhd-composer .svhd-attachment-retry{grid-column:2;min-height:44px;margin:0;padding:0 10px;border:0;border-radius:6px;background:transparent;color:${ACCENT_INK};font-family:inherit;font-size:13px;font-weight:600;line-height:1.4;text-decoration:underline;cursor:pointer}
20522
+ .svhd-composer .svhd-attachment-chip{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;align-content:start;flex:0 1 280px;min-width:0;max-width:100%;margin:0;padding:0 0 8px 10px;border:1px solid ${HELP_DESK_COLORS.fillStrong};border-radius:6px;background:${HELP_DESK_COLORS.canvas};font-size:13px;line-height:1.4}
20523
+ .svhd-composer .svhd-attachment-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;color:${HELP_DESK_COLORS.ink}}
20524
+ .svhd-composer .svhd-attachment-status{grid-column:1;padding-right:8px;color:${HELP_DESK_COLORS.body};font-size:12px;overflow-wrap:anywhere}
20525
+ .svhd-composer .svhd-attachment-status.svhd-composer-problem{color:${HELP_DESK_COLORS.error}}
20526
+ .svhd-composer .svhd-attachment-progress{grid-column:1/-1;width:calc(100% - 10px);height:6px;margin-top:6px;accent-color:${HELP_DESK_ACCENT.ink}}
20527
+ .svhd-composer .svhd-attachment-remove{display:grid;place-items:center;width:44px;height:44px;min-height:44px;margin:0;padding:0;border:0;border-radius:6px;background:transparent;color:${HELP_DESK_COLORS.body};cursor:pointer}
20528
+ .svhd-composer .svhd-attachment-retry{grid-column:2;min-height:44px;margin:0;padding:0 10px;border:0;border-radius:6px;background:transparent;color:${HELP_DESK_ACCENT.ink};font-family:inherit;font-size:13px;font-weight:600;line-height:1.4;text-decoration:underline;cursor:pointer}
20016
20529
  .svhd-composer .svhd-attachment-remove:disabled,.svhd-composer .svhd-attachment-retry:disabled{opacity:.6;cursor:default}
20017
20530
  .svhd-composer .svhd-composer-attach:focus-visible,.svhd-composer .svhd-composer-help:focus-visible,.svhd-composer .svhd-composer-help-close:focus-visible,.svhd-composer .svhd-attachment-remove:focus-visible,.svhd-composer .svhd-attachment-retry:focus-visible{${INSET_RING}}
20018
- .svhd-composer-notice{margin:0;color:${C['--color-error']};font-size:14px;line-height:1.5}
20531
+ .svhd-composer-notice{margin:0;color:${HELP_DESK_COLORS.error};font-size:14px;line-height:1.5}
20019
20532
  .svhd-composer [hidden],.svhd-composer-notice[hidden]{display:none!important}
20020
20533
  `;
20021
20534
 
@@ -20937,6 +21450,7 @@ function mountHelpDeskForm(client, options) {
20937
21450
  // The page that lays the support wizard out carries the attribution itself.
20938
21451
  footer: options.hostShowsAttribution ? null : createSecuredByFooter('svhd'),
20939
21452
  });
21453
+ applySupportBrand(shell.container, options.brand ?? supportBrand(client.desk.branding?.color));
20940
21454
  const prefix = `svhd-${++formSequence}`;
20941
21455
  const form = document.createElement('form');
20942
21456
  form.className = 'svhd-form';
@@ -22549,9 +23063,12 @@ function openHelpDeskForm(client, options = {}) {
22549
23063
  close.addEventListener('click', requestDismiss);
22550
23064
  header.append(title, close);
22551
23065
  const body = document.createElement('div');
23066
+ // Paired once for the modal and the form inside it.
23067
+ const brand = options.brand ?? supportBrand(client.desk.branding?.color);
23068
+ applySupportBrand(shell.modal, brand);
22552
23069
  shell.modal.append(header, body);
22553
23070
  try {
22554
- inner = mountHelpDeskForm(client, { ...options, target: body, onCancel: cancel });
23071
+ inner = mountHelpDeskForm(client, { ...options, brand, target: body, onCancel: cancel });
22555
23072
  // State observers run while the inner form mounts. They can dismiss the
22556
23073
  // shell before mountHelpDeskForm hands us its cleanup handle.
22557
23074
  if (destroyed)
@@ -24608,8 +25125,12 @@ function createSupportAnalytics({ deskId, post }) {
24608
25125
  }
24609
25126
 
24610
25127
  let launcherSequence = 0;
24611
- /** A convenience path only: it never owns a second support flow. */
24612
- function createSupportLauncher(options, open) {
25128
+ /**
25129
+ * A convenience path only: it never owns a second support flow. It carries
25130
+ * the desk's brand (`brand`, then setBrand), so its focus ring is the desk's,
25131
+ * as the panel's are.
25132
+ */
25133
+ function createSupportLauncher(options, brand, open) {
24613
25134
  const button = document.createElement('button');
24614
25135
  button.type = 'button';
24615
25136
  button.className = 'sv-support-launcher';
@@ -24618,7 +25139,7 @@ function createSupportLauncher(options, open) {
24618
25139
  button.setAttribute('aria-haspopup', 'dialog');
24619
25140
  button.setAttribute('aria-expanded', 'false');
24620
25141
  const offset = (value, fallback) => typeof value === 'number' && Number.isFinite(value) ? Math.min(240, Math.max(12, value)) : fallback;
24621
- button.style.cssText = `position:fixed;right:calc(${offset(options.right, 24)}px + env(safe-area-inset-right,0px));bottom:calc(${offset(options.bottom, 24)}px + env(safe-area-inset-bottom,0px));z-index:2147482800;width:56px;height:56px;border-radius:50%;border:1px solid ${withAlpha(DS.white, .22)};background:${DS.slate900};color:${DS.white};box-shadow:${DS.shadowPopover};display:grid;place-items:center;cursor:pointer;padding:0;overflow:hidden;`;
25142
+ button.style.cssText = `position:fixed;right:calc(${offset(options.right, 24)}px + env(safe-area-inset-right,0px));bottom:calc(${offset(options.bottom, 24)}px + env(safe-area-inset-bottom,0px));z-index:2147482800;width:56px;height:56px;border-radius:50%;border:1px solid ${withAlpha(DS.white, .22)};background:${DS.slate900};color:${DS.white};display:grid;place-items:center;cursor:pointer;padding:0;overflow:hidden;`;
24622
25143
  if (options.imageUrl) {
24623
25144
  let url;
24624
25145
  try {
@@ -24644,19 +25165,37 @@ function createSupportLauncher(options, open) {
24644
25165
  mark.style.cssText = 'display:grid;place-items:center;width:26px;height:26px;border:1.8px solid currentColor;border-radius:50%;font:600 20px/1 system-ui,sans-serif';
24645
25166
  button.append(mark);
24646
25167
  }
25168
+ applySupportBrand(button, brand);
24647
25169
  button.addEventListener('click', open);
24648
25170
  document.body.append(button);
24649
25171
  return {
24650
25172
  setExpanded(expanded) { button.setAttribute('aria-expanded', String(expanded)); },
25173
+ setBrand(next) { applySupportBrand(button, next); },
24651
25174
  destroy() { button.removeEventListener('click', open); button.remove(); },
24652
25175
  };
24653
25176
  }
24654
25177
 
25178
+ /**
25179
+ * The launcher's focus ring. The launcher floats over whatever the website
25180
+ * draws beneath it, so its ring opens with two bands no page color hides
25181
+ * (WCAG technique C40): white, then slate-950, which stand over 9:1 apart, so
25182
+ * one of them stands at 3:1 or more on any ground. It is the design system's
25183
+ * focus ring (`--focus-ring`: a surface gap, then the ring) with the darkest
25184
+ * slate as its ring, and the desk's focus color rings outside both.
25185
+ */
25186
+ const LAUNCHER_RING = `0 0 0 2px ${DS.white},0 0 0 4px ${DS.slate950}`;
24655
25187
  /**
24656
25188
  * The support journey's only skin. Customer content stays in the product register.
24657
25189
  * The panel's focus ring is 2px, 3px out, in the desk's focus color: its width and
24658
25190
  * offset are the panel's custom properties, which the help desk composer inside
24659
- * its request form reads, so the composer rings as the fields beside it do.
25191
+ * its request form reads, so the composer rings as the fields beside it do. It
25192
+ * paints in the help desk's color roles (@sparkvault/app-sdk/help-desk-colors):
25193
+ * its neutrals read the page's roles (HOST), so in the customer portal they
25194
+ * follow the portal's scheme, and stay light anywhere else; its accent reads
25195
+ * the page's accent roles, else the desk's light pairing (ACCENT), which the
25196
+ * panel and the launcher each carry (DEFAULT_PAIRING_DECLARATIONS), so the
25197
+ * launcher rings in the desk's color, as every control in the panel does,
25198
+ * outside a ring of its own that reads on any page (LAUNCHER_RING).
24660
25199
  */
24661
25200
  function injectHelpDeskSupportStyles() {
24662
25201
  if (document.getElementById('sparkvault-help-desk-support-styles'))
@@ -24665,8 +25204,8 @@ function injectHelpDeskSupportStyles() {
24665
25204
  style.id = 'sparkvault-help-desk-support-styles';
24666
25205
  style.textContent = `
24667
25206
  .svhs-panel,.svhs-panel *{box-sizing:border-box}
24668
- .svhs-panel{--hd-focus-width:2px;--hd-focus-offset:3px}
24669
- .svhs-panel{position:fixed;right:calc(var(--svhs-right,24px) + env(safe-area-inset-right,0px));bottom:calc(var(--svhs-bottom,96px) + env(safe-area-inset-bottom,0px));z-index:2147482900;width:408px;height:422px;max-width:calc(100vw - 32px);max-height:calc(100dvh - var(--svhs-bottom,96px) - 24px);display:flex;flex-direction:column;overflow:hidden;border:1px solid ${DS.slate200};border-radius:12px;background:${DS.white};color:${DS.slate900};font:400 15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',sans-serif;text-align:left;box-shadow:${DS.shadowPopover};transform-origin:bottom right;transition:width 180ms cubic-bezier(.2,0,0,1),height 180ms cubic-bezier(.2,0,0,1)}
25207
+ .svhs-panel{--hd-focus-width:2px;--hd-focus-offset:3px;${DEFAULT_PAIRING_DECLARATIONS}}
25208
+ .svhs-panel{position:fixed;right:calc(var(--svhs-right,24px) + env(safe-area-inset-right,0px));bottom:calc(var(--svhs-bottom,96px) + env(safe-area-inset-bottom,0px));z-index:2147482900;width:408px;height:422px;max-width:calc(100vw - 32px);max-height:calc(100dvh - var(--svhs-bottom,96px) - 24px);display:flex;flex-direction:column;overflow:hidden;border:1px solid ${HELP_DESK_COLORS.fillStrong};border-radius:12px;background:${HELP_DESK_COLORS.surface};color:${HELP_DESK_COLORS.ink};font:400 15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',sans-serif;text-align:left;box-shadow:${DS.shadowPopover};transform-origin:bottom right;transition:width 180ms cubic-bezier(.2,0,0,1),height 180ms cubic-bezier(.2,0,0,1)}
24670
25209
  .svhs-panel[hidden],.svhs-panel [hidden]{display:none!important}
24671
25210
  .svhs-panel[data-stage=results]{height:680px}
24672
25211
  .svhs-panel[data-stage=article]{width:704px;height:700px}
@@ -24677,99 +25216,99 @@ function injectHelpDeskSupportStyles() {
24677
25216
  .svhs-panel button,.svhs-panel a{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
24678
25217
  .svhs-panel button{appearance:none;cursor:pointer;margin:0}
24679
25218
  .svhs-panel button:active{transform:translateY(1px)}
24680
- .svhs-panel button:focus-visible,.svhs-panel a:focus-visible,.svhs-panel input:focus-visible,.svhs-panel textarea:focus-visible{outline:var(--hd-focus-width) solid var(--hd-focus,var(--hd-accent-ink,${DS.action}));outline-offset:var(--hd-focus-offset);box-shadow:none}
25219
+ .svhs-panel button:focus-visible,.svhs-panel a:focus-visible,.svhs-panel input:focus-visible,.svhs-panel textarea:focus-visible{outline:var(--hd-focus-width) solid ${HELP_DESK_FOCUS};outline-offset:var(--hd-focus-offset);box-shadow:none}
24681
25220
  .svhs-panel svg{display:block;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:none;pointer-events:none}
24682
- .svhs-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:60px;flex:none;padding:8px 14px 8px 24px;border-bottom:1px solid ${DS.slate200}}
24683
- .svhs-desk-name{font-size:14px;font-weight:600;line-height:1.35;color:${DS.slate600};overflow-wrap:anywhere;min-width:0}
25221
+ .svhs-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:60px;flex:none;padding:8px 14px 8px 24px;border-bottom:1px solid ${HELP_DESK_COLORS.fillStrong}}
25222
+ .svhs-desk-name{font-size:14px;font-weight:600;line-height:1.35;color:${HELP_DESK_COLORS.body};overflow-wrap:anywhere;min-width:0}
24684
25223
  .svhs-toolbar-actions{display:flex;align-items:center;gap:4px;margin-left:auto;flex:none}
24685
- .svhs-identity-notice{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:none;padding:8px 24px;border-bottom:1px solid ${DS.slate200};background:${DS.slate50}}
25224
+ .svhs-identity-notice{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:none;padding:8px 24px;border-bottom:1px solid ${HELP_DESK_COLORS.fillStrong};background:${HELP_DESK_COLORS.canvas}}
24686
25225
  .svhs-identity-notice .svhs-status{margin:0;font-size:13px}
24687
25226
  .svhs-identity-notice .svhs-text-button{flex:none;font-size:13px!important}
24688
- .svhs-icon-button{display:grid;place-items:center;width:40px;height:40px;flex:none;padding:0;border:0;border-radius:6px;background:transparent;color:${DS.slate500};text-decoration:none}
24689
- .svhs-icon-button:hover{background:${DS.slate100};color:${DS.slate900}}
24690
- .svhs-back{display:flex;align-items:center;gap:4px;flex:none;min-height:40px;margin-left:-10px!important;padding:8px;border:0;border-radius:6px;background:transparent;color:${DS.slate600};font-size:14px!important;font-weight:500!important;line-height:1.4}
24691
- .svhs-back:hover{background:${DS.slate50}}
24692
- .svhs-back:disabled{background:transparent;color:${DS.slate500};cursor:default;transform:none}
25227
+ .svhs-icon-button{display:grid;place-items:center;width:40px;height:40px;flex:none;padding:0;border:0;border-radius:6px;background:transparent;color:${HELP_DESK_COLORS.muted};text-decoration:none}
25228
+ .svhs-icon-button:hover{background:${HELP_DESK_COLORS.fill};color:${HELP_DESK_COLORS.ink}}
25229
+ .svhs-back{display:flex;align-items:center;gap:4px;flex:none;min-height:40px;margin-left:-10px!important;padding:8px;border:0;border-radius:6px;background:transparent;color:${HELP_DESK_COLORS.body};font-size:14px!important;font-weight:500!important;line-height:1.4}
25230
+ .svhs-back:hover{background:${HELP_DESK_COLORS.hover}}
25231
+ .svhs-back:disabled{background:transparent;color:${HELP_DESK_COLORS.muted};cursor:default;transform:none}
24693
25232
  .svhs-screen{display:flex;flex-direction:column;min-height:0;flex:1}
24694
25233
  .svhs-scroll{padding:26px 24px;overflow:auto;overscroll-behavior:contain;min-height:0;flex:1;scrollbar-gutter:stable}
24695
- .svhs-heading{margin:0 0 8px;padding:0;color:${DS.slate900};font-size:24px;font-weight:600;line-height:1.3;letter-spacing:-.6px;overflow-wrap:anywhere}
25234
+ .svhs-heading{margin:0 0 8px;padding:0;color:${HELP_DESK_COLORS.ink};font-size:24px;font-weight:600;line-height:1.3;letter-spacing:-.6px;overflow-wrap:anywhere}
24696
25235
  .svhs-heading:focus,.svhs-article-title:focus{outline:none;box-shadow:none}
24697
- .svhs-copy{margin:0 0 24px;color:${DS.slate600};font-size:14px;line-height:1.55}
24698
- .svhs-label{display:block;margin:0 0 7px;font-size:13px;font-weight:600;color:${DS.slate600}}
24699
- .svhs-issue{display:block;width:100%;min-height:120px;max-height:200px;resize:none;overflow-y:auto;border:1px solid ${DS.slate300};border-radius:8px;padding:12px 14px;background:${DS.white};color:${DS.slate900};font-size:16px!important;line-height:1.5!important;box-shadow:none}
25236
+ .svhs-copy{margin:0 0 24px;color:${HELP_DESK_COLORS.body};font-size:14px;line-height:1.55}
25237
+ .svhs-label{display:block;margin:0 0 7px;font-size:13px;font-weight:600;color:${HELP_DESK_COLORS.body}}
25238
+ .svhs-issue{display:block;width:100%;min-height:120px;max-height:200px;resize:none;overflow-y:auto;border:1px solid ${HELP_DESK_COLORS.lineStrong};border-radius:8px;padding:12px 14px;background:${HELP_DESK_COLORS.field};color:${HELP_DESK_COLORS.ink};font-size:16px!important;line-height:1.5!important;box-shadow:none}
24700
25239
  /* The heading is the field's label, so the field follows it at a label's distance from a question this large. */
24701
25240
  .svhs-heading+.svhs-issue{margin-top:16px}
24702
- .svhs-issue::placeholder{color:${DS.slate500};opacity:1}
24703
- .svhs-issue:focus{border-color:var(--hd-focus,var(--hd-accent-ink,${DS.action}))}
25241
+ .svhs-issue::placeholder{color:${HELP_DESK_COLORS.muted};opacity:1}
25242
+ .svhs-issue:focus{border-color:${HELP_DESK_FOCUS}}
24704
25243
  .svhs-primary,.svhs-secondary{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:10px 16px;border:1px solid transparent;border-radius:6px;font-size:14px!important;font-weight:600!important;line-height:1.4!important;text-decoration:none;transition:background 120ms cubic-bezier(.2,0,0,1)}
24705
- .svhs-primary{background:var(--hd-accent,${DS.action});color:var(--hd-on-accent,${DS.white})}
24706
- .svhs-primary:hover{background:var(--hd-accent-hover,${DS.actionHover})}
25244
+ .svhs-primary{background:${HELP_DESK_ACCENT.fill};color:${HELP_DESK_ACCENT.onAccent}}
25245
+ .svhs-primary:hover{background:${HELP_DESK_ACCENT.hover}}
24707
25246
  .svhs-primary[aria-disabled=true]{cursor:progress}
24708
- .svhs-secondary{border-color:${DS.slate300};background:${DS.white};color:${DS.slate600}}
24709
- .svhs-secondary:hover{background:${DS.slate50}}
24710
- .svhs-text-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:9px 4px;border:0;border-radius:6px;background:transparent;color:var(--hd-accent-ink,${DS.action});font-size:14px!important;line-height:1.4!important;text-decoration:none}
25247
+ .svhs-secondary{border-color:${HELP_DESK_COLORS.lineStrong};background:${HELP_DESK_COLORS.surface};color:${HELP_DESK_COLORS.body}}
25248
+ .svhs-secondary:hover{background:${HELP_DESK_COLORS.hover}}
25249
+ .svhs-text-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:9px 4px;border:0;border-radius:6px;background:transparent;color:${HELP_DESK_ACCENT.ink};font-size:14px!important;line-height:1.4!important;text-decoration:none}
24711
25250
  .svhs-text-button:hover{text-decoration:underline}
24712
25251
  .svhs-full{width:100%}
24713
- .svhs-bottom{padding:16px 24px 18px;flex:none;border-top:1px solid ${DS.slate100}}
25252
+ .svhs-bottom{padding:16px 24px 18px;flex:none;border-top:1px solid ${HELP_DESK_COLORS.fill}}
24714
25253
  .svhs-start-bottom{display:flex;flex-direction:column;align-items:center;gap:6px;padding-top:0;border-top:0}
24715
25254
  .svhs-start-bottom .svhs-primary{width:100%}
24716
- .svhs-query{display:flex;align-items:center;gap:12px;margin:0 0 24px;padding:12px 14px;border:1px solid ${DS.slate200};border-radius:8px;background:${DS.slate50}}
25255
+ .svhs-query{display:flex;align-items:center;gap:12px;margin:0 0 24px;padding:12px 14px;border:1px solid ${HELP_DESK_COLORS.fillStrong};border-radius:8px;background:${HELP_DESK_COLORS.canvas}}
24717
25256
  .svhs-question{flex:1;min-width:0}
24718
- .svhs-question-label{display:block;margin-bottom:3px;color:${DS.slate500};font-size:12px;font-weight:500;line-height:1.4}
24719
- .svhs-query-text{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0;color:${DS.slate900};font-size:14px;line-height:1.5;overflow-wrap:anywhere;white-space:pre-wrap}
25257
+ .svhs-question-label{display:block;margin-bottom:3px;color:${HELP_DESK_COLORS.muted};font-size:12px;font-weight:500;line-height:1.4}
25258
+ .svhs-query-text{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0;color:${HELP_DESK_COLORS.ink};font-size:14px;line-height:1.5;overflow-wrap:anywhere;white-space:pre-wrap}
24720
25259
  .svhs-query .svhs-text-button{flex:none;min-width:44px;padding:8px 0}
24721
25260
  .svhs-results{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}
24722
- .svhs-result{display:grid;grid-template-columns:24px minmax(0,1fr) 16px;align-items:start;gap:12px;width:100%;padding:18px 0;border:0;border-bottom:1px solid ${DS.slate200};border-radius:0;background:${DS.white};color:${DS.slate900};text-align:left}
24723
- .svhs-results li:first-child .svhs-result{border-top:1px solid ${DS.slate200}}
25261
+ .svhs-result{display:grid;grid-template-columns:24px minmax(0,1fr) 16px;align-items:start;gap:12px;width:100%;padding:18px 0;border:0;border-bottom:1px solid ${HELP_DESK_COLORS.fillStrong};border-radius:0;background:${HELP_DESK_COLORS.surface};color:${HELP_DESK_COLORS.ink};text-align:left}
25262
+ .svhs-results li:first-child .svhs-result{border-top:1px solid ${HELP_DESK_COLORS.fillStrong}}
24724
25263
  .svhs-results li:last-child .svhs-result{border-bottom:0}
24725
25264
  .svhs-result-copy{display:block;min-width:0}
24726
- .svhs-result-icon{margin-top:2px;color:${DS.slate500}}
24727
- .svhs-result-chevron{width:16px!important;height:16px!important;margin-top:4px;color:${DS.slate500}}
25265
+ .svhs-result-icon{margin-top:2px;color:${HELP_DESK_COLORS.muted}}
25266
+ .svhs-result-chevron{width:16px!important;height:16px!important;margin-top:4px;color:${HELP_DESK_COLORS.muted}}
24728
25267
  .svhs-result-title{display:block;margin:0 0 4px;color:inherit;font-size:16px;font-weight:600;line-height:1.4;letter-spacing:-.15px;overflow-wrap:anywhere}
24729
- .svhs-result:hover{background:${DS.slate50}}
24730
- .svhs-result:hover .svhs-result-title{color:var(--hd-accent-ink,${DS.action});text-decoration:underline}
24731
- .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}
24732
- .svhs-result-category{display:block;margin-top:6px;color:${DS.slate500};font-size:12px;line-height:1.4}
24733
- .svhs-results-bottom{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;background:${DS.slate50};border-top-color:${DS.slate200}}
25268
+ .svhs-result:hover{background:${HELP_DESK_COLORS.hover}}
25269
+ .svhs-result:hover .svhs-result-title{color:${HELP_DESK_ACCENT.ink};text-decoration:underline}
25270
+ .svhs-result-excerpt{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0;color:${HELP_DESK_COLORS.body};font-size:14px;line-height:1.5;overflow-wrap:anywhere}
25271
+ .svhs-result-category{display:block;margin-top:6px;color:${HELP_DESK_COLORS.muted};font-size:12px;line-height:1.4}
25272
+ .svhs-results-bottom{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;background:${HELP_DESK_COLORS.canvas};border-top-color:${HELP_DESK_COLORS.fillStrong}}
24734
25273
  /* Wraps below the ticket button when less than 200px remain beside it, as under the panel's full-width button. */
24735
- .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}
24736
- .svhs-error{margin:12px 0 0;color:${DS.error};font-size:14px;line-height:1.5;overflow-wrap:anywhere}
24737
- .svhs-status{margin:16px 0;color:${DS.slate600};font-size:14px;line-height:1.5}
25274
+ .svhs-contact-note{flex:1 1 200px;min-width:0;margin:0;color:${HELP_DESK_COLORS.muted};font-size:13px;line-height:1.5;overflow-wrap:anywhere}
25275
+ .svhs-error{margin:12px 0 0;color:${HELP_DESK_COLORS.error};font-size:14px;line-height:1.5;overflow-wrap:anywhere}
25276
+ .svhs-status{margin:16px 0;color:${HELP_DESK_COLORS.body};font-size:14px;line-height:1.5}
24738
25277
  .svhs-empty{padding:12px 0 4px}
24739
25278
  .svhs-empty .svhs-heading{font-size:18px;letter-spacing:-.3px}
24740
25279
  .svhs-spinner{width:15px;height:15px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:svhs-spin .7s linear infinite;flex:none}
24741
25280
  @keyframes svhs-spin{to{transform:rotate(360deg)}}
24742
25281
  .svhs-article-scroll{padding:34px 48px 28px}
24743
- .svhs-category{margin:0 0 12px;color:${DS.slate500};font-size:13px;line-height:1.5;overflow-wrap:anywhere}
24744
- .svhs-article-title{margin:0 0 18px;color:${DS.slate900};font-size:28px;font-weight:600;line-height:1.2;letter-spacing:-.8px;overflow-wrap:anywhere}
24745
- .svhs-article-content{color:${DS.slate600};font-size:15px;line-height:1.65;overflow-wrap:anywhere}
25282
+ .svhs-category{margin:0 0 12px;color:${HELP_DESK_COLORS.muted};font-size:13px;line-height:1.5;overflow-wrap:anywhere}
25283
+ .svhs-article-title{margin:0 0 18px;color:${HELP_DESK_COLORS.ink};font-size:28px;font-weight:600;line-height:1.2;letter-spacing:-.8px;overflow-wrap:anywhere}
25284
+ .svhs-article-content{color:${HELP_DESK_COLORS.body};font-size:15px;line-height:1.65;overflow-wrap:anywhere}
24746
25285
  .svhs-article-content>*:first-child{margin-top:0}
24747
25286
  .svhs-article-content p{margin:0 0 18px;font:inherit;color:inherit}
24748
- .svhs-article-content h1,.svhs-article-content h2,.svhs-article-content h3,.svhs-article-content h4,.svhs-article-content h5,.svhs-article-content h6{margin:28px 0 12px;color:${DS.slate900};font-size:18px;font-weight:600;line-height:1.35;letter-spacing:-.3px;scroll-margin-top:24px}
25287
+ .svhs-article-content h1,.svhs-article-content h2,.svhs-article-content h3,.svhs-article-content h4,.svhs-article-content h5,.svhs-article-content h6{margin:28px 0 12px;color:${HELP_DESK_COLORS.ink};font-size:18px;font-weight:600;line-height:1.35;letter-spacing:-.3px;scroll-margin-top:24px}
24749
25288
  .svhs-article-content h3,.svhs-article-content h4,.svhs-article-content h5,.svhs-article-content h6{font-size:16px}
24750
25289
  .svhs-article-content ul,.svhs-article-content ol{margin:0 0 22px;padding-left:22px}
24751
25290
  .svhs-article-content li{margin:8px 0;padding-left:5px}
24752
- .svhs-article-content strong{font-weight:600;color:${DS.slate900}}
24753
- .svhs-article-content a{color:var(--hd-accent-ink,${DS.action});text-decoration:underline;text-underline-offset:2px}
25291
+ .svhs-article-content strong{font-weight:600;color:${HELP_DESK_COLORS.ink}}
25292
+ .svhs-article-content a{color:${HELP_DESK_ACCENT.ink};text-decoration:underline;text-underline-offset:2px}
24754
25293
  .svhs-article-content img,.svhs-article-content video{display:block;max-width:100%;height:auto;margin:20px 0}
24755
25294
  .svhs-reader-asset{display:block;max-width:100%;margin:20px 0}
24756
25295
  .svhs-reader-asset img{margin:0}
24757
- .svhs-reader-asset-status{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:4px;min-height:140px;padding:20px;border:1px solid ${DS.slate200};border-radius:6px;background:${DS.slate50};color:${DS.slate500};font-size:13px;text-align:center}
25296
+ .svhs-reader-asset-status{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:4px;min-height:140px;padding:20px;border:1px solid ${HELP_DESK_COLORS.fillStrong};border-radius:6px;background:${HELP_DESK_COLORS.canvas};color:${HELP_DESK_COLORS.muted};font-size:13px;text-align:center}
24758
25297
  .svhs-reader-asset-status[style]{min-height:0}
24759
- .svhs-article-content blockquote{margin:22px 0;padding:0 0 0 16px;border-left:2px solid ${DS.slate300};font-size:14px}
24760
- .svhs-article-content pre{margin:20px 0;padding:14px;border:1px solid ${DS.slate200};border-radius:6px;background:${DS.slate50};overflow:auto;overscroll-behavior:contain;font:13px/1.6 ui-monospace,SFMono-Regular,Consolas,monospace}
25298
+ .svhs-article-content blockquote{margin:22px 0;padding:0 0 0 16px;border-left:2px solid ${HELP_DESK_COLORS.lineStrong};font-size:14px}
25299
+ .svhs-article-content pre{margin:20px 0;padding:14px;border:1px solid ${HELP_DESK_COLORS.fillStrong};border-radius:6px;background:${HELP_DESK_COLORS.canvas};overflow:auto;overscroll-behavior:contain;font:13px/1.6 ui-monospace,SFMono-Regular,Consolas,monospace}
24761
25300
  .svhs-article-content code{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:.9em}
24762
25301
  .svhs-article-content table{display:block;max-width:100%;border-collapse:collapse;overflow:auto;overscroll-behavior:contain;margin:20px 0;font-size:14px}
24763
- .svhs-article-content th,.svhs-article-content td{padding:10px 12px;border:1px solid ${DS.slate200};text-align:left}
24764
- .svhs-article-content hr{margin:24px 0;border:0;border-top:1px solid ${DS.slate200}}
24765
- .svhs-article-footer{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 24px;border-top:1px solid ${DS.slate100};flex:none}
25302
+ .svhs-article-content th,.svhs-article-content td{padding:10px 12px;border:1px solid ${HELP_DESK_COLORS.fillStrong};text-align:left}
25303
+ .svhs-article-content hr{margin:24px 0;border:0;border-top:1px solid ${HELP_DESK_COLORS.fillStrong}}
25304
+ .svhs-article-footer{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 24px;border-top:1px solid ${HELP_DESK_COLORS.fill};flex:none}
24766
25305
  .svhs-article-footer .svhs-primary{min-width:110px}
24767
25306
  .svhs-article-footer .svhs-text-button{white-space:nowrap;font-size:13px!important}
24768
- .svhs-article-question{color:${DS.slate500};font-size:13px;line-height:1.5}
25307
+ .svhs-article-question{color:${HELP_DESK_COLORS.muted};font-size:13px;line-height:1.5}
24769
25308
  .svhs-reader-actions{display:flex;align-items:stretch;gap:12px;flex:none}
24770
25309
  .svhs-feedback-scroll{padding-top:30px}
24771
25310
  .svhs-feedback-actions{display:flex;flex-direction:column;gap:9px;margin-top:24px}
24772
- .svhs-feedback-actions .svhs-text-button{align-self:center;color:${DS.slate500}}
25311
+ .svhs-feedback-actions .svhs-text-button{align-self:center;color:${HELP_DESK_COLORS.muted}}
24773
25312
  .svhs-review{margin-top:24px}
24774
25313
  .svhs-review .svhs-primary{width:fit-content}
24775
25314
  .svhs-contact-scroll{padding:0;scrollbar-gutter:auto}
@@ -24778,8 +25317,8 @@ function injectHelpDeskSupportStyles() {
24778
25317
  .svhs-contact-prelude{padding:24px}
24779
25318
  .svhs-contact-prelude .svhs-secondary{margin-top:16px}
24780
25319
  .svhs-ticket-gate{padding:0 24px 24px}
24781
- .svhs-unlock-input{display:block;box-sizing:border-box;width:100%;min-height:46px;margin:0 0 16px;border:1px solid ${DS.slate300};border-radius:6px;padding:11px 12px;background:${DS.white};color:${DS.slate900};font-size:16px!important;line-height:1.5!important}
24782
- .svhs-unlock-input:focus{border-color:var(--hd-focus,var(--hd-accent-ink,${DS.action}))}
25320
+ .svhs-unlock-input{display:block;box-sizing:border-box;width:100%;min-height:46px;margin:0 0 16px;border:1px solid ${HELP_DESK_COLORS.lineStrong};border-radius:6px;padding:11px 12px;background:${HELP_DESK_COLORS.field};color:${HELP_DESK_COLORS.ink};font-size:16px!important;line-height:1.5!important}
25321
+ .svhs-unlock-input:focus{border-color:${HELP_DESK_FOCUS}}
24783
25322
  .svhs-unlock-form{margin:0}
24784
25323
  .svhs-contact-target>.svhd-container{display:flex;flex:1;flex-direction:column;min-height:100%;max-width:none;padding:24px;border:0;border-radius:0;box-shadow:none;background:transparent}
24785
25324
  .svhs-contact-target .svhd-body{display:flex;flex:1;flex-direction:column;min-height:0}
@@ -24788,44 +25327,39 @@ function injectHelpDeskSupportStyles() {
24788
25327
  .svhs-contact-target .svhd-label{font-size:13px;line-height:1.5}
24789
25328
  .svhs-contact-target .svhd-input{font-size:16px;line-height:1.5}
24790
25329
  .svhs-contact-target .svhd-actions{gap:10px}
24791
- .svhs-contact-target .svhd-button:not(.svhd-secondary){background:var(--hd-accent,${DS.action});color:var(--hd-on-accent,${DS.white})}
24792
- .svhs-contact-target .svhd-button:not(.svhd-secondary):hover{background:var(--hd-accent-hover,${DS.actionHover})}
24793
- .svhs-contact-target .svhd-link{color:var(--hd-accent-ink,${DS.action})}
24794
25330
  .svhs-contact-target .svhd-actions>.svhd-button:first-child{flex:1}
24795
25331
  .svhs-contact-target .svhd-status{font-size:14px}
24796
25332
  .svhs-contact-target .svhd-auth{gap:14px}
24797
- .svhs-contact-target .svhd-text-button{color:var(--hd-accent-ink,${DS.action})}
24798
- .svhs-contact-target .svhd-text-button:disabled{color:${DS.slate500}}
24799
25333
  .svhs-contact-target .svhd-widget-form{display:flex;flex:1;flex-direction:column;gap:16px}
24800
25334
  /* The request fills the panel: the details step, and in it the composer and its text, take the height the fields leave. */
24801
25335
  .svhs-contact-target .svhd-widget-form>[data-contact-step=details]{display:flex;flex:1;flex-direction:column;gap:16px}
24802
25336
  .svhs-contact-target .svhd-widget-form .svhd-composer-field{display:flex;flex:1;flex-direction:column;gap:6px;min-height:164px}
24803
25337
  .svhs-contact-target .svhd-widget-form .svhd-composer{flex:1}
24804
25338
  .svhs-contact-target .svhd-widget-form .svhd-composer-input{flex:1;min-height:120px}
24805
- .svhs-contact-target .svhd-widget-form>.svhd-actions{position:sticky;bottom:0;z-index:1;margin:auto -24px 0;padding:16px 24px 0;border-top:1px solid ${DS.slate100};background:${DS.white}}
25339
+ .svhs-contact-target .svhd-widget-form>.svhd-actions{position:sticky;bottom:0;z-index:1;margin:auto -24px 0;padding:16px 24px 0;border-top:1px solid ${HELP_DESK_COLORS.fill};background:${HELP_DESK_COLORS.surface}}
24806
25340
  .svhs-contact-target .svhd-widget-form>.svhd-actions>.svhd-secondary{display:none}
24807
25341
  .svhs-contact-target .svhd-widget-form .svhd-actions>.svhd-button{font-size:14px}
24808
- .svhs-contact-target .svhd-widget-form>.svhd-confirm{position:sticky;bottom:-24px;z-index:2;margin:0 -24px -24px;padding:16px 24px 24px;border-top:1px solid ${DS.slate200};background:${DS.white}}
25342
+ .svhs-contact-target .svhd-widget-form>.svhd-confirm{position:sticky;bottom:-24px;z-index:2;margin:0 -24px -24px;padding:16px 24px 24px;border-top:1px solid ${HELP_DESK_COLORS.fillStrong};background:${HELP_DESK_COLORS.surface}}
24809
25343
  .svhs-contact-target .svhd-widget-form>.svhd-confirm .svhd-actions{flex-wrap:nowrap}
24810
25344
  .svhs-contact-target .svhd-widget-form>.svhd-confirm .svhd-button{flex:1}
24811
25345
  .svhs-contact-target .svhd-footer{margin-top:16px;text-align:center;font-size:11px}
24812
25346
  .svhs-receipt-scroll{padding-top:36px}
24813
- .svhs-receipt-mark{width:30px!important;height:30px!important;margin-bottom:20px;color:var(--hd-accent-ink,${DS.action})}
24814
- .svhs-ticket-link{display:inline-flex;align-items:center;min-height:44px;margin:0 0 10px;color:var(--hd-accent-ink,${DS.action});font-size:14px;font-weight:600;text-decoration:underline}
25347
+ .svhs-receipt-mark{width:30px!important;height:30px!important;margin-bottom:20px;color:${HELP_DESK_ACCENT.ink}}
25348
+ .svhs-ticket-link{display:inline-flex;align-items:center;min-height:44px;margin:0 0 10px;color:${HELP_DESK_ACCENT.ink};font-size:14px;font-weight:600;text-decoration:underline}
24815
25349
  .svhs-receipt-note{white-space:pre-wrap;overflow-wrap:anywhere}
24816
25350
  .svhs-receipt-actions{display:flex;flex-direction:column;align-items:center;gap:4px}
24817
25351
  .svhs-toast{box-sizing:border-box;position:fixed;right:24px;bottom:calc(96px + var(--svhs-toast-offset,0px) + env(safe-area-inset-bottom));z-index:2147482901;display:flex;align-items:center;gap:10px;max-width:calc(100vw - 36px);padding:14px 18px;border:1px solid transparent;border-radius:8px;background:${DS.slate900};color:${DS.white};box-shadow:${DS.shadowPopover};font:400 14px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',sans-serif;overflow-wrap:anywhere}
24818
25352
  .svhs-toast svg{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
24819
- .svhs-overlay{position:fixed;inset:0;z-index:2147482900;display:flex;background:${DS.white};padding:0;overflow:hidden}
25353
+ .svhs-overlay{position:fixed;inset:0;z-index:2147482900;display:flex;background:${HELP_DESK_COLORS.surface};padding:0;overflow:hidden}
24820
25354
  .svhs-modal{width:100%;height:100%;min-width:0;outline:none}
24821
25355
  .svhs-overlay .svhs-panel{position:relative;inset:auto;width:100%;height:100%;max-width:none;max-height:none;border:0;border-radius:0;box-shadow:none;padding-top:env(safe-area-inset-top);transition:none}
24822
- .sv-support-launcher{touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:background 120ms cubic-bezier(.2,0,0,1)}
25356
+ .sv-support-launcher{touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:background 120ms cubic-bezier(.2,0,0,1);box-shadow:${DS.shadowPopover};${DEFAULT_PAIRING_DECLARATIONS}}
24823
25357
  .sv-support-launcher:hover{filter:brightness(1.12)}
24824
25358
  .sv-support-launcher:active{transform:translateY(1px)}
24825
- .sv-support-launcher:focus-visible{outline:3px solid var(--hd-accent-ink,${DS.action});outline-offset:3px}
25359
+ .sv-support-launcher:focus-visible{outline:3px solid ${HELP_DESK_FOCUS};outline-offset:4px;box-shadow:${LAUNCHER_RING},${DS.shadowPopover}}
24826
25360
  @media(max-width:640px){
24827
25361
  .svhs-panel{right:0;bottom:0;width:100%;height:100dvh;max-width:none;max-height:none;border:0;border-radius:0}
24828
- .svhs-toolbar{min-height:60px;padding:8px 16px 8px 24px;border-bottom-color:${DS.slate200}}
25362
+ .svhs-toolbar{min-height:60px;padding:8px 16px 8px 24px;border-bottom-color:${HELP_DESK_COLORS.fillStrong}}
24829
25363
  .svhs-icon-button{width:44px;height:44px}
24830
25364
  .svhs-back{min-height:44px;max-width:42%}
24831
25365
  .svhs-scroll{padding:24px}
@@ -24857,7 +25391,7 @@ function injectHelpDeskSupportStyles() {
24857
25391
  @media(pointer:coarse){.svhs-icon-button{width:44px;height:44px}.svhs-back{min-height:44px}.svhs-query .svhs-text-button{min-height:44px;min-width:44px}}
24858
25392
  @media(prefers-reduced-motion:reduce){.svhs-panel,.svhs-panel *,.sv-support-launcher{transition-duration:0s!important;animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important}}
24859
25393
  @media(forced-colors:active){.svhs-panel button:focus-visible,.svhs-panel a:focus-visible,.svhs-panel input:focus-visible,.svhs-panel textarea:focus-visible{outline:2px solid Highlight}.svhs-panel,.svhs-primary,.svhs-secondary{border:1px solid ButtonText}}
24860
- .svhs-panel.svhs-page{position:static;inset:auto;z-index:auto;width:100%;height:auto;max-width:720px;max-height:none;margin:0 auto;border:1px solid ${DS.slate200};border-radius:12px;box-shadow:none;transition:none}
25394
+ .svhs-panel.svhs-page{position:static;inset:auto;z-index:auto;width:100%;height:auto;max-width:720px;max-height:none;margin:0 auto;border:1px solid ${HELP_DESK_COLORS.fillStrong};border-radius:12px;box-shadow:none;transition:none}
24861
25395
  .svhs-page .svhs-toolbar{min-height:52px;padding:4px 24px}
24862
25396
  .svhs-page .svhs-back{max-width:none;white-space:nowrap}
24863
25397
  .svhs-page .svhs-desk-name{display:none}
@@ -25054,35 +25588,6 @@ class SupportPhoneHistory {
25054
25588
  }
25055
25589
  }
25056
25590
 
25057
- /** Darken only the narrow range where neither white nor the product ink reaches AA. */
25058
- function accessibleFill(color) {
25059
- let fill = color;
25060
- while ((accentFillContrast(fill) ?? 0) < AA_TEXT_CONTRAST) {
25061
- fill = `#${[1, 3, 5].map(offset => Math.floor(Number.parseInt(fill.slice(offset, offset + 2), 16) * 0.98).toString(16).padStart(2, '0')).join('')}`;
25062
- }
25063
- return fill;
25064
- }
25065
- /** Scoped brand properties work in both a hosted page and an unrelated widget host. */
25066
- function applySupportBrand(target, value) {
25067
- const color = brandColor(value);
25068
- if (!color) {
25069
- for (const name of ['--hd-accent', '--hd-on-accent', '--hd-accent-ink', '--hd-accent-hover', '--hd-focus'])
25070
- target.style.removeProperty(name);
25071
- return;
25072
- }
25073
- const fill = accessibleFill(color);
25074
- const pairing = accentPairing(fill);
25075
- const ink = pairing.accentInk === 'accent' ? fill : DS.slate900;
25076
- const label = pairing.onAccent === 'white' ? DS.white : DS.slate900;
25077
- // Dark fills deepen on hover; light fills stay unchanged to preserve label contrast.
25078
- const hover = pairing.onAccent === 'white'
25079
- ? `#${[1, 3, 5].map(offset => Math.floor(Number.parseInt(fill.slice(offset, offset + 2), 16) * 0.9).toString(16).padStart(2, '0')).join('')}`
25080
- : fill;
25081
- const properties = { '--hd-accent': fill, '--hd-on-accent': label, '--hd-accent-ink': ink, '--hd-accent-hover': hover, '--hd-focus': ink };
25082
- for (const [name, content] of Object.entries(properties))
25083
- target.style.setProperty(name, content);
25084
- }
25085
-
25086
25591
  /* global MediaQueryList, HTMLImageElement, HTMLAnchorElement, Element */
25087
25592
  let sequence = 0;
25088
25593
  function element(tag, className, text) {
@@ -25369,7 +25874,8 @@ class SupportView {
25369
25874
  if (previous)
25370
25875
  this.saveScroll(previous);
25371
25876
  this.state = next;
25372
- applySupportBrand(this.panel, next.brandColor);
25877
+ if (next.brand !== previous?.brand)
25878
+ applySupportBrand(this.panel, next.brand);
25373
25879
  this.panel.dataset.stage = next.stage;
25374
25880
  const inset = (value, fallback) => typeof value === 'number' && Number.isFinite(value) ? Math.min(480, Math.max(0, value)) : fallback;
25375
25881
  this.panel.style.setProperty('--svhs-right', `${inset(next.position?.right, 24)}px`);
@@ -26072,7 +26578,11 @@ function createHelpDeskSupport(config, options) {
26072
26578
  let sourceArticleId;
26073
26579
  const lifetime = new AbortController();
26074
26580
  const bindings = new Set();
26075
- let state = { visible: false, stage: 'issue', deskName: 'Support', issue: '' };
26581
+ // A desk the page already holds brands the journey from the start, the
26582
+ // launcher included. Any other desk's brand arrives with connect, which the
26583
+ // first open, search or contact makes, never creation: connecting here would
26584
+ // add a desk lookup to every page load of a website that shows the launcher.
26585
+ let state = { visible: false, stage: 'issue', deskName: 'Support', issue: '', brand: supportBrand(options.desk?.branding?.color) };
26076
26586
  if (typeof options.launcher === 'object') {
26077
26587
  const offset = (value, fallback) => typeof value === 'number' && Number.isFinite(value) ? Math.min(240, Math.max(12, value)) : fallback;
26078
26588
  state.position = { right: offset(options.launcher.right, 24), bottom: offset(options.launcher.bottom, 24) + 72 };
@@ -26146,7 +26656,7 @@ function createHelpDeskSupport(config, options) {
26146
26656
  }, options.target === undefined ? undefined : resolveTarget(options.target));
26147
26657
  const launcher = (() => {
26148
26658
  try {
26149
- return options.launcher ? createSupportLauncher(typeof options.launcher === 'object' ? options.launcher : {}, () => { void open(); }) : null;
26659
+ return options.launcher ? createSupportLauncher(typeof options.launcher === 'object' ? options.launcher : {}, state.brand, () => { void open(); }) : null;
26150
26660
  }
26151
26661
  catch (error) {
26152
26662
  view.destroy();
@@ -26157,9 +26667,12 @@ function createHelpDeskSupport(config, options) {
26157
26667
  function update(change) {
26158
26668
  if (destroyed)
26159
26669
  return;
26670
+ const rebranded = change.brand !== undefined && change.brand !== state.brand;
26160
26671
  state = { ...state, ...change };
26161
26672
  view.render(state);
26162
26673
  launcher?.setExpanded(state.visible);
26674
+ if (rebranded)
26675
+ launcher?.setBrand(state.brand);
26163
26676
  notify(options.onStateChange, snapshot());
26164
26677
  }
26165
26678
  async function connect() {
@@ -26186,7 +26699,7 @@ function createHelpDeskSupport(config, options) {
26186
26699
  return (await http.request(path, { method: 'POST', body, credentials: 'omit', headers: { 'X-SV-Client': 'help-desk-portal', ...headers } })).data;
26187
26700
  },
26188
26701
  });
26189
- update({ deskName: answer.desk.organization_name || 'Support', brandColor: answer.desk.branding?.color, contactNote: answer.desk.ticket_contact_note ?? undefined });
26702
+ update({ deskName: answer.desk.organization_name || 'Support', brand: brandFor(answer.desk.branding?.color, state.brand), contactNote: answer.desk.ticket_contact_note ?? undefined });
26190
26703
  return answer;
26191
26704
  }).catch((error) => { connected = null; throw error; });
26192
26705
  return connected;
@@ -26577,6 +27090,7 @@ function createHelpDeskSupport(config, options) {
26577
27090
  persist: options.persist,
26578
27091
  pageLayout: options.target !== undefined,
26579
27092
  hostShowsAttribution: options.hostShowsAttribution === true,
27093
+ brand: state.brand,
26580
27094
  onSession: (session) => {
26581
27095
  anonymous = false;
26582
27096
  if (options.persist)
@@ -27009,7 +27523,7 @@ function createHelpDeskSupport(config, options) {
27009
27523
  client?.clearTicketAccess();
27010
27524
  client?.setSession(null);
27011
27525
  client = null;
27012
- state = { visible: false, stage: 'issue', deskName: 'Support', issue: '' };
27526
+ state = { visible: false, stage: 'issue', deskName: 'Support', issue: '', brand: state.brand };
27013
27527
  },
27014
27528
  };
27015
27529
  }
@@ -31778,7 +32292,7 @@ class SparkVault {
31778
32292
  }
31779
32293
  /** Get the SDK version */
31780
32294
  static get version() {
31781
- return '18.0.0';
32295
+ return '18.0.1';
31782
32296
  }
31783
32297
  }
31784
32298
  if (typeof window !== 'undefined') {