@callimacus/thamyr-react 4.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/LICENSE.md ADDED
@@ -0,0 +1,73 @@
1
+ # Solomei AI Commercial SDK License
2
+
3
+ Copyright © 2025–2026 Solomei AI SRL. All rights reserved.
4
+
5
+ This software (the "SDK") is proprietary software of Solomei AI SRL
6
+ ("Solomei"). It is published for distribution convenience only. It is **not**
7
+ open-source software, and no rights are granted except as stated below.
8
+
9
+ ## 1. License grant
10
+
11
+ Subject to these terms, Solomei grants you a limited, non-exclusive,
12
+ non-transferable, non-sublicensable, revocable license to install, integrate,
13
+ and use the SDK **solely**:
14
+
15
+ (a) in connection with the Callimacus platform, under an active commercial
16
+ agreement between you (or the organization you act for) and Solomei; and
17
+
18
+ (b) in accordance with the applicable documentation at
19
+ https://docs.callimacus.ai.
20
+
21
+ The license includes the right to serve unmodified copies of the SDK's built
22
+ artifacts to end users of your own websites and applications as an integral
23
+ part of a Callimacus integration.
24
+
25
+ ## 2. Restrictions
26
+
27
+ Except as expressly permitted above, you may not:
28
+
29
+ - use the SDK without an active commercial agreement with Solomei;
30
+ - redistribute, sell, sublicense, rent, or otherwise make the SDK available
31
+ as a standalone artifact or as part of a competing product or service;
32
+ - modify the SDK or create derivative works of it, other than configuration
33
+ and integration code written against its documented public interfaces;
34
+ - reverse engineer, decompile, or disassemble the SDK, except to the extent
35
+ such a restriction is prohibited by applicable law;
36
+ - remove or alter any copyright, license, or attribution notice contained in
37
+ the SDK.
38
+
39
+ ## 3. Termination
40
+
41
+ This license terminates automatically when your commercial agreement with
42
+ Solomei ends or when you breach these terms. Upon termination you must stop
43
+ using the SDK and remove it from your applications. Sections 4 and 5 survive
44
+ termination.
45
+
46
+ ## 4. Disclaimer of warranty
47
+
48
+ THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE", WITHOUT WARRANTY OF ANY KIND,
49
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
50
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
51
+ NON-INFRINGEMENT. ANY WARRANTY APPLICABLE TO THE CALLIMACUS PLATFORM ITSELF IS
52
+ GOVERNED EXCLUSIVELY BY YOUR COMMERCIAL AGREEMENT WITH SOLOMEI.
53
+
54
+ ## 5. Limitation of liability
55
+
56
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL SOLOMEI
57
+ BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE
58
+ DAMAGES, OR ANY LOSS OF PROFITS, REVENUE, DATA, OR GOODWILL, ARISING OUT OF OR
59
+ IN CONNECTION WITH THE SDK, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
60
+ DAMAGES. SOLOMEI'S AGGREGATE LIABILITY ARISING OUT OF OR RELATING TO THE SDK
61
+ SHALL NOT EXCEED THE AMOUNTS PAID BY YOU TO SOLOMEI UNDER YOUR COMMERCIAL
62
+ AGREEMENT IN THE TWELVE (12) MONTHS PRECEDING THE CLAIM.
63
+
64
+ ## 6. Governing law
65
+
66
+ This license is governed by the laws of Italy, without regard to its conflict
67
+ of law provisions. Any dispute shall be subject to the exclusive jurisdiction
68
+ of the courts of Milan, Italy, unless your commercial agreement with Solomei
69
+ provides otherwise.
70
+
71
+ ---
72
+
73
+ For licensing questions, contact Solomei AI SRL at https://solomei.ai.
package/MIGRATION.md ADDED
@@ -0,0 +1,271 @@
1
+ # Thamyr SDK migration guide
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).
4
+
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
+
7
+ ## Coming from v1
8
+
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
+
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.
12
+ 2. **`accessToken` → `clientId`** on the constructor / `useInitThamyr` — see [Initialization](#initialization-accesstoken--clientid).
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
+ 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.
15
+ 5. **Cart** follows the same shape since v3.0.0 — see [Migrating to v3](#migrating-to-v3-cart-becomes-a-contract-namespace).
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
+ 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
+ 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).
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
+
22
+ Dependencies your build scripts only had transitively through `@callimacus/common` (a `zod` import in a script, for instance) disappear too — declare them yourself.
23
+
24
+ The call sites a storefront on 1.x most often has, v1 → v4 in one hop:
25
+
26
+ | v1 | v4 |
27
+ | --- | --- |
28
+ | `const basket = await thamyr.cart.getCart()` | `const {data: basket, error, response} = await thamyr.cart.getCart()` |
29
+ | `thamyr.cart.addItemToCart(id)` | `thamyr.cart.addItemToCart({productId: id})` — same envelope; `removeItemFromCart` and `updateProductQuantity({productId, quantity})` alike |
30
+ | `const page = await thamyr.content.getPage(id)` | `const {data: page} = await thamyr.content.getPage({language: 'en', id})` (`'en'` was v1's hidden default) |
31
+ | `thamyr.products.getSimilarProducts(sku, 50)` | `const {data} = await thamyr.products.getSimilar({productId: sku, topK: 50})` — deprecated in v4 but kept, see [below](#products-is-deprecated--and-stays-through-4x) |
32
+ | `thamyr.products.getRecommendations(sku)` | `const {data} = await thamyr.products.getRecommendations({productId: sku})` |
33
+ | `thamyr.getWhisper(storyId)` | `const {data, response} = await thamyr.whisper.getLast({storyId})` → `data?.whisper`; `response?.status === 404` means none yet |
34
+ | `thamyr.analytics.trackEvent(storyId, name, content, payload)` | `void thamyr.analytics.trackEvent({storyId, eventName: name, content, payload})` — `content` is a `string` |
35
+
36
+ Prefer keeping v1's "resolve the payload, reject on failure" contract at your call sites? Pass `{throwOnError: true}` to the call: `const {data: basket} = await thamyr.cart.getCart({throwOnError: true})` is a `Basket` or a rejection, and from 4.1.0 the rejection is a `ThamyrHttpError` carrying `status` — see [Error handling](#error-handling). Under that option a 404 (the whisper row's "none yet") rejects with `status === 404`, and a fire-and-forget `void trackEvent(...)` needs a `.catch`.
37
+
38
+ # Migrating to v4
39
+
40
+ v4.0.0 (2026-09-02) re-vendors the current platform contract, with follow-ups in 4.0.1, 4.0.2 and 4.0.3 (2026-09-03). The wire protocol is unchanged — a v3 SDK and a v4 SDK speak to the same server identically; everything below is compile-time, with one exception: since 4.0.2 the constructor throws at startup on an empty or relative `endpoint` that earlier versions accepted (see below).
41
+
42
+ ## `skesis` is a generated namespace; `SkesisAPI` and axios are gone
43
+
44
+ The two graph reads joined the public contract, so `thamyr.skesis` is now generated like every other namespace: a single parameters object in, `{data, error, response}` out.
45
+
46
+ | v3 | v4 |
47
+ | ----------------------------------------------------- | --------------------------------------------------------------------- |
48
+ | `const r = await thamyr.skesis.similar(id, {topK})` | `const {data: r} = await thamyr.skesis.similar({anchorId: id, topK})` |
49
+ | `const r = await thamyr.skesis.related(id, {locale})` | `const {data: r} = await thamyr.skesis.related({anchorId: id, locale})` |
50
+ | `new SkesisAPI({accessToken, endpoint})` | use `thamyr.skesis` (the class export is removed) |
51
+
52
+ `SkesisItem`, `SkesisSimilarResponse` and `SkesisRelatedResponse` keep their names (now generated from the contract). react's `useSkesis()` keeps its positional arguments but resolves the envelope, like `useCart()`. As everywhere, narrow on `data` rather than `error` (`error` is `unknown`; a failed engine call is a 502 with `{error, errorId}`).
53
+
54
+ `SitemapAPI.getSitemap()` still resolves the XML text directly, but runs on the same fetch client as everything else: a failure rejects with an `Error` carrying `status` instead of an `AxiosError`, and `handleError` is gone. The SDK no longer depends on axios at all.
55
+
56
+ ## `products.*` is deprecated — and stays through 4.x
57
+
58
+ `thamyr.products.getSimilar` and `thamyr.products.getRecommendations` are flagged `@deprecated` (strikethrough in the editor, a hit under `@typescript-eslint/no-deprecated`). Their eventual replacement is the skesis graph reads, `thamyr.skesis.similar` / `thamyr.skesis.related`. The shapes differ: skesis returns generic items (`{id, kind, locale, fields}`, keyed by your project's semantics), not `ProductMatch` with the full product payload, and `anchorId` is a full item id (`sfcc:product:123`). There is no hydration from skesis items to products yet, so a storefront that renders `ProductMatch.product` (set products, image groups, variation groups) or needs the direct/inverse recommendation split has no drop-in replacement today.
59
+
60
+ Keep calling `products.*`. The methods stay for the whole of 4.x and survive the next platform contract re-vendor: their removal is not tied to the platform's version number. They leave the SDK only after a skesis read that returns product payloads (or a documented hydration path) exists, in a major announced ahead of time in the changelog and in this guide. Until then there is nothing to migrate to.
61
+
62
+ ## Product family types alias the Output components
63
+
64
+ `BCProduct`, `SetProduct`, `MasterProduct`, `MasterProductWithVariationGroup` and `VariationGroup` now alias the `…Output` components of the contract — the ones every response actually references. Their shapes are unchanged from v3; the few fields that did move are listed under [Type-level changes in v4](#type-level-changes-in-v4). `SetProduct.setProducts` (the set's members) is as before; `SetProduct.fullSetProducts` is `MasterProductWithVariationGroup[]`.
65
+
66
+ ## `Variant` keeps its meaning; `VariationAttribute` is new (4.0.1)
67
+
68
+ In 4.0.0 the upstream document used the component id `Variant` for the variation **attribute** definition (`{id, name, values}`); 4.0.1 re-vendors the corrected document. `Variant` is the variant **product** as in v3 — the items of `MasterProduct.variants` (`productId`, `orderable`, `variationValues`, `productPromotions`) — and `VariationAttribute`, exported since 4.0.0, is the items of `MasterProduct.variationAttributes`. Nothing to change unless you imported `Variant` from the generated types directly on 4.0.0.
69
+
70
+ ## `endpoint` must be an absolute URL (4.0.2)
71
+
72
+ The constructor validates `endpoint`. Omitting it (or passing `undefined`) still selects the public host, `https://api.callimacus.ai`. Anything else must parse as an absolute URL, otherwise `new Thamyr(…)` throws `[thamyr] \`endpoint\` must be an absolute URL …` naming the value it got — the same contract `clientId` has had since v2. Before, an empty string sailed through and failed later inside the contract client as an opaque `Failed to construct 'URL': Invalid base URL`.
73
+
74
+ The empty string is the case to watch when the value comes from a build-time variable. Vite inlines `import.meta.env.VITE_X` as `""` when the variable is present but empty, and `"" ?? default` is `""`. A build spec that copies variables into `.env` unconditionally —
75
+
76
+ ```yaml
77
+ - echo "VITE_CALLIMACUS_ENDPOINT=$VITE_CALLIMACUS_ENDPOINT" >> .env
78
+ ```
79
+
80
+ — writes `VITE_CALLIMACUS_ENDPOINT=` whenever the hosting variable is unset, and every page then throws at startup. Delete those lines: your CI (Amplify, GitHub Actions, …) already exports the variables into the build shell, and Vite reads `VITE_*` from the process environment with the highest priority, so an unset variable stays `undefined` and the default applies. If your storefront proxies the API through its own domain, keep passing the proxy URL explicitly — the SDK never falls back to the public host on your behalf.
81
+
82
+ ## `Basket.basketId` is required (4.0.3)
83
+
84
+ Every cart operation returns a persisted basket, so this is what the server always sent — and it is what makes passing the `{data, error, response}` envelope where a `Basket` is expected (`getCart().then((basket: Basket) => …)`, the v1 shape) a compile error instead of a silent runtime break. Salesforce `c_*` custom attributes stay `unknown` off the bare type — see [Custom attributes are `unknown`](#custom-attributes-are-unknown).
85
+
86
+ ## Type-level changes in v4
87
+
88
+ Reading code is unaffected by all of these; hand-written fixtures and mocks typed as these shapes may need updating.
89
+
90
+ - `MasterProduct.price` is `number` (v3: `number | null`). Propagates to `MasterProductWithVariationGroup`, `SetProduct.fullSetProducts[]`, `ProductMatch.product`, `BCProduct`, `GenericProduct`.
91
+ - `SLDocument.id` and `SLDocument.documentGroupId` are required (v3: optional), and `SLDocument.lastUpdate: string` is new and required.
92
+ - `SLDocumentSection.id` and `SLDocumentSection.document` are required (v3: optional).
93
+ - These propagate to `Block`, `LegacyBlock`, `HomePage`, `TopicContentsPage` and `RecommendationsResponse`.
94
+ - `CustomBlock<T = unknown>` stays generic over its `data`; `isCustomBlock(block)` narrows to `CustomBlock`.
95
+ - react `useCart()` members resolve the `{data, error, response}` envelope exactly (4.0.3 — on v3 and 4.0.0–4.0.2 they returned a union that also carried the throwing branch, so the hook's own `const {data, error} = await addItem(id)` example did not compile).
96
+ - Unchanged, and needing nothing: `UserInteraction`, `Variant`, `VariationGroup`, the skesis types (`SkesisItem` only gains an open index signature), every protocol enum.
97
+
98
+ ## Intent SDK 2.1.2 rides along
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.
101
+
102
+ # Migrating to v3: cart becomes a contract namespace
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:
105
+
106
+ | v1 / v2 | v3+ |
107
+ | ---------------------------------------------- | ------------------------------------------------------------------ |
108
+ | `const cart = await thamyr.cart.getCart()` | `const {data: cart, error} = await thamyr.cart.getCart()` |
109
+ | `thamyr.cart.addItemToCart(id)` | `thamyr.cart.addItemToCart({productId: id})` |
110
+ | `thamyr.cart.removeItemFromCart(id)` | `thamyr.cart.removeItemFromCart({productId: id})` |
111
+ | `thamyr.cart.updateProductQuantity(id, q)` | `thamyr.cart.updateProductQuantity({productId: id, quantity: q})` |
112
+ | `new CartAPI({accessToken, endpoint})` | use `thamyr.cart` (or `new Thamyr({clientId}).cart`) |
113
+
114
+ The `commerce-sdk-isomorphic` dependency left with `CartAPI`; non-SFCC consumers no longer install a Salesforce package. The v0.45-deprecated cart wrappers (`thamyr.getCart()` etc.) are also gone; use `thamyr.cart.*`.
115
+
116
+ ## Custom attributes are `unknown`
117
+
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
+
120
+ ```ts
121
+ import type {Basket, ProductItem} from '@callimacus/thamyr';
122
+
123
+ type MyItem = ProductItem & {c_image?: string; c_analytics?: {color?: {code: string}}};
124
+ type MyBasket = Basket & {c_productsQuantity: number; productItems?: MyItem[]};
125
+
126
+ const {data} = await thamyr.cart.getCart();
127
+ const basket = data as MyBasket | undefined;
128
+ ```
129
+
130
+ The product family is different: on `VariationGroup`, `MasterProduct`, `SetProduct` and `Variant` the contract types each `c_*` attribute explicitly (`VariationGroup.c_color: string`, `Variant.c_formattedPrice?: string`, …) and has no index signature, so a known attribute compiles as before and an attribute the contract does not list fails with TS2339 "does not exist" — that one needs a declaration on the contract side, not a cast.
131
+
132
+ # Migrating to v2
133
+
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
+
136
+ ## `@callimacus/common` is no longer a dependency
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:
139
+
140
+ ```sh
141
+ # macOS
142
+ grep -rl '@callimacus/common' src | xargs sed -i '' 's#@callimacus/common#@callimacus/thamyr#g'
143
+ # GNU
144
+ grep -rl '@callimacus/common' src | xargs sed -i 's#@callimacus/common#@callimacus/thamyr#g'
145
+ ```
146
+
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
+
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.
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`.
152
+
153
+ ## Initialization: `accessToken` → `clientId`
154
+
155
+ The deprecated `accessToken` alias is removed from both entry points. Same `cal-pk-…` value, new key:
156
+
157
+ ```ts
158
+ // Before
159
+ new Thamyr({accessToken: 'cal-pk-…'});
160
+ useInitThamyr({accessToken: 'cal-pk-…'});
161
+
162
+ // After
163
+ new Thamyr({clientId: 'cal-pk-…'});
164
+ useInitThamyr({clientId: 'cal-pk-…'});
165
+ ```
166
+
167
+ ## New method signatures on the API namespaces
168
+
169
+ `thamyr.content`, `thamyr.products`, `thamyr.whisper` and `thamyr.analytics` keep their names; their methods now mirror the platform API one-to-one, take a single flat parameters object, and new endpoints appear as methods automatically with each SDK release. Story sharing moved to a new `thamyr.stories` namespace. The deprecated instance-level wrappers (`thamyr.getPage(...)` and friends) are gone, and react's `useContent`/`useProducts`/`useWhisper`/`useAnalytics` hooks are replaced by a single `useApi()` exposing the same namespaces.
170
+
171
+ Methods resolve `{data, error, response}` and take a second options argument for per-call overrides (`{throwOnError: true}` to throw instead) — see [Error handling](#error-handling).
172
+
173
+ Note: v1 defaulted `language` to `'en'` when omitted. It is required with no server-side fallback, so pass your locale explicitly (only the `products.*` `language` query parameter defaults to `'en'` server-side). Pass `'en'` to keep v1's behaviour exactly.
174
+
175
+ | Removed | Use instead |
176
+ | --------------------------------------------------- | ------------------------------------------------------------------------------ |
177
+ | `content.getPage(id, lang?)` | `thamyr.content.getPage({language, id})` |
178
+ | `content.getTopics(lang?)` | `thamyr.content.listTopics({language})` |
179
+ | `content.getTopicContents(idOrSlug, lang?, opts?)` | `thamyr.content.getTopicContents({language, idOrSlug: String(idOrSlug), ...opts})` |
180
+ | `content.getDocumentBySlug(lang, slug)` | `thamyr.content.getDocumentBySlug({language: lang, slug})` |
181
+ | `content.getDocumentByGroupId(lang, groupId)` | `thamyr.content.getDocumentByGroup({language: lang, groupId})` |
182
+ | `content.getDocumentBySitemapPath(path)` | `thamyr.content.getDocumentByPath({path})` |
183
+ | `content.createShare(storyId)` | `thamyr.stories.share({id: storyId})` |
184
+ | `content.getShare(id)` | `thamyr.stories.getShared({id})` |
185
+ | `products.getSimilarProducts(productId, topK?)` | `thamyr.products.getSimilar({productId, topK})` |
186
+ | `products.getRecommendations(productId)` | `thamyr.products.getRecommendations({productId})` |
187
+ | `whisper.getLast(storyId)` / `thamyr.getWhisper(id)` | `thamyr.whisper.getLast({storyId})` → `data?.whisper` (404 = none yet) |
188
+ | `analytics.trackEvent(storyId, name, content?, p?)` | `void thamyr.analytics.trackEvent({storyId, eventName: name, content, payload: p})` |
189
+
190
+ "Not found" lookups no longer throw: on a 404, `data` is `undefined`, `error` carries the body and `response.status === 404`.
191
+
192
+ The `thamyr.sitemap` namespace (and `useSitemap`) keeps its v1 method. `thamyr.cart` kept its v1 signatures through v2 and joined the contract surface in [v3.0.0](#migrating-to-v3-cart-becomes-a-contract-namespace); `thamyr.skesis` did the same in [v4.0.0](#skesis-is-a-generated-namespace-skesisapi-and-axios-are-gone).
193
+
194
+ ## `likeResponse` removed everywhere
195
+
196
+ `thamyr.content.likeResponse()`, the `thamyr.likeResponse()` wrapper and react's `useContent().likeResponse` are removed with no replacement: the `/evaluate` endpoint they posted to never existed server-side, so every call has always rejected. If response ratings are needed, the endpoint must first be added to the public API.
197
+
198
+ ## `Chapter` and `Story` are plain types, not classes
199
+
200
+ They describe the wire payloads the server sends; nothing client-side should construct them. If you did anyway:
201
+
202
+ ```ts
203
+ // Before
204
+ const chapter = new Chapter();
205
+
206
+ // After — the class only defaulted these three fields:
207
+ const chapter: Chapter = {id: crypto.randomUUID(), deleted: false, status: ChapterStatus.understandingQuery};
208
+ ```
209
+
210
+ `Chapter.fromSLChapter` / `Story.fromSLStory` / `story.getHistoryMessages()` were server-side helpers and have no client equivalent.
211
+
212
+ ## Session id removed
213
+
214
+ The SDK no longer generates a per-instance session id or sends the `x-sl-session-id` header (the server never read it — conversation identity is the server-minted `storyId`, visitor identity is the intent-sdk session). `SitemapAPI`'s config is now `{accessToken, endpoint}`; drop the `sessionId` key if you construct it directly. (`CartAPI` no longer exists since v3.0.0 and `SkesisAPI` since v4.0.0 — cart and skesis are contract namespaces.)
215
+
216
+ ## Error handling
217
+
218
+ The HTTP layer moved from axios to fetch, and HTTP failures are values, not exceptions: `axios.isAxiosError(e)` checks no longer match anything. Every contract call resolves `{data, error, response}`:
219
+
220
+ | Case | `data` | `error` | `response` |
221
+ | --- | --- | --- | --- |
222
+ | 2xx | the payload | `undefined` | set |
223
+ | 4xx / 5xx, including a 404 on a lookup | `undefined` | the parsed body (`{error, errorId}` or a string; `{}` if the body was empty) | set — check `response.status` |
224
+ | network or CORS failure | `undefined` | the fetch `TypeError` | **`undefined`** — read `response?.status` |
225
+
226
+ A 404 is an error like any other 4xx: distinguish it with `response?.status === 404`, not by `error` being absent.
227
+
228
+ `{throwOnError: true}` (the second argument; the first on parameterless methods such as `cart.getCart`) makes a call reject instead, and narrows the result to `{data, request, response}` so `data` is the payload. From 4.1.0 the rejection is a `ThamyrHttpError` — an `Error` with `status` (undefined when no response arrived; 2xx when the response arrived but could not be parsed), `body` (the parsed body, `{}` if it was empty, or the fetch `TypeError`), `response` and `request`. Aborting a call through its `signal` rethrows the abort reason itself. On 4.0.x it threw the bare parsed body: `e.status` was `undefined` and `e instanceof Error` was false for HTTP failures. `sitemap.getSitemap()` rejects with an `Error` carrying `status` since 4.0.0 (an `AxiosError` before). The same applies to react's TanStack Query bridge (`thamyrQueryOptions` / `thamyrMutationOptions`), which calls every method with `throwOnError`: from 4.1.0 a query's `error` is a `ThamyrHttpError` (read `error.body` for the server's `{error, errorId}`), on 4.0.x it was the raw body.
229
+
230
+ Two consequences for code written against v1:
231
+
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
+
234
+ ```ts
235
+ import {ThamyrHttpError} from '@callimacus/thamyr';
236
+
237
+ const {data: basket} = await thamyr.cart.getCart({throwOnError: true}); // Basket, or rejects
238
+
239
+ try {
240
+ await thamyr.cart.addItemToCart({productId}, {throwOnError: true});
241
+ } catch (error) {
242
+ if (error instanceof ThamyrHttpError && error.status === 500) retryOnce();
243
+ }
244
+ ```
245
+
246
+ A `catch` variable is `unknown` under `strict`; narrow with `instanceof ThamyrHttpError` before reading `status`.
247
+
248
+ - **Bound your retries.** A v1 handler that re-fetched on a 500 stopped after one attempt because the second failure rejected. Routed through the envelope, the same handler runs again on every failure and loops on a persistent 500 — add a retry flag or a counter.
249
+
250
+ ## Type-level changes worth knowing
251
+
252
+ - Types now mirror the server exactly, fixing several places where v1's had drifted:
253
+ - `HomePage.topics[].topic` is a `TopicSummary` (`{id, name, slug}`) — the server never sent `description`/`translations`.
254
+ - Document dates (`lastUpdate`, `publishedAt`, …) are ISO **strings** on the wire, and are typed as such.
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
+ - 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
+ - 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).
259
+
260
+ ## Protocol enums are `as const` objects
261
+
262
+ `SLInputEventType`, `ThamyrResponseType`, `ChapterStatus`, `GalleryMode`, `ServerEvents` and `ClientEvents` are `as const` objects plus a same-named union type, not TypeScript `enum`s. (`UserInteractionType` and `CallimacusEvent` remain `enum`s, so `InteractionPayloadMap[UserInteractionType.CREATE_ROUND]` keeps working.) Members and runtime values are unchanged; comparisons and `switch` statements compile as before. Two idioms do not:
263
+
264
+ | v1 | v2+ |
265
+ | --- | --- |
266
+ | `Extract<SLInputEvent, {type: SLInputEventType.customInteraction}>` → TS2702 "only refers to a type, but is being used as a namespace" | `Extract<SLInputEvent, {type: typeof SLInputEventType.customInteraction}>` (or the literal `'customInteraction'`) |
267
+ | `let s = ChapterStatus.done; s = ChapterStatus.craftingAnswer` → TS2322, `s` was inferred as the literal `4` | `let s: ChapterStatus = ChapterStatus.done` |
268
+
269
+ ## Interaction payload types
270
+
271
+ `GetStoryPayload`, `CreateRoundPayload`, … now mirror the server exactly (shapes unchanged). Two visible effects: `BackFromRoundPayload` no longer carries the deprecated `roundId` alias (and the SDK stops sending it — the server accepts `chapterId` alone), and `CreateRoundPayload.storyId` also admits `null`.
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright © 2025–2026 Solomei AI SRL. All rights reserved.
3
+ *
4
+ * Proprietary software, licensed for use by Callimacus customers only.
5
+ * See LICENSE.md for the full terms.
6
+ *
7
+ */
8
+ import{Thamyr as e}from"@solomei-ai/thamyr";import{callimacusService as t}from"@solomei-ai/thamyr-core";import n from"react";const r=e=>{let t;const n=new Set,r=(e,r)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},t,o),n.forEach(n=>n(t,e))}},o=()=>t,s={setState:r,getState:o,getInitialState:()=>i,subscribe:e=>(n.add(e),()=>n.delete(e))},i=t=e(r,o,s);return s},o=e=>e;const s=e=>{const t=(e=>e?r(e):r)(e),s=e=>function(e,t=o){const r=n.useSyncExternalStore(e.subscribe,n.useCallback(()=>t(e.getState()),[e,t]),n.useCallback(()=>t(e.getInitialState()),[e,t]));return n.useDebugValue(r),r}(t,e);return Object.assign(s,t),s};function i(e,t){for(const n of e)try{n(t)}catch(e){console.error("[Thamyr] Listener threw:",e)}}const a=(c?s(c):s)((n,r)=>{let o,s=0;const a=new Set,c=new Set,d=new Set;return{connectionStatus:"idle",messages:[],error:void 0,_initialized:!1,_thamyr:void 0,init(u){if(r()._initialized)return;if("undefined"==typeof window)return void console.debug("[Thamyr] init() skipped: no browser environment detected (SSR).");const{clientId:l}=u;if(!l){console.error("[Thamyr] clientId is required. Pass your Callimacus Client ID (`cal-pk-…`) to useInitThamyr().");const e={code:0,message:"clientId is required. Pass your Callimacus Client ID (`cal-pk-…`) to useInitThamyr()."};return n({connectionStatus:"error",error:e}),i(d,e),void i(c,"error")}void 0!==u.maxMessages&&u.maxMessages<0&&console.warn("[Thamyr] maxMessages must be >= 0. Received:",u.maxMessages,". Clamping to 1.");const m=0===u.maxMessages?1/0:Math.max(1,u.maxMessages??50);let f;n({connectionStatus:"connecting",error:void 0});try{f=new e({clientId:l,endpoint:u.endpoint,uiObserver:u.uiObserver})}catch(e){console.error("[Thamyr] Failed to create Thamyr instance:",e);const t={code:0,message:e instanceof Error?e.message:String(e)};return n({connectionStatus:"error",error:t}),i(d,t),void i(c,"error")}const h=++s;f.onResponse(e=>{s===h&&(n(t=>{const n=[...t.messages,e];return{messages:n.length>m?n.slice(-m):n}}),i(a,e))}),f.onError(e=>{s===h&&(n({error:e,connectionStatus:"error"}),i(d,e),i(c,"error"))}),o=t.onConnectionStatus(e=>{if(s!==h)return;const t=e?"connected":"disconnected";n({connectionStatus:t}),i(c,t)}),function(e){n({_initialized:Boolean(e),_thamyr:e})}(f)},reset(){if(r()._initialized){s++;try{o?.()}catch(e){console.error("[Thamyr] Error unsubscribing connection status listener:",e)}try{t.disconnect()}catch(e){console.error("[Thamyr] Error disconnecting:",e)}o=void 0,n({_initialized:!1,_thamyr:void 0,connectionStatus:"idle",messages:[],error:void 0})}else"idle"!==r().connectionStatus&&n({connectionStatus:"idle",error:void 0})},sendEvent(e,t){const o=r()._thamyr;if(!o)throw new Error("[Thamyr] SDK is not initialized yet. Ensure useInitThamyr() has been called.");const{connectionStatus:s}=r();if("connected"!==s){const e={code:0,message:`Cannot send event: connection status is "${s}". Wait for connected status before sending.`};throw n({error:e}),i(d,e),new Error(e.message)}o.sendUserInteraction(e,t)},sendAudio(e,t){const o=r()._thamyr;if(!o)throw new Error("[Thamyr] SDK is not initialized yet. Ensure useInitThamyr() has been called.");const{connectionStatus:s}=r();if("connected"!==s){const e={code:0,message:`Cannot send audio: connection status is "${s}". Wait for connected status before sending.`};throw n({error:e}),i(d,e),new Error(e.message)}o.sendAudio(e,t)},addResponseListener:e=>(a.add(e),()=>{a.delete(e)}),addConnectionListener:e=>(c.add(e),()=>{c.delete(e)}),addErrorListener:e=>(d.add(e),()=>{d.delete(e)})}});var c;let d=!1,u=0;const l=new Set;function m(){d=!0}function f(){u++,d=!0}function h(){u--,queueMicrotask(()=>{if(u>0)return;d=!1;const e=[...l];l.clear();for(const t of e)t(new Error("[Thamyr] SDK was torn down: useInitThamyr() unmounted while this call was waiting for initialization."))})}function y(e){return new Error(`[Thamyr] SDK initialization failed: ${e?.message??"unknown error"}`)}async function w(){if("undefined"==typeof window)throw new Error("[Thamyr] The generated API is browser-only; this call ran without a browser environment (SSR).");const e=a.getState();if(e._thamyr)return e._thamyr;if(!d)throw new Error("[Thamyr] SDK is not initialized and no useInitThamyr() is mounted. Add useInitThamyr({clientId: 'cal-pk-…'}) to your root component.");if("error"===e.connectionStatus)throw y(e.error);return new Promise((e,t)=>{let n=!1;const r=e=>{n||(n=!0,s(),l.delete(o),e())},o=e=>{r(()=>{t(e)})};l.add(o);const s=a.subscribe(n=>{if(n._thamyr){const t=n._thamyr;r(()=>{e(t)})}else"error"===n.connectionStatus&&r(()=>{t(y(n.error))})})})}const g=new Set(["then","catch","finally","toJSON"]),S=new Set(Object.getOwnPropertyNames(Object.prototype));function p(e){return"string"!=typeof e||S.has(e)}const b=new Map,T=new Proxy({},{get(e,t){if(p(t))return Reflect.get(e,t);if(g.has(t))return;const n=t;let r=b.get(n);return void 0===r&&(r=function(e){const t=new Map;return new Proxy({},{get(n,r){if(p(r))return Reflect.get(n,r);if(g.has(r))return;const o=r;let s=t.get(o);return void 0===s&&(s=async(...t)=>{const n=(await w())[e],r=n?.[o];if("function"!=typeof r)throw new TypeError(`[Thamyr] ${e}.${o} is not part of the generated API surface.`);return Reflect.apply(r,n,t)},t.set(o,s)),s}})}(n),b.set(n,r)),r}});export{m as a,f as b,h as m,T as t,a as u,w};
9
+ //# sourceMappingURL=api-BeXO8dlg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-BeXO8dlg.js","sources":["../../../../../node_modules/zustand/esm/vanilla.mjs","../../../../../node_modules/zustand/esm/react.mjs","../../../../src/callimacus/store.ts","../../../../src/callimacus/api.ts"],"sourcesContent":["const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const api = { setState, getState, getInitialState, subscribe };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);\n\nexport { createStore };\n","import React from 'react';\nimport { createStore } from 'zustand/vanilla';\n\nconst identity = (arg) => arg;\nfunction useStore(api, selector = identity) {\n const slice = React.useSyncExternalStore(\n api.subscribe,\n React.useCallback(() => selector(api.getState()), [api, selector]),\n React.useCallback(() => selector(api.getInitialState()), [api, selector])\n );\n React.useDebugValue(slice);\n return slice;\n}\nconst createImpl = (createState) => {\n const api = createStore(createState);\n const useBoundStore = (selector) => useStore(api, selector);\n Object.assign(useBoundStore, api);\n return useBoundStore;\n};\nconst create = ((createState) => createState ? createImpl(createState) : createImpl);\n\nexport { create, useStore };\n",null,null],"names":["createStoreImpl","createState","state","listeners","Set","setState","partial","replace","nextState","Object","is","previousState","assign","forEach","listener","getState","api","getInitialState","initialState","subscribe","add","delete","identity","arg","createImpl","createStore","useBoundStore","selector","slice","React","useSyncExternalStore","useCallback","useDebugValue","useStore","notifyListeners","error","console","useCallimacusStore","set","get","unsubConnectionStatus","generation","responseListeners","connectionListeners","errorListeners","connectionStatus","messages","undefined","_initialized","_thamyr","init","config","window","debug","clientId","errorMessage","code","message","maxMessages","warn","Infinity","Math","max","thamyr","Thamyr","endpoint","uiObserver","Error","String","currentGen","onResponse","response","length","onError","callimacusService","onConnectionStatus","connected","status","Boolean","setInitState","reset","disconnect","sendEvent","type","payload","sendUserInteraction","sendAudio","audio","query","addResponseListener","cb","addConnectionListener","addErrorListener","wasInitRequested","mountedInitOwners","pendingRejecters","markInitRequested","markInitOwnerMounted","markInitOwnerUnmounted","queueMicrotask","rejecters","clear","rejectWaiter","initError","async","waitForInstance","Promise","resolve","reject","isSettled","settle","action","unsubscribe","rejecter","current","instance","blockedNames","objectPrototypeMembers","getOwnPropertyNames","prototype","isPassthroughProperty","property","has","namespaces","Map","thamyrApi","Proxy","target","Reflect","name","namespace","namespaceName","methods","method","args","fn","TypeError","apply","createNamespaceFacade"],"mappings":";;;;;;;6HAAA,MAAMA,EAAmBC,IACvB,IAAIC,EACJ,MAAMC,EAA4B,IAAIC,IAChCC,EAAW,CAACC,EAASC,KACzB,MAAMC,EAA+B,mBAAZF,EAAyBA,EAAQJ,GAASI,EACnE,IAAKG,OAAOC,GAAGF,EAAWN,GAAQ,CAChC,MAAMS,EAAgBT,EACtBA,GAAoB,MAAXK,EAAkBA,EAA+B,iBAAdC,GAAwC,OAAdA,GAAsBA,EAAYC,OAAOG,OAAO,CAAA,EAAIV,EAAOM,GACjIL,EAAUU,QAASC,GAAaA,EAASZ,EAAOS,GAClD,GAEII,EAAW,IAAMb,EAMjBc,EAAM,CAAEX,WAAUU,WAAUE,gBALV,IAAMC,EAKqBC,UAJhCL,IACjBX,EAAUiB,IAAIN,GACP,IAAMX,EAAUkB,OAAOP,KAG1BI,EAAehB,EAAQD,EAAYI,EAAUU,EAAUC,GAC7D,OAAOA,GChBHM,EAAYC,GAAQA,EAU1B,MAAMC,EAAcvB,IAClB,MAAMe,EDOS,CAAKf,GAAgBA,EAAcD,EAAgBC,GAAeD,ECPrEyB,CAAYxB,GAClByB,EAAiBC,GAXzB,SAAkBX,EAAKW,EAAWL,GAChC,MAAMM,EAAQC,EAAMC,qBAClBd,EAAIG,UACJU,EAAME,YAAY,IAAMJ,EAASX,EAAID,YAAa,CAACC,EAAKW,IACxDE,EAAME,YAAY,IAAMJ,EAASX,EAAIC,mBAAoB,CAACD,EAAKW,KAGjE,OADAE,EAAMG,cAAcJ,GACbA,CACT,CAGsCK,CAASjB,EAAKW,GAElD,OADAlB,OAAOG,OAAOc,EAAeV,GACtBU,GCiBT,SAASQ,EAAmB/B,EAAkCoB,GAC7D,IAAK,MAAMT,KAAYX,EACtB,I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,MACMJ,SADezB,KACwE0B,GACvFI,EAAKL,IAAYD,GACvB,GAAkB,mBAAPM,EACV,MAAM,IAAIC,UAAU,YAAYL,KAAiBF,+CAGlD,OAAOD,QAAQS,MAAMF,EAAIL,EAAWI,IAGrCF,EAAQ9F,IAAI2F,EAAMI,IAGZA,CACR,GAEF,CAmCeK,CAAsBT,GAClCN,EAAWrF,IAAI2F,EAAMC,IAGfA,CACR","x_google_ignoreList":[0,1]}
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright © 2025–2026 Solomei AI SRL. All rights reserved.
3
+ *
4
+ * Proprietary software, licensed for use by Callimacus customers only.
5
+ * See LICENSE.md for the full terms.
6
+ *
7
+ */
8
+ import{Thamyr as e}from"@callimacus/thamyr";import{callimacusService as t}from"@callimacus/thamyr-core";import n from"react";const r=e=>{let t;const n=new Set,r=(e,r)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},t,o),n.forEach(n=>n(t,e))}},o=()=>t,s={setState:r,getState:o,getInitialState:()=>i,subscribe:e=>(n.add(e),()=>n.delete(e))},i=t=e(r,o,s);return s},o=e=>e;const s=e=>{const t=(e=>e?r(e):r)(e),s=e=>function(e,t=o){const r=n.useSyncExternalStore(e.subscribe,n.useCallback(()=>t(e.getState()),[e,t]),n.useCallback(()=>t(e.getInitialState()),[e,t]));return n.useDebugValue(r),r}(t,e);return Object.assign(s,t),s};function i(e,t){for(const n of e)try{n(t)}catch(e){console.error("[Thamyr] Listener threw:",e)}}const a=(c?s(c):s)((n,r)=>{let o,s=0;const a=new Set,c=new Set,u=new Set;return{connectionStatus:"idle",messages:[],error:void 0,_initialized:!1,_thamyr:void 0,init(d){if(r()._initialized)return;if("undefined"==typeof window)return void console.debug("[Thamyr] init() skipped: no browser environment detected (SSR).");const{clientId:l}=d;if(!l){console.error("[Thamyr] clientId is required. Pass your Callimacus Client ID (`cal-pk-…`) to useInitThamyr().");const e={code:0,message:"clientId is required. Pass your Callimacus Client ID (`cal-pk-…`) to useInitThamyr()."};return n({connectionStatus:"error",error:e}),i(u,e),void i(c,"error")}void 0!==d.maxMessages&&d.maxMessages<0&&console.warn("[Thamyr] maxMessages must be >= 0. Received:",d.maxMessages,". Clamping to 1.");const m=0===d.maxMessages?1/0:Math.max(1,d.maxMessages??50);let f;n({connectionStatus:"connecting",error:void 0});try{f=new e({clientId:l,endpoint:d.endpoint,uiObserver:d.uiObserver})}catch(e){console.error("[Thamyr] Failed to create Thamyr instance:",e);const t={code:0,message:e instanceof Error?e.message:String(e)};return n({connectionStatus:"error",error:t}),i(u,t),void i(c,"error")}const h=++s;f.onResponse(e=>{s===h&&(n(t=>{const n=[...t.messages,e];return{messages:n.length>m?n.slice(-m):n}}),i(a,e))}),f.onError(e=>{s===h&&(n({error:e,connectionStatus:"error"}),i(u,e),i(c,"error"))}),o=t.onConnectionStatus(e=>{if(s!==h)return;const t=e?"connected":"disconnected";n({connectionStatus:t}),i(c,t)}),function(e){n({_initialized:Boolean(e),_thamyr:e})}(f)},reset(){if(r()._initialized){s++;try{o?.()}catch(e){console.error("[Thamyr] Error unsubscribing connection status listener:",e)}try{t.disconnect()}catch(e){console.error("[Thamyr] Error disconnecting:",e)}o=void 0,n({_initialized:!1,_thamyr:void 0,connectionStatus:"idle",messages:[],error:void 0})}else"idle"!==r().connectionStatus&&n({connectionStatus:"idle",error:void 0})},sendEvent(e,t){const o=r()._thamyr;if(!o)throw new Error("[Thamyr] SDK is not initialized yet. Ensure useInitThamyr() has been called.");const{connectionStatus:s}=r();if("connected"!==s){const e={code:0,message:`Cannot send event: connection status is "${s}". Wait for connected status before sending.`};throw n({error:e}),i(u,e),new Error(e.message)}o.sendUserInteraction(e,t)},sendAudio(e,t){const o=r()._thamyr;if(!o)throw new Error("[Thamyr] SDK is not initialized yet. Ensure useInitThamyr() has been called.");const{connectionStatus:s}=r();if("connected"!==s){const e={code:0,message:`Cannot send audio: connection status is "${s}". Wait for connected status before sending.`};throw n({error:e}),i(u,e),new Error(e.message)}o.sendAudio(e,t)},addResponseListener:e=>(a.add(e),()=>{a.delete(e)}),addConnectionListener:e=>(c.add(e),()=>{c.delete(e)}),addErrorListener:e=>(u.add(e),()=>{u.delete(e)})}});var c;let u=!1,d=0;const l=new Set;function m(){u=!0}function f(){d++,u=!0}function h(){d--,queueMicrotask(()=>{if(d>0)return;u=!1;const e=[...l];l.clear();for(const t of e)t(new Error("[Thamyr] SDK was torn down: useInitThamyr() unmounted while this call was waiting for initialization."))})}function y(e){return new Error(`[Thamyr] SDK initialization failed: ${e?.message??"unknown error"}`)}async function w(){if("undefined"==typeof window)throw new Error("[Thamyr] The generated API is browser-only; this call ran without a browser environment (SSR).");const e=a.getState();if(e._thamyr)return e._thamyr;if(!u)throw new Error("[Thamyr] SDK is not initialized and no useInitThamyr() is mounted. Add useInitThamyr({clientId: 'cal-pk-…'}) to your root component.");if("error"===e.connectionStatus)throw y(e.error);return new Promise((e,t)=>{let n=!1;const r=e=>{n||(n=!0,s(),l.delete(o),e())},o=e=>{r(()=>{t(e)})};l.add(o);const s=a.subscribe(n=>{if(n._thamyr){const t=n._thamyr;r(()=>{e(t)})}else"error"===n.connectionStatus&&r(()=>{t(y(n.error))})})})}const g=new Set(["then","catch","finally","toJSON"]),S=new Set(Object.getOwnPropertyNames(Object.prototype));function p(e){return"string"!=typeof e||S.has(e)}const b=new Map,T=new Proxy({},{get(e,t){if(p(t))return Reflect.get(e,t);if(g.has(t))return;const n=t;let r=b.get(n);return void 0===r&&(r=function(e){const t=new Map;return new Proxy({},{get(n,r){if(p(r))return Reflect.get(n,r);if(g.has(r))return;const o=r;let s=t.get(o);return void 0===s&&(s=async(...t)=>{const n=(await w())[e],r=n?.[o];if("function"!=typeof r)throw new TypeError(`[Thamyr] ${e}.${o} is not part of the generated API surface.`);return Reflect.apply(r,n,t)},t.set(o,s)),s}})}(n),b.set(n,r)),r}});export{m as a,f as b,h as m,T as t,a as u,w};
9
+ //# sourceMappingURL=api-Bzz6EL4P.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-Bzz6EL4P.js","sources":["../../../../../node_modules/zustand/esm/vanilla.mjs","../../../../../node_modules/zustand/esm/react.mjs","../../../../src/callimacus/store.ts","../../../../src/callimacus/api.ts"],"sourcesContent":["const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const api = { setState, getState, getInitialState, subscribe };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);\n\nexport { createStore };\n","import React from 'react';\nimport { createStore } from 'zustand/vanilla';\n\nconst identity = (arg) => arg;\nfunction useStore(api, selector = identity) {\n const slice = React.useSyncExternalStore(\n api.subscribe,\n React.useCallback(() => selector(api.getState()), [api, selector]),\n React.useCallback(() => selector(api.getInitialState()), [api, selector])\n );\n React.useDebugValue(slice);\n return slice;\n}\nconst createImpl = (createState) => {\n const api = createStore(createState);\n const useBoundStore = (selector) => useStore(api, selector);\n Object.assign(useBoundStore, api);\n return useBoundStore;\n};\nconst create = ((createState) => createState ? createImpl(createState) : createImpl);\n\nexport { create, useStore };\n",null,null],"names":["createStoreImpl","createState","state","listeners","Set","setState","partial","replace","nextState","Object","is","previousState","assign","forEach","listener","getState","api","getInitialState","initialState","subscribe","add","delete","identity","arg","createImpl","createStore","useBoundStore","selector","slice","React","useSyncExternalStore","useCallback","useDebugValue","useStore","notifyListeners","error","console","useCallimacusStore","set","get","unsubConnectionStatus","generation","responseListeners","connectionListeners","errorListeners","connectionStatus","messages","undefined","_initialized","_thamyr","init","config","window","debug","clientId","errorMessage","code","message","maxMessages","warn","Infinity","Math","max","thamyr","Thamyr","endpoint","uiObserver","Error","String","currentGen","onResponse","response","length","onError","callimacusService","onConnectionStatus","connected","status","Boolean","setInitState","reset","disconnect","sendEvent","type","payload","sendUserInteraction","sendAudio","audio","query","addResponseListener","cb","addConnectionListener","addErrorListener","wasInitRequested","mountedInitOwners","pendingRejecters","markInitRequested","markInitOwnerMounted","markInitOwnerUnmounted","queueMicrotask","rejecters","clear","rejectWaiter","initError","async","waitForInstance","Promise","resolve","reject","isSettled","settle","action","unsubscribe","rejecter","current","instance","blockedNames","objectPrototypeMembers","getOwnPropertyNames","prototype","isPassthroughProperty","property","has","namespaces","Map","thamyrApi","Proxy","target","Reflect","name","namespace","namespaceName","methods","method","args","fn","TypeError","apply","createNamespaceFacade"],"mappings":";;;;;;;6HAAA,MAAMA,EAAmBC,IACvB,IAAIC,EACJ,MAAMC,EAA4B,IAAIC,IAChCC,EAAW,CAACC,EAASC,KACzB,MAAMC,EAA+B,mBAAZF,EAAyBA,EAAQJ,GAASI,EACnE,IAAKG,OAAOC,GAAGF,EAAWN,GAAQ,CAChC,MAAMS,EAAgBT,EACtBA,GAAoB,MAAXK,EAAkBA,EAA+B,iBAAdC,GAAwC,OAAdA,GAAsBA,EAAYC,OAAOG,OAAO,CAAA,EAAIV,EAAOM,GACjIL,EAAUU,QAASC,GAAaA,EAASZ,EAAOS,GAClD,GAEII,EAAW,IAAMb,EAMjBc,EAAM,CAAEX,WAAUU,WAAUE,gBALV,IAAMC,EAKqBC,UAJhCL,IACjBX,EAAUiB,IAAIN,GACP,IAAMX,EAAUkB,OAAOP,KAG1BI,EAAehB,EAAQD,EAAYI,EAAUU,EAAUC,GAC7D,OAAOA,GChBHM,EAAYC,GAAQA,EAU1B,MAAMC,EAAcvB,IAClB,MAAMe,EDOS,CAAKf,GAAgBA,EAAcD,EAAgBC,GAAeD,ECPrEyB,CAAYxB,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MQ,EAAOR,EACb,IAAIS,EAAYP,EAAWpF,IAAI0F,GAM/B,YALkBlF,IAAdmF,IACHA,EApEH,SAA+BC,GAC9B,MAAMC,EAAU,IAAIR,IAEpB,OAAO,IAAIE,MAAM,GAAI,CACpB,GAAAvF,CAAIwF,EAAQN,GACX,GAAID,EAAsBC,GACzB,OAAOO,QAAQzF,IAAIwF,EAAQN,GAG5B,GAAIL,EAAaM,IAAID,GACpB,OAGD,MAAMQ,EAAOR,EACb,IAAIY,EAASD,EAAQ7F,IAAI0F,GAgBzB,YAfelF,IAAXsF,IACHA,EAAS7B,SAAU8B,KAClB,MACMJ,SADezB,KACwE0B,GACvFI,EAAKL,IAAYD,GACvB,GAAkB,mBAAPM,EACV,MAAM,IAAIC,UAAU,YAAYL,KAAiBF,+CAGlD,OAAOD,QAAQS,MAAMF,EAAIL,EAAWI,IAGrCF,EAAQ9F,IAAI2F,EAAMI,IAGZA,CACR,GAEF,CAmCeK,CAAsBT,GAClCN,EAAWrF,IAAI2F,EAAMC,IAGfA,CACR","x_google_ignoreList":[0,1]}
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright © 2025–2026 Solomei AI SRL. All rights reserved.
3
+ *
4
+ * Proprietary software, licensed for use by Callimacus customers only.
5
+ * See LICENSE.md for the full terms.
6
+ *
7
+ */
8
+ export{CallimacusEvent,ChapterStatus,ClientEvents,GalleryMode,SLInputEventType,ServerEvents,ThamyrHttpError,ThamyrResponseType,UserInteractionType,callimacusService,clearIntentSessionId,ensureIntentSessionId,extractTtsAudio,getIntentSessionId,initIntent,isSetProduct,logger,setConsent,setDebug,setDebugPanel,setGeo,setIntentSessionMaxAge,transformImageUrl}from"@callimacus/thamyr-core";import{t as e,w as t,u as r,m as n,a as o,b as a}from"./chunks/api-Bzz6EL4P.js";import{useMemo as i,useEffect as c,useRef as s,useState as u,useCallback as d}from"react";import"@callimacus/thamyr";function l(e,t){const r=s(t);r.current=t,c(()=>e(e=>{r.current(e)}),[e])}function p(e){const t=r(e=>e.init),i=r(e=>e.reset);o(),c(()=>(a(),t(e),()=>{i(),n()}),[t,i,e.clientId,e.endpoint])}function m(){return{history:r(e=>e.messages),sendEvent:r(e=>e.sendEvent),sendAudio:r(e=>e.sendAudio)}}function v(){return{status:r(e=>e.connectionStatus)}}function y(e){l(r(e=>e.addResponseListener),e)}function f(e){l(r(e=>e.addConnectionListener),e)}function g(e){l(r(e=>e.addErrorListener),e)}function w(){return i(()=>({getCart:async()=>(await t()).cart.getCart(),addItem:async e=>(await t()).cart.addItemToCart({productId:e}),removeItem:async e=>(await t()).cart.removeItemFromCart({productId:e}),updateQuantity:async(e,r)=>(await t()).cart.updateProductQuantity({productId:e,quantity:r})}),[])}function h(){return e}function I(){return i(()=>({similar:async(e,r)=>(await t()).skesis.similar({anchorId:e,...r}),related:async(e,r)=>(await t()).skesis.related({anchorId:e,...r})}),[])}function E(){return i(()=>({getSitemap:async()=>(await t()).sitemap.getSitemap()}),[])}const L=-45,S=1800,T=3e4;function A({silenceThreshold:e=L,silenceDuration:t=S,maxDuration:r=T,onRecordingComplete:n}){const[o,a]=u("idle"),[i,l]=u([]),[p,m]=u(void 0),v=s(void 0),y=s(void 0),f=s(void 0),g=s(void 0),w=s(0),h=s(0),I=s(void 0),E=s([]),A=s(!1),C=d(()=>{if(0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),void 0!==I.current&&(clearTimeout(I.current),I.current=void 0),g.current){for(const e of g.current.getTracks())e.stop();g.current=void 0}"closed"!==y.current?.state&&y.current?.close(),y.current=void 0,f.current=void 0,v.current=void 0,A.current=!1},[]);c(()=>C,[C]);const b=d(()=>{A.current||(A.current=!0,"recording"===v.current?.state&&v.current.stop(),0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),void 0!==I.current&&(clearTimeout(I.current),I.current=void 0))},[]),M=d(async()=>{m(void 0),E.current=[],A.current=!1;try{const o=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:16e3}});g.current=o;const i=new AudioContext({sampleRate:16e3});y.current=i;const c=i.createMediaStreamSource(o),s=i.createAnalyser();s.fftSize=256,s.smoothingTimeConstant=.7,c.connect(s),f.current=s;const u=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",d=new MediaRecorder(o,{mimeType:u});v.current=d,d.addEventListener("dataavailable",e=>{e.data.size>0&&E.current.push(e.data)}),d.addEventListener("stop",()=>{a("processing");const e=new Blob(E.current,{type:u});C(),n(e)}),d.start(250),a("recording"),h.current=0,I.current=setTimeout(()=>{b()},r);const p=()=>{if(!f.current||A.current)return;const r=f.current.frequencyBinCount,n=new Uint8Array(r);f.current.getByteFrequencyData(n);const o=Math.floor(r/32),a=[];for(let e=0;e<32;e++){let t=0;for(let r=0;r<o;r++)t+=n[e*o+r];a.push(t/o/255)}l(a);let i=0;for(const e of n){const t=e/255;i+=t*t}const c=Math.sqrt(i/r);if((c>0?20*Math.log10(c):-100)<e){if(0===h.current)h.current=Date.now();else if(Date.now()-h.current>t)return void b()}else h.current=0;w.current=requestAnimationFrame(p)};p()}catch{m("Microphone access denied"),a("idle"),C()}},[e,t,r,n,b,C]),R=d(()=>{a("idle"),l([])},[]);return{state:o,audioLevels:i,startRecording:M,stopRecording:b,reset:R,error:p}}function C(e){const t=s(void 0),[r,n]=u("idle"),[o,a]=u(void 0);c(()=>{const r=e?.audioUrl;if("undefined"==typeof Audio||void 0===r||""===r)return t.current=void 0,void n("idle");const o=new Audio(r);o.preload="none",t.current=o,n("idle"),a(void 0);const i=()=>{n("playing")},c=()=>{n("loading")},s=()=>{n(e=>"ended"===e?e:"paused")},u=()=>{n("ended")},d=()=>{a("Audio playback failed"),n("error")};return o.addEventListener("playing",i),o.addEventListener("waiting",c),o.addEventListener("pause",s),o.addEventListener("ended",u),o.addEventListener("error",d),()=>{o.pause(),o.removeEventListener("playing",i),o.removeEventListener("waiting",c),o.removeEventListener("pause",s),o.removeEventListener("ended",u),o.removeEventListener("error",d),o.src="",t.current=void 0}},[e?.audioUrl]);const i=d(async()=>{const e=t.current;if(e)try{a(void 0),n("loading"),await e.play()}catch{a("Audio playback failed"),n("error")}},[]),l=d(()=>{t.current?.pause()},[]),p=d(()=>{const e=t.current;e&&(e.pause(),e.currentTime=0,n("idle"))},[]),m=d(()=>{const e=t.current;e&&(e.paused?i():e.pause())},[i]);return{state:r,isPlaying:"playing"===r||"loading"===r,error:o,play:i,pause:l,toggle:m,stop:p}}export{e as thamyrApi,h as useApi,r as useCallimacusStore,w as useCart,v as useConnection,p as useInitThamyr,f as useOnConnectionChange,g as useOnError,y as useOnResponse,E as useSitemap,I as useSkesis,m as useThamyr,C as useTtsAudio,A as useVoiceRecorder};
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/callimacus/hooks.ts","../../../src/voice/use-voice-recorder.ts","../../../src/audio/use-tts-audio.ts"],"sourcesContent":[null,null,null],"names":["useEventListener","addListener","callback","callbackRef","useRef","current","useEffect","arg","useInitThamyr","config","init","useCallimacusStore","s","reset","markInitRequested","markInitOwnerMounted","markInitOwnerUnmounted","clientId","endpoint","useThamyr","history","messages","sendEvent","sendAudio","useConnection","status","connectionStatus","useOnResponse","addResponseListener","useOnConnectionChange","addConnectionListener","useOnError","addErrorListener","useCart","useMemo","async","waitForInstance","cart","getCart","productId","addItemToCart","removeItemFromCart","quantity","updateProductQuantity","useApi","thamyrApi","useSkesis","anchorId","options","skesis","similar","related","useSitemap","sitemap","getSitemap","defaultOptions","useVoiceRecorder","silenceThreshold","silenceDuration","maxDuration","onRecordingComplete","state","setState","useState","audioLevels","setAudioLevels","error","setError","undefined","mediaRecorderRef","audioContextRef","analyserRef","streamRef","animationFrameRef","silenceStartRef","maxDurationTimerRef","chunksRef","stoppingRef","cleanup","useCallback","cancelAnimationFrame","clearTimeout","track","getTracks","stop","close","stopRecording","startRecording","stream","navigator","mediaDevices","getUserMedia","audio","echoCancellation","noiseSuppression","sampleRate","audioContext","AudioContext","source","createMediaStreamSource","analyser","createAnalyser","fftSize","smoothingTimeConstant","connect","mimeType","MediaRecorder","isTypeSupported","mediaRecorder","addEventListener","event","data","size","push","audioBlob","Blob","type","start","setTimeout","monitorAudio","bufferLength","frequencyBinCount","dataArray","Uint8Array","getByteFrequencyData","step","Math","floor","levels","i","sum","j","sumSquares","value","normalized","rms","sqrt","log10","Date","now","requestAnimationFrame","useTtsAudio","audioRef","audioUrl","Audio","element","preload","onPlaying","onWaiting","onPause","previous","onEnded","onError","pause","removeEventListener","src","play","currentTime","toggle","paused","isPlaying"],"mappings":";;;;;;;ukBAuBA,SAASA,EACRC,EACAC,GAEA,MAAMC,EAAcC,EAAOF,GAE3BC,EAAYE,QAAUH,EAEtBI,EAAU,IACWL,EAAYM,IAC/BJ,EAAYE,QAAQE,KAGnB,CAACN,GACL,CAyBM,SAAUO,EAAcC,GAC7B,MAAMC,EAAOC,EAAmBC,GAAKA,EAAEF,MACjCG,EAAQF,EAAmBC,GAAKA,EAAEC,OAIxCC,IAEAR,EAAU,KACTS,IACAL,EAAKD,GAEE,KACNI,IAIAG,MAGC,CAACN,EAAMG,EAAOJ,EAAOQ,SAAUR,EAAOS,UAC1C,UA4BgBC,IAIf,MAAO,CAACC,QAHQT,EAAmBC,GAAKA,EAAES,UAGzBC,UAFCX,EAAmBC,GAAKA,EAAEU,WAEhBC,UADVZ,EAAmBC,GAAKA,EAAEW,WAE7C,UAoBgBC,IAEf,MAAO,CAACC,OADOd,EAAmBC,GAAKA,EAAEc,kBAE1C,CAiBM,SAAUC,EAAczB,GAC7BF,EAAiBW,EAAmBC,GAAKA,EAAEgB,qBAAsB1B,EAClE,CAkBM,SAAU2B,EAAsB3B,GACrCF,EAAiBW,EAAmBC,GAAKA,EAAEkB,uBAAwB5B,EACpE,CAiBM,SAAU6B,EAAW7B,GAC1BF,EAAiBW,EAAmBC,GAAKA,EAAEoB,kBAAmB9B,EAC/D,UA4DgB+B,IACf,OAAOC,EAAQ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E,EAAY,KACzB+D,EAASzI,SAASoJ,SAChB,IAEGrE,EAAOL,EAAY,KACxB,MAAMkE,EAAUH,EAASzI,QACpB4I,IAILA,EAAQQ,QACRR,EAAQY,YAAc,EACtB/F,EAAS,UACP,IAEGgG,EAAS/E,EAAY,KAC1B,MAAMkE,EAAUH,EAASzI,QACpB4I,IAIDA,EAAQc,OACNH,IAELX,EAAQQ,UAEP,CAACG,IAEJ,MAAO,CACN/F,QACAmG,UAAqB,YAAVnG,GAAiC,YAAVA,EAClCK,QACA0F,OACAH,QACAK,SACA1E,OAEF"}
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright © 2025–2026 Solomei AI SRL. All rights reserved.
3
+ *
4
+ * Proprietary software, licensed for use by Callimacus customers only.
5
+ * See LICENSE.md for the full terms.
6
+ *
7
+ */
8
+ import{queryOptions as t}from"@tanstack/react-query";import{t as r}from"./chunks/api-Bzz6EL4P.js";import"@callimacus/thamyr";import"@callimacus/thamyr-core";import"react";async function a(t,a,n,o){const i=r[t][a],c={signal:o,throwOnError:!0};return(await(void 0===n?i(c):i(n,c))).data}function n(r,n,o){return t({queryKey:["thamyr",r,n,o],queryFn:async({signal:t})=>a(r,n,o,t)})}function o(t,r){return{mutationKey:["thamyr",t,r],mutationFn:async n=>a(t,r,n)}}export{o as thamyrMutationOptions,n as thamyrQueryOptions};
9
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","sources":["../../../src/query.ts"],"sourcesContent":[null],"names":["async","callApi","namespace","method","parameters","signal","call","thamyrApi","options","throwOnError","undefined","data","thamyrQueryOptions","queryOptions","queryKey","thamyrMutationOptions","mutationKey"],"mappings":";;;;;;;2KA4FAA,eAAeC,EACdC,EACAC,EACAC,EACAC,GAEA,MAAMC,EAAOC,EAAUL,GAAWC,GAC5BK,EAAU,CAACH,SAAQI,cAAc,GASvC,kBADqCC,IAAfN,EAA2BE,EAAKE,GAAWF,EAAKF,EAAYI,KACpEG,IACf,UA4BgBC,EACfV,EACAC,EACAC,GAEA,OAAOS,EAAa,CACnBC,SAAU,CAAC,SAAUZ,EAAWC,EAAQC,GACxCJ,QAAa,OAACK,OAACA,KACPJ,EAAQC,EAAWC,EAAQC,EAAYC,IAGjD,CAYM,SAAUU,EACfb,EACAC,GAEA,MAAO,CACNa,YAAa,CAAC,SAAUd,EAAWC,GACnCH,WAAgB,MAACI,GACTH,EAAQC,EAAWC,EAAQC,GAGrC"}