@arbidocs/sdk 0.5.94 → 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
package/dist/index.cjs
CHANGED
|
@@ -5202,7 +5202,9 @@ __export(support_exports, {
|
|
|
5202
5202
|
createSupportTicket: () => createSupportTicket,
|
|
5203
5203
|
getSupportTicket: () => getSupportTicket,
|
|
5204
5204
|
listSupportTickets: () => listSupportTickets,
|
|
5205
|
-
rateSupportTicket: () => rateSupportTicket
|
|
5205
|
+
rateSupportTicket: () => rateSupportTicket,
|
|
5206
|
+
supportTicketReference: () => supportTicketReference,
|
|
5207
|
+
withSupportNotificationReference: () => withSupportNotificationReference
|
|
5206
5208
|
});
|
|
5207
5209
|
|
|
5208
5210
|
// src/operations/mail-encoding.ts
|
|
@@ -5254,6 +5256,32 @@ async function rateSupportTicket(arbi, ticketId, rating) {
|
|
|
5254
5256
|
"Could not send your rating."
|
|
5255
5257
|
);
|
|
5256
5258
|
}
|
|
5259
|
+
function supportTicketReference(deploymentDomain, ticketId) {
|
|
5260
|
+
if (!Number.isSafeInteger(ticketId) || ticketId < 1)
|
|
5261
|
+
throw new ArbiError("Invalid support ticket id.");
|
|
5262
|
+
const domain = deploymentDomain.trim().toLowerCase();
|
|
5263
|
+
if (!/^[a-z0-9][a-z0-9.-]*$/.test(domain) || domain.includes("..")) return `#${ticketId}`;
|
|
5264
|
+
return `${domain.split(".")[0]}-${ticketId}`;
|
|
5265
|
+
}
|
|
5266
|
+
function withSupportNotificationReference(notification, domain) {
|
|
5267
|
+
if (!["support_ticket_received", "support_ticket_reviewed", "support_ticket_resolved"].includes(
|
|
5268
|
+
String(notification.type)
|
|
5269
|
+
))
|
|
5270
|
+
return notification;
|
|
5271
|
+
try {
|
|
5272
|
+
const content = JSON.parse(notification.content ?? "{}");
|
|
5273
|
+
if (!Number.isSafeInteger(content.ticket_id) || content.ticket_id < 1) return notification;
|
|
5274
|
+
return {
|
|
5275
|
+
...notification,
|
|
5276
|
+
content: JSON.stringify({
|
|
5277
|
+
...content,
|
|
5278
|
+
ticket_reference: supportTicketReference(domain, content.ticket_id)
|
|
5279
|
+
})
|
|
5280
|
+
};
|
|
5281
|
+
} catch {
|
|
5282
|
+
return notification;
|
|
5283
|
+
}
|
|
5284
|
+
}
|
|
5257
5285
|
|
|
5258
5286
|
// src/diagnostics.ts
|
|
5259
5287
|
async function diagnoseSetup(options) {
|
|
@@ -13026,7 +13054,9 @@ var Arbi = class {
|
|
|
13026
13054
|
params: { query: { ...type ? { type } : {}, limit, ...offset ? { offset } : {} } }
|
|
13027
13055
|
});
|
|
13028
13056
|
if (error) throw new ArbiError("Could not load notifications");
|
|
13029
|
-
return data || []
|
|
13057
|
+
return (data || []).map(
|
|
13058
|
+
(notification) => withSupportNotificationReference(notification, this.getDeploymentDomain())
|
|
13059
|
+
);
|
|
13030
13060
|
},
|
|
13031
13061
|
markRead: async (ids) => {
|
|
13032
13062
|
if (!ids.length) return;
|
|
@@ -14083,12 +14113,24 @@ var Arbi = class {
|
|
|
14083
14113
|
};
|
|
14084
14114
|
// ── Health ────────────────────────────────────────────────────────────
|
|
14085
14115
|
support = {
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14116
|
+
reference: (ticketId) => supportTicketReference(this.getDeploymentDomain(), ticketId),
|
|
14117
|
+
list: () => this.recovering(() => listSupportTickets(this.requireClient())).then(
|
|
14118
|
+
(tickets) => tickets.map((ticket) => ({
|
|
14119
|
+
...ticket,
|
|
14120
|
+
reference: this.support.reference(ticket.ticket_id)
|
|
14121
|
+
}))
|
|
14122
|
+
),
|
|
14123
|
+
get: (ticketId) => this.recovering(() => getSupportTicket(this.requireClient(), ticketId)).then(
|
|
14124
|
+
(ticket) => ({ ...ticket, reference: this.support.reference(ticket.ticket_id) })
|
|
14125
|
+
),
|
|
14126
|
+
rate: (ticketId, rating) => this.recovering(
|
|
14127
|
+
() => rateSupportTicket(this.requireClient(), ticketId, rating)
|
|
14128
|
+
).then((ticket) => ({ ...ticket, reference: this.support.reference(ticket.ticket_id) })),
|
|
14089
14129
|
create: (input) => {
|
|
14090
14130
|
const request = { ...input, idempotencyKey: input.idempotencyKey ?? crypto.randomUUID() };
|
|
14091
|
-
return this.recovering(
|
|
14131
|
+
return this.recovering(
|
|
14132
|
+
() => createSupportTicket(this.requireClient(), request)
|
|
14133
|
+
).then((receipt) => ({ ...receipt, reference: this.support.reference(receipt.ticket_id) }));
|
|
14092
14134
|
}
|
|
14093
14135
|
};
|
|
14094
14136
|
health = {
|