@ixblix/sdk-js 0.2.1 → 0.2.3
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 +58 -0
- package/dist/client.d.ts +47 -4
- package/dist/client.js +68 -3
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +38 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,6 +53,14 @@ const { conversation, deeplink } = await ixblix.createConversation({
|
|
|
53
53
|
},
|
|
54
54
|
channel: "whatsapp",
|
|
55
55
|
operatorPublicKey: operatorKey.publicKeySpki,
|
|
56
|
+
// Optionally attach the operator's identity so the customer's client can
|
|
57
|
+
// display who is handling the conversation (avatar, name, gravatar).
|
|
58
|
+
operator: {
|
|
59
|
+
uuid: "agent-42",
|
|
60
|
+
name: "Maria Silva",
|
|
61
|
+
image: "https://cdn.example.com/avatars/maria.png",
|
|
62
|
+
// or gravatarHash: md5("maria@example.com")
|
|
63
|
+
},
|
|
56
64
|
});
|
|
57
65
|
|
|
58
66
|
// 4. Share `deeplink` with the contact. When they open it, their browser
|
|
@@ -86,6 +94,56 @@ for (const message of messages) {
|
|
|
86
94
|
}
|
|
87
95
|
```
|
|
88
96
|
|
|
97
|
+
## Operator identity
|
|
98
|
+
|
|
99
|
+
You can attach the identity of the desk/CRM agent (operator) handling a
|
|
100
|
+
conversation so the customer's client can display who is talking to them. The
|
|
101
|
+
operator is described by a stable `uuid`, a display `name`, and either an
|
|
102
|
+
`image` URL or a `gravatarHash` (MD5 of the operator's email).
|
|
103
|
+
|
|
104
|
+
Attach the operator when creating the conversation:
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
const { conversation } = await ixblix.createConversation({
|
|
108
|
+
contact: { externalId: "whatsapp_5511999999999", name: "John Doe" },
|
|
109
|
+
channel: "whatsapp",
|
|
110
|
+
operatorPublicKey: operatorKey.publicKeySpki,
|
|
111
|
+
operator: {
|
|
112
|
+
uuid: "agent-42",
|
|
113
|
+
name: "Maria Silva",
|
|
114
|
+
gravatarHash: "5d41402abc4b2a76b9719d911017c592",
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Update the operator at any moment during the conversation. Only the provided
|
|
120
|
+
fields are updated; omitted fields keep their current value. Pass `null` to
|
|
121
|
+
clear a field:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
await ixblix.updateOperator(conversation.id, {
|
|
125
|
+
name: "Maria S. (Supervisor)",
|
|
126
|
+
image: "https://cdn.example.com/avatars/maria-v2.png",
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Every company-sent message is attributed to the conversation's operator. You
|
|
131
|
+
can also pass the operator uuid explicitly when sending a message or media so
|
|
132
|
+
the message is attributed to a specific agent:
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
await ixblix.sendCompanyMessage(
|
|
136
|
+
conversation.id,
|
|
137
|
+
envelope,
|
|
138
|
+
"text",
|
|
139
|
+
"agent-42", // operator uuid
|
|
140
|
+
);
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The returned `Message` objects include an `operatorUuid` field on
|
|
144
|
+
company-sent messages, and the conversation payloads include the full
|
|
145
|
+
`operator` object so the customer's client can render the avatar.
|
|
146
|
+
|
|
89
147
|
## Company onboarding
|
|
90
148
|
|
|
91
149
|
Register a company (keyless), then activate it after payment to obtain the API
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActivateCompanyResult, CompanyBalance, CompanyCustomization, CompanyCustomizationInput, ContactInput, ConversationKeys, CreateConversationResult, CreditPurchase, Media, Message, MessageEnvelope, OriginalChannelMessageInput, PaymentProvidersResult, Plan, PurchaseCreditsResult, RegisterCompanyInput, RegisterCompanyResult } from "./types.js";
|
|
1
|
+
import type { ActivateCompanyResult, CompanyBalance, CompanyCustomization, CompanyCustomizationInput, CompanyProfile, ContactInput, ConversationKeys, CreateConversationResult, CreditPurchase, Media, Message, MessageEnvelope, OperatorInput, OriginalChannelMessageInput, PaymentProvidersResult, Plan, PurchaseCreditsResult, RegisterCompanyInput, RegisterCompanyResult, UpdateOperatorResult } from "./types.js";
|
|
2
2
|
/** Options for constructing an {@link IxblixClient}. */
|
|
3
3
|
export interface IxblixClientOptions {
|
|
4
4
|
/** Base URL of the ixblix API, e.g. `https://api.ixblix.app`. */
|
|
@@ -15,6 +15,13 @@ export interface MediaUpload {
|
|
|
15
15
|
fileName: string;
|
|
16
16
|
mimeType: string;
|
|
17
17
|
}
|
|
18
|
+
/** A company branding asset (logo/icon) to upload. */
|
|
19
|
+
export interface BrandingFile {
|
|
20
|
+
/** Raw file bytes (e.g. an SVG document). */
|
|
21
|
+
data: Uint8Array;
|
|
22
|
+
fileName: string;
|
|
23
|
+
mimeType: string;
|
|
24
|
+
}
|
|
18
25
|
/** A media file downloaded from ixblix, still encrypted. */
|
|
19
26
|
export interface MediaDownload {
|
|
20
27
|
/** Encrypted (ciphertext) bytes as stored by ixblix. */
|
|
@@ -51,6 +58,11 @@ export declare class IxblixClient {
|
|
|
51
58
|
listPlans(): Promise<Plan[]>;
|
|
52
59
|
/** List available payment providers. */
|
|
53
60
|
listPaymentProviders(): Promise<PaymentProvidersResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Fetch the authenticated company's profile, including its white-label
|
|
63
|
+
* customization (brand name, logo URLs, primary color, welcome message).
|
|
64
|
+
*/
|
|
65
|
+
getProfile(): Promise<CompanyProfile>;
|
|
54
66
|
/** Fetch the authenticated company's balance and plan state. */
|
|
55
67
|
getBalance(): Promise<CompanyBalance>;
|
|
56
68
|
/** Purchase prepaid credits for the authenticated company. */
|
|
@@ -81,15 +93,44 @@ export declare class IxblixClient {
|
|
|
81
93
|
* updated customization record.
|
|
82
94
|
*/
|
|
83
95
|
updateCustomization(input: CompanyCustomizationInput): Promise<CompanyCustomization>;
|
|
96
|
+
/**
|
|
97
|
+
* Upload company branding assets (a square icon and/or a rectangular logo,
|
|
98
|
+
* typically SVG) as multipart/form-data. Each file is stored in the public
|
|
99
|
+
* branding bucket and the corresponding customization URL is updated.
|
|
100
|
+
* Returns the updated customization record.
|
|
101
|
+
*
|
|
102
|
+
* @param assets Map of asset name -> file. Supported keys: `squareIcon` and
|
|
103
|
+
* `rectangularLogo`. At least one must be provided.
|
|
104
|
+
*/
|
|
105
|
+
uploadBranding(assets: {
|
|
106
|
+
squareIcon?: BrandingFile;
|
|
107
|
+
rectangularLogo?: BrandingFile;
|
|
108
|
+
}): Promise<CompanyCustomization>;
|
|
84
109
|
/**
|
|
85
110
|
* Create an overflow conversation for a contact. Supply the operator's RSA
|
|
86
111
|
* public key (base64 SPKI DER) so the customer can encrypt messages to it.
|
|
112
|
+
* Optionally attach the operator's identity (uuid, name, image and/or
|
|
113
|
+
* gravatar hash) so the customer's client can display who is handling the
|
|
114
|
+
* conversation.
|
|
87
115
|
*/
|
|
88
116
|
createConversation(input: {
|
|
89
117
|
contact: ContactInput;
|
|
90
118
|
channel: string;
|
|
91
119
|
operatorPublicKey: string;
|
|
120
|
+
operator?: {
|
|
121
|
+
uuid?: string;
|
|
122
|
+
name?: string;
|
|
123
|
+
image?: string;
|
|
124
|
+
gravatarHash?: string;
|
|
125
|
+
};
|
|
92
126
|
}): Promise<CreateConversationResult>;
|
|
127
|
+
/**
|
|
128
|
+
* Update the operator identity (uuid, name, image and/or gravatar hash)
|
|
129
|
+
* attached to a conversation. Only the provided fields are updated; omitted
|
|
130
|
+
* fields keep their current value. Pass `null` to clear a field. The
|
|
131
|
+
* operator can be updated at any moment during the conversation.
|
|
132
|
+
*/
|
|
133
|
+
updateOperator(conversationId: string, operator: OperatorInput): Promise<UpdateOperatorResult>;
|
|
93
134
|
/**
|
|
94
135
|
* Fetch the current E2EE key state of a conversation so the operator can
|
|
95
136
|
* detect when the customer has joined (`keyStatus === "ACTIVE"`).
|
|
@@ -98,8 +139,9 @@ export declare class IxblixClient {
|
|
|
98
139
|
/**
|
|
99
140
|
* Send an encrypted message from the company to the contact. The message must
|
|
100
141
|
* already be encrypted to the customer's public key (see the crypto helpers).
|
|
142
|
+
* Optionally pass the operator uuid so it is attributed to the message.
|
|
101
143
|
*/
|
|
102
|
-
sendCompanyMessage(conversationId: string, envelope: MessageEnvelope, contentType?: string): Promise<Message>;
|
|
144
|
+
sendCompanyMessage(conversationId: string, envelope: MessageEnvelope, contentType?: string, operatorUuid?: string): Promise<Message>;
|
|
103
145
|
/** List all messages of a conversation (content is always ciphertext). */
|
|
104
146
|
listMessages(conversationId: string): Promise<Message[]>;
|
|
105
147
|
/**
|
|
@@ -125,9 +167,10 @@ export declare class IxblixClient {
|
|
|
125
167
|
relayOriginalChannelMessage(input: OriginalChannelMessageInput): Promise<Message>;
|
|
126
168
|
/**
|
|
127
169
|
* Upload an encrypted media file from the company. `file.data` must be the
|
|
128
|
-
* ciphertext bytes produced by the media encryption helper.
|
|
170
|
+
* ciphertext bytes produced by the media encryption helper. Optionally pass
|
|
171
|
+
* the operator uuid so the media message is attributed to the operator.
|
|
129
172
|
*/
|
|
130
|
-
sendCompanyMedia(conversationId: string, file: MediaUpload, envelope: MessageEnvelope): Promise<Message>;
|
|
173
|
+
sendCompanyMedia(conversationId: string, file: MediaUpload, envelope: MessageEnvelope, operatorUuid?: string): Promise<Message>;
|
|
131
174
|
/** Fetch the metadata (envelope + file info) of a media file. */
|
|
132
175
|
getMedia(mediaId: string): Promise<Media>;
|
|
133
176
|
/**
|
package/dist/client.js
CHANGED
|
@@ -86,6 +86,13 @@ export class IxblixClient {
|
|
|
86
86
|
listPaymentProviders() {
|
|
87
87
|
return this.request("/api/payment/providers");
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Fetch the authenticated company's profile, including its white-label
|
|
91
|
+
* customization (brand name, logo URLs, primary color, welcome message).
|
|
92
|
+
*/
|
|
93
|
+
getProfile() {
|
|
94
|
+
return this.request("/api/companies/profile");
|
|
95
|
+
}
|
|
89
96
|
/** Fetch the authenticated company's balance and plan state. */
|
|
90
97
|
getBalance() {
|
|
91
98
|
return this.request("/api/companies/balance");
|
|
@@ -124,12 +131,52 @@ export class IxblixClient {
|
|
|
124
131
|
body: JSON.stringify(input),
|
|
125
132
|
});
|
|
126
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Upload company branding assets (a square icon and/or a rectangular logo,
|
|
136
|
+
* typically SVG) as multipart/form-data. Each file is stored in the public
|
|
137
|
+
* branding bucket and the corresponding customization URL is updated.
|
|
138
|
+
* Returns the updated customization record.
|
|
139
|
+
*
|
|
140
|
+
* @param assets Map of asset name -> file. Supported keys: `squareIcon` and
|
|
141
|
+
* `rectangularLogo`. At least one must be provided.
|
|
142
|
+
*/
|
|
143
|
+
async uploadBranding(assets) {
|
|
144
|
+
const form = new FormData();
|
|
145
|
+
if (assets.squareIcon) {
|
|
146
|
+
form.append("squareIcon", new Blob([assets.squareIcon.data], {
|
|
147
|
+
type: assets.squareIcon.mimeType,
|
|
148
|
+
}), assets.squareIcon.fileName);
|
|
149
|
+
}
|
|
150
|
+
if (assets.rectangularLogo) {
|
|
151
|
+
form.append("rectangularLogo", new Blob([assets.rectangularLogo.data], {
|
|
152
|
+
type: assets.rectangularLogo.mimeType,
|
|
153
|
+
}), assets.rectangularLogo.fileName);
|
|
154
|
+
}
|
|
155
|
+
const headers = {};
|
|
156
|
+
if (this.apiKey) {
|
|
157
|
+
headers["X-API-Key"] = this.apiKey;
|
|
158
|
+
}
|
|
159
|
+
const response = await this.fetchImpl(`${this.baseUrl}/api/companies/branding`, { method: "POST", headers, body: form });
|
|
160
|
+
const data = (await response.json());
|
|
161
|
+
if (!response.ok) {
|
|
162
|
+
const body = data;
|
|
163
|
+
throw new IxblixError(body?.error ?? "ixblix branding upload failed", {
|
|
164
|
+
status: response.status,
|
|
165
|
+
code: body?.code,
|
|
166
|
+
details: body?.errors,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return data;
|
|
170
|
+
}
|
|
127
171
|
// ---------------------------------------------------------------------------
|
|
128
172
|
// Conversations
|
|
129
173
|
// ---------------------------------------------------------------------------
|
|
130
174
|
/**
|
|
131
175
|
* Create an overflow conversation for a contact. Supply the operator's RSA
|
|
132
176
|
* public key (base64 SPKI DER) so the customer can encrypt messages to it.
|
|
177
|
+
* Optionally attach the operator's identity (uuid, name, image and/or
|
|
178
|
+
* gravatar hash) so the customer's client can display who is handling the
|
|
179
|
+
* conversation.
|
|
133
180
|
*/
|
|
134
181
|
createConversation(input) {
|
|
135
182
|
return this.request("/api/conversations", {
|
|
@@ -137,6 +184,18 @@ export class IxblixClient {
|
|
|
137
184
|
body: JSON.stringify(input),
|
|
138
185
|
});
|
|
139
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Update the operator identity (uuid, name, image and/or gravatar hash)
|
|
189
|
+
* attached to a conversation. Only the provided fields are updated; omitted
|
|
190
|
+
* fields keep their current value. Pass `null` to clear a field. The
|
|
191
|
+
* operator can be updated at any moment during the conversation.
|
|
192
|
+
*/
|
|
193
|
+
updateOperator(conversationId, operator) {
|
|
194
|
+
return this.request(`/api/conversations/${conversationId}/operator`, {
|
|
195
|
+
method: "PUT",
|
|
196
|
+
body: JSON.stringify({ operator }),
|
|
197
|
+
});
|
|
198
|
+
}
|
|
140
199
|
/**
|
|
141
200
|
* Fetch the current E2EE key state of a conversation so the operator can
|
|
142
201
|
* detect when the customer has joined (`keyStatus === "ACTIVE"`).
|
|
@@ -150,8 +209,9 @@ export class IxblixClient {
|
|
|
150
209
|
/**
|
|
151
210
|
* Send an encrypted message from the company to the contact. The message must
|
|
152
211
|
* already be encrypted to the customer's public key (see the crypto helpers).
|
|
212
|
+
* Optionally pass the operator uuid so it is attributed to the message.
|
|
153
213
|
*/
|
|
154
|
-
sendCompanyMessage(conversationId, envelope, contentType = "text") {
|
|
214
|
+
sendCompanyMessage(conversationId, envelope, contentType = "text", operatorUuid) {
|
|
155
215
|
return this.request("/api/messages/company", {
|
|
156
216
|
method: "POST",
|
|
157
217
|
body: JSON.stringify({
|
|
@@ -163,6 +223,7 @@ export class IxblixClient {
|
|
|
163
223
|
encryptedKey: envelope.encryptedKey,
|
|
164
224
|
selfEncryptedKey: envelope.selfEncryptedKey,
|
|
165
225
|
keyId: envelope.keyId,
|
|
226
|
+
operatorUuid,
|
|
166
227
|
}),
|
|
167
228
|
});
|
|
168
229
|
}
|
|
@@ -206,9 +267,10 @@ export class IxblixClient {
|
|
|
206
267
|
// ---------------------------------------------------------------------------
|
|
207
268
|
/**
|
|
208
269
|
* Upload an encrypted media file from the company. `file.data` must be the
|
|
209
|
-
* ciphertext bytes produced by the media encryption helper.
|
|
270
|
+
* ciphertext bytes produced by the media encryption helper. Optionally pass
|
|
271
|
+
* the operator uuid so the media message is attributed to the operator.
|
|
210
272
|
*/
|
|
211
|
-
async sendCompanyMedia(conversationId, file, envelope) {
|
|
273
|
+
async sendCompanyMedia(conversationId, file, envelope, operatorUuid) {
|
|
212
274
|
const form = new FormData();
|
|
213
275
|
form.append("conversationId", conversationId);
|
|
214
276
|
form.append("file", new Blob([file.data], { type: file.mimeType }), file.fileName);
|
|
@@ -217,6 +279,9 @@ export class IxblixClient {
|
|
|
217
279
|
form.append("encryptedKey", envelope.encryptedKey);
|
|
218
280
|
form.append("selfEncryptedKey", envelope.selfEncryptedKey);
|
|
219
281
|
form.append("keyId", envelope.keyId);
|
|
282
|
+
if (operatorUuid) {
|
|
283
|
+
form.append("operatorUuid", operatorUuid);
|
|
284
|
+
}
|
|
220
285
|
const headers = {};
|
|
221
286
|
if (this.apiKey) {
|
|
222
287
|
headers["X-API-Key"] = this.apiKey;
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,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AAM,OAAO,GAA2B,EAAE,CAAC;QAC3C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACrC,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CACnC,GAAG,IAAI,CAAC,OAAO,cAAc,OAAO,UAAU,EAC9C,EAAE,OAAO,EAAE,CACZ,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,WAAW,CACnB,4CAA4C,QAAQ,CAAC,MAAM,EAAE,EAC7D;gBACE,MAAM,EAAE,QAAQ,CAAC,MAAM;aACxB,CACF,CAAC;QACJ,CAAC;QACD,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;QACjD,OAAO,EAAE,IAAI,EAAE,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC;IACtD,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
export { IxblixClient } from "./client.js";
|
|
17
|
-
export type { IxblixClientOptions, MediaUpload, MediaDownload, } from "./client.js";
|
|
17
|
+
export type { IxblixClientOptions, MediaUpload, MediaDownload, BrandingFile, } from "./client.js";
|
|
18
18
|
export { IxblixError } from "./errors.js";
|
|
19
19
|
export { generateOperatorKeyPair, importPublicKey, encryptToRecipient, decryptEnvelope, encryptMediaToRecipient, decryptMediaEnvelope, } from "./crypto.js";
|
|
20
20
|
export type { OperatorKeyPair, GenerateKeyPairOptions } from "./crypto.js";
|
|
@@ -22,4 +22,4 @@ export { loadOrCreateOperatorKey } from "./keypair.js";
|
|
|
22
22
|
export { parseWebhook, verifyWebhook } from "./webhooks.js";
|
|
23
23
|
export type { ParsedWebhook } from "./webhooks.js";
|
|
24
24
|
export { WEBHOOK_SIGNATURE_HEADER, WEBHOOK_ID_HEADER, WEBHOOK_EVENT_HEADER, } from "./webhooks.js";
|
|
25
|
-
export type { SenderType, ConversationKeyStatus, ConversationStatus, ConsentStatus, Contact, ContactInput, Conversation, CompanyCustomization, CompanyCustomizationInput, CompanySummary, CreateConversationResult, ConversationKeys, RegisterCustomerKeyResult, EraseConversationResult, MessageEnvelope, Message, Media, Plan, RegisterCompanyInput, PaymentInstructions, RegisterCompanyResult, ActivateCompanyResult, CompanyBalance, CreditPurchase, PurchaseCreditsResult, PaymentProvidersResult, OriginalChannelMessageInput, WebhookEvent, CompanyActivatedEvent, MessageReceivedEvent, MessageReadEvent, CustomerJoinedEvent, ConversationClosedEvent, PresenceEvent, BalanceLowEvent, IxblixErrorBody, } from "./types.js";
|
|
25
|
+
export type { SenderType, ConversationKeyStatus, ConversationStatus, ConsentStatus, Contact, ContactInput, Conversation, CompanyCustomization, CompanyCustomizationInput, CompanySummary, CompanyProfile, CreateConversationResult, ConversationKeys, RegisterCustomerKeyResult, EraseConversationResult, Operator, OperatorInput, UpdateOperatorResult, MessageEnvelope, Message, Media, Plan, RegisterCompanyInput, PaymentInstructions, RegisterCompanyResult, ActivateCompanyResult, CompanyBalance, CreditPurchase, PurchaseCreditsResult, PaymentProvidersResult, OriginalChannelMessageInput, WebhookEvent, CompanyActivatedEvent, MessageReceivedEvent, MessageReadEvent, CustomerJoinedEvent, ConversationClosedEvent, PresenceEvent, BalanceLowEvent, IxblixErrorBody, } from "./types.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,eAAe,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -64,12 +64,43 @@ export interface CompanyCustomizationInput {
|
|
|
64
64
|
websiteUrl?: string;
|
|
65
65
|
welcomeMessage?: string;
|
|
66
66
|
}
|
|
67
|
+
/** The authenticated company's profile, including its customization. */
|
|
68
|
+
export interface CompanyProfile {
|
|
69
|
+
id: string;
|
|
70
|
+
name: string;
|
|
71
|
+
slug: string;
|
|
72
|
+
status: string;
|
|
73
|
+
websiteUrl?: string | null;
|
|
74
|
+
customizations?: CompanyCustomization | null;
|
|
75
|
+
}
|
|
67
76
|
/** Company summary returned when creating a conversation. */
|
|
68
77
|
export interface CompanySummary {
|
|
69
78
|
id: string;
|
|
70
79
|
name: string;
|
|
71
80
|
customizations?: CompanyCustomization;
|
|
72
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Identity of the desk/CRM agent (operator) handling a conversation. The
|
|
84
|
+
* operator can be attached when the conversation is created and updated at any
|
|
85
|
+
* time via the company API.
|
|
86
|
+
*/
|
|
87
|
+
export interface Operator {
|
|
88
|
+
/** Stable identifier of the operator in the desk/CRM. */
|
|
89
|
+
uuid?: string;
|
|
90
|
+
/** Display name of the operator. */
|
|
91
|
+
name?: string;
|
|
92
|
+
/** URL of the operator's avatar image. */
|
|
93
|
+
image?: string;
|
|
94
|
+
/** MD5 hash of the operator's email, used to build a Gravatar URL. */
|
|
95
|
+
gravatarHash?: string;
|
|
96
|
+
}
|
|
97
|
+
/** Payload used to attach/update an operator on a conversation. */
|
|
98
|
+
export interface OperatorInput {
|
|
99
|
+
uuid?: string | null;
|
|
100
|
+
name?: string | null;
|
|
101
|
+
image?: string | null;
|
|
102
|
+
gravatarHash?: string | null;
|
|
103
|
+
}
|
|
73
104
|
/** Result of creating a conversation. */
|
|
74
105
|
export interface CreateConversationResult {
|
|
75
106
|
conversation: Conversation;
|
|
@@ -77,6 +108,11 @@ export interface CreateConversationResult {
|
|
|
77
108
|
/** URL to share with the contact so they can join the secure chat. */
|
|
78
109
|
deeplink: string;
|
|
79
110
|
company: CompanySummary;
|
|
111
|
+
operator?: Operator;
|
|
112
|
+
}
|
|
113
|
+
/** Result of updating a conversation's operator. */
|
|
114
|
+
export interface UpdateOperatorResult {
|
|
115
|
+
operator: Operator;
|
|
80
116
|
}
|
|
81
117
|
/** Current E2EE key state of a conversation (operator view). */
|
|
82
118
|
export interface ConversationKeys {
|
|
@@ -137,6 +173,8 @@ export interface Message {
|
|
|
137
173
|
/** Present when the message carries an attached media file. */
|
|
138
174
|
mediaId?: string;
|
|
139
175
|
media?: Media;
|
|
176
|
+
/** Identifier of the operator that sent this message (COMPANY-sent only). */
|
|
177
|
+
operatorUuid?: string;
|
|
140
178
|
sentAt: string;
|
|
141
179
|
}
|
|
142
180
|
/** Metadata of a media file attached to a message. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixblix/sdk-js",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Official ixblix SDK for desk/CRM integrations. Create overflow conversations, exchange end-to-end encrypted messages and media, and manage company onboarding.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|