@callimacus/thamyr-shopify 4.31.0 → 5.0.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 +18 -0
- package/CHANGELOG.md +32 -0
- package/MIGRATION.md +38 -7
- package/README.md +14 -4
- package/dist/browser/callimacus.min.js +2 -2
- package/dist/browser/callimacus.min.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.core.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
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
|
+
## [5.0.0](https://github.com/callimacus/thamyr-sdk/compare/thamyr-core-v4.31.1...thamyr-core-v5.0.0) (2026-11-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### ⚠ BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* analytics refactor ([#892](https://github.com/callimacus/thamyr-sdk/issues/892))
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* analytics refactor ([#892](https://github.com/callimacus/thamyr-sdk/issues/892)) ([ac36d45](https://github.com/callimacus/thamyr-sdk/commit/ac36d452124a6f2511c18325b916d8e6445b08f0))
|
|
16
|
+
|
|
17
|
+
## [4.31.1](https://github.com/callimacus/thamyr-sdk/compare/thamyr-core-v4.31.0...thamyr-core-v4.31.1) (2026-11-12)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **core:** transformImageUrl writes base64 the CDN reads, in every browser (CAL-1826, CAL-1804) ([#922](https://github.com/callimacus/thamyr-sdk/issues/922)) ([945c74c](https://github.com/callimacus/thamyr-sdk/commit/945c74ce1e8b151edd2379875cdbc6b7ec18d879))
|
|
23
|
+
|
|
6
24
|
## [4.31.0](https://github.com/callimacus/thamyr-sdk/compare/thamyr-core-v4.30.2...thamyr-core-v4.31.0) (2026-11-12)
|
|
7
25
|
|
|
8
26
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.0.0](https://github.com/callimacus/thamyr-sdk/compare/thamyr-shopify-v4.31.1...thamyr-shopify-v5.0.0) (2026-11-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* analytics refactor ([#892](https://github.com/callimacus/thamyr-sdk/issues/892))
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* analytics refactor ([#892](https://github.com/callimacus/thamyr-sdk/issues/892)) ([ac36d45](https://github.com/callimacus/thamyr-sdk/commit/ac36d452124a6f2511c18325b916d8e6445b08f0))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Dependencies
|
|
16
|
+
|
|
17
|
+
* The following workspace dependencies were updated
|
|
18
|
+
* devDependencies
|
|
19
|
+
* @callimacus/thamyr-core bumped from ^4.31.1 to ^5.0.0
|
|
20
|
+
|
|
21
|
+
## [4.31.1](https://github.com/callimacus/thamyr-sdk/compare/thamyr-shopify-v4.31.0...thamyr-shopify-v4.31.1) (2026-11-12)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Miscellaneous Chores
|
|
25
|
+
|
|
26
|
+
* **thamyr-shopify:** Synchronize thamyr versions
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Dependencies
|
|
30
|
+
|
|
31
|
+
* The following workspace dependencies were updated
|
|
32
|
+
* devDependencies
|
|
33
|
+
* @callimacus/thamyr-core bumped from ^4.31.0 to ^4.31.1
|
|
34
|
+
|
|
3
35
|
## [4.31.0](https://github.com/callimacus/thamyr-sdk/compare/thamyr-shopify-v4.30.2...thamyr-shopify-v4.31.0) (2026-11-12)
|
|
4
36
|
|
|
5
37
|
|
package/MIGRATION.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
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
|
-
**The wire protocol has not changed since v1
|
|
5
|
+
**The wire protocol has not changed since v1;** v5 only adds to it: it sends events of its own and three optional fields — see [Migrating to v5](#migrating-to-v5). 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
|
|
|
7
7
|
## Coming from v1
|
|
8
8
|
|
|
9
|
-
Sites still on 1.x (the last 1.x release is 1.8.2) cross
|
|
9
|
+
Sites still on 1.x (the last 1.x release is 1.8.2) cross four majors at once. Work through the errors in this order:
|
|
10
10
|
|
|
11
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).
|
|
@@ -16,14 +16,15 @@ 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. **
|
|
20
|
-
10. **
|
|
19
|
+
9. **v5:** nothing to change in your code; the SDK now records page views, opens of the items in the assistant's answers, adds to cart and the custom events your markup names on its own, see [Migrating to v5](#migrating-to-v5).
|
|
20
|
+
10. **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).
|
|
21
|
+
11. **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
|
|
|
22
23
|
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
24
|
|
|
24
|
-
The call sites a storefront on 1.x most often has, v1 →
|
|
25
|
+
The call sites a storefront on 1.x most often has, v1 → v5 in one hop:
|
|
25
26
|
|
|
26
|
-
| v1 |
|
|
27
|
+
| v1 | v5 |
|
|
27
28
|
| --- | --- |
|
|
28
29
|
| `const basket = await thamyr.cart.getCart()` | `const {data: basket, error, response} = await thamyr.cart.getCart()` |
|
|
29
30
|
| `thamyr.cart.addItemToCart(id)` | `thamyr.cart.addItemToCart({productId: id})` — same envelope; `removeItemFromCart` and `updateProductQuantity({productId, quantity})` alike |
|
|
@@ -31,10 +32,40 @@ The call sites a storefront on 1.x most often has, v1 → v4 in one hop:
|
|
|
31
32
|
| `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
33
|
| `thamyr.products.getRecommendations(sku)` | `const {data} = await thamyr.products.getRecommendations({productId: sku})` |
|
|
33
34
|
| `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
|
+
| `thamyr.analytics.trackEvent(storyId, name, content, payload)` | `void thamyr.analytics.trackEvent({storyId, eventName: name, content, payload})` — `content` is a `string`; kept within the [custom events' limits](#custom-events) |
|
|
35
36
|
|
|
36
37
|
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
|
|
|
39
|
+
# Migrating to v5
|
|
40
|
+
|
|
41
|
+
**Breaking in:** v5.0.0, for all six packages together. No call is removed and no signature changes: moving to v5 is a version bump. What changes is what your site sends at run time, since v5 records events on its own: see [v5 records events on its own](#v5-records-events-on-its-own).
|
|
42
|
+
|
|
43
|
+
- **`trackEvent` stays.** `thamyr.analytics.trackEvent(...)` (vanilla) and `api.analytics.trackEvent(...)` (react, from `useApi()`) send a custom event, as on 4.x. Callimacus keeps it when its name and fields fit the [custom events' limits](#custom-events), and refuses and counts it when not; the call resolves the same either way.
|
|
44
|
+
- **The chat's adds to cart go through the collector.** After an add from the chat, v5 records an `added_to_cart` with its round instead of calling `trackEvent` with `shopify_cart_add` or `woocommerce_cart_add`. `useShopifyCartNotices()` and the notices' `outcome` are unchanged.
|
|
45
|
+
- **A new `events` namespace.** The contract's `POST /api/v3/events` operation is generated like every other: `thamyr.events.collect({eventBatch})` (vanilla) and `api.events.collect({eventBatch})` (react, from `useApi()`). It is the door the SDK's own collector posts to; you have no need to call it.
|
|
46
|
+
- **Three optional wire fields.** The socket's handshake says `recordsPageViews: true` while the SDK records the page's views (or the Shopify loader recorded the load's), so Callimacus records none of its own for that socket. A round's `context.pageViewId` names the page view it was asked on, so its facts join that page's visit. A round's `inputEvent.data` may carry `trigger`: `suggested` for a question the visitor clicked (offered by the assistant or by the site), `site` for a round the page sent on its own. Only the analytics reads it. The SDK sets both; a round you build yourself may set `trigger` too, as a starter chip would: `sendEvent('create-round', {inputEvent: {type: 'question', data: {value, trigger: 'suggested'}}})`.
|
|
47
|
+
- **A site still on 4.x keeps working.** Its `trackEvent` calls are kept as custom events within the limits, and its chat's adds to cart are counted.
|
|
48
|
+
|
|
49
|
+
## v5 records events on its own
|
|
50
|
+
|
|
51
|
+
With no call from your code, v5 records page views, opens of the items the assistant's answers showed, and adds to cart, each naming the round it came from, and the custom events your markup names:
|
|
52
|
+
|
|
53
|
+
- **React** (from `useInitThamyr`): a page view for the load and one for each route change, an open for a `link` action that names a product and its round, an add to cart for a `cart` action or a chat cart command that went through, and the custom events of the page's markup. To see route changes it wraps `history.pushState` and `history.replaceState` and listens to `popstate`, so a client-side router is seen with no setup. Events wait three seconds for others and go in one batch, so a route change costs about one request.
|
|
54
|
+
- **React Native**: adds to cart only; there are no pages.
|
|
55
|
+
- **Liquid**: an add to cart made from a round's renderer, and the custom events of the page's markup. The round a section opens with on its own (`data-interaction`, `data-prompt`) is marked as the site's; `data-landing` needs no mark, since Callimacus counts every landing as the site's.
|
|
56
|
+
- **The Shopify app embed**: page views, opens from its cards, adds from its cards and from the chat, and the custom events of the theme's markup.
|
|
57
|
+
- **Vanilla** (`@callimacus/thamyr`): nothing on its own.
|
|
58
|
+
|
|
59
|
+
React, React Native and Liquid declare adds to cart with the first one, so a site with no cart never shows cart numbers; the Shopify embed declares them on every page, since every store has a cart. Custom events are declared with the first one. A question from an `ask` action is marked `suggested`.
|
|
60
|
+
|
|
61
|
+
React, React Native and Liquid send to `POST {endpoint}/api/v3/events`, with the client id in the header and `credentials: 'include'`, so the browser sends the cookies it holds for the API's domain (a Callimacus Studio session cookie marks the traffic as internal). As the page hides, what is left goes by `navigator.sendBeacon` (a keepalive fetch where there is none), with the client id inside a `text/plain` body. The Shopify app embed sends to the store's App Proxy (`<proxy path>/events`), on the store's own origin. Recording writes no cookie and nothing to storage. A failed batch is tried three more times; after a 429 the next try waits for the response's `Retry-After`, else a minute.
|
|
62
|
+
|
|
63
|
+
## Custom events
|
|
64
|
+
|
|
65
|
+
- **From markup** (React, Liquid, the Shopify embed): `<button data-callimacus-event="newsletter_signup" data-callimacus-event-plan="pro">` sends `newsletter_signup` with `{plan: 'pro'}` when it is clicked. Each field is an attribute's name after `data-callimacus-event-`, as written: `data-callimacus-event-item_id="sku-123"` is `item_id`, which ties the event to an item an answer showed. HTML lowercases attribute names, so a markup field always arrives in lower case (`data-callimacus-event-itemId` is `itemid`). Values are sent as text, and an attribute with no value is no field. The event names the round of a non-empty `data-callimacus-round` on the element or an ancestor, else the round shown around it (a Shopify chapter, a Liquid section), else the newest round of the runtime that owns that part of the page. Several runtimes on one page (the Shopify embed and a Liquid section) send each event once, through the runtime whose part of the page it is in.
|
|
66
|
+
- **From code**: `trackEvent({storyId, eventName, content?, payload?})`. `content` is the field `content`; numbers and booleans in `payload` stay numbers and booleans.
|
|
67
|
+
- **The limits.** A name of at most 40 letters, digits or `_`, starting with a letter, in any case (`productClick` and `newsletter_signup` both pass), never a built-in event's name in any case. A name keeps at most 10 fields over its whole life, named the same way; `item_id` is the field that ties an event to an item an answer showed. Each value a finite number, a boolean, or a code of at most 128 letters, digits, `_`, `-`, `.`, `:` or `/`, which holds an item's id as answers show it (`shopify:product:gid://shopify/Product/1`): no spaces and no `@`, so no sentence or email address fits. A field's type is fixed when that field first arrives, and a project has at most 100 names. Free text and anything else outside the limits is refused and counted: the SDK drops a markup event before it is sent and counts it as dropped; Callimacus refuses a `trackEvent` call and counts it, and still answers it with 204, so the call resolves the same either way.
|
|
68
|
+
|
|
38
69
|
# Migrating to v4
|
|
39
70
|
|
|
40
71
|
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).
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ does the rest, in the theme's own look.
|
|
|
9
9
|
The package has two parts:
|
|
10
10
|
|
|
11
11
|
1. **Browser bundle**, loaded by the embed from jsDelivr at the major version:
|
|
12
|
-
`https://cdn.jsdelivr.net/npm/@callimacus/thamyr-shopify@
|
|
12
|
+
`https://cdn.jsdelivr.net/npm/@callimacus/thamyr-shopify@5/dist/browser/callimacus.min.js` and
|
|
13
13
|
`callimacus.css`. Self-contained (core's transport and socket.io-client bundled in).
|
|
14
14
|
2. **Node API** (`import … from '@callimacus/thamyr-shopify'`), for core: the generic project setup
|
|
15
15
|
specs, and the look's tokens with the checks core applies before it stores a posted look. Pure
|
|
@@ -147,6 +147,10 @@ Data attributes are the contract; classes are free.
|
|
|
147
147
|
- `[data-callimacus-form]`: forms with an `input[name=q]` (the dock, the home entrance). Submit = ask.
|
|
148
148
|
- `[data-callimacus-open]`: buttons that open and focus the dock input (our header button). `/` does the same.
|
|
149
149
|
- `[data-callimacus-ask="question text"]`: any clickable element; click = ask that text as a follow-up.
|
|
150
|
+
- `[data-callimacus-event="event_name"]`: any clickable element; click = record the theme's own event, with a field for each
|
|
151
|
+
`data-callimacus-event-<field>` attribute with a value (`data-callimacus-event-item_id="…"` is `item_id`; HTML lowercases
|
|
152
|
+
attribute names, so fields arrive in lower case) and the round of the chapter it sits in, else the newest. The limits are
|
|
153
|
+
in MIGRATION.md, Custom events.
|
|
150
154
|
- `[data-callimacus-stage]`: where chapters are composed, one per page, with `data-stage-kind`
|
|
151
155
|
(`home` | `search` | `page`) and optional `data-ask-on-load` (the search page's `?q=`). The
|
|
152
156
|
bundle places it: above the results on the search page, after the product's own section on a
|
|
@@ -234,7 +238,9 @@ window.callimacusRenderers.push({
|
|
|
234
238
|
| `ctx.url(item)` | The storefront link under `rootUrl`: `products/<handle>`, `collections/<handle>`, `blogs/<blogHandle>/<handle>`, or a page's or policy's `meta.url`; `''` when it has none |
|
|
235
239
|
| `ctx.imageUrl(hit, {width = 800, index = 0})` | Shopify CDN URL with `width`; falls back to image 0 |
|
|
236
240
|
| `ctx.variantId(hit)` | Numeric id of the first orderable variant |
|
|
237
|
-
| `ctx.addToCart(variantId, quantity = 1)` | The theme's cart where the kit knows it, else Shopify's cart API and our confirmation (see Cart). Rejects with a readable `Error`: a `CartAddError` whose `code` is `refused` (Shopify's own words), `cart_unavailable` (no cart answered) or `failed` |
|
|
241
|
+
| `ctx.addToCart(variantId, quantity = 1, from?)` | The theme's cart where the kit knows it, else Shopify's cart API and our confirmation (see Cart). Rejects with a readable `Error`: a `CartAddError` whose `code` is `refused` (Shopify's own words), `cart_unavailable` (no cart answered) or `failed`. An add that went through is recorded with the chapter's round, of `from.productId` (else the chapter's product that has the variant) |
|
|
242
|
+
| `ctx.productClicked(productId, position?)` | Records that the shopper followed a product's link on a card, with the chapter's round; the kit's cards call it themselves |
|
|
243
|
+
| `ctx.productAdded(variantId, quantity, from?)` | Records an add a card made through the theme's own control, which never passes through `ctx.addToCart`, with the chapter's round, of `from.productId` (else the chapter's product that has the variant); the kit's borrowed cards call it themselves |
|
|
238
244
|
| `ctx.ask(question)` | Continue the thread with a follow-up; queued while a round is in flight |
|
|
239
245
|
| `ctx.remember(kind, value)` | Personalisation memory (`questions`, `viewed`, `added`) |
|
|
240
246
|
|
|
@@ -292,7 +298,10 @@ drops the add row, `opts.columns` (2 to 5) sets the grid, `opts.sizes` the image
|
|
|
292
298
|
A theme whose search shows list rows (Debut) fails it; every borrowed card on the page becomes
|
|
293
299
|
ours, also those that arrive after the verdict, and the tab keeps our cards
|
|
294
300
|
(`sessionStorage['callimacus.cards']`).
|
|
295
|
-
- A borrowed card with no add control of its own gets our add button under it.
|
|
301
|
+
- A borrowed card with no add control of its own gets our add button under it. One with its own keeps
|
|
302
|
+
it, and an add through it (heard from the theme's cart events) is recorded with the round of the
|
|
303
|
+
card the shopper pressed; the theme's product form adding the same variant, with no card pressed,
|
|
304
|
+
is not.
|
|
296
305
|
- At most six card requests at a time, one per product per page, failures remembered. The shared
|
|
297
306
|
part (requests, cache, swap, fallbacks) is `src/browser/card-loader.ts`.
|
|
298
307
|
|
|
@@ -320,7 +329,8 @@ The chat's adds to the bag (`src/browser/runtime/index.ts`, `src/browser/runtime
|
|
|
320
329
|
`data-outcome` `added`, `refused`, `unavailable` or `failed`), below the reply. A chapter whose
|
|
321
330
|
add ran offers no "Ask again", which would add again, and its reply is never taken for a refusal
|
|
322
331
|
when it stands alone. Both, and the line, are kept with the thread, so the next page shows the
|
|
323
|
-
round as this one did.
|
|
332
|
+
round as this one did. An add that went through is recorded with its round, as one the shopper
|
|
333
|
+
asked for.
|
|
324
334
|
- The status line says the same for a few seconds, and `callimacus:cart` on `document` tells the theme
|
|
325
335
|
(`{outcome, variantId, quantity, message?}`, `message` when it was not added).
|
|
326
336
|
- When the chat cannot tell which variant to add, it sends the option choice
|