@sparkvault/sdk-js 18.0.2 → 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 +54 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +54 -17
- package/dist/index.mjs.map +1 -1
- package/dist/products/help-desk/support-view.d.ts +4 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -14949,6 +14949,21 @@ const HELP_DESK_WIDGET_IDENTITY_MESSAGES = Object.freeze({
|
|
|
14949
14949
|
result: 'sparkvault:help-desk:identity'
|
|
14950
14950
|
});
|
|
14951
14951
|
|
|
14952
|
+
/**
|
|
14953
|
+
* The one rule labelling a requester on a ticket's timeline, for every
|
|
14954
|
+
* audience, and in the console's inbox: the name they gave the desk, else
|
|
14955
|
+
* their address; null when it holds neither (an erased requester). An empty
|
|
14956
|
+
* name is no name, so their address stands in for it. Core's timeline
|
|
14957
|
+
* labels (help-desk/events.js) and the console's inbox (inbox/labels.js)
|
|
14958
|
+
* both read it.
|
|
14959
|
+
*
|
|
14960
|
+
* @param {{ display_name?: string|null, email?: string|null }|null|undefined} requester
|
|
14961
|
+
* @returns {string|null}
|
|
14962
|
+
*/
|
|
14963
|
+
function requesterNameOrAddress(requester) {
|
|
14964
|
+
return requester?.display_name || requester?.email || null;
|
|
14965
|
+
}
|
|
14966
|
+
|
|
14952
14967
|
/**
|
|
14953
14968
|
* Mail local parts no queue may take as its alias: the role mailboxes RFC 2142
|
|
14954
14969
|
* names, the addresses mail systems and their operators keep for themselves,
|
|
@@ -25552,6 +25567,10 @@ function injectHelpDeskSupportStyles() {
|
|
|
25552
25567
|
.svhs-page .svhs-bottom{padding:20px 32px 24px}
|
|
25553
25568
|
.svhs-page .svhs-start-bottom{padding-top:0;align-items:flex-start}
|
|
25554
25569
|
.svhs-page .svhs-start-bottom .svhs-primary{width:auto;min-width:160px}
|
|
25570
|
+
.svhs-page .svhs-start-bottom:has(>.svhs-requester-identity:not([hidden])){flex-direction:row;align-items:center;gap:16px}
|
|
25571
|
+
.svhs-page .svhs-start-bottom:has(>.svhs-requester-identity:not([hidden])) .svhs-primary{flex:none;width:auto}
|
|
25572
|
+
.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}
|
|
25573
|
+
.svhs-requester-name{font-weight:600}
|
|
25555
25574
|
.svhs-page[data-stage=issue] .svhs-heading{font-size:28px}
|
|
25556
25575
|
.svhs-page .svhs-results-bottom .svhs-secondary{width:auto;flex:none}
|
|
25557
25576
|
.svhs-page .svhs-contact-target,.svhs-page .svhs-contact-target>.svhd-container{min-height:0}
|
|
@@ -25564,6 +25583,7 @@ function injectHelpDeskSupportStyles() {
|
|
|
25564
25583
|
.svhs-page .svhs-bottom{padding:20px}
|
|
25565
25584
|
.svhs-page .svhs-start-bottom{padding-top:0}
|
|
25566
25585
|
.svhs-page .svhs-start-bottom .svhs-primary{width:100%}
|
|
25586
|
+
.svhs-page .svhs-start-bottom:has(>.svhs-requester-identity:not([hidden])) .svhs-primary{min-width:0}
|
|
25567
25587
|
.svhs-page[data-stage=issue] .svhs-heading{font-size:26px}
|
|
25568
25588
|
.svhs-page .svhs-results-bottom .svhs-secondary{width:100%}
|
|
25569
25589
|
.svhs-page .svhs-contact-scroll{padding:0}
|
|
@@ -25788,10 +25808,11 @@ class SupportView {
|
|
|
25788
25808
|
this.deskName = element('span', 'svhs-desk-name');
|
|
25789
25809
|
this.external = element('a', 'svhs-icon-button');
|
|
25790
25810
|
this.issue = element('textarea', 'svhs-issue');
|
|
25811
|
+
this.requesterIdentity = element('p', 'svhs-requester-identity');
|
|
25812
|
+
this.requesterName = element('span', 'svhs-requester-name');
|
|
25791
25813
|
this.issueError = element('p', 'svhs-error');
|
|
25792
25814
|
this.query = element('p', 'svhs-query-text');
|
|
25793
25815
|
this.resultList = element('ul', 'svhs-results');
|
|
25794
|
-
this.resultCopy = element('p', 'svhs-copy');
|
|
25795
25816
|
this.resultStatus = element('div', 'svhs-empty');
|
|
25796
25817
|
this.resultError = element('p', 'svhs-error');
|
|
25797
25818
|
this.contactNote = element('p', 'svhs-contact-note');
|
|
@@ -25882,11 +25903,8 @@ class SupportView {
|
|
|
25882
25903
|
// The heading asks the question once, so it names the field too.
|
|
25883
25904
|
const issueHeading = this.headings.get('issue');
|
|
25884
25905
|
issueHeading.id = `${this.prefix}-issue-title`;
|
|
25885
|
-
const helper = element('p', 'svhs-copy', 'What is your question? Tell us what is going on.');
|
|
25886
|
-
helper.id = `${this.prefix}-issue-help`;
|
|
25887
25906
|
this.issue.id = `${this.prefix}-issue`;
|
|
25888
25907
|
this.issue.setAttribute('aria-labelledby', issueHeading.id);
|
|
25889
|
-
this.issue.setAttribute('aria-describedby', helper.id);
|
|
25890
25908
|
this.issue.name = 'support_issue';
|
|
25891
25909
|
this.issue.placeholder = 'Describe your question or issue';
|
|
25892
25910
|
this.issue.autocomplete = 'off';
|
|
@@ -25906,9 +25924,14 @@ class SupportView {
|
|
|
25906
25924
|
this.search();
|
|
25907
25925
|
}
|
|
25908
25926
|
});
|
|
25909
|
-
intro.append(
|
|
25927
|
+
intro.append(this.issue, this.issueError);
|
|
25910
25928
|
this.find = button('svhs-primary', 'Continue', () => this.search());
|
|
25911
|
-
this.footer('issue', 'svhs-start-bottom')
|
|
25929
|
+
const issueFooter = this.footer('issue', 'svhs-start-bottom');
|
|
25930
|
+
issueFooter.append(this.find);
|
|
25931
|
+
this.requesterIdentity.append(document.createTextNode('Signed in as '), this.requesterName);
|
|
25932
|
+
this.requesterIdentity.hidden = true;
|
|
25933
|
+
if (target)
|
|
25934
|
+
issueFooter.append(this.requesterIdentity);
|
|
25912
25935
|
const results = this.screen('results', 'These articles may help');
|
|
25913
25936
|
const queryLine = element('div', 'svhs-query');
|
|
25914
25937
|
const question = element('div', 'svhs-question');
|
|
@@ -25917,7 +25940,7 @@ class SupportView {
|
|
|
25917
25940
|
editQuestion.setAttribute('aria-label', 'Edit your question');
|
|
25918
25941
|
queryLine.append(question, editQuestion);
|
|
25919
25942
|
results.prepend(queryLine);
|
|
25920
|
-
results.append(this.
|
|
25943
|
+
results.append(this.resultList, this.resultStatus, this.resultError);
|
|
25921
25944
|
this.resultError.setAttribute('role', 'alert');
|
|
25922
25945
|
this.contactResults = button('svhs-secondary svhs-full', 'Still need help? Open a ticket', () => {
|
|
25923
25946
|
if (this.state?.busy)
|
|
@@ -26054,6 +26077,8 @@ class SupportView {
|
|
|
26054
26077
|
if (next.busy)
|
|
26055
26078
|
this.find.append(element('span', 'svhs-spinner'));
|
|
26056
26079
|
this.find.append(document.createTextNode(next.busy ? 'Continuing...' : 'Continue'));
|
|
26080
|
+
this.requesterName.textContent = next.requesterLabel || '';
|
|
26081
|
+
this.requesterIdentity.hidden = !next.requesterLabel;
|
|
26057
26082
|
this.issueError.textContent = next.stage === 'issue' ? next.error || '' : '';
|
|
26058
26083
|
this.issueError.hidden = !this.issueError.textContent;
|
|
26059
26084
|
this.query.textContent = next.issue;
|
|
@@ -26296,9 +26321,7 @@ class SupportView {
|
|
|
26296
26321
|
this.resultList.append(item);
|
|
26297
26322
|
}
|
|
26298
26323
|
}
|
|
26299
|
-
this.resultCopy.textContent = 'Choose an article to read the full answer.';
|
|
26300
26324
|
this.resultList.hidden = Boolean(state.busy) || state.kbState === 'locked' || state.kbState === 'unavailable';
|
|
26301
|
-
this.resultCopy.hidden = this.resultList.hidden || results.length === 0;
|
|
26302
26325
|
this.resultError.textContent = state.stage === 'results' ? state.error || '' : '';
|
|
26303
26326
|
this.resultError.hidden = !this.resultError.textContent;
|
|
26304
26327
|
this.renderResultStatus(state, results);
|
|
@@ -26733,7 +26756,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
26733
26756
|
// launcher included. Any other desk's brand arrives with connect, which the
|
|
26734
26757
|
// first open, search or contact makes, never creation: connecting here would
|
|
26735
26758
|
// 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) };
|
|
26759
|
+
let state = { visible: false, stage: 'issue', deskName: 'Support', issue: '', requesterLabel: null, brand: supportBrand(options.desk?.branding?.color) };
|
|
26737
26760
|
if (typeof options.launcher === 'object') {
|
|
26738
26761
|
const offset = (value, fallback) => typeof value === 'number' && Number.isFinite(value) ? Math.min(240, Math.max(12, value)) : fallback;
|
|
26739
26762
|
state.position = { right: offset(options.launcher.right, 24), bottom: offset(options.launcher.bottom, 24) + 72 };
|
|
@@ -26826,6 +26849,11 @@ function createHelpDeskSupport(config, options) {
|
|
|
26826
26849
|
launcher?.setBrand(state.brand);
|
|
26827
26850
|
notify(options.onStateChange, snapshot());
|
|
26828
26851
|
}
|
|
26852
|
+
function identifyRequester(customer) {
|
|
26853
|
+
const requesterLabel = requesterNameOrAddress(customer);
|
|
26854
|
+
if (requesterLabel !== state.requesterLabel)
|
|
26855
|
+
update({ requesterLabel });
|
|
26856
|
+
}
|
|
26829
26857
|
async function connect() {
|
|
26830
26858
|
if (!connected)
|
|
26831
26859
|
connected = HelpDeskClient.connect(config, { ...options, onDiscardError: reportLostRevocation }).then((answer) => {
|
|
@@ -26833,10 +26861,12 @@ function createHelpDeskSupport(config, options) {
|
|
|
26833
26861
|
throw new Error('Support is closed.');
|
|
26834
26862
|
client = answer;
|
|
26835
26863
|
stopSession = answer.subscribeSession((change) => {
|
|
26864
|
+
if (change.source !== 'renew')
|
|
26865
|
+
identifyRequester(null);
|
|
26836
26866
|
if (change.source !== 'clear' || replacingSession)
|
|
26837
26867
|
return;
|
|
26838
26868
|
if (lookupsInFlight === 0)
|
|
26839
|
-
|
|
26869
|
+
tellHost(null);
|
|
26840
26870
|
else
|
|
26841
26871
|
heldClear = true;
|
|
26842
26872
|
});
|
|
@@ -26876,6 +26906,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
26876
26906
|
return;
|
|
26877
26907
|
anonymous = !token;
|
|
26878
26908
|
if (!token) {
|
|
26909
|
+
identifyRequester(null);
|
|
26879
26910
|
if (!state.issue)
|
|
26880
26911
|
update({ issue: readSupportIssue(active.desk.desk_id) ?? '' });
|
|
26881
26912
|
if (state.issue)
|
|
@@ -26885,7 +26916,10 @@ function createHelpDeskSupport(config, options) {
|
|
|
26885
26916
|
}
|
|
26886
26917
|
else if (active.hasTicketAccess) {
|
|
26887
26918
|
const customer = await active.getMe();
|
|
26888
|
-
if (destroyed
|
|
26919
|
+
if (destroyed)
|
|
26920
|
+
return;
|
|
26921
|
+
identifyRequester(customer);
|
|
26922
|
+
if (state.stage !== 'issue')
|
|
26889
26923
|
return;
|
|
26890
26924
|
const saved = readFormDraft(active.desk.desk_id, customer.requester_id);
|
|
26891
26925
|
const composition = readAnonymousFormDraft(active.desk.desk_id);
|
|
@@ -27028,8 +27062,10 @@ function createHelpDeskSupport(config, options) {
|
|
|
27028
27062
|
tellHost(session);
|
|
27029
27063
|
}
|
|
27030
27064
|
function tellHost(session) {
|
|
27031
|
-
if (
|
|
27032
|
-
|
|
27065
|
+
if (destroyed)
|
|
27066
|
+
return;
|
|
27067
|
+
identifyRequester(session?.customer ?? null);
|
|
27068
|
+
notify(options.onSession, session);
|
|
27033
27069
|
}
|
|
27034
27070
|
/**
|
|
27035
27071
|
* Support's session lookup, with where support arrived (`arrival`) when the
|
|
@@ -27220,6 +27256,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
27220
27256
|
return;
|
|
27221
27257
|
contactCustomer = customer;
|
|
27222
27258
|
anonymous = !customer;
|
|
27259
|
+
identifyRequester(customer);
|
|
27223
27260
|
// A customer the website gave back sees their own saved request; none keeps it hidden.
|
|
27224
27261
|
const recovering = customer ? null : pendingRecovery;
|
|
27225
27262
|
pendingRecovery = null;
|
|
@@ -27246,7 +27283,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
27246
27283
|
anonymous = false;
|
|
27247
27284
|
if (options.persist)
|
|
27248
27285
|
clearSupportIssue(client.desk.desk_id);
|
|
27249
|
-
|
|
27286
|
+
tellHost(session);
|
|
27250
27287
|
},
|
|
27251
27288
|
widgetIdentity: {
|
|
27252
27289
|
customer,
|
|
@@ -27526,7 +27563,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
27526
27563
|
// A refused or lost revocation leaves the chosen account in place.
|
|
27527
27564
|
void released.catch(reportLostRevocation);
|
|
27528
27565
|
active.setSession(session);
|
|
27529
|
-
|
|
27566
|
+
tellHost(session);
|
|
27530
27567
|
let refusal;
|
|
27531
27568
|
if (active.ticketAccessPolicy?.mode === 'identity') {
|
|
27532
27569
|
// Without this grant, contact's access check shows the employee gate
|
|
@@ -32444,7 +32481,7 @@ class SparkVault {
|
|
|
32444
32481
|
}
|
|
32445
32482
|
/** Get the SDK version */
|
|
32446
32483
|
static get version() {
|
|
32447
|
-
return '18.0.
|
|
32484
|
+
return '18.0.4';
|
|
32448
32485
|
}
|
|
32449
32486
|
}
|
|
32450
32487
|
if (typeof window !== 'undefined') {
|