@aikaara/chat-sdk 1.3.2 → 1.3.4

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/headless.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./MountTenant-CP_CYdl8.cjs");class s extends e.EventEmitter{registration=null;pendingEdits=[];constructor(t){super(),this.setupListeners(t)}registerForm(t){this.registration=t;const i=this.pendingEdits.filter(r=>r.entity_type===t.entityType&&String(r.entity_id)===String(t.entityId));if(i.length>0){for(const r of i)t.onFieldUpdate(r.fields),this.emit("edit:applied",{entityType:r.entity_type,entityId:r.entity_id,fields:r.fields});this.pendingEdits=this.pendingEdits.filter(r=>!(r.entity_type===t.entityType&&String(r.entity_id)===String(t.entityId)))}}unregisterForm(t,i){this.registration?.entityType===t&&String(this.registration?.entityId)===String(i)&&(this.registration=null)}get currentForm(){return this.registration}pushFieldUpdates(t,i,r){this.registration&&this.registration.entityType===t&&String(this.registration.entityId)===String(i)?(this.registration.onFieldUpdate(r),this.emit("edit:applied",{entityType:t,entityId:i,fields:r})):(this.pendingEdits.push({action:"edit_entity",entity_type:t,entity_id:i,fields:r}),this.emit("edit:pending",{entityType:t,entityId:i,fields:r}))}async requestSave(){if(!this.registration)return{success:!1,error:"No form registered"};try{return await this.registration.onSave(),this.emit("save:success",{entityType:this.registration.entityType,entityId:this.registration.entityId}),{success:!0}}catch(t){const i=t instanceof Error?t.message:"Save failed";return this.emit("save:error",{entityType:this.registration.entityType,entityId:this.registration.entityId,error:i}),{success:!1,error:i}}}async requestTest(t){if(!this.registration?.onTest)return{success:!1,error:"Current form does not support testing"};try{return await this.registration.onTest(t),{success:!0}}catch(i){return{success:!1,error:i instanceof Error?i.message:"Test failed"}}}setupListeners(t){t.on("action:edit_entity",i=>{this.pushFieldUpdates(i.entity_type,i.entity_id,i.fields)}),t.on("action:save_entity",i=>{this.requestSave()}),t.on("action:test_tool",i=>{this.emit("test:triggered",{toolId:i.tool_id,parameters:i.parameters}),this.requestTest(i.parameters)})}}exports.ActionCableClient=e.ActionCableClient;exports.AikaaraChatClient=e.AikaaraChatClient;exports.ApiClient=e.ApiClient;exports.ChannelSubscription=e.ChannelSubscription;exports.ConnectionManager=e.ConnectionManager;exports.ConversationManager=e.ConversationManager;exports.EventEmitter=e.EventEmitter;exports.MessageStore=e.MessageStore;exports.SessionAuthAdapter=e.SessionAuthAdapter;exports.SsoExchangeAdapter=e.SsoExchangeAdapter;exports.TiledeskTransport=e.TiledeskTransport;exports.TokenDiscoveryError=e.TokenDiscoveryError;exports.TokenDiscoveryReader=e.TokenDiscoveryReader;exports.clearPersistedConversationId=e.clearPersistedConversationId;exports.collectSsoCredentials=e.collectSsoCredentials;exports.createFetchUploadAdapter=e.createFetchUploadAdapter;exports.createPresigned3StepUploadAdapter=e.createPresigned3StepUploadAdapter;exports.createTiledeskHistoryAdapter=e.createTiledeskHistoryAdapter;exports.discoverToken=e.discoverToken;exports.extractTiledeskFileEnvelope=e.extractTiledeskFileEnvelope;exports.inferTiledeskRole=e.inferTiledeskRole;exports.isTiledeskSelfEcho=e.isTiledeskSelfEcho;exports.mountFromSlug=e.mountFromSlug;exports.mountTenantWidget=e.mount;exports.parseTiledeskTemplate=e.parseTiledeskTemplate;exports.FormBridge=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./MountTenant-DYhDyux6.cjs");class s extends e.EventEmitter{registration=null;pendingEdits=[];constructor(t){super(),this.setupListeners(t)}registerForm(t){this.registration=t;const i=this.pendingEdits.filter(r=>r.entity_type===t.entityType&&String(r.entity_id)===String(t.entityId));if(i.length>0){for(const r of i)t.onFieldUpdate(r.fields),this.emit("edit:applied",{entityType:r.entity_type,entityId:r.entity_id,fields:r.fields});this.pendingEdits=this.pendingEdits.filter(r=>!(r.entity_type===t.entityType&&String(r.entity_id)===String(t.entityId)))}}unregisterForm(t,i){this.registration?.entityType===t&&String(this.registration?.entityId)===String(i)&&(this.registration=null)}get currentForm(){return this.registration}pushFieldUpdates(t,i,r){this.registration&&this.registration.entityType===t&&String(this.registration.entityId)===String(i)?(this.registration.onFieldUpdate(r),this.emit("edit:applied",{entityType:t,entityId:i,fields:r})):(this.pendingEdits.push({action:"edit_entity",entity_type:t,entity_id:i,fields:r}),this.emit("edit:pending",{entityType:t,entityId:i,fields:r}))}async requestSave(){if(!this.registration)return{success:!1,error:"No form registered"};try{return await this.registration.onSave(),this.emit("save:success",{entityType:this.registration.entityType,entityId:this.registration.entityId}),{success:!0}}catch(t){const i=t instanceof Error?t.message:"Save failed";return this.emit("save:error",{entityType:this.registration.entityType,entityId:this.registration.entityId,error:i}),{success:!1,error:i}}}async requestTest(t){if(!this.registration?.onTest)return{success:!1,error:"Current form does not support testing"};try{return await this.registration.onTest(t),{success:!0}}catch(i){return{success:!1,error:i instanceof Error?i.message:"Test failed"}}}setupListeners(t){t.on("action:edit_entity",i=>{this.pushFieldUpdates(i.entity_type,i.entity_id,i.fields)}),t.on("action:save_entity",i=>{this.requestSave()}),t.on("action:test_tool",i=>{this.emit("test:triggered",{toolId:i.tool_id,parameters:i.parameters}),this.requestTest(i.parameters)})}}exports.ActionCableClient=e.ActionCableClient;exports.AikaaraChatClient=e.AikaaraChatClient;exports.ApiClient=e.ApiClient;exports.ChannelSubscription=e.ChannelSubscription;exports.ConnectionManager=e.ConnectionManager;exports.ConversationManager=e.ConversationManager;exports.EventEmitter=e.EventEmitter;exports.MessageStore=e.MessageStore;exports.SessionAuthAdapter=e.SessionAuthAdapter;exports.SsoExchangeAdapter=e.SsoExchangeAdapter;exports.TiledeskTransport=e.TiledeskTransport;exports.TokenDiscoveryError=e.TokenDiscoveryError;exports.TokenDiscoveryReader=e.TokenDiscoveryReader;exports.clearPersistedConversationId=e.clearPersistedConversationId;exports.collectSsoCredentials=e.collectSsoCredentials;exports.createFetchUploadAdapter=e.createFetchUploadAdapter;exports.createPresigned3StepUploadAdapter=e.createPresigned3StepUploadAdapter;exports.createTiledeskHistoryAdapter=e.createTiledeskHistoryAdapter;exports.discoverToken=e.discoverToken;exports.extractTiledeskFileEnvelope=e.extractTiledeskFileEnvelope;exports.inferTiledeskRole=e.inferTiledeskRole;exports.isTiledeskSelfEcho=e.isTiledeskSelfEcho;exports.mountFromSlug=e.mountFromSlug;exports.mountTenantWidget=e.mount;exports.parseTiledeskTemplate=e.parseTiledeskTemplate;exports.runMethodSelectPreflight=e.runMethodSelectPreflight;exports.FormBridge=s;
@@ -481,7 +481,7 @@ declare interface ChatEvents_2 {
481
481
  };
