@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.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,6 +25808,8 @@ 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');
|
|
@@ -25881,11 +25903,8 @@ class SupportView {
|
|
|
25881
25903
|
// The heading asks the question once, so it names the field too.
|
|
25882
25904
|
const issueHeading = this.headings.get('issue');
|
|
25883
25905
|
issueHeading.id = `${this.prefix}-issue-title`;
|
|
25884
|
-
const helper = element('p', 'svhs-copy', 'What is your question? Tell us what is going on.');
|
|
25885
|
-
helper.id = `${this.prefix}-issue-help`;
|
|
25886
25906
|
this.issue.id = `${this.prefix}-issue`;
|
|
25887
25907
|
this.issue.setAttribute('aria-labelledby', issueHeading.id);
|
|
25888
|
-
this.issue.setAttribute('aria-describedby', helper.id);
|
|
25889
25908
|
this.issue.name = 'support_issue';
|
|
25890
25909
|
this.issue.placeholder = 'Describe your question or issue';
|
|
25891
25910
|
this.issue.autocomplete = 'off';
|
|
@@ -25905,9 +25924,14 @@ class SupportView {
|
|
|
25905
25924
|
this.search();
|
|
25906
25925
|
}
|
|
25907
25926
|
});
|
|
25908
|
-
intro.append(
|
|
25927
|
+
intro.append(this.issue, this.issueError);
|
|
25909
25928
|
this.find = button('svhs-primary', 'Continue', () => this.search());
|
|
25910
|
-
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);
|
|
25911
25935
|
const results = this.screen('results', 'These articles may help');
|
|
25912
25936
|
const queryLine = element('div', 'svhs-query');
|
|
25913
25937
|
const question = element('div', 'svhs-question');
|
|
@@ -26053,6 +26077,8 @@ class SupportView {
|
|
|
26053
26077
|
if (next.busy)
|
|
26054
26078
|
this.find.append(element('span', 'svhs-spinner'));
|
|
26055
26079
|
this.find.append(document.createTextNode(next.busy ? 'Continuing...' : 'Continue'));
|
|
26080
|
+
this.requesterName.textContent = next.requesterLabel || '';
|
|
26081
|
+
this.requesterIdentity.hidden = !next.requesterLabel;
|
|
26056
26082
|
this.issueError.textContent = next.stage === 'issue' ? next.error || '' : '';
|
|
26057
26083
|
this.issueError.hidden = !this.issueError.textContent;
|
|
26058
26084
|
this.query.textContent = next.issue;
|
|
@@ -26730,7 +26756,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
26730
26756
|
// launcher included. Any other desk's brand arrives with connect, which the
|
|
26731
26757
|
// first open, search or contact makes, never creation: connecting here would
|
|
26732
26758
|
// add a desk lookup to every page load of a website that shows the launcher.
|
|
26733
|
-
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) };
|
|
26734
26760
|
if (typeof options.launcher === 'object') {
|
|
26735
26761
|
const offset = (value, fallback) => typeof value === 'number' && Number.isFinite(value) ? Math.min(240, Math.max(12, value)) : fallback;
|
|
26736
26762
|
state.position = { right: offset(options.launcher.right, 24), bottom: offset(options.launcher.bottom, 24) + 72 };
|
|
@@ -26823,6 +26849,11 @@ function createHelpDeskSupport(config, options) {
|
|
|
26823
26849
|
launcher?.setBrand(state.brand);
|
|
26824
26850
|
notify(options.onStateChange, snapshot());
|
|
26825
26851
|
}
|
|
26852
|
+
function identifyRequester(customer) {
|
|
26853
|
+
const requesterLabel = requesterNameOrAddress(customer);
|
|
26854
|
+
if (requesterLabel !== state.requesterLabel)
|
|
26855
|
+
update({ requesterLabel });
|
|
26856
|
+
}
|
|
26826
26857
|
async function connect() {
|
|
26827
26858
|
if (!connected)
|
|
26828
26859
|
connected = HelpDeskClient.connect(config, { ...options, onDiscardError: reportLostRevocation }).then((answer) => {
|
|
@@ -26830,10 +26861,12 @@ function createHelpDeskSupport(config, options) {
|
|
|
26830
26861
|
throw new Error('Support is closed.');
|
|
26831
26862
|
client = answer;
|
|
26832
26863
|
stopSession = answer.subscribeSession((change) => {
|
|
26864
|
+
if (change.source !== 'renew')
|
|
26865
|
+
identifyRequester(null);
|
|
26833
26866
|
if (change.source !== 'clear' || replacingSession)
|
|
26834
26867
|
return;
|
|
26835
26868
|
if (lookupsInFlight === 0)
|
|
26836
|
-
|
|
26869
|
+
tellHost(null);
|
|
26837
26870
|
else
|
|
26838
26871
|
heldClear = true;
|
|
26839
26872
|
});
|
|
@@ -26873,6 +26906,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
26873
26906
|
return;
|
|
26874
26907
|
anonymous = !token;
|
|
26875
26908
|
if (!token) {
|
|
26909
|
+
identifyRequester(null);
|
|
26876
26910
|
if (!state.issue)
|
|
26877
26911
|
update({ issue: readSupportIssue(active.desk.desk_id) ?? '' });
|
|
26878
26912
|
if (state.issue)
|
|
@@ -26882,7 +26916,10 @@ function createHelpDeskSupport(config, options) {
|
|
|
26882
26916
|
}
|
|
26883
26917
|
else if (active.hasTicketAccess) {
|
|
26884
26918
|
const customer = await active.getMe();
|
|
26885
|
-
if (destroyed
|
|
26919
|
+
if (destroyed)
|
|
26920
|
+
return;
|
|
26921
|
+
identifyRequester(customer);
|
|
26922
|
+
if (state.stage !== 'issue')
|
|
26886
26923
|
return;
|
|
26887
26924
|
const saved = readFormDraft(active.desk.desk_id, customer.requester_id);
|
|
26888
26925
|
const composition = readAnonymousFormDraft(active.desk.desk_id);
|
|
@@ -27025,8 +27062,10 @@ function createHelpDeskSupport(config, options) {
|
|
|
27025
27062
|
tellHost(session);
|
|
27026
27063
|
}
|
|
27027
27064
|
function tellHost(session) {
|
|
27028
|
-
if (
|
|
27029
|
-
|
|
27065
|
+
if (destroyed)
|
|
27066
|
+
return;
|
|
27067
|
+
identifyRequester(session?.customer ?? null);
|
|
27068
|
+
notify(options.onSession, session);
|
|
27030
27069
|
}
|
|
27031
27070
|
/**
|
|
27032
27071
|
* Support's session lookup, with where support arrived (`arrival`) when the
|
|
@@ -27217,6 +27256,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
27217
27256
|
return;
|
|
27218
27257
|
contactCustomer = customer;
|
|
27219
27258
|
anonymous = !customer;
|
|
27259
|
+
identifyRequester(customer);
|
|
27220
27260
|
// A customer the website gave back sees their own saved request; none keeps it hidden.
|
|
27221
27261
|
const recovering = customer ? null : pendingRecovery;
|
|
27222
27262
|
pendingRecovery = null;
|
|
@@ -27243,7 +27283,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
27243
27283
|
anonymous = false;
|
|
27244
27284
|
if (options.persist)
|
|
27245
27285
|
clearSupportIssue(client.desk.desk_id);
|
|
27246
|
-
|
|
27286
|
+
tellHost(session);
|
|
27247
27287
|
},
|
|
27248
27288
|
widgetIdentity: {
|
|
27249
27289
|
customer,
|
|
@@ -27523,7 +27563,7 @@ function createHelpDeskSupport(config, options) {
|
|
|
27523
27563
|
// A refused or lost revocation leaves the chosen account in place.
|
|
27524
27564
|
void released.catch(reportLostRevocation);
|
|
27525
27565
|
active.setSession(session);
|
|
27526
|
-
|
|
27566
|
+
tellHost(session);
|
|
27527
27567
|
let refusal;
|
|
27528
27568
|
if (active.ticketAccessPolicy?.mode === 'identity') {
|
|
27529
27569
|
// Without this grant, contact's access check shows the employee gate
|
|
@@ -32441,7 +32481,7 @@ class SparkVault {
|
|
|
32441
32481
|
}
|
|
32442
32482
|
/** Get the SDK version */
|
|
32443
32483
|
static get version() {
|
|
32444
|
-
return '18.0.
|
|
32484
|
+
return '18.0.4';
|
|
32445
32485
|
}
|
|
32446
32486
|
}
|
|
32447
32487
|
if (typeof window !== 'undefined') {
|