@sparkvault/sdk-js 15.11.4 → 15.11.5
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 +6 -1
- package/dist/index.cjs +40 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.mjs +40 -6
- package/dist/index.mjs.map +1 -1
- package/dist/products/help-desk/client.d.ts +3 -1
- package/dist/products/help-desk/types.d.ts +11 -0
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -465,7 +465,12 @@ const requests = await desk.listTickets({ status: 'open' });
|
|
|
465
465
|
```
|
|
466
466
|
|
|
467
467
|
`getMe`, `updateMe`, `getTicket`, `listEvents`, `replyToTicket`, `resolveTicket`,
|
|
468
|
-
`muteTicket` and attachment methods expose the existing customer routes.
|
|
468
|
+
`muteTicket` and attachment methods expose the existing customer routes. Name
|
|
469
|
+
each composed reply once with `newReplyId()` and pass it as `eventId` on every
|
|
470
|
+
send of that reply while its words and files stand unchanged, whatever an
|
|
471
|
+
earlier send answered (a lost response, a refusal): a reply an earlier send
|
|
472
|
+
posted is answered with that reply instead of being posted again. Name a
|
|
473
|
+
changed reply anew.
|
|
469
474
|
`sendAttachment(forgeUrl, file, { signal, onProgress, onSessionCreated })` and
|
|
470
475
|
`resumeAttachment({ sessionUrl }, file, { signal, onProgress })` use the same
|
|
471
476
|
direct Forge transfer as `ingots.sendUpload`, without Core or customer credentials.
|
package/dist/index.cjs
CHANGED
|
@@ -13098,9 +13098,14 @@ Array.from({ length: 1 << BRAND_BITS.size }, (_, mask) =>
|
|
|
13098
13098
|
* histogram's bucket edges live here for the same reason. So do the one rule a tag is stored by
|
|
13099
13099
|
* (ticketTag), which Core applies where it stores a tag and the console
|
|
13100
13100
|
* applies where one is typed, and the one rule a typed or pasted sign-in
|
|
13101
|
-
* code is read by (helpDeskPinDigits), which every sign-in form applies.
|
|
13101
|
+
* code is read by (helpDeskPinDigits), which every sign-in form applies. So
|
|
13102
|
+
* does the one way a client names a message it sends (newMessageId), which
|
|
13103
|
+
* the portal, the SDK and the console's composer each send their messages
|
|
13104
|
+
* under, and the one rule that a message sent again is the same message
|
|
13105
|
+
* (sameMessage), which keeps its name.
|
|
13102
13106
|
*
|
|
13103
|
-
* BROWSER-SAFE: data and pure functions
|
|
13107
|
+
* BROWSER-SAFE: data and pure functions, and newMessageId's count of the ids
|
|
13108
|
+
* its page named; its imports are the platform's label
|
|
13104
13109
|
* rule a tag is built on (./display-text.js), the mail products whose fixed
|
|
13105
13110
|
* From local parts no team alias may take (./mail-products.js) and the brand
|
|
13106
13111
|
* rule no team alias may read as (./organization-name.js).
|
|
@@ -13211,6 +13216,30 @@ function helpDeskCountdown(seconds) {
|
|
|
13211
13216
|
return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, '0')}`;
|
|
13212
13217
|
}
|
|
13213
13218
|
|
|
13219
|
+
/** How many message ids this page has named (newMessageId). */
|
|
13220
|
+
let messagesNamed = 0;
|
|
13221
|
+
|
|
13222
|
+
/**
|
|
13223
|
+
* A new id for a message its client sends: a customer's reply from the
|
|
13224
|
+
* portal or the SDK (`event_id`), a trainee's reply held for review
|
|
13225
|
+
* (`review_id`). The client names a message once and sends every retry of it
|
|
13226
|
+
* under the same id, so a send whose answer was lost and is made again is
|
|
13227
|
+
* answered with what the first send wrote instead of writing it twice.
|
|
13228
|
+
*
|
|
13229
|
+
* Counted, never drawn (docs/CONVENTIONS.md → Randomness: it only has to
|
|
13230
|
+
* differ): the page's time origin, the time it is named and the page's count
|
|
13231
|
+
* of the ids it named, so no two of one author's messages share one. The
|
|
13232
|
+
* server keeps a ticket's ids apart: one another record of the ticket holds
|
|
13233
|
+
* is refused.
|
|
13234
|
+
*
|
|
13235
|
+
* @returns {string} An id of a message event (`@sparkvault/app-sdk/ids` `ticketEvent`)
|
|
13236
|
+
*/
|
|
13237
|
+
function newMessageId() {
|
|
13238
|
+
messagesNamed += 1;
|
|
13239
|
+
const origin = Math.round((globalThis.performance?.timeOrigin ?? 0) * 1000);
|
|
13240
|
+
return `hdev_m${origin.toString(36)}-${Date.now().toString(36)}-${messagesNamed.toString(36)}`;
|
|
13241
|
+
}
|
|
13242
|
+
|
|
13214
13243
|
/**
|
|
13215
13244
|
* Why a customer's file is refused by the desk's upload allowance per
|
|
13216
13245
|
* customer (`customer_upload_limit_bytes`), as the 402 QUOTA_EXCEEDED that
|
|
@@ -16323,7 +16352,7 @@ function hostname(value) {
|
|
|
16323
16352
|
}
|
|
16324
16353
|
function resource(kind, value, field) {
|
|
16325
16354
|
if (!isResourceIdOf(kind, value))
|
|
16326
|
-
throw new ValidationError(`${field} must be a help desk ${kind} ID`, { field });
|
|
16355
|
+
throw new ValidationError(`${field} must be a help desk ${kind === 'ticketEvent' ? 'message' : kind} ID`, { field });
|
|
16327
16356
|
return value;
|
|
16328
16357
|
}
|
|
16329
16358
|
function requestNumber(value) {
|
|
@@ -16795,9 +16824,14 @@ class HelpDeskClient {
|
|
|
16795
16824
|
listEvents(number, cursor) {
|
|
16796
16825
|
return this.send('GET', apiPath `/v1/hd/desks/${this.desk.desk_id}/tickets/${requestNumber(number)}/events`, undefined, { cursor });
|
|
16797
16826
|
}
|
|
16798
|
-
/**
|
|
16827
|
+
/** A new id for one composed reply, sent as `HelpDeskReplyOptions.eventId` with every send of it while it stands unchanged. */
|
|
16828
|
+
newReplyId() { return newMessageId(); }
|
|
16829
|
+
/** A reply sent under an `eventId` an earlier send of it posted answers that reply, posting nothing again. */
|
|
16799
16830
|
replyToTicket(number, options, context) {
|
|
16800
|
-
|
|
16831
|
+
const eventId = options.eventId === undefined ? undefined : resource('ticketEvent', options.eventId, 'eventId');
|
|
16832
|
+
return this.send('POST', apiPath `/v1/hd/desks/${this.desk.desk_id}/tickets/${requestNumber(number)}/replies`, {
|
|
16833
|
+
body: options.body, attachments: options.attachments ?? [], ...(eventId && { event_id: eventId }),
|
|
16834
|
+
}, undefined, true, context);
|
|
16801
16835
|
}
|
|
16802
16836
|
resolveTicket(number, context) { return this.send('POST', apiPath `/v1/hd/desks/${this.desk.desk_id}/tickets/${requestNumber(number)}/resolve`, undefined, undefined, true, context); }
|
|
16803
16837
|
muteTicket(number, muted, context) { return this.send('PUT', apiPath `/v1/hd/desks/${this.desk.desk_id}/tickets/${requestNumber(number)}/mute`, { muted }, undefined, true, context); }
|
|
@@ -26139,7 +26173,7 @@ class SparkVault {
|
|
|
26139
26173
|
}
|
|
26140
26174
|
/** Get the SDK version */
|
|
26141
26175
|
static get version() {
|
|
26142
|
-
return '15.11.
|
|
26176
|
+
return '15.11.5';
|
|
26143
26177
|
}
|
|
26144
26178
|
}
|
|
26145
26179
|
if (typeof window !== 'undefined') {
|