482
482
  }
483
483
 
484
- export declare function clearPersistedConversationId(userId: string, projectId: string): void;
484
+ export declare function clearPersistedConversationId(userId: string, projectId: string, scope?: string): void;
485
485
 
486
486
  /** Read every credential listed in `spec`. Throws on missing required. */
487
487
  export declare function collectSsoCredentials(opts: SsoCollectorOptions): Promise<Record<string, string>>;
@@ -1061,10 +1061,6 @@ export declare interface PostMsgSourceConfig {
1061
1061
  timeoutMs?: number;
1062
1062
  }
1063
1063
 
1064
- /**
1065
- * One HTTP call run by the SDK before auth. Failure of `soft: true` steps
1066
- * is logged and ignored; failure of strict steps aborts the mount.
1067
- */
1068
1064
  export declare interface PreflightStep {
1069
1065
  url: string;
1070
1066
  method?: 'GET' | 'POST' | 'PUT';
@@ -1075,6 +1071,13 @@ export declare interface PreflightStep {
1075
1071
  authHeaderTemplate?: string;
1076
1072
  /** Continue on non-2xx. Default `false` (mount abort). */
1077
1073
  soft?: boolean;
1074
+ /**
1075
+ * When this step fires. Absent / `before-chat` runs in the pre-mount
1076
+ * preflight chain as today; `on-method-select` defers it to the hosted
1077
+ * shell's method screen (so `{serviceType}`/`{userType}` resolve from the
1078
+ * user's pick). Fully backward compatible — no trigger means before-chat.
1079
+ */
1080
+ trigger?: PreflightTrigger;
1078
1081
  /**
1079
1082
  * When set, parse the response as JSON and capture the value at the
1080
1083
  * given dotted path (e.g. `data.token`). The captured value can be
@@ -1099,6 +1102,24 @@ export declare interface PreflightStep {
1099
1102
  };
1100
1103
  }
1101
1104
 
1105
+ /**
1106
+ * One HTTP call run by the SDK before auth. Failure of `soft: true` steps
1107
+ * is logged and ignored; failure of strict steps aborts the mount.
1108
+ */
1109
+ /**
1110
+ * When a preflight step fires. Shared vocabulary across the SDK, the hosted
1111
+ * shell (screen:method handler), and the dashboard editors:
1112
+ * - `before-chat` — pre-mount preflight chain, exactly as today. This is
1113
+ * also the implicit default when `trigger` is absent, so
1114
+ * every existing descriptor keeps byte-identical behaviour.
1115
+ * - `on-method-select` — deferred to the hosted shell's screen:method
1116
+ * handler, fired *after* the user picks a method so the
1117
+ * step's URL/body can interpolate `{serviceType}` and
1118
+ * `{userType}` (e.g. a leader-assignment warmup).
1119
+ * - `during-login` — reserved for the native LoginScreen chain.
1120
+ */
1121
+ export declare type PreflightTrigger = 'before-chat' | 'on-method-select' | 'during-login';
1122
+
1102
1123
  /**
1103
1124
  * Three-step presigned-S3 upload (sign → PUT → register). Driven entirely
1104
1125
  * by descriptor — no tenant-specific code in host apps.
@@ -1314,6 +1335,28 @@ export declare interface RouteDef {
1314
1335
  layout?: string;
1315
1336
  }
1316
1337
 
1338
+ /**
1339
+ * Standalone runner for the `on-method-select` slice of a descriptor's
1340
+ * preflight chain. The hosted shell's method picker (screen:method) calls
1341
+ * this *after* the user picks a method but *before* the chat mounts, so a
1342
+ * leader-assignment (or any warmup) declared as an `on-method-select`
1343
+ * preflight step interpolates `{serviceType}`/`{userType}` from the pick.
1344
+ *
1345
+ * No-op (resolves `{}`) when no step carries `trigger: 'on-method-select'`,
1346
+ * so descriptors without method-select steps are unaffected. Returns the
1347
+ * captured map (same shape as the pre-mount preflight pass).
1348
+ */
1349
+ export declare function runMethodSelectPreflight(args: {
1350
+ steps?: PreflightStep[];
1351
+ sessionToken: SessionTokenProvider;
1352
+ userId: string;
1353
+ projectId?: string;
1354
+ slug?: string;
1355
+ serviceType?: string;
1356
+ userType?: string;
1357
+ identity?: Record<string, string | undefined>;
1358
+ }): Promise<Record<string, string>>;
1359
+
1317
1360
  export declare interface SaveEntityAction {
1318
1361
  action: 'save_entity';
1319
1362
  }
@@ -1443,6 +1486,19 @@ export declare interface SlugMountedWidget extends MountedTenantWidget {
1443
1486
  * `true`; returns `null` immediately otherwise.
1444
1487
  */
1445
1488
  refreshPartnerAuth(): Promise<string | null>;
1489
+ /**
1490
+ * Run the descriptor's `on-method-select` preflight steps. The hosted
1491
+ * shell calls this from its screen:method handler after the user picks a
1492
+ * method, passing `{serviceType}`/`{userType}` so a leader-assignment (or
1493
+ * any warmup) declared as an on-method-select preflight step interpolates
1494
+ * the pick correctly. No-op (resolves `{}`) when the descriptor has no
1495
+ * such steps. Returns the captured map (same shape as before-chat preflight).
1496
+ */
1497
+ runMethodSelectPreflight(sel?: {
1498
+ serviceType?: string;
1499
+ userType?: string;
1500
+ identity?: Record<string, string | undefined>;
1501
+ }): Promise<Record<string, string>>;
1446
1502
  }
1447
1503
 
1448
1504
  export declare interface SlugMountOptions {
@@ -1454,6 +1510,14 @@ export declare interface SlugMountOptions {
1454
1510
  configBase?: string;
1455
1511
  /** Additional headers for the descriptor fetch. */
1456
1512
  configHeaders?: Record<string, string>;
1513
+ /**
1514
+ * Isolates the persisted chat thread under `{userId}:{projectId}:{scope}`.
1515
+ * Pass the active PAN (or any per-context discriminator) so a user filing
1516
+ * for multiple PANs gets a distinct conversation per PAN instead of one
1517
+ * shared thread. Re-mounting with a different scope loads/creates that
1518
+ * scope's own conversation.
1519
+ */
1520
+ conversationScope?: string;
1457
1521
  user: {
1458
1522
  /**
1459
1523
  * Initial identifier. When `descriptor.sso` is configured, the
@@ -1721,6 +1785,13 @@ export declare interface TenantMountOptions {
1721
1785
  */
1722
1786
  conversationId?: string;
1723
1787
  forceNewConversation?: boolean;
1788
+ /**
1789
+ * Isolates the persisted conversation under `{userId}:{projectId}:{scope}`.
1790
+ * Use when one user + project maps to several logically distinct threads —
1791
+ * e.g. a taxbuddy user filing for multiple PANs, where each PAN must keep
1792
+ * its own chat. Omit for the default single-thread-per-user behaviour.
1793
+ */
1794
+ conversationScope?: string;
1724
1795
  /** Per-mount overrides that take precedence over the descriptor. */
1725
1796
  overrides?: Partial<WidgetConfigDescriptor>;
1726
1797
  /** Surfaced from the SDK. */
@@ -2295,6 +2366,16 @@ export declare interface WidgetConfig extends ChatClientConfig {
2295
2366
  sendButtonShape?: 'circle' | 'square';
2296
2367
  };
2297
2368
  templateLayout?: 'inside' | 'outside';
2369
+ /**
2370
+ * Override the header overflow-menu actions. Pass an empty array `[]` to
2371
+ * hide the overflow menu entirely (disables Smart Edit and any future items).
2372
+ * When omitted the SDK uses its built-in defaults (currently "Edit ITR Details").
2373
+ */
2374
+ chatActions?: {
2375
+ id: string;
2376
+ label: string;
2377
+ icon?: 'edit' | 'mail' | 'star';
2378
+ }[];
2298
2379
  showBubble?: boolean;
2299
2380
  bubbleText?: string;
2300
2381
  bubbleIcon?: string;
package/dist/headless.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { E as s } from "./MountTenant-8zB0FoEP.mjs";
2
- import { A as p, b as l, k as g, C as c, l as h, m as y, M as u, S as m, n as f, T, o as S, p as _, q as v, s as E, t as C, u as F, v as k, w as A, x as I, y as x, z as U, B as q, D as M, F as b } from "./MountTenant-8zB0FoEP.mjs";
1
+ import { E as s } from "./MountTenant-a_9ZUVQQ.mjs";
2
+ import { A as p, b as l, k as g, C as c, l as h, m as y, M as u, S as m, n as f, T, o as S, p as _, q as v, s as E, t as C, u as F, v as k, w as A, x as I, y as x, z as U, B as q, D as M, F as b, G as w } from "./MountTenant-a_9ZUVQQ.mjs";
3
3
  class a extends s {
4
4
  registration = null;
5
5
  pendingEdits = [];
@@ -118,5 +118,6 @@ export {
118
118
  U as isTiledeskSelfEcho,
119
119
  q as mountFromSlug,
120
120
  M as mountTenantWidget,
121
- b as parseTiledeskTemplate
121
+ b as parseTiledeskTemplate,
122
+ w as runMethodSelectPreflight
122
123
  };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./MountTenant-CP_CYdl8.cjs"),s=require("./headless.cjs");function l(a){e.registerComponents();const t=document.createElement("aikaara-chat-widget"),i={baseUrl:"base-url",userToken:"user-token",apiKey:"api-key",title:"title",subtitle:"subtitle",theme:"theme",primaryColor:"primary-color",position:"position",width:"width",height:"height",placeholder:"placeholder",welcomeMessage:"welcome-message",avatarUrl:"avatar-url"};for(const[o,n]of Object.entries(i)){const r=a[o];r!=null&&t.setAttribute(n,String(r))}return t.configure(a),document.body.appendChild(t),t}function d(){const a=document.querySelector("aikaara-chat-widget");a&&a.remove()}exports.ActionCableClient=e.ActionCableClient;exports.AikaaraChatBubble=e.AikaaraChatBubble;exports.AikaaraChatClient=e.AikaaraChatClient;exports.AikaaraChatHeader=e.AikaaraChatHeader;exports.AikaaraChatInput=e.AikaaraChatInput;exports.AikaaraChatWidget=e.AikaaraChatWidget;exports.AikaaraErrorBanner=e.AikaaraErrorBanner;exports.AikaaraMessageBubble=e.AikaaraMessageBubble;exports.AikaaraMessageList=e.AikaaraMessageList;exports.AikaaraStreamingMessage=e.AikaaraStreamingMessage;exports.AikaaraTypingIndicator=e.AikaaraTypingIndicator;exports.ApiClient=e.ApiClient;exports.ChannelSubscription=e.ChannelSubscription;exports.ConnectionManager=e.ConnectionManager;exports.ConversationManager=e.ConversationManager;exports.EventEmitter=e.EventEmitter;exports.MessageStore=e.MessageStore;exports.SessionAuthAdapter=e.SessionAuthAdapter;exports.SsoExchangeAdapter=e.SsoExchangeAdapter;exports.TiledeskTransport=e.TiledeskTransport;exports.TokenDiscoveryError=e.TokenDiscoveryError;exports.TokenDiscoveryReader=e.TokenDiscoveryReader;exports.clearPersistedConversationId=e.clearPersistedConversationId;exports.collectSsoCredentials=e.collectSsoCredentials;exports.createFetchUploadAdapter=e.createFetchUploadAdapter;exports.createPresigned3StepUploadAdapter=e.createPresigned3StepUploadAdapter;exports.createTiledeskHistoryAdapter=e.createTiledeskHistoryAdapter;exports.discoverToken=e.discoverToken;exports.extractTiledeskFileEnvelope=e.extractTiledeskFileEnvelope;exports.inferTiledeskRole=e.inferTiledeskRole;exports.isTiledeskSelfEcho=e.isTiledeskSelfEcho;exports.mountFromSlug=e.mountFromSlug;exports.mountTenantWidget=e.mount;exports.parseTiledeskTemplate=e.parseTiledeskTemplate;exports.registerComponents=e.registerComponents;exports.FormBridge=s.FormBridge;exports.mount=l;exports.unmount=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./MountTenant-DYhDyux6.cjs"),s=require("./headless.cjs");function l(a){e.registerComponents();const t=document.createElement("aikaara-chat-widget"),i={baseUrl:"base-url",userToken:"user-token",apiKey:"api-key",title:"title",subtitle:"subtitle",theme:"theme",primaryColor:"primary-color",position:"position",width:"width",height:"height",placeholder:"placeholder",welcomeMessage:"welcome-message",avatarUrl:"avatar-url"};for(const[o,n]of Object.entries(i)){const r=a[o];r!=null&&t.setAttribute(n,String(r))}return t.configure(a),document.body.appendChild(t),t}function d(){const a=document.querySelector("aikaara-chat-widget");a&&a.remove()}exports.ActionCableClient=e.ActionCableClient;exports.AikaaraChatBubble=e.AikaaraChatBubble;exports.AikaaraChatClient=e.AikaaraChatClient;exports.AikaaraChatHeader=e.AikaaraChatHeader;exports.AikaaraChatInput=e.AikaaraChatInput;exports.AikaaraChatWidget=e.AikaaraChatWidget;exports.AikaaraErrorBanner=e.AikaaraErrorBanner;exports.AikaaraMessageBubble=e.AikaaraMessageBubble;exports.AikaaraMessageList=e.AikaaraMessageList;exports.AikaaraStreamingMessage=e.AikaaraStreamingMessage;exports.AikaaraTypingIndicator=e.AikaaraTypingIndicator;exports.ApiClient=e.ApiClient;exports.ChannelSubscription=e.ChannelSubscription;exports.ConnectionManager=e.ConnectionManager;exports.ConversationManager=e.ConversationManager;exports.EventEmitter=e.EventEmitter;exports.MessageStore=e.MessageStore;exports.SessionAuthAdapter=e.SessionAuthAdapter;exports.SsoExchangeAdapter=e.SsoExchangeAdapter;exports.TiledeskTransport=e.TiledeskTransport;exports.TokenDiscoveryError=e.TokenDiscoveryError;exports.TokenDiscoveryReader=e.TokenDiscoveryReader;exports.clearPersistedConversationId=e.clearPersistedConversationId;exports.collectSsoCredentials=e.collectSsoCredentials;exports.createFetchUploadAdapter=e.createFetchUploadAdapter;exports.createPresigned3StepUploadAdapter=e.createPresigned3StepUploadAdapter;exports.createTiledeskHistoryAdapter=e.createTiledeskHistoryAdapter;exports.discoverToken=e.discoverToken;exports.extractTiledeskFileEnvelope=e.extractTiledeskFileEnvelope;exports.inferTiledeskRole=e.inferTiledeskRole;exports.isTiledeskSelfEcho=e.isTiledeskSelfEcho;exports.mountFromSlug=e.mountFromSlug;exports.mountTenantWidget=e.mount;exports.parseTiledeskTemplate=e.parseTiledeskTemplate;exports.registerComponents=e.registerComponents;exports.runMethodSelectPreflight=e.runMethodSelectPreflight;exports.FormBridge=s.FormBridge;exports.mount=l;exports.unmount=d;
package/dist/index.d.ts CHANGED
@@ -476,7 +476,7 @@ export declare interface ChatEvents {
476
476
  };
477
477
  }
478
478
 
479
- export declare function clearPersistedConversationId(userId: string, projectId: string): void;
479
+ export declare function clearPersistedConversationId(userId: string, projectId: string, scope?: string): void;
480
480
 
481
481
  /** Read every credential listed in `spec`. Throws on missing required. */
482
482
  export declare function collectSsoCredentials(opts: SsoCollectorOptions): Promise<Record<string, string>>;
@@ -982,10 +982,6 @@ export declare interface PostMsgSourceConfig {
982
982
  timeoutMs?: number;
983
983
  }
984
984
 
985
- /**
986
- * One HTTP call run by the SDK before auth. Failure of `soft: true` steps
987
- * is logged and ignored; failure of strict steps aborts the mount.
988
- */
989
985
  export declare interface PreflightStep {
990
986
  url: string;
991
987
  method?: 'GET' | 'POST' | 'PUT';
@@ -996,6 +992,13 @@ export declare interface PreflightStep {
996
992
  authHeaderTemplate?: string;
997
993
  /** Continue on non-2xx. Default `false` (mount abort). */
998
994
  soft?: boolean;
995
+ /**
996
+ * When this step fires. Absent / `before-chat` runs in the pre-mount
997
+ * preflight chain as today; `on-method-select` defers it to the hosted
998
+ * shell's method screen (so `{serviceType}`/`{userType}` resolve from the
999
+ * user's pick). Fully backward compatible — no trigger means before-chat.
1000
+ */
1001
+ trigger?: PreflightTrigger;
999
1002
  /**
1000
1003
  * When set, parse the response as JSON and capture the value at the
1001
1004
  * given dotted path (e.g. `data.token`). The captured value can be
@@ -1020,6 +1023,24 @@ export declare interface PreflightStep {
1020
1023
  };
1021
1024
  }
1022
1025
 
1026
+ /**
1027
+ * One HTTP call run by the SDK before auth. Failure of `soft: true` steps
1028
+ * is logged and ignored; failure of strict steps aborts the mount.
1029
+ */
1030
+ /**
1031
+ * When a preflight step fires. Shared vocabulary across the SDK, the hosted
1032
+ * shell (screen:method handler), and the dashboard editors:
1033
+ * - `before-chat` — pre-mount preflight chain, exactly as today. This is
1034
+ * also the implicit default when `trigger` is absent, so
1035
+ * every existing descriptor keeps byte-identical behaviour.
1036
+ * - `on-method-select` — deferred to the hosted shell's screen:method
1037
+ * handler, fired *after* the user picks a method so the
1038
+ * step's URL/body can interpolate `{serviceType}` and
1039
+ * `{userType}` (e.g. a leader-assignment warmup).
1040
+ * - `during-login` — reserved for the native LoginScreen chain.
1041
+ */
1042
+ export declare type PreflightTrigger = 'before-chat' | 'on-method-select' | 'during-login';
1043
+
1023
1044
  /**
1024
1045
  * Three-step presigned-S3 upload (sign → PUT → register). Driven entirely
1025
1046
  * by descriptor — no tenant-specific code in host apps.
@@ -1237,6 +1258,28 @@ export declare interface RouteDef {
1237
1258
  layout?: string;
1238
1259
  }
1239
1260
 
1261
+ /**
1262
+ * Standalone runner for the `on-method-select` slice of a descriptor's
1263
+ * preflight chain. The hosted shell's method picker (screen:method) calls
1264
+ * this *after* the user picks a method but *before* the chat mounts, so a
1265
+ * leader-assignment (or any warmup) declared as an `on-method-select`
1266
+ * preflight step interpolates `{serviceType}`/`{userType}` from the pick.
1267
+ *
1268
+ * No-op (resolves `{}`) when no step carries `trigger: 'on-method-select'`,
1269
+ * so descriptors without method-select steps are unaffected. Returns the
1270
+ * captured map (same shape as the pre-mount preflight pass).
1271
+ */
1272
+ export declare function runMethodSelectPreflight(args: {
1273
+ steps?: PreflightStep[];
1274
+ sessionToken: SessionTokenProvider;
1275
+ userId: string;
1276
+ projectId?: string;
1277
+ slug?: string;
1278
+ serviceType?: string;
1279
+ userType?: string;
1280
+ identity?: Record<string, string | undefined>;
1281
+ }): Promise<Record<string, string>>;
1282
+
1240
1283
  export declare interface SaveEntityAction {
1241
1284
  action: 'save_entity';
1242
1285
  }
@@ -1362,6 +1405,19 @@ export declare interface SlugMountedWidget extends MountedTenantWidget {
1362
1405
  * `true`; returns `null` immediately otherwise.
1363
1406
  */
1364
1407
  refreshPartnerAuth(): Promise<string | null>;
1408
+ /**
1409
+ * Run the descriptor's `on-method-select` preflight steps. The hosted
1410
+ * shell calls this from its screen:method handler after the user picks a
1411
+ * method, passing `{serviceType}`/`{userType}` so a leader-assignment (or
1412
+ * any warmup) declared as an on-method-select preflight step interpolates
1413
+ * the pick correctly. No-op (resolves `{}`) when the descriptor has no
1414
+ * such steps. Returns the captured map (same shape as before-chat preflight).
1415
+ */
1416
+ runMethodSelectPreflight(sel?: {
1417
+ serviceType?: string;
1418
+ userType?: string;
1419
+ identity?: Record<string, string | undefined>;
1420
+ }): Promise<Record<string, string>>;
1365
1421
  }
1366
1422
 
1367
1423
  export declare interface SlugMountOptions {
@@ -1373,6 +1429,14 @@ export declare interface SlugMountOptions {
1373
1429
  configBase?: string;
1374
1430
  /** Additional headers for the descriptor fetch. */
1375
1431
  configHeaders?: Record<string, string>;
1432
+ /**
1433
+ * Isolates the persisted chat thread under `{userId}:{projectId}:{scope}`.
1434
+ * Pass the active PAN (or any per-context discriminator) so a user filing
1435
+ * for multiple PANs gets a distinct conversation per PAN instead of one
1436
+ * shared thread. Re-mounting with a different scope loads/creates that
1437
+ * scope's own conversation.
1438
+ */
1439
+ conversationScope?: string;
1376
1440
  user: {
1377
1441
  /**
1378
1442
  * Initial identifier. When `descriptor.sso` is configured, the
@@ -1629,6 +1693,13 @@ export declare interface TenantMountOptions {
1629
1693
  */
1630
1694
  conversationId?: string;
1631
1695
  forceNewConversation?: boolean;
1696
+ /**
1697
+ * Isolates the persisted conversation under `{userId}:{projectId}:{scope}`.
1698
+ * Use when one user + project maps to several logically distinct threads —
1699
+ * e.g. a taxbuddy user filing for multiple PANs, where each PAN must keep
1700
+ * its own chat. Omit for the default single-thread-per-user behaviour.
1701
+ */
1702
+ conversationScope?: string;
1632
1703
  /** Per-mount overrides that take precedence over the descriptor. */
1633
1704
  overrides?: Partial<WidgetConfigDescriptor>;
1634
1705
  /** Surfaced from the SDK. */
@@ -2068,6 +2139,16 @@ export declare interface WidgetConfig extends ChatClientConfig {
2068
2139
  sendButtonShape?: 'circle' | 'square';
2069
2140
  };
2070
2141
  templateLayout?: 'inside' | 'outside';
2142
+ /**
2143
+ * Override the header overflow-menu actions. Pass an empty array `[]` to
2144
+ * hide the overflow menu entirely (disables Smart Edit and any future items).
2145
+ * When omitted the SDK uses its built-in defaults (currently "Edit ITR Details").
2146
+ */
2147
+ chatActions?: {
2148
+ id: string;
2149
+ label: string;
2150
+ icon?: 'edit' | 'mail' | 'star';
2151
+ }[];
2071
2152
  showBubble?: boolean;
2072
2153
  bubbleText?: string;
2073
2154
  bubbleIcon?: string;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { r as o } from "./MountTenant-8zB0FoEP.mjs";
2
- import { A as u, a as m, b as k, c as g, d as h, e as A, f as C, g as T, h as b, i as v, j as f, k as y, C as S, l as w, m as E, E as M, M as x, S as B, n as F, T as U, o as D, p as I, q as j, s as q, t as H, u as P, v as R, w as W, x as z, y as K, z as L, B as O, D as G, F as J } from "./MountTenant-8zB0FoEP.mjs";
3
- import { FormBridge as Q } from "./headless.mjs";
1
+ import { r as o } from "./MountTenant-a_9ZUVQQ.mjs";
2
+ import { A as u, a as m, b as g, c as h, d as k, e as A, f as C, g as T, h as b, i as f, j as v, k as S, C as y, l as M, m as w, E, M as x, S as B, n as F, T as U, o as D, p as I, q as P, s as j, t as q, u as H, v as R, w as W, x as z, y as G, z as K, B as L, D as O, F as J, G as N } from "./MountTenant-a_9ZUVQQ.mjs";
3
+ import { FormBridge as V } from "./headless.mjs";
4
4
  function l(e) {
5
5
  o();
6
6
  const a = document.createElement("aikaara-chat-widget"), r = {
@@ -31,40 +31,41 @@ function d() {
31
31
  export {
32
32
  u as ActionCableClient,
33
33
  m as AikaaraChatBubble,
34
- k as AikaaraChatClient,
35
- g as AikaaraChatHeader,
36
- h as AikaaraChatInput,
34
+ g as AikaaraChatClient,
35
+ h as AikaaraChatHeader,
36
+ k as AikaaraChatInput,
37
37
  A as AikaaraChatWidget,
38
38
  C as AikaaraErrorBanner,
39
39
  T as AikaaraMessageBubble,
40
40
  b as AikaaraMessageList,
41
- v as AikaaraStreamingMessage,
42
- f as AikaaraTypingIndicator,
43
- y as ApiClient,
44
- S as ChannelSubscription,
45
- w as ConnectionManager,
46
- E as ConversationManager,
47
- M as EventEmitter,
48
- Q as FormBridge,
41
+ f as AikaaraStreamingMessage,
42
+ v as AikaaraTypingIndicator,
43
+ S as ApiClient,
44
+ y as ChannelSubscription,
45
+ M as ConnectionManager,
46
+ w as ConversationManager,
47
+ E as EventEmitter,
48
+ V as FormBridge,
49
49
  x as MessageStore,
50
50
  B as SessionAuthAdapter,
51
51
  F as SsoExchangeAdapter,
52
52
  U as TiledeskTransport,
53
53
  D as TokenDiscoveryError,
54
54
  I as TokenDiscoveryReader,
55
- j as clearPersistedConversationId,
56
- q as collectSsoCredentials,
57
- H as createFetchUploadAdapter,
58
- P as createPresigned3StepUploadAdapter,
55
+ P as clearPersistedConversationId,
56
+ j as collectSsoCredentials,
57
+ q as createFetchUploadAdapter,
58
+ H as createPresigned3StepUploadAdapter,
59
59
  R as createTiledeskHistoryAdapter,
60
60
  W as discoverToken,
61
61
  z as extractTiledeskFileEnvelope,
62
- K as inferTiledeskRole,
63
- L as isTiledeskSelfEcho,
62
+ G as inferTiledeskRole,
63
+ K as isTiledeskSelfEcho,
64
64
  l as mount,
65
- O as mountFromSlug,
66
- G as mountTenantWidget,
65
+ L as mountFromSlug,
66
+ O as mountTenantWidget,
67
67
  J as parseTiledeskTemplate,
68
68
  o as registerComponents,
69
+ N as runMethodSelectPreflight,
69
70
  d as unmount
70
71
  };
package/dist/ui.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./MountTenant-CP_CYdl8.cjs");exports.AikaaraChat=a.AikaaraChat;exports.AikaaraChatBubble=a.AikaaraChatBubble;exports.AikaaraChatHeader=a.AikaaraChatHeader;exports.AikaaraChatInput=a.AikaaraChatInput;exports.AikaaraChatWidget=a.AikaaraChatWidget;exports.AikaaraComparePlans=a.AikaaraComparePlans;exports.AikaaraErrorBanner=a.AikaaraErrorBanner;exports.AikaaraLinkModal=a.AikaaraLinkModal;exports.AikaaraMessageBubble=a.AikaaraMessageBubble;exports.AikaaraMessageList=a.AikaaraMessageList;exports.AikaaraModalAction=a.AikaaraModalAction;exports.AikaaraOptionList=a.AikaaraOptionList;exports.AikaaraSchemaForm=a.AikaaraSchemaForm;exports.AikaaraSmartEditModal=a.AikaaraSmartEditModal;exports.AikaaraStreamingMessage=a.AikaaraStreamingMessage;exports.AikaaraSubmitAction=a.AikaaraSubmitAction;exports.AikaaraSystemPill=a.AikaaraSystemPill;exports.AikaaraTemplateRenderer=a.AikaaraTemplateRenderer;exports.AikaaraTypingIndicator=a.AikaaraTypingIndicator;exports.registerComponents=a.registerComponents;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./MountTenant-DYhDyux6.cjs");exports.AikaaraChat=a.AikaaraChat;exports.AikaaraChatBubble=a.AikaaraChatBubble;exports.AikaaraChatHeader=a.AikaaraChatHeader;exports.AikaaraChatInput=a.AikaaraChatInput;exports.AikaaraChatWidget=a.AikaaraChatWidget;exports.AikaaraComparePlans=a.AikaaraComparePlans;exports.AikaaraErrorBanner=a.AikaaraErrorBanner;exports.AikaaraLinkModal=a.AikaaraLinkModal;exports.AikaaraMessageBubble=a.AikaaraMessageBubble;exports.AikaaraMessageList=a.AikaaraMessageList;exports.AikaaraModalAction=a.AikaaraModalAction;exports.AikaaraOptionList=a.AikaaraOptionList;exports.AikaaraSchemaForm=a.AikaaraSchemaForm;exports.AikaaraSmartEditModal=a.AikaaraSmartEditModal;exports.AikaaraStreamingMessage=a.AikaaraStreamingMessage;exports.AikaaraSubmitAction=a.AikaaraSubmitAction;exports.AikaaraSystemPill=a.AikaaraSystemPill;exports.AikaaraTemplateRenderer=a.AikaaraTemplateRenderer;exports.AikaaraTypingIndicator=a.AikaaraTypingIndicator;exports.registerComponents=a.registerComponents;
package/dist/ui.d.ts CHANGED
@@ -357,9 +357,14 @@ export declare class AikaaraOptionList extends HTMLElement {
357
357
  private shadow;
358
358
  private data;
359
359
  private selected;
360
+ private preSelectedDisabled;
360
361
  constructor();
361
362
  connectedCallback(): void;
362
363
  setPayload(payload: OptionListPayload): void;
364
+ /** Name of the form field — used by AikaaraTemplateRenderer to match postback keys. */
365
+ getName(): string;
366
+ /** Pre-populate selections from history and lock the list to display-only. */
367
+ setPreSelected(values: string[]): void;
363
368
  /** Read selected values — used by parent submit action to collect form state. */
364
369
  getValues(): {
365
370
  name: string;
@@ -527,11 +532,19 @@ export declare class AikaaraTemplateRenderer extends HTMLElement {
527
532
  private payloadData;
528
533
  private innerMessage;
529
534
  private renderGen;
535
+ private _consumedValues;
530
536
  static get observedAttributes(): string[];
531
537
  constructor();
532
538
  connectedCallback(): void;
533
539
  attributeChangedCallback(): void;
534
540
  setPayload(payload: unknown, innerMessage?: string): void;
541
+ /**
542
+ * Forward previously-submitted form values to child option lists so they
543
+ * render pre-selected and locked. Values are stored so render() can
544
+ * re-apply them if connectedCallback fires and re-creates the children.
545
+ */
546
+ setConsumedValues(values: Record<string, string[]>): void;
547
+ private _applyConsumedToChildren;
535
548
  private render;
536
549
  private mountField;
537
550
  /**
@@ -1427,6 +1440,16 @@ declare interface WidgetConfig extends ChatClientConfig {
1427
1440
  sendButtonShape?: 'circle' | 'square';
1428
1441
  };
1429
1442
  templateLayout?: 'inside' | 'outside';
1443
+ /**
1444
+ * Override the header overflow-menu actions. Pass an empty array `[]` to
1445
+ * hide the overflow menu entirely (disables Smart Edit and any future items).
1446
+ * When omitted the SDK uses its built-in defaults (currently "Edit ITR Details").
1447
+ */
1448
+ chatActions?: {
1449
+ id: string;
1450
+ label: string;
1451
+ icon?: 'edit' | 'mail' | 'star';
1452
+ }[];
1430
1453
  showBubble?: boolean;
1431
1454
  bubbleText?: string;
1432
1455
  bubbleIcon?: string;
package/dist/ui.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { G as i, a as s, c as e, d as t, e as A, H as k, f as n, I as o, g as m, h as d, J as l, K as g, L as h, N as p, i as C, O as M, P as b, Q as c, j as S, r as u } from "./MountTenant-8zB0FoEP.mjs";
1
+ import { H as i, a as s, c as e, d as t, e as A, I as k, f as n, J as o, g as m, h as d, K as l, L as g, N as h, O as p, i as C, P as M, Q as b, R as c, j as S, r as u } from "./MountTenant-a_9ZUVQQ.mjs";
2
2
  export {
3
3
  i as AikaaraChat,
4
4
  s as AikaaraChatBubble,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikaara/chat-sdk",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "type": "module",
5
5
  "description": "Aikaara Chat SDK — embeddable chat widget and headless client",
6
6
  "license": "MIT",