@arbidocs/sdk 0.5.93 → 0.5.95
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/{browser-4oIgAqs1.d.cts → browser-BvaBTk7i.d.cts} +15 -2
- package/dist/{browser-CL-6Y6E1.d.ts → browser-CpYezzb5.d.ts} +15 -2
- package/dist/browser.cjs +48 -6
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +48 -6
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +48 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +48 -6
- package/dist/index.js.map +1 -1
- package/examples/human-review/package.json +1 -1
- package/examples/react-chat/package.json +2 -2
- package/package.json +2 -2
|
@@ -997,6 +997,13 @@ type SupportRating = _arbidocs_client.components['schemas']['SupportRating'];
|
|
|
997
997
|
declare function listSupportTickets(arbi: ArbiClient): Promise<SupportTicket[]>;
|
|
998
998
|
declare function getSupportTicket(arbi: ArbiClient, ticketId: number): Promise<SupportTicket>;
|
|
999
999
|
declare function rateSupportTicket(arbi: ArbiClient, ticketId: number, rating: SupportRating): Promise<SupportTicket>;
|
|
1000
|
+
/** Human-facing reference; routing and idempotency continue to use the numeric id. */
|
|
1001
|
+
declare function supportTicketReference(deploymentDomain: string, ticketId: number): string;
|
|
1002
|
+
/** Upgrade legacy notification metadata using this SDK client's deployment identity. */
|
|
1003
|
+
declare function withSupportNotificationReference<T extends {
|
|
1004
|
+
type: unknown;
|
|
1005
|
+
content?: string | null;
|
|
1006
|
+
}>(notification: T, domain: string): T;
|
|
1000
1007
|
|
|
1001
1008
|
type support_SupportRating = SupportRating;
|
|
1002
1009
|
type support_SupportTicket = SupportTicket;
|
|
@@ -1005,8 +1012,10 @@ declare const support_createSupportTicket: typeof createSupportTicket;
|
|
|
1005
1012
|
declare const support_getSupportTicket: typeof getSupportTicket;
|
|
1006
1013
|
declare const support_listSupportTickets: typeof listSupportTickets;
|
|
1007
1014
|
declare const support_rateSupportTicket: typeof rateSupportTicket;
|
|
1015
|
+
declare const support_supportTicketReference: typeof supportTicketReference;
|
|
1016
|
+
declare const support_withSupportNotificationReference: typeof withSupportNotificationReference;
|
|
1008
1017
|
declare namespace support {
|
|
1009
|
-
export { type support_SupportRating as SupportRating, type support_SupportTicket as SupportTicket, type support_SupportTicketInput as SupportTicketInput, support_createSupportTicket as createSupportTicket, support_getSupportTicket as getSupportTicket, support_listSupportTickets as listSupportTickets, support_rateSupportTicket as rateSupportTicket };
|
|
1018
|
+
export { type support_SupportRating as SupportRating, type support_SupportTicket as SupportTicket, type support_SupportTicketInput as SupportTicketInput, support_createSupportTicket as createSupportTicket, support_getSupportTicket as getSupportTicket, support_listSupportTickets as listSupportTickets, support_rateSupportTicket as rateSupportTicket, support_supportTicketReference as supportTicketReference, support_withSupportNotificationReference as withSupportNotificationReference };
|
|
1010
1019
|
}
|
|
1011
1020
|
|
|
1012
1021
|
/**
|
|
@@ -15211,7 +15220,9 @@ declare class Arbi {
|
|
|
15211
15220
|
}>;
|
|
15212
15221
|
};
|
|
15213
15222
|
readonly support: {
|
|
15223
|
+
reference: (ticketId: number) => string;
|
|
15214
15224
|
list: () => Promise<{
|
|
15225
|
+
reference: string;
|
|
15215
15226
|
ticket_id: number;
|
|
15216
15227
|
title: string;
|
|
15217
15228
|
description: string;
|
|
@@ -15222,6 +15233,7 @@ declare class Arbi {
|
|
|
15222
15233
|
rating?: components["schemas"]["SupportRating"] | null;
|
|
15223
15234
|
}[]>;
|
|
15224
15235
|
get: (ticketId: number) => Promise<{
|
|
15236
|
+
reference: string;
|
|
15225
15237
|
ticket_id: number;
|
|
15226
15238
|
title: string;
|
|
15227
15239
|
description: string;
|
|
@@ -15232,6 +15244,7 @@ declare class Arbi {
|
|
|
15232
15244
|
rating?: components["schemas"]["SupportRating"] | null;
|
|
15233
15245
|
}>;
|
|
15234
15246
|
rate: (ticketId: number, rating: SupportRating) => Promise<{
|
|
15247
|
+
reference: string;
|
|
15235
15248
|
ticket_id: number;
|
|
15236
15249
|
title: string;
|
|
15237
15250
|
description: string;
|
|
@@ -15242,8 +15255,8 @@ declare class Arbi {
|
|
|
15242
15255
|
rating?: components["schemas"]["SupportRating"] | null;
|
|
15243
15256
|
}>;
|
|
15244
15257
|
create: (input: SupportTicketInput) => Promise<{
|
|
15245
|
-
ticket_id: number;
|
|
15246
15258
|
reference: string;
|
|
15259
|
+
ticket_id: number;
|
|
15247
15260
|
}>;
|
|
15248
15261
|
};
|
|
15249
15262
|
readonly health: {
|
|
@@ -997,6 +997,13 @@ type SupportRating = _arbidocs_client.components['schemas']['SupportRating'];
|
|
|
997
997
|
declare function listSupportTickets(arbi: ArbiClient): Promise<SupportTicket[]>;
|
|
998
998
|
declare function getSupportTicket(arbi: ArbiClient, ticketId: number): Promise<SupportTicket>;
|
|
999
999
|
declare function rateSupportTicket(arbi: ArbiClient, ticketId: number, rating: SupportRating): Promise<SupportTicket>;
|
|
1000
|
+
/** Human-facing reference; routing and idempotency continue to use the numeric id. */
|
|
1001
|
+
declare function supportTicketReference(deploymentDomain: string, ticketId: number): string;
|
|
1002
|
+
/** Upgrade legacy notification metadata using this SDK client's deployment identity. */
|
|
1003
|
+
declare function withSupportNotificationReference<T extends {
|
|
1004
|
+
type: unknown;
|
|
1005
|
+
content?: string | null;
|
|
1006
|
+
}>(notification: T, domain: string): T;
|
|
1000
1007
|
|
|
1001
1008
|
type support_SupportRating = SupportRating;
|
|
1002
1009
|
type support_SupportTicket = SupportTicket;
|
|
@@ -1005,8 +1012,10 @@ declare const support_createSupportTicket: typeof createSupportTicket;
|
|
|
1005
1012
|
declare const support_getSupportTicket: typeof getSupportTicket;
|
|
1006
1013
|
declare const support_listSupportTickets: typeof listSupportTickets;
|
|
1007
1014
|
declare const support_rateSupportTicket: typeof rateSupportTicket;
|
|
1015
|
+
declare const support_supportTicketReference: typeof supportTicketReference;
|
|
1016
|
+
declare const support_withSupportNotificationReference: typeof withSupportNotificationReference;
|
|
1008
1017
|
declare namespace support {
|
|
1009
|
-
export { type support_SupportRating as SupportRating, type support_SupportTicket as SupportTicket, type support_SupportTicketInput as SupportTicketInput, support_createSupportTicket as createSupportTicket, support_getSupportTicket as getSupportTicket, support_listSupportTickets as listSupportTickets, support_rateSupportTicket as rateSupportTicket };
|
|
1018
|
+
export { type support_SupportRating as SupportRating, type support_SupportTicket as SupportTicket, type support_SupportTicketInput as SupportTicketInput, support_createSupportTicket as createSupportTicket, support_getSupportTicket as getSupportTicket, support_listSupportTickets as listSupportTickets, support_rateSupportTicket as rateSupportTicket, support_supportTicketReference as supportTicketReference, support_withSupportNotificationReference as withSupportNotificationReference };
|
|
1010
1019
|
}
|
|
1011
1020
|
|
|
1012
1021
|
/**
|
|
@@ -15211,7 +15220,9 @@ declare class Arbi {
|
|
|
15211
15220
|
}>;
|
|
15212
15221
|
};
|
|
15213
15222
|
readonly support: {
|
|
15223
|
+
reference: (ticketId: number) => string;
|
|
15214
15224
|
list: () => Promise<{
|
|
15225
|
+
reference: string;
|
|
15215
15226
|
ticket_id: number;
|
|
15216
15227
|
title: string;
|
|
15217
15228
|
description: string;
|
|
@@ -15222,6 +15233,7 @@ declare class Arbi {
|
|
|
15222
15233
|
rating?: components["schemas"]["SupportRating"] | null;
|
|
15223
15234
|
}[]>;
|
|
15224
15235
|
get: (ticketId: number) => Promise<{
|
|
15236
|
+
reference: string;
|
|
15225
15237
|
ticket_id: number;
|
|
15226
15238
|
title: string;
|
|
15227
15239
|
description: string;
|
|
@@ -15232,6 +15244,7 @@ declare class Arbi {
|
|
|
15232
15244
|
rating?: components["schemas"]["SupportRating"] | null;
|
|
15233
15245
|
}>;
|
|
15234
15246
|
rate: (ticketId: number, rating: SupportRating) => Promise<{
|
|
15247
|
+
reference: string;
|
|
15235
15248
|
ticket_id: number;
|
|
15236
15249
|
title: string;
|
|
15237
15250
|
description: string;
|
|
@@ -15242,8 +15255,8 @@ declare class Arbi {
|
|
|
15242
15255
|
rating?: components["schemas"]["SupportRating"] | null;
|
|
15243
15256
|
}>;
|
|
15244
15257
|
create: (input: SupportTicketInput) => Promise<{
|
|
15245
|
-
ticket_id: number;
|
|
15246
15258
|
reference: string;
|
|
15259
|
+
ticket_id: number;
|
|
15247
15260
|
}>;
|
|
15248
15261
|
};
|
|
15249
15262
|
readonly health: {
|
package/dist/browser.cjs
CHANGED
|
@@ -4660,7 +4660,9 @@ __export(support_exports, {
|
|
|
4660
4660
|
createSupportTicket: () => createSupportTicket,
|
|
4661
4661
|
getSupportTicket: () => getSupportTicket,
|
|
4662
4662
|
listSupportTickets: () => listSupportTickets,
|
|
4663
|
-
rateSupportTicket: () => rateSupportTicket
|
|
4663
|
+
rateSupportTicket: () => rateSupportTicket,
|
|
4664
|
+
supportTicketReference: () => supportTicketReference,
|
|
4665
|
+
withSupportNotificationReference: () => withSupportNotificationReference
|
|
4664
4666
|
});
|
|
4665
4667
|
|
|
4666
4668
|
// src/operations/mail-encoding.ts
|
|
@@ -4712,6 +4714,32 @@ async function rateSupportTicket(arbi, ticketId, rating) {
|
|
|
4712
4714
|
"Could not send your rating."
|
|
4713
4715
|
);
|
|
4714
4716
|
}
|
|
4717
|
+
function supportTicketReference(deploymentDomain, ticketId) {
|
|
4718
|
+
if (!Number.isSafeInteger(ticketId) || ticketId < 1)
|
|
4719
|
+
throw new ArbiError("Invalid support ticket id.");
|
|
4720
|
+
const domain = deploymentDomain.trim().toLowerCase();
|
|
4721
|
+
if (!/^[a-z0-9][a-z0-9.-]*$/.test(domain) || domain.includes("..")) return `#${ticketId}`;
|
|
4722
|
+
return `${domain.split(".")[0]}-${ticketId}`;
|
|
4723
|
+
}
|
|
4724
|
+
function withSupportNotificationReference(notification, domain) {
|
|
4725
|
+
if (!["support_ticket_received", "support_ticket_reviewed", "support_ticket_resolved"].includes(
|
|
4726
|
+
String(notification.type)
|
|
4727
|
+
))
|
|
4728
|
+
return notification;
|
|
4729
|
+
try {
|
|
4730
|
+
const content = JSON.parse(notification.content ?? "{}");
|
|
4731
|
+
if (!Number.isSafeInteger(content.ticket_id) || content.ticket_id < 1) return notification;
|
|
4732
|
+
return {
|
|
4733
|
+
...notification,
|
|
4734
|
+
content: JSON.stringify({
|
|
4735
|
+
...content,
|
|
4736
|
+
ticket_reference: supportTicketReference(domain, content.ticket_id)
|
|
4737
|
+
})
|
|
4738
|
+
};
|
|
4739
|
+
} catch {
|
|
4740
|
+
return notification;
|
|
4741
|
+
}
|
|
4742
|
+
}
|
|
4715
4743
|
|
|
4716
4744
|
// src/diagnostics.ts
|
|
4717
4745
|
async function diagnoseSetup(options) {
|
|
@@ -12440,7 +12468,9 @@ var Arbi = class {
|
|
|
12440
12468
|
params: { query: { ...type ? { type } : {}, limit, ...offset ? { offset } : {} } }
|
|
12441
12469
|
});
|
|
12442
12470
|
if (error) throw new ArbiError("Could not load notifications");
|
|
12443
|
-
return data || []
|
|
12471
|
+
return (data || []).map(
|
|
12472
|
+
(notification) => withSupportNotificationReference(notification, this.getDeploymentDomain())
|
|
12473
|
+
);
|
|
12444
12474
|
},
|
|
12445
12475
|
markRead: async (ids) => {
|
|
12446
12476
|
if (!ids.length) return;
|
|
@@ -13497,12 +13527,24 @@ var Arbi = class {
|
|
|
13497
13527
|
};
|
|
13498
13528
|
// ── Health ────────────────────────────────────────────────────────────
|
|
13499
13529
|
support = {
|
|
13500
|
-
|
|
13501
|
-
|
|
13502
|
-
|
|
13530
|
+
reference: (ticketId) => supportTicketReference(this.getDeploymentDomain(), ticketId),
|
|
13531
|
+
list: () => this.recovering(() => listSupportTickets(this.requireClient())).then(
|
|
13532
|
+
(tickets) => tickets.map((ticket) => ({
|
|
13533
|
+
...ticket,
|
|
13534
|
+
reference: this.support.reference(ticket.ticket_id)
|
|
13535
|
+
}))
|
|
13536
|
+
),
|
|
13537
|
+
get: (ticketId) => this.recovering(() => getSupportTicket(this.requireClient(), ticketId)).then(
|
|
13538
|
+
(ticket) => ({ ...ticket, reference: this.support.reference(ticket.ticket_id) })
|
|
13539
|
+
),
|
|
13540
|
+
rate: (ticketId, rating) => this.recovering(
|
|
13541
|
+
() => rateSupportTicket(this.requireClient(), ticketId, rating)
|
|
13542
|
+
).then((ticket) => ({ ...ticket, reference: this.support.reference(ticket.ticket_id) })),
|
|
13503
13543
|
create: (input) => {
|
|
13504
13544
|
const request = { ...input, idempotencyKey: input.idempotencyKey ?? crypto.randomUUID() };
|
|
13505
|
-
return this.recovering(
|
|
13545
|
+
return this.recovering(
|
|
13546
|
+
() => createSupportTicket(this.requireClient(), request)
|
|
13547
|
+
).then((receipt) => ({ ...receipt, reference: this.support.reference(receipt.ticket_id) }));
|
|
13506
13548
|
}
|
|
13507
13549
|
};
|
|
13508
13550
|
health = {
|