@callimacus/thamyr 4.3.4 → 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 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-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
+
31
+ ## [4.3.5](https://github.com/callimacus/thamyr-sdk/compare/thamyr-core-v4.3.4...thamyr-core-v4.3.5) (2026-09-29)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * **npm:** publish the five packages as @callimacus/* ([#791](https://github.com/callimacus/thamyr-sdk/issues/791)) ([7beae9a](https://github.com/callimacus/thamyr-sdk/commit/7beae9a15f713602aa73d0ddb8ae82d045a725c0))
37
+
6
38
  ## [4.3.4](https://github.com/solomei-ai/thamyr-sdk/compare/thamyr-core-v4.3.3...thamyr-core-v4.3.4) (2026-09-27)
7
39
 
8
40
 
package/CHANGELOG.md CHANGED
@@ -3,6 +3,52 @@
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
+
38
+ ## [4.3.5](https://github.com/callimacus/thamyr-sdk/compare/thamyr-v4.3.4...thamyr-v4.3.5) (2026-09-29)
39
+
40
+
41
+ ### Bug Fixes
42
+
43
+ * **npm:** publish the five packages as @callimacus/* ([#791](https://github.com/callimacus/thamyr-sdk/issues/791)) ([7beae9a](https://github.com/callimacus/thamyr-sdk/commit/7beae9a15f713602aa73d0ddb8ae82d045a725c0))
44
+
45
+
46
+ ### Dependencies
47
+
48
+ * The following workspace dependencies were updated
49
+ * dependencies
50
+ * @callimacus/thamyr-core bumped from ^4.3.4 to ^4.3.5
51
+
6
52
  ## [4.3.4](https://github.com/solomei-ai/thamyr-sdk/compare/thamyr-v4.3.3...thamyr-v4.3.4) (2026-09-27)
7
53
 
8
54
 
package/MIGRATION.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Thamyr SDK migration guide
2
2
 
3
- This file ships inside every `@callimacus/thamyr*` package; the same guide is published at [docs.callimacus.ai/thamyr-sdk/8-migration](https://docs.callimacus.ai/thamyr-sdk/8-migration) (Callimacus account required). It covers every break since 1.x; release-by-release detail is in `CHANGELOG.md` (this package) and, in the framework packages, `CHANGELOG.core.md` (the contract and types — in `@callimacus/thamyr-core` that is `CHANGELOG.md` itself).
3
+ This file ships inside every `@solomei-ai/thamyr*` package; the same guide is published at [docs.callimacus.ai/thamyr-sdk/8-migration](https://docs.callimacus.ai/thamyr-sdk/8-migration) (Callimacus account required). It covers every break since 1.x; release-by-release detail is in `CHANGELOG.md` (this package) and, in the framework packages, `CHANGELOG.core.md` (the contract and types — in `@solomei-ai/thamyr-core` that is `CHANGELOG.md` itself).
4
4
 
5
5
  **The wire protocol has not changed since v1.** Any major talks to the same server, so upgrading is an exercise you can schedule: bump, run your type checker, work through the errors. Every signature change is compile-time; three things are not — error handling, retries, and since 4.0.2 the constructor rejecting an empty or relative `endpoint` — so read [Error handling](#error-handling) and [`endpoint` must be an absolute URL](#endpoint-must-be-an-absolute-url-402) before you start.
6
6
 
@@ -8,7 +8,7 @@ This file ships inside every `@callimacus/thamyr*` package; the same guide is pu
8
8
 
9
9
  Sites still on 1.x (the last 1.x release is 1.8.2) cross three majors at once. Work through the errors in this order:
10
10
 
11
- 1. **`@callimacus/common` imports.** The package left the dependency tree in v2.0.0; every wire type and enum a client needs is exported by `@callimacus/thamyr`. One rewrite — see [`@callimacus/common` is no longer a dependency](#solomei-aicommon-is-no-longer-a-dependency). Imports from `@callimacus/thamyr-core` keep working (`@callimacus/thamyr` re-exports all of it), but declare the package or import from `@callimacus/thamyr` instead of relying on hoisting.
11
+ 1. **`@solomei-ai/common` imports.** The package left the dependency tree in v2.0.0; every wire type and enum a client needs is exported by `@solomei-ai/thamyr`. One rewrite — see [`@solomei-ai/common` is no longer a dependency](#solomei-aicommon-is-no-longer-a-dependency). Imports from `@solomei-ai/thamyr-core` keep working (`@solomei-ai/thamyr` re-exports all of it), but declare the package or import from `@solomei-ai/thamyr` instead of relying on hoisting.
12
12
  2. **`accessToken` → `clientId`** on the constructor / `useInitThamyr` — see [Initialization](#initialization-accesstoken--clientid).
13
13
  3. **Contract methods take one parameters object and resolve `{data, error, response}`; none of them rejects on HTTP status** (only `sitemap.getSitemap()` still does). Read [Error handling](#error-handling) before touching code that caught or retried — a `catch` on `err.status` silently stops running, and a retry-on-500 handler can loop. Signature-by-signature mapping under [New method signatures](#new-method-signatures-on-the-api-namespaces).
14
14
  4. **`language` is required** on `content.*` — v1 sent `'en'` when you omitted it. Pass `'en'` to keep behaviour identical, or your real locale to fix it.
@@ -16,10 +16,10 @@ Sites still on 1.x (the last 1.x release is 1.8.2) cross three majors at once. W
16
16
  6. **Protocol enums are `as const` objects.** Runtime values are unchanged; `Enum.member` in a type position becomes `typeof Enum.member` — see [Protocol enums](#protocol-enums-are-as-const-objects).
17
17
  7. **Salesforce `c_*` attributes and media extras are `unknown`** on `Basket`, on each `ProductItem` and on `Image.properties.cloudinary` — declare your shapes once, see [Custom attributes](#custom-attributes-are-unknown).
18
18
  8. **v4:** `skesis.*` takes a parameters object and resolves the envelope; `products.*` is deprecated but stays; `endpoint` must be an absolute URL; `Basket.basketId` is required — see [Migrating to v4](#migrating-to-v4).
19
- 9. **Ride-along:** `@callimacus/intent` moves to 2.1.2 or later — see [Intent SDK 2.1.2 rides along](#intent-sdk-212-rides-along).
19
+ 9. **Ride-along:** `@solomei-ai/intent` moves to 2.1.2 or later — see [Intent SDK 2.1.2 rides along](#intent-sdk-212-rides-along).
20
20
  10. **Deploy:** if your build copies `VITE_*` variables into `.env`, delete those lines — see [`endpoint` must be an absolute URL](#endpoint-must-be-an-absolute-url-402).
21
21
 
22
- Dependencies your build scripts only had transitively through `@callimacus/common` (a `zod` import in a script, for instance) disappear too — declare them yourself.
22
+ Dependencies your build scripts only had transitively through `@solomei-ai/common` (a `zod` import in a script, for instance) disappear too — declare them yourself.
23
23
 
24
24
  The call sites a storefront on 1.x most often has, v1 → v4 in one hop:
25
25
 
@@ -97,11 +97,11 @@ Reading code is unaffected by all of these; hand-written fixtures and mocks type
97
97
 
98
98
  ## Intent SDK 2.1.2 rides along
99
99
 
100
- `@callimacus/thamyr-core` 4 requires `@callimacus/intent` 2.1.2 or later, so npm upgrades a 2.0.x lock on the same install. If your site calls the Intent SDK directly, read its changelog entries for 2.1.0 (platform-free core, [#278](https://github.com/callimacus/intent-sdk/issues/278)) and 2.1.1 (hrefs that lead nowhere are dropped instead of forwarded, [#289](https://github.com/callimacus/intent-sdk/issues/289)), and verify the consent banner on staging: accepting sets the `intent_sid` cookie, revoking clears it. If your site declares its own `@callimacus/intent` dependency, bump its range to `^2.1.2` — or drop it and import `initIntent` / `setConsent` from `@callimacus/thamyr`, which re-exports the Intent SDK — and check that `npm ls @callimacus/intent` shows a single copy.
100
+ `@solomei-ai/thamyr-core` 4 requires `@solomei-ai/intent` 2.1.2 or later, so npm upgrades a 2.0.x lock on the same install. If your site calls the Intent SDK directly, read its changelog entries for 2.1.0 (platform-free core, [#278](https://github.com/solomei-ai/intent-sdk/issues/278)) and 2.1.1 (hrefs that lead nowhere are dropped instead of forwarded, [#289](https://github.com/solomei-ai/intent-sdk/issues/289)), and verify the consent banner on staging: accepting sets the `intent_sid` cookie, revoking clears it. If your site declares its own `@solomei-ai/intent` dependency, bump its range to `^2.1.2` — or drop it and import `initIntent` / `setConsent` from `@solomei-ai/thamyr`, which re-exports the Intent SDK — and check that `npm ls @solomei-ai/intent` shows a single copy.
101
101
 
102
102
  # Migrating to v3: cart becomes a contract namespace
103
103
 
104
- v3.0.0 (2026-08-07, [#725](https://github.com/callimacus/thamyr-sdk/issues/725)). The `cart` namespace joined the generated contract surface: methods take a flat parameters object and resolve `{data, error, response}` like the other contract namespaces, and the `CartAPI` class export is gone (the `Basket`/`ProductItem` types remain, now generated from Salesforce's own published schema). `useCart()` keeps its method names and positional arguments, but resolves the envelope instead of the bare basket:
104
+ v3.0.0 (2026-08-07, [#725](https://github.com/solomei-ai/thamyr-sdk/issues/725)). The `cart` namespace joined the generated contract surface: methods take a flat parameters object and resolve `{data, error, response}` like the other contract namespaces, and the `CartAPI` class export is gone (the `Basket`/`ProductItem` types remain, now generated from Salesforce's own published schema). `useCart()` keeps its method names and positional arguments, but resolves the envelope instead of the bare basket:
105
105
 
106
106
  | v1 / v2 | v3+ |
107
107
  | ---------------------------------------------- | ------------------------------------------------------------------ |
@@ -118,7 +118,7 @@ The `commerce-sdk-isomorphic` dependency left with `CartAPI`; non-SFCC consumers
118
118
  Salesforce `c_*` attributes on `Basket` **and on each `ProductItem` in `Basket.productItems`**, and extra keys on `Image.properties.cloudinary` (beyond its typed `publicId`, `cloudName` and `secureDistribution`), are typed `[key: string]: unknown` (v1: `any`). Every former `any` access is now TS18046 `'basket.c_x' is of type 'unknown'` (or TS2322 where the value lands in a typed slot) — typically in templates and components far from the SDK call. Declare your project's shapes once and cast at the boundary:
119
119
 
120
120
  ```ts
121
- import type {Basket, ProductItem} from '@callimacus/thamyr';
121
+ import type {Basket, ProductItem} from '@solomei-ai/thamyr';
122
122
 
123
123
  type MyItem = ProductItem & {c_image?: string; c_analytics?: {color?: {code: string}}};
124
124
  type MyBasket = Basket & {c_productsQuantity: number; productItems?: MyItem[]};
@@ -133,22 +133,22 @@ The product family is different: on `VariationGroup`, `MasterProduct`, `SetProdu
133
133
 
134
134
  v2 aligns the SDK's types and methods exactly with what the platform serves, and every surface deprecated during v1 is gone. The wire protocol is unchanged — a v1 SDK and a v2 SDK speak to the same server identically; everything below is compile-time.
135
135
 
136
- ## `@callimacus/common` is no longer a dependency
136
+ ## `@solomei-ai/common` is no longer a dependency
137
137
 
138
- v1 pulled `@callimacus/common` — and its server-side dependency tree (langchain, openai, mysql2, zod, uuid, …) — into every browser bundle, and many sites imported wire types from it directly without declaring it. v2 drops it, so those imports fail with `Cannot find module '@callimacus/common'` after the bump. Every type and enum a site takes from it is exported by `@callimacus/thamyr` (through `@callimacus/thamyr-core`), so the migration is a rename:
138
+ v1 pulled `@solomei-ai/common` — and its server-side dependency tree (langchain, openai, mysql2, zod, uuid, …) — into every browser bundle, and many sites imported wire types from it directly without declaring it. v2 drops it, so those imports fail with `Cannot find module '@solomei-ai/common'` after the bump. Every type and enum a site takes from it is exported by `@solomei-ai/thamyr` (through `@solomei-ai/thamyr-core`), so the migration is a rename:
139
139
 
140
140
  ```sh
141
141
  # macOS
142
- grep -rl '@callimacus/common' src | xargs sed -i '' 's#@callimacus/common#@callimacus/thamyr#g'
142
+ grep -rl '@solomei-ai/common' src | xargs sed -i '' 's#@solomei-ai/common#@solomei-ai/thamyr#g'
143
143
  # GNU
144
- grep -rl '@callimacus/common' src | xargs sed -i 's#@callimacus/common#@callimacus/thamyr#g'
144
+ grep -rl '@solomei-ai/common' src | xargs sed -i 's#@solomei-ai/common#@solomei-ai/thamyr#g'
145
145
  ```
146
146
 
147
147
  Then merge any duplicated import statements and run your type checker: a name it still cannot find was a server-side helper with no client equivalent (`Chapter.fromSLChapter`, `Story.fromSLStory`, `story.getHistoryMessages()`).
148
148
 
149
- Do **not** add `@callimacus/common` back as a dependency: its current majors (12.x) are a server-side package (mysql2, winston, openai, langchain) that is not kept in step with the SDK's wire types.
149
+ Do **not** add `@solomei-ai/common` back as a dependency: its current majors (12.x) are a server-side package (mysql2, winston, openai, langchain) that is not kept in step with the SDK's wire types.
150
150
 
151
- The wire types and enums a v1 site imported from `@callimacus/common`, all exported by `@callimacus/thamyr` 4.x — types: `Basket`, `BCProduct`, `Block`, `Chapter`, `CustomBlock`, `ErrorMessage`, `Gallery`, `GenericProduct`, `HomePage`, `Image`, `LegacyBlock`, `LocalizedEPArtwork`, `LocalizedEPChapter`, `MasterProduct`, `MasterProductWithVariationGroup`, `OptionItem`, `ProductItem`, `ProductMatch`, `RecommendationsResponse`, `SetProduct`, `SkesisItem`, `SkesisRelatedResponse`, `SkesisSimilarResponse`, `SLDocument`, `SLDocumentSection`, `SLInputEvent`, `Story`, `ThamyrResponse`, `Topic`, `TopicContentsPage`, `TopicSummary`, `Variant`, `VariationAttribute`, `VariationGroup`, `Video`, `WhisperPayload`. Values: `ChapterStatus`, `ClientEvents`, `GalleryMode`, `isCustomBlock`, `isMasterProduct`, `isSetProduct`, `ServerEvents`, `SLInputEventType`, `ThamyrResponseType`.
151
+ The wire types and enums a v1 site imported from `@solomei-ai/common`, all exported by `@solomei-ai/thamyr` 4.x — types: `Basket`, `BCProduct`, `Block`, `Chapter`, `CustomBlock`, `ErrorMessage`, `Gallery`, `GenericProduct`, `HomePage`, `Image`, `LegacyBlock`, `LocalizedEPArtwork`, `LocalizedEPChapter`, `MasterProduct`, `MasterProductWithVariationGroup`, `OptionItem`, `ProductItem`, `ProductMatch`, `RecommendationsResponse`, `SetProduct`, `SkesisItem`, `SkesisRelatedResponse`, `SkesisSimilarResponse`, `SLDocument`, `SLDocumentSection`, `SLInputEvent`, `Story`, `ThamyrResponse`, `Topic`, `TopicContentsPage`, `TopicSummary`, `Variant`, `VariationAttribute`, `VariationGroup`, `Video`, `WhisperPayload`. Values: `ChapterStatus`, `ClientEvents`, `GalleryMode`, `isCustomBlock`, `isMasterProduct`, `isSetProduct`, `ServerEvents`, `SLInputEventType`, `ThamyrResponseType`.
152
152
 
153
153
  ## Initialization: `accessToken` → `clientId`
154
154
 
@@ -232,7 +232,7 @@ Two consequences for code written against v1:
232
232
  - **Anything that keyed off `err.status` in a `catch` stops running** unless the call opts into throwing. Either read `error` and `response?.status` from the envelope, or keep the v1 contract with the option the generated client already has:
233
233
 
234
234
  ```ts
235
- import {ThamyrHttpError} from '@callimacus/thamyr';
235
+ import {ThamyrHttpError} from '@solomei-ai/thamyr';
236
236
 
237
237
  const {data: basket} = await thamyr.cart.getCart({throwOnError: true}); // Basket, or rejects
238
238
 
@@ -255,7 +255,7 @@ Two consequences for code written against v1:
255
255
  - `ThamyrResponse` gains the `story-reset` variant, `chapter-deleted` carries the deprecated `roundId` alias, custom blocks carry `name` and `metaJson`, and `ErrorMessage` gains optional `reason`.
256
256
  - Protocol enums (`SLInputEventType`, `ThamyrResponseType`, `ChapterStatus`, …) keep their members and values; comparisons and switches are unaffected — but they are `as const` objects now, not TypeScript `enum`s, which changes two idioms: see [below](#protocol-enums-are-as-const-objects).
257
257
  - New exports: the `isCustomBlock` block guard, the `CallimacusApi` client class and `createContractClient` (thamyr-core), and the full product family (`BCProduct`, `SetProduct`, `VariationGroup`, …).
258
- - `@callimacus/common` is no longer a dependency (nor `uuid`) — see [above](#solomei-aicommon-is-no-longer-a-dependency).
258
+ - `@solomei-ai/common` is no longer a dependency (nor `uuid`) — see [above](#solomei-aicommon-is-no-longer-a-dependency).
259
259
 
260
260
  ## Protocol enums are `as const` objects
261
261
 
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 a{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)}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 i{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 c="https://api.callimacus.ai";function l(n){const e=n??c;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 ${c}, got ${JSON.stringify(n)}. Omit it to use the default.`);return e}class h extends o{config;websocketManager;sitemap;constructor(n){const t=l(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 i({accessToken:o,endpoint:t}),this.websocketManager=new a({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)}onResponse(n){this.websocketManager.onResponse(n)}onError(n){this.websocketManager.onError(n)}}export{i as SitemapAPI,h as Thamyr,a as WebsocketManager};
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
@@ -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":";;;;;;;+MA+FaA,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,oBAAoBR,GAIvCC,KAAKQ,sBAEDb,GACHK,KAAKS,QAAQb,EAAKC,EAEpB,CAKQ,mBAAAW,GACPF,EAAkBI,mBAAmBC,IAChCX,KAAKX,kCACRW,KAAKX,iCAAiCsB,KAIxCL,EAAkBM,iBAAiBC,IAC9Bb,KAAKV,oBACRU,KAAKV,mBAAmBuB,KAI1BP,EAAkBH,QAASW,IACtBd,KAAKT,iBACRS,KAAKT,gBAAgBuB,IAGxB,CAQO,OAAAL,CAAQb,EAAM,uBAAwBC,GAG5C,MAAMkB,EAA4B,iBAAVlB,GAAgC,KAAVA,EAExCmB,EAAUD,EAAW,CAACE,cAAe,UAAUpB,UAAWQ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ACD,CAbMG,CAAcJ,GAClB,MAAM,IAAIJ,MAAM,yDAAyDC,UAAyBQ,KAAKC,UAAUP,mCAGlH,OAAOC,CACR,CAeM,MAAOO,UAAeC,EAOCxB,OANXyB,iBAIDC,QAEhB,WAAA7D,CAA4BmC,GAQ3B,MAAMe,EAAWD,EAAgBd,EAAOe,WAClCY,SAACA,GAAY3B,EAGnB,IAAK2B,EACJ,MAAM,IAAIf,MAAM,iFAOjBgB,MAAM,CAAC3B,OAAQC,EAAqB,CAAC2B,YAAaF,EAAUZ,WAAUe,iBAAiB,MApB5D1D,KAAA4B,OAAAA,EAsB3B5B,KAAKsD,QAAU,IAAI3B,EAAW,CAC7B8B,YAAaF,EACbZ,aAGD3C,KAAKqD,iBAAmB,IAAIjE,EAAiB,CAC5CQ,IAAK+C,EACLhD,aAAa,EACbE,MAAO0D,EACPxD,WAAY6B,EAAO7B,YAErB,CAEA,SAAA4D,CAAUC,EAAaC,GACtB,MAAMC,EAAO,IAAIC,KAAK,CAACH,GAAQ,iBAAkB,CAACvC,KAAMuC,EAAMvC,OAC9DrB,KAAKoB,oBAAoB4C,EAAoBC,aAAc,CAC1DC,WAAY,CACX7C,KAAM8C,EAAiBC,SACvBpC,KAAM,CAACa,MAAOgB,GAAS,GAAIC,UAG9B,CAEA,mBAAA1C,CAAmDC,EAASC,GAC3DtB,KAAKqD,iBAAiBjC,oBAAoBC,EAAMC,EACjD,CAEA,UAAApB,CAAWwB,GACV1B,KAAKqD,iBAAiBnD,WAAWwB,EAClC,CAEA,OAAAvB,CAAQuB,GACP1B,KAAKqD,iBAAiBlD,QAAQuB,EAC/B"}
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,oBAAoBR,GAIvCC,KAAKQ,sBAEDb,GACHK,KAAKS,QAAQb,EAAKC,EAEpB,CAKQ,mBAAAW,GACPF,EAAkBI,mBAAmBC,IAChCX,KAAKX,kCACRW,KAAKX,iCAAiCsB,KAIxCL,EAAkBM,iBAAiBC,IAC9Bb,KAAKV,oBACRU,KAAKV,mBAAmBuB,KAI1BP,EAAkBH,QAASW,IACtBd,KAAKT,iBACRS,KAAKT,gBAAgBuB,IAGxB,CAQO,OAAAL,CAAQb,EAAM,uBAAwBC,GAG5C,MAAMkB,EAA4B,iBAAVlB,GAAgC,KAAVA,EAExCmB,EAAUD,EAAW,CAACE,cAAe,UAAUpB,UAAWQ,EAC1Da,EAAOH,EA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,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"}
@@ -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.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.3.4"
38
+ "@callimacus/thamyr-core": "^4.4.0"
39
39
  },
40
40
  "gitHead": "fafba2c8ca0586f95b1d03c5eede356a53b00886",
41
41
  "devDependencies": {