@sparkvault/sdk-js 18.0.0 → 18.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import type { SupportBrand } from './support-brand';
1
2
  import type { HelpDeskCustomer, HelpDeskSession, HelpDeskTicketCreated } from './types';
2
3
  /**
3
4
  * @internal The unsent text a widget form hands on with an account change, and
@@ -88,6 +89,8 @@ export interface HelpDeskFormOptions {
88
89
  onScreenChange?: () => void;
89
90
  /** @internal The host page already shows "Secured by SparkVault", so the form leaves its own out. */
90
91
  hostShowsAttribution?: boolean;
92
+ /** @internal The desk's brand its opener already paired (supportBrand), so the form pairs it no second time. */
93
+ brand?: SupportBrand;
91
94
  /** @internal Server-minted, content-free assistance correlation. */
92
95
  assistanceContext?: () => {
93
96
  assistance_attempt_id: string;
@@ -1,2 +1,9 @@
1
- /** Scoped styles for the optional inline help desk form. */
1
+ /**
2
+ * Scoped styles for the optional inline help desk form and its modal, in the
3
+ * help desk's color roles (@sparkvault/app-sdk/help-desk-colors): their
4
+ * neutrals the page's roles where it sets them (HOST), their accent the
5
+ * page's accent roles, else the desk's light pairing, which the form's
6
+ * container and the modal each carry (ACCENT, DEFAULT_PAIRING_DECLARATIONS),
7
+ * as the support panel does.
8
+ */
2
9
  export declare function injectHelpDeskFormStyles(): void;
@@ -1,2 +1,49 @@
1
- /** Scoped brand properties work in both a hosted page and an unrelated widget host. */
2
- export declare function applySupportBrand(target: HTMLElement, value: unknown): void;
1
+ /**
2
+ * The default pairings (@sparkvault/app-sdk/brand-color DEFAULT_PAIRINGS, the
3
+ * ones the customer portal, the console's sample and the desk's email paint
4
+ * for a desk without a brand color) as stylesheet declarations, which a
5
+ * desk's brand color replaces (applySupportBrand). The launcher, the support
6
+ * panel, the request form's container and its modal each carry them, so the
7
+ * accent roles (@sparkvault/app-sdk/help-desk-colors HELP_DESK_ACCENT) read
8
+ * the light pairing the element carries, and a website may point those roles
9
+ * at the dark one.
10
+ */
11
+ export declare const DEFAULT_PAIRING_DECLARATIONS: string;
12
+ /**
13
+ * A desk's brand color as its carriers paint it: the color (`#rrggbb`, null
14
+ * for none) and both of its pairings as the custom properties each carrier
15
+ * sets on itself, null for none, which leaves the stylesheet's default
16
+ * pairings (DEFAULT_PAIRING_DECLARATIONS).
17
+ */
18
+ export interface SupportBrand {
19
+ readonly color: string | null;
20
+ readonly properties: Readonly<Record<string, string>> | null;
21
+ }
22
+ /**
23
+ * Pairs a desk's brand color for every carrier, once: both of its pairings
24
+ * (@sparkvault/app-sdk/brand-color schemePairings, the ones the customer
25
+ * portal and the desk's email paint too), under each scheme's names: the
26
+ * fill, white or the ink on it, the accent as text, and the fill under the
27
+ * pointer. Whoever learns the desk's color derives it and hands the one brand
28
+ * to each element it paints (applySupportBrand), so a desk's color is paired
29
+ * once however often its elements render. A value that is no brand color is
30
+ * none.
31
+ */
32
+ export declare function supportBrand(value: unknown): SupportBrand;
33
+ /**
34
+ * The brand for a desk's color: `held` where it pairs that same color, so a
35
+ * color learned again (a held desk's, then connect's answer for it) is paired
36
+ * once and stays the one object every element compares.
37
+ */
38
+ export declare function brandFor(value: unknown, held: SupportBrand): SupportBrand;
39
+ /**
40
+ * Sets a desk's brand (supportBrand) on the launcher, the support panel, the
41
+ * request form's container or the form's modal. The stylesheet paints the
42
+ * light pairing wherever the accent roles (`--hd-accent*`) are not set, so on
43
+ * a website the widget's accent is the pairing the portal paints on light
44
+ * pages until the page points the roles at the dark pairing, and inside the
45
+ * customer portal each takes the portal's roles. Scoped to the element, so it
46
+ * works on a hosted page and on any website the widget stands on; a brand
47
+ * with no color clears them, and the stylesheet's default pairings return.
48
+ */
49
+ export declare function applySupportBrand(target: HTMLElement, brand: SupportBrand): void;
@@ -1,6 +1,12 @@
1
1
  import type { HelpDeskSupportLauncherOptions } from './support-types';
2
- /** A convenience path only: it never owns a second support flow. */
3
- export declare function createSupportLauncher(options: HelpDeskSupportLauncherOptions, open: () => void): {
2
+ import { type SupportBrand } from './support-brand';
3
+ /**
4
+ * A convenience path only: it never owns a second support flow. It carries
5
+ * the desk's brand (`brand`, then setBrand), so its focus ring is the desk's,
6
+ * as the panel's are.
7
+ */
8
+ export declare function createSupportLauncher(options: HelpDeskSupportLauncherOptions, brand: SupportBrand, open: () => void): {
4
9
  setExpanded(expanded: boolean): void;
10
+ setBrand(next: SupportBrand): void;
5
11
  destroy(): void;
6
12
  };
@@ -2,6 +2,13 @@
2
2
  * The support journey's only skin. Customer content stays in the product register.
3
3
  * The panel's focus ring is 2px, 3px out, in the desk's focus color: its width and
4
4
  * offset are the panel's custom properties, which the help desk composer inside
5
- * its request form reads, so the composer rings as the fields beside it do.
5
+ * its request form reads, so the composer rings as the fields beside it do. It
6
+ * paints in the help desk's color roles (@sparkvault/app-sdk/help-desk-colors):
7
+ * its neutrals read the page's roles (HOST), so in the customer portal they
8
+ * follow the portal's scheme, and stay light anywhere else; its accent reads
9
+ * the page's accent roles, else the desk's light pairing (ACCENT), which the
10
+ * panel and the launcher each carry (DEFAULT_PAIRING_DECLARATIONS), so the
11
+ * launcher rings in the desk's color, as every control in the panel does,
12
+ * outside a ring of its own that reads on any page (LAUNCHER_RING).
6
13
  */
7
14
  export declare function injectHelpDeskSupportStyles(): void;
@@ -1,11 +1,13 @@
1
1
  import type { KbReaderDocument, KbSearchResult } from './kb-types';
2
+ import { type SupportBrand } from './support-brand';
2
3
  export type SupportViewStage = 'issue' | 'results' | 'article' | 'feedback' | 'resolved' | 'contact' | 'receipt';
3
4
  export type SupportContactReason = 'direct' | 'no_results' | 'none_match' | 'article_not_answered';
4
5
  /** Presentation data only; the support controller owns authentication and writes. */
5
6
  export interface SupportViewState {
6
7
  visible: boolean;
7
8
  deskName: string;
8
- brandColor?: string | null;
9
+ /** The desk's brand, paired once by whoever learned its color (supportBrand). */
10
+ brand: SupportBrand;
9
11
  /** The desk's plain-text note beside the results' ticket button. */
10
12
  contactNote?: string;
11
13
  stage: SupportViewStage;