@callimacus/thamyr 4.3.5 → 4.4.0
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/CHANGELOG.core.md +25 -0
- package/CHANGELOG.md +32 -0
- package/README.md +84 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +38 -1
- package/package.json +2 -2
package/CHANGELOG.core.md
CHANGED
|
@@ -3,6 +3,31 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.4.0](https://github.com/callimacus/thamyr-sdk/compare/thamyr-core-v4.3.5...thamyr-core-v4.4.0) (2026-09-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **callimacus:** export additional action types from hooks for better type safety ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
12
|
+
* **ContentAPI:** implement getDocumentByGroupId method to retrieve documents based on language and group ID ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
13
|
+
* **hooks.ts:** enhance useProducts, useAnalytics, and useSitemap hooks with TypeScript interfaces and detailed documentation ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
14
|
+
* **react:** add eslint-config-xo-react for better React linting ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
15
|
+
* **react:** implement Callimacus store and hooks for state management ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
16
|
+
* **service.ts:** add polling transport option to socket connection for improved connectivity in restricted environments ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
17
|
+
* **service.ts:** add referrer to auth object for enhanced tracking and analytics ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
18
|
+
* **thamyr:** parity with the v2 wire, rounds without a message, acknowledged suggestions, receptors and block keys ([#784](https://github.com/callimacus/thamyr-sdk/issues/784)) ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **AnalyticsAPI.ts, Thamyr.ts:** remove array type from content parameter in trackEvent method for consistency and simplification ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
24
|
+
* **core/package.json:** update @solomei-ai/intent to version 1.9.2 for latest features and fixes ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
25
|
+
* **package.json:** remove redundant comma in scripts section to ensure JSON validity ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
26
|
+
* **package.json:** update @types/react to version 19.2.10 for improved type definitions chore(package.json): bump react and react-dom to version 19.2.4 for latest features and fixes ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
27
|
+
* **react:** ensure consistent export style across components ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
28
|
+
* **react:** remove obsolete global type declarations ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
29
|
+
* remove legacy-peer-deps from .npmrc and update registry configuration for scoped package ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
30
|
+
|
|
6
31
|
## [4.3.5](https://github.com/callimacus/thamyr-sdk/compare/thamyr-core-v4.3.4...thamyr-core-v4.3.5) (2026-09-29)
|
|
7
32
|
|
|
8
33
|
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,38 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.4.0](https://github.com/callimacus/thamyr-sdk/compare/thamyr-v4.3.5...thamyr-v4.4.0) (2026-09-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **callimacus:** export additional action types from hooks for better type safety ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
12
|
+
* **ContentAPI:** implement getDocumentByGroupId method to retrieve documents based on language and group ID ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
13
|
+
* **hooks.ts:** enhance useProducts, useAnalytics, and useSitemap hooks with TypeScript interfaces and detailed documentation ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
14
|
+
* **react:** add eslint-config-xo-react for better React linting ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
15
|
+
* **react:** implement Callimacus store and hooks for state management ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
16
|
+
* **service.ts:** add polling transport option to socket connection for improved connectivity in restricted environments ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
17
|
+
* **service.ts:** add referrer to auth object for enhanced tracking and analytics ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
18
|
+
* **thamyr:** parity with the v2 wire, rounds without a message, acknowledged suggestions, receptors and block keys ([#784](https://github.com/callimacus/thamyr-sdk/issues/784)) ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **AnalyticsAPI.ts, Thamyr.ts:** remove array type from content parameter in trackEvent method for consistency and simplification ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
24
|
+
* **core/package.json:** update @solomei-ai/intent to version 1.9.2 for latest features and fixes ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
25
|
+
* **package.json:** remove redundant comma in scripts section to ensure JSON validity ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
26
|
+
* **package.json:** update @types/react to version 19.2.10 for improved type definitions chore(package.json): bump react and react-dom to version 19.2.4 for latest features and fixes ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
27
|
+
* **react:** ensure consistent export style across components ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
28
|
+
* **react:** remove obsolete global type declarations ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
29
|
+
* remove legacy-peer-deps from .npmrc and update registry configuration for scoped package ([fe22166](https://github.com/callimacus/thamyr-sdk/commit/fe221665c994723d546f972c9379cdf4b4eecbc8))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Dependencies
|
|
33
|
+
|
|
34
|
+
* The following workspace dependencies were updated
|
|
35
|
+
* dependencies
|
|
36
|
+
* @callimacus/thamyr-core bumped from ^4.3.5 to ^4.4.0
|
|
37
|
+
|
|
6
38
|
## [4.3.5](https://github.com/callimacus/thamyr-sdk/compare/thamyr-v4.3.4...thamyr-v4.3.5) (2026-09-29)
|
|
7
39
|
|
|
8
40
|
|
package/README.md
CHANGED
|
@@ -254,6 +254,90 @@ To trigger interactions and send user input, you'll need to handle user events l
|
|
|
254
254
|
};
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
+
### Rounds Without a Message: Landing, Interactions, Refresh
|
|
258
|
+
|
|
259
|
+
Not every round starts with a question. The tenant's configuration document declares a landing page and a registry of named **interactions** the storefront may send; the SDK opens those rounds with three helpers, so you never assemble the input event by hand.
|
|
260
|
+
|
|
261
|
+
```javascript
|
|
262
|
+
// The landing page, composed from the tenant's landing configuration.
|
|
263
|
+
// `value` is the landing value its blocks read ({{input.value}}) — a page slug, a campaign; at most 200 characters.
|
|
264
|
+
thamyr.openLanding('spring-edit', { language: 'it' });
|
|
265
|
+
|
|
266
|
+
// A declared interaction, with the block it comes from and what it carries.
|
|
267
|
+
thamyr.sendInteraction('pick-size', { block: 'hero', payload: { size: 'M' }, storyId });
|
|
268
|
+
|
|
269
|
+
// A refresh: the interaction sent with the block's key. The round composes like any other; a block
|
|
270
|
+
// whose `patchOn` names the interaction is updated in place instead (see Block patches).
|
|
271
|
+
thamyr.refresh('hero', 'reshuffle', { storyId });
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Every helper takes `storyId` and `language` like `CREATE_ROUND` does; an interaction the tenant declared as `system` is recorded and closed with nothing composed.
|
|
275
|
+
|
|
276
|
+
Type `sendInteraction` from the tenant's registry by augmenting `ThamyrInteractionMap` once in your project: the id becomes a union of the declared ids and each payload is checked.
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
declare module '@callimacus/thamyr-core' {
|
|
280
|
+
interface ThamyrInteractionMap {
|
|
281
|
+
'pick-size': { size: string };
|
|
282
|
+
reshuffle: undefined;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
In React the same three helpers come from `useThamyr()` and pass through its connection gate:
|
|
288
|
+
|
|
289
|
+
```tsx
|
|
290
|
+
const { openLanding, sendInteraction, refresh } = useThamyr();
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Suggestions for the Input Box
|
|
294
|
+
|
|
295
|
+
`suggest(prefix)` answers through the socket acknowledgment, never as a story response: the tenant's starter questions while the prefix is shorter than three characters, autocomplete from there. It never rejects — a disabled tenant, a lost connection or a timeout (4 s by default) all resolve to no suggestions.
|
|
296
|
+
|
|
297
|
+
```javascript
|
|
298
|
+
const { suggestions } = await thamyr.suggest(inputText, { storyId, timeoutMs: 2000 });
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
In React, `useSuggestions(prefix, { storyId })` follows the input as the visitor types — debounced (200 ms by default, the empty prefix asks at once), and a late answer never overwrites a newer prefix:
|
|
302
|
+
|
|
303
|
+
```tsx
|
|
304
|
+
const [text, setText] = useState('');
|
|
305
|
+
const { suggestions, loading } = useSuggestions(text, { storyId });
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Reading a Round
|
|
309
|
+
|
|
310
|
+
Three things a round carries are worth reading by name rather than by digging into `data`:
|
|
311
|
+
|
|
312
|
+
- **Receptors** — the labels the classifier assigned this message (not the session intent). `receptorsOf(chapter)` reads `chapter.receptors`, falling back to the `intent` name older servers used.
|
|
313
|
+
- **Block key** — the identity a block is attributed, pinned and linked by; `block.type` is a render hint two blocks may share. `blockKeyOf(block)` reads it off a custom block (legacy blocks have none).
|
|
314
|
+
- **Add-to-cart result** — when the flow adds to cart, every block of the round carries how it went as `data.addToCart`; `addToCartResultOf(block)` narrows it to `{status: 'resolved' | 'size_selection_needed' | 'error', ...}`. A round that needs a size picked also emits a `custom:addToCartResult` block (`ADD_TO_CART_RESULT_BLOCK`).
|
|
315
|
+
|
|
316
|
+
```javascript
|
|
317
|
+
thamyr.onResponse((response) => {
|
|
318
|
+
if (response.type !== ThamyrResponseType.CHAPTER_EVENT) return;
|
|
319
|
+
const labels = receptorsOf(response.chapter);
|
|
320
|
+
for (const block of response.chapter.blocks ?? []) {
|
|
321
|
+
const result = addToCartResultOf(block);
|
|
322
|
+
if (result?.status === 'size_selection_needed') showSizePicker(result.availableSizes);
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### Block Patches
|
|
328
|
+
|
|
329
|
+
An interaction a block's rive content declares in `patchOn`, sent with the block's key, does not compose a new round: the server answers with a `block-patch` response that re-sets the animation already on screen. `values`, `inputs` and `textRuns` hold only what changed; `fire` lists the triggers to play once, in order (`input:<name>` or `vm:<name>`).
|
|
330
|
+
|
|
331
|
+
`applyBlockPatch(chapter, patch)` returns the round with the patch merged into the animation it names (`patch.contentId`, a dotted path into `block.data`), or the same chapter when it holds no such block. The React and React Native stores apply it to the history for you; the patch itself still reaches `onResponse`, which is where to play `fire`, so triggers never replay from state.
|
|
332
|
+
|
|
333
|
+
```javascript
|
|
334
|
+
thamyr.onResponse((response) => {
|
|
335
|
+
if (response.type !== ThamyrResponseType.BLOCK_PATCH) return;
|
|
336
|
+
round = applyBlockPatch(round, response.data);
|
|
337
|
+
player.fire(response.data.fire);
|
|
338
|
+
});
|
|
339
|
+
```
|
|
340
|
+
|
|
257
341
|
### Rendering Blocks
|
|
258
342
|
|
|
259
343
|
Thamyr responds with different types of content blocks based on the input events. You can render these blocks in your UI using a switch-case structure or dynamic rendering.
|
package/dist/esm/index.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* See LICENSE.md for the full terms.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import{callimacusService as n,createContractClient as e,logger as t,CallimacusApi as o,UserInteractionType as s,SLInputEventType as r}from"@callimacus/thamyr-core";export*from"@callimacus/thamyr-core";class
|
|
8
|
+
import{callimacusService as n,createContractClient as e,logger as t,CallimacusApi as o,UserInteractionType as s,SLInputEventType as r,landingRound as a,interactionRound as i}from"@callimacus/thamyr-core";export*from"@callimacus/thamyr-core";class c{onConnectionStatusChangeCallback;onResponseCallback;onErrorCallback;onClientInfoCallback;constructor(e={}){const{autoConnect:t=!0,url:o="wss://localhost:4000",token:s,callbacks:r,uiObserver:a}=e;this.onConnectionStatusChangeCallback=r?.onConnectionStatusChange,this.onResponseCallback=r?.onResponse,this.onErrorCallback=r?.onError,this.onClientInfoCallback=r?.onClientInfo,void 0!==a&&n.configureUiObserver(a),this.setupEventListeners(),t&&this.connect(o,s)}setupEventListeners(){n.onConnectionStatus(n=>{this.onConnectionStatusChangeCallback&&this.onConnectionStatusChangeCallback(n)}),n.onServerResponse(n=>{this.onResponseCallback&&this.onResponseCallback(n)}),n.onError(n=>{this.onErrorCallback&&this.onErrorCallback(n)})}connect(e="wss://localhost:4000",t){const o="string"==typeof t&&""!==t,s=o?{Authorization:`Bearer ${t}`}:void 0,r=o?{token:t}:void 0;n.connect(e,s,r)}disconnect(){n.disconnect()}sendUserInteraction(e,t){n.sendUserInteraction(e,t)}async suggest(e,t){return n.suggest(e,t)}gatherClientInfo(){n.gatherClientInfo().then(n=>{this.onClientInfoCallback&&this.onClientInfoCallback(n)})}onConnectionStatusChange(n){return this.onConnectionStatusChangeCallback=n,()=>{this.onConnectionStatusChangeCallback=void 0}}onResponse(n){return this.onResponseCallback=n,()=>{this.onResponseCallback=void 0}}onError(n){return this.onErrorCallback=n,()=>{this.onErrorCallback=void 0}}}class l{config;client;constructor(n){this.config=n,this.client=e(n)}async getSitemap(){const{data:n,error:e,response:o}=await this.client.get({url:"/sitemap.xml",headers:{Accept:"application/xml"},parseAs:"text"});if(void 0===n){const n=o?.status;throw t.error(void 0===n?"sitemap: no response received":`sitemap: API Error ${n}`,e),Object.assign(new Error(void 0===n?"sitemap request failed":`sitemap request failed with status ${n}`),{status:n,error:e})}return n}}const u="https://api.callimacus.ai";function h(n){const e=n??u;if(!function(n){try{return Boolean(new URL(n))}catch{return!1}}(e))throw new Error(`[thamyr] \`endpoint\` must be an absolute URL such as ${u}, got ${JSON.stringify(n)}. Omit it to use the default.`);return e}class C extends o{config;websocketManager;sitemap;constructor(n){const t=h(n.endpoint),{clientId:o}=n;if(!o)throw new Error("[thamyr] `clientId` is required. Pass your Callimacus Client ID (`cal-pk-…`).");super({client:e({accessToken:o,endpoint:t,withCredentials:!0})}),this.config=n,this.sitemap=new l({accessToken:o,endpoint:t}),this.websocketManager=new c({url:t,autoConnect:!0,token:o,uiObserver:n.uiObserver})}sendAudio(n,e){const t=new File([n],"recording.webm",{type:n.type});this.sendUserInteraction(s.CREATE_ROUND,{inputEvent:{type:r.question,data:{value:e??"",file:t}}})}sendUserInteraction(n,e){this.websocketManager.sendUserInteraction(n,e)}openLanding(n,e={}){this.sendUserInteraction(s.CREATE_ROUND,a(n,e))}sendInteraction(n,e={}){this.sendUserInteraction(s.CREATE_ROUND,i(n,e))}refresh(n,e,t={}){this.sendInteraction(e,{...t,block:n})}async suggest(n="",e={}){const{timeoutMs:t,storyId:o,language:s}=e;return this.websocketManager.suggest({prefix:n,storyId:o??void 0,language:s},{timeoutMs:t})}onResponse(n){this.websocketManager.onResponse(n)}onError(n){this.websocketManager.onError(n)}}export{l as SitemapAPI,C as Thamyr,c as WebsocketManager};
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/callimacus/manager.ts","../../../src/service/sitemap-api.ts","../../../src/service/thamyr.ts"],"sourcesContent":[null,null,null],"names":["WebsocketManager","onConnectionStatusChangeCallback","onResponseCallback","onErrorCallback","onClientInfoCallback","constructor","options","autoConnect","url","token","callbacks","uiObserver","this","onConnectionStatusChange","onResponse","onError","onClientInfo","undefined","callimacusService","configureUiObserver","setupEventListeners","connect","onConnectionStatus","isConnected","onServerResponse","response","error","hasToken","headers","Authorization","auth","disconnect","sendUserInteraction","type","payload","gatherClientInfo","then","clientInfo","callback","SitemapAPI","config","client","createContractClient","getSitemap","data","get","Accept","parseAs","status","logger","Object","assign","Error","DEFAULT_ENDPOINT","resolveEndpoint","endpoint","resolved","value","Boolean","URL","isAbsoluteUrl","JSON","stringify","Thamyr","CallimacusApi","websocketManager","sitemap","clientId","super","accessToken","withCredentials","sendAudio","audio","query","file","File","UserInteractionType","CREATE_ROUND","inputEvent","SLInputEventType","question"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/callimacus/manager.ts","../../../src/service/sitemap-api.ts","../../../src/service/thamyr.ts"],"sourcesContent":[null,null,null],"names":["WebsocketManager","onConnectionStatusChangeCallback","onResponseCallback","onErrorCallback","onClientInfoCallback","constructor","options","autoConnect","url","token","callbacks","uiObserver","this","onConnectionStatusChange","onResponse","onError","onClientInfo","undefined","callimacusService","configureUiObserver","setupEventListeners","connect","onConnectionStatus","isConnected","onServerResponse","response","error","hasToken","headers","Authorization","auth","disconnect","sendUserInteraction","type","payload","suggest","gatherClientInfo","then","clientInfo","callback","SitemapAPI","config","client","createContractClient","getSitemap","data","get","Accept","parseAs","status","logger","Object","assign","Error","DEFAULT_ENDPOINT","resolveEndpoint","endpoint","resolved","value","Boolean","URL","isAbsoluteUrl","JSON","stringify","Thamyr","CallimacusApi","websocketManager","sitemap","clientId","super","accessToken","withCredentials","sendAudio","audio","query","file","File","UserInteractionType","CREATE_ROUND","inputEvent","SLInputEventType","question","openLanding","landingRound","sendInteraction","id","interactionRound","refresh","block","interaction","prefix","timeoutMs","storyId","language"],"mappings":";;;;;;;uPAiGaA,EAEJC,iCACAC,mBACAC,gBACSC,qBAMjB,WAAAC,CAAYC,EAAoC,IAC/C,MAAMC,YACLA,GAAc,EAAIC,IAClBA,EAAM,uBAAsBC,MAC5BA,EAAKC,UACLA,EAASC,WACTA,GACGL,EAGJM,KAAKX,iCAAmCS,GAAWG,yBACnDD,KAAKV,mBAAqBQ,GAAWI,WACrCF,KAAKT,gBAAkBO,GAAWK,QAClCH,KAAKR,qBAAuBM,GAAWM,kBAEpBC,IAAfN,GACHO,EAAkBC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+C,EAAiBC,SACvBpC,KAAM,CAACa,MAAOgB,GAAS,GAAIC,UAG9B,CAEA,mBAAA3C,CAAmDC,EAASC,GAC3DtB,KAAKsD,iBAAiBlC,oBAAoBC,EAAMC,EACjD,CAOA,WAAAgD,CAAYxB,EAAgBpD,EAAwB,IACnDM,KAAKoB,oBAAoB6C,EAAoBC,aAAcK,EAAazB,EAAOpD,GAChF,CAQA,eAAA8E,CAAyCC,EAAO/E,EAAiC,IAChFM,KAAKoB,oBAAoB6C,EAAoBC,aAAcQ,EAAiBD,EAAI/E,GACjF,CASA,OAAAiF,CAAQC,EAAeC,EAA4BnF,EAAwB,CAAA,GAC1EM,KAAKwE,gBAAgBK,EAAa,IAAInF,EAASkF,SAChD,CASA,aAAMrD,CAAQuD,EAAS,GAAIpF,EAA+C,CAAA,GACzE,MAAMqF,UAACA,EAASC,QAAEA,EAAOC,SAAEA,GAAYvF,EACvC,OAAOM,KAAKsD,iBAAiB/B,QAAQ,CAACuD,SAAQE,QAASA,QAAW3E,EAAW4E,YAAW,CAACF,aAC1F,CAEA,UAAA7E,CAAWyB,GACV3B,KAAKsD,iBAAiBpD,WAAWyB,EAClC,CAEA,OAAAxB,CAAQwB,GACP3B,KAAKsD,iBAAiBnD,QAAQwB,EAC/B"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* See LICENSE.md for the full terms.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import { ThamyrResponse, ErrorMessage, ClientInfo, UiObserverConfig, UserInteractionType, InteractionPayloadMap, CallimacusApi } from '@callimacus/thamyr-core';
|
|
8
|
+
import { ThamyrResponse, ErrorMessage, ClientInfo, UiObserverConfig, UserInteractionType, InteractionPayloadMap, SuggestPayload, Suggestions, CallimacusApi, RoundOptions, InteractionId, InteractionOptions } from '@callimacus/thamyr-core';
|
|
9
9
|
export * from '@callimacus/thamyr-core';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -119,6 +119,12 @@ declare class WebsocketManager {
|
|
|
119
119
|
@param payload - The properly typed payload for this interaction type
|
|
120
120
|
*/
|
|
121
121
|
sendUserInteraction<T extends UserInteractionType>(type: T, payload: InteractionPayloadMap[T]): void;
|
|
122
|
+
/**
|
|
123
|
+
Prompt suggestions through the socket acknowledgment; resolves to none when disconnected.
|
|
124
|
+
*/
|
|
125
|
+
suggest(payload: SuggestPayload, options?: {
|
|
126
|
+
timeoutMs?: number;
|
|
127
|
+
}): Promise<Suggestions>;
|
|
122
128
|
/**
|
|
123
129
|
Gathers client information
|
|
124
130
|
*/
|
|
@@ -195,6 +201,37 @@ declare class Thamyr extends CallimacusApi {
|
|
|
195
201
|
});
|
|
196
202
|
sendAudio(audio: Blob, query?: string): void;
|
|
197
203
|
sendUserInteraction<T extends UserInteractionType>(type: T, payload: InteractionPayloadMap[T]): void;
|
|
204
|
+
/**
|
|
205
|
+
Opens the landing page: a round with no message, composed from the tenant's
|
|
206
|
+
landing configuration. `value` is the landing value its blocks and conditions
|
|
207
|
+
read (`{{input.value}}`) — a page slug, a campaign; at most 200 characters.
|
|
208
|
+
*/
|
|
209
|
+
openLanding(value?: string, options?: RoundOptions): void;
|
|
210
|
+
/**
|
|
211
|
+
Sends one of the interactions the tenant declared in its configuration
|
|
212
|
+
document. Augment `ThamyrInteractionMap` (from `@callimacus/thamyr-core`) with
|
|
213
|
+
the registry and the id and payload are typed; a `system` interaction is
|
|
214
|
+
recorded and closed with nothing composed.
|
|
215
|
+
*/
|
|
216
|
+
sendInteraction<I extends InteractionId>(id: I, options?: InteractionOptions<I>): void;
|
|
217
|
+
/**
|
|
218
|
+
Sends an interaction on behalf of one block. The round composes like any
|
|
219
|
+
other; a block whose `patchOn` names the interaction is patched in place.
|
|
220
|
+
@param block - The block's key
|
|
221
|
+
@param interaction - The refresh interaction the block declares
|
|
222
|
+
@param options - The story to continue and the language to compose in
|
|
223
|
+
*/
|
|
224
|
+
refresh(block: string, interaction: InteractionId, options?: RoundOptions): void;
|
|
225
|
+
/**
|
|
226
|
+
Prompt suggestions for the input box: the tenant's starter questions while the
|
|
227
|
+
prefix is shorter than three characters, autocomplete from there. Called with
|
|
228
|
+
no prefix — an empty input box — it asks for the starters. Resolves to no
|
|
229
|
+
suggestions — never rejects — when the tenant disabled them, the socket is
|
|
230
|
+
down or the server did not answer within `timeoutMs` (default 4 s).
|
|
231
|
+
*/
|
|
232
|
+
suggest(prefix?: string, options?: RoundOptions & {
|
|
233
|
+
timeoutMs?: number;
|
|
234
|
+
}): Promise<Suggestions>;
|
|
198
235
|
onResponse(callback: (response: ThamyrResponse) => void): void;
|
|
199
236
|
onError(callback: (error: ErrorMessage) => void): void;
|
|
200
237
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@callimacus/thamyr",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "JavaScript package for Thamyr",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"test": "vitest run"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@callimacus/thamyr-core": "^4.
|
|
38
|
+
"@callimacus/thamyr-core": "^4.4.0"
|
|
39
39
|
},
|
|
40
40
|
"gitHead": "fafba2c8ca0586f95b1d03c5eede356a53b00886",
|
|
41
41
|
"devDependencies": {
|