@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/dist/index.d.ts
CHANGED
|
@@ -3581,8 +3581,19 @@ interface HelpDeskTicketDetail extends HelpDeskTimeline {
|
|
|
3581
3581
|
ticket: HelpDeskTicket;
|
|
3582
3582
|
}
|
|
3583
3583
|
interface HelpDeskReplyOptions {
|
|
3584
|
+
/** Help desk safe markup, not HTML. */
|
|
3584
3585
|
body: string;
|
|
3585
3586
|
attachments?: string[];
|
|
3587
|
+
/**
|
|
3588
|
+
* The id the reply is sent under (`HelpDeskClient.newReplyId()`), named once
|
|
3589
|
+
* per composed reply and sent with every send of it while its words and
|
|
3590
|
+
* files stand unchanged, whatever an earlier send answered (a lost
|
|
3591
|
+
* response, a refusal): a reply an earlier send posted is answered with
|
|
3592
|
+
* that reply instead of being posted again. Name a changed reply anew.
|
|
3593
|
+
* Without one the help desk names the reply itself, so a reply sent again
|
|
3594
|
+
* posts again.
|
|
3595
|
+
*/
|
|
3596
|
+
eventId?: string;
|
|
3586
3597
|
}
|
|
3587
3598
|
interface HelpDeskReplyCreated {
|
|
3588
3599
|
event_id: string;
|
|
@@ -3755,7 +3766,9 @@ declare class HelpDeskClient {
|
|
|
3755
3766
|
response?: string;
|
|
3756
3767
|
}): Promise<HelpDeskTicketDetail>;
|
|
3757
3768
|
listEvents(number: number, cursor?: string): Promise<HelpDeskTimeline>;
|
|
3758
|
-
/**
|
|
3769
|
+
/** A new id for one composed reply, sent as `HelpDeskReplyOptions.eventId` with every send of it while it stands unchanged. */
|
|
3770
|
+
newReplyId(): string;
|
|
3771
|
+
/** A reply sent under an `eventId` an earlier send of it posted answers that reply, posting nothing again. */
|
|
3759
3772
|
replyToTicket(number: number, options: HelpDeskReplyOptions, context?: HelpDeskRequestContext): Promise<HelpDeskReplyCreated>;
|
|
3760
3773
|
resolveTicket(number: number, context?: HelpDeskRequestContext): Promise<void>;
|
|
3761
3774
|
muteTicket(number: number, muted: boolean, context?: HelpDeskRequestContext): Promise<void>;
|
package/dist/index.mjs
CHANGED
|
@@ -13094,9 +13094,14 @@ Array.from({ length: 1 << BRAND_BITS.size }, (_, mask) =>
|
|
|
13094
13094
|
* histogram's bucket edges live here for the same reason. So do the one rule a tag is stored by
|
|
13095
13095
|
* (ticketTag), which Core applies where it stores a tag and the console
|
|
13096
13096
|
* applies where one is typed, and the one rule a typed or pasted sign-in
|
|
13097
|
-
* code is read by (helpDeskPinDigits), which every sign-in form applies.
|
|
13097
|
+
* code is read by (helpDeskPinDigits), which every sign-in form applies. So
|
|
13098
|
+
* does the one way a client names a message it sends (newMessageId), which
|
|
13099
|
+
* the portal, the SDK and the console's composer each send their messages
|
|
13100
|
+
* under, and the one rule that a message sent again is the same message
|
|
13101
|
+
* (sameMessage), which keeps its name.
|
|
13098
13102
|
*
|
|
13099
|
-
* BROWSER-SAFE: data and pure functions
|
|
13103
|
+
* BROWSER-SAFE: data and pure functions, and newMessageId's count of the ids
|
|
13104
|
+
* its page named; its imports are the platform's label
|
|
13100
13105
|
* rule a tag is built on (./display-text.js), the mail products whose fixed
|
|
13101
13106
|
* From local parts no team alias may take (./mail-products.js) and the brand
|
|
13102
13107
|
* rule no team alias may read as (./organization-name.js).
|
|
@@ -13207,6 +13212,30 @@ function helpDeskCountdown(seconds) {
|
|
|
13207
13212
|
return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, '0')}`;
|
|
13208
13213
|
}
|
|
13209
13214
|
|
|
13215
|
+
/** How many message ids this page has named (newMessageId). */
|
|
13216
|
+
let messagesNamed = 0;
|
|
13217
|
+
|
|
13218
|
+
/**
|
|
13219
|
+
* A new id for a message its client sends: a customer's reply from the
|
|
13220
|
+
* portal or the SDK (`event_id`), a trainee's reply held for review
|
|
13221
|
+
* (`review_id`). The client names a message once and sends every retry of it
|
|
13222
|
+
* under the same id, so a send whose answer was lost and is made again is
|
|
13223
|
+
* answered with what the first send wrote instead of writing it twice.
|
|
13224
|
+
*
|
|
13225
|
+
* Counted, never drawn (docs/CONVENTIONS.md → Randomness: it only has to
|
|
13226
|
+
* differ): the page's time origin, the time it is named and the page's count
|
|
13227
|
+
* of the ids it named, so no two of one author's messages share one. The
|
|
13228
|
+
* server keeps a ticket's ids apart: one another record of the ticket holds
|
|
13229
|
+
* is refused.
|
|
13230
|
+
*
|
|
13231
|
+
* @returns {string} An id of a message event (`@sparkvault/app-sdk/ids` `ticketEvent`)
|
|
13232
|
+
*/
|
|
13233
|
+
function newMessageId() {
|
|
13234
|
+
messagesNamed += 1;
|
|
13235
|
+
const origin = Math.round((globalThis.performance?.timeOrigin ?? 0) * 1000);
|
|
13236
|
+
return `hdev_m${origin.toString(36)}-${Date.now().toString(36)}-${messagesNamed.toString(36)}`;
|
|
13237
|
+
}
|
|
13238
|
+
|
|
13210
13239
|
/**
|
|
13211
13240
|
* Why a customer's file is refused by the desk's upload allowance per
|
|
13212
13241
|
* customer (`customer_upload_limit_bytes`), as the 402 QUOTA_EXCEEDED that
|
|
@@ -16319,7 +16348,7 @@ function hostname(value) {
|
|
|
16319
16348
|
}
|
|
16320
16349
|
function resource(kind, value, field) {
|
|
16321
16350
|
if (!isResourceIdOf(kind, value))
|
|
16322
|
-
throw new ValidationError(`${field} must be a help desk ${kind} ID`, { field });
|
|
16351
|
+
throw new ValidationError(`${field} must be a help desk ${kind === 'ticketEvent' ? 'message' : kind} ID`, { field });
|
|
16323
16352
|
return value;
|
|
16324
16353
|
}
|
|
16325
16354
|
function requestNumber(value) {
|
|
@@ -16791,9 +16820,14 @@ class HelpDeskClient {
|
|
|
16791
16820
|
listEvents(number, cursor) {
|
|
16792
16821
|
return this.send('GET', apiPath `/v1/hd/desks/${this.desk.desk_id}/tickets/${requestNumber(number)}/events`, undefined, { cursor });
|
|
16793
16822
|
}
|
|
16794
|
-
/**
|
|
16823
|
+
/** A new id for one composed reply, sent as `HelpDeskReplyOptions.eventId` with every send of it while it stands unchanged. */
|
|
16824
|
+
newReplyId() { return newMessageId(); }
|
|
16825
|
+
/** A reply sent under an `eventId` an earlier send of it posted answers that reply, posting nothing again. */
|
|
16795
16826
|
replyToTicket(number, options, context) {
|
|
16796
|
-
|
|
16827
|
+
const eventId = options.eventId === undefined ? undefined : resource('ticketEvent', options.eventId, 'eventId');
|
|
16828
|
+
return this.send('POST', apiPath `/v1/hd/desks/${this.desk.desk_id}/tickets/${requestNumber(number)}/replies`, {
|
|
16829
|
+
body: options.body, attachments: options.attachments ?? [], ...(eventId && { event_id: eventId }),
|
|
16830
|
+
}, undefined, true, context);
|
|
16797
16831
|
}
|
|
16798
16832
|
resolveTicket(number, context) { return this.send('POST', apiPath `/v1/hd/desks/${this.desk.desk_id}/tickets/${requestNumber(number)}/resolve`, undefined, undefined, true, context); }
|
|
16799
16833
|
muteTicket(number, muted, context) { return this.send('PUT', apiPath `/v1/hd/desks/${this.desk.desk_id}/tickets/${requestNumber(number)}/mute`, { muted }, undefined, true, context); }
|
|
@@ -26135,7 +26169,7 @@ class SparkVault {
|
|
|
26135
26169
|
}
|
|
26136
26170
|
/** Get the SDK version */
|
|
26137
26171
|
static get version() {
|
|
26138
|
-
return '15.11.
|
|
26172
|
+
return '15.11.5';
|
|
26139
26173
|
}
|
|
26140
26174
|
}
|
|
26141
26175
|
if (typeof window !== 'undefined') {
|