@sparkvault/sdk-js 15.2.0 → 15.3.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.
package/README.md CHANGED
@@ -136,6 +136,66 @@ app.post('/api/auth/login', async (req, res) => {
136
136
 
137
137
  ## Help Desk
138
138
 
139
+ Create one KB-first support widget after the page body is ready:
140
+
141
+ ```typescript
142
+ const support = sv.products.helpDesk.createSupport({
143
+ host: 'support.example.com',
144
+ launcher: true, // Optional bottom-right question-mark button.
145
+ identityEndpoint: '/api/support/assertion' // Optional trusted website session.
146
+ });
147
+ const detachSupportLinks = support.attach('[data-open-support]');
148
+ // The bubble and your own links use the same public entry point:
149
+ document.querySelector('#help-menu')?.addEventListener('click', () => {
150
+ void support.open();
151
+ });
152
+ // On component unmount or website customer change:
153
+ // detachSupportLinks(); support.destroy();
154
+ ```
155
+
156
+ `createSupport` adds no launcher unless `launcher` is enabled. Use
157
+ `launcher: { imageUrl: 'https://example.com/support.png', label: 'Open support' }`
158
+ for a custom image. It makes no API request until first opened. Repeated `open()`
159
+ calls resume the same panel, question and unsent message. `open({issue})` can
160
+ prefill a new question; `close()` minimizes, while `destroy()` removes owned UI,
161
+ bindings, files and in-memory credentials. `getState()` and `onStateChange`
162
+ report visibility, stage and loading. Desktop keeps the host page usable;
163
+ phones use the SDK's accessible modal.
164
+ On phones, browser Back minimizes support and Forward resumes the saved screen;
165
+ host navigation stays under the website's control.
166
+ An explicit close can leave an inactive same-URL history entry. The SDK reuses
167
+ it when possible and never calls browser Back to remove it or risk a host route.
168
+
169
+ The widget searches the same published index as the desk's knowledge base,
170
+ locally; the visitor's question is not uploaded for search. Articles open inside
171
+ the widget, with a link to the canonical page. Explicit helpful feedback or
172
+ contact intent records content-free assistance analytics; closing records no
173
+ invented outcome. Search outages and protected articles are separate states,
174
+ with contact still available subject to its own access policy. Republish older
175
+ KB releases once to generate their in-widget reader documents; the canonical
176
+ help-center link remains available.
177
+
178
+ Contact reuses the ticket form's draft, attachment and uncertain-send handling.
179
+ The subject and message are editable. A verified website session appears without
180
+ another login. Anonymous visitors provide first name, last name and email, then
181
+ confirm their address through the native auth.SV Identity window before the
182
+ request is sent. “Not you?” changes only the support account; it preserves idle,
183
+ unsent subject/message text, drops the previous account's draft/files and
184
+ suppresses website sign-in until “Use website account” is chosen. This does not
185
+ sign the visitor out of the host website. Destroy/recreate the widget when the
186
+ host's actual customer changes.
187
+
188
+ Knowledge-base access and ticket-portal access remain independent. Passwords,
189
+ approved networks and employee membership are enforced by the API, including
190
+ when both are protected. KB/ticket access grants stay in memory. Register the
191
+ exact embedding origin in the desk's website settings before installation;
192
+ never put signing keys, operator tokens or raw identity assertions in markup.
193
+ For a site with CSP, allow the API in `connect-src` and `blob:` in `img-src`
194
+ for authorized in-widget images, alongside the SDK's normal style policy.
195
+ The optional `onSuccess` and `onError` callbacks behave like the direct form.
196
+
197
+ The existing direct-ticket APIs remain available:
198
+
139
199
  Use an existing support button with the SDK's modal and callback handling:
140
200
 
141
201
  ```typescript
@@ -178,6 +238,13 @@ codes, sending a new code, using a different email), a missing display name,
178
238
  submitting once, and retrying the same draft after an uncertain response.
179
239
  `onSuccess` runs only after the service confirms a ticket number; the form then
180
240
  shows the request number and a link to the request's page in the hosted portal.
241
+ Help Desk > Settings > General can also set a submission confirmation message,
242
+ such as the team's expected response time. The SDK form and hosted portal show
243
+ this plain text only after submission is confirmed, alongside the request
244
+ number, request link and actual email-update instructions. The optional public
245
+ desk field is `ticket_confirmation_message` (up to 1,000 characters); null or
246
+ omission uses the default. Administrators can clear the setting with null, an
247
+ empty string or whitespace. HTML and template interpolation are not applied.
181
248
  `onStateChange` observes `authenticating`, `editing`, `verifying`, `submitting`, `uncertain`, `success` and
182
249
  `destroyed`; `reset()` clears an idle/completed form. Observer callback errors
183
250
  do not turn an accepted ticket into a retry. The file picker appears when the
@@ -265,7 +332,11 @@ and `openClientForm(client, options)` reuse that client. Same server-verified
265
332
  requester renewal preserves work; account change/logout cancels old state.
266
333
  Explicit guest policy can allow email codes for a null anonymous answer;
267
334
  authentication errors never downgrade to a guest. This creates a desk-local
268
- requester/session without a second login, consent or auth.SV account.
335
+ requester/session without a second login, consent or auth.SV account. Even a
336
+ verified host email stays contact metadata: host proofs never claim native
337
+ ticket history or create/link a global SVID. The support widget's optional
338
+ auth.SV account switch opens a separate native requester and leaves the website
339
+ signed in; only “Use website account” resumes the host provider.
269
340
 
270
341
  A host can also supply an existing server-issued desk session through
271
342
  `getSessionToken` or `onAuthRequired`; never construct a session from browser