@sparkvault/sdk-js 18.0.3 → 18.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +53 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +53 -13
- package/dist/index.mjs.map +1 -1
- package/dist/products/help-desk/support-view.d.ts +4 -0
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -14953,6 +14953,21 @@ const HELP_DESK_WIDGET_IDENTITY_MESSAGES = Object.freeze({
|
|
|
14953
14953
|
result: 'sparkvault:help-desk:identity'
|
|
14954
14954
|
});
|
|
14955
14955
|
|
|
14956
|
+
/**
|
|
14957
|
+
* The one rule labelling a requester on a ticket's timeline, for every
|
|
14958
|
+
* audience, and in the console's inbox: the name they gave the desk, else
|
|
14959
|
+
* their address; null when it holds neither (an erased requester). An empty
|
|
14960
|
+
* name is no name, so their address stands in for it. Core's timeline
|
|
14961
|
+
* labels (help-desk/events.js) and the console's inbox (inbox/labels.js)
|
|
14962
|
+
* both read it.
|
|
14963
|
+
*
|
|
14964
|
+
* @param {{ display_name?: string|null, email?: string|null }|null|undefined} requester
|
|
14965
|
+
* @returns {string|null}
|
|
14966
|
+
*/
|
|
14967
|
+
function requesterNameOrAddress(requester) {
|
|
14968
|
+
return requester?.display_name || requester?.email || null;
|
|
14969
|
+
}
|
|
14970
|
+
|
|
14956
14971
|
/**
|
|
14957
14972
|
* Mail local parts no queue may take as its alias: the role mailboxes RFC 2142
|
|
14958
14973
|
* names, the addresses mail systems and their operators keep for themselves,
|
|
@@ -25556,6 +25571,10 @@ function injectHelpDeskSupportStyles() {
|
|
|
25556
25571
|
.svhs-page .svhs-bottom{padding:20px 32px 24px}
|
|
25557
25572
|
.svhs-page .svhs-start-bottom{padding-top:0;align-items:flex-start}
|
|
25558
25573
|
.svhs-page .svhs-start-bottom .svhs-primary{width:auto;min-width:160px}
|
|
25574
|
+
.svhs-page .svhs-start-bottom:has(>.svhs-requester-identity:not([hidden])){flex-direction:row;align-items:center;gap:16px}
|
|
25575
|
+
.svhs-page .svhs-start-bottom:has(>.svhs-requester-identity:not([hidden])) .svhs-primary{flex:none;width:auto}
|
|
25576
|
+
.svhs-requester-identity{flex:1;min-width:0;margin:0;color:${HELP_DESK_COLORS.body};font-size:13px;line-height:1.5;overflow-wrap:anywhere}
|
|
25577
|
+
.svhs-requester-name{font-weight:600}
|
|
25559
25578
|
.svhs-page[data-stage=issue] .svhs-heading{font-size:28px}
|
|
25560
25579
|
.svhs-page .svhs-results-bottom .svhs-secondary{width:auto;flex:none}
|
|
25561
25580
|
.svhs-page .svhs-contact-target,.svhs-page .svhs-contact-target>.svhd-container{min-height:0}
|
|
@@ -25568,6 +25587,7 @@ function injectHelpDeskSupportStyles() {
|
|
|
25568
25587
|
.svhs-page .svhs-bottom{padding:20px}
|
|
25569
25588
|
.svhs-page .svhs-start-bottom{padding-top:0}
|
|
25570
25589
|
.svhs-page .svhs-start-bottom .svhs-primary{width:100%}
|
|
25590
|
+
.svhs-page .svhs-start-bottom:has(>.svhs-requester-identity:not([hidden])) .svhs-primary{min-width:0}
|
|
25571
25591
|
.svhs-page[data-stage=issue] .svhs-heading{font-size:26px}
|
|
25572
25592
|
.svhs-page .svhs-results-bottom .svhs-secondary{width:100%}
|
|
25573
25593
|
.svhs-page .svhs-contact-scroll{padding:0}
|
|
@@ -25792,6 +25812,8 @@ class SupportView {
|
|
|
25792
25812
|
this.deskName = element('span', 'svhs-desk-name');
|
|
25793
25813
|
this.external = element('a', 'svhs-icon-button');
|
|
25794
25814
|
this.issue = element('textarea', 'svhs-issue');
|
|
25815
|
+
this.requesterIdentity = element('p', 'svhs-requester-identity');
|
|
25816
|
+
this.requesterName = element('span', 'svhs-requester-name');
|
|
25795
25817
|
this.issueError = element('p', 'svhs-error');
|
|
25796
25818
|
this.query = element('p', 'svhs-query-text');
|
|
25797
25819
|
this.resultList = element('ul', 'svhs-results');
|
|
@@ -25885,11 +25907,8 @@ class SupportView {
|
|
|
25885
25907
|
// The heading asks the question once, so it names the field too.
|
|
25886
25908
|
const issueHeading = this.headings.get('issue');
|
|
25887
25909
|
issueHeading.id = `${this.prefix}-issue-title`;
|
|
25888
|
-
const helper = element('p', 'svhs-copy', 'What is your question? Tell us what is going on.');
|
|
25889
|
-
helper.id = `${this.prefix}-issue-help`;
|
|
25890
25910
|
this.issue.id = `${this.prefix}-issue`;
|
|
25891
25911
|
this.issue.setAttribute('aria-labelledby', issueHeading.id);
|
|
25892
|
-
this.issue.setAttribute('aria-describedby', helper.id);
|
|
25893
25912
|
this.issue.name = 'support_issue';
|
|
25894
25913
|
this.issue.placeholder = 'Describe your question or issue';
|
|
25895
25914
|
this.issue.autocomplete = 'off';
|
|
@@ -25909,9 +25928,14 @@ class SupportView {
|
|
|
25909
25928
|
this.search();
|
|
25910
25929
|
}
|
|
25911
25930
|
});
|
|
25912
|
-
intro.append(
|
|
25931
|
+
intro.append(this.issue, this.issueError);
|
|
25913
25932
|
this.find = button('svhs-primary', 'Continue', () => this.search());
|
|
25914
|
-
this.footer('issue', 'svhs-start-bottom')
|
|
25933
|
+
const issueFooter = this.footer('issue', 'svhs-start-bottom');
|
|
25934
|
+
issueFooter.append(this.find);
|
|
25935
|
+
this.requesterIdentity.append(document.createTextNode('Signed in as '), this.requesterName);
|
|
25936
|
+
this.requesterIdentity.hidden = true;
|
|
25937
|
+
if (target)
|
|
25938
|
+
issueFooter.append(this.requesterIdentity);
|
|
25915
25939
|
const results = this.screen('results', 'These articles may help');
|
|
25916
25940
|
const queryLine = element('div', 'svhs-query');
|
|
25917
25941
|
const question = element('div', 'svhs-question');
|
|
@@ -26057,6 +26081,8 @@ class SupportView {
|
|
|
26057
26081
|
if (next.busy)
|
|
26058
26082
|
this.find.append(element('span', 'svhs-spinner'));
|
|
26059
26083
|
this.find.append(document.createTextNode(next.busy ? 'Continuing...' : 'Continue'));
|
|
26084
|
+
this.requesterName.textContent = next.requesterLabel || '';
|
|
26085
|
+
this.requesterIdentity.hidden = !next.requesterLabel;
|
|
26060
26086
|
this.issueError.textContent = next.stage === 'issue' ? next.error || '' : '';
|
|
26061
26087
|
this.issueError.hidden = !this.issueError.textContent;
|
|
26062
26088
|
this.query.textContent = next.issue;
|
|
@@ -26734,7 +26760,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
26734
26760
|
// launcher included. Any other desk's brand arrives with connect, which the
|
|
26735
26761
|
// first open, search or contact makes, never creation: connecting here would
|
|
26736
26762
|
// add a desk lookup to every page load of a website that shows the launcher.
|
|
26737
|
-
let state = { visible: false, stage: 'issue', deskName: 'Support', issue: '', brand: supportBrand(options.desk?.branding?.color) };
|
|
26763
|
+
let state = { visible: false, stage: 'issue', deskName: 'Support', issue: '', requesterLabel: null, brand: supportBrand(options.desk?.branding?.color) };
|
|
26738
26764
|
if (typeof options.launcher === 'object') {
|
|
26739
26765
|
const offset = (value, fallback) => typeof value === 'number' && Number.isFinite(value) ? Math.min(240, Math.max(12, value)) : fallback;
|
|
26740
26766
|
state.position = { right: offset(options.launcher.right, 24), bottom: offset(options.launcher.bottom, 24) + 72 };
|
|
@@ -26827,6 +26853,11 @@ function createHelpDeskSupport(config, options) {
|
|
|
26827
26853
|
launcher?.setBrand(state.brand);
|
|
26828
26854
|
notify(options.onStateChange, snapshot());
|
|
26829
26855
|
}
|
|
26856
|
+
function identifyRequester(customer) {
|
|
26857
|
+
const requesterLabel = requesterNameOrAddress(customer);
|
|
26858
|
+
if (requesterLabel !== state.requesterLabel)
|
|
26859
|
+
update({ requesterLabel });
|
|
26860
|
+
}
|
|
26830
26861
|
async function connect() {
|
|
26831
26862
|
if (!connected)
|
|
26832
26863
|
connected = HelpDeskClient.connect(config, { ...options, onDiscardError: reportLostRevocation }).then((answer) => {
|
|
@@ -26834,10 +26865,12 @@ function createHelpDeskSupport(config, options) {
|
|
|
26834
26865
|
throw new Error('Support is closed.');
|
|
26835
26866
|
client = answer;
|
|
26836
26867
|
stopSession = answer.subscribeSession((change) => {
|
|
26868
|
+
if (change.source !== 'renew')
|
|
26869
|
+
identifyRequester(null);
|
|
26837
26870
|
if (change.source !== 'clear' || replacingSession)
|
|
26838
26871
|
return;
|
|
26839
26872
|
if (lookupsInFlight === 0)
|
|
26840
|
-
|
|
26873
|
+
tellHost(null);
|
|
26841
26874
|
else
|
|
26842
26875
|
heldClear = true;
|
|
26843
26876
|
});
|
|
@@ -26877,6 +26910,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
26877
26910
|
return;
|
|
26878
26911
|
anonymous = !token;
|
|
26879
26912
|
if (!token) {
|
|
26913
|
+
identifyRequester(null);
|
|
26880
26914
|
if (!state.issue)
|
|
26881
26915
|
update({ issue: readSupportIssue(active.desk.desk_id) ?? '' });
|
|
26882
26916
|
if (state.issue)
|
|
@@ -26886,7 +26920,10 @@ function createHelpDeskSupport(config, options) {
|
|
|
26886
26920
|
}
|
|
26887
26921
|
else if (active.hasTicketAccess) {
|
|
26888
26922
|
const customer = await active.getMe();
|
|
26889
|
-
if (destroyed
|
|
26923
|
+
if (destroyed)
|
|
26924
|
+
return;
|
|
26925
|
+
identifyRequester(customer);
|
|
26926
|
+
if (state.stage !== 'issue')
|
|
26890
26927
|
return;
|
|
26891
26928
|
const saved = readFormDraft(active.desk.desk_id, customer.requester_id);
|
|
26892
26929
|
const composition = readAnonymousFormDraft(active.desk.desk_id);
|
|
@@ -27029,8 +27066,10 @@ function createHelpDeskSupport(config, options) {
|
|
|
27029
27066
|
tellHost(session);
|
|
27030
27067
|
}
|
|
27031
27068
|
function tellHost(session) {
|
|
27032
|
-
if (
|
|
27033
|
-
|
|
27069
|
+
if (destroyed)
|
|
27070
|
+
return;
|
|
27071
|
+
identifyRequester(session?.customer ?? null);
|
|
27072
|
+
notify(options.onSession, session);
|
|
27034
27073
|
}
|
|
27035
27074
|
/**
|
|
27036
27075
|
* Support's session lookup, with where support arrived (`arrival`) when the
|
|
@@ -27221,6 +27260,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
27221
27260
|
return;
|
|
27222
27261
|
contactCustomer = customer;
|
|
27223
27262
|
anonymous = !customer;
|
|
27263
|
+
identifyRequester(customer);
|
|
27224
27264
|
// A customer the website gave back sees their own saved request; none keeps it hidden.
|
|
27225
27265
|
const recovering = customer ? null : pendingRecovery;
|
|
27226
27266
|
pendingRecovery = null;
|
|
@@ -27247,7 +27287,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
27247
27287
|
anonymous = false;
|
|
27248
27288
|
if (options.persist)
|
|
27249
27289
|
clearSupportIssue(client.desk.desk_id);
|
|
27250
|
-
|
|
27290
|
+
tellHost(session);
|
|
27251
27291
|
},
|
|
27252
27292
|
widgetIdentity: {
|
|
27253
27293
|
customer,
|
|
@@ -27527,7 +27567,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
27527
27567
|
// A refused or lost revocation leaves the chosen account in place.
|
|
27528
27568
|
void released.catch(reportLostRevocation);
|
|
27529
27569
|
active.setSession(session);
|
|
27530
|
-
|
|
27570
|
+
tellHost(session);
|
|
27531
27571
|
let refusal;
|
|
27532
27572
|
if (active.ticketAccessPolicy?.mode === 'identity') {
|
|
27533
27573
|
// Without this grant, contact's access check shows the employee gate
|
|
@@ -32445,7 +32485,7 @@ class SparkVault {
|
|
|
32445
32485
|
}
|
|
32446
32486
|
/** Get the SDK version */
|
|
32447
32487
|
static get version() {
|
|
32448
|
-
return '18.0.
|
|
32488
|
+
return '18.0.4';
|
|
32449
32489
|
}
|
|
32450
32490
|
}
|
|
32451
32491
|
if (typeof window !== 'undefined') {
|