@sparkvault/sdk-js 18.0.0 → 18.0.2
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/README.md +84 -7
- package/dist/index.cjs +1064 -394
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.mjs +1064 -394
- package/dist/index.mjs.map +1 -1
- package/dist/products/help-desk/form-types.d.ts +3 -0
- package/dist/products/help-desk/styles.d.ts +8 -1
- package/dist/products/help-desk/support-brand.d.ts +49 -2
- package/dist/products/help-desk/support-launcher.d.ts +8 -2
- package/dist/products/help-desk/support-styles.d.ts +8 -1
- package/dist/products/help-desk/support-view.d.ts +3 -1
- package/dist/products/identity/views/identity-input.d.ts +2 -5
- package/dist/sparks/index.d.ts +2 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4616,6 +4616,220 @@ class LoadingView {
|
|
|
4616
4616
|
}
|
|
4617
4617
|
}
|
|
4618
4618
|
|
|
4619
|
+
/**
|
|
4620
|
+
* Shared browser email-or-phone field. Entered text is held separately from
|
|
4621
|
+
* phone presentation, so a numeric email prefix never inherits punctuation
|
|
4622
|
+
* inserted by the formatter. Callers validate `value`, never the presentation.
|
|
4623
|
+
*/
|
|
4624
|
+
|
|
4625
|
+
const PHONE_CHARACTER = /[+\d]/;
|
|
4626
|
+
|
|
4627
|
+
/** Map each displayed phone digit to the entered character it represents. */
|
|
4628
|
+
function phonePositions(value, display) {
|
|
4629
|
+
const entered = [...value.matchAll(/[+\d]/g)].map((match) => match.index);
|
|
4630
|
+
const shown = [...display.matchAll(/[+\d]/g)].map((match) => match.index);
|
|
4631
|
+
// NANP presentation omits its declared country code; it stays in the value.
|
|
4632
|
+
return shown.map((position, index) => ({ display: position, value: entered[index + entered.length - shown.length] }));
|
|
4633
|
+
}
|
|
4634
|
+
|
|
4635
|
+
/**
|
|
4636
|
+
* @param {HTMLInputElement} input - A text or tel input owned by the caller
|
|
4637
|
+
* @param {{allowedTypes?: ('email'|'phone')[], onChange?: (value: string, type: 'email'|'phone') => void}} options
|
|
4638
|
+
* @returns {{readonly value: string, readonly type: 'email'|'phone', setValue: (value: string) => void, destroy: () => void}}
|
|
4639
|
+
*/
|
|
4640
|
+
function attachIdentityInput(input, { allowedTypes = ['email', 'phone'], onChange } = {}) {
|
|
4641
|
+
let value = input.value;
|
|
4642
|
+
let display = value;
|
|
4643
|
+
let positions = [];
|
|
4644
|
+
let composing = false;
|
|
4645
|
+
let beforeEdit = null;
|
|
4646
|
+
let history = [{ value, start: value.length, end: value.length }];
|
|
4647
|
+
let historyIndex = 0;
|
|
4648
|
+
const phoneOnly = allowedTypes.length === 1 && allowedTypes[0] === 'phone';
|
|
4649
|
+
const allowsPhone = allowedTypes.includes('phone');
|
|
4650
|
+
const identityType = () => phoneOnly ? 'phone' : allowsPhone ? inferIdentityType(value) : 'email';
|
|
4651
|
+
|
|
4652
|
+
function valuePosition(position) {
|
|
4653
|
+
if (display === value || position === 0) return position;
|
|
4654
|
+
if (position >= display.length) return value.length;
|
|
4655
|
+
return positions.find((entry) => entry.display >= position)?.value ?? value.length;
|
|
4656
|
+
}
|
|
4657
|
+
|
|
4658
|
+
function displayPosition(position) {
|
|
4659
|
+
if (display === value) return position;
|
|
4660
|
+
if (position >= value.length) return display.length;
|
|
4661
|
+
for (let index = positions.length - 1; index >= 0; index -= 1) {
|
|
4662
|
+
if (positions[index].value < position) return positions[index].display + 1;
|
|
4663
|
+
}
|
|
4664
|
+
return positions[0]?.display ?? 0;
|
|
4665
|
+
}
|
|
4666
|
+
|
|
4667
|
+
function present(start = null, end = start) {
|
|
4668
|
+
display = identityType() === 'phone' ? formatPhoneDisplay(value) : value;
|
|
4669
|
+
positions = display === value ? [] : phonePositions(value, display);
|
|
4670
|
+
input.value = display;
|
|
4671
|
+
// Mixed fields keep a text keyboard: an initial digit can begin an email.
|
|
4672
|
+
input.inputMode = phoneOnly ? 'tel' : 'text';
|
|
4673
|
+
input.autocapitalize = 'none';
|
|
4674
|
+
input.spellcheck = false;
|
|
4675
|
+
if (start !== null) input.setSelectionRange(displayPosition(start), displayPosition(end));
|
|
4676
|
+
}
|
|
4677
|
+
|
|
4678
|
+
// Formatting writes the DOM value, which changes native undo bookkeeping.
|
|
4679
|
+
// History therefore owns entered values and selections, never DOM diffs.
|
|
4680
|
+
function restoreHistory(direction) {
|
|
4681
|
+
beforeEdit = null;
|
|
4682
|
+
const nextIndex = Math.max(0, Math.min(history.length - 1, historyIndex + direction));
|
|
4683
|
+
const changed = nextIndex !== historyIndex;
|
|
4684
|
+
historyIndex = nextIndex;
|
|
4685
|
+
const state = history[historyIndex];
|
|
4686
|
+
value = state.value;
|
|
4687
|
+
present();
|
|
4688
|
+
input.setSelectionRange(state.start, state.end);
|
|
4689
|
+
if (changed) onChange?.(value, identityType());
|
|
4690
|
+
}
|
|
4691
|
+
|
|
4692
|
+
function historyDirection(event) {
|
|
4693
|
+
return event.inputType === 'historyUndo' ? -1 : event.inputType === 'historyRedo' ? 1 : 0;
|
|
4694
|
+
}
|
|
4695
|
+
|
|
4696
|
+
function handleHistoryKey(event) {
|
|
4697
|
+
if (composing || event.isComposing || event.altKey || !(event.metaKey || event.ctrlKey)) return;
|
|
4698
|
+
const key = event.key.toLowerCase();
|
|
4699
|
+
const direction = key === 'z' ? (event.shiftKey ? 1 : -1) : key === 'y' && event.ctrlKey ? 1 : 0;
|
|
4700
|
+
if (!direction) return;
|
|
4701
|
+
event.preventDefault();
|
|
4702
|
+
restoreHistory(direction);
|
|
4703
|
+
}
|
|
4704
|
+
|
|
4705
|
+
function rememberSelection() {
|
|
4706
|
+
const start = input.selectionStart ?? display.length;
|
|
4707
|
+
const end = input.selectionEnd ?? start;
|
|
4708
|
+
history[historyIndex] = { value, start, end };
|
|
4709
|
+
}
|
|
4710
|
+
|
|
4711
|
+
function captureEdit(event) {
|
|
4712
|
+
if (composing || event.isComposing) return;
|
|
4713
|
+
const direction = historyDirection(event);
|
|
4714
|
+
if (direction) {
|
|
4715
|
+
if (event.cancelable) {
|
|
4716
|
+
event.preventDefault();
|
|
4717
|
+
restoreHistory(direction);
|
|
4718
|
+
}
|
|
4719
|
+
return;
|
|
4720
|
+
}
|
|
4721
|
+
rememberSelection();
|
|
4722
|
+
let start = input.selectionStart ?? display.length;
|
|
4723
|
+
let end = input.selectionEnd ?? start;
|
|
4724
|
+
if (start === end && event.inputType === 'deleteContentBackward') start = Math.max(0, start - 1);
|
|
4725
|
+
if (start === end && event.inputType === 'deleteContentForward') end = Math.min(display.length, end + 1);
|
|
4726
|
+
beforeEdit = { start, end, inputType: event.inputType, display };
|
|
4727
|
+
}
|
|
4728
|
+
|
|
4729
|
+
function acceptEdit(event) {
|
|
4730
|
+
if (composing || event.isComposing) return;
|
|
4731
|
+
const direction = historyDirection(event);
|
|
4732
|
+
if (direction) {
|
|
4733
|
+
restoreHistory(direction);
|
|
4734
|
+
return;
|
|
4735
|
+
}
|
|
4736
|
+
const next = input.value;
|
|
4737
|
+
if (next === display) {
|
|
4738
|
+
beforeEdit = null;
|
|
4739
|
+
return;
|
|
4740
|
+
}
|
|
4741
|
+
const cursor = input.selectionStart ?? next.length;
|
|
4742
|
+
const selectionEnd = input.selectionEnd ?? cursor;
|
|
4743
|
+
let start = 0;
|
|
4744
|
+
let end = display.length;
|
|
4745
|
+
let nextEnd = next.length;
|
|
4746
|
+
const edit = beforeEdit;
|
|
4747
|
+
beforeEdit = null;
|
|
4748
|
+
if (edit?.display === display && next.startsWith(display.slice(0, edit.start))
|
|
4749
|
+
&& next.endsWith(display.slice(edit.end))) {
|
|
4750
|
+
start = edit.start;
|
|
4751
|
+
end = edit.end;
|
|
4752
|
+
nextEnd = next.length - (display.length - end);
|
|
4753
|
+
} else {
|
|
4754
|
+
while (start < display.length && start < next.length && display[start] === next[start]) start += 1;
|
|
4755
|
+
while (end > start && nextEnd > start && display[end - 1] === next[nextEnd - 1]) {
|
|
4756
|
+
end -= 1;
|
|
4757
|
+
nextEnd -= 1;
|
|
4758
|
+
}
|
|
4759
|
+
}
|
|
4760
|
+
let rawStart = valuePosition(start);
|
|
4761
|
+
let rawEnd = valuePosition(end);
|
|
4762
|
+
const inserted = next.slice(start, nextEnd);
|
|
4763
|
+
// Backspace/Delete on presentation punctuation must make progress instead
|
|
4764
|
+
// of immediately restoring the separator and trapping the caret.
|
|
4765
|
+
if (!inserted && end > start && rawStart === rawEnd) {
|
|
4766
|
+
const forward = (edit?.inputType || event.inputType) === 'deleteContentForward';
|
|
4767
|
+
if (forward) {
|
|
4768
|
+
while (rawEnd < value.length && !PHONE_CHARACTER.test(value[rawEnd])) rawEnd += 1;
|
|
4769
|
+
rawEnd = Math.min(value.length, rawEnd + 1);
|
|
4770
|
+
} else {
|
|
4771
|
+
while (rawStart > 0 && !PHONE_CHARACTER.test(value[rawStart - 1])) rawStart -= 1;
|
|
4772
|
+
rawStart = Math.max(0, rawStart - 1);
|
|
4773
|
+
}
|
|
4774
|
+
}
|
|
4775
|
+
const toValuePosition = (position) => position < start
|
|
4776
|
+
? valuePosition(position)
|
|
4777
|
+
: position <= nextEnd
|
|
4778
|
+
? rawStart + position - start
|
|
4779
|
+
: valuePosition(position - nextEnd + end) + inserted.length - (rawEnd - rawStart);
|
|
4780
|
+
const rawCursor = toValuePosition(cursor);
|
|
4781
|
+
const rawSelectionEnd = toValuePosition(selectionEnd);
|
|
4782
|
+
value = value.slice(0, rawStart) + inserted + value.slice(rawEnd);
|
|
4783
|
+
present(rawCursor, rawSelectionEnd);
|
|
4784
|
+
history.splice(historyIndex + 1);
|
|
4785
|
+
history.push({ value, start: input.selectionStart, end: input.selectionEnd });
|
|
4786
|
+
historyIndex = history.length - 1;
|
|
4787
|
+
onChange?.(value, identityType());
|
|
4788
|
+
}
|
|
4789
|
+
|
|
4790
|
+
function startComposition() {
|
|
4791
|
+
rememberSelection();
|
|
4792
|
+
composing = true;
|
|
4793
|
+
beforeEdit = null;
|
|
4794
|
+
}
|
|
4795
|
+
|
|
4796
|
+
function endComposition(event) {
|
|
4797
|
+
composing = false;
|
|
4798
|
+
acceptEdit(event);
|
|
4799
|
+
}
|
|
4800
|
+
|
|
4801
|
+
input.addEventListener('keydown', handleHistoryKey);
|
|
4802
|
+
input.addEventListener('beforeinput', captureEdit);
|
|
4803
|
+
input.addEventListener('input', acceptEdit);
|
|
4804
|
+
input.addEventListener('change', acceptEdit);
|
|
4805
|
+
input.addEventListener('compositionstart', startComposition);
|
|
4806
|
+
input.addEventListener('compositionend', endComposition);
|
|
4807
|
+
present();
|
|
4808
|
+
rememberSelection();
|
|
4809
|
+
|
|
4810
|
+
return {
|
|
4811
|
+
get value() { return value; },
|
|
4812
|
+
get type() { return identityType(); },
|
|
4813
|
+
setValue(next) {
|
|
4814
|
+
if (next === value) return;
|
|
4815
|
+
value = next;
|
|
4816
|
+
history = [{ value, start: value.length, end: value.length }];
|
|
4817
|
+
historyIndex = 0;
|
|
4818
|
+
beforeEdit = null;
|
|
4819
|
+
present();
|
|
4820
|
+
rememberSelection();
|
|
4821
|
+
},
|
|
4822
|
+
destroy() {
|
|
4823
|
+
input.removeEventListener('keydown', handleHistoryKey);
|
|
4824
|
+
input.removeEventListener('beforeinput', captureEdit);
|
|
4825
|
+
input.removeEventListener('input', acceptEdit);
|
|
4826
|
+
input.removeEventListener('change', acceptEdit);
|
|
4827
|
+
input.removeEventListener('compositionstart', startComposition);
|
|
4828
|
+
input.removeEventListener('compositionend', endComposition);
|
|
4829
|
+
}
|
|
4830
|
+
};
|
|
4831
|
+
}
|
|
4832
|
+
|
|
4619
4833
|
/**
|
|
4620
4834
|
* The sign-in providers' marks and the social networks' marks, each stated
|
|
4621
4835
|
* once: the identity dialog (the browser SDK, which bundles this module) and
|
|
@@ -5111,7 +5325,7 @@ function smsConsent(id) {
|
|
|
5111
5325
|
*
|
|
5112
5326
|
* Collects and validates the user's email or phone number: reads the input as
|
|
5113
5327
|
* one or the other by the platform's rules (`@sparkvault/app-sdk/phone` and
|
|
5114
|
-
* `@sparkvault/app-sdk/email-address`), and formats
|
|
5328
|
+
* `@sparkvault/app-sdk/email-address`), and formats phone numbers as the
|
|
5115
5329
|
* number is typed. A field that takes a phone number carries the SMS and voice
|
|
5116
5330
|
* consent beneath it.
|
|
5117
5331
|
*/
|
|
@@ -5126,12 +5340,8 @@ class IdentityInputView {
|
|
|
5126
5340
|
this.leadingHandler = null;
|
|
5127
5341
|
this.errorContainer = null;
|
|
5128
5342
|
this.focusTimeoutId = null;
|
|
5129
|
-
this.
|
|
5343
|
+
this.identityInput = null;
|
|
5130
5344
|
this.props = props;
|
|
5131
|
-
this.boundHandleInput = () => {
|
|
5132
|
-
this.handleInput();
|
|
5133
|
-
this.props.onType?.();
|
|
5134
|
-
};
|
|
5135
5345
|
this.boundHandleKeyDown = (e) => {
|
|
5136
5346
|
if (e.key === 'Enter') {
|
|
5137
5347
|
e.preventDefault();
|
|
@@ -5186,9 +5396,17 @@ class IdentityInputView {
|
|
|
5186
5396
|
this.inputElement.maxLength = EMAIL_ADDRESS_LIMITS.ADDRESS;
|
|
5187
5397
|
if (this.props.initialValue) {
|
|
5188
5398
|
this.inputElement.value = this.props.initialValue;
|
|
5189
|
-
this.detectAndUpdateType(this.props.initialValue);
|
|
5190
5399
|
}
|
|
5191
|
-
this.inputElement
|
|
5400
|
+
this.identityInput = attachIdentityInput(this.inputElement, {
|
|
5401
|
+
allowedTypes: this.props.allowedTypes,
|
|
5402
|
+
onChange: () => {
|
|
5403
|
+
this.clearError();
|
|
5404
|
+
if (this.labelElement)
|
|
5405
|
+
this.labelElement.textContent = this.getLabelText();
|
|
5406
|
+
this.props.onType?.();
|
|
5407
|
+
}
|
|
5408
|
+
});
|
|
5409
|
+
this.labelElement.textContent = this.getLabelText();
|
|
5192
5410
|
this.inputElement.addEventListener('keydown', this.boundHandleKeyDown);
|
|
5193
5411
|
inputWrapper.appendChild(this.labelElement);
|
|
5194
5412
|
inputWrapper.appendChild(this.inputElement);
|
|
@@ -5241,7 +5459,7 @@ class IdentityInputView {
|
|
|
5241
5459
|
}
|
|
5242
5460
|
getLabelText() {
|
|
5243
5461
|
if (this.allowsBoth) {
|
|
5244
|
-
return this.
|
|
5462
|
+
return this.identityInput?.type === 'phone' ? 'Phone number' : 'Email address';
|
|
5245
5463
|
}
|
|
5246
5464
|
if (this.allowsPhone)
|
|
5247
5465
|
return 'Phone number';
|
|
@@ -5254,36 +5472,6 @@ class IdentityInputView {
|
|
|
5254
5472
|
return '(555) 123-4567';
|
|
5255
5473
|
return 'you@example.com';
|
|
5256
5474
|
}
|
|
5257
|
-
handleInput() {
|
|
5258
|
-
this.clearError();
|
|
5259
|
-
if (!this.inputElement)
|
|
5260
|
-
return;
|
|
5261
|
-
const value = this.inputElement.value;
|
|
5262
|
-
if (this.allowsBoth) {
|
|
5263
|
-
// The label follows what the input reads as, but the text is never
|
|
5264
|
-
// rewritten: digits typed so far can still begin an email address
|
|
5265
|
-
// ("2024user@gmail.com", "12345678@qq.com"), and phone formatting would
|
|
5266
|
-
// corrupt it. Submit normalizes a phone number whatever its separators.
|
|
5267
|
-
const wasPhone = this.detectedType === 'phone';
|
|
5268
|
-
this.detectAndUpdateType(value);
|
|
5269
|
-
if (wasPhone !== (this.detectedType === 'phone') && this.labelElement) {
|
|
5270
|
-
this.labelElement.textContent = this.getLabelText();
|
|
5271
|
-
}
|
|
5272
|
-
}
|
|
5273
|
-
else if (this.allowsPhone) {
|
|
5274
|
-
// Phone-only mode: always format
|
|
5275
|
-
const cursorPos = this.inputElement.selectionStart ?? value.length;
|
|
5276
|
-
const formatted = formatPhoneDisplay(value);
|
|
5277
|
-
if (formatted !== value) {
|
|
5278
|
-
this.inputElement.value = formatted;
|
|
5279
|
-
const newPos = Math.min(cursorPos + (formatted.length - value.length), formatted.length);
|
|
5280
|
-
this.inputElement.setSelectionRange(newPos, newPos);
|
|
5281
|
-
}
|
|
5282
|
-
}
|
|
5283
|
-
}
|
|
5284
|
-
detectAndUpdateType(value) {
|
|
5285
|
-
this.detectedType = inferIdentityType(value);
|
|
5286
|
-
}
|
|
5287
5475
|
clearError() {
|
|
5288
5476
|
if (this.errorContainer) {
|
|
5289
5477
|
clearChildren(this.errorContainer);
|
|
@@ -5299,60 +5487,27 @@ class IdentityInputView {
|
|
|
5299
5487
|
this.inputElement?.focus();
|
|
5300
5488
|
}
|
|
5301
5489
|
handleSubmit() {
|
|
5302
|
-
if (!this.
|
|
5490
|
+
if (!this.identityInput || !this.submitButton)
|
|
5491
|
+
return;
|
|
5492
|
+
const type = this.identityInput.type;
|
|
5493
|
+
const value = type === 'phone'
|
|
5494
|
+
? parsePhone(this.identityInput.value)
|
|
5495
|
+
: validateEmail(this.identityInput.value);
|
|
5496
|
+
if (!value) {
|
|
5497
|
+
this.showError(type === 'phone' ? 'Please enter a valid phone number' : 'Please enter a valid email address');
|
|
5303
5498
|
return;
|
|
5304
|
-
const rawValue = this.inputElement.value;
|
|
5305
|
-
// Validate based on detected type
|
|
5306
|
-
if (this.allowsBoth) {
|
|
5307
|
-
if (this.detectedType === 'phone') {
|
|
5308
|
-
const validPhone = parsePhone(rawValue);
|
|
5309
|
-
if (!validPhone) {
|
|
5310
|
-
this.showError('Please enter a valid phone number');
|
|
5311
|
-
return;
|
|
5312
|
-
}
|
|
5313
|
-
this.submitButton.disabled = true;
|
|
5314
|
-
this.submitButton.textContent = 'Please wait...';
|
|
5315
|
-
this.props.onSubmit({ value: validPhone, type: 'phone' });
|
|
5316
|
-
}
|
|
5317
|
-
else {
|
|
5318
|
-
const validEmail = validateEmail(rawValue);
|
|
5319
|
-
if (!validEmail) {
|
|
5320
|
-
this.showError('Please enter a valid email address');
|
|
5321
|
-
return;
|
|
5322
|
-
}
|
|
5323
|
-
this.submitButton.disabled = true;
|
|
5324
|
-
this.submitButton.textContent = 'Please wait...';
|
|
5325
|
-
this.props.onSubmit({ value: validEmail, type: 'email' });
|
|
5326
|
-
}
|
|
5327
|
-
}
|
|
5328
|
-
else if (this.allowsPhone) {
|
|
5329
|
-
const validPhone = parsePhone(rawValue);
|
|
5330
|
-
if (!validPhone) {
|
|
5331
|
-
this.showError('Please enter a valid phone number');
|
|
5332
|
-
return;
|
|
5333
|
-
}
|
|
5334
|
-
this.submitButton.disabled = true;
|
|
5335
|
-
this.submitButton.textContent = 'Please wait...';
|
|
5336
|
-
this.props.onSubmit({ value: validPhone, type: 'phone' });
|
|
5337
|
-
}
|
|
5338
|
-
else {
|
|
5339
|
-
const validEmail = validateEmail(rawValue);
|
|
5340
|
-
if (!validEmail) {
|
|
5341
|
-
this.showError('Please enter a valid email address');
|
|
5342
|
-
return;
|
|
5343
|
-
}
|
|
5344
|
-
this.submitButton.disabled = true;
|
|
5345
|
-
this.submitButton.textContent = 'Please wait...';
|
|
5346
|
-
this.props.onSubmit({ value: validEmail, type: 'email' });
|
|
5347
5499
|
}
|
|
5500
|
+
this.submitButton.disabled = true;
|
|
5501
|
+
this.submitButton.textContent = 'Please wait...';
|
|
5502
|
+
this.props.onSubmit({ value, type });
|
|
5348
5503
|
}
|
|
5349
5504
|
destroy() {
|
|
5505
|
+
this.identityInput?.destroy();
|
|
5350
5506
|
if (this.focusTimeoutId !== null) {
|
|
5351
5507
|
clearTimeout(this.focusTimeoutId);
|
|
5352
5508
|
this.focusTimeoutId = null;
|
|
5353
5509
|
}
|
|
5354
5510
|
if (this.inputElement) {
|
|
5355
|
-
this.inputElement.removeEventListener('input', this.boundHandleInput);
|
|
5356
5511
|
this.inputElement.removeEventListener('keydown', this.boundHandleKeyDown);
|
|
5357
5512
|
}
|
|
5358
5513
|
if (this.submitButton) {
|
|
@@ -18845,7 +19000,657 @@ class HelpDeskClient {
|
|
|
18845
19000
|
}
|
|
18846
19001
|
}
|
|
18847
19002
|
|
|
18848
|
-
/**
|
|
19003
|
+
/**
|
|
19004
|
+
* A tenant's brand color and the WCAG contrast rules that decide how it may be
|
|
19005
|
+
* used: the one hex rule the server stores, the console checks and the portal
|
|
19006
|
+
* paints, the one contrast reading the console's readouts, the portal's
|
|
19007
|
+
* accent and the portal's reading of a help center's ground share, and the
|
|
19008
|
+
* one way a readout writes that reading.
|
|
19009
|
+
*
|
|
19010
|
+
* A brand color is tenant-controlled, so it is used only when it is a
|
|
19011
|
+
* six-digit hex color, read case-insensitively and held in lowercase; anything
|
|
19012
|
+
* else (a color name, a CSS function, a value that runs on into more CSS) is
|
|
19013
|
+
* no color at all.
|
|
19014
|
+
*
|
|
19015
|
+
* A brand color can be any lightness, so whatever shows it picks what goes
|
|
19016
|
+
* with it, in one pairing per scheme that every surface painting the color
|
|
19017
|
+
* shares (the customer portal, the SDK's support journey, the desk's email,
|
|
19018
|
+
* the console's sample):
|
|
19019
|
+
*
|
|
19020
|
+
* light (lightAccent) the fill, moved in lightness away from its label
|
|
19021
|
+
* only where neither white nor ink reads on it at
|
|
19022
|
+
* 4.5:1; white or ink on it, whichever reads more
|
|
19023
|
+
* strongly; the color itself as text only where it
|
|
19024
|
+
* reaches 4.5:1 on both grounds accent text stands on,
|
|
19025
|
+
* the white surface and the canvas tone, ink otherwise
|
|
19026
|
+
* dark (darkAccent) a color with a hue a reader sees, lifted in
|
|
19027
|
+
* lightness at its own hue and the saturation it shows
|
|
19028
|
+
* where it would not read: as text until it reads at
|
|
19029
|
+
* 4.5:1 on every dark ground accent text stands on
|
|
19030
|
+
* (darkAccentInk), as a fill until it stands at 3:1 on
|
|
19031
|
+
* the dark page and its cards under a label at 4.5:1,
|
|
19032
|
+
* its hover too (darkAccentFill); a grey or black, the
|
|
19033
|
+
* dark scheme's ink, as fill and as text, under ink
|
|
19034
|
+
*
|
|
19035
|
+
* A hue is the one a reader sees (shownChroma): a black whose OKLCH chroma
|
|
19036
|
+
* names a hue no reader sees there, such as #000001, pairs as black in both
|
|
19037
|
+
* schemes. Under the pointer each fill moves a step a reader sees, away from
|
|
19038
|
+
* its label wherever there is room, and on dark grounds wherever that step
|
|
19039
|
+
* still stands there (hoverOf). schemePairings gives both pairings at once,
|
|
19040
|
+
* DEFAULT_PAIRINGS the ones a desk with no brand color paints, and
|
|
19041
|
+
* accentProperties says either as the accent custom properties the customer
|
|
19042
|
+
* portal paints with.
|
|
19043
|
+
*
|
|
19044
|
+
* BROWSER-SAFE: data only, no imports.
|
|
19045
|
+
*/
|
|
19046
|
+
|
|
19047
|
+
const HEX_COLOR = /^#[0-9a-f]{6}$/;
|
|
19048
|
+
|
|
19049
|
+
/** WCAG AA's floor for normal-size text. */
|
|
19050
|
+
const AA_TEXT_CONTRAST = 4.5;
|
|
19051
|
+
|
|
19052
|
+
/**
|
|
19053
|
+
* The canvas tone, the design system's `--canvas` (`--color-slate-50`): the
|
|
19054
|
+
* page ground the customer portal (its pages and a customer's own messages)
|
|
19055
|
+
* and the knowledge base's default theme set accent text on, beside the white
|
|
19056
|
+
* surface. The design system publishes its tokens only as CSS, which this
|
|
19057
|
+
* import-free module cannot read, so the value is mirrored here once, and
|
|
19058
|
+
* tests/brand-color.test.js holds it to packages/design-system/tokens/colors.css.
|
|
19059
|
+
*/
|
|
19060
|
+
const CANVAS_COLOR = '#f7fafb';
|
|
19061
|
+
|
|
19062
|
+
/**
|
|
19063
|
+
* The ink, the design system's `--ink` (`--color-slate-900`): the dark text a
|
|
19064
|
+
* pairing paints on a fill and in place of a color too light to stand as
|
|
19065
|
+
* text. Mirrored here once for the same reason as CANVAS_COLOR, and held to
|
|
19066
|
+
* packages/design-system/tokens/colors.css by tests/brand-color.test.js.
|
|
19067
|
+
*/
|
|
19068
|
+
const INK_COLOR = '#0d1a20';
|
|
19069
|
+
|
|
19070
|
+
/**
|
|
19071
|
+
* The design system's dark app grounds accent colors stand on, mirrored for
|
|
19072
|
+
* the same reason as CANVAS_COLOR and held to the tokens the same way: the
|
|
19073
|
+
* page (`--dark-app-canvas`), its cards (`--dark-app-surface`) and the
|
|
19074
|
+
* ground of selected text and of the composer's drop prompt
|
|
19075
|
+
* (`--dark-app-selection`), the lightest ground accent text stands on there.
|
|
19076
|
+
*/
|
|
19077
|
+
const DARK_CANVAS_COLOR = '#071217';
|
|
19078
|
+
const DARK_SURFACE_COLOR = '#0d1a20';
|
|
19079
|
+
const DARK_SELECTION_COLOR = '#1b2e4c';
|
|
19080
|
+
|
|
19081
|
+
/**
|
|
19082
|
+
* The dark app ramp's ink, `--dark-app-ink`: the text on its grounds, and the
|
|
19083
|
+
* accent a grey or black brand color takes there. Mirrored and held to the
|
|
19084
|
+
* tokens as CANVAS_COLOR is.
|
|
19085
|
+
*/
|
|
19086
|
+
const DARK_INK_COLOR = '#f0f5f7';
|
|
19087
|
+
|
|
19088
|
+
/**
|
|
19089
|
+
* The pairings a desk with no brand color paints, in the shape a brand
|
|
19090
|
+
* color's take (schemePairings), so every surface that paints a desk's accent
|
|
19091
|
+
* (the customer portal, the SDK's support journey, the desk's email, the
|
|
19092
|
+
* console's sample) paints this one default: on light grounds the design
|
|
19093
|
+
* system's primary button (`--color-btn-primary`, under the pointer
|
|
19094
|
+
* `--color-btn-primary-hover`) under white, with `--color-action` as text; on
|
|
19095
|
+
* the dark app grounds its action fill (`--dark-app-action`, under the
|
|
19096
|
+
* pointer `--dark-app-action-hover`) under white, with
|
|
19097
|
+
* `--color-action-on-dark` as text. Each color is its token's value,
|
|
19098
|
+
* mirrored and held to the tokens as CANVAS_COLOR is.
|
|
19099
|
+
*/
|
|
19100
|
+
const DEFAULT_PAIRINGS = Object.freeze({
|
|
19101
|
+
light: Object.freeze({ fill: '#0a4eb1', onAccent: 'white', ink: '#216bde', hover: '#03439f' }),
|
|
19102
|
+
dark: Object.freeze({ fill: '#226ee3', onAccent: 'white', ink: '#72a8ff', hover: '#1d60c8' })
|
|
19103
|
+
});
|
|
19104
|
+
|
|
19105
|
+
/**
|
|
19106
|
+
* The chroma a reader sees (shownChroma) under which a color is a grey rather
|
|
19107
|
+
* than a hue: the neutral greys a brand picks (a pure, warm or cool grey,
|
|
19108
|
+
* stone, zinc) sit at 0 to 0.019, and the least saturated colors still named
|
|
19109
|
+
* by their hue (a desaturated olive, a charcoal navy, a taupe, a brown) at
|
|
19110
|
+
* 0.028 to 0.035.
|
|
19111
|
+
*/
|
|
19112
|
+
const CHROMA_FLOOR = 0.02;
|
|
19113
|
+
|
|
19114
|
+
/**
|
|
19115
|
+
* The OKLCH lightness under which OKLCH's chroma names a hue a reader does
|
|
19116
|
+
* not see: CIE L*a*b*'s 6/29, under which L*a*b* weighs light linearly where
|
|
19117
|
+
* OKLab keeps its cube root to black. Near black that cube root finds a hue
|
|
19118
|
+
* in what little light there is (a chroma of 0.021 in #000001, 0.045 in
|
|
19119
|
+
* #00000a) in a color a reader sees as black.
|
|
19120
|
+
*/
|
|
19121
|
+
const LINEAR_LIGHTNESS = 6 / 29;
|
|
19122
|
+
|
|
19123
|
+
/** WCAG AA's floor for a control's parts and a state's mark (1.4.11). */
|
|
19124
|
+
const AA_NON_TEXT_CONTRAST = 3;
|
|
19125
|
+
|
|
19126
|
+
/** sRGB's transfer function: an encoded channel, from 0 to 1, as linear light, and back. */
|
|
19127
|
+
const toLinear = (channel) => (channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4);
|
|
19128
|
+
const toGamma = (channel) => (channel <= 0.0031308 ? 12.92 * channel : 1.055 * channel ** (1 / 2.4) - 0.055);
|
|
19129
|
+
|
|
19130
|
+
/** A validated `#rrggbb` color's red, green and blue channels, each from 0 to 1. */
|
|
19131
|
+
const channelsOf = (color) => [1, 3, 5].map((offset) => Number.parseInt(color.slice(offset, offset + 2), 16) / 255);
|
|
19132
|
+
|
|
19133
|
+
/** Relative luminance (WCAG 2) of an sRGB color's red, green and blue channels, each from 0 to 1. */
|
|
19134
|
+
function channelLuminance(channels) {
|
|
19135
|
+
const [red, green, blue] = channels.map(toLinear);
|
|
19136
|
+
return 0.2126 * red + 0.7152 * green + 0.0722 * blue;
|
|
19137
|
+
}
|
|
19138
|
+
|
|
19139
|
+
/** Relative luminance (WCAG 2) of a validated `#rrggbb` color. */
|
|
19140
|
+
function relativeLuminance(color) {
|
|
19141
|
+
return channelLuminance(channelsOf(color));
|
|
19142
|
+
}
|
|
19143
|
+
|
|
19144
|
+
/** The contrast ratio of two relative luminances. */
|
|
19145
|
+
function contrastRatio(first, second) {
|
|
19146
|
+
return (Math.max(first, second) + 0.05) / (Math.min(first, second) + 0.05);
|
|
19147
|
+
}
|
|
19148
|
+
|
|
19149
|
+
/** The relative luminance of the ink a fill's text is weighed in, the real ink rather than pure black. */
|
|
19150
|
+
const INK_LUMINANCE = relativeLuminance(INK_COLOR);
|
|
19151
|
+
|
|
19152
|
+
/** The relative luminances of the grounds accent text stands on: the white surface and the canvas tone. */
|
|
19153
|
+
const TEXT_GROUNDS = Object.freeze([1, relativeLuminance(CANVAS_COLOR)]);
|
|
19154
|
+
|
|
19155
|
+
/** The dark app ramp's grounds accent text stands on, as sRGB channels: the dark page, its cards and the selection. */
|
|
19156
|
+
const DARK_TEXT_GROUNDS = Object.freeze([DARK_CANVAS_COLOR, DARK_SURFACE_COLOR, DARK_SELECTION_COLOR].map((color) => Object.freeze(channelsOf(color))));
|
|
19157
|
+
|
|
19158
|
+
/** The dark app ramp's grounds an accent fill stands on, as sRGB channels: the dark page and its cards. */
|
|
19159
|
+
const DARK_FILL_GROUNDS = Object.freeze([DARK_CANVAS_COLOR, DARK_SURFACE_COLOR].map((color) => Object.freeze(channelsOf(color))));
|
|
19160
|
+
|
|
19161
|
+
/** How strongly a color of this luminance reads on the one of `grounds` it reads least on. */
|
|
19162
|
+
function lowestContrast(luminance, grounds) {
|
|
19163
|
+
return Math.min(...grounds.map((ground) => contrastRatio(luminance, ground)));
|
|
19164
|
+
}
|
|
19165
|
+
|
|
19166
|
+
/** The text a fill of this luminance takes: white or ink, whichever reads more strongly on it. */
|
|
19167
|
+
function labelOf(luminance) {
|
|
19168
|
+
return contrastRatio(luminance, 1) >= contrastRatio(luminance, INK_LUMINANCE) ? 'white' : 'ink';
|
|
19169
|
+
}
|
|
19170
|
+
|
|
19171
|
+
/** How strongly that text reads on a fill of this luminance. */
|
|
19172
|
+
function labelContrast(luminance) {
|
|
19173
|
+
return contrastRatio(luminance, labelOf(luminance) === 'white' ? 1 : INK_LUMINANCE);
|
|
19174
|
+
}
|
|
19175
|
+
|
|
19176
|
+
/** How strongly a color of this luminance reads as text on the light ground it reads least on. */
|
|
19177
|
+
function textContrast(luminance) {
|
|
19178
|
+
return lowestContrast(luminance, TEXT_GROUNDS);
|
|
19179
|
+
}
|
|
19180
|
+
|
|
19181
|
+
/**
|
|
19182
|
+
* A validated `#rrggbb` color in OKLCH (lightness from 0 to 1, chroma, hue in
|
|
19183
|
+
* radians), by the same transform the design system derives its palette with
|
|
19184
|
+
* (packages/design-system/scripts/token-css.mjs oklchOfRgb, by which
|
|
19185
|
+
* tests/brand-color.test.js measures every lift).
|
|
19186
|
+
*/
|
|
19187
|
+
function oklchOf(color) {
|
|
19188
|
+
const [r, g, b] = channelsOf(color).map(toLinear);
|
|
19189
|
+
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
|
|
19190
|
+
const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
|
|
19191
|
+
const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
|
|
19192
|
+
const a = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s;
|
|
19193
|
+
const bAxis = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s;
|
|
19194
|
+
return { L: 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s, C: Math.hypot(a, bAxis), H: Math.atan2(bAxis, a) };
|
|
19195
|
+
}
|
|
19196
|
+
|
|
19197
|
+
/** An OKLCH color's linear red, green and blue; a channel outside 0 to 1 is one sRGB cannot draw. */
|
|
19198
|
+
function linearOfOklch(L, C, H) {
|
|
19199
|
+
const [a, b] = [C * Math.cos(H), C * Math.sin(H)];
|
|
19200
|
+
const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3;
|
|
19201
|
+
const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3;
|
|
19202
|
+
const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3;
|
|
19203
|
+
return [
|
|
19204
|
+
4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
|
|
19205
|
+
-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
|
|
19206
|
+
-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s
|
|
19207
|
+
];
|
|
19208
|
+
}
|
|
19209
|
+
|
|
19210
|
+
/**
|
|
19211
|
+
* The chroma a reader sees in a color (its OKLCH lightness and chroma): its
|
|
19212
|
+
* OKLCH chroma, under LINEAR_LIGHTNESS faded by the square of the color's
|
|
19213
|
+
* share of that lightness, as L*a*b*'s linear weighing scales chroma against
|
|
19214
|
+
* the cube root there.
|
|
19215
|
+
*/
|
|
19216
|
+
const shownChroma = ({ L, C }) => C * Math.min(1, (L / LINEAR_LIGHTNESS) ** 2);
|
|
19217
|
+
|
|
19218
|
+
/** Whether a color (its OKLCH lightness and chroma) has a hue a reader sees: its shown chroma at CHROMA_FLOOR or more. */
|
|
19219
|
+
const hasHue = (oklch) => shownChroma(oklch) >= CHROMA_FLOOR;
|
|
19220
|
+
|
|
19221
|
+
/**
|
|
19222
|
+
* The saturation a walk from a color keeps (shiftedUntil): its shown chroma
|
|
19223
|
+
* for its lightness. A color darker than LINEAR_LIGHTNESS with no hue a
|
|
19224
|
+
* reader sees keeps none, so it walks as a grey: a walk toward the light
|
|
19225
|
+
* would grow its trace into a hue. A lighter grey keeps its faint tint, which
|
|
19226
|
+
* its short walks barely move.
|
|
19227
|
+
*/
|
|
19228
|
+
function saturationOf(oklch) {
|
|
19229
|
+
if (oklch.L <= 0 || (oklch.L < LINEAR_LIGHTNESS && !hasHue(oklch))) return 0;
|
|
19230
|
+
return shownChroma(oklch) / oklch.L;
|
|
19231
|
+
}
|
|
19232
|
+
|
|
19233
|
+
const drawable = (channels) => channels.every((channel) => channel >= 0 && channel <= 1);
|
|
19234
|
+
|
|
19235
|
+
/** The `#rrggbb` color at OKLCH lightness L and hue H, with as much of chroma C as sRGB holds there. */
|
|
19236
|
+
function colorAt(L, C, H) {
|
|
19237
|
+
let chroma = C;
|
|
19238
|
+
if (!drawable(linearOfOklch(L, chroma, H))) {
|
|
19239
|
+
let [low, high] = [0, C];
|
|
19240
|
+
for (let halving = 0; halving < 24; halving += 1) {
|
|
19241
|
+
const middle = (low + high) / 2;
|
|
19242
|
+
if (drawable(linearOfOklch(L, middle, H))) low = middle;
|
|
19243
|
+
else high = middle;
|
|
19244
|
+
}
|
|
19245
|
+
chroma = low;
|
|
19246
|
+
}
|
|
19247
|
+
return `#${linearOfOklch(L, chroma, H).map((channel) => Math.round(toGamma(Math.min(1, Math.max(0, channel))) * 255).toString(16).padStart(2, '0')).join('')}`;
|
|
19248
|
+
}
|
|
19249
|
+
|
|
19250
|
+
/** How far each step of a shift moves a color's OKLCH lightness. */
|
|
19251
|
+
const SHIFT_STEP = 0.005;
|
|
19252
|
+
|
|
19253
|
+
/**
|
|
19254
|
+
* A color as it stands where `reads` asks more of it: itself where it reads,
|
|
19255
|
+
* else moved in OKLCH lightness (up for `direction` 1, down for -1) at its
|
|
19256
|
+
* own hue, one step at a time, to the first step that reads, white or black
|
|
19257
|
+
* at the end. Its saturation (saturationOf), the chroma a reader sees for its
|
|
19258
|
+
* lightness, stays as it is, so a navy lifts to a clear blue of its own
|
|
19259
|
+
* family rather than greying out, with as much of that chroma as sRGB holds
|
|
19260
|
+
* at each step. Null where not even the end reads.
|
|
19261
|
+
*
|
|
19262
|
+
* @param {string} color - A validated brand color
|
|
19263
|
+
* @param {1|-1} direction
|
|
19264
|
+
* @param {(candidate: string) => boolean} reads
|
|
19265
|
+
* @returns {string|null}
|
|
19266
|
+
*/
|
|
19267
|
+
function shiftedUntil(color, direction, reads) {
|
|
19268
|
+
if (reads(color)) return color;
|
|
19269
|
+
const oklch = oklchOf(color);
|
|
19270
|
+
const { L, H } = oklch;
|
|
19271
|
+
const saturation = saturationOf(oklch);
|
|
19272
|
+
for (let lightness = L + direction * SHIFT_STEP; lightness > 0 && lightness < 1; lightness += direction * SHIFT_STEP) {
|
|
19273
|
+
const shifted = colorAt(lightness, saturation * lightness, H);
|
|
19274
|
+
if (reads(shifted)) return shifted;
|
|
19275
|
+
}
|
|
19276
|
+
const end = direction > 0 ? '#ffffff' : '#000000';
|
|
19277
|
+
return reads(end) ? end : null;
|
|
19278
|
+
}
|
|
19279
|
+
|
|
19280
|
+
/**
|
|
19281
|
+
* A brand color as it may be stored and shown, or null when the value is not
|
|
19282
|
+
* one: a `#rrggbb` hex value, read case-insensitively.
|
|
19283
|
+
*
|
|
19284
|
+
* @param {unknown} value
|
|
19285
|
+
* @returns {string|null} The color in lowercase
|
|
19286
|
+
*/
|
|
19287
|
+
function brandColor(value) {
|
|
19288
|
+
if (typeof value !== 'string') return null;
|
|
19289
|
+
const color = value.toLowerCase();
|
|
19290
|
+
return HEX_COLOR.test(color) ? color : null;
|
|
19291
|
+
}
|
|
19292
|
+
|
|
19293
|
+
/** How far a fill under the pointer moves at least, in OKLCH lightness. */
|
|
19294
|
+
const HOVER_SHIFT = 0.05;
|
|
19295
|
+
|
|
19296
|
+
/**
|
|
19297
|
+
* How far a fill under the pointer stands from the fill at least, as a
|
|
19298
|
+
* contrast ratio: where HOVER_SHIFT moves a very dark fill too little for a
|
|
19299
|
+
* reader to see (black's step is a 1.0:1 change), the hover moves on until
|
|
19300
|
+
* it stands this far apart.
|
|
19301
|
+
*/
|
|
19302
|
+
const HOVER_CONTRAST = 1.1;
|
|
19303
|
+
|
|
19304
|
+
/**
|
|
19305
|
+
* A fill under the pointer: the first step in OKLCH lightness at its own hue
|
|
19306
|
+
* (shiftedUntil) at least HOVER_SHIFT from the fill that stands
|
|
19307
|
+
* HOVER_CONTRAST from it, away from its label (darker under white, lighter
|
|
19308
|
+
* under ink), so the label reads more strongly on it still, where that step
|
|
19309
|
+
* `stands` (for a dark fill, standsWhere: on the grounds it stands on, under
|
|
19310
|
+
* its label). Where it does not (a fill too near that end of the range, black
|
|
19311
|
+
* and its nearest neighbors under white or white under ink, or a dark fill
|
|
19312
|
+
* whose step away sinks into its grounds), the first such step toward its
|
|
19313
|
+
* label, where that one stands; a step further either way only moves further
|
|
19314
|
+
* from the fill. Null where neither stands.
|
|
19315
|
+
*
|
|
19316
|
+
* @param {string} fill - A `#rrggbb` color
|
|
19317
|
+
* @param {'white'|'ink'} onAccent - Its label
|
|
19318
|
+
* @param {(candidate: string) => boolean} [stands]
|
|
19319
|
+
* @returns {string|null}
|
|
19320
|
+
*/
|
|
19321
|
+
function hoverOf(fill, onAccent, stands = () => true) {
|
|
19322
|
+
const { L } = oklchOf(fill);
|
|
19323
|
+
const luminance = relativeLuminance(fill);
|
|
19324
|
+
const apart = (candidate) => Math.abs(oklchOf(candidate).L - L) >= HOVER_SHIFT - Number.EPSILON
|
|
19325
|
+
&& contrastRatio(relativeLuminance(candidate), luminance) >= HOVER_CONTRAST;
|
|
19326
|
+
const away = onAccent === 'white' ? -1 : 1;
|
|
19327
|
+
return [away, -away].map((direction) => shiftedUntil(fill, direction, apart)).find((step) => step !== null && stands(step)) ?? null;
|
|
19328
|
+
}
|
|
19329
|
+
|
|
19330
|
+
/**
|
|
19331
|
+
* Whether a dark fill's hover stands where the fill does: at
|
|
19332
|
+
* AA_NON_TEXT_CONTRAST on each of the grounds (their relative luminances),
|
|
19333
|
+
* under the fill's label at AA_TEXT_CONTRAST.
|
|
19334
|
+
*
|
|
19335
|
+
* @param {number[]} luminances
|
|
19336
|
+
* @param {'white'|'ink'} onAccent
|
|
19337
|
+
* @returns {(candidate: string) => boolean}
|
|
19338
|
+
*/
|
|
19339
|
+
const standsWhere = (luminances, onAccent) => (candidate) => {
|
|
19340
|
+
const luminance = relativeLuminance(candidate);
|
|
19341
|
+
return lowestContrast(luminance, luminances) >= AA_NON_TEXT_CONTRAST
|
|
19342
|
+
&& contrastRatio(luminance, onAccent === 'white' ? 1 : INK_LUMINANCE) >= AA_TEXT_CONTRAST;
|
|
19343
|
+
};
|
|
19344
|
+
|
|
19345
|
+
/**
|
|
19346
|
+
* @typedef {Object} AccentPairing
|
|
19347
|
+
* @property {string} fill - The fill of a primary action, `#rrggbb`
|
|
19348
|
+
* @property {'white'|'ink'} onAccent - The text on it: white, or the light ink (INK_COLOR)
|
|
19349
|
+
* @property {string} ink - The accent as text on the scheme's grounds, `#rrggbb`
|
|
19350
|
+
* @property {string} hover - The fill under the pointer, `#rrggbb`
|
|
19351
|
+
*/
|
|
19352
|
+
|
|
19353
|
+
/**
|
|
19354
|
+
* What a brand color becomes on the light grounds (the white surface and the
|
|
19355
|
+
* canvas tone): its label, white or ink, whichever reads more strongly on
|
|
19356
|
+
* it; its fill, itself where that label reads on it at AA_TEXT_CONTRAST,
|
|
19357
|
+
* else moved in lightness away from the label (shiftedUntil) to the first
|
|
19358
|
+
* step where it does; the color itself as text where it reads at
|
|
19359
|
+
* AA_TEXT_CONTRAST on both grounds (accentTextContrast), INK_COLOR otherwise;
|
|
19360
|
+
* and its fill under the pointer (hoverOf).
|
|
19361
|
+
*
|
|
19362
|
+
* @param {unknown} value
|
|
19363
|
+
* @returns {AccentPairing|null} Null when the value is not a brand color
|
|
19364
|
+
*/
|
|
19365
|
+
function lightAccent(value) {
|
|
19366
|
+
const color = brandColor(value);
|
|
19367
|
+
if (!color) return null;
|
|
19368
|
+
const luminance = relativeLuminance(color);
|
|
19369
|
+
const onAccent = labelOf(luminance);
|
|
19370
|
+
const fill = shiftedUntil(color, onAccent === 'white' ? -1 : 1, (candidate) => labelContrast(relativeLuminance(candidate)) >= AA_TEXT_CONTRAST);
|
|
19371
|
+
return { fill, onAccent, ink: textContrast(luminance) >= AA_TEXT_CONTRAST ? color : INK_COLOR, hover: hoverOf(fill, onAccent) };
|
|
19372
|
+
}
|
|
19373
|
+
|
|
19374
|
+
/**
|
|
19375
|
+
* The color a brand color starts its dark lift from: itself where it has a
|
|
19376
|
+
* hue a reader sees (hasHue), kept as it lifts; the dark scheme's ink
|
|
19377
|
+
* (DARK_INK_COLOR) for a grey or black, which has no hue to keep and lifted
|
|
19378
|
+
* would read as a disabled control.
|
|
19379
|
+
*/
|
|
19380
|
+
const darkSource = (color) => (hasHue(oklchOf(color)) ? color : DARK_INK_COLOR);
|
|
19381
|
+
|
|
19382
|
+
/** The relative luminances of grounds given as sRGB channels. */
|
|
19383
|
+
const luminancesOf = (grounds) => grounds.map(channelLuminance);
|
|
19384
|
+
|
|
19385
|
+
/**
|
|
19386
|
+
* A brand color's fill on dark grounds: the color (darkSource) lifted
|
|
19387
|
+
* (shiftedUntil) until it stands at AA_NON_TEXT_CONTRAST on each of `grounds`,
|
|
19388
|
+
* white or ink, whichever reads more strongly on it, reads at
|
|
19389
|
+
* AA_TEXT_CONTRAST, and it has a fill under the pointer that stands there
|
|
19390
|
+
* too (hoverOf, standsWhere); that label; and that hover. A color that
|
|
19391
|
+
* already stands there is itself.
|
|
19392
|
+
*
|
|
19393
|
+
* @param {unknown} value
|
|
19394
|
+
* @param {number[][]} [grounds] - sRGB channels from 0 to 1; the dark app ramp's page and cards unless given
|
|
19395
|
+
* @returns {{ fill: string, onAccent: 'white'|'ink', hover: string }|null} Null when the value is not a brand color, or no lift stands on `grounds`
|
|
19396
|
+
*/
|
|
19397
|
+
function darkAccentFill(value, grounds = DARK_FILL_GROUNDS) {
|
|
19398
|
+
const color = brandColor(value);
|
|
19399
|
+
if (!color) return null;
|
|
19400
|
+
const luminances = luminancesOf(grounds);
|
|
19401
|
+
// The step that stands, with its label and hover, kept from the walk that found it.
|
|
19402
|
+
let found = null;
|
|
19403
|
+
shiftedUntil(darkSource(color), 1, (candidate) => {
|
|
19404
|
+
const luminance = relativeLuminance(candidate);
|
|
19405
|
+
if (lowestContrast(luminance, luminances) < AA_NON_TEXT_CONTRAST || labelContrast(luminance) < AA_TEXT_CONTRAST) return false;
|
|
19406
|
+
const onAccent = labelOf(luminance);
|
|
19407
|
+
const hover = hoverOf(candidate, onAccent, standsWhere(luminances, onAccent));
|
|
19408
|
+
found = hover && { fill: candidate, onAccent, hover };
|
|
19409
|
+
return found !== null;
|
|
19410
|
+
});
|
|
19411
|
+
return found;
|
|
19412
|
+
}
|
|
19413
|
+
|
|
19414
|
+
/**
|
|
19415
|
+
* A brand color as text on dark grounds: the color (darkSource) lifted
|
|
19416
|
+
* (shiftedUntil) until it reads at AA_TEXT_CONTRAST on each of `grounds`. A
|
|
19417
|
+
* color that already reads there is itself.
|
|
19418
|
+
*
|
|
19419
|
+
* @param {unknown} value
|
|
19420
|
+
* @param {number[][]} [grounds] - sRGB channels from 0 to 1; the dark app ramp's page, cards and selection unless given
|
|
19421
|
+
* @returns {string|null} Null when the value is not a brand color, or no lift reads on `grounds`
|
|
19422
|
+
*/
|
|
19423
|
+
function darkAccentInk(value, grounds = DARK_TEXT_GROUNDS) {
|
|
19424
|
+
const color = brandColor(value);
|
|
19425
|
+
if (!color) return null;
|
|
19426
|
+
const luminances = luminancesOf(grounds);
|
|
19427
|
+
return shiftedUntil(darkSource(color), 1, (candidate) => lowestContrast(relativeLuminance(candidate), luminances) >= AA_TEXT_CONTRAST);
|
|
19428
|
+
}
|
|
19429
|
+
|
|
19430
|
+
/**
|
|
19431
|
+
* What a brand color becomes on the design system's dark app grounds: its
|
|
19432
|
+
* fill and label (darkAccentFill) and its text (darkAccentInk), each lifted
|
|
19433
|
+
* at the color's own hue until it reads there. On a help center's own dark
|
|
19434
|
+
* ground the customer portal lifts this pairing again, with the same two,
|
|
19435
|
+
* against that ground and the grounds it draws from it.
|
|
19436
|
+
*
|
|
19437
|
+
* @param {unknown} value
|
|
19438
|
+
* @returns {AccentPairing|null} Null when the value is not a brand color
|
|
19439
|
+
*/
|
|
19440
|
+
function darkAccent(value) {
|
|
19441
|
+
const fill = darkAccentFill(value);
|
|
19442
|
+
return fill && { ...fill, ink: darkAccentInk(value) };
|
|
19443
|
+
}
|
|
19444
|
+
|
|
19445
|
+
/**
|
|
19446
|
+
* A brand color's pairing in each scheme, derived once for whatever writes
|
|
19447
|
+
* them and weighs them together: on the light grounds (lightAccent) and on
|
|
19448
|
+
* the dark app grounds (darkAccent).
|
|
19449
|
+
*
|
|
19450
|
+
* @param {unknown} value
|
|
19451
|
+
* @returns {Readonly<{ light: AccentPairing, dark: AccentPairing }>|null} Null when the value is not a brand color
|
|
19452
|
+
*/
|
|
19453
|
+
function schemePairings(value) {
|
|
19454
|
+
const light = lightAccent(value);
|
|
19455
|
+
return light && Object.freeze({ light, dark: darkAccent(value) });
|
|
19456
|
+
}
|
|
19457
|
+
|
|
19458
|
+
/**
|
|
19459
|
+
* How accentProperties writes white and each scheme's ink, the colors a
|
|
19460
|
+
* design-system token names: as those tokens (`tokens`), for a page whose
|
|
19461
|
+
* stylesheet declares them (the customer portal, the console's sample), or as
|
|
19462
|
+
* the colors themselves (`colors`), for a page that declares none (the SDK's
|
|
19463
|
+
* widget on a customer's website). Each token holds the color beside it.
|
|
19464
|
+
*/
|
|
19465
|
+
const WRITINGS = Object.freeze({
|
|
19466
|
+
tokens: Object.freeze({ white: 'var(--color-white)', ink: 'var(--ink)', darkInk: 'var(--dark-app-ink)' }),
|
|
19467
|
+
colors: Object.freeze({ white: '#ffffff', ink: INK_COLOR, darkInk: DARK_INK_COLOR })
|
|
19468
|
+
});
|
|
19469
|
+
|
|
19470
|
+
/**
|
|
19471
|
+
* The accent custom properties for a desk's pairings (a brand color's,
|
|
19472
|
+
* schemePairings, or DEFAULT_PAIRINGS), for each scheme a help desk surface
|
|
19473
|
+
* paints in: on light grounds the fill (`--hd-light-accent`), the text on it
|
|
19474
|
+
* (`--hd-light-on-accent`), the accent as text (`--hd-light-accent-ink`) and
|
|
19475
|
+
* the fill under the pointer (`--hd-light-accent-hover`); on the dark app
|
|
19476
|
+
* grounds the same four (`--hd-dark-*`). The one place these names are
|
|
19477
|
+
* spelled: the customer portal's root, the console's sample and every element
|
|
19478
|
+
* of the SDK's widget carry what it returns.
|
|
19479
|
+
*
|
|
19480
|
+
* @param {{ light: AccentPairing, dark: AccentPairing }} pairings
|
|
19481
|
+
* @param {'tokens'|'colors'} [writing] - How white and each scheme's ink are written (WRITINGS)
|
|
19482
|
+
* @returns {Record<`--hd-${'light'|'dark'}-${'accent'|'on-accent'|'accent-ink'|'accent-hover'}`, string>}
|
|
19483
|
+
*/
|
|
19484
|
+
function accentProperties(pairings, writing = 'tokens') {
|
|
19485
|
+
const { white, ink, darkInk } = WRITINGS[writing];
|
|
19486
|
+
const label = { white, ink };
|
|
19487
|
+
const { light, dark } = pairings;
|
|
19488
|
+
return {
|
|
19489
|
+
'--hd-light-accent': light.fill,
|
|
19490
|
+
'--hd-light-on-accent': label[light.onAccent],
|
|
19491
|
+
'--hd-light-accent-ink': light.ink === INK_COLOR ? ink : light.ink,
|
|
19492
|
+
'--hd-light-accent-hover': light.hover,
|
|
19493
|
+
'--hd-dark-accent': dark.fill === DARK_INK_COLOR ? darkInk : dark.fill,
|
|
19494
|
+
'--hd-dark-on-accent': label[dark.onAccent],
|
|
19495
|
+
'--hd-dark-accent-ink': dark.ink === DARK_INK_COLOR ? darkInk : dark.ink,
|
|
19496
|
+
'--hd-dark-accent-hover': dark.hover
|
|
19497
|
+
};
|
|
19498
|
+
}
|
|
19499
|
+
|
|
19500
|
+
/**
|
|
19501
|
+
* The help desk's color roles as every customer-facing piece of its UI reads
|
|
19502
|
+
* them, written once: the SDK's support launcher, its panel, the request
|
|
19503
|
+
* form and its modal (sdk-js products/help-desk) and the composer both share
|
|
19504
|
+
* (help-desk-composer.js). Each reads the customer portal's color role of the
|
|
19505
|
+
* same meaning (`--hd-*`, which the portal's root maps to its scheme's color
|
|
19506
|
+
* set), else the design system's light value, the one the portal's own light
|
|
19507
|
+
* set maps the role to, so on a page that sets none, a customer's own website
|
|
19508
|
+
* among them, the UI stays light.
|
|
19509
|
+
*
|
|
19510
|
+
* The accent reads the page's accent roles (`--hd-accent*`, which the portal's
|
|
19511
|
+
* root sets to the pairing its scheme paints), else the light pairing the
|
|
19512
|
+
* element it paints in carries (`--hd-light-accent*`: the SDK's launcher,
|
|
19513
|
+
* panel, form container and modal each carry the desk's), else the light
|
|
19514
|
+
* half of brand-color.js' DEFAULT_PAIRINGS, the pairing a desk without a
|
|
19515
|
+
* brand color takes.
|
|
19516
|
+
*
|
|
19517
|
+
* BROWSER-SAFE: data only; imports only brand-color.js.
|
|
19518
|
+
*/
|
|
19519
|
+
|
|
19520
|
+
|
|
19521
|
+
/**
|
|
19522
|
+
* The light value of each design-system token a role falls back to, keyed by
|
|
19523
|
+
* that token (tests/help-desk-colors.test.js holds each to
|
|
19524
|
+
* packages/design-system/tokens). The canvas tone and the ink are
|
|
19525
|
+
* brand-color.js' mirrors of those tokens.
|
|
19526
|
+
*/
|
|
19527
|
+
const HELP_DESK_LIGHT_COLORS = Object.freeze({
|
|
19528
|
+
'--surface': '#ffffff',
|
|
19529
|
+
'--canvas': CANVAS_COLOR,
|
|
19530
|
+
'--color-slate-100': '#f0f5f7',
|
|
19531
|
+
'--color-slate-200': '#e0e9ed',
|
|
19532
|
+
'--color-slate-300': '#c9d6dc',
|
|
19533
|
+
'--ink': INK_COLOR,
|
|
19534
|
+
'--text-body': '#425761',
|
|
19535
|
+
'--text-muted': '#5e757f',
|
|
19536
|
+
'--color-action-bg': '#eef4fe',
|
|
19537
|
+
'--color-error': '#b02b27'
|
|
19538
|
+
});
|
|
19539
|
+
|
|
19540
|
+
const LIGHT = HELP_DESK_LIGHT_COLORS;
|
|
19541
|
+
|
|
19542
|
+
/** 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. */
|
|
19543
|
+
const DEFAULT = accentProperties(DEFAULT_PAIRINGS, 'colors');
|
|
19544
|
+
|
|
19545
|
+
/** The neutral and error roles, each the page's `--hd-*` role, else its light value. */
|
|
19546
|
+
const HELP_DESK_COLORS = Object.freeze({
|
|
19547
|
+
/** A panel and its cards. */
|
|
19548
|
+
surface: `var(--hd-surface,${LIGHT['--surface']})`,
|
|
19549
|
+
/** A field's ground. */
|
|
19550
|
+
field: `var(--hd-field,${LIGHT['--surface']})`,
|
|
19551
|
+
/** A quiet ground: a question's recap, a note, code, a disabled field. */
|
|
19552
|
+
canvas: `var(--hd-canvas,${LIGHT['--canvas']})`,
|
|
19553
|
+
/** A raised row or control under the pointer. */
|
|
19554
|
+
hover: `var(--hd-hover,${LIGHT['--canvas']})`,
|
|
19555
|
+
/** An icon control under the pointer, and the quietest rules. */
|
|
19556
|
+
fill: `var(--hd-fill,${LIGHT['--color-slate-100']})`,
|
|
19557
|
+
/** Rules and edges. */
|
|
19558
|
+
fillStrong: `var(--hd-fill-strong,${LIGHT['--color-slate-200']})`,
|
|
19559
|
+
/** A field's and a secondary action's edge. */
|
|
19560
|
+
lineStrong: `var(--hd-line-strong,${LIGHT['--color-slate-300']})`,
|
|
19561
|
+
ink: `var(--hd-ink,${LIGHT['--ink']})`,
|
|
19562
|
+
body: `var(--hd-text-body,${LIGHT['--text-body']})`,
|
|
19563
|
+
muted: `var(--hd-text-muted,${LIGHT['--text-muted']})`,
|
|
19564
|
+
/** Selected text, and the composer's drop prompt. */
|
|
19565
|
+
selection: `var(--hd-selection,${LIGHT['--color-action-bg']})`,
|
|
19566
|
+
error: `var(--hd-error,${LIGHT['--color-error']})`
|
|
19567
|
+
});
|
|
19568
|
+
|
|
19569
|
+
/** The accent roles: the fill of a primary action, the text on it, the accent as text, and the fill under the pointer. */
|
|
19570
|
+
const HELP_DESK_ACCENT = Object.freeze({
|
|
19571
|
+
fill: `var(--hd-accent,var(--hd-light-accent,${DEFAULT['--hd-light-accent']}))`,
|
|
19572
|
+
onAccent: `var(--hd-on-accent,var(--hd-light-on-accent,${DEFAULT['--hd-light-on-accent']}))`,
|
|
19573
|
+
ink: `var(--hd-accent-ink,var(--hd-light-accent-ink,${DEFAULT['--hd-light-accent-ink']}))`,
|
|
19574
|
+
hover: `var(--hd-accent-hover,var(--hd-light-accent-hover,${DEFAULT['--hd-light-accent-hover']}))`
|
|
19575
|
+
});
|
|
19576
|
+
|
|
19577
|
+
/** The focus ring's color: the page's `--hd-focus` where it sets one, else the accent as text. */
|
|
19578
|
+
const HELP_DESK_FOCUS = `var(--hd-focus,${HELP_DESK_ACCENT.ink})`;
|
|
19579
|
+
|
|
19580
|
+
/**
|
|
19581
|
+
* Both schemes' pairings as the custom properties an element carries them
|
|
19582
|
+
* under (@sparkvault/app-sdk/brand-color accentProperties: `--hd-light-accent*`,
|
|
19583
|
+
* `--hd-dark-accent*`), written as colors, since a customer's website declares
|
|
19584
|
+
* none of the design system's tokens.
|
|
19585
|
+
*/
|
|
19586
|
+
function pairingProperties(pairings) {
|
|
19587
|
+
return Object.freeze(accentProperties(pairings, 'colors'));
|
|
19588
|
+
}
|
|
19589
|
+
/** The default pairings (@sparkvault/app-sdk/brand-color DEFAULT_PAIRINGS) as the custom properties, every one an element can carry. */
|
|
19590
|
+
const DEFAULT_PROPERTIES = pairingProperties(DEFAULT_PAIRINGS);
|
|
19591
|
+
/**
|
|
19592
|
+
* The default pairings (@sparkvault/app-sdk/brand-color DEFAULT_PAIRINGS, the
|
|
19593
|
+
* ones the customer portal, the console's sample and the desk's email paint
|
|
19594
|
+
* for a desk without a brand color) as stylesheet declarations, which a
|
|
19595
|
+
* desk's brand color replaces (applySupportBrand). The launcher, the support
|
|
19596
|
+
* panel, the request form's container and its modal each carry them, so the
|
|
19597
|
+
* accent roles (@sparkvault/app-sdk/help-desk-colors HELP_DESK_ACCENT) read
|
|
19598
|
+
* the light pairing the element carries, and a website may point those roles
|
|
19599
|
+
* at the dark one.
|
|
19600
|
+
*/
|
|
19601
|
+
const DEFAULT_PAIRING_DECLARATIONS = Object.entries(DEFAULT_PROPERTIES).map(([name, value]) => `${name}:${value}`).join(';');
|
|
19602
|
+
const NO_BRAND = Object.freeze({ color: null, properties: null });
|
|
19603
|
+
/**
|
|
19604
|
+
* Pairs a desk's brand color for every carrier, once: both of its pairings
|
|
19605
|
+
* (@sparkvault/app-sdk/brand-color schemePairings, the ones the customer
|
|
19606
|
+
* portal and the desk's email paint too), under each scheme's names: the
|
|
19607
|
+
* fill, white or the ink on it, the accent as text, and the fill under the
|
|
19608
|
+
* pointer. Whoever learns the desk's color derives it and hands the one brand
|
|
19609
|
+
* to each element it paints (applySupportBrand), so a desk's color is paired
|
|
19610
|
+
* once however often its elements render. A value that is no brand color is
|
|
19611
|
+
* none.
|
|
19612
|
+
*/
|
|
19613
|
+
function supportBrand(value) {
|
|
19614
|
+
const color = brandColor(value);
|
|
19615
|
+
const pairings = color === null ? null : schemePairings(color);
|
|
19616
|
+
return pairings ? Object.freeze({ color, properties: pairingProperties(pairings) }) : NO_BRAND;
|
|
19617
|
+
}
|
|
19618
|
+
/**
|
|
19619
|
+
* The brand for a desk's color: `held` where it pairs that same color, so a
|
|
19620
|
+
* color learned again (a held desk's, then connect's answer for it) is paired
|
|
19621
|
+
* once and stays the one object every element compares.
|
|
19622
|
+
*/
|
|
19623
|
+
function brandFor(value, held) {
|
|
19624
|
+
return brandColor(value) === held.color ? held : supportBrand(value);
|
|
19625
|
+
}
|
|
19626
|
+
/**
|
|
19627
|
+
* Sets a desk's brand (supportBrand) on the launcher, the support panel, the
|
|
19628
|
+
* request form's container or the form's modal. The stylesheet paints the
|
|
19629
|
+
* light pairing wherever the accent roles (`--hd-accent*`) are not set, so on
|
|
19630
|
+
* a website the widget's accent is the pairing the portal paints on light
|
|
19631
|
+
* pages until the page points the roles at the dark pairing, and inside the
|
|
19632
|
+
* customer portal each takes the portal's roles. Scoped to the element, so it
|
|
19633
|
+
* works on a hosted page and on any website the widget stands on; a brand
|
|
19634
|
+
* with no color clears them, and the stylesheet's default pairings return.
|
|
19635
|
+
*/
|
|
19636
|
+
function applySupportBrand(target, brand) {
|
|
19637
|
+
for (const name of Object.keys(DEFAULT_PROPERTIES)) {
|
|
19638
|
+
const value = brand.properties?.[name];
|
|
19639
|
+
if (value)
|
|
19640
|
+
target.style.setProperty(name, value);
|
|
19641
|
+
else
|
|
19642
|
+
target.style.removeProperty(name);
|
|
19643
|
+
}
|
|
19644
|
+
}
|
|
19645
|
+
|
|
19646
|
+
/**
|
|
19647
|
+
* Scoped styles for the optional inline help desk form and its modal, in the
|
|
19648
|
+
* help desk's color roles (@sparkvault/app-sdk/help-desk-colors): their
|
|
19649
|
+
* neutrals the page's roles where it sets them (HOST), their accent the
|
|
19650
|
+
* page's accent roles, else the desk's light pairing, which the form's
|
|
19651
|
+
* container and the modal each carry (ACCENT, DEFAULT_PAIRING_DECLARATIONS),
|
|
19652
|
+
* as the support panel does.
|
|
19653
|
+
*/
|
|
18849
19654
|
function injectHelpDeskFormStyles() {
|
|
18850
19655
|
if (document.getElementById('sparkvault-help-desk-styles'))
|
|
18851
19656
|
return;
|
|
@@ -18854,33 +19659,33 @@ function injectHelpDeskFormStyles() {
|
|
|
18854
19659
|
style.textContent = `
|
|
18855
19660
|
.svhd-overlay{position:fixed;inset:0;z-index:2147483000;display:flex;align-items:center;justify-content:center;padding:16px;background:${DS.modalOverlay};overflow:auto}
|
|
18856
19661
|
.svhd-blur{backdrop-filter:blur(5px)}
|
|
18857
|
-
.svhd-modal{width:100%;max-width:36rem;max-height:calc(100dvh - 32px);overflow:auto;border-radius:12px;background:${
|
|
19662
|
+
.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}}
|
|
18858
19663
|
.svhd-modal-header{display:flex;justify-content:flex-end;padding:12px 16px 0}
|
|
18859
|
-
.svhd-modal-close{border:0;border-radius:4px;background:transparent;color:${
|
|
18860
|
-
.svhd-modal-close:hover{color:${
|
|
18861
|
-
.svhd-modal-close:focus-visible{outline:3px solid ${
|
|
19664
|
+
.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}
|
|
19665
|
+
.svhd-modal-close:hover{color:${HELP_DESK_COLORS.ink}}
|
|
19666
|
+
.svhd-modal-close:focus-visible{outline:3px solid ${HELP_DESK_FOCUS};outline-offset:2px}
|
|
18862
19667
|
.svhd-modal .svhd-container{max-width:none;border:0;border-radius:0;padding-top:8px}
|
|
18863
|
-
.svhd-container{box-sizing:border-box;max-width:36rem;border:1px solid ${
|
|
19668
|
+
.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}}
|
|
18864
19669
|
.svhd-container *{box-sizing:border-box}
|
|
18865
19670
|
.svhd-container h2{font-size:22px;line-height:1.25;margin:0}
|
|
18866
19671
|
.svhd-step-head h2:focus{outline:none}
|
|
18867
19672
|
.svhd-form{display:grid;gap:16px}
|
|
18868
19673
|
.svhd-field{display:grid;gap:6px}
|
|
18869
19674
|
.svhd-label{font-weight:600}
|
|
18870
|
-
.svhd-input{width:100%;border:1px solid ${
|
|
18871
|
-
.svhd-input:focus-visible,.svhd-button:focus-visible,.svhd-link:focus-visible{outline:3px solid ${
|
|
18872
|
-
.svhd-input:disabled{background:${
|
|
19675
|
+
.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}
|
|
19676
|
+
.svhd-input:focus-visible,.svhd-button:focus-visible,.svhd-link:focus-visible{outline:3px solid ${HELP_DESK_FOCUS};outline-offset:2px}
|
|
19677
|
+
.svhd-input:disabled{background:${HELP_DESK_COLORS.canvas}}
|
|
18873
19678
|
.svhd-auth{display:grid;gap:16px;border:0;padding:0;margin:0}
|
|
18874
19679
|
.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}
|
|
18875
19680
|
.svhd-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
|
|
18876
|
-
.svhd-button{border:0;border-radius:6px;padding:10px 16px;min-height:44px;font:600 15px/1.5 system-ui,sans-serif;background:${
|
|
18877
|
-
.svhd-button:hover{background:${
|
|
19681
|
+
.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}
|
|
19682
|
+
.svhd-button:hover{background:${HELP_DESK_ACCENT.hover}}
|
|
18878
19683
|
.svhd-button:disabled{opacity:.6;cursor:default}
|
|
18879
|
-
.svhd-secondary{background:transparent;color:${
|
|
18880
|
-
.svhd-secondary:hover{background:transparent;color:${
|
|
18881
|
-
.svhd-status{margin:0;color:${
|
|
18882
|
-
.svhd-error{color:${
|
|
18883
|
-
.svhd-field-error{margin:0;font-size:14px;color:${
|
|
19684
|
+
.svhd-secondary{background:transparent;color:${HELP_DESK_COLORS.body};padding:10px 4px}
|
|
19685
|
+
.svhd-secondary:hover{background:transparent;color:${HELP_DESK_COLORS.ink}}
|
|
19686
|
+
.svhd-status{margin:0;color:${HELP_DESK_COLORS.body}}
|
|
19687
|
+
.svhd-error{color:${HELP_DESK_COLORS.error}}
|
|
19688
|
+
.svhd-field-error{margin:0;font-size:14px;color:${HELP_DESK_COLORS.error}}
|
|
18884
19689
|
.svhd-code-links{display:flex;flex-wrap:wrap;gap:4px 16px}
|
|
18885
19690
|
.svhd-confirm{display:grid;gap:8px}
|
|
18886
19691
|
.svhd-confirm-title{font-weight:600;margin:0}
|
|
@@ -18888,26 +19693,26 @@ function injectHelpDeskFormStyles() {
|
|
|
18888
19693
|
.svhd-done-title{font-size:18px;line-height:1.3;margin:0}
|
|
18889
19694
|
.svhd-done-title:focus{outline:none}
|
|
18890
19695
|
.svhd-confirmation-message{white-space:pre-wrap;overflow-wrap:anywhere}
|
|
18891
|
-
.svhd-link{display:inline-flex;align-items:center;justify-self:start;min-height:44px;color:${
|
|
18892
|
-
.svhd-hint{font-size:13px;color:${
|
|
19696
|
+
.svhd-link{display:inline-flex;align-items:center;justify-self:start;min-height:44px;color:${HELP_DESK_ACCENT.ink};text-decoration:underline}
|
|
19697
|
+
.svhd-hint{font-size:13px;color:${HELP_DESK_COLORS.body};margin:0}
|
|
18893
19698
|
.svhd-step{display:grid;gap:16px;min-width:0}
|
|
18894
19699
|
.svhd-step-head{display:grid;gap:4px;margin-bottom:4px}
|
|
18895
|
-
.svhd-step-label{margin:0;font-size:13px;font-weight:600;line-height:1.4;color:${
|
|
18896
|
-
.svhd-text-button{display:inline-flex;align-items:center;min-height:44px;padding:0 4px;border:0;border-radius:6px;background:transparent;color:${
|
|
18897
|
-
.svhd-text-button:hover{
|
|
18898
|
-
.svhd-text-button:focus-visible{outline:3px solid ${
|
|
18899
|
-
.svhd-text-button:disabled{color:${
|
|
19700
|
+
.svhd-step-label{margin:0;font-size:13px;font-weight:600;line-height:1.4;color:${HELP_DESK_COLORS.body}}
|
|
19701
|
+
.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}
|
|
19702
|
+
.svhd-text-button:not(:disabled):hover{text-decoration-thickness:2px}
|
|
19703
|
+
.svhd-text-button:focus-visible{outline:3px solid ${HELP_DESK_FOCUS};outline-offset:2px}
|
|
19704
|
+
.svhd-text-button:disabled{color:${HELP_DESK_COLORS.muted};cursor:default}
|
|
18900
19705
|
.svhd-widget-account{display:flex;align-items:center;flex-wrap:wrap;gap:0 16px;min-width:0}
|
|
18901
|
-
.svhd-posting-as{margin:0;color:${
|
|
18902
|
-
.svhd-note{display:flex;align-items:flex-start;gap:10px;margin:0;padding:12px 14px;border:1px solid ${
|
|
18903
|
-
.svhd-step .svhd-note svg{display:block;width:18px;height:18px;flex:none;margin-top:2px;color:${
|
|
18904
|
-
.svhd-recap{display:flex;align-items:center;gap:12px;padding:6px 6px 6px 14px;border:1px solid ${
|
|
19706
|
+
.svhd-posting-as{margin:0;color:${HELP_DESK_COLORS.body};font-size:14px;line-height:1.5;overflow-wrap:anywhere}
|
|
19707
|
+
.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}
|
|
19708
|
+
.svhd-step .svhd-note svg{display:block;width:18px;height:18px;flex:none;margin-top:2px;color:${HELP_DESK_ACCENT.ink}}
|
|
19709
|
+
.svhd-recap{display:flex;align-items:center;gap:12px;padding:6px 6px 6px 14px;border:1px solid ${HELP_DESK_COLORS.fillStrong};border-radius:8px}
|
|
18905
19710
|
.svhd-recap-request{flex:1;min-width:0}
|
|
18906
|
-
.svhd-recap-label{display:block;color:${
|
|
18907
|
-
.svhd-recap-text{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0;color:${
|
|
19711
|
+
.svhd-recap-label{display:block;color:${HELP_DESK_COLORS.body};font-size:12px;font-weight:600;line-height:1.4}
|
|
19712
|
+
.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}
|
|
18908
19713
|
.svhd-recap .svhd-text-button{flex:none}
|
|
18909
19714
|
.svhd-live{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
|
|
18910
|
-
.svhd-footer{margin-top:20px;font-size:12px;color:${
|
|
19715
|
+
.svhd-footer{margin-top:20px;font-size:12px;color:${HELP_DESK_COLORS.muted}}
|
|
18911
19716
|
`;
|
|
18912
19717
|
document.head.appendChild(style);
|
|
18913
19718
|
}
|
|
@@ -19526,123 +20331,6 @@ function refusalCopy(refusal, maxBytes) {
|
|
|
19526
20331
|
return REFUSAL_COPY[refusal] ?? "This file can't be attached.";
|
|
19527
20332
|
}
|
|
19528
20333
|
|
|
19529
|
-
/**
|
|
19530
|
-
* A tenant's brand color and the WCAG contrast rules that decide how it may be
|
|
19531
|
-
* used: the one hex rule the server stores, the console checks and the portal
|
|
19532
|
-
* paints, the one contrast reading the console's readouts, the portal's
|
|
19533
|
-
* accent and the portal's reading of a help center's ground share, and the
|
|
19534
|
-
* one way a readout writes that reading.
|
|
19535
|
-
*
|
|
19536
|
-
* A brand color is tenant-controlled, so it is used only when it is a
|
|
19537
|
-
* six-digit hex color, read case-insensitively and held in lowercase; anything
|
|
19538
|
-
* else (a color name, a CSS function, a value that runs on into more CSS) is
|
|
19539
|
-
* no color at all.
|
|
19540
|
-
*
|
|
19541
|
-
* A brand color can be any lightness, so whatever shows it picks what goes
|
|
19542
|
-
* with it: white or ink as the text on its fill, whichever reads more
|
|
19543
|
-
* strongly (at least 4.2:1 on any fill, as far as two inks reach on a
|
|
19544
|
-
* mid-tone), and the color itself as text only where it reaches 4.5:1 on
|
|
19545
|
-
* both grounds accent text stands on, the white surface and the canvas
|
|
19546
|
-
* tone, ink otherwise. accentProperties says that as the accent
|
|
19547
|
-
* custom properties the customer portal paints with and the console's sample
|
|
19548
|
-
* of it shows, in the design system's own tokens.
|
|
19549
|
-
*
|
|
19550
|
-
* BROWSER-SAFE: data only, no imports.
|
|
19551
|
-
*/
|
|
19552
|
-
|
|
19553
|
-
const HEX_COLOR = /^#[0-9a-f]{6}$/;
|
|
19554
|
-
|
|
19555
|
-
/** WCAG AA's floor for normal-size text. */
|
|
19556
|
-
const AA_TEXT_CONTRAST = 4.5;
|
|
19557
|
-
|
|
19558
|
-
/**
|
|
19559
|
-
* The canvas tone, the design system's `--canvas` (`--color-slate-50`): the
|
|
19560
|
-
* page ground the customer portal (its pages and a customer's own messages)
|
|
19561
|
-
* and the knowledge base's default theme set accent text on, beside the white
|
|
19562
|
-
* surface. The design system publishes its tokens only as CSS, which this
|
|
19563
|
-
* import-free module cannot read, so the value is mirrored here once, and
|
|
19564
|
-
* tests/brand-color.test.js holds it to packages/design-system/tokens/colors.css.
|
|
19565
|
-
*/
|
|
19566
|
-
const CANVAS_COLOR = '#f7fafb';
|
|
19567
|
-
|
|
19568
|
-
/**
|
|
19569
|
-
* The ink, the design system's `--ink` (`--color-slate-900`): the dark text a
|
|
19570
|
-
* pairing paints on a fill and in place of a color too light to stand as
|
|
19571
|
-
* text. Mirrored here once for the same reason as CANVAS_COLOR, and held to
|
|
19572
|
-
* packages/design-system/tokens/colors.css by tests/brand-color.test.js.
|
|
19573
|
-
*/
|
|
19574
|
-
const INK_COLOR = '#0d1a20';
|
|
19575
|
-
|
|
19576
|
-
/** Relative luminance (WCAG 2) of an sRGB color's red, green and blue channels, each from 0 to 1. */
|
|
19577
|
-
function channelLuminance(channels) {
|
|
19578
|
-
const [red, green, blue] = channels.map((channel) => (channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4));
|
|
19579
|
-
return 0.2126 * red + 0.7152 * green + 0.0722 * blue;
|
|
19580
|
-
}
|
|
19581
|
-
|
|
19582
|
-
/** Relative luminance (WCAG 2) of a validated `#rrggbb` color. */
|
|
19583
|
-
function relativeLuminance(color) {
|
|
19584
|
-
return channelLuminance([1, 3, 5].map((offset) => Number.parseInt(color.slice(offset, offset + 2), 16) / 255));
|
|
19585
|
-
}
|
|
19586
|
-
|
|
19587
|
-
/** The contrast ratio of two relative luminances. */
|
|
19588
|
-
function contrastRatio(first, second) {
|
|
19589
|
-
return (Math.max(first, second) + 0.05) / (Math.min(first, second) + 0.05);
|
|
19590
|
-
}
|
|
19591
|
-
|
|
19592
|
-
/** The relative luminance of the ink a fill's text is weighed in, the real ink rather than pure black. */
|
|
19593
|
-
const INK_LUMINANCE = relativeLuminance(INK_COLOR);
|
|
19594
|
-
|
|
19595
|
-
/** The relative luminances of the grounds accent text stands on: the white surface and the canvas tone. */
|
|
19596
|
-
const TEXT_GROUNDS = Object.freeze([1, relativeLuminance(CANVAS_COLOR)]);
|
|
19597
|
-
|
|
19598
|
-
/** How strongly a color of this luminance reads as text on the ground it reads least on. */
|
|
19599
|
-
function textContrast(luminance) {
|
|
19600
|
-
return Math.min(...TEXT_GROUNDS.map((ground) => contrastRatio(luminance, ground)));
|
|
19601
|
-
}
|
|
19602
|
-
|
|
19603
|
-
/**
|
|
19604
|
-
* A brand color as it may be stored and shown, or null when the value is not
|
|
19605
|
-
* one: a `#rrggbb` hex value, read case-insensitively.
|
|
19606
|
-
*
|
|
19607
|
-
* @param {unknown} value
|
|
19608
|
-
* @returns {string|null} The color in lowercase
|
|
19609
|
-
*/
|
|
19610
|
-
function brandColor(value) {
|
|
19611
|
-
if (typeof value !== 'string') return null;
|
|
19612
|
-
const color = value.toLowerCase();
|
|
19613
|
-
return HEX_COLOR.test(color) ? color : null;
|
|
19614
|
-
}
|
|
19615
|
-
|
|
19616
|
-
/**
|
|
19617
|
-
* What goes with a brand color: the text on its fill (white or ink,
|
|
19618
|
-
* whichever reads more strongly, at least 4.2:1 on any fill) and the ink for
|
|
19619
|
-
* it as text
|
|
19620
|
-
* (the color itself where it reaches AA_TEXT_CONTRAST on both the white
|
|
19621
|
-
* surface and the canvas tone, ink otherwise).
|
|
19622
|
-
*
|
|
19623
|
-
* @param {unknown} value
|
|
19624
|
-
* @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)
|
|
19625
|
-
*/
|
|
19626
|
-
function accentPairing(value) {
|
|
19627
|
-
const color = brandColor(value);
|
|
19628
|
-
if (!color) return null;
|
|
19629
|
-
const luminance = relativeLuminance(color);
|
|
19630
|
-
const ratio = textContrast(luminance);
|
|
19631
|
-
return {
|
|
19632
|
-
onAccent: contrastRatio(luminance, 1) >= contrastRatio(luminance, INK_LUMINANCE) ? 'white' : 'ink',
|
|
19633
|
-
accentInk: ratio >= AA_TEXT_CONTRAST ? 'accent' : 'ink',
|
|
19634
|
-
ratio
|
|
19635
|
-
};
|
|
19636
|
-
}
|
|
19637
|
-
|
|
19638
|
-
/** Contrast between a brand fill and the label selected by accentPairing. */
|
|
19639
|
-
function accentFillContrast(value) {
|
|
19640
|
-
const color = brandColor(value);
|
|
19641
|
-
if (!color) return null;
|
|
19642
|
-
const pairing = accentPairing(color);
|
|
19643
|
-
return contrastRatio(relativeLuminance(color), pairing.onAccent === 'white' ? 1 : INK_LUMINANCE);
|
|
19644
|
-
}
|
|
19645
|
-
|
|
19646
20334
|
/**
|
|
19647
20335
|
* Files brought to a message's composer by drag, drop and paste, handled
|
|
19648
20336
|
* alike by every composer that takes them: the console's reply composer and
|
|
@@ -19926,11 +20614,14 @@ function helpDeskIcon(name) {
|
|
|
19926
20614
|
* and whether trying again can mend it.
|
|
19927
20615
|
*
|
|
19928
20616
|
* The composer draws its own stylesheet (one unlayered `<style>` per
|
|
19929
|
-
* document), in the
|
|
19930
|
-
*
|
|
19931
|
-
*
|
|
19932
|
-
*
|
|
19933
|
-
*
|
|
20617
|
+
* document), in the help desk's color roles (help-desk-colors.js): the
|
|
20618
|
+
* host's where it sets them, else the design system's light values, with the
|
|
20619
|
+
* help desk's accent as text, the light pairing of the SDK's panel, form
|
|
20620
|
+
* container or modal it stands in where the host sets no accent role. Its
|
|
20621
|
+
* focus ring is the one the host's fields wear: its color, width and offset
|
|
20622
|
+
* are the host's `--hd-focus`, `--hd-focus-width` and `--hd-focus-offset`,
|
|
20623
|
+
* the color else that accent, the width and offset else the SDK's field
|
|
20624
|
+
* ring's (3px, 2px out).
|
|
19934
20625
|
*
|
|
19935
20626
|
* BROWSER-SAFE: builds its DOM through the page's `document`, and imports
|
|
19936
20627
|
* only app-sdk's browser-safe modules.
|
|
@@ -19940,34 +20631,11 @@ function helpDeskIcon(name) {
|
|
|
19940
20631
|
/** The id of the composer's one `<style>` element in a document. */
|
|
19941
20632
|
const HELP_DESK_COMPOSER_STYLE_ID = 'sparkvault-help-desk-composer-styles';
|
|
19942
20633
|
|
|
19943
|
-
/**
|
|
19944
|
-
* The design-system colors the composer is drawn in, each the value of the
|
|
19945
|
-
* token it names (tests/help-desk-composer.test.js holds them to
|
|
19946
|
-
* packages/design-system/tokens). The canvas tone and the ink are
|
|
19947
|
-
* brand-color.js' mirrors of those tokens.
|
|
19948
|
-
*/
|
|
19949
|
-
const COMPOSER_COLORS = Object.freeze({
|
|
19950
|
-
'--color-white': '#ffffff',
|
|
19951
|
-
'--canvas': CANVAS_COLOR,
|
|
19952
|
-
'--color-slate-100': '#f0f5f7',
|
|
19953
|
-
'--color-slate-200': '#e0e9ed',
|
|
19954
|
-
'--color-slate-300': '#c9d6dc',
|
|
19955
|
-
'--color-slate-600': '#425761',
|
|
19956
|
-
'--ink': INK_COLOR,
|
|
19957
|
-
'--color-action': '#216bde',
|
|
19958
|
-
'--color-action-bg': '#eef4fe',
|
|
19959
|
-
'--color-error': '#b02b27'
|
|
19960
|
-
});
|
|
19961
|
-
|
|
19962
|
-
const C = COMPOSER_COLORS;
|
|
19963
|
-
/** The help desk's accent ink where the host sets one, Action Blue where none does. */
|
|
19964
|
-
const ACCENT_INK = `var(--hd-accent-ink,${C['--color-action']})`;
|
|
19965
|
-
/** The focus ring of the host's fields: the SDK's field ring (`.svhd-input`) where the host sets none. */
|
|
19966
|
-
const FOCUS = `var(--hd-focus,${C['--color-action']})`;
|
|
20634
|
+
/** The focus ring's width and offset: the host's where it sets them, else the SDK's field ring (`.svhd-input`). */
|
|
19967
20635
|
const FOCUS_WIDTH = 'var(--hd-focus-width,3px)';
|
|
19968
20636
|
const FOCUS_OFFSET = 'var(--hd-focus-offset,2px)';
|
|
19969
20637
|
/** A control inside the frame wears the ring within its own hit area. */
|
|
19970
|
-
const INSET_RING = `outline:${FOCUS_WIDTH} solid ${
|
|
20638
|
+
const INSET_RING = `outline:${FOCUS_WIDTH} solid ${HELP_DESK_FOCUS};outline-offset:calc(-1 * ${FOCUS_WIDTH});box-shadow:none`;
|
|
19971
20639
|
|
|
19972
20640
|
/**
|
|
19973
20641
|
* The composer's stylesheet. Every rule but the notice's sits under
|
|
@@ -19977,41 +20645,41 @@ const INSET_RING = `outline:${FOCUS_WIDTH} solid ${FOCUS};outline-offset:calc(-1
|
|
|
19977
20645
|
*/
|
|
19978
20646
|
const COMPOSER_CSS = `
|
|
19979
20647
|
.svhd-composer,.svhd-composer *{box-sizing:border-box}
|
|
19980
|
-
.svhd-composer{position:relative;display:flex;flex-direction:column;min-width:0;border:1px solid ${
|
|
19981
|
-
.svhd-composer:has(.svhd-composer-input:focus-visible){outline:${FOCUS_WIDTH} solid ${
|
|
19982
|
-
@supports not selector(:has(*)){.svhd-composer:focus-within{outline:${FOCUS_WIDTH} solid ${
|
|
19983
|
-
.svhd-composer:has(.svhd-composer-input[aria-invalid=true]){border-color:${
|
|
19984
|
-
.svhd-composer.svhd-composer-dragging{border-style:dashed;border-color:${
|
|
19985
|
-
.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:${
|
|
20648
|
+
.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}}
|
|
20649
|
+
.svhd-composer:has(.svhd-composer-input:focus-visible){outline:${FOCUS_WIDTH} solid ${HELP_DESK_FOCUS};outline-offset:${FOCUS_OFFSET}}
|
|
20650
|
+
@supports not selector(:has(*)){.svhd-composer:focus-within{outline:${FOCUS_WIDTH} solid ${HELP_DESK_FOCUS};outline-offset:${FOCUS_OFFSET}}}
|
|
20651
|
+
.svhd-composer:has(.svhd-composer-input[aria-invalid=true]){border-color:${HELP_DESK_COLORS.error}}
|
|
20652
|
+
.svhd-composer.svhd-composer-dragging{border-style:dashed;border-color:${HELP_DESK_ACCENT.ink}}
|
|
20653
|
+
.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}
|
|
19986
20654
|
.svhd-composer .svhd-composer-input:focus,.svhd-composer .svhd-composer-input:focus-visible{outline:none;box-shadow:none}
|
|
19987
|
-
.svhd-composer .svhd-composer-input:disabled{background:${
|
|
19988
|
-
.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:${
|
|
19989
|
-
.svhd-composer .svhd-composer-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:0 4px;padding:0 4px;border-top:1px solid ${
|
|
19990
|
-
.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:${
|
|
19991
|
-
.svhd-composer .svhd-composer-attach:hover,.svhd-composer .svhd-composer-help:hover{background:${
|
|
20655
|
+
.svhd-composer .svhd-composer-input:disabled{background:${HELP_DESK_COLORS.canvas}}
|
|
20656
|
+
.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}
|
|
20657
|
+
.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}}
|
|
20658
|
+
.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}
|
|
20659
|
+
.svhd-composer .svhd-composer-attach:hover,.svhd-composer .svhd-composer-help:hover{background:${HELP_DESK_COLORS.fill};color:${HELP_DESK_COLORS.ink}}
|
|
19992
20660
|
.svhd-composer .svhd-composer-attach:disabled{opacity:.6;cursor:default}
|
|
19993
20661
|
.svhd-composer .svhd-composer-attach svg{display:block;width:18px;height:18px}
|
|
19994
|
-
.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:${
|
|
20662
|
+
.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}
|
|
19995
20663
|
.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}
|
|
19996
|
-
.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 ${
|
|
20664
|
+
.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}
|
|
19997
20665
|
.svhd-composer .svhd-composer-help-copy{grid-column:1;min-width:0;overflow-wrap:anywhere}
|
|
19998
20666
|
.svhd-composer .svhd-composer-help-copy p{margin:0}
|
|
19999
20667
|
.svhd-composer .svhd-composer-help-copy p+p{margin-top:6px}
|
|
20000
|
-
.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:${
|
|
20001
|
-
.svhd-composer .svhd-composer-help-close:hover,.svhd-composer .svhd-attachment-remove:hover{background:${
|
|
20668
|
+
.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}
|
|
20669
|
+
.svhd-composer .svhd-composer-help-close:hover,.svhd-composer .svhd-attachment-remove:hover{background:${HELP_DESK_COLORS.fillStrong};color:${HELP_DESK_COLORS.ink}}
|
|
20002
20670
|
.svhd-composer .svhd-composer-help-close svg,.svhd-composer .svhd-attachment-remove svg{display:block;width:16px;height:16px}
|
|
20003
|
-
.svhd-composer .svhd-attachment-chips{display:flex;flex-wrap:wrap;gap:8px;list-style:none;margin:0;padding:8px;border-top:1px solid ${
|
|
20671
|
+
.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}}
|
|
20004
20672
|
.svhd-composer .svhd-attachment-chips:empty{display:none}
|
|
20005
|
-
.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 ${
|
|
20006
|
-
.svhd-composer .svhd-attachment-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;color:${
|
|
20007
|
-
.svhd-composer .svhd-attachment-status{grid-column:1;padding-right:8px;color:${
|
|
20008
|
-
.svhd-composer .svhd-attachment-status.svhd-composer-problem{color:${
|
|
20009
|
-
.svhd-composer .svhd-attachment-progress{grid-column:1/-1;width:calc(100% - 10px);height:6px;margin-top:6px;accent-color:${
|
|
20010
|
-
.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:${
|
|
20011
|
-
.svhd-composer .svhd-attachment-retry{grid-column:2;min-height:44px;margin:0;padding:0 10px;border:0;border-radius:6px;background:transparent;color:${
|
|
20673
|
+
.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}
|
|
20674
|
+
.svhd-composer .svhd-attachment-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;color:${HELP_DESK_COLORS.ink}}
|
|
20675
|
+
.svhd-composer .svhd-attachment-status{grid-column:1;padding-right:8px;color:${HELP_DESK_COLORS.body};font-size:12px;overflow-wrap:anywhere}
|
|
20676
|
+
.svhd-composer .svhd-attachment-status.svhd-composer-problem{color:${HELP_DESK_COLORS.error}}
|
|
20677
|
+
.svhd-composer .svhd-attachment-progress{grid-column:1/-1;width:calc(100% - 10px);height:6px;margin-top:6px;accent-color:${HELP_DESK_ACCENT.ink}}
|
|
20678
|
+
.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}
|
|
20679
|
+
.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}
|
|
20012
20680
|
.svhd-composer .svhd-attachment-remove:disabled,.svhd-composer .svhd-attachment-retry:disabled{opacity:.6;cursor:default}
|
|
20013
20681
|
.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}}
|
|
20014
|
-
.svhd-composer-notice{margin:0;color:${
|
|
20682
|
+
.svhd-composer-notice{margin:0;color:${HELP_DESK_COLORS.error};font-size:14px;line-height:1.5}
|
|
20015
20683
|
.svhd-composer [hidden],.svhd-composer-notice[hidden]{display:none!important}
|
|
20016
20684
|
`;
|
|
20017
20685
|
|
|
@@ -20933,6 +21601,7 @@ function mountHelpDeskForm(client, options) {
|
|
|
20933
21601
|
// The page that lays the support wizard out carries the attribution itself.
|
|
20934
21602
|
footer: options.hostShowsAttribution ? null : createSecuredByFooter('svhd'),
|
|
20935
21603
|
});
|
|
21604
|
+
applySupportBrand(shell.container, options.brand ?? supportBrand(client.desk.branding?.color));
|
|
20936
21605
|
const prefix = `svhd-${++formSequence}`;
|
|
20937
21606
|
const form = document.createElement('form');
|
|
20938
21607
|
form.className = 'svhd-form';
|
|
@@ -22545,9 +23214,12 @@ function openHelpDeskForm(client, options = {}) {
|
|
|
22545
23214
|
close.addEventListener('click', requestDismiss);
|
|
22546
23215
|
header.append(title, close);
|
|
22547
23216
|
const body = document.createElement('div');
|
|
23217
|
+
// Paired once for the modal and the form inside it.
|
|
23218
|
+
const brand = options.brand ?? supportBrand(client.desk.branding?.color);
|
|
23219
|
+
applySupportBrand(shell.modal, brand);
|
|
22548
23220
|
shell.modal.append(header, body);
|
|
22549
23221
|
try {
|
|
22550
|
-
inner = mountHelpDeskForm(client, { ...options, target: body, onCancel: cancel });
|
|
23222
|
+
inner = mountHelpDeskForm(client, { ...options, brand, target: body, onCancel: cancel });
|
|
22551
23223
|
// State observers run while the inner form mounts. They can dismiss the
|
|
22552
23224
|
// shell before mountHelpDeskForm hands us its cleanup handle.
|
|
22553
23225
|
if (destroyed)
|
|
@@ -24604,8 +25276,12 @@ function createSupportAnalytics({ deskId, post }) {
|
|
|
24604
25276
|
}
|
|
24605
25277
|
|
|
24606
25278
|
let launcherSequence = 0;
|
|
24607
|
-
/**
|
|
24608
|
-
|
|
25279
|
+
/**
|
|
25280
|
+
* A convenience path only: it never owns a second support flow. It carries
|
|
25281
|
+
* the desk's brand (`brand`, then setBrand), so its focus ring is the desk's,
|
|
25282
|
+
* as the panel's are.
|
|
25283
|
+
*/
|
|
25284
|
+
function createSupportLauncher(options, brand, open) {
|
|
24609
25285
|
const button = document.createElement('button');
|
|
24610
25286
|
button.type = 'button';
|
|
24611
25287
|
button.className = 'sv-support-launcher';
|
|
@@ -24614,7 +25290,7 @@ function createSupportLauncher(options, open) {
|
|
|
24614
25290
|
button.setAttribute('aria-haspopup', 'dialog');
|
|
24615
25291
|
button.setAttribute('aria-expanded', 'false');
|
|
24616
25292
|
const offset = (value, fallback) => typeof value === 'number' && Number.isFinite(value) ? Math.min(240, Math.max(12, value)) : fallback;
|
|
24617
|
-
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};
|
|
25293
|
+
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;`;
|
|
24618
25294
|
if (options.imageUrl) {
|
|
24619
25295
|
let url;
|
|
24620
25296
|
try {
|
|
@@ -24640,19 +25316,37 @@ function createSupportLauncher(options, open) {
|
|
|
24640
25316
|
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';
|
|
24641
25317
|
button.append(mark);
|
|
24642
25318
|
}
|
|
25319
|
+
applySupportBrand(button, brand);
|
|
24643
25320
|
button.addEventListener('click', open);
|
|
24644
25321
|
document.body.append(button);
|
|
24645
25322
|
return {
|
|
24646
25323
|
setExpanded(expanded) { button.setAttribute('aria-expanded', String(expanded)); },
|
|
25324
|
+
setBrand(next) { applySupportBrand(button, next); },
|
|
24647
25325
|
destroy() { button.removeEventListener('click', open); button.remove(); },
|
|
24648
25326
|
};
|
|
24649
25327
|
}
|
|
24650
25328
|
|
|
25329
|
+
/**
|
|
25330
|
+
* The launcher's focus ring. The launcher floats over whatever the website
|
|
25331
|
+
* draws beneath it, so its ring opens with two bands no page color hides
|
|
25332
|
+
* (WCAG technique C40): white, then slate-950, which stand over 9:1 apart, so
|
|
25333
|
+
* one of them stands at 3:1 or more on any ground. It is the design system's
|
|
25334
|
+
* focus ring (`--focus-ring`: a surface gap, then the ring) with the darkest
|
|
25335
|
+
* slate as its ring, and the desk's focus color rings outside both.
|
|
25336
|
+
*/
|
|
25337
|
+
const LAUNCHER_RING = `0 0 0 2px ${DS.white},0 0 0 4px ${DS.slate950}`;
|
|
24651
25338
|
/**
|
|
24652
25339
|
* The support journey's only skin. Customer content stays in the product register.
|
|
24653
25340
|
* The panel's focus ring is 2px, 3px out, in the desk's focus color: its width and
|
|
24654
25341
|
* offset are the panel's custom properties, which the help desk composer inside
|
|
24655
|
-
* its request form reads, so the composer rings as the fields beside it do.
|
|
25342
|
+
* its request form reads, so the composer rings as the fields beside it do. It
|
|
25343
|
+
* paints in the help desk's color roles (@sparkvault/app-sdk/help-desk-colors):
|
|
25344
|
+
* its neutrals read the page's roles (HOST), so in the customer portal they
|
|
25345
|
+
* follow the portal's scheme, and stay light anywhere else; its accent reads
|
|
25346
|
+
* the page's accent roles, else the desk's light pairing (ACCENT), which the
|
|
25347
|
+
* panel and the launcher each carry (DEFAULT_PAIRING_DECLARATIONS), so the
|
|
25348
|
+
* launcher rings in the desk's color, as every control in the panel does,
|
|
25349
|
+
* outside a ring of its own that reads on any page (LAUNCHER_RING).
|
|
24656
25350
|
*/
|
|
24657
25351
|
function injectHelpDeskSupportStyles() {
|
|
24658
25352
|
if (document.getElementById('sparkvault-help-desk-support-styles'))
|
|
@@ -24661,8 +25355,8 @@ function injectHelpDeskSupportStyles() {
|
|
|
24661
25355
|
style.id = 'sparkvault-help-desk-support-styles';
|
|
24662
25356
|
style.textContent = `
|
|
24663
25357
|
.svhs-panel,.svhs-panel *{box-sizing:border-box}
|
|
24664
|
-
.svhs-panel{--hd-focus-width:2px;--hd-focus-offset:3px}
|
|
24665
|
-
.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 ${
|
|
25358
|
+
.svhs-panel{--hd-focus-width:2px;--hd-focus-offset:3px;${DEFAULT_PAIRING_DECLARATIONS}}
|
|
25359
|
+
.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)}
|
|
24666
25360
|
.svhs-panel[hidden],.svhs-panel [hidden]{display:none!important}
|
|
24667
25361
|
.svhs-panel[data-stage=results]{height:680px}
|
|
24668
25362
|
.svhs-panel[data-stage=article]{width:704px;height:700px}
|
|
@@ -24673,99 +25367,99 @@ function injectHelpDeskSupportStyles() {
|
|
|
24673
25367
|
.svhs-panel button,.svhs-panel a{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
|
|
24674
25368
|
.svhs-panel button{appearance:none;cursor:pointer;margin:0}
|
|
24675
25369
|
.svhs-panel button:active{transform:translateY(1px)}
|
|
24676
|
-
.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
|
|
25370
|
+
.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}
|
|
24677
25371
|
.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}
|
|
24678
|
-
.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 ${
|
|
24679
|
-
.svhs-desk-name{font-size:14px;font-weight:600;line-height:1.35;color:${
|
|
25372
|
+
.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}}
|
|
25373
|
+
.svhs-desk-name{font-size:14px;font-weight:600;line-height:1.35;color:${HELP_DESK_COLORS.body};overflow-wrap:anywhere;min-width:0}
|
|
24680
25374
|
.svhs-toolbar-actions{display:flex;align-items:center;gap:4px;margin-left:auto;flex:none}
|
|
24681
|
-
.svhs-identity-notice{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:none;padding:8px 24px;border-bottom:1px solid ${
|
|
25375
|
+
.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}}
|
|
24682
25376
|
.svhs-identity-notice .svhs-status{margin:0;font-size:13px}
|
|
24683
25377
|
.svhs-identity-notice .svhs-text-button{flex:none;font-size:13px!important}
|
|
24684
|
-
.svhs-icon-button{display:grid;place-items:center;width:40px;height:40px;flex:none;padding:0;border:0;border-radius:6px;background:transparent;color:${
|
|
24685
|
-
.svhs-icon-button:hover{background:${
|
|
24686
|
-
.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:${
|
|
24687
|
-
.svhs-back:hover{background:${
|
|
24688
|
-
.svhs-back:disabled{background:transparent;color:${
|
|
25378
|
+
.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}
|
|
25379
|
+
.svhs-icon-button:hover{background:${HELP_DESK_COLORS.fill};color:${HELP_DESK_COLORS.ink}}
|
|
25380
|
+
.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}
|
|
25381
|
+
.svhs-back:hover{background:${HELP_DESK_COLORS.hover}}
|
|
25382
|
+
.svhs-back:disabled{background:transparent;color:${HELP_DESK_COLORS.muted};cursor:default;transform:none}
|
|
24689
25383
|
.svhs-screen{display:flex;flex-direction:column;min-height:0;flex:1}
|
|
24690
25384
|
.svhs-scroll{padding:26px 24px;overflow:auto;overscroll-behavior:contain;min-height:0;flex:1;scrollbar-gutter:stable}
|
|
24691
|
-
.svhs-heading{margin:0 0 8px;padding:0;color:${
|
|
25385
|
+
.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}
|
|
24692
25386
|
.svhs-heading:focus,.svhs-article-title:focus{outline:none;box-shadow:none}
|
|
24693
|
-
.svhs-copy{margin:0 0 24px;color:${
|
|
24694
|
-
.svhs-label{display:block;margin:0 0 7px;font-size:13px;font-weight:600;color:${
|
|
24695
|
-
.svhs-issue{display:block;width:100%;min-height:120px;max-height:200px;resize:none;overflow-y:auto;border:1px solid ${
|
|
25387
|
+
.svhs-copy{margin:0 0 24px;color:${HELP_DESK_COLORS.body};font-size:14px;line-height:1.55}
|
|
25388
|
+
.svhs-label{display:block;margin:0 0 7px;font-size:13px;font-weight:600;color:${HELP_DESK_COLORS.body}}
|
|
25389
|
+
.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}
|
|
24696
25390
|
/* The heading is the field's label, so the field follows it at a label's distance from a question this large. */
|
|
24697
25391
|
.svhs-heading+.svhs-issue{margin-top:16px}
|
|
24698
|
-
.svhs-issue::placeholder{color:${
|
|
24699
|
-
.svhs-issue:focus{border-color
|
|
25392
|
+
.svhs-issue::placeholder{color:${HELP_DESK_COLORS.muted};opacity:1}
|
|
25393
|
+
.svhs-issue:focus{border-color:${HELP_DESK_FOCUS}}
|
|
24700
25394
|
.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)}
|
|
24701
|
-
.svhs-primary{background
|
|
24702
|
-
.svhs-primary:hover{background
|
|
25395
|
+
.svhs-primary{background:${HELP_DESK_ACCENT.fill};color:${HELP_DESK_ACCENT.onAccent}}
|
|
25396
|
+
.svhs-primary:hover{background:${HELP_DESK_ACCENT.hover}}
|
|
24703
25397
|
.svhs-primary[aria-disabled=true]{cursor:progress}
|
|
24704
|
-
.svhs-secondary{border-color:${
|
|
24705
|
-
.svhs-secondary:hover{background:${
|
|
24706
|
-
.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
|
|
25398
|
+
.svhs-secondary{border-color:${HELP_DESK_COLORS.lineStrong};background:${HELP_DESK_COLORS.surface};color:${HELP_DESK_COLORS.body}}
|
|
25399
|
+
.svhs-secondary:hover{background:${HELP_DESK_COLORS.hover}}
|
|
25400
|
+
.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}
|
|
24707
25401
|
.svhs-text-button:hover{text-decoration:underline}
|
|
24708
25402
|
.svhs-full{width:100%}
|
|
24709
|
-
.svhs-bottom{padding:16px 24px 18px;flex:none;border-top:1px solid ${
|
|
25403
|
+
.svhs-bottom{padding:16px 24px 18px;flex:none;border-top:1px solid ${HELP_DESK_COLORS.fill}}
|
|
24710
25404
|
.svhs-start-bottom{display:flex;flex-direction:column;align-items:center;gap:6px;padding-top:0;border-top:0}
|
|
24711
25405
|
.svhs-start-bottom .svhs-primary{width:100%}
|
|
24712
|
-
.svhs-query{display:flex;align-items:center;gap:12px;margin:0 0 24px;padding:12px 14px;border:1px solid ${
|
|
25406
|
+
.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}}
|
|
24713
25407
|
.svhs-question{flex:1;min-width:0}
|
|
24714
|
-
.svhs-question-label{display:block;margin-bottom:3px;color:${
|
|
24715
|
-
.svhs-query-text{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0;color:${
|
|
25408
|
+
.svhs-question-label{display:block;margin-bottom:3px;color:${HELP_DESK_COLORS.muted};font-size:12px;font-weight:500;line-height:1.4}
|
|
25409
|
+
.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}
|
|
24716
25410
|
.svhs-query .svhs-text-button{flex:none;min-width:44px;padding:8px 0}
|
|
24717
25411
|
.svhs-results{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}
|
|
24718
|
-
.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 ${
|
|
24719
|
-
.svhs-results li:first-child .svhs-result{border-top:1px solid ${
|
|
25412
|
+
.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}
|
|
25413
|
+
.svhs-results li:first-child .svhs-result{border-top:1px solid ${HELP_DESK_COLORS.fillStrong}}
|
|
24720
25414
|
.svhs-results li:last-child .svhs-result{border-bottom:0}
|
|
24721
25415
|
.svhs-result-copy{display:block;min-width:0}
|
|
24722
|
-
.svhs-result-icon{margin-top:2px;color:${
|
|
24723
|
-
.svhs-result-chevron{width:16px!important;height:16px!important;margin-top:4px;color:${
|
|
25416
|
+
.svhs-result-icon{margin-top:2px;color:${HELP_DESK_COLORS.muted}}
|
|
25417
|
+
.svhs-result-chevron{width:16px!important;height:16px!important;margin-top:4px;color:${HELP_DESK_COLORS.muted}}
|
|
24724
25418
|
.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}
|
|
24725
|
-
.svhs-result:hover{background:${
|
|
24726
|
-
.svhs-result:hover .svhs-result-title{color
|
|
24727
|
-
.svhs-result-excerpt{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0;color:${
|
|
24728
|
-
.svhs-result-category{display:block;margin-top:6px;color:${
|
|
24729
|
-
.svhs-results-bottom{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;background:${
|
|
25419
|
+
.svhs-result:hover{background:${HELP_DESK_COLORS.hover}}
|
|
25420
|
+
.svhs-result:hover .svhs-result-title{color:${HELP_DESK_ACCENT.ink};text-decoration:underline}
|
|
25421
|
+
.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}
|
|
25422
|
+
.svhs-result-category{display:block;margin-top:6px;color:${HELP_DESK_COLORS.muted};font-size:12px;line-height:1.4}
|
|
25423
|
+
.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}}
|
|
24730
25424
|
/* Wraps below the ticket button when less than 200px remain beside it, as under the panel's full-width button. */
|
|
24731
|
-
.svhs-contact-note{flex:1 1 200px;min-width:0;margin:0;color:${
|
|
24732
|
-
.svhs-error{margin:12px 0 0;color:${
|
|
24733
|
-
.svhs-status{margin:16px 0;color:${
|
|
25425
|
+
.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}
|
|
25426
|
+
.svhs-error{margin:12px 0 0;color:${HELP_DESK_COLORS.error};font-size:14px;line-height:1.5;overflow-wrap:anywhere}
|
|
25427
|
+
.svhs-status{margin:16px 0;color:${HELP_DESK_COLORS.body};font-size:14px;line-height:1.5}
|
|
24734
25428
|
.svhs-empty{padding:12px 0 4px}
|
|
24735
25429
|
.svhs-empty .svhs-heading{font-size:18px;letter-spacing:-.3px}
|
|
24736
25430
|
.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}
|
|
24737
25431
|
@keyframes svhs-spin{to{transform:rotate(360deg)}}
|
|
24738
25432
|
.svhs-article-scroll{padding:34px 48px 28px}
|
|
24739
|
-
.svhs-category{margin:0 0 12px;color:${
|
|
24740
|
-
.svhs-article-title{margin:0 0 18px;color:${
|
|
24741
|
-
.svhs-article-content{color:${
|
|
25433
|
+
.svhs-category{margin:0 0 12px;color:${HELP_DESK_COLORS.muted};font-size:13px;line-height:1.5;overflow-wrap:anywhere}
|
|
25434
|
+
.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}
|
|
25435
|
+
.svhs-article-content{color:${HELP_DESK_COLORS.body};font-size:15px;line-height:1.65;overflow-wrap:anywhere}
|
|
24742
25436
|
.svhs-article-content>*:first-child{margin-top:0}
|
|
24743
25437
|
.svhs-article-content p{margin:0 0 18px;font:inherit;color:inherit}
|
|
24744
|
-
.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:${
|
|
25438
|
+
.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}
|
|
24745
25439
|
.svhs-article-content h3,.svhs-article-content h4,.svhs-article-content h5,.svhs-article-content h6{font-size:16px}
|
|
24746
25440
|
.svhs-article-content ul,.svhs-article-content ol{margin:0 0 22px;padding-left:22px}
|
|
24747
25441
|
.svhs-article-content li{margin:8px 0;padding-left:5px}
|
|
24748
|
-
.svhs-article-content strong{font-weight:600;color:${
|
|
24749
|
-
.svhs-article-content a{color
|
|
25442
|
+
.svhs-article-content strong{font-weight:600;color:${HELP_DESK_COLORS.ink}}
|
|
25443
|
+
.svhs-article-content a{color:${HELP_DESK_ACCENT.ink};text-decoration:underline;text-underline-offset:2px}
|
|
24750
25444
|
.svhs-article-content img,.svhs-article-content video{display:block;max-width:100%;height:auto;margin:20px 0}
|
|
24751
25445
|
.svhs-reader-asset{display:block;max-width:100%;margin:20px 0}
|
|
24752
25446
|
.svhs-reader-asset img{margin:0}
|
|
24753
|
-
.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 ${
|
|
25447
|
+
.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}
|
|
24754
25448
|
.svhs-reader-asset-status[style]{min-height:0}
|
|
24755
|
-
.svhs-article-content blockquote{margin:22px 0;padding:0 0 0 16px;border-left:2px solid ${
|
|
24756
|
-
.svhs-article-content pre{margin:20px 0;padding:14px;border:1px solid ${
|
|
25449
|
+
.svhs-article-content blockquote{margin:22px 0;padding:0 0 0 16px;border-left:2px solid ${HELP_DESK_COLORS.lineStrong};font-size:14px}
|
|
25450
|
+
.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}
|
|
24757
25451
|
.svhs-article-content code{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:.9em}
|
|
24758
25452
|
.svhs-article-content table{display:block;max-width:100%;border-collapse:collapse;overflow:auto;overscroll-behavior:contain;margin:20px 0;font-size:14px}
|
|
24759
|
-
.svhs-article-content th,.svhs-article-content td{padding:10px 12px;border:1px solid ${
|
|
24760
|
-
.svhs-article-content hr{margin:24px 0;border:0;border-top:1px solid ${
|
|
24761
|
-
.svhs-article-footer{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 24px;border-top:1px solid ${
|
|
25453
|
+
.svhs-article-content th,.svhs-article-content td{padding:10px 12px;border:1px solid ${HELP_DESK_COLORS.fillStrong};text-align:left}
|
|
25454
|
+
.svhs-article-content hr{margin:24px 0;border:0;border-top:1px solid ${HELP_DESK_COLORS.fillStrong}}
|
|
25455
|
+
.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}
|
|
24762
25456
|
.svhs-article-footer .svhs-primary{min-width:110px}
|
|
24763
25457
|
.svhs-article-footer .svhs-text-button{white-space:nowrap;font-size:13px!important}
|
|
24764
|
-
.svhs-article-question{color:${
|
|
25458
|
+
.svhs-article-question{color:${HELP_DESK_COLORS.muted};font-size:13px;line-height:1.5}
|
|
24765
25459
|
.svhs-reader-actions{display:flex;align-items:stretch;gap:12px;flex:none}
|
|
24766
25460
|
.svhs-feedback-scroll{padding-top:30px}
|
|
24767
25461
|
.svhs-feedback-actions{display:flex;flex-direction:column;gap:9px;margin-top:24px}
|
|
24768
|
-
.svhs-feedback-actions .svhs-text-button{align-self:center;color:${
|
|
25462
|
+
.svhs-feedback-actions .svhs-text-button{align-self:center;color:${HELP_DESK_COLORS.muted}}
|
|
24769
25463
|
.svhs-review{margin-top:24px}
|
|
24770
25464
|
.svhs-review .svhs-primary{width:fit-content}
|
|
24771
25465
|
.svhs-contact-scroll{padding:0;scrollbar-gutter:auto}
|
|
@@ -24774,8 +25468,8 @@ function injectHelpDeskSupportStyles() {
|
|
|
24774
25468
|
.svhs-contact-prelude{padding:24px}
|
|
24775
25469
|
.svhs-contact-prelude .svhs-secondary{margin-top:16px}
|
|
24776
25470
|
.svhs-ticket-gate{padding:0 24px 24px}
|
|
24777
|
-
.svhs-unlock-input{display:block;box-sizing:border-box;width:100%;min-height:46px;margin:0 0 16px;border:1px solid ${
|
|
24778
|
-
.svhs-unlock-input:focus{border-color
|
|
25471
|
+
.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}
|
|
25472
|
+
.svhs-unlock-input:focus{border-color:${HELP_DESK_FOCUS}}
|
|
24779
25473
|
.svhs-unlock-form{margin:0}
|
|
24780
25474
|
.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}
|
|
24781
25475
|
.svhs-contact-target .svhd-body{display:flex;flex:1;flex-direction:column;min-height:0}
|
|
@@ -24784,44 +25478,39 @@ function injectHelpDeskSupportStyles() {
|
|
|
24784
25478
|
.svhs-contact-target .svhd-label{font-size:13px;line-height:1.5}
|
|
24785
25479
|
.svhs-contact-target .svhd-input{font-size:16px;line-height:1.5}
|
|
24786
25480
|
.svhs-contact-target .svhd-actions{gap:10px}
|
|
24787
|
-
.svhs-contact-target .svhd-button:not(.svhd-secondary){background:var(--hd-accent,${DS.action});color:var(--hd-on-accent,${DS.white})}
|
|
24788
|
-
.svhs-contact-target .svhd-button:not(.svhd-secondary):hover{background:var(--hd-accent-hover,${DS.actionHover})}
|
|
24789
|
-
.svhs-contact-target .svhd-link{color:var(--hd-accent-ink,${DS.action})}
|
|
24790
25481
|
.svhs-contact-target .svhd-actions>.svhd-button:first-child{flex:1}
|
|
24791
25482
|
.svhs-contact-target .svhd-status{font-size:14px}
|
|
24792
25483
|
.svhs-contact-target .svhd-auth{gap:14px}
|
|
24793
|
-
.svhs-contact-target .svhd-text-button{color:var(--hd-accent-ink,${DS.action})}
|
|
24794
|
-
.svhs-contact-target .svhd-text-button:disabled{color:${DS.slate500}}
|
|
24795
25484
|
.svhs-contact-target .svhd-widget-form{display:flex;flex:1;flex-direction:column;gap:16px}
|
|
24796
25485
|
/* The request fills the panel: the details step, and in it the composer and its text, take the height the fields leave. */
|
|
24797
25486
|
.svhs-contact-target .svhd-widget-form>[data-contact-step=details]{display:flex;flex:1;flex-direction:column;gap:16px}
|
|
24798
25487
|
.svhs-contact-target .svhd-widget-form .svhd-composer-field{display:flex;flex:1;flex-direction:column;gap:6px;min-height:164px}
|
|
24799
25488
|
.svhs-contact-target .svhd-widget-form .svhd-composer{flex:1}
|
|
24800
25489
|
.svhs-contact-target .svhd-widget-form .svhd-composer-input{flex:1;min-height:120px}
|
|
24801
|
-
.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 ${
|
|
25490
|
+
.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}}
|
|
24802
25491
|
.svhs-contact-target .svhd-widget-form>.svhd-actions>.svhd-secondary{display:none}
|
|
24803
25492
|
.svhs-contact-target .svhd-widget-form .svhd-actions>.svhd-button{font-size:14px}
|
|
24804
|
-
.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 ${
|
|
25493
|
+
.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}}
|
|
24805
25494
|
.svhs-contact-target .svhd-widget-form>.svhd-confirm .svhd-actions{flex-wrap:nowrap}
|
|
24806
25495
|
.svhs-contact-target .svhd-widget-form>.svhd-confirm .svhd-button{flex:1}
|
|
24807
25496
|
.svhs-contact-target .svhd-footer{margin-top:16px;text-align:center;font-size:11px}
|
|
24808
25497
|
.svhs-receipt-scroll{padding-top:36px}
|
|
24809
|
-
.svhs-receipt-mark{width:30px!important;height:30px!important;margin-bottom:20px;color
|
|
24810
|
-
.svhs-ticket-link{display:inline-flex;align-items:center;min-height:44px;margin:0 0 10px;color
|
|
25498
|
+
.svhs-receipt-mark{width:30px!important;height:30px!important;margin-bottom:20px;color:${HELP_DESK_ACCENT.ink}}
|
|
25499
|
+
.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}
|
|
24811
25500
|
.svhs-receipt-note{white-space:pre-wrap;overflow-wrap:anywhere}
|
|
24812
25501
|
.svhs-receipt-actions{display:flex;flex-direction:column;align-items:center;gap:4px}
|
|
24813
25502
|
.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}
|
|
24814
25503
|
.svhs-toast svg{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
|
|
24815
|
-
.svhs-overlay{position:fixed;inset:0;z-index:2147482900;display:flex;background:${
|
|
25504
|
+
.svhs-overlay{position:fixed;inset:0;z-index:2147482900;display:flex;background:${HELP_DESK_COLORS.surface};padding:0;overflow:hidden}
|
|
24816
25505
|
.svhs-modal{width:100%;height:100%;min-width:0;outline:none}
|
|
24817
25506
|
.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}
|
|
24818
|
-
.sv-support-launcher{touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:background 120ms cubic-bezier(.2,0,0,1)}
|
|
25507
|
+
.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}}
|
|
24819
25508
|
.sv-support-launcher:hover{filter:brightness(1.12)}
|
|
24820
25509
|
.sv-support-launcher:active{transform:translateY(1px)}
|
|
24821
|
-
.sv-support-launcher:focus-visible{outline:3px solid
|
|
25510
|
+
.sv-support-launcher:focus-visible{outline:3px solid ${HELP_DESK_FOCUS};outline-offset:4px;box-shadow:${LAUNCHER_RING},${DS.shadowPopover}}
|
|
24822
25511
|
@media(max-width:640px){
|
|
24823
25512
|
.svhs-panel{right:0;bottom:0;width:100%;height:100dvh;max-width:none;max-height:none;border:0;border-radius:0}
|
|
24824
|
-
.svhs-toolbar{min-height:60px;padding:8px 16px 8px 24px;border-bottom-color:${
|
|
25513
|
+
.svhs-toolbar{min-height:60px;padding:8px 16px 8px 24px;border-bottom-color:${HELP_DESK_COLORS.fillStrong}}
|
|
24825
25514
|
.svhs-icon-button{width:44px;height:44px}
|
|
24826
25515
|
.svhs-back{min-height:44px;max-width:42%}
|
|
24827
25516
|
.svhs-scroll{padding:24px}
|
|
@@ -24853,7 +25542,7 @@ function injectHelpDeskSupportStyles() {
|
|
|
24853
25542
|
@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}}
|
|
24854
25543
|
@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}}
|
|
24855
25544
|
@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}}
|
|
24856
|
-
.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 ${
|
|
25545
|
+
.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}
|
|
24857
25546
|
.svhs-page .svhs-toolbar{min-height:52px;padding:4px 24px}
|
|
24858
25547
|
.svhs-page .svhs-back{max-width:none;white-space:nowrap}
|
|
24859
25548
|
.svhs-page .svhs-desk-name{display:none}
|
|
@@ -25050,35 +25739,6 @@ class SupportPhoneHistory {
|
|
|
25050
25739
|
}
|
|
25051
25740
|
}
|
|
25052
25741
|
|
|
25053
|
-
/** Darken only the narrow range where neither white nor the product ink reaches AA. */
|
|
25054
|
-
function accessibleFill(color) {
|
|
25055
|
-
let fill = color;
|
|
25056
|
-
while ((accentFillContrast(fill) ?? 0) < AA_TEXT_CONTRAST) {
|
|
25057
|
-
fill = `#${[1, 3, 5].map(offset => Math.floor(Number.parseInt(fill.slice(offset, offset + 2), 16) * 0.98).toString(16).padStart(2, '0')).join('')}`;
|
|
25058
|
-
}
|
|
25059
|
-
return fill;
|
|
25060
|
-
}
|
|
25061
|
-
/** Scoped brand properties work in both a hosted page and an unrelated widget host. */
|
|
25062
|
-
function applySupportBrand(target, value) {
|
|
25063
|
-
const color = brandColor(value);
|
|
25064
|
-
if (!color) {
|
|
25065
|
-
for (const name of ['--hd-accent', '--hd-on-accent', '--hd-accent-ink', '--hd-accent-hover', '--hd-focus'])
|
|
25066
|
-
target.style.removeProperty(name);
|
|
25067
|
-
return;
|
|
25068
|
-
}
|
|
25069
|
-
const fill = accessibleFill(color);
|
|
25070
|
-
const pairing = accentPairing(fill);
|
|
25071
|
-
const ink = pairing.accentInk === 'accent' ? fill : DS.slate900;
|
|
25072
|
-
const label = pairing.onAccent === 'white' ? DS.white : DS.slate900;
|
|
25073
|
-
// Dark fills deepen on hover; light fills stay unchanged to preserve label contrast.
|
|
25074
|
-
const hover = pairing.onAccent === 'white'
|
|
25075
|
-
? `#${[1, 3, 5].map(offset => Math.floor(Number.parseInt(fill.slice(offset, offset + 2), 16) * 0.9).toString(16).padStart(2, '0')).join('')}`
|
|
25076
|
-
: fill;
|
|
25077
|
-
const properties = { '--hd-accent': fill, '--hd-on-accent': label, '--hd-accent-ink': ink, '--hd-accent-hover': hover, '--hd-focus': ink };
|
|
25078
|
-
for (const [name, content] of Object.entries(properties))
|
|
25079
|
-
target.style.setProperty(name, content);
|
|
25080
|
-
}
|
|
25081
|
-
|
|
25082
25742
|
/* global MediaQueryList, HTMLImageElement, HTMLAnchorElement, Element */
|
|
25083
25743
|
let sequence = 0;
|
|
25084
25744
|
function element(tag, className, text) {
|
|
@@ -25365,7 +26025,8 @@ class SupportView {
|
|
|
25365
26025
|
if (previous)
|
|
25366
26026
|
this.saveScroll(previous);
|
|
25367
26027
|
this.state = next;
|
|
25368
|
-
|
|
26028
|
+
if (next.brand !== previous?.brand)
|
|
26029
|
+
applySupportBrand(this.panel, next.brand);
|
|
25369
26030
|
this.panel.dataset.stage = next.stage;
|
|
25370
26031
|
const inset = (value, fallback) => typeof value === 'number' && Number.isFinite(value) ? Math.min(480, Math.max(0, value)) : fallback;
|
|
25371
26032
|
this.panel.style.setProperty('--svhs-right', `${inset(next.position?.right, 24)}px`);
|
|
@@ -26068,7 +26729,11 @@ function createHelpDeskSupport(config, options) {
|
|
|
26068
26729
|
let sourceArticleId;
|
|
26069
26730
|
const lifetime = new AbortController();
|
|
26070
26731
|
const bindings = new Set();
|
|
26071
|
-
|
|
26732
|
+
// A desk the page already holds brands the journey from the start, the
|
|
26733
|
+
// launcher included. Any other desk's brand arrives with connect, which the
|
|
26734
|
+
// first open, search or contact makes, never creation: connecting here would
|
|
26735
|
+
// add a desk lookup to every page load of a website that shows the launcher.
|
|
26736
|
+
let state = { visible: false, stage: 'issue', deskName: 'Support', issue: '', brand: supportBrand(options.desk?.branding?.color) };
|
|
26072
26737
|
if (typeof options.launcher === 'object') {
|
|
26073
26738
|
const offset = (value, fallback) => typeof value === 'number' && Number.isFinite(value) ? Math.min(240, Math.max(12, value)) : fallback;
|
|
26074
26739
|
state.position = { right: offset(options.launcher.right, 24), bottom: offset(options.launcher.bottom, 24) + 72 };
|
|
@@ -26142,7 +26807,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
26142
26807
|
}, options.target === undefined ? undefined : resolveTarget(options.target));
|
|
26143
26808
|
const launcher = (() => {
|
|
26144
26809
|
try {
|
|
26145
|
-
return options.launcher ? createSupportLauncher(typeof options.launcher === 'object' ? options.launcher : {}, () => { void open(); }) : null;
|
|
26810
|
+
return options.launcher ? createSupportLauncher(typeof options.launcher === 'object' ? options.launcher : {}, state.brand, () => { void open(); }) : null;
|
|
26146
26811
|
}
|
|
26147
26812
|
catch (error) {
|
|
26148
26813
|
view.destroy();
|
|
@@ -26153,9 +26818,12 @@ function createHelpDeskSupport(config, options) {
|
|
|
26153
26818
|
function update(change) {
|
|
26154
26819
|
if (destroyed)
|
|
26155
26820
|
return;
|
|
26821
|
+
const rebranded = change.brand !== undefined && change.brand !== state.brand;
|
|
26156
26822
|
state = { ...state, ...change };
|
|
26157
26823
|
view.render(state);
|
|
26158
26824
|
launcher?.setExpanded(state.visible);
|
|
26825
|
+
if (rebranded)
|
|
26826
|
+
launcher?.setBrand(state.brand);
|
|
26159
26827
|
notify(options.onStateChange, snapshot());
|
|
26160
26828
|
}
|
|
26161
26829
|
async function connect() {
|
|
@@ -26182,7 +26850,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
26182
26850
|
return (await http.request(path, { method: 'POST', body, credentials: 'omit', headers: { 'X-SV-Client': 'help-desk-portal', ...headers } })).data;
|
|
26183
26851
|
},
|
|
26184
26852
|
});
|
|
26185
|
-
update({ deskName: answer.desk.organization_name || 'Support',
|
|
26853
|
+
update({ deskName: answer.desk.organization_name || 'Support', brand: brandFor(answer.desk.branding?.color, state.brand), contactNote: answer.desk.ticket_contact_note ?? undefined });
|
|
26186
26854
|
return answer;
|
|
26187
26855
|
}).catch((error) => { connected = null; throw error; });
|
|
26188
26856
|
return connected;
|
|
@@ -26573,6 +27241,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
26573
27241
|
persist: options.persist,
|
|
26574
27242
|
pageLayout: options.target !== undefined,
|
|
26575
27243
|
hostShowsAttribution: options.hostShowsAttribution === true,
|
|
27244
|
+
brand: state.brand,
|
|
26576
27245
|
onSession: (session) => {
|
|
26577
27246
|
anonymous = false;
|
|
26578
27247
|
if (options.persist)
|
|
@@ -27005,7 +27674,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
27005
27674
|
client?.clearTicketAccess();
|
|
27006
27675
|
client?.setSession(null);
|
|
27007
27676
|
client = null;
|
|
27008
|
-
state = { visible: false, stage: 'issue', deskName: 'Support', issue: '' };
|
|
27677
|
+
state = { visible: false, stage: 'issue', deskName: 'Support', issue: '', brand: state.brand };
|
|
27009
27678
|
},
|
|
27010
27679
|
};
|
|
27011
27680
|
}
|
|
@@ -31146,7 +31815,8 @@ class SparksModule {
|
|
|
31146
31815
|
/**
|
|
31147
31816
|
* Deliver an invite-only spark's link to its invitee again, changing
|
|
31148
31817
|
* nothing about the link: the way on from an invitation that could not be
|
|
31149
|
-
* delivered (a share rejected with INVITATION_DELIVERY_FAILED
|
|
31818
|
+
* delivered (a share rejected with INVITATION_DELIVERY_FAILED or a 402
|
|
31819
|
+
* usage-credit funding refusal leaves its
|
|
31150
31820
|
* link in place, and the same share again delivers nothing), or one the
|
|
31151
31821
|
* invitee never received. `linkCode` names the link the resend was asked
|
|
31152
31822
|
* of: a link replaced since is never delivered in its place (409 CONFLICT).
|
|
@@ -31774,7 +32444,7 @@ class SparkVault {
|
|
|
31774
32444
|
}
|
|
31775
32445
|
/** Get the SDK version */
|
|
31776
32446
|
static get version() {
|
|
31777
|
-
return '18.0.
|
|
32447
|
+
return '18.0.2';
|
|
31778
32448
|
}
|
|
31779
32449
|
}
|
|
31780
32450
|
if (typeof window !== 'undefined') {
|