@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.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,10 +25812,11 @@ 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');
|
|
25798
|
-
this.resultCopy = element('p', 'svhs-copy');
|
|
25799
25820
|
this.resultStatus = element('div', 'svhs-empty');
|
|
25800
25821
|
this.resultError = element('p', 'svhs-error');
|
|
25801
25822
|
this.contactNote = element('p', 'svhs-contact-note');
|
|
@@ -25886,11 +25907,8 @@ class SupportView {
|
|
|
25886
25907
|
// The heading asks the question once, so it names the field too.
|
|
25887
25908
|
const issueHeading = this.headings.get('issue');
|
|
25888
25909
|
issueHeading.id = `${this.prefix}-issue-title`;
|
|
25889
|
-
const helper = element('p', 'svhs-copy', 'What is your question? Tell us what is going on.');
|
|
25890
|
-
helper.id = `${this.prefix}-issue-help`;
|
|
25891
25910
|
this.issue.id = `${this.prefix}-issue`;
|
|
25892
25911
|
this.issue.setAttribute('aria-labelledby', issueHeading.id);
|
|
25893
|
-
this.issue.setAttribute('aria-describedby', helper.id);
|
|
25894
25912
|
this.issue.name = 'support_issue';
|
|
25895
25913
|
this.issue.placeholder = 'Describe your question or issue';
|
|
25896
25914
|
this.issue.autocomplete = 'off';
|
|
@@ -25910,9 +25928,14 @@ class SupportView {
|
|
|
25910
25928
|
this.search();
|
|
25911
25929
|
}
|
|
25912
25930
|
});
|
|
25913
|
-
intro.append(
|
|
25931
|
+
intro.append(this.issue, this.issueError);
|
|
25914
25932
|
this.find = button('svhs-primary', 'Continue', () => this.search());
|
|
25915
|
-
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);
|
|
25916
25939
|
const results = this.screen('results', 'These articles may help');
|
|
25917
25940
|
const queryLine = element('div', 'svhs-query');
|
|
25918
25941
|
const question = element('div', 'svhs-question');
|
|
@@ -25921,7 +25944,7 @@ class SupportView {
|
|
|
25921
25944
|
editQuestion.setAttribute('aria-label', 'Edit your question');
|
|
25922
25945
|
queryLine.append(question, editQuestion);
|
|
25923
25946
|
results.prepend(queryLine);
|
|
25924
|
-
results.append(this.
|
|
25947
|
+
results.append(this.resultList, this.resultStatus, this.resultError);
|
|
25925
25948
|
this.resultError.setAttribute('role', 'alert');
|
|
25926
25949
|
this.contactResults = button('svhs-secondary svhs-full', 'Still need help? Open a ticket', () => {
|
|
25927
25950
|
if (this.state?.busy)
|
|
@@ -26058,6 +26081,8 @@ class SupportView {
|
|
|
26058
26081
|
if (next.busy)
|
|
26059
26082
|
this.find.append(element('span', 'svhs-spinner'));
|
|
26060
26083
|
this.find.append(document.createTextNode(next.busy ? 'Continuing...' : 'Continue'));
|
|
26084
|
+
this.requesterName.textContent = next.requesterLabel || '';
|
|
26085
|
+
this.requesterIdentity.hidden = !next.requesterLabel;
|
|
26061
26086
|
this.issueError.textContent = next.stage === 'issue' ? next.error || '' : '';
|
|
26062
26087
|
this.issueError.hidden = !this.issueError.textContent;
|
|
26063
26088
|
this.query.textContent = next.issue;
|
|
@@ -26300,9 +26325,7 @@ class SupportView {
|
|
|
26300
26325
|
this.resultList.append(item);
|
|
26301
26326
|
}
|
|
26302
26327
|
}
|
|
26303
|
-
this.resultCopy.textContent = 'Choose an article to read the full answer.';
|
|
26304
26328
|
this.resultList.hidden = Boolean(state.busy) || state.kbState === 'locked' || state.kbState === 'unavailable';
|
|
26305
|
-
this.resultCopy.hidden = this.resultList.hidden || results.length === 0;
|
|
26306
26329
|
this.resultError.textContent = state.stage === 'results' ? state.error || '' : '';
|
|
26307
26330
|
this.resultError.hidden = !this.resultError.textContent;
|
|
26308
26331
|
this.renderResultStatus(state, results);
|
|
@@ -26737,7 +26760,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
26737
26760
|
// launcher included. Any other desk's brand arrives with connect, which the
|
|
26738
26761
|
// first open, search or contact makes, never creation: connecting here would
|
|
26739
26762
|
// add a desk lookup to every page load of a website that shows the launcher.
|
|
26740
|
-
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) };
|
|
26741
26764
|
if (typeof options.launcher === 'object') {
|
|
26742
26765
|
const offset = (value, fallback) => typeof value === 'number' && Number.isFinite(value) ? Math.min(240, Math.max(12, value)) : fallback;
|
|
26743
26766
|
state.position = { right: offset(options.launcher.right, 24), bottom: offset(options.launcher.bottom, 24) + 72 };
|
|
@@ -26830,6 +26853,11 @@ function createHelpDeskSupport(config, options) {
|
|
|
26830
26853
|
launcher?.setBrand(state.brand);
|
|
26831
26854
|
notify(options.onStateChange, snapshot());
|
|
26832
26855
|
}
|
|
26856
|
+
function identifyRequester(customer) {
|
|
26857
|
+
const requesterLabel = requesterNameOrAddress(customer);
|
|
26858
|
+
if (requesterLabel !== state.requesterLabel)
|
|
26859
|
+
update({ requesterLabel });
|
|
26860
|
+
}
|
|
26833
26861
|
async function connect() {
|
|
26834
26862
|
if (!connected)
|
|
26835
26863
|
connected = HelpDeskClient.connect(config, { ...options, onDiscardError: reportLostRevocation }).then((answer) => {
|
|
@@ -26837,10 +26865,12 @@ function createHelpDeskSupport(config, options) {
|
|
|
26837
26865
|
throw new Error('Support is closed.');
|
|
26838
26866
|
client = answer;
|
|
26839
26867
|
stopSession = answer.subscribeSession((change) => {
|
|
26868
|
+
if (change.source !== 'renew')
|
|
26869
|
+
identifyRequester(null);
|
|
26840
26870
|
if (change.source !== 'clear' || replacingSession)
|
|
26841
26871
|
return;
|
|
26842
26872
|
if (lookupsInFlight === 0)
|
|
26843
|
-
|
|
26873
|
+
tellHost(null);
|
|
26844
26874
|
else
|
|
26845
26875
|
heldClear = true;
|
|
26846
26876
|
});
|
|
@@ -26880,6 +26910,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
26880
26910
|
return;
|
|
26881
26911
|
anonymous = !token;
|
|
26882
26912
|
if (!token) {
|
|
26913
|
+
identifyRequester(null);
|
|
26883
26914
|
if (!state.issue)
|
|
26884
26915
|
update({ issue: readSupportIssue(active.desk.desk_id) ?? '' });
|
|
26885
26916
|
if (state.issue)
|
|
@@ -26889,7 +26920,10 @@ function createHelpDeskSupport(config, options) {
|
|
|
26889
26920
|
}
|
|
26890
26921
|
else if (active.hasTicketAccess) {
|
|
26891
26922
|
const customer = await active.getMe();
|
|
26892
|
-
if (destroyed
|
|
26923
|
+
if (destroyed)
|
|
26924
|
+
return;
|
|
26925
|
+
identifyRequester(customer);
|
|
26926
|
+
if (state.stage !== 'issue')
|
|
26893
26927
|
return;
|
|
26894
26928
|
const saved = readFormDraft(active.desk.desk_id, customer.requester_id);
|
|
26895
26929
|
const composition = readAnonymousFormDraft(active.desk.desk_id);
|
|
@@ -27032,8 +27066,10 @@ function createHelpDeskSupport(config, options) {
|
|
|
27032
27066
|
tellHost(session);
|
|
27033
27067
|
}
|
|
27034
27068
|
function tellHost(session) {
|
|
27035
|
-
if (
|
|
27036
|
-
|
|
27069
|
+
if (destroyed)
|
|
27070
|
+
return;
|
|
27071
|
+
identifyRequester(session?.customer ?? null);
|
|
27072
|
+
notify(options.onSession, session);
|
|
27037
27073
|
}
|
|
27038
27074
|
/**
|
|
27039
27075
|
* Support's session lookup, with where support arrived (`arrival`) when the
|
|
@@ -27224,6 +27260,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
27224
27260
|
return;
|
|
27225
27261
|
contactCustomer = customer;
|
|
27226
27262
|
anonymous = !customer;
|
|
27263
|
+
identifyRequester(customer);
|
|
27227
27264
|
// A customer the website gave back sees their own saved request; none keeps it hidden.
|
|
27228
27265
|
const recovering = customer ? null : pendingRecovery;
|
|
27229
27266
|
pendingRecovery = null;
|
|
@@ -27250,7 +27287,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
27250
27287
|
anonymous = false;
|
|
27251
27288
|
if (options.persist)
|
|
27252
27289
|
clearSupportIssue(client.desk.desk_id);
|
|
27253
|
-
|
|
27290
|
+
tellHost(session);
|
|
27254
27291
|
},
|
|
27255
27292
|
widgetIdentity: {
|
|
27256
27293
|
customer,
|
|
@@ -27530,7 +27567,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
27530
27567
|
// A refused or lost revocation leaves the chosen account in place.
|
|
27531
27568
|
void released.catch(reportLostRevocation);
|
|
27532
27569
|
active.setSession(session);
|
|
27533
|
-
|
|
27570
|
+
tellHost(session);
|
|
27534
27571
|
let refusal;
|
|
27535
27572
|
if (active.ticketAccessPolicy?.mode === 'identity') {
|
|
27536
27573
|
// Without this grant, contact's access check shows the employee gate
|
|
@@ -32448,7 +32485,7 @@ class SparkVault {
|
|
|
32448
32485
|
}
|
|
32449
32486
|
/** Get the SDK version */
|
|
32450
32487
|
static get version() {
|
|
32451
|
-
return '18.0.
|
|
32488
|
+
return '18.0.4';
|
|
32452
32489
|
}
|
|
32453
32490
|
}
|
|
32454
32491
|
if (typeof window !== 'undefined') {
|