@aiqa/sdk 2.5.0 → 3.0.0-develop.2

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 CHANGED
@@ -29,6 +29,8 @@ A TypeScript/JavaScript SDK for interacting with the AIQA WebSocket service. Thi
29
29
  - [UpdateConversationInput](#updateconversationinput)
30
30
  - [UpdateConversationResult](#updateconversationresult)
31
31
  - [ConversationWarning](#conversationwarning)
32
+ - [UpsertAdvisorInput](#upsertadvisorinput)
33
+ - [UpsertAdvisorResult](#upsertadvisorresult)
32
34
  - [Examples](#examples)
33
35
  - [Error Handling](#error-handling)
34
36
  - [Version Requirements](#version-requirements)
@@ -129,8 +131,6 @@ going so far.
129
131
  client_name: string;
130
132
  client_phone_number: string;
131
133
  agent_id: string;
132
- agent_first_name: string;
133
- agent_last_name: string;
134
134
  external_status?: string;
135
135
  verification?: ApplicationVerificationSummary;
136
136
  }
@@ -138,11 +138,11 @@ going so far.
138
138
 
139
139
  Wait for the `authenticated` event before calling it: until authentication
140
140
  has completed, and whenever the connection is down, it **rejects**.
141
- `client_name`, `client_phone_number` and `agent_id` normally carry any change
142
- you made with `updateConversation()` earlier in the call — see
141
+ `agent_id` is the advisor's AIQA user id, the value `updateConversation()`
142
+ returns as `conversation.advisor_id`. `client_name`,
143
+ `client_phone_number` and `agent_id` normally carry any change you made with
144
+ `updateConversation()` earlier in the call — see
143
145
  [Reading `verification`](#reading-verification) for the exception.
144
- `agent_first_name` and `agent_last_name` come back empty; use
145
- `updateConversation({ agentName })` if you need to record an agent's name.
146
146
  `external_status` is the value you last sent with
147
147
  `updateConversation({ externalStatus })`, lowercased — one of
148
148
  [`ExternalStatus`](#externalstatus) — and is **missing** until you send one.
@@ -228,50 +228,48 @@ change.
228
228
 
229
229
  - `input: UpdateConversationInput` - partial set of conversation fields to update
230
230
 
231
- | field | type | max | notes |
232
- | --------------------------- | ---------- | -------- | ----------------------------------------------------------------------- |
233
- | `policyNumber` | `string` | 128 | |
234
- | `insuredPhone` | `string` | 32 | the insured, who may differ from the caller |
235
- | `clientName` | `string` | 128 | |
236
- | `clientPhone` | `string` | 32 | |
237
- | `clientEmail` | `string` | 254 | must be a valid email address |
238
- | `clientId` | `string` | 64 | your own CRM identifier |
239
- | `agentId` | `string` | 64 | the agent's AIQA user id; used instead of `agentEmail` if both are sent |
240
- | `agentEmail` | `string` | 254 | valid email; alternative to `agentId` |
241
- | `agentName` | `string` | 128 | |
242
- | `advisorId` / `advisorName` | `string` | 64/128 | |
243
- | `agentGroups` | `string[]` | 32 × 128 | entries cannot contain a comma |
244
- | `externalStatus` | `string` | — | see [`ExternalStatus`](#externalstatus) |
231
+ | field | type | max | notes |
232
+ | ---------------- | ---------- | -------- | --------------------------------------------------------------------------------------------------------------- |
233
+ | `policyNumber` | `string` | 128 | |
234
+ | `insuredPhone` | `string` | 32 | the insured, who may differ from the caller |
235
+ | `clientName` | `string` | 128 | |
236
+ | `clientPhone` | `string` | 32 | |
237
+ | `clientEmail` | `string` | 254 | must be a valid email address |
238
+ | `clientId` | `string` | 64 | your own CRM identifier |
239
+ | `advisorId` | `string` | 64 | the advisor's AIQA user id; used instead of `advisorEmail` if both are sent; a longer id goes in `advisorEmail` |
240
+ | `advisorEmail` | `string` | 254 | email of the advisor's AIQA user; AIQA links the call to that user |
241
+ | `agentGroups` | `string[]` | 32 × 128 | entries cannot contain a comma |
242
+ | `externalStatus` | `string` | — | see [`ExternalStatus`](#externalstatus) |
245
243
 
246
244
  Every string (including each `agentGroups` entry) must be non-empty;
247
245
  surrounding whitespace is trimmed first, so a value of only spaces is
248
246
  rejected. `null` is rejected — omit the field instead. At least one field is
249
247
  required, and any field not in the table is rejected.
250
248
 
251
- **Agent identification**
249
+ **Advisor identification**
252
250
 
253
- | sent | conversation's agent | `conversation.agent_id` | `warnings` |
254
- | ------------------------------------- | -------------------- | --------------------------------------------------------------------------------------------- | -------------------------- |
255
- | `agentId` | set to `agentId` | `agentId` | — |
256
- | `agentId` + `agentEmail` | set to `agentId` | `agentId` (`agentEmail` is ignored) | — |
257
- | `agentEmail`, a user matches | set to that user | the user's AIQA user id: their email in lowercase (compare it to what you sent ignoring case) | — |
258
- | `agentEmail`, no user matches | unchanged | absent | `agent_not_found` |
259
- | `agentEmail`, temporarily not checked | unchanged | absent | `agent_lookup_unavailable` |
260
- - `conversation` never contains `agentEmail`.
251
+ | sent | conversation's advisor | `conversation.advisor_id` | `warnings` |
252
+ | --------------------------------------- | ---------------------- | --------------------------------------------------------------------------------------------- | ---------------------------- |
253
+ | `advisorId` | set to `advisorId` | `advisorId` | — |
254
+ | `advisorId` + `advisorEmail` | set to `advisorId` | `advisorId` (`advisorEmail` is ignored) | — |
255
+ | `advisorEmail`, a user matches | set to that user | the user's AIQA user id: their email in lowercase (compare it to what you sent ignoring case) | — |
256
+ | `advisorEmail`, no user matches | unchanged | absent | `advisor_not_found` |
257
+ | `advisorEmail`, temporarily not checked | unchanged | absent | `advisor_lookup_unavailable` |
258
+ - The result never includes the email you sent; a matched user comes back as their id in `advisor_id`.
261
259
  - With a warning, `success` is `true` and every other field you sent is saved.
262
- - After `agent_lookup_unavailable`, call `updateConversation({ agentEmail })` again later. You do not need to resend the other fields.
260
+ - After `advisor_lookup_unavailable`, call `updateConversation({ advisorEmail })` again later. You do not need to resend the other fields.
263
261
 
264
262
  **Returns:**
265
263
 
266
264
  - `Promise<UpdateConversationResult>`
267
- - `conversation`: only the fields you sent; a matched `agentEmail` comes back as `agent_id`.
265
+ - `conversation`: only the fields you sent; a matched `advisorEmail` comes back as `advisor_id`.
268
266
  - `warnings`: present only when part of the update was not applied.
269
267
 
270
268
  ```typescript
271
269
  const result = await sdk.updateConversation({
272
270
  policyNumber: "POL-123",
273
271
  clientEmail: "jane@example.com",
274
- agentEmail: "vio.agent@example.com",
272
+ advisorEmail: "advisor@example.com",
275
273
  externalStatus: ExternalStatus.COMPLETED,
276
274
  });
277
275
  console.log(result.success, result.conversation.policy_number);
@@ -285,6 +283,40 @@ for (const warning of result.warnings ?? []) {
285
283
  User-provided application status: `draft`, `pending`, `completed`, `expired`,
286
284
  `closed`.
287
285
 
286
+ #### `upsertAdvisor()`
287
+
288
+ Creates an advisor in your organization, or updates the name of an existing
289
+ advisor with the same email. Use the returned `advisor_id` with
290
+ `updateConversation({ advisorId })`.
291
+
292
+ **Parameters:**
293
+
294
+ - `input: UpsertAdvisorInput` - `advisorEmail`, `firstName` and `lastName`, all required
295
+
296
+ **Returns:**
297
+
298
+ - `Promise<UpsertAdvisorResult>`
299
+
300
+ | your organization has | result |
301
+ | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
302
+ | no user with that email | the advisor is created; `created: true` |
303
+ | an advisor with that email | its first and last name are updated; `created: false` |
304
+ | a user with that email who is not an advisor, such as an administrator | the user is not changed and keeps its own first and last name, which can differ from what you sent; `created: false`. You can still pass its `advisor_id` to `updateConversation({ advisorId })` |
305
+
306
+ - `advisor_id` is the email in lowercase.
307
+ - The Promise rejects when the advisor cannot be saved: invalid input (for
308
+ example, a malformed email), or, rarely, a different user in your
309
+ organization who already signs in with that email.
310
+
311
+ ```typescript
312
+ const result = await sdk.upsertAdvisor({
313
+ advisorEmail: "advisor@example.com",
314
+ firstName: "Jane",
315
+ lastName: "Doe",
316
+ });
317
+ await sdk.updateConversation({ advisorId: result.advisor.advisor_id });
318
+ ```
319
+
288
320
  ### Fact Management
289
321
 
290
322
  #### `addFact(fact)`
@@ -524,7 +556,7 @@ on the `FACT_VERIFIED` broadcast event before the Promise resolves:
524
556
 
525
557
  ```
526
558
  processing
527
- └─> awaiting_question (agent hasn't asked yet)
559
+ └─> awaiting_question (advisor hasn't asked yet)
528
560
  └─> awaiting_answer (asked, customer hasn't answered yet)
529
561
  └─> partial (partial evidence — e.g. "305" of "30521")
530
562
  └─> pending_confirmation_matched
@@ -563,9 +595,7 @@ type Application = {
563
595
  application_id: string;
564
596
  client_name: string;
565
597
  client_phone_number: string;
566
- agent_id: string;
567
- agent_first_name: string; // comes back empty
568
- agent_last_name: string; // comes back empty
598
+ agent_id: string; // the advisor's AIQA user id (conversation.advisor_id)
569
599
  // The externalStatus you last sent, lowercased. Missing until you send one
570
600
  // — not the same as "draft". Never in the authentication snapshot, so on the
571
601
  // fallback path below it is absent, not stale.
@@ -606,7 +636,7 @@ type ApplicationVerificationSummary = {
606
636
  count_pending: number;
607
637
 
608
638
  // Facts flagged as suspicious when the call is reviewed — for instance the
609
- // agent leading the customer to the expected answer. Independent of the
639
+ // advisor leading the customer to the expected answer. Independent of the
610
640
  // answer: a matched fact can be flagged. Reads 0 while the call is running.
611
641
  count_suspicious: number;
612
642
  };
@@ -663,7 +693,7 @@ interface AddFactResult {
663
693
  question_asked?: boolean;
664
694
 
665
695
  /**
666
- * How closely the agent's utterance matched the expected question, on a
696
+ * How closely the advisor's utterance matched the expected question, on a
667
697
  * 0–1 or a 0–100 scale. Higher is closer.
668
698
  */
669
699
  question_match_score?: number;
@@ -842,11 +872,8 @@ type UpdateConversationInput = {
842
872
  clientPhone?: string;
843
873
  clientEmail?: string;
844
874
  clientId?: string;
845
- agentId?: string; // or agentEmail
846
- agentEmail?: string; // or agentId
847
- agentName?: string;
848
- advisorId?: string;
849
- advisorName?: string;
875
+ advisorId?: string; // or advisorEmail
876
+ advisorEmail?: string; // or advisorId
850
877
  agentGroups?: string[];
851
878
  externalStatus?: ExternalStatus | (string & {});
852
879
  };
@@ -856,7 +883,7 @@ type UpdateConversationInput = {
856
883
 
857
884
  Returned by `updateConversation()`.
858
885
 
859
- - `conversation`: only the fields you sent; a matched `agentEmail` comes back as `agent_id`.
886
+ - `conversation`: only the fields you sent; a matched `advisorEmail` comes back as `advisor_id`.
860
887
  - `warnings`: present only when part of the update was not applied.
861
888
 
862
889
  ```typescript
@@ -869,10 +896,7 @@ type UpdateConversationResult = {
869
896
  client_phone?: string;
870
897
  client_email?: string;
871
898
  client_id?: string;
872
- agent_id?: string;
873
- agent_name?: string;
874
899
  advisor_id?: string;
875
- advisor_name?: string;
876
900
  agent_groups?: string[];
877
901
  external_status?: string;
878
902
  };
@@ -890,20 +914,48 @@ interface ConversationWarning {
890
914
  }
891
915
 
892
916
  type ConversationWarningCode =
893
- | "agent_not_found"
894
- | "agent_lookup_unavailable"
917
+ | "advisor_not_found"
918
+ | "advisor_lookup_unavailable"
895
919
  | (string & {});
896
920
  ```
897
921
 
898
- | `code` | meaning | conversation's agent | what to do |
899
- | -------------------------- | --------------------------------------------------------------- | -------------------- | ------------------------------------------------ |
900
- | `agent_not_found` | no AIQA user in your organization has the `agentEmail` | unchanged | check the email |
901
- | `agent_lookup_unavailable` | the `agentEmail` could not be checked at the moment (temporary) | unchanged | retry `updateConversation({ agentEmail })` later |
902
- | any other | added in a later version | — | log `message` and continue |
922
+ | `code` | meaning | conversation's advisor | what to do |
923
+ | ---------------------------- | ----------------------------------------------------------------- | ---------------------- | ------------------------------------------------------------------------------- |
924
+ | `advisor_not_found` | no AIQA user in your organization has the `advisorEmail` | unchanged | check the email, or create the advisor with [`upsertAdvisor()`](#upsertadvisor) |
925
+ | `advisor_lookup_unavailable` | the `advisorEmail` could not be checked at the moment (temporary) | unchanged | retry `updateConversation({ advisorEmail })` later |
926
+ | any other | added in a later version | — | log `message` and continue |
903
927
 
904
928
  - Use `code` to choose what to do; do not parse `message`. `message` is human-readable, includes the email you sent, and may change.
905
929
  - `success` is `true` and every other field you sent is saved.
906
930
 
931
+ ### UpsertAdvisorInput
932
+
933
+ Accepted by `upsertAdvisor()`.
934
+
935
+ ```typescript
936
+ type UpsertAdvisorInput = {
937
+ advisorEmail: string;
938
+ firstName: string;
939
+ lastName: string;
940
+ };
941
+ ```
942
+
943
+ ### UpsertAdvisorResult
944
+
945
+ Returned by `upsertAdvisor()`.
946
+
947
+ ```typescript
948
+ type UpsertAdvisorResult = {
949
+ success: boolean; // always true when the Promise resolves
950
+ advisor: {
951
+ advisor_id: string; // pass it to updateConversation({ advisorId })
952
+ first_name: string | null; // null only for an existing non-advisor user with no name stored
953
+ last_name: string | null; // same as first_name
954
+ created: boolean; // true when created; false when a user in your organization already had this email
955
+ };
956
+ };
957
+ ```
958
+
907
959
  ## Examples
908
960
 
909
961
  ### Complete Example: Recording Session
@@ -42,7 +42,7 @@ type ApplicationVerificationSummary = {
42
42
  count_pending: number;
43
43
  /**
44
44
  * Facts flagged as suspicious when the call is reviewed — for instance the
45
- * agent leading the customer to the expected answer. Independent of the
45
+ * advisor leading the customer to the expected answer. Independent of the
46
46
  * answer: a matched fact can be flagged. Reads 0 while the call is running.
47
47
  */
48
48
  count_suspicious: number;
@@ -51,11 +51,8 @@ type Application = {
51
51
  application_id: string;
52
52
  client_name: string;
53
53
  client_phone_number: string;
54
+ /** The advisor's AIQA user id; `updateConversation()` returns it as `conversation.advisor_id`. */
54
55
  agent_id: string;
55
- /** Comes back empty. Set an agent name with `updateConversation()`. */
56
- agent_first_name: string;
57
- /** Comes back empty. Set an agent name with `updateConversation()`. */
58
- agent_last_name: string;
59
56
  /**
60
57
  * The status you last reported with `updateConversation({ externalStatus })`,
61
58
  * folded to lowercase by the server. Missing when you never reported one —
@@ -85,7 +82,8 @@ declare enum Methods {
85
82
  FLAG_FACT = "FLAG_FACT",
86
83
  SET_CONVERSATION_PRODUCT = "SET_CONVERSATION_PRODUCT",
87
84
  SET_CONVERSATION_LANGUAGE = "SET_CONVERSATION_LANGUAGE",
88
- UPDATE_CONVERSATION = "UPDATE_CONVERSATION"
85
+ UPDATE_CONVERSATION = "UPDATE_CONVERSATION",
86
+ UPSERT_ADVISOR = "UPSERT_ADVISOR"
89
87
  }
90
88
  type SetConversationProductResult = {
91
89
  success: boolean;
@@ -110,18 +108,15 @@ type UpdateConversationInput = {
110
108
  clientPhone?: string;
111
109
  clientEmail?: string;
112
110
  clientId?: string;
113
- /** The agent's AIQA user id. Takes precedence over `agentEmail`. */
114
- agentId?: string;
115
- /** Email of the agent's AIQA user. Results: README, Agent identification. */
116
- agentEmail?: string;
117
- agentName?: string;
111
+ /** The advisor's AIQA user id. Takes precedence over `advisorEmail`. */
118
112
  advisorId?: string;
119
- advisorName?: string;
113
+ /** Email of the advisor's AIQA user. Results: README, Advisor identification. */
114
+ advisorEmail?: string;
120
115
  agentGroups?: string[];
121
116
  externalStatus?: ExternalStatus | (string & {});
122
117
  };
123
118
  /** Decide with `code`, not `message`. Codes: README, ConversationWarning. */
124
- type ConversationWarningCode = "agent_not_found" | "agent_lookup_unavailable" | (string & {});
119
+ type ConversationWarningCode = "advisor_not_found" | "advisor_lookup_unavailable" | (string & {});
125
120
  /** Part of an `updateConversation()` that was not applied; the rest was saved. */
126
121
  interface ConversationWarning {
127
122
  code: ConversationWarningCode;
@@ -137,15 +132,34 @@ type UpdateConversationResult = {
137
132
  client_phone?: string;
138
133
  client_email?: string;
139
134
  client_id?: string;
140
- agent_id?: string;
141
- agent_name?: string;
142
135
  advisor_id?: string;
143
- advisor_name?: string;
144
136
  agent_groups?: string[];
145
137
  external_status?: string;
146
138
  };
147
139
  warnings?: ConversationWarning[];
148
140
  };
141
+ /** The advisor to create or update with `upsertAdvisor()`. */
142
+ type UpsertAdvisorInput = {
143
+ /** Email of the advisor. Identifies the advisor in your organization. */
144
+ advisorEmail: string;
145
+ firstName: string;
146
+ lastName: string;
147
+ };
148
+ /** Returned by `upsertAdvisor()`. */
149
+ type UpsertAdvisorResult = {
150
+ /** Always `true` when the Promise resolves. */
151
+ success: boolean;
152
+ advisor: {
153
+ /** Pass it to `updateConversation({ advisorId })`. The email in lowercase. */
154
+ advisor_id: string;
155
+ /** The first name stored for this user. `null` only when the email belongs to an existing user who is not an advisor and has no name stored. */
156
+ first_name: string | null;
157
+ /** The last name stored for this user. `null` in the same case as `first_name`. */
158
+ last_name: string | null;
159
+ /** `true` when the advisor was created. `false` when a user in your organization already had this email: an advisor is updated, any other user is left unchanged. */
160
+ created: boolean;
161
+ };
162
+ };
149
163
  declare enum ConversationLanguage {
150
164
  EN = "en",
151
165
  ES = "es",
@@ -211,7 +225,7 @@ type QuestionStatus = "searching" | "asked" | "not_asked";
211
225
  * `processing`.
212
226
  *
213
227
  * - `processing` queued, or nothing to go on yet
214
- * - `awaiting_question` the agent hasn't asked the question yet
228
+ * - `awaiting_question` the advisor hasn't asked the question yet
215
229
  * - `awaiting_answer` asked, the customer hasn't answered yet
216
230
  * - `partial` partial evidence so far (e.g. "305" of "30521")
217
231
  * - `pending_confirmation_matched` a matching answer is held briefly in case
@@ -256,7 +270,7 @@ interface AddFactResult {
256
270
  is_valid_answer: boolean;
257
271
  question_asked?: boolean;
258
272
  /**
259
- * How closely the agent's utterance matched the expected question, on a 0–1
273
+ * How closely the advisor's utterance matched the expected question, on a 0–1
260
274
  * or a 0–100 scale. Higher is closer.
261
275
  */
262
276
  question_match_score?: number;
@@ -360,6 +374,12 @@ declare abstract class IAiqaSdk {
360
374
  abstract setConversationProduct(product: string): Promise<SetConversationProductResult>;
361
375
  abstract setConversationLanguage(language: ConversationLanguage): Promise<SetConversationLanguageResult>;
362
376
  abstract updateConversation(input: UpdateConversationInput): Promise<UpdateConversationResult>;
377
+ /**
378
+ * Creates an advisor in your organization, or updates the name of an existing
379
+ * advisor with the same email. A user with that email who is not an advisor is
380
+ * left unchanged. Rejects on invalid input.
381
+ */
382
+ abstract upsertAdvisor(input: UpsertAdvisorInput): Promise<UpsertAdvisorResult>;
363
383
  }
364
384
 
365
385
  declare class AiQaSdk implements IAiqaSdk {
@@ -384,6 +404,7 @@ declare class AiQaSdk implements IAiqaSdk {
384
404
  setConversationProduct(product: string): Promise<SetConversationProductResult>;
385
405
  setConversationLanguage(language: ConversationLanguage): Promise<SetConversationLanguageResult>;
386
406
  updateConversation(input: UpdateConversationInput): Promise<UpdateConversationResult>;
407
+ upsertAdvisor(input: UpsertAdvisorInput): Promise<UpsertAdvisorResult>;
387
408
  authenticate(): Promise<void>;
388
409
  startRecording(): Promise<boolean>;
389
410
  stopRecording(): Promise<boolean>;
@@ -393,4 +414,4 @@ declare class AiQaSdk implements IAiqaSdk {
393
414
  private isManagerEvent;
394
415
  }
395
416
 
396
- export { type AddFactResult, AiQaSdk, type Application, type ApplicationFact, type ApplicationFactAnswerChoice, type ApplicationFactAnswerFormat, type ApplicationFactInput, type ApplicationVerificationStatus, type ApplicationVerificationSummary, ConversationLanguage, type ConversationWarning, type ConversationWarningCode, type DialogAct, type DialogActConfidence, ExternalStatus, FactAnswerFormatType, type FactVerifiedPayload, type FactWarning, type FactWarningCode, type FlagFactResult, IAiqaSdk, Methods, type QuestionStatus, type SdkError, type SdkEvent, type SetConversationLanguageResult, type SetConversationProductResult, type TranscriptionUpdate, type UpdateConversationInput, type UpdateConversationResult, type Utterance, type VerificationStatus };
417
+ export { type AddFactResult, AiQaSdk, type Application, type ApplicationFact, type ApplicationFactAnswerChoice, type ApplicationFactAnswerFormat, type ApplicationFactInput, type ApplicationVerificationStatus, type ApplicationVerificationSummary, ConversationLanguage, type ConversationWarning, type ConversationWarningCode, type DialogAct, type DialogActConfidence, ExternalStatus, FactAnswerFormatType, type FactVerifiedPayload, type FactWarning, type FactWarningCode, type FlagFactResult, IAiqaSdk, Methods, type QuestionStatus, type SdkError, type SdkEvent, type SetConversationLanguageResult, type SetConversationProductResult, type TranscriptionUpdate, type UpdateConversationInput, type UpdateConversationResult, type UpsertAdvisorInput, type UpsertAdvisorResult, type Utterance, type VerificationStatus };
@@ -3350,6 +3350,7 @@ var Methods = /* @__PURE__ */ ((Methods2) => {
3350
3350
  Methods2["SET_CONVERSATION_PRODUCT"] = "SET_CONVERSATION_PRODUCT";
3351
3351
  Methods2["SET_CONVERSATION_LANGUAGE"] = "SET_CONVERSATION_LANGUAGE";
3352
3352
  Methods2["UPDATE_CONVERSATION"] = "UPDATE_CONVERSATION";
3353
+ Methods2["UPSERT_ADVISOR"] = "UPSERT_ADVISOR";
3353
3354
  return Methods2;
3354
3355
  })(Methods || {});
3355
3356
  var ExternalStatus = /* @__PURE__ */ ((ExternalStatus2) => {
@@ -3406,7 +3407,7 @@ var compareVersions = (left, right) => {
3406
3407
  // package.json
3407
3408
  var package_default = {
3408
3409
  name: "@aiqa/sdk",
3409
- version: "2.5.0-develop.1",
3410
+ version: "3.0.0-develop.1",
3410
3411
  main: "dist/node/node.js",
3411
3412
  module: "dist/node/node.js",
3412
3413
  types: "dist/node/node.d.ts",
@@ -3770,7 +3771,26 @@ var AiQaSdk = class {
3770
3771
  return result && result.data !== void 0 ? result.data : result;
3771
3772
  }
3772
3773
  async updateConversation(input) {
3773
- const result = await this.sendMessage("UPDATE_CONVERSATION" /* UPDATE_CONVERSATION */, input);
3774
+ const { advisorId, advisorEmail, ...fields } = input;
3775
+ const result = await this.sendMessage("UPDATE_CONVERSATION" /* UPDATE_CONVERSATION */, {
3776
+ ...fields,
3777
+ agentId: advisorId,
3778
+ agentEmail: advisorEmail
3779
+ });
3780
+ const data = result && result.data !== void 0 ? result.data : result;
3781
+ if (!data?.conversation || !("agent_id" in data.conversation)) {
3782
+ return data;
3783
+ }
3784
+ const { agent_id, ...conversation } = data.conversation;
3785
+ return { ...data, conversation: { ...conversation, advisor_id: agent_id } };
3786
+ }
3787
+ async upsertAdvisor(input) {
3788
+ const { advisorEmail, firstName, lastName } = input;
3789
+ const result = await this.sendMessage("UPSERT_ADVISOR" /* UPSERT_ADVISOR */, {
3790
+ email: advisorEmail,
3791
+ firstName,
3792
+ lastName
3793
+ });
3774
3794
  return result && result.data !== void 0 ? result.data : result;
3775
3795
  }
3776
3796
  async authenticate() {